1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-18 06:21:22 +08:00

Merge pull request #34934 from Valerus9/fixtestdouble

Fix TestDouble failing on systems where the decimal separator isn't a dot
This commit is contained in:
Bartłomiej Dach
2025-09-29 16:46:32 +09:00
committed by GitHub
Unverified
3 changed files with 7 additions and 4 deletions
@@ -46,9 +46,12 @@ namespace osu.Game.Tests.Extensions
[Test]
[SetCulture("fr-FR")]
public void TestCultureInsensitivity()
[TestCase(0.4, true, 2, ExpectedResult = "40%")]
[TestCase(1e-6, false, 6, ExpectedResult = "0.000001")]
[TestCase(0.48333, true, 4, ExpectedResult = "48.33%")]
public string TestCultureInsensitivity(double input, bool percent, int decimalDigits)
{
Assert.That(0.4.ToStandardFormattedString(maxDecimalDigits: 2, asPercentage: true), Is.EqualTo("40%"));
return input.ToStandardFormattedString(decimalDigits, percent);
}
}
}
@@ -36,7 +36,7 @@ namespace osu.Game.Extensions
string negativeSign = Math.Round(floatValue, significantDigits) < 0 ? "-" : string.Empty;
return FormattableString.Invariant($"{negativeSign}{Math.Abs(floatValue).ToString($"N{significantDigits}")}");
return $"{negativeSign}{Math.Abs(floatValue).ToString($"N{significantDigits}", CultureInfo.InvariantCulture)}";
}
/// <summary>
+1 -1
View File
@@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Mods
get
{
if (!SpeedChange.IsDefault)
yield return ("Speed change", $"{SpeedChange.Value:N2}x");
yield return ("Speed change", FormattableString.Invariant($@"{SpeedChange.Value:N2}x"));
}
}