Author: gert
Date: 2007-05-27 14:38:41 -0400 (Sun, 27 May 2007)
New Revision: 78017

Modified:
   trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
   
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DateTimePickerTest.cs
Log:
* DateTimePickerTest.cs: Avoid test failures on Windows system with
non-us locale.


Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2007-05-27 18:17:24 UTC (rev 78016)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2007-05-27 18:38:41 UTC (rev 78017)
@@ -1,5 +1,10 @@
 2007-05-27  Gert Driesen  <[EMAIL PROTECTED]>
 
+       * DateTimePickerTest.cs: Avoid test failures on Windows system with
+       non-us locale.
+
+2007-05-27  Gert Driesen  <[EMAIL PROTECTED]>
+
        * NumericUpDownTest.cs: Avoid use of global identifier since csc 1.x
        does not support this.
        * FormTest.cs: Avoid using anonymous methods. Allows our test to build

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DateTimePickerTest.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DateTimePickerTest.cs
       2007-05-27 18:17:24 UTC (rev 78016)
+++ 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DateTimePickerTest.cs
       2007-05-27 18:38:41 UTC (rev 78017)
@@ -22,7 +22,6 @@
 // Authors:
 //     Rolf Bjarne Kvinge      [EMAIL PROTECTED]
 
-
 using System;
 using System.ComponentModel;
 using System.Drawing;
@@ -48,24 +47,18 @@
                
                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,10 +125,8 @@
 
                        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
                // (see: 
http://www.microsoft.com/globaldev/getWR/steps/WRG_lclmdl.mspx#EOE)
@@ -3002,8 +2993,6 @@
                                Assert.AreEqual (@" 07-02", dt.Text, "#1423");
                                dt.CustomFormat = @"-yy-MM";
                                Assert.AreEqual (@"-07-02", dt.Text, "#1424");
-
-
                        }
                }
 
@@ -3174,10 +3163,12 @@
                [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 @@
                {
                        DateTimePicker dt = new DateTimePicker ();
                        dt.Text = "abcdef";
-               
                }
        }
-}
\ No newline at end of file
+}

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to