1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 16:43:00 +08:00

Fix PlaylistResultsScreen test failures

As seen: https://github.com/ppy/osu/pull/17252/checks?check_run_id=5545717506

The `PlaylistsResultsScreen` takes a lease on the `Beatmap` bindable
when entered. During `SetUp`, the `Beatmap` bindable is reassigned but
fails in cases where an existing test instance of the screen hasn't been
exited yet. This fix moves the assignment into the `SetUpSteps` function
after `base.SetUpSteps` is called which will exit the existing screens
first.
This commit is contained in:
Jai Sharma 2022-03-15 20:38:04 +00:00
parent 7aa3a52ef7
commit c56df80106

View File

@ -53,12 +53,23 @@ namespace osu.Game.Tests.Visual.Playlists
userScore.Statistics = new Dictionary<HitResult, int>();
bindHandler();
// beatmap is required to be an actual beatmap so the scores can get their scores correctly calculated for standardised scoring.
// else the tests that rely on ordering will fall over.
Beatmap.Value = CreateWorkingBeatmap(Ruleset.Value);
});
[SetUpSteps]
public override void SetUpSteps()
{
base.SetUpSteps();
// Existing test instances of the results screen hold a leased bindable of the beatmap,
// so wait for those screens to be cleaned up by the base SetUpSteps before re-assigning
AddStep("Create Working Beatmap", () =>
{
// Beatmap is required to be an actual beatmap so the scores can get their scores correctly calculated for standardised scoring.
// else the tests that rely on ordering will fall over.
Beatmap.Value = CreateWorkingBeatmap(Ruleset.Value);
});
}
[Test]
public void TestShowWithUserScore()
{