Procházet zdrojové kódy

In Test/System.Windows.Forms:
2006-11-29 Chris Toshok <[email protected]>

* BindingTest.cs: add two new tests.

In System.Windows.Forms:
2006-11-29 Chris Toshok <[email protected]>

* Binding.cs (SetControl): fix unit test.


svn path=/trunk/mcs/; revision=68706

Chris Toshok před 19 roky
rodič
revize
3028ac42c5

+ 0 - 1
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Binding.cs

@@ -135,7 +135,6 @@ namespace System.Windows.Forms {
 			control.Validating += new CancelEventHandler (ControlValidatingHandler);
 
 			this.control = control;
-			control.DataBindings.Add (this);
 		}
 
 		internal void Check (BindingContext binding_context)

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

@@ -1,3 +1,7 @@
+2006-11-29  Chris Toshok  <[email protected]>
+
+	* Binding.cs (SetControl): fix unit test.
+
 2006-11-29  Carlos Alberto Cortez <[email protected]>
 
 	* PageSetupDialog.cs: Validate the margins and set them in

+ 32 - 0
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/BindingTest.cs

@@ -126,6 +126,38 @@ namespace MonoTests.System.Windows.Forms {
 			Console.WriteLine (Environment.StackTrace);
 			eventcount++;
 		}
+
+		[Test]
+		public void DataBindingCountTest1 ()
+		{
+			Control c = new Control ();
+			Assert.AreEqual (0, c.DataBindings.Count, "1");
+			c.DataBindings.Add (new Binding ("Text", c, "Name"));
+			Assert.AreEqual (1, c.DataBindings.Count, "2");
+
+			Binding b = c.DataBindings[0];
+			Assert.AreEqual (c, b.Control, "3");
+			Assert.AreEqual (c, b.DataSource, "4");
+			Assert.AreEqual ("Text", b.PropertyName, "5");
+			Assert.AreEqual ("Name", b.BindingMemberInfo.BindingField, "6");
+		}
+
+		[Test]
+		public void DataBindingCountTest2 ()
+		{
+			Control c = new Control ();
+			Control c2 = new Control ();
+			Assert.AreEqual (0, c.DataBindings.Count, "1");
+			c.DataBindings.Add (new Binding ("Text", c2, "Name"));
+			Assert.AreEqual (1, c.DataBindings.Count, "2");
+			Assert.AreEqual (0, c2.DataBindings.Count, "3");
+
+			Binding b = c.DataBindings[0];
+			Assert.AreEqual (c, b.Control, "4");
+			Assert.AreEqual (c2, b.DataSource, "5");
+			Assert.AreEqual ("Text", b.PropertyName, "6");
+			Assert.AreEqual ("Name", b.BindingMemberInfo.BindingField, "7");
+		}
 	}
 
 }

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

@@ -1,3 +1,7 @@
+2006-11-29  Chris Toshok  <[email protected]>
+
+	* BindingTest.cs: add two new tests.
+
 2006-11-28  Rolf Bjarne Kvinge  <[email protected]>
 
 	* TrackBar.cs: Changed SizeTest and OrientationTest