mirror of
https://github.com/ppy/osu
synced 2024-12-15 19:36:34 +00:00
Rewrite TestFriendScore
assertions to constraint model
Allows to clearly see what the failure is: TearDown : System.TimeoutException : "friend score is pink" timed out: Expected: some item equal to "#FF549A" But was: < "#FFFFFF", "#7FCC33", "#444444" > The #7FCC33 colour is used for the first score on the leaderboard.
This commit is contained in:
parent
561f66400a
commit
9301a1907a
@ -6,7 +6,6 @@
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Extensions.PolygonExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -161,10 +160,14 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
int playerNumber = 1;
|
||||
|
||||
AddRepeatStep("add 3 other players", () => createRandomScore(new APIUser { Username = $"Player {playerNumber++}" }), 3);
|
||||
AddUntilStep("there are no pink color score", () => leaderboard.ChildrenOfType<Box>().All(b => b.Colour != Color4Extensions.FromHex("ff549a")));
|
||||
AddUntilStep("no pink color scores",
|
||||
() => leaderboard.ChildrenOfType<Box>().Select(b => ((Colour4)b.Colour).ToHex()),
|
||||
() => Does.Not.Contain("#FF549A"));
|
||||
|
||||
AddRepeatStep("add 3 friend score", () => createRandomScore(friend), 3);
|
||||
AddUntilStep("there are pink color for friend score", () => leaderboard.GetScoreByUsername("my friend").ChildrenOfType<Box>().Any(b => b.Colour == Color4Extensions.FromHex("ff549a")));
|
||||
AddUntilStep("friend score is pink",
|
||||
() => leaderboard.GetScoreByUsername("my friend").ChildrenOfType<Box>().Select(b => ((Colour4)b.Colour).ToHex()),
|
||||
() => Does.Contain("#FF549A"));
|
||||
}
|
||||
|
||||
private void addLocalPlayer()
|
||||
|
Loading…
Reference in New Issue
Block a user