* DateTimePickerTest.cs: Avoid test failures on Windows system with
authorGert Driesen <drieseng@users.sourceforge.net>
Sun, 27 May 2007 18:38:41 +0000 (18:38 -0000)
committerGert Driesen <drieseng@users.sourceforge.net>
Sun, 27 May 2007 18:38:41 +0000 (18:38 -0000)
non-us locale.

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

mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DateTimePickerTest.cs

index 034b2129561c91e9e70452cfe477ae877c4104ed..631ce3a393ff9f63bcaf304727c5e2781f2c097f 100644 (file)
@@ -1,3 +1,8 @@
+2007-05-27  Gert Driesen  <drieseng@users.sourceforge.net>
+
+       * DateTimePickerTest.cs: Avoid test failures on Windows system with
+       non-us locale.
+
 2007-05-27  Gert Driesen  <drieseng@users.sourceforge.net>
 
        * NumericUpDownTest.cs: Avoid use of global identifier since csc 1.x
index a21e7856ab10946985b8437946577937a37c5378..894e5bd373c097bce5fa90aa398a94785c7db90e 100644 (file)
@@ -22,7 +22,6 @@
 // Authors:
 //     Rolf Bjarne Kvinge      RKvinge@novell.com
 
-
 using System;
 using System.ComponentModel;
 using System.Drawing;
@@ -48,24 +47,18 @@ namespace MonoTests.System.Windows.Forms {
                
                private static void CheckCulture ()
                {
-                       try {
-                               if (Environment.OSVersion.Platform == PlatformID.Win32Windows) {
-                                       int LCID = GetUserDefaultLCID ();
-                                       if ((new CultureInfo ("en-US")).LCID != LCID) {
-                                               Assert.Ignore ("Must be called with us-english locale, current locale is: " + new CultureInfo (LCID).Name);
-                                               return;
-                                       }
+                       if (!TestHelper.RunningOnUnix) {
+                               int LCID = GetUserDefaultLCID ();
+                               if ((new CultureInfo ("en-US")).LCID != LCID) {
+                                       Assert.Ignore ("Must be called with us-english locale, current locale is: " + new CultureInfo (LCID).Name);
                                }
-                       } catch (Exception ex) {
-                               //ignore any exceptions.
-                               TestHelper.RemoveWarning (ex);
                        }
                        
                        if (Thread.CurrentThread.CurrentCulture.Name != "en-US") {
                                Assert.Ignore ("Must be called with us-english locale, current locale is: " + Thread.CurrentThread.CurrentCulture.Name);
-                               return;
                        }
                }
+
 #if NET_2_0
                // Only use on Windows!
                public static string GenerateCustomFormatTests ()
@@ -132,9 +125,7 @@ namespace MonoTests.System.Windows.Forms {
 
                        return builder.ToString ();
                }
-#endif 
-
-
+#endif
 
                // On Windows this test must be called with en-US locale specified in the regional settings.
                // There is no way to change this programmatically for the test to run correctly on other locales
@@ -3002,8 +2993,6 @@ namespace MonoTests.System.Windows.Forms {
                                Assert.AreEqual (@" 07-02", dt.Text, "#1423");
                                dt.CustomFormat = @"-yy-MM";
                                Assert.AreEqual (@"-07-02", dt.Text, "#1424");
-
-
                        }
                }
 
@@ -3174,10 +3163,12 @@ namespace MonoTests.System.Windows.Forms {
                [Test]
                public void TextTest ()
                {
+                       CheckCulture ();
+
                        DateTimePicker dt = new DateTimePicker ();
                        EventLogger log = new EventLogger (dt);
                        DateTime tomorrow = DateTime.Today.AddDays (1);
-                       
+
                        log.Clear ();
                        dt.Value = tomorrow;
                        Assert.AreEqual ("", dt.Text, "#1");
@@ -3236,7 +3227,6 @@ namespace MonoTests.System.Windows.Forms {
                {
                        DateTimePicker dt = new DateTimePicker ();
                        dt.Text = "abcdef";
-               
                }
        }
-}
\ No newline at end of file
+}