Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Magn-9966 Crash when closing a Custom Node with a Group when in Sweden or France #6724

Merged
merged 6 commits into from
Jun 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/DynamoCoreWpf/UI/Converters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,7 @@ public class ZoomToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
double zoom = System.Convert.ToDouble(value);
double zoom = System.Convert.ToDouble(value, culture);

if (zoom < .5)
return Visibility.Hidden;
Expand Down Expand Up @@ -2193,8 +2193,8 @@ public class MenuItemCheckConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var fontsize = System.Convert.ToDouble(value);
var param = System.Convert.ToDouble(parameter);
var fontsize = System.Convert.ToDouble(value, culture);
var param = System.Convert.ToDouble(parameter, culture);

return fontsize == param;
}
Expand Down Expand Up @@ -2250,8 +2250,8 @@ public class GroupFontSizeToEditorEnabledConverter : IMultiValueConverter

public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
var zoom = System.Convert.ToDouble(values[0]);
var fontsize = System.Convert.ToDouble(values[1]);
var zoom = System.Convert.ToDouble(values[0], culture);
var fontsize = System.Convert.ToDouble(values[1], culture);

var factor = zoom*fontsize;
if (factor < MinFontFactor)
Expand Down
67 changes: 66 additions & 1 deletion test/DynamoCoreWpfTests/ConverterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,71 @@ public void FilePathDisplayConverterInternalDoesNotThrow()
Assert.DoesNotThrow(() => FilePathDisplayConverter.ShortenNestedFilePath(@"\\psf\\Home\somedyn.dyn"));
Assert.DoesNotThrow(() => FilePathDisplayConverter.ShortenNestedFilePath(@"\\psf\somedyn.dyn"));
Assert.AreEqual(@"\\psf\Home\Desktop\somedyn.dyn", FilePathDisplayConverter.ShortenNestedFilePath(@"\\psf\Home\Desktop\somedyn.dyn"));
}
}

[Test]
[Category("UnitTests")]
public void ZoomToVisibilityConverterTest()
{
object visibility;
ZoomToVisibilityConverter converter = new ZoomToVisibilityConverter();

visibility = converter.Convert("1.0", typeof(string), null, new CultureInfo("en-US"));
Assert.AreEqual(visibility, Visibility.Visible);

visibility = converter.Convert("1,0", typeof(string), null, new CultureInfo("de-DE"));
Assert.AreEqual(visibility, Visibility.Visible);

visibility = converter.Convert(1.0, typeof(double), null, new CultureInfo("en-US"));
Assert.AreEqual(visibility, Visibility.Visible);

visibility = converter.Convert(1.0, typeof(double), null, new CultureInfo("de-DE"));
Assert.AreEqual(visibility, Visibility.Visible);
}

[Test]
[Category("UnitTests")]
public void MenuItemCheckConverterTest()
{
object equal;
MenuItemCheckConverter converter = new MenuItemCheckConverter();

equal = converter.Convert("1.0", typeof(string), "1.0", new CultureInfo("en-US"));
Assert.AreEqual(equal, true);

equal = converter.Convert("1,0", typeof(string), "1,0", new CultureInfo("de-DE"));
Assert.AreEqual(equal, true);

equal = converter.Convert(1.0, typeof(double), 1.0, new CultureInfo("en-US"));
Assert.AreEqual(equal, true);

equal = converter.Convert(1.0, typeof(double), 1.0, new CultureInfo("de-DE"));
Assert.AreEqual(equal, true);
}

[Test]
[Category("UnitTests")]
public void GroupFontSizeToEditorEnabledConverterTest()
{
object equal;
GroupFontSizeToEditorEnabledConverter converter = new GroupFontSizeToEditorEnabledConverter();
string[] stringsUs = { "2.0", "4.0" };
string[] stringsDe = { "2,0", "4,0" };
double[] doubles = { 2.0, 4.0 };
object[] objects = new object[2];
doubles.CopyTo(objects, 0);

equal = converter.Convert(stringsUs , typeof(string), null, new CultureInfo("en-US"));
Assert.AreEqual(equal, true);

equal = converter.Convert(stringsDe, typeof(string), null, new CultureInfo("de-DE"));
Assert.AreEqual(equal, true);

equal = converter.Convert(objects, typeof(float), null, new CultureInfo("en-US"));
Assert.AreEqual(equal, true);

equal = converter.Convert(objects, typeof(float), null, new CultureInfo("de-DE"));
Assert.AreEqual(equal, true);
}
}
}