Author: yonik
Date: 2006-11-30 06:37:50 -0500 (Thu, 30 Nov 2006)
New Revision: 68740

Modified:
   trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
   trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/PanelTest.cs
Log:
PanetTest.cs added new test for 2.0 

Modified: trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog 
2006-11-30 11:26:09 UTC (rev 68739)
+++ trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog 
2006-11-30 11:37:50 UTC (rev 68740)
@@ -1,3 +1,7 @@
+2006-11-30  Yoni Klain         <[EMAIL PROTECTED]>
+
+       * PanelTest.cs: added new test for 2.0 
+
 2006-11-29  Igor Zelmanovich   <[EMAIL PROTECTED]>
 
        * CreateUserWizardTest.cs: fixed NunitWeb tests.

Modified: trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/PanelTest.cs
===================================================================
--- trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/PanelTest.cs      
2006-11-30 11:26:09 UTC (rev 68739)
+++ trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/PanelTest.cs      
2006-11-30 11:37:50 UTC (rev 68740)
@@ -3,6 +3,7 @@
 //
 // Author:
 //     Ben Maurer <[EMAIL PROTECTED]>
+//     Yoni Klain <[EMAIL PROTECTED]>
 //
 
 //
@@ -35,11 +36,17 @@
 using System.Web;
 using System.Web.UI;
 using System.Web.UI.WebControls;
