Author: yonik
Date: 2006-07-07 05:42:19 -0400 (Fri, 07 Jul 2006)
New Revision: 62345
Added:
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ContentTest.cs
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/GridViewRowCollectionTest.cs
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/GridViewRowTest.cs
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/PagerSettingsTest.cs
Modified:
trunk/mcs/class/System.Web/ChangeLog
trunk/mcs/class/System.Web/Makefile
trunk/mcs/class/System.Web/System.Web_test.dll.sources
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/GridViewTest.cs
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/MenuTest.cs
trunk/mcs/class/System.Web/Test/mainsoft/ChangeLog
Log:
Modified: trunk/mcs/class/System.Web/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/ChangeLog 2006-07-07 09:10:15 UTC (rev
62344)
+++ trunk/mcs/class/System.Web/ChangeLog 2006-07-07 09:42:19 UTC (rev
62345)
@@ -1,3 +1,7 @@
+2006-07-07 Yoni Klain <[EMAIL PROTECTED]>
+
+ * System.Web_test.dll.sources: add ContentTest.cs
+
2006-07-05 Vladimir Krasnov <[EMAIL PROTECTED]>
* System.Web_test.dll.sources: added CreateUserWizardTest.cs
Modified: trunk/mcs/class/System.Web/Makefile
===================================================================
--- trunk/mcs/class/System.Web/Makefile 2006-07-07 09:10:15 UTC (rev 62344)
+++ trunk/mcs/class/System.Web/Makefile 2006-07-07 09:42:19 UTC (rev 62345)
@@ -71,8 +71,9 @@
Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPageWithMaster.aspx \
Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.config \
Test/mainsoft/NunitWebResources/menuclass.aspx \
- Test/mainsoft/NunitWebResources/FormView.aspx \
+ Test/mainsoft/NunitWebResources/FormView.aspx \
Test/mainsoft/NunitWebResources/PageWithStyleSheet.aspx \
+ Test/mainsoft/NunitWebResources/PostBackMenuTest.aspx \
Test/mainsoft/NunitWebResources/PageWithTheme.aspx \
Test/mainsoft/NunitWebResources/RunTimeSetTheme.aspx \
Test/mainsoft/NunitWebResources/ReadOnlyPropertyBind.aspx \
Modified: trunk/mcs/class/System.Web/System.Web_test.dll.sources
===================================================================
--- trunk/mcs/class/System.Web/System.Web_test.dll.sources 2006-07-07
09:10:15 UTC (rev 62344)
+++ trunk/mcs/class/System.Web/System.Web_test.dll.sources 2006-07-07
09:42:19 UTC (rev 62345)
@@ -141,6 +141,7 @@
System.Web.UI.WebControls/CommandFieldTest.cs
System.Web.UI.WebControls/CompareValidatorTest.cs
System.Web.UI.WebControls/CompositeControlTest.cs
+System.Web.UI.WebControls/ContentTest.cs
System.Web.UI.WebControls/CreateUserWizardTest.cs
System.Web.UI.WebControls/CustomValidatorTest.cs
System.Web.UI.WebControls/DataBoundControlTest.cs
@@ -165,6 +166,8 @@
System.Web.UI.WebControls/FontUnitTest.cs
System.Web.UI.WebControls/FormViewTest.cs
System.Web.UI.WebControls/GridViewTest.cs
+System.Web.UI.WebControls/GridViewRowCollectionTest.cs
+System.Web.UI.WebControls/GridViewRowTest.cs
System.Web.UI.WebControls/HyperLinkColumnTest.cs
System.Web.UI.WebControls/HyperLinkFieldTest.cs
System.Web.UI.WebControls/HyperLinkTest.cs
@@ -186,6 +189,7 @@
System.Web.UI.WebControls/MonthChangedEventArgsTest.cs
System.Web.UI.WebControls/MultiViewTest.cs
System.Web.UI.WebControls/PagedDataSourceTest.cs
+System.Web.UI.WebControls/PagerSettingsTest.cs
System.Web.UI.WebControls/PanelTest.cs
System.Web.UI.WebControls/RadioButtonListTest.cs
System.Web.UI.WebControls/RadioButtonTest.cs
Modified: trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
2006-07-07 09:10:15 UTC (rev 62344)
+++ trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
2006-07-07 09:42:19 UTC (rev 62345)
@@ -1,3 +1,12 @@
+2006-07-07 Yoni Klain <[EMAIL PROTECTED]>
+
+ * added PagerSettingsTest.cs;GridViewRowCollectionTest.cs;
+ ContentTest.cs;GridViewRowTest.cs
+
+2006-07-07 Yoni Klain <[EMAIL PROTECTED]>
+
+ * GridViewTest.cs, MenuTest.cs added PostBack tests
+
2006-07-05 Vladimir Krasnov <[EMAIL PROTECTED]>
* added CreateUserWizardTest.cs
Added: trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ContentTest.cs
===================================================================
--- trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ContentTest.cs
2006-07-07 09:10:15 UTC (rev 62344)
+++ trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ContentTest.cs
2006-07-07 09:42:19 UTC (rev 62345)
@@ -0,0 +1,164 @@
+//
+// Tests for System.Web.UI.WebControls.ContentTest.cs
+//
+// Author:
+// Yoni Klein ([EMAIL PROTECTED])
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+#if NET_2_0
+
+
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.IO;
+using System.Drawing;
+using MyWebControl = System.Web.UI.WebControls;
+using System.Collections;
+using MonoTests.stand_alone.WebHarness;
+
+
+namespace MonoTests.System.Web.UI.WebControls
+{
+
+
+ class PokerContent : Content
+ {
+ public PokerContent ()
+ {
+ TrackViewState ();
+ }
+ public void DoOnDataBinding ()
+ {
+ base.OnDataBinding(new EventArgs()) ;
+ }
+ public void DoOnInit ()
+ {
+ base.OnInit (new EventArgs ());
+ }
+ public void DoOnLoad ()
+ {
+ base.OnLoad (new EventArgs ());
+ }
+ public void DoOnPreRender ()
+ {
+ base.OnPreRender (new EventArgs ());
+ }
+ public void DoOnUnLoad ()
+ {
+ base.OnUnload (new EventArgs ());
+ }
+ }
+
+
+ [TestFixture]
+ public class ContentTest
+ {
+ [Test]
+ [Category ("NotWorking")]
+ public void Content_DefaultProperty ()
+ {
+ PokerContent pc = new PokerContent();
+ Assert.AreEqual (String.Empty, pc.ContentPlaceHolderID,
"ContentPlaceHolderID");
+ }
+
+ private bool OnDataBinding;
+ private bool OnInit;
+ private bool OnLoad;
+ private bool OnPreRender;
+ private bool OnUnLoad;
+
+ private void OnUnLoadHendler (Object sender, EventArgs args)
+ {
+ OnUnLoad = true;
+ }
+
+ private void OnPreRenderHendler (Object sender, EventArgs args)
+ {
+ OnPreRender = true;
+ }
+
+ private void OnLoadHandler (Object sender, EventArgs args)
+ {
+ OnLoad = true;
+ }
+
+ private void OnDataBindingHandler (Object sender, EventArgs
args)
+ {
+ OnDataBinding = true;
+ }
+ private void OnInitHandler (Object sender, EventArgs args)
+ {
+ OnInit = true;
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void Events ()
+ {
+ PokerContent pc = new PokerContent ();
+ pc.DataBinding += new EventHandler
(OnDataBindingHandler);
+ pc.Init += new EventHandler (OnInitHandler);
+ pc.Load += new EventHandler (OnLoadHandler);
+ pc.PreRender += new EventHandler (OnPreRenderHendler);
+ pc.Unload += new EventHandler (OnUnLoadHendler);
+ // Unload event
+ Assert.AreEqual (false, OnUnLoad, "BeforeUnLoad");
+ pc.DoOnUnLoad ();
+ Assert.AreEqual (true, OnUnLoad, "AfterUnLoad");
+ // PreRender event
+ Assert.AreEqual (false, OnPreRender, "BeforePreRender");
+ pc.DoOnPreRender ();
+ Assert.AreEqual (true, OnPreRender, "AfterPreRender");
+ // Load event
+ Assert.AreEqual (false, OnLoad, "BeforeLoad");
+ pc.DoOnLoad ();
+ Assert.AreEqual (true, OnLoad, "AfterLoad");
+ // Init event
+ Assert.AreEqual (false, OnInit, "BeforeInit");
+ pc.DoOnInit ();
+ Assert.AreEqual (true, OnInit, "AfterInit");
+ // DataBiding event
+ Assert.AreEqual (false, OnDataBinding,
"BeforeDataBinding");
+ pc.DoOnDataBinding ();
+ Assert.AreEqual (true, OnDataBinding,
"AfterDataBinding");
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ [ExpectedException (typeof(NotSupportedException))]
+ public void Content_PropertyExeption ()
+ {
+ PokerContent pc = new PokerContent ();
+ pc.ContentPlaceHolderID = "fake";
+ }
+
+ }
+}
+#endif
\ No newline at end of file
Added:
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/GridViewRowCollectionTest.cs
===================================================================
---
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/GridViewRowCollectionTest.cs
2006-07-07 09:10:15 UTC (rev 62344)
+++
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/GridViewRowCollectionTest.cs
2006-07-07 09:42:19 UTC (rev 62345)
@@ -0,0 +1,123 @@
+//
+// Tests for System.Web.UI.WebControls.GridViewRowCollectionTest.cs
+//
+// Author:
+// Yoni Klein ([EMAIL PROTECTED])
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using NUnit.Framework;
+
+
+namespace MonoTests.System.Web.UI.WebControls
+{
+ class PokerGridViewRowCollection : GridViewRowCollection
+ {
+ public PokerGridViewRowCollection (ArrayList list)
+ : base (list)
+ {
+
+ }
+ }
+
+ [TestFixture]
+ public class GridViewRowCollectionTest
+ {
+
+ [Test]
+ public void GridViewRowCollection_DefaultProperty ()
+ {
+ GridViewRowCollection collection = new
GridViewRowCollection(new ArrayList());
+ Assert.AreEqual (0, collection.Count, "Count");
+ Assert.AreEqual (false, collection.IsSynchronized,
"IsSynchronized"); //Always return false
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void GridViewRowCollection_DefaultPropertyNotWorking ()
+ {
+ GridViewRowCollection collection = new
GridViewRowCollection (new ArrayList ());
+ // Note : does not contain a definition for `IsReadOnly'
+ //Assert.AreEqual (false, collection.IsReadOnly,
"IsReadOnly"); //Always return false
+ Assert.AreEqual (collection, collection.SyncRoot,
"SyncRoot");
+ }
+
+ [Test]
+ public void GridViewRowCollection_AssignProperty ()
+ {
+ ArrayList list = new ArrayList ();
+ list.Add(new GridViewRow (0, 0,
DataControlRowType.DataRow, DataControlRowState.Normal));
+ GridViewRowCollection collection = new
GridViewRowCollection (list);
+ Assert.AreEqual (1, collection.Count, "Count");
+ // Note : does not contain a definition for `IsReadOnly'
+ //Assert.AreEqual (false, collection.IsReadOnly,
"IsReadOnly"); //Always return false
+ Assert.AreEqual (false, collection.IsSynchronized,
"IsSynchronized"); //Always return false
+ Assert.AreEqual (typeof(GridViewRow),
collection[0].GetType (), "Item");
+ }
+
+ [Test]
+ public void GridViewRowCollection_CopyTo ()
+ {
+ ArrayList list = new ArrayList ();
+ list.Add (new GridViewRow (0, 0,
DataControlRowType.DataRow, DataControlRowState.Normal));
+ GridViewRowCollection collection = new
GridViewRowCollection (list);
+ GridViewRow[] rows = new GridViewRow[collection.Count];
+ collection.CopyTo (rows, 0);
+ Assert.AreEqual (collection.Count, rows.Length,
"CopyToLenth");
+ Assert.IsNotNull (rows[0], "CopyToTargetCreated");
+ Assert.AreEqual (collection[0].GetType (),
rows[0].GetType (), "CopyToTargetType");
+ }
+
+ [Test]
+ public void GridViewRowCollection_GetEnumerator ()
+ {
+ ArrayList list = new ArrayList ();
+ list.Add (new GridViewRow (0, 0,
DataControlRowType.DataRow, DataControlRowState.Normal));
+ GridViewRowCollection collection = new
GridViewRowCollection (list);
+ IEnumerator numerator = collection.GetEnumerator ();
+ Assert.IsNotNull (numerator, "IEnumeratorCreated");
+ numerator.Reset ();
+ numerator.MoveNext ();
+ Assert.AreEqual (numerator.Current, collection[0],
"GetEnumeratorCurrent");
+ Assert.AreEqual (typeof (GridViewRow),
numerator.Current.GetType (), "");
+ }
+
+ [Test]
+ [ExpectedException(typeof(ArgumentOutOfRangeException))]
+ public void GridViewRowCollection_ItemException ()
+ {
+ GridViewRowCollection collection = new
GridViewRowCollection (new ArrayList ());
+ Assert.AreEqual (null, collection[0], "Item");
+
+ }
+ }
+}
+#endif
\ No newline at end of file
Added:
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/GridViewRowTest.cs
===================================================================
---
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/GridViewRowTest.cs
2006-07-07 09:10:15 UTC (rev 62344)
+++
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/GridViewRowTest.cs
2006-07-07 09:42:19 UTC (rev 62345)
@@ -0,0 +1,91 @@
+//
+// Tests for System.Web.UI.WebControls.GridViewRowTest.cs
+//
+// Author:
+// Yoni Klein ([EMAIL PROTECTED])
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+#if NET_2_0
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using NUnit.Framework;
+
+
+namespace MonoTests.System.Web.UI.WebControls
+{
+ class PokerGridViewRow : GridViewRow
+ {
+ // View state Stuff
+ public PokerGridViewRow(int rowIndex,int
dataItemIndex,DataControlRowType rowType,DataControlRowState rowState)
+ :base(rowIndex,dataItemIndex,rowType,rowState)
+ {
+ TrackViewState ();
+ }
+
+ public bool DoOnBubbleEvent (object source, EventArgs e)
+ {
+ return base.OnBubbleEvent (source, e);
+ }
+ }
+
+ [TestFixture]
+ public class GridViewRowTest
+ {
+
+ [Test]
+ public void GridViewRow_DefaultProperty ()
+ {
+ GridViewRow row = new GridViewRow(0, 0,
DataControlRowType.DataRow, DataControlRowState.Normal);
+ Assert.AreEqual (null, row.DataItem, "DataItem");
+ Assert.AreEqual (0, row.DataItemIndex,
"DataItemIndex"); //This value assigned into constractor
+ Assert.AreEqual (0, row.RowIndex, "RowIndex");
//This value assigned into constractor
+ Assert.AreEqual (DataControlRowType.DataRow,
row.RowType, "RowType"); //This value assigned into constractor
+ Assert.AreEqual (DataControlRowState.Normal,
row.RowState, "RowState"); //This value assigned into constractor
+ }
+
+ [Test]
+ public void GridViewRow_AssignProperty ()
+ {
+ // All public or protected property are assigned into
constractor
+ // and was tested into default property test
+ }
+
+ [Test]
+ public void GridViewRow_BubbleEvent ()
+ {
+ PokerGridViewRow row = new PokerGridViewRow(0, 0,
DataControlRowType.DataRow, DataControlRowState.Normal);
+ bool result = row.DoOnBubbleEvent (this, new
CommandEventArgs ("", null));
+ Assert.AreEqual (true, result,
"OnBubbleEventWithCommandEventArgs");
+ result = row.DoOnBubbleEvent (this, new EventArgs());
+ Assert.AreEqual (false, result,
"OnBubbleEventWithEventArgs");
+ }
+
+
+ }
+}
+#endif
\ No newline at end of file
Modified:
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/GridViewTest.cs
===================================================================
--- trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/GridViewTest.cs
2006-07-07 09:10:15 UTC (rev 62344)
+++ trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/GridViewTest.cs
2006-07-07 09:42:19 UTC (rev 62345)
@@ -45,6 +45,7 @@
using MyWebControl = System.Web.UI.WebControls;
using System.Data;
using System.Drawing;
+using System.Threading;
namespace MonoTests.System.Web.UI.WebControls
{
@@ -299,6 +300,12 @@
ArrayList myds = new ArrayList ();
public bool InitilizePager;
+ [SetUp]
+ public void SetupTestCase ()
+ {
+ Thread.Sleep (100);
+ }
+
[TestFixtureSetUp]
public void GridViewInit ()
{
@@ -1051,7 +1058,7 @@
string RenderedPageHtml = new WebTest
(PageInvoker.CreateOnLoad (RenderAllowPaging)).Run ();
string RenderedControlHtml =
HtmlDiff.GetControlFromPageHtml (RenderedPageHtml);
string OriginControlHtml = @"<div>
- <table cellspacing=""0""
rules=""all"" border=""1"">
+ <table cellspacing=""0""
rules=""all"" border=""1"" style=""border-collapse:collapse;"">
<tr>
<th scope=""col"">Item</th>
</tr><tr>
@@ -1101,7 +1108,7 @@
string RenderedPageHtml = new WebTest
(PageInvoker.CreateOnLoad (RenderingBoundField)).Run ();
string RenderedControlHtml =
HtmlDiff.GetControlFromPageHtml (RenderedPageHtml);
string OriginControlHtml = @"<div>
- <table
cellspacing=""0"" rules=""all"" border=""1"">
+ <table
cellspacing=""0"" rules=""all"" border=""1""
style=""border-collapse:collapse;"">
<tr>
<th
scope=""col"">HeaderText</th>
</tr><tr>
@@ -1123,7 +1130,7 @@
string RenderedPageHtml = new WebTest
(PageInvoker.CreateOnLoad (RenderingCheckBoxField)).Run ();
string RenderedControlHtml =
HtmlDiff.GetControlFromPageHtml (RenderedPageHtml);
string OriginControlHtml = @"<div>
- <table
cellspacing=""0"" rules=""all"" border=""1"">
+ <table
cellspacing=""0"" rules=""all"" border=""1""
style=""border-collapse:collapse;"">
<tr>
<th
scope=""col"">HeaderText</th>
</tr><tr>
@@ -1145,18 +1152,18 @@
string RenderedPageHtml = new WebTest
(PageInvoker.CreateOnLoad (RenderingImageField)).Run ();
string RenderedControlHtml =
HtmlDiff.GetControlFromPageHtml (RenderedPageHtml);
string OriginControlHtml = @"<div>
- <table
cellspacing=""0"" rules=""all"" border=""1"">
+ <table
cellspacing=""0"" rules=""all"" border=""1""
style=""border-collapse:collapse;"">
<tr>
<th
scope=""col"">HeaderText</th>
</tr><tr>
-
<td><img src=""1"" alt=""1"" border=""0"" /></td>
+
<td><img src=""1"" alt=""1"" style=""border-width:0px;"" /></td>
</tr><tr>
-
<td><img src=""2"" alt=""2"" border=""0"" /></td>
+
<td><img src=""2"" alt=""2"" style=""border-width:0px;"" /></td>
</tr><tr>
<td>FooterText</td>
</tr>
</table>
- </div>";
+ </div>";
HtmlDiff.AssertAreEqual (OriginControlHtml,
RenderedControlHtml, "RenderingImageField");
}
@@ -1167,7 +1174,7 @@
string RenderedPageHtml = new WebTest
(PageInvoker.CreateOnLoad (RenderingCommandField)).Run ();
string RenderedControlHtml =
HtmlDiff.GetControlFromPageHtml (RenderedPageHtml);
string OriginControlHtml = @"<div>
- <table
cellspacing=""0"" rules=""all"" border=""1"">
+ <table
cellspacing=""0"" rules=""all"" border=""1""
style=""border-collapse:collapse;"">
<tr>
<th
scope=""col"">HeaderText</th>
</tr><tr>
@@ -1189,7 +1196,7 @@
string RenderedPageHtml = new WebTest
(PageInvoker.CreateOnLoad (RenderingHyperLinkField)).Run ();
string RenderedControlHtml =
HtmlDiff.GetControlFromPageHtml (RenderedPageHtml);
string OriginControlHtml = @"<div>
- <table
cellspacing=""0"" rules=""all"" border=""1"">
+ <table
cellspacing=""0"" rules=""all"" border=""1""
style=""border-collapse:collapse;"">
<tr>
<th
scope=""col"">HeaderText</th>
</tr><tr>
@@ -1211,21 +1218,25 @@
string RenderedPageHtml = new WebTest
(PageInvoker.CreateOnLoad (RenderingButtonField)).Run ();
string RenderedControlHtml =
HtmlDiff.GetControlFromPageHtml (RenderedPageHtml);
string OriginControlHtml = @"<div>
- <table
cellspacing=""0"" rules=""all"" border=""1"">
+ <table
cellspacing=""0"" rules=""all"" border=""1""
style=""border-collapse:collapse;"">
<tr>
<th
scope=""col"">HeaderText</th><th scope=""col"">HeaderText</th><th
scope=""col"">HeaderText</th>
</tr><tr>
-
<td><input type=""button"" value=""1""
onclick=""javascript:__doPostBack('ctl01','$0')"" /></td><td><a
href=""javascript:__doPostBack('ctl01','$0')"">1</a></td><td><input
type=""image"" src="""" alt=""1""
onclick=""javascript:__doPostBack('ctl01','$0')"" border=""0"" /></td>
+
<td><input type=""button"" value=""1""
onclick=""javascript:__doPostBack('ctl01','0')"" /></td><td><a
href=""javascript:__doPostBack('ctl01','0')"">1</a></td><td><input
type=""image"" src="""" alt=""1""
onclick=""javascript:__doPostBack('ctl01','0')"" style=""border-width:0px;""
/></td>
</tr><tr>
-
<td><input type=""button"" value=""2""
onclick=""javascript:__doPostBack('ctl01','$1')"" /></td><td><a
href=""javascript:__doPostBack('ctl01','$1')"">2</a></td><td><input
type=""image"" src="""" alt=""2""
onclick=""javascript:__doPostBack('ctl01','$1')"" border=""0"" /></td>
+
<td><input type=""button"" value=""2""
onclick=""javascript:__doPostBack('ctl01','1')"" /></td><td><a
href=""javascript:__doPostBack('ctl01','1')"">2</a></td><td><input
type=""image"" src="""" alt=""2""
onclick=""javascript:__doPostBack('ctl01','1')"" style=""border-width:0px;""
/></td>
</tr><tr>
<td>FooterText</td><td>FooterText</td><td>FooterText</td>
</tr>
</table>
- </div>";
+ </div>";
HtmlDiff.AssertAreEqual (OriginControlHtml,
RenderedControlHtml, "RenderingCheckBoxField");
}
+
+
+
+
[Test]
[Category ("NotWorking")]
public void GridView_RenderingTemplateField ()
@@ -1234,15 +1245,15 @@
string RenderedPageHtml = new WebTest
(PageInvoker.CreateOnLoad (RenderingTemplateField)).Run ();
string RenderedControlHtml =
HtmlDiff.GetControlFromPageHtml (RenderedPageHtml);
string OriginControlHtml = @"<div>
- <table
cellspacing=""0"" rules=""all"" border=""1"">
+ <table
cellspacing=""0"" rules=""all"" border=""1""
style=""border-collapse:collapse;"">
<tr>
- <th
scope=""col""><input name=""ctl01$ctl01$TextBox1"" type=""text""
id=""ctl01_ctl01_TextBox1"" /></th>
+ <th
scope=""col""><input name="""" type=""text"" id="""" /></th>
</tr><tr>
-
<td><input name=""ctl01$ctl02$TextBox1"" type=""text"" value=""1""
id=""ctl01_ctl02_TextBox1"" /></td>
+
<td><input name="""" type=""text"" value=""1"" id="""" /></td>
</tr><tr>
-
<td><input name=""ctl01$ctl03$TextBox1"" type=""text"" value=""2""
id=""ctl01_ctl03_TextBox1"" /></td>
+
<td><input name="""" type=""text"" value=""2"" id="""" /></td>
</tr><tr>
-
<td><input name=""ctl01$ctl04$TextBox1"" type=""text""
id=""ctl01_ctl04_TextBox1"" /></td>
+
<td><input name="""" type=""text"" id="""" /></td>
</tr>
</table>
</div>";
@@ -1250,12 +1261,12 @@
}
-
public static void RenderingTemplateField (Page p)
{
LiteralControl lcb = new LiteralControl
(HtmlDiff.BEGIN_TAG);
LiteralControl lce = new LiteralControl
(HtmlDiff.END_TAG);
GridView grid = new GridView ();
+ grid.ID = "grid";
grid.AutoGenerateColumns = false;
grid.ShowFooter = true;
TemplateField templatefield = new TemplateField ();
@@ -1433,6 +1444,179 @@
grid.DataBind ();
}
+ ///////////////////////////////////////////////////////
+ ///// GRIDVIEW POSTBACK //////
+ ///////////////////////////////////////////////////////
+
+ /// <summary>
+ /// Urgent Note!
+ /// All postback event are failed on reason
+ /// System.NotImplementedException:
+ /// The requested feature is not implemented.
+ /// At
System.Web.UI.WebControls.GridView.System.Web.UI.WebControls.IPostBackContainer.GetPostBackOptions
(IButtonControl control)
+ /// [0x00000] in
C:\cygwin\monobuild\mcs\class\System.Web\System.Web.UI.WebControls\GridView.cs:1891
+ /// </summary>
+
+ [Test]
+ [Category ("NunitWeb")]
+ [Category ("NotWorking")]
+ public void GridView_PostBackSotring ()
+ {
+ WebTest t = new WebTest (PageInvoker.CreateOnLoad
(GridView_postback));
+ string pageHTML = t.Run ();
+ Assert.AreEqual (-1, pageHTML.IndexOf
("SortingSuccess"), "BeforeSorting");
+ FormRequest fr = new FormRequest (t.Response, "form1");
+ fr.Controls.Add ("__EVENTTARGET");
+ fr.Controls.Add ("__EVENTARGUMENT");
+ fr.Controls["__EVENTTARGET"].Value = "mygrid";
+ fr.Controls["__EVENTARGUMENT"].Value = "Sort$Item";
+ t.Request = fr;
+ t.Invoker = PageInvoker.CreateOnLoad
(GridView_postback);
+ pageHTML = t.Run ();
+ if (pageHTML.IndexOf ("SortingSuccess") < 0) {
+ Assert.Fail ("SortingFail");
+ }
+ }
+
+ [Test]
+ [Category ("NunitWeb")]
+ [Category ("NotWorking")]
+ public void GridView_PostBackPaging ()
+ {
+ WebTest t = new WebTest (PageInvoker.CreateOnLoad
(GridView_postback));
+ string pageHTML = t.Run ();
+ Assert.AreEqual (-1, pageHTML.IndexOf
("PagingSuccess"), "BeforePaging");
+ FormRequest fr = new FormRequest (t.Response, "form1");
+ fr.Controls.Add ("__EVENTTARGET");
+ fr.Controls.Add ("__EVENTARGUMENT");
+ fr.Controls["__EVENTTARGET"].Value = "mygrid";
+ fr.Controls["__EVENTARGUMENT"].Value = "Page$2";
+ t.Request = fr;
+ t.Invoker = PageInvoker.CreateOnLoad
(GridView_postback);
+ pageHTML = t.Run ();
+ if (pageHTML.IndexOf ("PagingSuccess") < 0) {
+ Assert.Fail ("PagingFail");
+ }
+ }
+
+ [Test]
+ [Category ("NunitWeb")]
+ [Category ("NotWorking")]
+ public void GridView_PostBackDelete ()
+ {
+ WebTest t = new WebTest (PageInvoker.CreateOnLoad
(GridView_postback));
+ string pageHTML = t.Run ();
+ Assert.AreEqual (-1, pageHTML.IndexOf
("DeleteSuccess"), "BeforeDelete");
+ FormRequest fr = new FormRequest (t.Response, "form1");
+ fr.Controls.Add ("__EVENTTARGET");
+ fr.Controls.Add ("__EVENTARGUMENT");
+ fr.Controls["__EVENTTARGET"].Value = "mygrid";
+ fr.Controls["__EVENTARGUMENT"].Value = "Delete$0";
+ t.Request = fr;
+ t.Invoker = PageInvoker.CreateOnLoad
(GridView_postback);
+ pageHTML = t.Run ();
+ if (pageHTML.IndexOf ("DeleteSuccess") < 0) {
+ Assert.Fail ("DeleteFail");
+ }
+ }
+
+ [Test]
+ [Category ("NunitWeb")]
+ [Category ("NotWorking")]
+ public void GridView_PostBackEdit ()
+ {
+ WebTest t = new WebTest (PageInvoker.CreateOnLoad
(GridView_postback));
+ string pageHTML = t.Run ();
+ Assert.AreEqual (-1, pageHTML.IndexOf ("EditSuccess"),
"BeforeEdit");
+ FormRequest fr = new FormRequest (t.Response, "form1");
+ fr.Controls.Add ("__EVENTTARGET");
+ fr.Controls.Add ("__EVENTARGUMENT");
+ fr.Controls["__EVENTTARGET"].Value = "mygrid";
+ fr.Controls["__EVENTARGUMENT"].Value = "Edit$0";
+ t.Request = fr;
+ t.Invoker = PageInvoker.CreateOnLoad
(GridView_postback);
+ pageHTML = t.Run ();
+ if (pageHTML.IndexOf ("EditSuccess") < 0) {
+ Assert.Fail ("EditFail");
+ }
+ }
+
+ [Test]
+ [Category ("NunitWeb")]
+ [Category ("NotWorking")]
+ public void GridView_PostBackSelect ()
+ {
+ WebTest t = new WebTest (PageInvoker.CreateOnLoad
(GridView_postback));
+ string pageHTML = t.Run ();
+ Assert.AreEqual (-1, pageHTML.IndexOf
("SelectSuccess"), "BeforeSelect");
+ FormRequest fr = new FormRequest (t.Response, "form1");
+ fr.Controls.Add ("__EVENTTARGET");
+ fr.Controls.Add ("__EVENTARGUMENT");
+ fr.Controls["__EVENTTARGET"].Value = "mygrid";
+ fr.Controls["__EVENTARGUMENT"].Value = "Select$0";
+ t.Request = fr;
+ t.Invoker = PageInvoker.CreateOnLoad
(GridView_postback);
+ pageHTML = t.Run ();
+ if (pageHTML.IndexOf ("SelectSuccess") < 0) {
+ Assert.Fail ("SelectFail");
+ }
+ }
+
+ public void GridView_postback (Page p)
+ {
+ PokerGridView b = new PokerGridView ();
+ b.ID = "mygrid";
+ b.PageIndexChanging += new GridViewPageEventHandler
(b_PageIndexChanging);
+ b.Sorting += new GridViewSortEventHandler (b_Sorting);
+ b.RowDeleting += new GridViewDeleteEventHandler
(b_RowDeleting);
+ b.RowEditing += new GridViewEditEventHandler
(b_RowEditing);
+ b.SelectedIndexChanging += new
GridViewSelectEventHandler (b_SelectedIndexChanging);
+ ArrayList myds = new ArrayList ();
+ myds.Add ("Norway");
+ myds.Add ("Sweden");
+ myds.Add ("France");
+ myds.Add ("Italy");
+
+ p.Form.Controls.Add (b);
+ b.AllowPaging = true;
+ b.PageSize = 2;
+ b.AllowSorting = true;
+
+ b.AutoGenerateDeleteButton = true;
+ b.AutoGenerateEditButton = true;
+ b.AutoGenerateSelectButton = true;
+
+ b.DataSource = myds;
+ b.DataBind ();
+ }
+
+ public void b_RowEditing (object o, GridViewEditEventArgs e)
+ {
+ ((GridView) o).Page.Controls.Add (new LiteralControl
("EditSuccess"));
+ Assert.AreEqual (false, e.Cancel, "EditCancel");
+ Assert.AreEqual (0, e.NewEditIndex, "NewEditIndex");
+ }
+
+ public void b_PageIndexChanging (object o,
GridViewPageEventArgs e)
+ {
+ ((GridView) o).Page.Controls.Add (new LiteralControl
("PagingSuccess"));
+ Assert.AreEqual(false,e.Cancel,"Cancel");
+ }
+
+ public void b_Sorting (object o, GridViewSortEventArgs e)
+ {
+ ((GridView) o).Page.Controls.Add (new LiteralControl
("SortingSuccess"));
+ }
+
+ public void b_RowDeleting (object o, GridViewDeleteEventArgs e)
+ {
+ ((GridView) o).Page.Controls.Add (new LiteralControl
("DeleteSuccess"));
+ }
+
+ public void b_SelectedIndexChanging (object o,
GridViewSelectEventArgs e)
+ {
+ ((GridView) o).Page.Controls.Add (new LiteralControl
("SelectSuccess"));
+ }
/// <summary>
Modified: trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/MenuTest.cs
===================================================================
--- trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/MenuTest.cs
2006-07-07 09:10:15 UTC (rev 62344)
+++ trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/MenuTest.cs
2006-07-07 09:42:19 UTC (rev 62345)
@@ -123,12 +123,6 @@
[TestFixture]
public class MenuTest
{
- [SetUp]
- public void SetupTestCase ()
- {
- Thread.Sleep (100);
- }
-
[Test]
public void Menu_DefaultProperties ()
{
@@ -390,7 +384,7 @@
[Test]
[Category ("NunitWeb")]
- [Category ("NotWorking")] //Must be running after hosting bug
resolve
+ [Category ("NotWorking")]
public void Menu_RenderBeginTag ()
{
new WebTest (PageInvoker.CreateOnLoad
(_BeginTagRender)).Run ();
@@ -405,7 +399,7 @@
string RenderedControlHtml = sw.ToString();
string OriginControlHtml = @"<a
href=""#ctl01_SkipLink"">
<img alt=""Skip Navigation
Links""
src=""/NunitWeb/WebResource.axd?d=gZrz8lvSQfolS1pG07HX9g2&t=632784640484505569""
- width=""0"" height=""0""
style=""border-width:0px;"" />
+ width=""0""
style=""border-width:0px"" height=""0"" style=""border-width:0px;"" />
</a><table id=""ctl01""
cellpadding=""0"" cellspacing=""0"" border=""0"">";
@@ -415,7 +409,7 @@
[Test]
[Category ("NunitWeb")]
- [Category ("NotWorking")] //Must be running after hosting bug
resolve
+ [Category ("NotWorking")]
public void Menu_RenderEndTag ()
{
new WebTest (PageInvoker.CreateOnLoad
(_EndTagRender)).Run ();
@@ -431,7 +425,7 @@
string RenderedControlHtml = sw.ToString ();
string OriginControlHtml = @"<a
href=""#ctl01_SkipLink"">
<img alt=""Skip Navigation
Links""
src=""/NunitWeb/WebResource.axd?d=gZrz8lvSQfolS1pG07HX9g2&t=632784640484505569""
- width=""0"" height=""0""
style=""border-width:0px;"" />
+ width=""0""
style=""border-width:0px"" height=""0"" style=""border-width:0px;"" />
</a><table id=""ctl01""
cellpadding=""0"" cellspacing=""0"" border=""0"">
</table><a
id=""ctl01_SkipLink""></a>";
@@ -509,7 +503,7 @@
[Test]
[Category ("NunitWeb")]
- [Category ("NotWorking")] //Must be running after hosting bug
resolve
+ [Category ("NotWorking")]
public void Menu_DefaultRender ()
{
string RenderedPageHtml = new WebTest
(PageInvoker.CreateOnLoad (_DefaultRender)).Run ();
@@ -531,42 +525,43 @@
}
[Test]
[Category ("NunitWeb")]
- [Category ("NotWorking")] //Must be running after hosting bug
resolve
+ [Category ("NotWorking")]
public void Menu_ItemsRender ()
{
string RenderedPageHtml = new WebTest
(PageInvoker.CreateOnLoad (_ItemsRender)).Run ();
string RenderedControlHtml =
HtmlDiff.GetControlFromPageHtml (RenderedPageHtml);
- string OriginControlHtml = @"<a
href=""#ctl01_SkipLink""><img alt=""Skip Navigation Links""
src=""/NunitWeb/WebResource.axd?d=gZrz8lvSQfolS1pG07HX9g2&t=632784640484505569""
width=""0"" height=""0"" border=""0"" />
- </a><table id=""ctl01""
cellpadding=""0"" cellspacing=""0"" border=""0"">
- <tr
onmouseover=""Menu_HoverStatic(this)"" onmouseout=""Menu_Unhover(this)""
onkeyup=""Menu_Key(event)"" id=""ctl01n0"">
- <td><table
cellpadding=""0"" cellspacing=""0"" border=""0"" width=""100%"">
- <tr>
- <td nowrap=""nowrap""
width=""100%""><a
href=""javascript:__doPostBack('ctl01','value1')"">root</a></td><td width=""0"">
- <img
src=""/NunitWeb/WebResource.axd?d=jEQEPhExqNH3fus0nmWZ3pFNw-rGIVoBqrGqFcOqB1U1&t=632784640484505569""
alt=""Expand root"" valign=""middle"" /></td>
- </tr>
- </table></td>
- </tr>
- </table><div
id=""ctl01n0Items"" style=""display:none;"">
- <table border=""0""
cellpadding=""0"" cellspacing=""0"">
- <tr
onmouseover=""Menu_HoverDynamic(this)"" onmouseout=""Menu_Unhover(this)""
onkeyup=""Menu_Key(event)"" id=""ctl01n1"">
- <td><table
cellpadding=""0"" cellspacing=""0"" border=""0"" width=""100%"">
- <tr>
- <td nowrap=""nowrap""
width=""100%""><a
href=""javascript:__doPostBack('ctl01','value1\\value2')"">node1</a></td>
- </tr>
- </table></td>
- </tr><tr
onmouseover=""Menu_HoverDynamic(this)"" onmouseout=""Menu_Unhover(this)""
onkeyup=""Menu_Key(event)"" id=""ctl01n2"">
- <td><table
cellpadding=""0"" cellspacing=""0"" border=""0"" width=""100%"">
- <tr>
- <td nowrap=""nowrap""
width=""100%""><a
href=""javascript:__doPostBack('ctl01','value1\\value3')"">node2</a></td>
- </tr>
- </table></td>
- </tr>
- </table><div
id=""ctl01n0ItemsUp"" onmouseover=""PopOut_Up(this)""
onmouseout=""PopOut_Stop(this)"" align=""center"" style=""display:none;"">
- <img
src=""/NunitWeb/WebResource.axd?d=Kql4shtTcfCiKn_s1ZX6W6WIJmS2VsB7hDFw8oD-9I01&t=632784640484505569""
alt=""Scroll up"" />
- </div><div
id=""ctl01n0ItemsDn"" onmouseover=""PopOut_Down(this)""
onmouseout=""PopOut_Stop(this)"" align=""center"" style=""display:none;"">
- <img
src=""/NunitWeb/WebResource.axd?d=QxI-WSWnY8jfAZsv_BcOLFGj_CTJTI_bGi0dPzQPCtI1&t=632784640484505569""
alt=""Scroll down"" />
- </div>
- </div><a
id=""ctl01_SkipLink""></a>";
+ string OriginControlHtml = @"<a
href=""#ctl01_SkipLink""><img alt=""Skip Navigation Links""
src=""/NunitWeb/WebResource.axd?d=gZrz8lvSQfolS1pG07HX9g2&t=632784640484505569""
width=""0"" height=""0""
+ style=""border-width:0px;"" /></a>
+ <table id=""ctl01"" class=""ctl01_2""
cellpadding=""0"" cellspacing=""0"" border=""0"">
+ <tr onmouseover=""Menu_HoverStatic(this)""
onmouseout=""Menu_Unhover(this)"" onkeyup=""Menu_Key(this)"" id=""ctl01n0"">
+ <td><table cellpadding=""0"" cellspacing=""0""
border=""0"" width=""100%"">
+ <tr>
+ <td style=""white-space:nowrap;width:100%;""><a
class=""ctl01_1""
href=""javascript:__doPostBack('ctl01','value1')"">root</a></td><td
style=""width:0;"">
+ <img
src=""/NunitWeb/WebResource.axd?d=jEQEPhExqNH3fus0nmWZ3pFNw-rGIVoBqrGqFcOqB1U1&t=632784640484505569""
alt=""Expand root"" style=""border-style:none;vertical-align:middle;"" /></td>
+ </tr>
+ </table></td>
+ </tr>
+ </table><div id=""ctl01n0Items""
class=""ctl01_0"">
+ <table border=""0"" cellpadding=""0""
cellspacing=""0"">
+ <tr onmouseover=""Menu_HoverDynamic(this)""
onmouseout=""Menu_Unhover(this)"" onkeyup=""Menu_Key(this)"" id=""ctl01n1"">
+ <td><table cellpadding=""0"" cellspacing=""0""
border=""0"" width=""100%"">
+ <tr>
+ <td style=""white-space:nowrap;width:100%;""><a
class=""ctl01_1""
href=""javascript:__doPostBack('ctl01','value1\\value2')"">node1</a></td>
+ </tr>
+ </table></td>
+ </tr><tr
onmouseover=""Menu_HoverDynamic(this)"" onmouseout=""Menu_Unhover(this)""
onkeyup=""Menu_Key(this)"" id=""ctl01n2"">
+ <td><table cellpadding=""0"" cellspacing=""0""
border=""0"" width=""100%"">
+ <tr>
+ <td style=""white-space:nowrap;width:100%;""><a
class=""ctl01_1""
href=""javascript:__doPostBack('ctl01','value1\\value3')"">node2</a></td>
+ </tr>
+ </table></td>
+ </tr>
+ </table><div class=""ctl01_0""
id=""ctl01n0ItemsUp"" onmouseover=""PopOut_Up(this)""
onmouseout=""PopOut_Stop(this)"" style=""text-align:center;"">
+ <img
src=""/NunitWeb/WebResource.axd?d=Kql4shtTcfCiKn_s1ZX6W6WIJmS2VsB7hDFw8oD-9I01&t=632784640484505569""
alt=""Scroll up"" />
+ </div><div class=""ctl01_0""
id=""ctl01n0ItemsDn"" onmouseover=""PopOut_Down(this)""
onmouseout=""PopOut_Stop(this)"" style=""text-align:center;"">
+ <img
src=""/NunitWeb/WebResource.axd?d=QxI-WSWnY8jfAZsv_BcOLFGj_CTJTI_bGi0dPzQPCtI1&t=632784640484505569""
alt=""Scroll down"" />
+ </div>
+ </div><a id=""ctl01_SkipLink""></a>";
HtmlDiff.AssertAreEqual(OriginControlHtml,
RenderedControlHtml,"Render Items");
}
@@ -713,7 +708,11 @@
[Test]
public void MenuClass ()
{
+#if DOT_NET
+ WebTest.CopyResource (GetType (),
"MonoTests.System.Web.UI.WebControls.Resources.menuclass.aspx",
"menuclass.aspx");
+#else
WebTest.CopyResource (GetType (), "menuclass.aspx",
"menuclass.aspx");
+#endif
string res = new WebTest ("menuclass.aspx").Run ();
string
menua_pattern="<table[^>]*class=\"[^\"]*menua[^\"]*\"[^>]*>";
Assert.IsTrue (Regex.IsMatch (res,
".*"+menua_pattern+".*",
@@ -723,6 +722,37 @@
RegexOptions.IgnoreCase|RegexOptions.Singleline),
"check that <table class=\"menua\"> is found
only once");
}
+
+ [Test]
+ [Category ("NunitWeb")]
+ [Category ("NotWorking")]
+ public void Menu_PostBack ()
+ {
+#if DOT_NET
+ WebTest.CopyResource (GetType (),
"MonoTests.System.Web.UI.WebControls.Resources.PostBackMenuTest.aspx",
"PostBackMenuTest.aspx");
+#else
+ WebTest.CopyResource (GetType (),
"PostBackMenuTest.aspx", "PostBackMenuTest.aspx");
+#endif
+ WebTest t = new WebTest ("PostBackMenuTest.aspx");
+ string str = t.Run ();
+ FormRequest fr = new FormRequest (t.Response, "form1");
+ fr.Controls.Add ("__EVENTTARGET");
+ fr.Controls.Add ("__EVENTARGUMENT");
+ fr.Controls["__EVENTTARGET"].Value = "Menu1";
+ fr.Controls["__EVENTARGUMENT"].Value = "root\\node2";
+ t.Request = fr;
+ t.Invoker = PageInvoker.CreateOnLoad (_MenuItemsPost);
+ t.Run ();
+ }
+
+ public static void _MenuItemsPost (Page p)
+ {
+ foreach (Control c in p.Form.Controls) {
+ Menu m = c as Menu;
+ if (m != null)
+ Assert.AreEqual ("node2",
m.SelectedValue, "MenuItemsPostBack");
+ }
+ }
}
}
#endif
Added:
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/PagerSettingsTest.cs
===================================================================
---
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/PagerSettingsTest.cs
2006-07-07 09:10:15 UTC (rev 62344)
+++
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/PagerSettingsTest.cs
2006-07-07 09:42:19 UTC (rev 62345)
@@ -0,0 +1,146 @@
+//
+// Tests for System.Web.UI.WebControls.PagerSettingsTest.cs
+//
+// Author:
+// Yoni Klein ([EMAIL PROTECTED])
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+#if NET_2_0
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using NUnit.Framework;
+
+
+namespace MonoTests.System.Web.UI.WebControls
+{
+
+
+ [TestFixture]
+ public class PagerSettingsTest
+ {
+ private bool _eventchecker;
+
+ [Test]
+ public void PagerSettings_DefaultProperty ()
+ {
+ PagerSettings pager = new PagerSettings ();
+ Assert.AreEqual ("", pager.FirstPageImageUrl,
"FirstPageImageUrl");
+ Assert.AreEqual ("<<", pager.FirstPageText,
"FirstPageText");
+ Assert.AreEqual ("", pager.LastPageImageUrl,
"LastPageImageUrl");
+ Assert.AreEqual (">>", pager.LastPageText,
"LastPageText");
+ Assert.AreEqual (PagerButtons.Numeric, pager.Mode,
"Mode");
+ Assert.AreEqual ("", pager.NextPageImageUrl,
"NextPageImageUrl");
+ Assert.AreEqual (">", pager.NextPageText,
"NextPageText");
+ Assert.AreEqual (10, pager.PageButtonCount,
"PageButtonCount");
+ Assert.AreEqual (PagerPosition.Bottom, pager.Position,
"Position");
+ Assert.AreEqual ("", pager.PreviousPageImageUrl,
"PreviousPageImageUrl");
+ Assert.AreEqual ("<", pager.PreviousPageText,
"PreviousPageText");
+ Assert.AreEqual (true, pager.Visible, "Visible");
+ }
+
+ [Test]
+ public void PagerSettings_AssignProperty ()
+ {
+ PagerSettings pager = new PagerSettings ();
+ pager.FirstPageImageUrl = "test";
+ Assert.AreEqual ("test", pager.FirstPageImageUrl,
"FirstPageImageUrl");
+ pager.FirstPageText = "test";
+ Assert.AreEqual ("test", pager.FirstPageText,
"FirstPageText");
+ pager.LastPageImageUrl = "test";
+ Assert.AreEqual ("test", pager.LastPageImageUrl,
"LastPageImageUrl");
+ pager.LastPageText = "test";
+ Assert.AreEqual ("test", pager.LastPageText,
"LastPageText");
+ pager.Mode = PagerButtons.NextPrevious;
+ Assert.AreEqual (PagerButtons.NextPrevious, pager.Mode,
"Mode");
+ pager.NextPageImageUrl = "test";
+ Assert.AreEqual ("test", pager.NextPageImageUrl,
"NextPageImageUrl");
+ pager.NextPageText = "test";
+ Assert.AreEqual ("test", pager.NextPageText,
"NextPageText");
+ pager.PageButtonCount = 20;
+ Assert.AreEqual (20, pager.PageButtonCount,
"PageButtonCount");
+ pager.Position = PagerPosition.Top;
+ Assert.AreEqual (PagerPosition.Top, pager.Position,
"Position");
+ pager.PreviousPageImageUrl = "test";
+ Assert.AreEqual ("test", pager.PreviousPageImageUrl,
"PreviousPageImageUrl");
+ pager.PreviousPageText = "test";
+ Assert.AreEqual ("test", pager.PreviousPageText,
"PreviousPageText");
+ pager.Visible = false;
+ Assert.AreEqual (false, pager.Visible, "Visible");
+ }
+
+ [Test]
+ public void PagerSettings_ToString ()
+ {
+ PagerSettings pager = new PagerSettings ();
+ string result = pager.ToString ();
+ Assert.AreEqual ("", result, "ToString");
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void PagerSettings_PropertyChanged ()
+ {
+ PagerSettings pager = new PagerSettings ();
+ // Note : does not contain a definition for
+ // `PropertyChanged'
+ // pager.PropertyChanged += new EventHandler
(pager_PropertyChanged);
+ pager.FirstPageImageUrl = "test";
+ eventassert ("FirstPageImageUrl");
+ pager.FirstPageText = "test";
+ eventassert ("FirstPageText");
+ pager.LastPageImageUrl = "test";
+ eventassert ("LastPageImageUrl");
+ pager.LastPageText = "test";
+ eventassert ("LastPageText");
+ pager.Mode = PagerButtons.NextPrevious;
+ eventassert ("Mode");
+ pager.NextPageImageUrl = "test";
+ eventassert ("NextPageImageUrl");
+ pager.NextPageText = "test";
+ eventassert ("NextPageText");
+ pager.PageButtonCount = 20;
+ eventassert ("PageButtonCount");
+ pager.PreviousPageImageUrl = "test";
+ eventassert ("PreviousPageImageUrl");
+ pager.PreviousPageText = "test";
+ eventassert ("PreviousPageText");
+ }
+
+ private void pager_PropertyChanged (object o, EventArgs e)
+ {
+ _eventchecker = true;
+ }
+
+ private void eventassert (string message)
+ {
+ Assert.IsTrue (_eventchecker, message);
+ _eventchecker = false;
+ }
+ }
+}
+#endif
\ No newline at end of file
Modified: trunk/mcs/class/System.Web/Test/mainsoft/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/Test/mainsoft/ChangeLog 2006-07-07 09:10:15 UTC
(rev 62344)
+++ trunk/mcs/class/System.Web/Test/mainsoft/ChangeLog 2006-07-07 09:42:19 UTC
(rev 62345)
@@ -1,3 +1,7 @@
+2006-07-07 Yoni Klain <[EMAIL PROTECTED]>
+
+ * added PostBackMenuTest.aspx embedded resources for MenuPostBack test
+
2006-27-06 Yoni Klain <[EMAIL PROTECTED]>
* NunitWebTest.cs : Changes for embedded resources
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches