fat-develop Mailing List for FAT Acceptance Testing Framework (Page 3)
Brought to you by:
exortech
You can subscribe to this list here.
| 2004 |
Jan
(33) |
Feb
(46) |
Mar
(10) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(9) |
Oct
|
Nov
|
Dec
|
|
From: <dmc...@us...> - 2004-02-03 22:13:29
|
Update of /cvsroot/fat/FAT/sample/Calculator/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20685/sample/Calculator/test Modified Files: Calculator Test.fat Log Message: Fixed test fixture name. Index: Calculator Test.fat =================================================================== RCS file: /cvsroot/fat/FAT/sample/Calculator/test/Calculator Test.fat,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Calculator Test.fat 14 Dec 2003 21:30:28 -0000 1.1 --- Calculator Test.fat 3 Feb 2004 22:11:13 -0000 1.2 *************** *** 1,3 **** ! @Fixture: CalculatorTests Enter: 4 --- 1,3 ---- ! @Fixture: CalculatorTest Enter: 4 |
|
From: <dmc...@us...> - 2004-02-03 22:12:12
|
Update of /cvsroot/fat/FAT/test/FAT.Test/Web/HtmlDetails In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19552/test/FAT.Test/Web/HtmlDetails Removed Files: HtmlDetailsRequestHelperTest.cs Log Message: Refactored tests for HtmlDetailsRequestHandler. Renamed some classes. --- HtmlDetailsRequestHelperTest.cs DELETED --- |
|
From: <dmc...@us...> - 2004-02-03 22:12:12
|
Update of /cvsroot/fat/FAT/src/FAT.Web/HtmlDetails In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19552/src/FAT.Web/HtmlDetails Removed Files: HtmlDetailsRequestContext.cs HtmlDetailsRequestHelper.cs IHtmlDetailsRequestContext.cs Log Message: Refactored tests for HtmlDetailsRequestHandler. Renamed some classes. --- HtmlDetailsRequestContext.cs DELETED --- --- HtmlDetailsRequestHelper.cs DELETED --- --- IHtmlDetailsRequestContext.cs DELETED --- |
|
From: Darren M. <DMc...@th...> - 2004-02-03 22:02:40
|
owen, >> Not sure about including thumbvw.dll in a distribution though? >why not? where does the dll come from? I pulled it off this site: http://dll.yaroslavl.ru/index.php3?lng=&in_char=T I think it's a Windows 2000 dll that's not part of the standard build for xp. Are there any issues with including a MS dll? darren Owen Rogers 02/02/2004 03:54 To: Darren McGrath <DMc...@th...>@THOUGHTWORKS_COM cc: fat...@li... Subject: Re: [Fat-develop] FAT Clickable Thumbnails darren, this looks sweet. thanks for putting this together. i haven't had the chance to try out the code yet, but i look forward to doing so. > I'd have preferred an approach of getting images from the InternetExplorerClass - but couldn't get it working. i can have a look at this. it should be possible to do anything that ie can do. > The tweaks required to XP are a pain, maybe it's possible to make the registry tweak at FAT start-up. sure. seems fine with me. > Not sure about including thumbvw.dll in a distribution though? why not? where does the dll come from? cheers, o. --- R. Owen Rogers ThoughtWorks Technologies (India) Pvt Ltd. ThoughtWorks - Deliver with passion! Darren McGrath <DMc...@th...> Sent by: fat...@li... 30/01/2004 20:45 To: "Owen Rogers <ORogers" cc: fat...@li... Subject: [Fat-develop] FAT Clickable Thumbnails Owen, Some notes on the clickable thumbnails ..... It should work fine on Windows 2000. On Windows XP, if you can see a thumbnail of an html file in the thumbnails view in Windows Explorer then it's working. To get it working on my XP machine I had to : 1. Install and register C:\windows\system32\thumbvw.dll. 2. Add the following registry entries: [HKEY_CLASSES_ROOT\.html\ShellEx\{BB2E617C-0920-11d1-9A0B-00C04FC2D6C1}] @ = "{EAB841A0-9550-11cf-8C16-00805F1408F3}" I used an approach of writing the html to a file and using the shell extensions to get a thumbnail of the file. I'd have preferred an approach of getting images from the InternetExplorerClass - but couldn't get it working. The tweaks required to XP are a pain, maybe it's possible to make the registry tweak at FAT start-up. Not sure about including thumbvw.dll in a distribution though? Cheers, Darren |
|
From: Owen R. <OR...@th...> - 2004-02-02 04:00:08
|
they're corrupted for me too :(. i should probably just remove them and create new ones. o. --- R. Owen Rogers ThoughtWorks Technologies (India) Pvt Ltd. 6th Floor, Tower D, Corporate Block Diamond District, Airport Road Bangalore, INDIA tel: +91 80 508 9572 mobile: +91 98451 53169 ThoughtWorks - Deliver with passion! |---------+----------------------------> | | Darren McGrath | | | | | | 01/02/2004 22:30 | |---------+----------------------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| | | | To: Owen Rogers <OR...@th...>@THOUGHTWORKS_COM | | cc: fat...@li... | | Subject: red, green, yellow.jpg | >--------------------------------------------------------------------------------------------------------------------------------------------------| Owen, the images/red, green, yellow.jpg are corrupted for me? should they be working? darren |
|
From: Owen R. <OR...@th...> - 2004-02-02 03:55:09
|
darren, this looks sweet. thanks for putting this together. i haven't had the chance to try out the code yet, but i look forward to doing so. > I'd have preferred an approach of getting images from the InternetExplorerClass - but couldn't get it working. i can have a look at this. it should be possible to do anything that ie can do. > The tweaks required to XP are a pain, maybe it's possible to make the registry tweak at FAT start-up. sure. seems fine with me. > Not sure about including thumbvw.dll in a distribution though? why not? where does the dll come from? cheers, o. --- R. Owen Rogers ThoughtWorks Technologies (India) Pvt Ltd. ThoughtWorks - Deliver with passion! |---------+---------------------------------------> | | Darren McGrath | | | <DMc...@th...> | | | Sent by: | | | fat...@li...| | | ceforge.net | | | | | | | | | 30/01/2004 20:45 | |---------+---------------------------------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| | | | To: "Owen Rogers <ORogers" | | cc: fat...@li... | | Subject: [Fat-develop] FAT Clickable Thumbnails | >--------------------------------------------------------------------------------------------------------------------------------------------------| Owen, Some notes on the clickable thumbnails ..... It should work fine on Windows 2000. On Windows XP, if you can see a thumbnail of an html file in the thumbnails view in Windows Explorer then it's working. To get it working on my XP machine I had to : 1. Install and register C:\windows\system32\thumbvw.dll. 2. Add the following registry entries: [HKEY_CLASSES_ROOT\.html\ShellEx\{BB2E617C-0920-11d1-9A0B-00C04FC2D6C1}] @ = "{EAB841A0-9550-11cf-8C16-00805F1408F3}" I used an approach of writing the html to a file and using the shell extensions to get a thumbnail of the file. I'd have preferred an approach of getting images from the InternetExplorerClass - but couldn't get it working. The tweaks required to XP are a pain, maybe it's possible to make the registry tweak at FAT start-up. Not sure about including thumbvw.dll in a distribution though? Cheers, Darren |
|
From: Darren M. <DMc...@th...> - 2004-02-01 17:00:38
|
Owen, the images/red, green, yellow.jpg are corrupted for me? should they be working? darren |
|
From: <dmc...@pr...> - 2004-02-01 15:25:36
|
Update of /cvsroot/fat/FAT/src/FAT.Web/HtmlDetails In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8539/src/FAT.Web/HtmlDetails Removed Files: HtmlDetailsRequestHandler.ashx Log Message: Removed unnecessary case statement in WebHandler. --- HtmlDetailsRequestHandler.ashx DELETED --- |
Update of /cvsroot/fat/FAT/src/FAT.Web/HtmlDetails In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7495/src/FAT.Web/HtmlDetails Modified Files: HtmlDetailsRequestContext.cs HtmlDetailsRequestHelper.cs IHtmlDetailsRequestContext.cs Added Files: Html.ashx HtmlWithAbsoluteUrls.ashx Image.ashx Log Message: Removed unnecessary case statement in WebHandler. --- NEW FILE: Html.ashx --- <!- file: Html.ashh --> <%@ WebHandler Language="C#" class="FAT.Web.HtmlDetails.Html" %> using System; using System.Web; using System.Web.SessionState; namespace FAT.Web.HtmlDetails { public class Html : IHttpHandler, IRequiresSessionState { public void ProcessRequest(HttpContext context) { HtmlDetailsRequestHelper.ReplyWithHtmlDetails(new HtmlDetailsRequestContext(context)); } public bool IsReusable {get {return true;}} } } --- NEW FILE: HtmlWithAbsoluteUrls.ashx --- <!- file: HtmlWithAbsoluteUrls.ashh --> <%@ WebHandler Language="C#" class="FAT.Web.HtmlDetails.HtmlWithAbsoluteUrls" %> using System; using System.Web; using System.Web.SessionState; namespace FAT.Web.HtmlDetails { public class HtmlWithAbsoluteUrls : IHttpHandler, IRequiresSessionState { public void ProcessRequest(HttpContext context) { HtmlDetailsRequestHelper.ReplyWithHtmlWithAbsoluteUrlsDetails(new HtmlDetailsRequestContext(context)); } public bool IsReusable {get {return true;}} } } --- NEW FILE: Image.ashx --- <!- file: Image.ashh --> <%@ WebHandler Language="C#" class="FAT.Web.HtmlDetails.Image" %> using System; using System.Web; using System.Web.SessionState; namespace FAT.Web.HtmlDetails { public class Image : IHttpHandler, IRequiresSessionState { public void ProcessRequest(HttpContext context) { HtmlDetailsRequestHelper.ReplyWithImageDetails(new HtmlDetailsRequestContext(context)); } public bool IsReusable {get {return true;}} } } Index: HtmlDetailsRequestContext.cs =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Web/HtmlDetails/HtmlDetailsRequestContext.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HtmlDetailsRequestContext.cs 28 Jan 2004 22:14:49 -0000 1.1 --- HtmlDetailsRequestContext.cs 1 Feb 2004 15:22:33 -0000 1.2 *************** *** 16,21 **** } - public string DetailsType { get {return (string)request[HtmlDetailsRequestHelper.DETAILS_TYPE_PARAMETER_NAME];} } - public Image Thumbnail {get {return htmlDetails.Thumbnail;}} public string Html { get {return htmlDetails.Html;}} --- 16,19 ---- Index: HtmlDetailsRequestHelper.cs =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Web/HtmlDetails/HtmlDetailsRequestHelper.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HtmlDetailsRequestHelper.cs 28 Jan 2004 22:14:49 -0000 1.1 --- HtmlDetailsRequestHelper.cs 1 Feb 2004 15:22:33 -0000 1.2 *************** *** 7,68 **** public class HtmlDetailsRequestHelper { ! public const string DETAILS_HANDLER_RELATIVE_URL = "HtmlDetails/HtmlDetailsRequestHandler.ashx"; public const string ID_PARAMETER_NAME = "id"; ! public const string DETAILS_TYPE_PARAMETER_NAME = "type"; ! private const string IMAGE = "image"; ! private const string HTML_WITH_ABSOLUTE_URLS = "htmlWithAbsoluteUrls"; ! private const string HTML = "html"; ! ! public static void ReplyWithAppropriateHtmlDetails(IHtmlDetailsRequestContext context) ! { ! switch (context.DetailsType) ! { ! case IMAGE: ! context.ContentType="image/jpeg"; ! context.StreamImage(context.Thumbnail); ! break; ! case HTML: ! context.ContentType="text/plain"; // how to launch notepad? ! context.StreamText(context.Html); ! break; ! case HTML_WITH_ABSOLUTE_URLS: ! context.ContentType="text/html"; ! context.StreamText(context.HtmlWithAbsoluteUrls); ! break; ! default: ! break; ! } ! } ! ! public static string CreateImageUrl(string id) { ! return DETAILS_HANDLER_RELATIVE_URL + "?" + CreateImageParameter() + "&" + CreateHtmlDetailsIdParameter(id); } ! public static string CreateHtmlUrl(string id) { ! return DETAILS_HANDLER_RELATIVE_URL + "?" + CreateHtmlParameter() + "&" + CreateHtmlDetailsIdParameter(id); } ! public static string CreateHtmlWithAbsoluteUrlsUrl(string id) { ! return DETAILS_HANDLER_RELATIVE_URL + "?" + CreateHtmlWithAbsoluteUrlsParameter() + "&" + CreateHtmlDetailsIdParameter(id); } ! private static string CreateImageParameter() { ! return DETAILS_TYPE_PARAMETER_NAME + "=" + IMAGE; } ! private static string CreateHtmlParameter() { ! return DETAILS_TYPE_PARAMETER_NAME + "=" + HTML; } ! private static string CreateHtmlWithAbsoluteUrlsParameter() { ! return DETAILS_TYPE_PARAMETER_NAME + "=" + HTML_WITH_ABSOLUTE_URLS; } --- 7,48 ---- public class HtmlDetailsRequestHelper { ! private const string NAMESPACE = "HtmlDetails/"; ! public const string IMAGE_HANDLER_RELATIVE_URL = NAMESPACE + "Image.ashx"; ! public const string HTML_HANDLER_RELATIVE_URL = NAMESPACE + "Html.ashx"; ! public const string HTML_WITH_ABSOLUTE_URLS_HANDLER_RELATIVE_URL = NAMESPACE + "HtmlWithAbsoluteUrls.ashx"; public const string ID_PARAMETER_NAME = "id"; ! public static void ReplyWithImageDetails(IHtmlDetailsRequestContext context) { ! context.ContentType="image/jpeg"; ! context.StreamImage(context.Thumbnail); } ! public static void ReplyWithHtmlDetails(IHtmlDetailsRequestContext context) { ! context.ContentType="text/plain"; // how to launch notepad? ! context.StreamText(context.Html); } ! public static void ReplyWithHtmlWithAbsoluteUrlsDetails(IHtmlDetailsRequestContext context) { ! context.ContentType="text/html"; ! context.StreamText(context.HtmlWithAbsoluteUrls); } ! public static string CreateImageUrl(string id) { ! return IMAGE_HANDLER_RELATIVE_URL + "?" + CreateHtmlDetailsIdParameter(id); } ! public static string CreateHtmlUrl(string id) { ! return HTML_HANDLER_RELATIVE_URL + "?" + CreateHtmlDetailsIdParameter(id); } ! public static string CreateHtmlWithAbsoluteUrlsUrl(string id) { ! return HTML_WITH_ABSOLUTE_URLS_HANDLER_RELATIVE_URL + "?" + CreateHtmlDetailsIdParameter(id); } Index: IHtmlDetailsRequestContext.cs =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Web/HtmlDetails/IHtmlDetailsRequestContext.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IHtmlDetailsRequestContext.cs 28 Jan 2004 22:14:49 -0000 1.1 --- IHtmlDetailsRequestContext.cs 1 Feb 2004 15:22:33 -0000 1.2 *************** *** 6,10 **** public interface IHtmlDetailsRequestContext { - string DetailsType { get; } string Html {get;} string HtmlWithAbsoluteUrls {get;} --- 6,9 ---- |
|
From: <dmc...@pr...> - 2004-02-01 15:24:27
|
Update of /cvsroot/fat/FAT/test/FAT.Test/Web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7495/test/FAT.Test/Web Modified Files: CreateTestModelTest.cs Log Message: Removed unnecessary case statement in WebHandler. Index: CreateTestModelTest.cs =================================================================== RCS file: /cvsroot/fat/FAT/test/FAT.Test/Web/CreateTestModelTest.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CreateTestModelTest.cs 1 Feb 2004 12:27:16 -0000 1.5 --- CreateTestModelTest.cs 1 Feb 2004 15:22:33 -0000 1.6 *************** *** 60,66 **** AssertEquals("NotRun", table.Rows[2].Cells[2].Text); AssertEquals("fooby", table.Rows[2].Cells[3].Text); ! AssertEquals("HtmlDetails/HtmlDetailsRequestHandler.ashx?type=image&id=999", ((HyperLink)(table.Rows[2].Cells[4].Controls[0])).ImageUrl); ! AssertEquals("HtmlDetails/HtmlDetailsRequestHandler.ashx?type=htmlWithAbsoluteUrls&id=999", ((HyperLink)(table.Rows[2].Cells[4].Controls[0])).NavigateUrl); ! AssertEquals("HtmlDetails/HtmlDetailsRequestHandler.ashx?type=html&id=999", ((HyperLink)(table.Rows[2].Cells[4].Controls[2])).NavigateUrl); } --- 60,66 ---- AssertEquals("NotRun", table.Rows[2].Cells[2].Text); AssertEquals("fooby", table.Rows[2].Cells[3].Text); ! AssertEquals("HtmlDetails/Image.ashx?id=999", ((HyperLink)(table.Rows[2].Cells[4].Controls[0])).ImageUrl); ! AssertEquals("HtmlDetails/HtmlWithAbsoluteUrls.ashx?id=999", ((HyperLink)(table.Rows[2].Cells[4].Controls[0])).NavigateUrl); ! AssertEquals("HtmlDetails/Html.ashx?id=999", ((HyperLink)(table.Rows[2].Cells[4].Controls[2])).NavigateUrl); } |
|
From: <dmc...@pr...> - 2004-02-01 15:24:26
|
Update of /cvsroot/fat/FAT/test/FAT.Test/Web/HtmlDetails In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7495/test/FAT.Test/Web/HtmlDetails Modified Files: HtmlDetailsRequestHelperTest.cs Log Message: Removed unnecessary case statement in WebHandler. Index: HtmlDetailsRequestHelperTest.cs =================================================================== RCS file: /cvsroot/fat/FAT/test/FAT.Test/Web/HtmlDetails/HtmlDetailsRequestHelperTest.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HtmlDetailsRequestHelperTest.cs 28 Jan 2004 22:14:50 -0000 1.1 --- HtmlDetailsRequestHelperTest.cs 1 Feb 2004 15:22:34 -0000 1.2 *************** *** 15,19 **** DynamicMock mockHtmlDetailsRequestContext = new DynamicMock(typeof(IHtmlDetailsRequestContext)); - mockHtmlDetailsRequestContext.ExpectAndReturn("DetailsType", "image"); mockHtmlDetailsRequestContext.Expect("ContentType", "image/jpeg"); Image image = new Bitmap(1, 1); --- 15,18 ---- *************** *** 21,25 **** mockHtmlDetailsRequestContext.Expect("StreamImage", image); ! HtmlDetailsRequestHelper.ReplyWithAppropriateHtmlDetails((IHtmlDetailsRequestContext)mockHtmlDetailsRequestContext.MockInstance); mockHtmlDetailsRequestContext.Verify(); --- 20,24 ---- mockHtmlDetailsRequestContext.Expect("StreamImage", image); ! HtmlDetailsRequestHelper.ReplyWithImageDetails((IHtmlDetailsRequestContext)mockHtmlDetailsRequestContext.MockInstance); mockHtmlDetailsRequestContext.Verify(); *************** *** 31,35 **** DynamicMock mockHtmlDetailsRequestContext = new DynamicMock(typeof(IHtmlDetailsRequestContext)); - mockHtmlDetailsRequestContext.ExpectAndReturn("DetailsType", "html"); mockHtmlDetailsRequestContext.Expect("ContentType", "text/plain"); string html = @"<a href=""relativeUrl.gif""/>"; --- 30,33 ---- *************** *** 37,41 **** mockHtmlDetailsRequestContext.Expect("StreamText", html); ! HtmlDetailsRequestHelper.ReplyWithAppropriateHtmlDetails((IHtmlDetailsRequestContext)mockHtmlDetailsRequestContext.MockInstance); mockHtmlDetailsRequestContext.Verify(); --- 35,39 ---- mockHtmlDetailsRequestContext.Expect("StreamText", html); ! HtmlDetailsRequestHelper.ReplyWithHtmlDetails((IHtmlDetailsRequestContext)mockHtmlDetailsRequestContext.MockInstance); mockHtmlDetailsRequestContext.Verify(); *************** *** 47,51 **** DynamicMock mockHtmlDetailsRequestContext = new DynamicMock(typeof(IHtmlDetailsRequestContext)); - mockHtmlDetailsRequestContext.ExpectAndReturn("DetailsType", "htmlWithAbsoluteUrls"); mockHtmlDetailsRequestContext.Expect("ContentType", "text/html"); string htmlWithAbsoluteUrls = @"<a href=""http://absolute/url.gif""/>"; --- 45,48 ---- *************** *** 53,57 **** mockHtmlDetailsRequestContext.Expect("StreamText", htmlWithAbsoluteUrls); ! HtmlDetailsRequestHelper.ReplyWithAppropriateHtmlDetails((IHtmlDetailsRequestContext)mockHtmlDetailsRequestContext.MockInstance); mockHtmlDetailsRequestContext.Verify(); --- 50,54 ---- mockHtmlDetailsRequestContext.Expect("StreamText", htmlWithAbsoluteUrls); ! HtmlDetailsRequestHelper.ReplyWithHtmlWithAbsoluteUrlsDetails((IHtmlDetailsRequestContext)mockHtmlDetailsRequestContext.MockInstance); mockHtmlDetailsRequestContext.Verify(); *************** *** 61,65 **** public void CreateImageUrl() { ! Assert.AreEqual("HtmlDetails/HtmlDetailsRequestHandler.ashx?type=image&id=999", HtmlDetailsRequestHelper.CreateImageUrl("999")); } --- 58,62 ---- public void CreateImageUrl() { ! Assert.AreEqual("HtmlDetails/Image.ashx?id=999", HtmlDetailsRequestHelper.CreateImageUrl("999")); } *************** *** 67,71 **** public void CreateHtmlUrl() { ! Assert.AreEqual("HtmlDetails/HtmlDetailsRequestHandler.ashx?type=html&id=999", HtmlDetailsRequestHelper.CreateHtmlUrl("999")); } --- 64,68 ---- public void CreateHtmlUrl() { ! Assert.AreEqual("HtmlDetails/Html.ashx?id=999", HtmlDetailsRequestHelper.CreateHtmlUrl("999")); } *************** *** 73,77 **** public void CreateHtmlWithAbsoluteUrlsUrl() { ! Assert.AreEqual("HtmlDetails/HtmlDetailsRequestHandler.ashx?type=htmlWithAbsoluteUrls&id=999", HtmlDetailsRequestHelper.CreateHtmlWithAbsoluteUrlsUrl("999")); } } --- 70,74 ---- public void CreateHtmlWithAbsoluteUrlsUrl() { ! Assert.AreEqual("HtmlDetails/HtmlWithAbsoluteUrls.ashx?id=999", HtmlDetailsRequestHelper.CreateHtmlWithAbsoluteUrlsUrl("999")); } } |
|
From: <dmc...@pr...> - 2004-02-01 15:24:26
|
Update of /cvsroot/fat/FAT/src/FAT.Web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7495/src/FAT.Web Modified Files: FAT.Web.csproj Log Message: Removed unnecessary case statement in WebHandler. Index: FAT.Web.csproj =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Web/FAT.Web.csproj,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FAT.Web.csproj 28 Jan 2004 22:14:48 -0000 1.3 --- FAT.Web.csproj 1 Feb 2004 15:22:33 -0000 1.4 *************** *** 152,168 **** /> <File ! RelPath = "HtmlDetails\HtmlDetailsEnhancer.cs" SubType = "Code" ! BuildAction = "Compile" /> <File ! RelPath = "HtmlDetails\HtmlDetailsRequestContext.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "HtmlDetails\HtmlDetailsRequestHandler.ashx" SubType = "Code" ! BuildAction = "Content" /> <File --- 152,168 ---- /> <File ! RelPath = "HtmlDetails\Html.ashx" SubType = "Code" ! BuildAction = "Content" /> <File ! RelPath = "HtmlDetails\HtmlDetailsEnhancer.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "HtmlDetails\HtmlDetailsRequestContext.cs" SubType = "Code" ! BuildAction = "Compile" /> <File *************** *** 177,180 **** --- 177,184 ---- /> <File + RelPath = "HtmlDetails\HtmlWithAbsoluteUrls.ashx" + BuildAction = "None" + /> + <File RelPath = "HtmlDetails\IEnumIDList.cs" SubType = "Code" *************** *** 197,200 **** --- 201,208 ---- /> <File + RelPath = "HtmlDetails\Image.ashx" + BuildAction = "None" + /> + <File RelPath = "HtmlDetails\ISession.cs" SubType = "Code" |
|
From: <dmc...@pr...> - 2004-02-01 12:29:08
|
Update of /cvsroot/fat/FAT/test/FAT.Test/Web/HtmlDetails In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18067/test/FAT.Test/Web/HtmlDetails Modified Files: HtmlDetailsEnhancerTest.cs Log Message: Relative urls in html is now expanded so that <img src="url" >, <a href="url" >, <form action="url" > etc. work in thumbnail creation and in IE pop-up when thumbnail is clicked. Introduced "view source" link so that original, unmodified html source is still accessible. Index: HtmlDetailsEnhancerTest.cs =================================================================== RCS file: /cvsroot/fat/FAT/test/FAT.Test/Web/HtmlDetails/HtmlDetailsEnhancerTest.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HtmlDetailsEnhancerTest.cs 28 Jan 2004 22:14:50 -0000 1.1 --- HtmlDetailsEnhancerTest.cs 1 Feb 2004 12:27:16 -0000 1.2 *************** *** 11,27 **** public class HtmlDetailsEnhancerTest : Assertion { - private string html = "<html><head><title>foo</title></head><body><b>Some Text</b><br><b>Some More Text</b><br></body></html>"; - private string url = "http://testhost/testpath/test.aspx"; - private HtmlDetailsEnhancer htmlDetailsEnhancer; - - [SetUp] - public void CreateObjectToTest() - { - htmlDetailsEnhancer = new HtmlDetailsEnhancer(url, html); - } - [Test] public void Construction() { AssertEquals(html, htmlDetailsEnhancer.Html); AssertEquals(url, htmlDetailsEnhancer.Url); --- 11,21 ---- public class HtmlDetailsEnhancerTest : Assertion { [Test] public void Construction() { + string html = "<html></html>"; + string url = "http://testhost/testpath/test.aspx"; + HtmlDetailsEnhancer htmlDetailsEnhancer = new HtmlDetailsEnhancer(url, html); + AssertEquals(html, htmlDetailsEnhancer.Html); AssertEquals(url, htmlDetailsEnhancer.Url); *************** *** 31,34 **** --- 25,32 ---- public void Image() { + string html = "<html><head><title>foo</title></head><body><b>Some Text</b><br><b>Some More Text</b><br></body></html>"; + string url = "http://testhost/testpath/test.aspx"; + HtmlDetailsEnhancer htmlDetailsEnhancer = new HtmlDetailsEnhancer(url, html); + AssertNotNull(htmlDetailsEnhancer.Thumbnail); Assert(htmlDetailsEnhancer.Thumbnail.Height >10); *************** *** 36,43 **** } - // TODO: expand urls [Test] ! public void HtmlWithAbsoluteUrls() { } } --- 34,104 ---- } [Test] ! public void UrlRoot() { + HtmlDetailsEnhancer htmlDetailsEnhancer = new HtmlDetailsEnhancer("http://localhost/FAT.Web/PageVisited.aspx", "<html/>"); + AssertEquals("http://localhost/FAT.Web", htmlDetailsEnhancer.UrlRoot); + + htmlDetailsEnhancer = new HtmlDetailsEnhancer("http://www.google.co.uk", "<html/>"); + AssertEquals("http://www.google.co.uk", htmlDetailsEnhancer.UrlRoot); + } + + [Test] + public void UrlHost() + { + HtmlDetailsEnhancer htmlDetailsEnhancer = new HtmlDetailsEnhancer("http://localhost/FAT.Web/PageVisited.aspx", "<html/>"); + AssertEquals("http://localhost", htmlDetailsEnhancer.UrlHost); + + htmlDetailsEnhancer = new HtmlDetailsEnhancer("http://www.google.co.uk", "<html/>"); + AssertEquals("http://www.google.co.uk", htmlDetailsEnhancer.UrlHost); + } + + [Test] + public void ExpandsFolderRelativeUrlsToBeAbsolute() + { + AssertHtmlExpansion("http://localhost/FAT.Web/PageVisited.aspx", + @"<form name=""CreateTest"" method=""post"" action = ""PageToPostTo.aspx"" id=""CreateTest"">", + @"<form name=""CreateTest"" method=""post"" action = ""http://localhost/FAT.Web/PageToPostTo.aspx"" id=""CreateTest"">"); + + AssertHtmlExpansion("http://www.google.co.uk", + @"<form name= ""CreateTest"" method=""post"" action= ""PageToPostTo.aspx"" id=""CreateTest"">", + @"<form name= ""CreateTest"" method=""post"" action= ""http://www.google.co.uk/PageToPostTo.aspx"" id=""CreateTest"">"); + } + + [Test] + public void ExpandsHostRelativeUrlsToBeAbsolute() + { + AssertHtmlExpansion("http://localhost/FAT.Web/PageVisited.aspx", + @"<form name=""CreateTest"" method=""post"" action =""/FAT.Web2/PageToPostTo.aspx"" id=""CreateTest"">", + @"<form name=""CreateTest"" method=""post"" action =""http://localhost/FAT.Web2/PageToPostTo.aspx"" id=""CreateTest"">"); + + AssertHtmlExpansion("http://www.google.co.uk", + @"<img src =""/intl/en_uk/images/logo.gif"" width=276 height=110 alt=""Google"">", + @"<img src =""http://www.google.co.uk/intl/en_uk/images/logo.gif"" width=276 height=110 alt=""Google"">"); + } + + [Test] + public void ExpandsRelativeUrlsToBeAbsoluteWhereThereAreMultipleOccurences() + { + string htmlFragment = @"<form name= ""CreateTest"" method=""post"" \naction= ""PageToPostTo.aspx"" id=""CreateTest"">\n"; + string expectedHtmlFragment = @"<form name= ""CreateTest"" method=""post"" \naction= ""http://www.google.co.uk/PageToPostTo.aspx"" id=""CreateTest"">\n"; + AssertHtmlExpansion("http://www.google.co.uk", htmlFragment + htmlFragment, expectedHtmlFragment + expectedHtmlFragment); + + htmlFragment = @"<img src =""/intl/en_uk/images/logo.gif"" width=276 height=110 alt=""Google"">\n\r"; + expectedHtmlFragment = @"<img src =""http://www.google.co.uk/intl/en_uk/images/logo.gif"" width=276 height=110 alt=""Google"">\n\r"; + AssertHtmlExpansion("http://www.google.co.uk", htmlFragment + htmlFragment, expectedHtmlFragment + expectedHtmlFragment); + } + + [Test] + public void LeavesUntouchedAbsoluteUrls() + { + string html = @"<form name=""CreateTest"" method=""post"" action=""http://localhost2/FAT.Web2/PageToPostTo.aspx"" id=""CreateTest"">"; + AssertHtmlExpansion("http://localhost/FAT.Web/PageVisited.aspx", html, html); + } + + private void AssertHtmlExpansion(string url, string html, string expectedExpandedHtml) + { + HtmlDetailsEnhancer htmlDetailsEnhancer = new HtmlDetailsEnhancer(url, html); + Assertion.AssertEquals(expectedExpandedHtml, htmlDetailsEnhancer.HtmlWithAbsoluteUrls); } } |
|
From: <dmc...@pr...> - 2004-02-01 12:29:08
|
Update of /cvsroot/fat/FAT/test/FAT.Test/Web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18067/test/FAT.Test/Web Modified Files: CreateTestModelTest.cs Log Message: Relative urls in html is now expanded so that <img src="url" >, <a href="url" >, <form action="url" > etc. work in thumbnail creation and in IE pop-up when thumbnail is clicked. Introduced "view source" link so that original, unmodified html source is still accessible. Index: CreateTestModelTest.cs =================================================================== RCS file: /cvsroot/fat/FAT/test/FAT.Test/Web/CreateTestModelTest.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CreateTestModelTest.cs 28 Jan 2004 22:14:49 -0000 1.4 --- CreateTestModelTest.cs 1 Feb 2004 12:27:16 -0000 1.5 *************** *** 62,65 **** --- 62,66 ---- AssertEquals("HtmlDetails/HtmlDetailsRequestHandler.ashx?type=image&id=999", ((HyperLink)(table.Rows[2].Cells[4].Controls[0])).ImageUrl); AssertEquals("HtmlDetails/HtmlDetailsRequestHandler.ashx?type=htmlWithAbsoluteUrls&id=999", ((HyperLink)(table.Rows[2].Cells[4].Controls[0])).NavigateUrl); + AssertEquals("HtmlDetails/HtmlDetailsRequestHandler.ashx?type=html&id=999", ((HyperLink)(table.Rows[2].Cells[4].Controls[2])).NavigateUrl); } |
|
From: <dmc...@pr...> - 2004-02-01 12:29:08
|
Update of /cvsroot/fat/FAT/src/FAT.Web/HtmlDetails In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18067/src/FAT.Web/HtmlDetails Modified Files: HtmlDetailsEnhancer.cs Log Message: Relative urls in html is now expanded so that <img src="url" >, <a href="url" >, <form action="url" > etc. work in thumbnail creation and in IE pop-up when thumbnail is clicked. Introduced "view source" link so that original, unmodified html source is still accessible. Index: HtmlDetailsEnhancer.cs =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Web/HtmlDetails/HtmlDetailsEnhancer.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HtmlDetailsEnhancer.cs 28 Jan 2004 22:14:49 -0000 1.1 --- HtmlDetailsEnhancer.cs 1 Feb 2004 12:27:15 -0000 1.2 *************** *** 1,3 **** --- 1,4 ---- using System; + using System.Text.RegularExpressions; using System.Drawing; using System.IO; *************** *** 8,12 **** public class HtmlDetailsEnhancer { ! private const int screenWidth = 1400; private const int screenHeight = 1050; private const int scalingFactor = 8; --- 9,13 ---- public class HtmlDetailsEnhancer { ! private const int screenWidth = 1050; private const int screenHeight = 1050; private const int scalingFactor = 8; *************** *** 35,40 **** public string HtmlWithAbsoluteUrls { ! // TODO: expand all urls in the html to be absolute url so that the page functions correctly (in most cases) when fetched from the FAT site. ! get {return html;} } --- 36,52 ---- public string HtmlWithAbsoluteUrls { ! // here we expand urls in the html to be absolute urls so that the page functions correctly when ! // fetched from the FAT site or when viewed as a thumbnail. This means expanding relative urls to be ! // absolute for all <img src="">, <form action="">, <a href=""> etc. ! // it's not perfect - just good enough - urls embedded in javascript etc. are not caught, ! // RegExes works only where attribute values is enclosed in "". ! get ! { ! string expandingHtml = html; ! expandingHtml = ExpandRelativeUrls(expandingHtml, "form", "action"); ! expandingHtml = ExpandRelativeUrls(expandingHtml, "img", "src"); ! expandingHtml = ExpandRelativeUrls(expandingHtml, "a", "img"); ! return expandingHtml; ! } } *************** *** 44,51 **** } private Image CreateImage() { string temporaryFileName = GetTemporaryFileName(); ! WriteHtmlToFile(temporaryFileName); Image image = CreateImageFromFile(temporaryFileName); DeleteTemporaryFile(temporaryFileName); --- 56,83 ---- } + public string UrlRoot { get { return Regex.Replace(url, "(http://.*)/.*$", "$1"); }} + public string UrlHost { get { return Regex.Replace(url, "(http://.*?)/.*", "$1"); }} + + private string ExpandRelativeUrls(string html, string element, string attribute) + { + return ExpandHostRelativeUrls(ExpandFolderRelativeUrls(html, element, attribute), element, attribute); + } + + private string ExpandFolderRelativeUrls(string html, string element, string attribute) + { + // Example: Default.aspx => http://localhost/FAT.Web/Default.aspx + return Regex.Replace(html, "(<" + element + " .*?" + attribute + @"\s*=\s*"")((?(http://|/)no).*?"".*?>)", "$1" + UrlRoot + "/$2", RegexOptions.Singleline); + } + + private string ExpandHostRelativeUrls(string html, string element, string attribute) + { + // Example: /FAT.Web/Default.aspx => http://localhost/FAT.Web/Default.aspx + return Regex.Replace(html, "(<" + element + " .*?" + attribute + @"\s*=\s*"")((?(http://)no).*?"".*?>)", "$1" + UrlHost + "$2", RegexOptions.Singleline); + } + private Image CreateImage() { string temporaryFileName = GetTemporaryFileName(); ! WriteHtmlWithAbsoluteUrlsToFile(temporaryFileName); Image image = CreateImageFromFile(temporaryFileName); DeleteTemporaryFile(temporaryFileName); *************** *** 58,65 **** } ! private void WriteHtmlToFile(string fileName) { StreamWriter writer = new StreamWriter(fileName); ! writer.Write(html); writer.Close(); } --- 90,97 ---- } ! private void WriteHtmlWithAbsoluteUrlsToFile(string fileName) { StreamWriter writer = new StreamWriter(fileName); ! writer.Write(HtmlWithAbsoluteUrls); writer.Close(); } |
|
From: <dmc...@pr...> - 2004-02-01 12:29:07
|
Update of /cvsroot/fat/FAT/src/FAT.Web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18067/src/FAT.Web Modified Files: DefaultPageModel.cs Log Message: Relative urls in html is now expanded so that <img src="url" >, <a href="url" >, <form action="url" > etc. work in thumbnail creation and in IE pop-up when thumbnail is clicked. Introduced "view source" link so that original, unmodified html source is still accessible. Index: DefaultPageModel.cs =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Web/DefaultPageModel.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DefaultPageModel.cs 28 Jan 2004 22:14:48 -0000 1.4 --- DefaultPageModel.cs 1 Feb 2004 12:27:15 -0000 1.5 *************** *** 66,70 **** { string id = htmlDetailsStore.Add(new HtmlDetailsEnhancer(HtmlDetailsLog.Url, HtmlDetailsLog.Html)); ! return CreateImageHyperLinkCell(HtmlDetailsRequestHelper.CreateImageUrl(id), HtmlDetailsRequestHelper.CreateHtmlWithAbsoluteUrlsUrl(id)); } } --- 66,70 ---- { string id = htmlDetailsStore.Add(new HtmlDetailsEnhancer(HtmlDetailsLog.Url, HtmlDetailsLog.Html)); ! return CreateImageHyperLinkCell(HtmlDetailsRequestHelper.CreateImageUrl(id), HtmlDetailsRequestHelper.CreateHtmlWithAbsoluteUrlsUrl(id), HtmlDetailsRequestHelper.CreateHtmlUrl(id)); } } *************** *** 92,103 **** } ! private TableCell CreateImageHyperLinkCell(string imageUrl, string clickUrl) { HyperLink image = new HyperLink(); ! image.NavigateUrl = clickUrl; image.ImageUrl = imageUrl; image.Target = "_blank"; ! return CreateTableCell(image); } --- 92,114 ---- } ! private TableCell CreateImageHyperLinkCell(string imageUrl, string htmlWithAbsoluteUrlsUrl, string htmlUrl) { + TableCell cell = new TableCell(); + HyperLink image = new HyperLink(); ! image.NavigateUrl = htmlWithAbsoluteUrlsUrl; image.ImageUrl = imageUrl; image.Target = "_blank"; + cell.Controls.Add(image); ! cell.Controls.Add(new LiteralControl("<br>")); ! ! HyperLink href = new HyperLink(); ! href.NavigateUrl = htmlUrl; ! href.Text = "view source"; ! href.Target = "_blank"; ! cell.Controls.Add(href); ! ! return cell; } |
|
From: Darren M. <DMc...@th...> - 2004-01-30 20:32:38
|
Owen,
Some notes on the clickable thumbnails .....
It should work fine on Windows 2000.
On Windows XP, if you can see a thumbnail of an html file in the
thumbnails view in Windows Explorer then it's working. To get it working
on my XP machine I had to :
1. Install and register C:\windows\system32\thumbvw.dll.
2. Add the following registry entries:
[HKEY_CLASSES_ROOT\.html\ShellEx\{BB2E617C-0920-11d1-9A0B-00C04FC2D6C1}]
@ = "{EAB841A0-9550-11cf-8C16-00805F1408F3}"
I used an approach of writing the html to a file and using the shell
extensions to get a thumbnail of the file. I'd have preferred an approach
of getting images from the InternetExplorerClass - but couldn't get it
working.
The tweaks required to XP are a pain, maybe it's possible to make the
registry tweak at FAT start-up. Not sure about including thumbvw.dll in a
distribution though?
Cheers,
Darren |
|
From: <dmc...@pr...> - 2004-01-30 17:22:21
|
Update of /cvsroot/fat/FAT/src/FAT.Web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20467/src/FAT.Web Modified Files: Web.config Log Message: fixed previous unintentional commit Index: Web.config =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Web/Web.config,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Web.config 28 Jan 2004 22:14:48 -0000 1.4 --- Web.config 30 Jan 2004 17:20:47 -0000 1.5 *************** *** 8,15 **** <FAT> <Assemblies> ! <Assembly>C:\dev\FAT\build\FAT.Acceptance.dll</Assembly> </Assemblies> <TestPaths> ! <TestPath>C:\dev\FAT\sample\Calculator</TestPath> </TestPaths> </FAT> --- 8,15 ---- <FAT> <Assemblies> ! <Assembly>D:\dev\FAT\build\FAT.Acceptance.dll</Assembly> </Assemblies> <TestPaths> ! <TestPath>D:\dev\FAT\sample\Calculator</TestPath> </TestPaths> </FAT> |
Update of /cvsroot/fat/FAT/src/FAT.Web/HtmlDetails In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13246/src/FAT.Web/HtmlDetails Added Files: HtmlDetailsEnhancer.cs HtmlDetailsRequestContext.cs HtmlDetailsRequestHandler.ashx HtmlDetailsRequestHelper.cs HtmlDetailsStore.cs IEnumIDList.cs IExtractImage.cs IHtmlDetailsRequestContext.cs IHtmlDetailsStore.cs ISession.cs IShellFolder.cs Session.cs Shell32.cs Shell32Exception.cs Log Message: Can now add HtmlDetails to TestLogger in FATFixtures. Details are dislayed in test results as clickable thumbnails in FAT.Web --- NEW FILE: HtmlDetailsEnhancer.cs --- using System; using System.Drawing; using System.IO; using System.Runtime.InteropServices; namespace FAT.Web.HtmlDetails { public class HtmlDetailsEnhancer { private const int screenWidth = 1400; private const int screenHeight = 1050; private const int scalingFactor = 8; private static Size size = new Size(screenWidth/scalingFactor, screenHeight/scalingFactor); private const int bitsPerPixel = 32; private string html; private string url; public HtmlDetailsEnhancer(string url, string html) { this.url = url; this.html = html; } public string Url { get {return url;} } public string Html { get {return html;} } public string HtmlWithAbsoluteUrls { // TODO: expand all urls in the html to be absolute url so that the page functions correctly (in most cases) when fetched from the FAT site. get {return html;} } public Image Thumbnail { get {return CreateImage();} } private Image CreateImage() { string temporaryFileName = GetTemporaryFileName(); WriteHtmlToFile(temporaryFileName); Image image = CreateImageFromFile(temporaryFileName); DeleteTemporaryFile(temporaryFileName); return image; } private string GetTemporaryFileName() { return Path.GetTempFileName() + ".html"; } private void WriteHtmlToFile(string fileName) { StreamWriter writer = new StreamWriter(fileName); writer.Write(html); writer.Close(); } private void DeleteTemporaryFile(string temporaryFileName) { File.Delete(temporaryFileName); File.Delete(Path.GetDirectoryName(temporaryFileName) + "\\" + Path.GetFileNameWithoutExtension(temporaryFileName)); } private Bitmap CreateImageFromFile(String path) { String folder = Path.GetDirectoryName(path); String file = Path.GetFileName(path); IShellFolder desktopFolder = GetDesktopShellFolder(); IShellFolder targetFolder = GetShellFolder(desktopFolder, folder); IExtractImage image = GetImageForFile(targetFolder, file); return GetBitmap(image); } private IShellFolder GetDesktopShellFolder() { IShellFolder desktopFolder = null; UInt32 hr = Shell32.SHGetDesktopFolder(out desktopFolder); CheckReturnAndConditionForFailure(hr, desktopFolder == null, "SHGetDesktopFolder failed."); return desktopFolder; } private IShellFolder GetShellFolder(IShellFolder desktopFolder, string folder) { IntPtr folderPidl = GetPIDLForFolder(desktopFolder, folder); Object shellFolder = null; Guid guid = typeof(IShellFolder).GUID; UInt32 hr = desktopFolder.BindToObject(folderPidl, IntPtr.Zero, ref guid, out shellFolder); CheckReturnAndConditionForFailure(hr, shellFolder == null, "BindToObject (ShellFolder) failed"); return (IShellFolder)shellFolder; } private IExtractImage GetImageForFile(IShellFolder targetFolder, string file) { IntPtr filePidl = GetPIDLForFolder(targetFolder, file); Guid guid = typeof(IExtractImage).GUID; UInt32 prfgInOut = 0; object extractedImage = null; UInt32 hr = targetFolder.GetUIObjectOf(IntPtr.Zero, 1, new IntPtr[] {filePidl}, ref guid, ref prfgInOut, out extractedImage); CheckReturnAndConditionForFailure(hr, extractedImage == null, "GetUIObjectOf (ExtractImage) failed"); return (IExtractImage)extractedImage; } [DllImport("Gdi32.dll")] private static extern Boolean DeleteObject(IntPtr hObject); private Bitmap GetBitmap(IExtractImage extract) { String retPath = ""; UInt32 pdwPriority = 0; UInt32 flags = Convert.ToUInt32(IEIFLAG.QUALITY); UInt32 hr = extract.GetLocation(out retPath, 1, ref pdwPriority, ref size, bitsPerPixel, ref flags); CheckReturnAndConditionForFailure(hr, false, "GetLocation failed"); IntPtr hBitmap = IntPtr.Zero; hr = extract.Extract(out hBitmap); CheckConditionForFailure(hr, (!Success(hr) && hr!=1) || hBitmap == IntPtr.Zero, "Extract failed"); Bitmap result = Bitmap.FromHbitmap(hBitmap); DeleteObject(hBitmap); return result; } private IntPtr GetPIDLForFolder(IShellFolder desktopFolder, string folder) { Int32 pchEaten = 0; UInt32 attr =0; IntPtr folderPidl; UInt32 hr = desktopFolder.ParseDisplayName(IntPtr.Zero, 0, folder, ref pchEaten, out folderPidl, ref attr); CheckReturnAndConditionForFailure(hr, folderPidl == IntPtr.Zero, "ParseDisplayName failed for folder " + folder); return folderPidl; } private void CheckReturnAndConditionForFailure(UInt32 hr, bool failureCondition, string message) { ThrowExceptionOncondition(!Success(hr) || failureCondition, hr, message); } private void CheckConditionForFailure(UInt32 hr, bool failureCondition, string message) { ThrowExceptionOncondition(failureCondition, hr, message); } private void ThrowExceptionOncondition(bool failureCondition, UInt32 hr, string message) { if (failureCondition) { throw new Shell32Exception(hr, message); } } private static Boolean Success(UInt32 hr) { return (hr==0); } } } --- NEW FILE: HtmlDetailsRequestContext.cs --- using System.Web; using System.Web.SessionState; using System.IO; using System.Drawing; using System.Drawing.Imaging; namespace FAT.Web.HtmlDetails { public class HtmlDetailsRequestContext : IHtmlDetailsRequestContext { private HttpContext context; public HtmlDetailsRequestContext(HttpContext context) { this.context = context; } public string DetailsType { get {return (string)request[HtmlDetailsRequestHelper.DETAILS_TYPE_PARAMETER_NAME];} } public Image Thumbnail {get {return htmlDetails.Thumbnail;}} public string Html { get {return htmlDetails.Html;}} public string HtmlWithAbsoluteUrls {get {return htmlDetails.HtmlWithAbsoluteUrls;}} public string ContentType { set {response.ContentType = value;}} public void StreamImage(Image image) { image.Save(response.OutputStream, ImageFormat.Jpeg); } public void StreamText(string text) { StreamWriter writer = new StreamWriter(response.OutputStream); writer.Write(text); writer.Close(); } private HtmlDetailsEnhancer htmlDetails { get {return HtmlDetailsStore.Instance(new Session(session)).Get(detailsId);} } private string detailsId { get {return (string)request[HtmlDetailsRequestHelper.ID_PARAMETER_NAME];} } private HttpRequest request { get {return context.Request;}} private HttpResponse response { get {return context.Response;}} private HttpSessionState session { get {return context.Session;}} } } --- NEW FILE: HtmlDetailsRequestHandler.ashx --- <!- file: ImageHandler.asph --> <%@ WebHandler Language="C#" Class="FAT.Web.HtmlDetails.HtmlDetailsRequestHandler" %> using System; using System.Web; using System.Web.SessionState; namespace FAT.Web.HtmlDetails { public class HtmlDetailsRequestHandler : IHttpHandler, IRequiresSessionState { public void ProcessRequest(HttpContext context) { HtmlDetailsRequestHelper.ReplyWithAppropriateHtmlDetails(new HtmlDetailsRequestContext(context)); } public bool IsReusable {get {return true;}} } } --- NEW FILE: HtmlDetailsRequestHelper.cs --- using System.Drawing.Imaging; using System.IO; using System.Web.SessionState; namespace FAT.Web.HtmlDetails { public class HtmlDetailsRequestHelper { public const string DETAILS_HANDLER_RELATIVE_URL = "HtmlDetails/HtmlDetailsRequestHandler.ashx"; public const string ID_PARAMETER_NAME = "id"; public const string DETAILS_TYPE_PARAMETER_NAME = "type"; private const string IMAGE = "image"; private const string HTML_WITH_ABSOLUTE_URLS = "htmlWithAbsoluteUrls"; private const string HTML = "html"; public static void ReplyWithAppropriateHtmlDetails(IHtmlDetailsRequestContext context) { switch (context.DetailsType) { case IMAGE: context.ContentType="image/jpeg"; context.StreamImage(context.Thumbnail); break; case HTML: context.ContentType="text/plain"; // how to launch notepad? context.StreamText(context.Html); break; case HTML_WITH_ABSOLUTE_URLS: context.ContentType="text/html"; context.StreamText(context.HtmlWithAbsoluteUrls); break; default: break; } } public static string CreateImageUrl(string id) { return DETAILS_HANDLER_RELATIVE_URL + "?" + CreateImageParameter() + "&" + CreateHtmlDetailsIdParameter(id); } public static string CreateHtmlUrl(string id) { return DETAILS_HANDLER_RELATIVE_URL + "?" + CreateHtmlParameter() + "&" + CreateHtmlDetailsIdParameter(id); } public static string CreateHtmlWithAbsoluteUrlsUrl(string id) { return DETAILS_HANDLER_RELATIVE_URL + "?" + CreateHtmlWithAbsoluteUrlsParameter() + "&" + CreateHtmlDetailsIdParameter(id); } private static string CreateImageParameter() { return DETAILS_TYPE_PARAMETER_NAME + "=" + IMAGE; } private static string CreateHtmlParameter() { return DETAILS_TYPE_PARAMETER_NAME + "=" + HTML; } private static string CreateHtmlWithAbsoluteUrlsParameter() { return DETAILS_TYPE_PARAMETER_NAME + "=" + HTML_WITH_ABSOLUTE_URLS; } private static string CreateHtmlDetailsIdParameter(string id) { return ID_PARAMETER_NAME + "=" + id; } } } --- NEW FILE: HtmlDetailsStore.cs --- using System; using System.Collections; using System.Web.SessionState; namespace FAT.Web.HtmlDetails { public class HtmlDetailsStore : IHtmlDetailsStore { private const string SESSION_KEY = "HtmlDetailsStore"; private Hashtable cache = new Hashtable(); private static int currentId = 1; private HtmlDetailsStore() {} public static void CreateInstance(ISession session) { session[SESSION_KEY] = new HtmlDetailsStore(); } public static IHtmlDetailsStore Instance(ISession session) { return (IHtmlDetailsStore)session[SESSION_KEY]; } public HtmlDetailsEnhancer Get(string id) { return (HtmlDetailsEnhancer)cache[id]; } public string Add(HtmlDetailsEnhancer htmlDetailsEnhancer) { string id = GetNextId(); cache.Add(id, htmlDetailsEnhancer); return id; } private string GetNextId() { lock (this) { return (currentId++).ToString(); } } } } --- NEW FILE: IEnumIDList.cs --- using System; using System.Runtime.InteropServices; namespace FAT.Web.HtmlDetails { /// <summary> /// Summary description for IEnumIDList. /// </summary> [ ComImport(), Guid("000214F2-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown) ] internal interface IEnumIDList { [PreserveSig()] uint Next( int celt, [MarshalAs(UnmanagedType.LPArray)] IntPtr[] rgelt, out int pceltFetched); void Skip( int celt); void Reset(); void Clone( out IEnumIDList ppenum); } } --- NEW FILE: IExtractImage.cs --- using System; using System.Drawing; using System.Runtime.InteropServices; namespace FAT.Web.HtmlDetails { /// <summary> /// Flags used for IExtractImage.GetLocation /// </summary> [Flags()] public enum IEIFLAG : uint { /// <summary> /// Used to ask the object if it supports asynchronous (free-threaded) extraction. If this flag is set, IExtractImage::GetLocation may return E_PENDING, indicating the wish to run the extract on another thread. If E_PENDING is returned, the priority of the item is returned in pdwPriority. /// </summary> ASYNC = 0x0001, /// <summary> /// Returned by the object to indicate that it will not cache the image. If this flag is returned, the Shell will cache a copy of the image. /// </summary> CACHE = 0x0002, /// <summary> /// Used to ask the object to use the supplied aspect ratio. If this flag is set, a rectangle with the desired aspect ratio will be passed in prgSize. This flag cannot be used with IEIFLAG_SCREEN. /// </summary> ASPECT = 0x0004, /// <summary> /// Used to tell the object to use only local content for rendering. /// </summary> OFFLINE = 0x0008, /// <summary> /// Not Supported. /// </summary> GLEAM = 0x0010, /// <summary> /// Used to tell the object to render as if for the screen. This flag cannot be used with IEIFLAG_ASPECT. /// </summary> SCREEN = 0x0020, /// <summary> /// Used to tell the object to render the image to the approximate size passed in prgSize, but crop it if necessary. /// </summary> ORIGSIZE = 0x0040, /// <summary> /// Not Supported. /// </summary> NOSTAMP = 0x0080, /// <summary> /// Not Supported. /// </summary> NOBORDER = 0x0100, /// <summary> /// Passed to the IExtractImage.Extract method to indicate that a higher quality image is requested. /// </summary> QUALITY = 0x0200 } /// <summary> /// The IExtractImage interface is used to request a thumbnail image from a Shell folder. /// </summary> [ ComImport(), Guid("BB2E617C-0920-11d1-9A0B-00C04FC2D6C1"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown) ] internal interface IExtractImage { /// <summary> /// Used to request the path description of an image and specify how the image should be rendered. /// </summary> /// <remarks><a href="http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/ifaces/iextractimage/GetLocation.asp">See MSDN.</a></remarks> [PreserveSig()] UInt32 GetLocation( [Out(), MarshalAs(UnmanagedType.LPWStr, SizeParamIndex=1)] out String path, UInt32 cchMax, [In(),Out()] ref UInt32 pdwPriority, [In()] ref Size size, UInt32 depth, [In()][Out()] ref UInt32 flags); /// <summary> /// Used to request an image from an object, such as an item in a Shell folder. /// </summary> /// <remarks><a href="http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/ifaces/iextractimage/Extract.asp">See MSDN.</a></remarks> [PreserveSig()] UInt32 Extract(out System.IntPtr hbmp); } } --- NEW FILE: IHtmlDetailsRequestContext.cs --- using System.IO; using System.Drawing; namespace FAT.Web.HtmlDetails { public interface IHtmlDetailsRequestContext { string DetailsType { get; } string Html {get;} string HtmlWithAbsoluteUrls {get;} Image Thumbnail {get;} string ContentType { set ;} void StreamText(string text); void StreamImage(Image image); } } --- NEW FILE: IHtmlDetailsStore.cs --- using System; using System.Collections; namespace FAT.Web.HtmlDetails { public interface IHtmlDetailsStore { HtmlDetailsEnhancer Get(string id); string Add(HtmlDetailsEnhancer htmlDetailsEnhancer); } } --- NEW FILE: ISession.cs --- using System; using System.Web.SessionState; namespace FAT.Web.HtmlDetails { public interface ISession { object this[string stringIndex] {get; set;} } } --- NEW FILE: IShellFolder.cs --- using System; using System.Runtime.InteropServices; namespace FAT.Web.HtmlDetails { [ ComImport(), Guid("000214E6-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown) ] internal interface IShellFolder { /// <summary> /// Translates a file object's or folder's display name into an item identifier list. /// </summary> /// <remarks><a href="http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/ifaces/ishellfolder/ParseDisplayName.asp">See MSDN.</a></remarks> [PreserveSig()] UInt32 ParseDisplayName( IntPtr hwnd, Int32 pdcReserved, String displayName, ref Int32 pchEaten, out IntPtr ppidl, ref UInt32 attr); /// <summary> /// Allows a client to determine the contents of a folder by creating an item identifier enumeration object and returning its IEnumIDList interface. The methods supported by that interface can then be used to enumerate the folder's contents. /// </summary> /// <remarks><a href="http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/ifaces/ishellfolder/EnumObjects.asp">See MSDN.</a></remarks> [PreserveSig()] UInt32 EnumObjects( IntPtr hwnd, SHCONTF grfFlags, out IEnumIDList pidl); /// <summary> /// Retrieves an IShellFolder object for a subfolder. /// </summary> /// <remarks><a href="http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/ifaces/ishellfolder/BindToObject.asp">See MSDN.</a></remarks> [PreserveSig()] UInt32 BindToObject( IntPtr pidl, IntPtr pdcReserved, [In()]ref System.Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppv); /// <summary> /// Requests a pointer to an object's storage interface. /// </summary> /// <remarks><a href="http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/ifaces/ishellfolder/BindToStorage.asp">See MSDN.</a></remarks> [PreserveSig()] UInt32 BindToStorage( IntPtr pidl, IntPtr pdcReserved, ref System.Guid riid, ref IntPtr ppvOut); /// <summary> /// Determines the relative order of two file objects or folders, given their item identifier lists. /// </summary> /// <remarks><a href="http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/ifaces/ishellfolder/CompareIDs.asp">See MSDN.</a></remarks> [PreserveSig()] UInt32 CompareIDs( Int32 lParam, IntPtr pidl1, IntPtr pidl2); /// <summary> /// Requests an object that can be used to obtain information from or interact with a folder object. /// </summary> /// <remarks><a href="http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/ifaces/ishellfolder/CreateViewObject.asp">See MSDN.</a></remarks> [PreserveSig()] UInt32 CreateViewObject( IntPtr hwnd, System.Guid riid, ref IntPtr ppvOut); /// <summary> /// Retrieves the attributes of one or more file objects or subfolders. /// </summary> /// <remarks><a href="http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/ifaces/ishellfolder/GetAttributesOf.asp">See MSDN.</a></remarks> [PreserveSig()] UInt32 GetAttributesOf( Int32 cidl, IntPtr apidl, ref Int32 rgfInOut); /// <summary> /// Retrieves an OLE interface that can be used to carry out actions on the specified file objects or folders. /// </summary> /// <remarks><a href="http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/ifaces/ishellfolder/GetUIObjectOf.asp">See MSDN.</a></remarks> [PreserveSig()] UInt32 GetUIObjectOf( IntPtr hwnd, UInt32 cidl, [In(), MarshalAs(UnmanagedType.LPArray)] IntPtr[] apidl, [In()] ref System.Guid riid, ref UInt32 prfgInOut, [Out()][MarshalAs(UnmanagedType.Interface)] out object ppvOut); /// <summary> /// Retrieves the display name for the specified file object or subfolder. /// </summary> /// <remarks><a href="http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/ifaces/ishellfolder/GetDisplayNameOf.asp">See MSDN.</a></remarks> [PreserveSig()] UInt32 GetDisplayNameOf( IntPtr pidl, SHGDN uFlags, out STRRET lpName); /// <summary> /// Sets the display name of a file object or subfolder, changing the item identifier in the process. /// </summary> /// <remarks><a href="http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/ifaces/ishellfolder/SetNameOf.asp">See MSDN.</a></remarks> [PreserveSig()] UInt32 SetNameOf( IntPtr hwnd, IntPtr pidl, String lpszName, Int32 uFlags, ref Int32 ppidlOut); } } --- NEW FILE: Session.cs --- using System; using System.Web.SessionState; namespace FAT.Web.HtmlDetails { public class Session : ISession { private HttpSessionState session; public Session(HttpSessionState session) { this.session = session; } public object this[string stringIndex] { get {return session[stringIndex];} set {session[stringIndex] = value;} } } } --- NEW FILE: Shell32.cs --- using System; using System.Runtime.InteropServices; namespace FAT.Web.HtmlDetails { /// <summary> /// Contains strings returned from the IShellFolder interface methods. /// </summary> [StructLayout(LayoutKind.Explicit)] public struct STRRET { /// <summary> /// Value that specifies the desired format of the string. /// </summary> [FieldOffset(0)] public int uType; /// <summary> /// Pointer to the OLE string. This memory must be allocated with the Shell's allocator (see SHGetMalloc). It is the calling application's responsibility to free this memory when it is no longer needed. The Shell's allocator must be used to free the memory. /// </summary> [FieldOffset(4)] public IntPtr pOleStr; /// <summary> /// Offset into item identifier list. /// </summary> [FieldOffset(4)] public uint uOffset; /// <summary> /// Buffer to receive the display name. /// </summary> [FieldOffset(8)] [MarshalAs(UnmanagedType.ByValArray, SizeConst=260)] char[] cStr; } /// <summary> /// Determines the type of items included in an enumeration. These values are used with the IShellFolder.EnumObjects method. /// </summary> [Flags()] public enum SHCONTF { /// <summary> /// Include items that are folders in the enumeration. /// </summary> FOLDERS = 0x20, /// <summary> /// Include items that are not folders in the enumeration. /// </summary> NONFOLDERS = 0x40, /// <summary> /// Include hidden items in the enumeration. /// </summary> INCLUDEHIDDEN = 0x80, /// <summary> /// IShellFolder.EnumObjects can return without validating the enumeration object. Validation can be postponed until the first call to IEnumIDList.Next. Use this flag when a user interface might be displayed prior to the first IEnumIDList.Next call. For a user interface to be presented, hwnd must be set to a valid window handle. /// </summary> INIT_ON_FIRST_NEXT = 0x100, /// <summary> /// The caller is looking for printer objects. /// </summary> NETPRINTERSRCH = 0x200, /// <summary> /// The caller is looking for remote shares. /// </summary> SHAREABLE = 0x400, /// <summary> /// Include items with accessible storage and their ancestors. /// </summary> STORAGE = 0x800 } /// <summary> /// Defines the values used with the IShellFolder.GetDisplayNameOf and IShellFolder.SetNameOf methods. /// </summary> [Flags()] public enum SHGDN { /// <summary> /// Full name. The name is relative to the desktop and not to a specific folder. This name is used for generic display. /// </summary> NORMAL = 0x0000, /// <summary> /// Relative name. The name is relative to the folder that is processing it. /// </summary> INFOLDER = 0x0001, /// <summary> /// The name is used for in-place editing when the user renames the item. /// </summary> FOREDITING = 0x1000, /// <summary> /// The name is displayed in an address bar combo box. /// </summary> FORADDRESSBAR = 0x4000, /// <summary> /// The name is used for parsing. That is, it can be passed to IShellFolder::ParseDisplayName to recover the object's pointer to an item identifier list (PIDL). The form this name takes depends on the particular object. /// </summary> FORPARSING = 0x8000 , }; /// <summary> /// Provides static methods for interop with shell32.dll. /// </summary> internal class Shell32 { /// <summary> /// Retrieves the IShellFolder interface for the desktop folder, which is the root of the Shell's namespace. /// </summary> /// <param name="folder">Used to return IShellFolder object for desktop folder.</param> /// <returns>Returns NOERROR if successful, or an OLE-defined error result otherwise.</returns> [DllImport("shell32.dll")] public static extern UInt32 SHGetDesktopFolder([MarshalAs(UnmanagedType.Interface)] [Out()]out IShellFolder folder); } } --- NEW FILE: Shell32Exception.cs --- using System; namespace FAT.Web.HtmlDetails { public class Shell32Exception : ApplicationException { public Shell32Exception(UInt32 hr, String message) : base(String.Format("HRESULT = {0}: {1}", hr, message)) { } } } |
Update of /cvsroot/fat/FAT/src/FAT.Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13246/src/FAT.Core Modified Files: FAT.Core.csproj ITestLog.cs ITestStepResult.cs TestLog.cs TestLogger.cs TestStepInvoker.cs TestStepResult.cs Added Files: HtmlDetailsLog.cs Log Message: Can now add HtmlDetails to TestLogger in FATFixtures. Details are dislayed in test results as clickable thumbnails in FAT.Web --- NEW FILE: HtmlDetailsLog.cs --- using System; namespace FAT.Core { [Serializable] public class HtmlDetailsLog { private string url; private string html; public HtmlDetailsLog(string url, string html) { this.url = url; this.html = html; } public string Url { get {return url;} } public string Html { get {return html;} } } } Index: FAT.Core.csproj =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Core/FAT.Core.csproj,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FAT.Core.csproj 14 Dec 2003 21:30:28 -0000 1.2 --- FAT.Core.csproj 28 Jan 2004 22:14:47 -0000 1.3 *************** *** 93,96 **** --- 93,101 ---- /> <File + RelPath = "HtmlDetailsLog.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "IsolatedTestRunner.cs" SubType = "Code" Index: ITestLog.cs =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Core/ITestLog.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ITestLog.cs 12 Dec 2003 23:28:50 -0000 1.1 --- ITestLog.cs 28 Jan 2004 22:14:48 -0000 1.2 *************** *** 7,10 **** --- 7,12 ---- void Log(object message); string Flush(); + HtmlDetailsLog HtmlDetailsLog {set;} + HtmlDetailsLog FlushHtmlDetailsLog(); } } Index: ITestStepResult.cs =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Core/ITestStepResult.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ITestStepResult.cs 12 Dec 2003 23:28:50 -0000 1.1 --- ITestStepResult.cs 28 Jan 2004 22:14:48 -0000 1.2 *************** *** 11,14 **** --- 11,15 ---- string Detail { get; } bool Succeeded { get; } + HtmlDetailsLog HtmlDetailsLog { get; } } } Index: TestLog.cs =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Core/TestLog.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestLog.cs 12 Dec 2003 23:28:50 -0000 1.1 --- TestLog.cs 28 Jan 2004 22:14:48 -0000 1.2 *************** *** 7,10 **** --- 7,11 ---- { private StringBuilder buffer = new StringBuilder(); + private HtmlDetailsLog htmlDetailsLog; public void Log(object message) *************** *** 19,22 **** --- 20,36 ---- return contents; } + + public HtmlDetailsLog HtmlDetailsLog + { + set {htmlDetailsLog = value;} + } + + public HtmlDetailsLog FlushHtmlDetailsLog() + { + HtmlDetailsLog returnHtmlDetails = htmlDetailsLog; + htmlDetailsLog = null; + return returnHtmlDetails; + } + } } Index: TestLogger.cs =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Core/TestLogger.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestLogger.cs 12 Dec 2003 23:28:50 -0000 1.1 --- TestLogger.cs 28 Jan 2004 22:14:48 -0000 1.2 *************** *** 19,22 **** return Instance.Flush(); } ! } } --- 19,32 ---- return Instance.Flush(); } ! ! public static HtmlDetailsLog HtmlDetailsLog ! { ! set {Instance.HtmlDetailsLog = value;} ! } ! ! public static HtmlDetailsLog FlushHtmlDetails() ! { ! return Instance.FlushHtmlDetailsLog(); ! } ! } } Index: TestStepInvoker.cs =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Core/TestStepInvoker.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestStepInvoker.cs 12 Dec 2003 23:28:50 -0000 1.1 --- TestStepInvoker.cs 28 Jan 2004 22:14:48 -0000 1.2 *************** *** 61,65 **** private ITestStepResult TestStepSuccessful(ITestStep testStep) { ! return new TestStepResult(testStep, TestStatus.Succeeded, TestLogger.Flush()); } --- 61,65 ---- private ITestStepResult TestStepSuccessful(ITestStep testStep) { ! return new TestStepResult(testStep, TestStatus.Succeeded, TestLogger.Flush(), TestLogger.FlushHtmlDetails()); } *************** *** 68,72 **** string message = ex.InnerException.Message.Trim(); string detail = ex.InnerException.ToString(); ! return new TestStepResult(testStep, TestStatus.Failed, message, detail); } } --- 68,72 ---- string message = ex.InnerException.Message.Trim(); string detail = ex.InnerException.ToString(); ! return new TestStepResult(testStep, TestStatus.Failed, message, detail, TestLogger.FlushHtmlDetails()); } } Index: TestStepResult.cs =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Core/TestStepResult.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestStepResult.cs 12 Dec 2003 23:28:50 -0000 1.1 --- TestStepResult.cs 28 Jan 2004 22:14:48 -0000 1.2 *************** *** 10,19 **** private string message; private string detail; ! public TestStepResult(ITestStep testStep, TestStatus testStatus) : this(testStep, testStatus, null, null) { } ! public TestStepResult(ITestStep testStep, TestStatus testStatus, string message) : this(testStep, testStatus, message, null) { } ! public TestStepResult(ITestStep testStep, TestStatus testStatus, string message, string detail) { this.testStep = testStep; --- 10,24 ---- private string message; private string detail; + private HtmlDetailsLog htmlDetailsLog; ! public TestStepResult(ITestStep testStep, TestStatus testStatus) : this(testStep, testStatus, null, null, null) { } ! public TestStepResult(ITestStep testStep, TestStatus testStatus, string message) : this(testStep, testStatus, message, null, null) { } ! public TestStepResult(ITestStep testStep, TestStatus testStatus, string message, HtmlDetailsLog htmlDetailsLog) : this(testStep, testStatus, message, null, htmlDetailsLog) { } ! ! public TestStepResult(ITestStep testStep, TestStatus testStatus, string message, string detail) : this(testStep, testStatus, message, detail, null) { } ! ! public TestStepResult(ITestStep testStep, TestStatus testStatus, string message, string detail, HtmlDetailsLog htmlDetailsLog) { this.testStep = testStep; *************** *** 21,24 **** --- 26,30 ---- this.message = message; this.detail = detail; + this.htmlDetailsLog = htmlDetailsLog; } *************** *** 52,55 **** --- 58,66 ---- get { return testStatus == TestStatus.Succeeded; } } + + public HtmlDetailsLog HtmlDetailsLog + { + get { return htmlDetailsLog; } + } } } |
|
From: <dmc...@pr...> - 2004-01-29 06:46:18
|
Update of /cvsroot/fat/FAT/test/FAT.Test/Web/HtmlDetails In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13246/test/FAT.Test/Web/HtmlDetails Added Files: HtmlDetailsEnhancerTest.cs HtmlDetailsRequestHelperTest.cs HtmlDetailsStoreTest.cs Log Message: Can now add HtmlDetails to TestLogger in FATFixtures. Details are dislayed in test results as clickable thumbnails in FAT.Web --- NEW FILE: HtmlDetailsEnhancerTest.cs --- using FAT.Web; using FAT.Web.HtmlDetails; using NUnit.Framework; using System; using System.Drawing; using System.IO; namespace FAT.Test.Web.HtmlDetails { [TestFixture] public class HtmlDetailsEnhancerTest : Assertion { private string html = "<html><head><title>foo</title></head><body><b>Some Text</b><br><b>Some More Text</b><br></body></html>"; private string url = "http://testhost/testpath/test.aspx"; private HtmlDetailsEnhancer htmlDetailsEnhancer; [SetUp] public void CreateObjectToTest() { htmlDetailsEnhancer = new HtmlDetailsEnhancer(url, html); } [Test] public void Construction() { AssertEquals(html, htmlDetailsEnhancer.Html); AssertEquals(url, htmlDetailsEnhancer.Url); } [Test] public void Image() { AssertNotNull(htmlDetailsEnhancer.Thumbnail); Assert(htmlDetailsEnhancer.Thumbnail.Height >10); Assert(htmlDetailsEnhancer.Thumbnail.Width >10); } // TODO: expand urls [Test] public void HtmlWithAbsoluteUrls() { } } } --- NEW FILE: HtmlDetailsRequestHelperTest.cs --- using FAT.Web.HtmlDetails; using NMock; using NUnit.Framework; using System; using System.Drawing; namespace FAT.Test.Web.HtmlDetails { [TestFixture] public class HtmlDetailsRequestHelperTest { [Test] public void ReplyWithImage() { DynamicMock mockHtmlDetailsRequestContext = new DynamicMock(typeof(IHtmlDetailsRequestContext)); mockHtmlDetailsRequestContext.ExpectAndReturn("DetailsType", "image"); mockHtmlDetailsRequestContext.Expect("ContentType", "image/jpeg"); Image image = new Bitmap(1, 1); mockHtmlDetailsRequestContext.ExpectAndReturn("Thumbnail", image); mockHtmlDetailsRequestContext.Expect("StreamImage", image); HtmlDetailsRequestHelper.ReplyWithAppropriateHtmlDetails((IHtmlDetailsRequestContext)mockHtmlDetailsRequestContext.MockInstance); mockHtmlDetailsRequestContext.Verify(); } [Test] public void ReplyWithHtml() { DynamicMock mockHtmlDetailsRequestContext = new DynamicMock(typeof(IHtmlDetailsRequestContext)); mockHtmlDetailsRequestContext.ExpectAndReturn("DetailsType", "html"); mockHtmlDetailsRequestContext.Expect("ContentType", "text/plain"); string html = @"<a href=""relativeUrl.gif""/>"; mockHtmlDetailsRequestContext.ExpectAndReturn("Html", html); mockHtmlDetailsRequestContext.Expect("StreamText", html); HtmlDetailsRequestHelper.ReplyWithAppropriateHtmlDetails((IHtmlDetailsRequestContext)mockHtmlDetailsRequestContext.MockInstance); mockHtmlDetailsRequestContext.Verify(); } [Test] public void ReplyWithHtmlWithAbsoluteUrls() { DynamicMock mockHtmlDetailsRequestContext = new DynamicMock(typeof(IHtmlDetailsRequestContext)); mockHtmlDetailsRequestContext.ExpectAndReturn("DetailsType", "htmlWithAbsoluteUrls"); mockHtmlDetailsRequestContext.Expect("ContentType", "text/html"); string htmlWithAbsoluteUrls = @"<a href=""http://absolute/url.gif""/>"; mockHtmlDetailsRequestContext.ExpectAndReturn("HtmlWithAbsoluteUrls", htmlWithAbsoluteUrls); mockHtmlDetailsRequestContext.Expect("StreamText", htmlWithAbsoluteUrls); HtmlDetailsRequestHelper.ReplyWithAppropriateHtmlDetails((IHtmlDetailsRequestContext)mockHtmlDetailsRequestContext.MockInstance); mockHtmlDetailsRequestContext.Verify(); } [Test] public void CreateImageUrl() { Assert.AreEqual("HtmlDetails/HtmlDetailsRequestHandler.ashx?type=image&id=999", HtmlDetailsRequestHelper.CreateImageUrl("999")); } [Test] public void CreateHtmlUrl() { Assert.AreEqual("HtmlDetails/HtmlDetailsRequestHandler.ashx?type=html&id=999", HtmlDetailsRequestHelper.CreateHtmlUrl("999")); } [Test] public void CreateHtmlWithAbsoluteUrlsUrl() { Assert.AreEqual("HtmlDetails/HtmlDetailsRequestHandler.ashx?type=htmlWithAbsoluteUrls&id=999", HtmlDetailsRequestHelper.CreateHtmlWithAbsoluteUrlsUrl("999")); } } } --- NEW FILE: HtmlDetailsStoreTest.cs --- using FAT.Web.HtmlDetails; using NMock; using NUnit.Framework; using System; namespace FAT.Test.Web.HtmlDetails { [TestFixture] public class HtmlDetailsStoreTest { private ISession session; [SetUp] public void CreateTestSession() { session = new TestSession(); } [Test] public void Instance() { Assert.IsNull(HtmlDetailsStore.Instance(session)); HtmlDetailsStore.CreateInstance(session); IHtmlDetailsStore htmlDetailsStore1 = HtmlDetailsStore.Instance(session); Assert.IsNotNull(htmlDetailsStore1); IHtmlDetailsStore htmlDetailsStore2 = HtmlDetailsStore.Instance(session); Assert.AreSame(htmlDetailsStore1, htmlDetailsStore2); } [Test] public void StoringDetails() { HtmlDetailsStore.CreateInstance(session); IHtmlDetailsStore htmlDetailsStore = HtmlDetailsStore.Instance(session); HtmlDetailsEnhancer htmlDetailsEnhancer1 = new HtmlDetailsEnhancer("url_1", "html_1"); string id1 = htmlDetailsStore.Add(htmlDetailsEnhancer1); HtmlDetailsEnhancer htmlDetailsEnhancer2 = new HtmlDetailsEnhancer("url_2", "html_2"); string id2 = htmlDetailsStore.Add(htmlDetailsEnhancer2); HtmlDetailsEnhancer htmlDetailsEnhancer3 = new HtmlDetailsEnhancer("url_3", "html_3"); string id3 = htmlDetailsStore.Add(htmlDetailsEnhancer3); Assert.AreSame(htmlDetailsEnhancer1, htmlDetailsStore.Get(id1)); Assert.AreSame(htmlDetailsEnhancer2, htmlDetailsStore.Get(id2)); Assert.AreSame(htmlDetailsEnhancer3, htmlDetailsStore.Get(id3)); } } public class TestSession : ISession { private object item; public object this[string stringIndex] { get { Assert.AreEqual("HtmlDetailsStore", stringIndex); return item; } set { Assert.AreEqual("HtmlDetailsStore", stringIndex); item = value; } } } } |
|
From: <dmc...@pr...> - 2004-01-29 05:22:11
|
Update of /cvsroot/fat/FAT/src/FAT.Console In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13246/src/FAT.Console Modified Files: app.config Log Message: Can now add HtmlDetails to TestLogger in FATFixtures. Details are dislayed in test results as clickable thumbnails in FAT.Web Index: app.config =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Console/app.config,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** app.config 15 Jan 2004 00:56:57 -0000 1.2 --- app.config 28 Jan 2004 22:14:47 -0000 1.3 *************** *** 7,11 **** <FAT> <Assemblies> ! <Assembly>D:\dev\FAT\build\FAT.Acceptance.dll</Assembly> </Assemblies> </FAT> --- 7,11 ---- <FAT> <Assemblies> ! <Assembly>C:\dev\FAT\build\FAT.Acceptance.dll</Assembly> </Assemblies> </FAT> |
|
From: <dmc...@pr...> - 2004-01-29 01:19:20
|
Update of /cvsroot/fat/FAT/src/FAT.Web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13246/src/FAT.Web Modified Files: Default.aspx Default.aspx.cs DefaultPageModel.cs FAT.Web.csproj Global.asax.cs Web.config Log Message: Can now add HtmlDetails to TestLogger in FATFixtures. Details are dislayed in test results as clickable thumbnails in FAT.Web Index: Default.aspx =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Web/Default.aspx,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Default.aspx 15 Jan 2004 00:56:58 -0000 1.2 --- Default.aspx 28 Jan 2004 22:14:48 -0000 1.3 *************** *** 1,4 **** <%@ Register Tagprefix="FAT" Namespace="FAT.Web" Assembly="FAT.Web" %> ! <%@ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false" Inherits="FAT.Web.Default" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> --- 1,4 ---- <%@ Register Tagprefix="FAT" Namespace="FAT.Web" Assembly="FAT.Web" %> ! <%@ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false" Inherits="FAT.Web.Default" EnableSessionState=true %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> Index: Default.aspx.cs =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Web/Default.aspx.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Default.aspx.cs 15 Jan 2004 00:56:58 -0000 1.2 --- Default.aspx.cs 28 Jan 2004 22:14:48 -0000 1.3 *************** *** 1,11 **** using FAT.Core; using System; - using System.Collections; - using System.ComponentModel; - using System.Web; - using System.Web.SessionState; - using System.Web.UI; using System.Web.UI.WebControls; - using System.Web.UI.HtmlControls; namespace FAT.Web --- 1,6 ---- using FAT.Core; + using FAT.Web.HtmlDetails; using System; using System.Web.UI.WebControls; namespace FAT.Web *************** *** 13,47 **** public class Default : System.Web.UI.Page { - protected Label instructions; - protected Label testNameLabel; protected TextBox testName; - protected Label testNameWarning; - protected Label fixtureLabel; protected TextBox fixture; - protected Label testLabel; protected TextBox test; - protected Label setupLabel; protected TextBox setup; - protected Label teardownLabel; protected TextBox teardown; protected Label fixtureWarning; protected Button run; protected PlaceHolder results; ! protected FAT.Web.TestTreeView TestTreeView1; ! protected System.Web.UI.WebControls.Label setUpLabel; ! protected System.Web.UI.WebControls.Label tearDownLabel; ! private DefaultPageModel model = new DefaultPageModel(); private void Page_Load(object sender, System.EventArgs e) { - fixtureWarning.Text = null; } private void Run_Click(object source, EventArgs args) { try { ITestResult testResult = model.Run(testName.Text, fixture.Text, test.Text, setup.Text, teardown.Text); ! results.Controls.Add(model.CreateResultsTable(testResult)); } catch (FATException ex) --- 8,35 ---- public class Default : System.Web.UI.Page { protected TextBox testName; protected TextBox fixture; protected TextBox test; protected TextBox setup; protected TextBox teardown; protected Label fixtureWarning; protected Button run; protected PlaceHolder results; ! private DefaultPageModel model; private void Page_Load(object sender, System.EventArgs e) { } private void Run_Click(object source, EventArgs args) { + model = new DefaultPageModel(); + fixtureWarning.Text = null; + try { ITestResult testResult = model.Run(testName.Text, fixture.Text, test.Text, setup.Text, teardown.Text); ! ! results.Controls.Add(model.CreateResultsTable(testResult, HtmlDetailsStore.Instance(new Session(Session)))); } catch (FATException ex) Index: DefaultPageModel.cs =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Web/DefaultPageModel.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DefaultPageModel.cs 20 Jan 2004 06:01:20 -0000 1.3 --- DefaultPageModel.cs 28 Jan 2004 22:14:48 -0000 1.4 *************** *** 1,6 **** --- 1,8 ---- using FAT.Core; using FAT.Core.Configuration; + using FAT.Web.HtmlDetails; using System; using System.Text; + using System.Web.UI; using System.Web.UI.WebControls; *************** *** 29,33 **** } ! public Table CreateResultsTable(ITestResult result) { Table table = new Table(); --- 31,35 ---- } ! public Table CreateResultsTable(ITestResult result, IHtmlDetailsStore htmlDetailsStore) { Table table = new Table(); *************** *** 44,56 **** { TableRow stepRow = new TableRow(); ! stepRow.Cells.Add(CreateImageCell(step.TestStatus)); stepRow.Cells.Add(CreateCell(step.Name)); stepRow.Cells.Add(CreateCell(step.TestStatus.ToString())); stepRow.Cells.Add(CreateCell(step.Message.ToString())); table.Rows.Add(stepRow); } return table; } private TableCell CreateHeaderCell(string header) { --- 46,73 ---- { TableRow stepRow = new TableRow(); ! stepRow.Cells.Add(CreateImageCell(CreateImageUrl(step.TestStatus))); stepRow.Cells.Add(CreateCell(step.Name)); stepRow.Cells.Add(CreateCell(step.TestStatus.ToString())); stepRow.Cells.Add(CreateCell(step.Message.ToString())); + stepRow.Cells.Add(CreateHtmlDetailsCell(step.HtmlDetailsLog, htmlDetailsStore)); table.Rows.Add(stepRow); } + return table; } + private TableCell CreateHtmlDetailsCell(HtmlDetailsLog HtmlDetailsLog, IHtmlDetailsStore htmlDetailsStore) + { + if (HtmlDetailsLog == null) + { + return CreateCell(""); + } + else + { + string id = htmlDetailsStore.Add(new HtmlDetailsEnhancer(HtmlDetailsLog.Url, HtmlDetailsLog.Html)); + return CreateImageHyperLinkCell(HtmlDetailsRequestHelper.CreateImageUrl(id), HtmlDetailsRequestHelper.CreateHtmlWithAbsoluteUrlsUrl(id)); + } + } + private TableCell CreateHeaderCell(string header) { *************** *** 67,76 **** } ! private TableCell CreateImageCell(TestStatus status) { Image image = new Image(); ! // image.ImageUrl = CreateImageUrl(status); TableCell cell = new TableCell(); ! cell.Controls.Add(image); return cell; } --- 84,109 ---- } ! private TableCell CreateImageCell(string url) { Image image = new Image(); ! image.ImageUrl = url; ! ! return CreateTableCell(image); ! } ! ! private TableCell CreateImageHyperLinkCell(string imageUrl, string clickUrl) ! { ! HyperLink image = new HyperLink(); ! image.NavigateUrl = clickUrl; ! image.ImageUrl = imageUrl; ! image.Target = "_blank"; ! ! return CreateTableCell(image); ! } ! ! private TableCell CreateTableCell(Control control) ! { TableCell cell = new TableCell(); ! cell.Controls.Add(control); return cell; } Index: FAT.Web.csproj =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Web/FAT.Web.csproj,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FAT.Web.csproj 15 Jan 2004 00:56:58 -0000 1.2 --- FAT.Web.csproj 28 Jan 2004 22:14:48 -0000 1.3 *************** *** 152,155 **** --- 152,225 ---- /> <File + RelPath = "HtmlDetails\HtmlDetailsEnhancer.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "HtmlDetails\HtmlDetailsRequestContext.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "HtmlDetails\HtmlDetailsRequestHandler.ashx" + SubType = "Code" + BuildAction = "Content" + /> + <File + RelPath = "HtmlDetails\HtmlDetailsRequestHelper.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "HtmlDetails\HtmlDetailsStore.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "HtmlDetails\IEnumIDList.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "HtmlDetails\IExtractImage.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "HtmlDetails\IHtmlDetailsRequestContext.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "HtmlDetails\IHtmlDetailsStore.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "HtmlDetails\ISession.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "HtmlDetails\IShellFolder.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "HtmlDetails\Session.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "HtmlDetails\Shell32.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "HtmlDetails\Shell32Exception.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "images\Green.jpg" BuildAction = "Content" Index: Global.asax.cs =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Web/Global.asax.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Global.asax.cs 13 Dec 2003 00:09:02 -0000 1.1 --- Global.asax.cs 28 Jan 2004 22:14:48 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- + using FAT.Web.HtmlDetails; using System; using System.Collections; *************** *** 7,13 **** namespace FAT.Web { - /// <summary> - /// Summary description for Global. - /// </summary> public class Global : System.Web.HttpApplication { --- 8,11 ---- *************** *** 24,28 **** protected void Session_Start(Object sender, EventArgs e) { ! } --- 22,26 ---- protected void Session_Start(Object sender, EventArgs e) { ! HtmlDetailsStore.CreateInstance(new Session(Session)); } Index: Web.config =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Web/Web.config,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Web.config 20 Jan 2004 06:01:20 -0000 1.3 --- Web.config 28 Jan 2004 22:14:48 -0000 1.4 *************** *** 8,15 **** <FAT> <Assemblies> ! <Assembly>D:\dev\FAT\build\FAT.Acceptance.dll</Assembly> </Assemblies> <TestPaths> ! <TestPath>D:\dev\FAT\sample\Calculator</TestPath> </TestPaths> </FAT> --- 8,15 ---- <FAT> <Assemblies> ! <Assembly>C:\dev\FAT\build\FAT.Acceptance.dll</Assembly> </Assemblies> <TestPaths> ! <TestPath>C:\dev\FAT\sample\Calculator</TestPath> </TestPaths> </FAT> |
|
From: <dmc...@pr...> - 2004-01-28 22:38:20
|
Update of /cvsroot/fat/FAT/test/FAT.Test/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13246/test/FAT.Test/Core Modified Files: TestLogTest.cs Log Message: Can now add HtmlDetails to TestLogger in FATFixtures. Details are dislayed in test results as clickable thumbnails in FAT.Web Index: TestLogTest.cs =================================================================== RCS file: /cvsroot/fat/FAT/test/FAT.Test/Core/TestLogTest.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestLogTest.cs 14 Dec 2003 21:30:28 -0000 1.1 --- TestLogTest.cs 28 Jan 2004 22:14:49 -0000 1.2 *************** *** 1,3 **** --- 1,4 ---- using FAT.Core; + using FAT.Web.HtmlDetails; using NMock; using NMock.Constraints; *************** *** 21,24 **** --- 22,38 ---- AssertEquals(String.Empty, log.Flush()); } + + [Test] + public void HtmlDetails() + { + TestLog log = new TestLog(); + HtmlDetailsLog htmlDetails1 = new HtmlDetailsLog("url1", "html1"); + HtmlDetailsLog htmlDetails2 = new HtmlDetailsLog("url2", "html2"); + + log.HtmlDetailsLog = htmlDetails1; + log.HtmlDetailsLog = htmlDetails2; + AssertEquals(htmlDetails2, log.FlushHtmlDetailsLog()); + AssertEquals(null, log.FlushHtmlDetailsLog()); + } } } |
|
From: <dmc...@pr...> - 2004-01-28 22:31:07
|
Update of /cvsroot/fat/FAT/test/FAT.Test/Web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13246/test/FAT.Test/Web Modified Files: CreateTestModelTest.cs Log Message: Can now add HtmlDetails to TestLogger in FATFixtures. Details are dislayed in test results as clickable thumbnails in FAT.Web Index: CreateTestModelTest.cs =================================================================== RCS file: /cvsroot/fat/FAT/test/FAT.Test/Web/CreateTestModelTest.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CreateTestModelTest.cs 20 Jan 2004 06:01:20 -0000 1.3 --- CreateTestModelTest.cs 28 Jan 2004 22:14:49 -0000 1.4 *************** *** 1,4 **** --- 1,5 ---- using FAT.Core; using FAT.Web; + using FAT.Web.HtmlDetails; using NMock; using NUnit.Framework; *************** *** 13,16 **** --- 14,18 ---- private Mock mockParser; private Mock mockRunner; + private Mock mockHtmlDetailsStore; private DefaultPageModel model; *************** *** 41,51 **** public void CreateResultsTable() { ! Table table = model.CreateResultsTable(CreateTestResults()); AssertEquals(3, table.Rows.Count); AssertEquals("a", table.Rows[1].Cells[1].Text); AssertEquals("NotRun", table.Rows[1].Cells[2].Text); AssertEquals("b", table.Rows[2].Cells[1].Text); AssertEquals("NotRun", table.Rows[2].Cells[2].Text); } --- 43,65 ---- public void CreateResultsTable() { ! mockHtmlDetailsStore = new DynamicMock(typeof(IHtmlDetailsStore)); ! mockHtmlDetailsStore.ExpectAndReturn("Add", "999", new NMock.Constraints.IsTypeOf(typeof(HtmlDetailsEnhancer))); ! ! Table table = model.CreateResultsTable(CreateTestResults(), (IHtmlDetailsStore)mockHtmlDetailsStore.MockInstance); ! ! mockHtmlDetailsStore.Verify(); AssertEquals(3, table.Rows.Count); + AssertEquals("a", table.Rows[1].Cells[1].Text); AssertEquals("NotRun", table.Rows[1].Cells[2].Text); + AssertEquals("foo", table.Rows[1].Cells[3].Text); + AssertEquals(" ", table.Rows[1].Cells[4].Text); + AssertEquals("b", table.Rows[2].Cells[1].Text); AssertEquals("NotRun", table.Rows[2].Cells[2].Text); + AssertEquals("fooby", table.Rows[2].Cells[3].Text); + AssertEquals("HtmlDetails/HtmlDetailsRequestHandler.ashx?type=image&id=999", ((HyperLink)(table.Rows[2].Cells[4].Controls[0])).ImageUrl); + AssertEquals("HtmlDetails/HtmlDetailsRequestHandler.ashx?type=htmlWithAbsoluteUrls&id=999", ((HyperLink)(table.Rows[2].Cells[4].Controls[0])).NavigateUrl); } *************** *** 54,58 **** TestResult testResult = new TestResult("story"); testResult.AddTestStepResult(new TestStepResult(new TestStep("a"), TestStatus.NotRun, "foo", "bar")); ! testResult.AddTestStepResult(new TestStepResult(new TestStep("b"), TestStatus.NotRun, "fooby", "barby")); return testResult; } --- 68,72 ---- TestResult testResult = new TestResult("story"); testResult.AddTestStepResult(new TestStepResult(new TestStep("a"), TestStatus.NotRun, "foo", "bar")); ! testResult.AddTestStepResult(new TestStepResult(new TestStep("b"), TestStatus.NotRun, "fooby", "barby", new HtmlDetailsLog("uurrll", "hhttmmll"))); return testResult; } |