+using System.Drawing;
+using MonoTests.stand_alone.WebHarness;
+using MonoTests.SystemWeb.Framework;
 
 namespace MonoTests.System.Web.UI.WebControls {
-       [TestFixture]   
-       public class PanelTest {
+       [TestFixture]
+       public class PanelTest
+       {
+               #region helpclasses
                class Poker : Panel {
+                       
                        public string Render ()
                        {
                                StringWriter sw = new StringWriter ();
@@ -47,8 +54,105 @@
                                HtmlTextWriter writer = new HtmlTextWriter (sw);
                                base.Render (writer);
                                return writer.InnerWriter.ToString ();
-                       }       
+                       }
                }
+       
+               class PokerS : Panel
+               {
+                       public string Render ()
+                       {
+                               StringWriter sw = new StringWriter ();
+                               sw.NewLine = "\n";
+                               HtmlTextWriter writer = new HtmlTextWriter (sw);
+                               base.Render (writer);
+                               return writer.InnerWriter.ToString ();
+                       }
+#if NET_2_0
+                       protected override Style CreateControlStyle ()
+                       {
+                               Style s = new Style (new StateBag ());
+                               s.BackColor = Color.Red;
+                               s.BorderColor = Color.Red;
+                               return s;
+                       }
+
+                       public override void RenderBeginTag (HtmlTextWriter 
writer)
+                       {
+                               base.RenderBeginTag (writer);
+                       }
+
+                       public override void RenderEndTag (HtmlTextWriter 
writer)
+                       {
+                               base.RenderEndTag (writer);
+                       }
+
+                       public  string RenderBeginTag ()
+                       {
+                               StringWriter sw = new StringWriter ();
+                               sw.NewLine = "\n";
+                               HtmlTextWriter writer = new HtmlTextWriter (sw);
+                               base.RenderBeginTag (writer);
+                               return writer.InnerWriter.ToString ();
+                       }
+
+                       public  string RenderEndTag ()
+                       {
+                               StringWriter sw = new StringWriter ();
+                               sw.NewLine = "\n";
+                               HtmlTextWriter writer = new HtmlTextWriter (sw);
+                               base.RenderBeginTag (writer);
+                               base.RenderEndTag (writer);
+                               return writer.InnerWriter.ToString ();
+                       }
+#endif
+               }
+
+               class PokerR : Panel
+               {
+                       public string Render ()
+                       {
+                               StringWriter sw = new StringWriter ();
+                               sw.NewLine = "\n";
+                               HtmlTextWriter writer = new HtmlTextWriter (sw);
+                               sw.Write ("Render");
+                               base.Render (writer);
+                               return writer.InnerWriter.ToString ();
+                       }
+#if NET_2_0
+                       public override void RenderBeginTag (HtmlTextWriter 
writer)
+                       {
+                               writer.Write ("RenderBeginTag");
+                       }
+
+                       public override void RenderEndTag (HtmlTextWriter 
writer)
+                       {
+                               writer.Write ("RenderEndTag");
+                       }
+#endif
+               }
+               #endregion
+#if NET_2_0
+               [TestFixtureSetUp]
+               public void SetUp ()
+               {
+                       WebTest.CopyResource (GetType (), 
"NoEventValidation.aspx", "NoEventValidation.aspx");
+               }
+#endif
+               [Test]
+               [Category("NotWorking")]
+               public void Defaults ()
+               {
+                       Poker p = new Poker ();
+#if NET_2_0
+#if false      
+                       Assert.AreEqual (ContentDirection.NotSet, p.Direction, 
"Direction"); 
+                       Assert.AreEqual (string.Empty, p.GroupingText, 
"GroupingText");
+                       Assert.AreEqual (ScrollBars.None, p.ScrollBars, 
"ScrollBars"); 
+                       Assert.AreEqual (string.Empty, p.DefaultButton, 
"DefaultButton");
+#endif
+                       //Note: "Panel does not have definition to: 
ScrollBars;DefaultButton;Direction;GroupingText";
+#endif
+               }
                
                [Test]
                public void NoWrap ()
@@ -61,9 +165,161 @@
 #elif NET_1_1
                        const string html ="<div 
nowrap=\"nowrap\">\n\tTEXT\n</div>";
 #endif
-                       
                        Assert.AreEqual (html, p.Render ());
-               }               
+               }
+
+#if NET_2_0
+               [Test]
+               public void CreateControlStyle ()
+               {
+                       PokerS p = new PokerS ();
+                       Style s = p.ControlStyle;
+                       Assert.AreEqual (Color.Red, s.BackColor, 
"CreateControlStyle#1");
+                       Assert.AreEqual (Color.Red, s.BorderColor, 
"CreateControlStyle#2");
+                       p.ApplyStyle (s);
+                       string html = p.Render ();
+                       HtmlDiff.AssertAreEqual ("<div 
style=\"background-color:Red;border-color:Red;\"></div>", html, 
"CreateControlStyle");
+               }
+
+               [Test]
+               [Category("NotWorking")]
+               [Category ("NunitWeb")]
+               public void DefaultButton ()
+               {
+#if false
+                       WebTest.CopyResource (GetType (), 
"NoEventValidation.aspx", "NoEventValidation.aspx");
+                       WebTest t = new WebTest ("NoEventValidation.aspx");
+                       t.Invoker = PageInvoker.CreateOnInit 
(DefaultButton__Init);
+                       t.Run ();
+#endif
+                       // Note : "Panel have no definition to DefaultButton");
+               }
+
+               public static void DefaultButton__Init (Page p)
+               {
+#if false
+                       Poker pl = new Poker ();
+                       pl.DefaultButton = "MyButton";
+                       Button b = new Button ();
+                       b.ID = "MyButton";
+                       p.Form.Controls.Add (b);
+                       p.Form.Controls.Add (pl);
+                       string html = pl.Render ();
+                       if (html.IndexOf ("onkeypress") == -1)
+                               Assert.Fail ("Default button script not created 
#1");
+                       if (html.IndexOf ("MyButton") == -1)
+                               Assert.Fail ("Default button script not created 
#2");
+#endif
+                       // Note :"Panel have no definition to DefaultButton");
+
+               }
+               
+               [Test]
+               [Category ("NotWorking")]
+               [Category("NunitWeb")]
+#if false
+               [ExpectedException(typeof(InvalidOperationException))]
+#endif
+               public void DefaultButton_Exception ()
+               {
+#if false
+                       WebTest.CopyResource (GetType (), 
"NoEventValidation.aspx", "NoEventValidation.aspx");
+                       WebTest t = new WebTest ("NoEventValidation.aspx");
+                       t.Invoker = PageInvoker.CreateOnInit 
(DefaultButton_Init);
+                       t.Run ();
+#endif
+                       // Note :"Panel have no definition to DefaultButton");
+
+               }
+
+               public static void DefaultButton_Init (Page p)
+               {
+#if false
+                       Poker pl = new Poker ();
+                       pl.DefaultButton = "test";
+                       p.Form.Controls.Add (pl);
+                       pl.Render ();
+#endif
+                       // Note: "Panel have no definition to DefaultButton");
+
+               }
+
+               [Test]
+               [Category("NotWorking")]
+               public void Direction ()
+               {
+                       Poker p = new Poker ();
+#if false
+                       p.Direction = ContentDirection.LeftToRight;
+                       string html = p.Render();
+                       HtmlDiff.AssertAreEqual ("<div dir=\"ltr\"></div>", 
html, "Direction");
+#endif
+                       //Note:"Panel have no definition to Direction");
+               }
+
+               [Test]
+               [Category ("NotWorking")]
+               public void GroupingText ()
+               {
+                       Poker p = new Poker ();
+#if false
+                       p.GroupingText = "MyNameText";
+                       string html = p.Render ();
+                       HtmlDiff.AssertAreEqual 
("<div><fieldset><legend>MyNameText</legend></fieldset></div>", html, 
"GroupingText");
+#endif
+                       //Note : "Panel have no definition to GroupingText");
+
+               }
+
+               [Test]
+               public void RenderBeginTag ()
+               {
+                       PokerS p = new PokerS ();
+                       string html = p.RenderBeginTag ();
+                       HtmlDiff.AssertAreEqual ("<div>\n", html, 
"RenderBeginTag");
+               }
+
+               [Test]
+               public void RenderEndTag ()
+               {
+                       PokerS p = new PokerS ();
+                       string html = p.RenderEndTag ();
+                       HtmlDiff.AssertAreEqual ("<div>\n\n</div>", html, 
"RenderBeginTag");
+               }
+
+               [Test]
+               public void RenderFlow ()
+               {
+                       PokerR p = new PokerR ();
+                       string html = p.Render ();
+                       Assert.AreEqual ("RenderRenderBeginTagRenderEndTag", 
html, "RenderFlow");
+               }
+
+               [Test]
+               [Category("NotWorking")]
+               public void Scroll_Bars ()
+               {
+                       Poker p = new Poker ();
+#if false
+                       p.ScrollBars = ScrollBars.Horizontal;
+                       string html = p.Render ();
+                       HtmlDiff.AssertAreEqual ("<div 
style=\"overflow-x:scroll;\"></div>", html, "ScrollBars.Horizontal");
+                       p.ScrollBars = ScrollBars.Vertical;
+                       html = p.Render ();
+                       HtmlDiff.AssertAreEqual ("<div 
style=\"overflow-y:scroll;\"></div>", html, "ScrollBars.Vertical");
+                       p.ScrollBars = ScrollBars.Both;
+                       html = p.Render ();
+                       HtmlDiff.AssertAreEqual ("<div 
style=\"overflow-scroll;\"></div>", html, "ScrollBars.Both");
+#endif
+                       // Note : "Panel does not have definition to 
ScrollBars");
+               }
+
+               [TestFixtureTearDown]
+               public void TearDown ()
+               {
+                       WebTest.Unload ();
+               }
+#endif
        }
 }
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to