mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Merge remote-tracking branch 'origin/master' into backgrounded-beatmap-status-lookups
This commit is contained in:
@ -210,7 +210,52 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddAssert("start not requested", () => !startRequested);
|
||||
}
|
||||
|
||||
private void importForRuleset(int id) => AddStep($"import test map for ruleset {id}", () => manager.Import(createTestBeatmapSet(getImportId(), rulesets.AvailableRulesets.Where(r => r.ID == id).ToArray())).Wait());
|
||||
[Test]
|
||||
public void TestAddNewBeatmapWhileSelectingRandom()
|
||||
{
|
||||
const int test_count = 10;
|
||||
int beatmapChangedCount = 0;
|
||||
int debounceCount = 0;
|
||||
createSongSelect();
|
||||
AddStep("Setup counters", () =>
|
||||
{
|
||||
beatmapChangedCount = 0;
|
||||
debounceCount = 0;
|
||||
songSelect.Carousel.SelectionChanged += _ => beatmapChangedCount++;
|
||||
});
|
||||
AddRepeatStep($"Create beatmaps {test_count} times", () =>
|
||||
{
|
||||
importForRuleset(0);
|
||||
|
||||
Scheduler.AddDelayed(() =>
|
||||
{
|
||||
// Wait for debounce
|
||||
songSelect.Carousel.SelectNextRandom();
|
||||
++debounceCount;
|
||||
}, 400);
|
||||
}, test_count);
|
||||
|
||||
AddUntilStep("Debounce limit reached", () => debounceCount == test_count);
|
||||
|
||||
// The selected beatmap should have changed an additional 2 times since both initially loading songselect and the first import also triggers selectionChanged
|
||||
AddAssert($"Beatmap changed {test_count + 2} times", () => beatmapChangedCount == test_count + 2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHideSetSelectsCorrectBeatmap()
|
||||
{
|
||||
int? previousID = null;
|
||||
createSongSelect();
|
||||
addRulesetImportStep(0);
|
||||
AddStep("Move to last difficulty", () => songSelect.Carousel.SelectBeatmap(songSelect.Carousel.BeatmapSets.First().Beatmaps.Last()));
|
||||
AddStep("Store current ID", () => previousID = songSelect.Carousel.SelectedBeatmap.ID);
|
||||
AddStep("Hide first beatmap", () => manager.Hide(songSelect.Carousel.SelectedBeatmapSet.Beatmaps.First()));
|
||||
AddAssert("Selected beatmap has not changed", () => songSelect.Carousel.SelectedBeatmap.ID == previousID);
|
||||
}
|
||||
|
||||
private void addRulesetImportStep(int id) => AddStep($"import test map for ruleset {id}", () => importForRuleset(id));
|
||||
|
||||
private void importForRuleset(int id) => manager.Import(createTestBeatmapSet(getImportId(), rulesets.AvailableRulesets.Where(r => r.ID == id).ToArray())).Wait();
|
||||
|
||||
private static int importId;
|
||||
private int getImportId() => ++importId;
|
||||
|
Reference in New Issue
Block a user