Kaynağa Gözat

* TextBoxTest.cs: Add a test for Modified property.
- We need to put something on the clipboard before we can paste.


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

Jackson Harper 19 yıl önce
ebeveyn
işleme
f636355465

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

@@ -1,3 +1,8 @@
+2006-12-06  Jackson Harper  <[email protected]>
+
+	* TextBoxTest.cs: Add a test for Modified property.
+	- We need to put something on the clipboard before we can paste.
+
 2006-12-04  Jackson Harper  <[email protected]>
 
 	* TextBoxTest: More of these tests work now.

+ 20 - 0
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TextBoxTest.cs

@@ -45,10 +45,14 @@ namespace MonoTests.System.Windows.Forms
 			
 			Assert.AreEqual (BorderStyle.Fixed3D, textBox.BorderStyle, "#5");
 			Assert.AreEqual (false, textBox.CanUndo, "#6a");
+
+			Clipboard.SetDataObject ("TEST");
 			textBox.Paste ();
 			Assert.AreEqual (true, textBox.CanUndo, "#6b");
+			textBox.Undo ();
 			textBox.ClearUndo ();
 			Assert.AreEqual (false, textBox.CanUndo, "#6c");
+
 			Assert.AreEqual ("WindowText", textBox.ForeColor.Name, "#7");
 			Assert.AreEqual (true, textBox.HideSelection, "#8");
 			Assert.AreEqual (1, textBox.Lines.Length, "#9");
@@ -326,5 +330,21 @@ namespace MonoTests.System.Windows.Forms
 
 			Assert.AreEqual (text, textBox.Text, "#2");
 		}
+
+		
+		[Test]
+		public void ModifiedTest ()
+		{
+			Assert.AreEqual (true, textBox.Modified, "modified-1");
+
+			textBox.Modified = false;
+			Assert.AreEqual (false, textBox.Modified, "modified-2");
+
+			textBox.Modified = true;
+			Assert.AreEqual (true, textBox.Modified, "modified-2");
+
+			textBox.Text = "TEXT";
+			Assert.AreEqual (false, textBox.Modified, "modified-3");
+		}
 	}
 }