|
|
|
@ -2,6 +2,7 @@ |
|
|
|
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|
|
|
|
|
|
|
using System; |
|
|
|
using System.Globalization; |
|
|
|
using System.Linq; |
|
|
|
using Xunit; |
|
|
|
|
|
|
|
@ -12,7 +13,7 @@ namespace Perspex.Controls.UnitTests |
|
|
|
[Fact] |
|
|
|
public void Parse_Should_Parse_Auto() |
|
|
|
{ |
|
|
|
var result = GridLength.Parse("Auto"); |
|
|
|
var result = GridLength.Parse("Auto", CultureInfo.InvariantCulture); |
|
|
|
|
|
|
|
Assert.Equal(GridLength.Auto, result); |
|
|
|
} |
|
|
|
@ -20,7 +21,7 @@ namespace Perspex.Controls.UnitTests |
|
|
|
[Fact] |
|
|
|
public void Parse_Should_Parse_Auto_Lowercase() |
|
|
|
{ |
|
|
|
var result = GridLength.Parse("auto"); |
|
|
|
var result = GridLength.Parse("auto", CultureInfo.InvariantCulture); |
|
|
|
|
|
|
|
Assert.Equal(GridLength.Auto, result); |
|
|
|
} |
|
|
|
@ -28,7 +29,7 @@ namespace Perspex.Controls.UnitTests |
|
|
|
[Fact] |
|
|
|
public void Parse_Should_Parse_Star() |
|
|
|
{ |
|
|
|
var result = GridLength.Parse("*"); |
|
|
|
var result = GridLength.Parse("*", CultureInfo.InvariantCulture); |
|
|
|
|
|
|
|
Assert.Equal(new GridLength(1, GridUnitType.Star), result); |
|
|
|
} |
|
|
|
@ -36,7 +37,7 @@ namespace Perspex.Controls.UnitTests |
|
|
|
[Fact] |
|
|
|
public void Parse_Should_Parse_Star_Value() |
|
|
|
{ |
|
|
|
var result = GridLength.Parse("2*"); |
|
|
|
var result = GridLength.Parse("2*", CultureInfo.InvariantCulture); |
|
|
|
|
|
|
|
Assert.Equal(new GridLength(2, GridUnitType.Star), result); |
|
|
|
} |
|
|
|
@ -44,7 +45,7 @@ namespace Perspex.Controls.UnitTests |
|
|
|
[Fact] |
|
|
|
public void Parse_Should_Parse_Pixel_Value() |
|
|
|
{ |
|
|
|
var result = GridLength.Parse("2"); |
|
|
|
var result = GridLength.Parse("2", CultureInfo.InvariantCulture); |
|
|
|
|
|
|
|
Assert.Equal(new GridLength(2, GridUnitType.Pixel), result); |
|
|
|
} |
|
|
|
@ -52,13 +53,13 @@ namespace Perspex.Controls.UnitTests |
|
|
|
[Fact] |
|
|
|
public void Parse_Should_Throw_FormatException_For_Invalid_String() |
|
|
|
{ |
|
|
|
Assert.Throws<FormatException>(() => GridLength.Parse("2x")); |
|
|
|
Assert.Throws<FormatException>(() => GridLength.Parse("2x", CultureInfo.InvariantCulture)); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void ParseLengths_Accepts_Comma_Separators() |
|
|
|
{ |
|
|
|
var result = GridLength.ParseLengths("*,Auto,2*,4").ToList(); |
|
|
|
var result = GridLength.ParseLengths("*,Auto,2*,4", CultureInfo.InvariantCulture).ToList(); |
|
|
|
|
|
|
|
Assert.Equal( |
|
|
|
new[] |
|
|
|
@ -74,7 +75,7 @@ namespace Perspex.Controls.UnitTests |
|
|
|
[Fact] |
|
|
|
public void ParseLengths_Accepts_Space_Separators() |
|
|
|
{ |
|
|
|
var result = GridLength.ParseLengths("* Auto 2* 4").ToList(); |
|
|
|
var result = GridLength.ParseLengths("* Auto 2* 4", CultureInfo.InvariantCulture).ToList(); |
|
|
|
|
|
|
|
Assert.Equal( |
|
|
|
new[] |
|
|
|
|