Browse Source

2006-08-08 Chris Toshok <[email protected]>

	* GridTableStylesCollectionTest.cs: make this fixture public so
	it's actually included, and add a test for changing the
	MappingName of a constituent TableStyle.


svn path=/trunk/mcs/; revision=63509
Chris Toshok 19 years ago
parent
commit
eb1396726d

+ 6 - 0
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog

@@ -1,3 +1,9 @@
+2006-08-08  Chris Toshok  <[email protected]>
+
+	* GridTableStylesCollectionTest.cs: make this fixture public so
+	it's actually included, and add a test for changing the
+	MappingName of a constituent TableStyle.
+
 2006-07-30  Carlos Alberto Cortez <[email protected]>
 
 	* PrintDialogTest.cs: Added.

+ 26 - 7
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/GridTableStylesCollectionTest.cs

@@ -35,7 +35,7 @@ using NUnit.Framework;
 namespace MonoTests.System.Windows.Forms
 {
 	[TestFixture]
-	class GridTableStylesCollectionTest
+	public class GridTableStylesCollectionTest
 	{
 		private bool eventhandled;
 		private object Element;
@@ -55,6 +55,25 @@ namespace MonoTests.System.Windows.Forms
 			Assert.AreEqual (false, sc.IsReadOnly, "IsReadOnly property");
 		}
 
+		[Test]
+		public void TestMappingNameChanged ()
+		{
+			DataGrid grid = new DataGrid ();
+			GridTableStylesCollection sc = grid.TableStyles;
+			sc.CollectionChanged += new CollectionChangeEventHandler (OnCollectionEventHandler);
+
+			// Add single
+			DataGridTableStyle ts = new DataGridTableStyle ();
+			ts.MappingName = "Table1";
+			sc.Add (ts);
+			ResetEventData ();
+			ts.MappingName = "Table2";
+
+			Assert.AreEqual (true, eventhandled, "A1");
+			Assert.AreEqual (null, Element, "A2");
+			Assert.AreEqual (CollectionChangeAction.Refresh, Action, "A3");
+		}
+
 		[Test]
 		public void TestAdd ()
 		{			
@@ -176,17 +195,17 @@ namespace MonoTests.System.Windows.Forms
 			Action = (CollectionChangeAction) 0;
 		}
 
-		private void OnEventHandler (object sender, EventArgs e)
-	        {
-	            	eventhandled = true;
+		private void OnEventHandler (object sender, EventArgs e)
+	        {
+	            	eventhandled = true;
 	        }
 
-	        private void OnCollectionEventHandler (object sender, CollectionChangeEventArgs e)
+	        private void OnCollectionEventHandler (object sender, CollectionChangeEventArgs e)
 	        {
-			times++;
+			times++;
 	            	eventhandled = true;
 	            	Element = e.Element;
-			Action = e.Action;			
+			Action = e.Action;
 	        }
 
 	}