From 2a45318a6a4e23dddb1ee7d10afcb5bbfa259c90 Mon Sep 17 00:00:00 2001 From: Matt Ward Date: Sat, 21 Mar 2009 17:44:15 +0000 Subject: [PATCH] Fixed failing python addin unit tests - font size now converted to string using CultureInfo.InvariantCulture. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3898 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Project/Src/PythonPropertyValueAssignment.cs | 3 ++- .../PythonPropertyAssignmentToStringTests.cs | 13 ++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonPropertyValueAssignment.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonPropertyValueAssignment.cs index 69e4cd9a1f..f27ff9fe68 100644 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonPropertyValueAssignment.cs +++ b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonPropertyValueAssignment.cs @@ -7,6 +7,7 @@ using System; using System.Drawing; +using System.Globalization; using System.Windows.Forms; using System.Reflection; @@ -94,7 +95,7 @@ namespace ICSharpCode.PythonBinding static string GetFontAsString(Font font) { - return String.Concat(font.GetType().FullName, "(\"", font.Name, "\", ", font.Size, ", ", typeof(FontStyle).FullName, ".", font.Style, ", ", typeof(GraphicsUnit).FullName, ".", font.Unit, ", ", font.GdiCharSet, ")"); + return String.Concat(font.GetType().FullName, "(\"", font.Name, "\", ", font.Size.ToString(CultureInfo.InvariantCulture), ", ", typeof(FontStyle).FullName, ".", font.Style, ", ", typeof(GraphicsUnit).FullName, ".", font.Unit, ", ", font.GdiCharSet, ")"); } } } diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonPropertyAssignmentToStringTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonPropertyAssignmentToStringTests.cs index 6bc8b8c66e..3e092b13d3 100644 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonPropertyAssignmentToStringTests.cs +++ b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonPropertyAssignmentToStringTests.cs @@ -7,6 +7,7 @@ using System; using System.Drawing; +using System.Globalization; using ICSharpCode.PythonBinding; using NUnit.Framework; @@ -29,9 +30,15 @@ namespace PythonBinding.Tests.Designer [Test] public void FontToString() { - Font font = new Font("Times New Roman", 8.25F, FontStyle.Regular, GraphicsUnit.Point, 0); - Assert.AreEqual("System.Drawing.Font(\"Times New Roman\", 8.25, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0)", - PythonPropertyValueAssignment.ToString(font)); + CultureInfo cultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture; + try { + System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("de-DE"); + Font font = new Font("Times New Roman", 8.25F, FontStyle.Regular, GraphicsUnit.Point, 0); + Assert.AreEqual("System.Drawing.Font(\"Times New Roman\", 8.25, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0)", + PythonPropertyValueAssignment.ToString(font)); + } finally { + System.Threading.Thread.CurrentThread.CurrentCulture = cultureInfo; + } } } }