mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 16:02:55 +08:00
Fix flooring causing delta to not work as expected
This commit is contained in:
parent
610ebc5481
commit
67f0ea5d7d
@ -97,6 +97,7 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
public void TestTransientUserStatisticsDisplay()
|
||||
{
|
||||
AddStep("Log in", () => dummyAPI.Login("wang", "jang"));
|
||||
|
||||
AddStep("Gain", () =>
|
||||
{
|
||||
var transientUpdateDisplay = this.ChildrenOfType<TransientUserStatisticsUpdateDisplay>().Single();
|
||||
@ -113,6 +114,7 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
PP = 1357
|
||||
});
|
||||
});
|
||||
|
||||
AddStep("Loss", () =>
|
||||
{
|
||||
var transientUpdateDisplay = this.ChildrenOfType<TransientUserStatisticsUpdateDisplay>().Single();
|
||||
@ -129,7 +131,9 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
PP = 1234
|
||||
});
|
||||
});
|
||||
AddStep("No change", () =>
|
||||
|
||||
// Tests flooring logic works as expected.
|
||||
AddStep("Tiny increase in PP", () =>
|
||||
{
|
||||
var transientUpdateDisplay = this.ChildrenOfType<TransientUserStatisticsUpdateDisplay>().Single();
|
||||
transientUpdateDisplay.LatestUpdate.Value = new UserStatisticsUpdate(
|
||||
@ -137,7 +141,24 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
new UserStatistics
|
||||
{
|
||||
GlobalRank = 111_111,
|
||||
PP = 1357
|
||||
PP = 1357.6m
|
||||
},
|
||||
new UserStatistics
|
||||
{
|
||||
GlobalRank = 111_111,
|
||||
PP = 1358.1m
|
||||
});
|
||||
});
|
||||
|
||||
AddStep("No change 1", () =>
|
||||
{
|
||||
var transientUpdateDisplay = this.ChildrenOfType<TransientUserStatisticsUpdateDisplay>().Single();
|
||||
transientUpdateDisplay.LatestUpdate.Value = new UserStatisticsUpdate(
|
||||
new ScoreInfo(),
|
||||
new UserStatistics
|
||||
{
|
||||
GlobalRank = 111_111,
|
||||
PP = 1357m
|
||||
},
|
||||
new UserStatistics
|
||||
{
|
||||
@ -145,6 +166,7 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
PP = 1357.1m
|
||||
});
|
||||
});
|
||||
|
||||
AddStep("Was null", () =>
|
||||
{
|
||||
var transientUpdateDisplay = this.ChildrenOfType<TransientUserStatisticsUpdateDisplay>().Single();
|
||||
@ -161,6 +183,7 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
PP = 1357
|
||||
});
|
||||
});
|
||||
|
||||
AddStep("Became null", () =>
|
||||
{
|
||||
var transientUpdateDisplay = this.ChildrenOfType<TransientUserStatisticsUpdateDisplay>().Single();
|
||||
|
@ -83,7 +83,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
}
|
||||
|
||||
if (update.After.PP != null)
|
||||
pp.Display((int)(update.Before.PP ?? update.After.PP.Value), (int)Math.Abs((update.After.PP - update.Before.PP) ?? 0M), (int)update.After.PP.Value);
|
||||
pp.Display((int)(update.Before.PP ?? update.After.PP.Value), (int)Math.Abs(((int?)update.After.PP - (int?)update.Before.PP) ?? 0M), (int)update.After.PP.Value);
|
||||
|
||||
this.Delay(5000).FadeOut(500, Easing.OutQuint);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user