From: Alexander Köplinger Date: Mon, 18 Sep 2017 18:58:44 +0000 (+0200) Subject: [WindowsBase] Use InvariantCulture for ConvertTo/ToString tests X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;ds=sidebyside;h=8efc784bd99a6bc2519afedd5eef985b2dab0eb7;p=mono.git [WindowsBase] Use InvariantCulture for ConvertTo/ToString tests They'd fail on locales such as de-DE before which uses ';' as separator. --- diff --git a/mcs/class/WindowsBase/Test/System.Windows.Media/MatrixConverterTest.cs b/mcs/class/WindowsBase/Test/System.Windows.Media/MatrixConverterTest.cs index 9134aec4b47..f9e15374908 100644 --- a/mcs/class/WindowsBase/Test/System.Windows.Media/MatrixConverterTest.cs +++ b/mcs/class/WindowsBase/Test/System.Windows.Media/MatrixConverterTest.cs @@ -1,5 +1,6 @@ using NUnit.Framework; using System; +using System.Globalization; using System.Windows.Media; namespace MonoTests.System.Windows.Media { @@ -56,7 +57,7 @@ namespace MonoTests.System.Windows.Media { { var conv = new MatrixConverter (); var matrix = new Matrix (1, 2, 3, 4, 5, 6); - object obj = conv.ConvertTo (matrix, typeof (string)); + object obj = conv.ConvertTo (null, CultureInfo.InvariantCulture, matrix, typeof (string)); Assert.AreEqual (typeof (string), obj.GetType ()); Assert.AreEqual ("1,2,3,4,5,6", (string)obj); } diff --git a/mcs/class/WindowsBase/Test/System.Windows.Media/MatrixTest.cs b/mcs/class/WindowsBase/Test/System.Windows.Media/MatrixTest.cs index cbccb4339bb..29503407fb1 100644 --- a/mcs/class/WindowsBase/Test/System.Windows.Media/MatrixTest.cs +++ b/mcs/class/WindowsBase/Test/System.Windows.Media/MatrixTest.cs @@ -24,6 +24,7 @@ // using System; +using System.Globalization; using System.Windows; using System.Windows.Media; using NUnit.Framework; @@ -347,7 +348,7 @@ namespace MonoTests.System.Windows.Media { public void ToStringTest () { Matrix m = new Matrix (1, 2, 3, 4, 5, 6); - Assert.AreEqual ("1,2,3,4,5,6", m.ToString()); + Assert.AreEqual ("1,2,3,4,5,6", m.ToString(CultureInfo.InvariantCulture)); m = Matrix.Identity; Assert.AreEqual ("Identity", m.ToString()); } diff --git a/mcs/class/WindowsBase/Test/System.Windows/Int32RectConverterTest.cs b/mcs/class/WindowsBase/Test/System.Windows/Int32RectConverterTest.cs index 64375844ccd..2aecc932a3a 100644 --- a/mcs/class/WindowsBase/Test/System.Windows/Int32RectConverterTest.cs +++ b/mcs/class/WindowsBase/Test/System.Windows/Int32RectConverterTest.cs @@ -24,6 +24,7 @@ // using System; +using System.Globalization; using System.Windows; using System.Windows.Media; using NUnit.Framework; @@ -88,14 +89,13 @@ namespace MonoTests.System.Windows { } [Test] - [Category ("NotWorking")] public void ConvertTo () { Int32RectConverter r = new Int32RectConverter (); Int32Rect rect = new Int32Rect (0, 0, 1, 2); - object o = r.ConvertTo (rect, typeof (string)); + object o = r.ConvertTo (null, CultureInfo.InvariantCulture, rect, typeof (string)); Assert.AreEqual (typeof (string), o.GetType()); Assert.AreEqual ("0,0,1,2", (string)o); diff --git a/mcs/class/WindowsBase/Test/System.Windows/Int32RectTest.cs b/mcs/class/WindowsBase/Test/System.Windows/Int32RectTest.cs index ffd571f3a19..d65da4e23f2 100644 --- a/mcs/class/WindowsBase/Test/System.Windows/Int32RectTest.cs +++ b/mcs/class/WindowsBase/Test/System.Windows/Int32RectTest.cs @@ -24,6 +24,7 @@ // using System; +using System.Globalization; using System.Windows; using System.Windows.Media; using NUnit.Framework; @@ -136,7 +137,7 @@ namespace MonoTests.System.Windows { public void ToStringTest () { Int32Rect r = new Int32Rect (1, 2, 3, 4); - Assert.AreEqual ("1,2,3,4", r.ToString()); + Assert.AreEqual ("1,2,3,4", r.ToString(CultureInfo.InvariantCulture)); Assert.AreEqual ("Empty", Int32Rect.Empty.ToString()); } diff --git a/mcs/class/WindowsBase/Test/System.Windows/PointConverterTest.cs b/mcs/class/WindowsBase/Test/System.Windows/PointConverterTest.cs index 93d33bc678a..9e80eb1dedf 100644 --- a/mcs/class/WindowsBase/Test/System.Windows/PointConverterTest.cs +++ b/mcs/class/WindowsBase/Test/System.Windows/PointConverterTest.cs @@ -24,6 +24,7 @@ // using System; +using System.Globalization; using System.Windows; using System.Windows.Media; using NUnit.Framework; @@ -82,7 +83,7 @@ namespace MonoTests.System.Windows { Point rect = new Point (1, 2); - object o = r.ConvertTo (rect, typeof (string)); + object o = r.ConvertTo (null, CultureInfo.InvariantCulture, rect, typeof (string)); Assert.AreEqual (typeof (string), o.GetType()); Assert.AreEqual ("1,2", (string)o); diff --git a/mcs/class/WindowsBase/Test/System.Windows/RectConverterTest.cs b/mcs/class/WindowsBase/Test/System.Windows/RectConverterTest.cs index 3d2b6b12a72..0e1161c9dca 100644 --- a/mcs/class/WindowsBase/Test/System.Windows/RectConverterTest.cs +++ b/mcs/class/WindowsBase/Test/System.Windows/RectConverterTest.cs @@ -24,6 +24,7 @@ // using System; +using System.Globalization; using System.Windows; using System.Windows.Media; using NUnit.Framework; @@ -92,7 +93,7 @@ namespace MonoTests.System.Windows { Rect rect = new Rect (0, 0, 1, 2); - object o = r.ConvertTo (rect, typeof (string)); + object o = r.ConvertTo (null, CultureInfo.InvariantCulture, rect, typeof (string)); Assert.AreEqual (typeof (string), o.GetType()); Assert.AreEqual ("0,0,1,2", (string)o); diff --git a/mcs/class/WindowsBase/Test/System.Windows/SizeConverterTest.cs b/mcs/class/WindowsBase/Test/System.Windows/SizeConverterTest.cs index d320100f1a0..74a0f0b3be1 100644 --- a/mcs/class/WindowsBase/Test/System.Windows/SizeConverterTest.cs +++ b/mcs/class/WindowsBase/Test/System.Windows/SizeConverterTest.cs @@ -24,6 +24,7 @@ // using System; +using System.Globalization; using System.Windows; using System.Windows.Media; using NUnit.Framework; @@ -86,7 +87,7 @@ namespace MonoTests.System.Windows { Size rect = new Size (1, 2); - object o = r.ConvertTo (rect, typeof (string)); + object o = r.ConvertTo (null, CultureInfo.InvariantCulture, rect, typeof (string)); Assert.AreEqual (typeof (string), o.GetType()); Assert.AreEqual ("1,2", (string)o); diff --git a/mcs/class/WindowsBase/Test/System.Windows/SizeTest.cs b/mcs/class/WindowsBase/Test/System.Windows/SizeTest.cs index 6c04fd244d4..e9bb8d925c0 100644 --- a/mcs/class/WindowsBase/Test/System.Windows/SizeTest.cs +++ b/mcs/class/WindowsBase/Test/System.Windows/SizeTest.cs @@ -24,6 +24,7 @@ // using System; +using System.Globalization; using System.Windows; using System.Windows.Media; using NUnit.Framework; @@ -158,7 +159,7 @@ namespace MonoTests.System.Windows { [Test] public void ToStringTest () { - Assert.AreEqual ("1,2", (new Size (1, 2)).ToString ()); + Assert.AreEqual ("1,2", (new Size (1, 2)).ToString (CultureInfo.InvariantCulture)); } [Test] diff --git a/mcs/class/WindowsBase/Test/System.Windows/VectorConverterTest.cs b/mcs/class/WindowsBase/Test/System.Windows/VectorConverterTest.cs index 8c2a7449635..af6dd725aea 100644 --- a/mcs/class/WindowsBase/Test/System.Windows/VectorConverterTest.cs +++ b/mcs/class/WindowsBase/Test/System.Windows/VectorConverterTest.cs @@ -24,6 +24,7 @@ // using System; +using System.Globalization; using System.Windows; using System.Windows.Media; using NUnit.Framework; @@ -82,7 +83,7 @@ namespace MonoTests.System.Windows { Vector rect = new Vector (1, 2); - object o = r.ConvertTo (rect, typeof (string)); + object o = r.ConvertTo (null, CultureInfo.InvariantCulture, rect, typeof (string)); Assert.AreEqual (typeof (string), o.GetType()); Assert.AreEqual ("1,2", (string)o); diff --git a/mcs/class/WindowsBase/Test/System.Windows/VectorTest.cs b/mcs/class/WindowsBase/Test/System.Windows/VectorTest.cs index 2f203729adf..20e64e3134e 100644 --- a/mcs/class/WindowsBase/Test/System.Windows/VectorTest.cs +++ b/mcs/class/WindowsBase/Test/System.Windows/VectorTest.cs @@ -24,6 +24,7 @@ // using System; +using System.Globalization; using System.Windows; using System.Windows.Media; using NUnit.Framework; @@ -56,7 +57,7 @@ namespace MonoTests.System.Windows { public void ToStringTest () { Vector v = new Vector (4, 5); - Assert.AreEqual ("4,5", v.ToString()); + Assert.AreEqual ("4,5", v.ToString(CultureInfo.InvariantCulture)); } [Test]