Skip to content

Commit

Permalink
Fix ToLower() in Turkish converting capital I to ı, causing unexpecte…
Browse files Browse the repository at this point in the history
…d Setınputenabled
  • Loading branch information
cooolbros committed Nov 15, 2024
1 parent 2d2d9e2 commit 30d077d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
20 changes: 18 additions & 2 deletions src/HUDAnimations.Tests/HUDAnimationsSerializerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,20 @@ public void DeserializeTest()
{
foreach (string path in Directory.EnumerateFiles("HUDAnimationsSerializerTests/scripts"))
{
HUDAnimationsSerializer.Deserialize(File.ReadAllText(path));
string text = File.ReadAllText(path);

HUDAnimationsSerializer.Deserialize(text);

CultureInfo currentCulture = CultureInfo.CurrentCulture;

foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.AllCultures))
{
CultureInfo.CurrentCulture = culture;

HUDAnimationsSerializer.Deserialize(text);
}

CultureInfo.CurrentCulture = currentCulture;
}
}

Expand All @@ -29,7 +42,10 @@ public void SerializeTest()
foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.AllCultures))
{
CultureInfo.CurrentCulture = culture;
Assert.AreEqual(text, HUDAnimationsSerializer.Serialize(animations));

string result = HUDAnimationsSerializer.Serialize(animations);
Assert.AreEqual(text, result, CultureInfo.CurrentCulture.Name);
HUDAnimationsSerializer.Deserialize(result);
}

CultureInfo.CurrentCulture = currentCulture;
Expand Down
2 changes: 1 addition & 1 deletion src/HUDAnimations/HUDAnimationsSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ bool ReadBool()
: null;
}

return command.ToLower() switch
return command.ToLowerInvariant() switch
{
"animate" => new Animate
{
Expand Down

0 comments on commit 30d077d

Please sign in to comment.