mirror of https://github.com/ppy/osu
Make tests safer against async loads / transforms
This commit is contained in:
parent
28510674ac
commit
4a68c79137
|
@ -123,16 +123,26 @@ public void Setup() => Schedule(() =>
|
|||
// Due to soft deletions, we can re-use deleted scores between test runs
|
||||
scoreManager.Undelete(scoreManager.QueryScores(s => s.DeletePending).ToList());
|
||||
|
||||
leaderboard.Scores = null;
|
||||
leaderboard.FinishTransforms(true); // After setting scores, we may be waiting for transforms to expire drawables
|
||||
|
||||
leaderboard.Beatmap = beatmap;
|
||||
leaderboard.RefreshScores();
|
||||
leaderboard.RefreshScores(); // Required in the case that the beatmap hasn't changed
|
||||
});
|
||||
|
||||
[SetUpSteps]
|
||||
public void SetupSteps()
|
||||
{
|
||||
// Ensure the leaderboard has finished async-loading drawables
|
||||
AddUntilStep("wait for drawables", () => leaderboard.ChildrenOfType<LeaderboardScore>().Any());
|
||||
|
||||
// Ensure the leaderboard items have finished showing up
|
||||
AddStep("finish transforms", () => leaderboard.FinishTransforms(true));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDeleteViaRightClick()
|
||||
{
|
||||
// Ensure the leaderboard items have finished showing up
|
||||
AddStep("finish transforms", () => leaderboard.FinishTransforms(true));
|
||||
|
||||
AddStep("open menu for top score", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(leaderboard.ChildrenOfType<LeaderboardScore>().First());
|
||||
|
|
Loading…
Reference in New Issue