Browse Source

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
shortcuts
Matt Ward 17 years ago
parent
commit
2a45318a6a
  1. 3
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonPropertyValueAssignment.cs
  2. 13
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonPropertyAssignmentToStringTests.cs

3
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonPropertyValueAssignment.cs

@ -7,6 +7,7 @@ @@ -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 @@ -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, ")");
}
}
}

13
src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonPropertyAssignmentToStringTests.cs

@ -7,6 +7,7 @@ @@ -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 @@ -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;
}
}
}
}

Loading…
Cancel
Save