|
|
@@ -7,34 +7,34 @@
|
|
|
|
|
|
#if NET_2_0
|
|
|
|
|
|
-using System;
|
|
|
-using System.Collections;
|
|
|
-using System.ComponentModel;
|
|
|
-using System.Drawing;
|
|
|
-using System.Windows.Forms;
|
|
|
-using System.Xml;
|
|
|
-using System.Threading;
|
|
|
-using NUnit.Framework;
|
|
|
-using System.Globalization;
|
|
|
-using Thread=System.Threading.Thread;
|
|
|
-using CategoryAttribute=NUnit.Framework.CategoryAttribute;
|
|
|
-using System.Reflection;
|
|
|
-
|
|
|
-namespace MonoTests.System.Windows.Forms
|
|
|
-{
|
|
|
- [TestFixture]
|
|
|
- public class MaskedTextBoxTest
|
|
|
- {
|
|
|
+using System;
|
|
|
+using System.Collections;
|
|
|
+using System.ComponentModel;
|
|
|
+using System.Drawing;
|
|
|
+using System.Windows.Forms;
|
|
|
+using System.Xml;
|
|
|
+using System.Threading;
|
|
|
+using NUnit.Framework;
|
|
|
+using System.Globalization;
|
|
|
+using Thread=System.Threading.Thread;
|
|
|
+using CategoryAttribute=NUnit.Framework.CategoryAttribute;
|
|
|
+using System.Reflection;
|
|
|
+
|
|
|
+namespace MonoTests.System.Windows.Forms
|
|
|
+{
|
|
|
+ [TestFixture]
|
|
|
+ public class MaskedTextBoxTest
|
|
|
+ {
|
|
|
[SetUp]
|
|
|
public void Setup ()
|
|
|
{
|
|
|
Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo ("en-US");
|
|
|
}
|
|
|
|
|
|
- [Test]
|
|
|
- public void InitialProperties ()
|
|
|
- {
|
|
|
- MaskedTextBox mtb = new MaskedTextBox ();
|
|
|
+ [Test]
|
|
|
+ public void InitialProperties ()
|
|
|
+ {
|
|
|
+ MaskedTextBox mtb = new MaskedTextBox ();
|
|
|
Assert.AreEqual (false, mtb.AcceptsTab, "#A1");
|
|
|
Assert.AreEqual (true, mtb.AllowPromptAsInput, "#A2");
|
|
|
Assert.AreEqual (false, mtb.AsciiOnly, "#A3");
|
|
|
@@ -585,35 +585,35 @@ namespace MonoTests.System.Windows.Forms
|
|
|
mtb.AsciiOnly = false;
|
|
|
Assert.AreEqual (false, mtb.AsciiOnly, "#A3");
|
|
|
mtb.Dispose ();
|
|
|
- }
|
|
|
-
|
|
|
- [Test]
|
|
|
- public void AllowPromptAsInputTest ()
|
|
|
+ }
|
|
|
+
|
|
|
+ [Test]
|
|
|
+ public void AllowPromptAsInputTest ()
|
|
|
{
|
|
|
MaskedTextBox mtb = new MaskedTextBox ();
|
|
|
Assert.AreEqual (true, mtb.AllowPromptAsInput, "#A1");
|
|
|
mtb.AllowPromptAsInput = true;
|
|
|
Assert.AreEqual (true, mtb.AllowPromptAsInput, "#A2");
|
|
|
mtb.AllowPromptAsInput = false;
|
|
|
- Assert.AreEqual (false, mtb.AllowPromptAsInput, "#A3");
|
|
|
- mtb.Dispose ();
|
|
|
- }
|
|
|
-
|
|
|
- [Test]
|
|
|
- public void AcceptsTabTest ()
|
|
|
+ Assert.AreEqual (false, mtb.AllowPromptAsInput, "#A3");
|
|
|
+ mtb.Dispose ();
|
|
|
+ }
|
|
|
+
|
|
|
+ [Test]
|
|
|
+ public void AcceptsTabTest ()
|
|
|
{
|
|
|
MaskedTextBox mtb = new MaskedTextBox ();
|
|
|
- Assert.AreEqual (false, mtb.AcceptsTab, "#A1");
|
|
|
+ Assert.AreEqual (false, mtb.AcceptsTab, "#A1");
|
|
|
mtb.AcceptsTab = true;
|
|
|
Assert.AreEqual (false, mtb.AcceptsTab, "#A2");
|
|
|
mtb.AcceptsTab = false;
|
|
|
Assert.AreEqual (false, mtb.AcceptsTab, "#A3");
|
|
|
- mtb.Dispose ();
|
|
|
- }
|
|
|
-
|
|
|
- [Test]
|
|
|
- public void ConstructorTest ()
|
|
|
- {
|
|
|
+ mtb.Dispose ();
|
|
|
+ }
|
|
|
+
|
|
|
+ [Test]
|
|
|
+ public void ConstructorTest ()
|
|
|
+ {
|
|
|
using (MaskedTextBox mtb = new MaskedTextBox ()) {
|
|
|
Assert.AreEqual (false, mtb.AcceptsTab, "#A_A1");
|
|
|
Assert.AreEqual (true, mtb.AllowPromptAsInput, "#A_A2");
|
|
|
@@ -800,40 +800,40 @@ namespace MonoTests.System.Windows.Forms
|
|
|
Assert.IsNull (mtb.ValidatingType, "#E_V1");
|
|
|
Assert.AreEqual (false, mtb.WordWrap, "#E_W1");
|
|
|
}
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- [Test]
|
|
|
- public void UndoTest ()
|
|
|
- {
|
|
|
- MaskedTextBox mtb;
|
|
|
-
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ [Test]
|
|
|
+ public void UndoTest ()
|
|
|
+ {
|
|
|
+ MaskedTextBox mtb;
|
|
|
+
|
|
|
mtb = new MaskedTextBox ();
|
|
|
mtb.Text = "abcdef";
|
|
|
- Assert.AreEqual (false, mtb.CanUndo, "#A0-c");
|
|
|
+ Assert.AreEqual (false, mtb.CanUndo, "#A0-c");
|
|
|
mtb.Undo ();
|
|
|
Assert.AreEqual ("abcdef", mtb.Text, "#A1");
|
|
|
- Assert.AreEqual (false, mtb.CanUndo, "#A1-c");
|
|
|
+ Assert.AreEqual (false, mtb.CanUndo, "#A1-c");
|
|
|
mtb.Text = "cdef";
|
|
|
mtb.ClearUndo ();
|
|
|
- Assert.AreEqual ("cdef", mtb.Text, "#A2");
|
|
|
- Assert.AreEqual (false, mtb.CanUndo, "#A2-c");
|
|
|
-
|
|
|
- mtb.Dispose ();
|
|
|
- }
|
|
|
-
|
|
|
- [Test]
|
|
|
- public void CreateHandleTest ()
|
|
|
- {
|
|
|
- using (MaskedTextBox mtb = new MaskedTextBox ()) {
|
|
|
+ Assert.AreEqual ("cdef", mtb.Text, "#A2");
|
|
|
+ Assert.AreEqual (false, mtb.CanUndo, "#A2-c");
|
|
|
+
|
|
|
+ mtb.Dispose ();
|
|
|
+ }
|
|
|
+
|
|
|
+ [Test]
|
|
|
+ public void CreateHandleTest ()
|
|
|
+ {
|
|
|
+ using (MaskedTextBox mtb = new MaskedTextBox ()) {
|
|
|
Assert.AreEqual (false, mtb.IsHandleCreated, "#A1");
|
|
|
typeof (MaskedTextBox).GetMethod ("CreateHandle", global::System.Reflection.BindingFlags.Instance | global::System.Reflection.BindingFlags.NonPublic).Invoke (mtb, new object [] { });
|
|
|
- Assert.AreEqual (true, mtb.IsHandleCreated, "#A2");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- [Test]
|
|
|
- public void GetFirstCharIndexFromLineTest ()
|
|
|
+ Assert.AreEqual (true, mtb.IsHandleCreated, "#A2");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ [Test]
|
|
|
+ public void GetFirstCharIndexFromLineTest ()
|
|
|
{
|
|
|
using (MaskedTextBox mtb = new MaskedTextBox ()) {
|
|
|
for (int i = -100; i < 100; i++) {
|
|
|
@@ -843,7 +843,7 @@ namespace MonoTests.System.Windows.Forms
|
|
|
for (int i = -100; i < 100; i++) {
|
|
|
Assert.AreEqual (0, mtb.GetFirstCharIndexFromLine (i), "#B" + i.ToString ());
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -869,10 +869,10 @@ namespace MonoTests.System.Windows.Forms
|
|
|
Assert.AreEqual (0, mtb.GetLineFromCharIndex (i), "#B" + i.ToString ());
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- [Test]
|
|
|
- public void IsInputKeyTest ()
|
|
|
+ }
|
|
|
+
|
|
|
+ [Test]
|
|
|
+ public void IsInputKeyTest ()
|
|
|
{
|
|
|
using (Form f = new Form ()) {
|
|
|
using (MaskedTextBox mtb = new MaskedTextBox ()) {
|
|
|
@@ -914,22 +914,22 @@ namespace MonoTests.System.Windows.Forms
|
|
|
Assert.AreEqual (is_input, (bool)IsInputKey.Invoke (mtb, new object [] { key_SHIFT_CTLR }));
|
|
|
Assert.AreEqual (false, (bool)IsInputKey.Invoke (mtb, new object [] { key_ALT_SHIFT_CTLR }));
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- [Test]
|
|
|
- public void ValidateTextTest ()
|
|
|
- {
|
|
|
- Assert.Ignore ("Pending implementation");
|
|
|
- }
|
|
|
-
|
|
|
- [Test]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ [Test]
|
|
|
+ public void ValidateTextTest ()
|
|
|
+ {
|
|
|
+ Assert.Ignore ("Pending implementation");
|
|
|
+ }
|
|
|
+
|
|
|
+ [Test]
|
|
|
public void ToStringTest ()
|
|
|
{
|
|
|
- Assert.Ignore ("Pending implementation");
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
+ Assert.Ignore ("Pending implementation");
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
#endif
|