mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:12:54 +08:00
Add test coverage
This commit is contained in:
parent
a852a27dfb
commit
b401259f84
@ -643,6 +643,54 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddAssert("Selected beatmap correct", () => songSelect.Carousel.SelectedBeatmap == filteredBeatmap);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestChangingRulesetOnMultiRulesetBeatmap()
|
||||
{
|
||||
int changeCount = 0;
|
||||
|
||||
AddStep("change convert setting", () => config.Set(OsuSetting.ShowConvertedBeatmaps, false));
|
||||
AddStep("bind beatmap changed", () =>
|
||||
{
|
||||
Beatmap.ValueChanged += onChange;
|
||||
changeCount = 0;
|
||||
});
|
||||
|
||||
changeRuleset(0);
|
||||
|
||||
createSongSelect();
|
||||
|
||||
AddStep("import multi-ruleset map", () =>
|
||||
{
|
||||
var usableRulesets = rulesets.AvailableRulesets.Where(r => r.ID != 2).ToArray();
|
||||
manager.Import(createTestBeatmapSet(usableRulesets)).Wait();
|
||||
});
|
||||
|
||||
int previousSetID = 0;
|
||||
|
||||
AddUntilStep("wait for selection", () => !Beatmap.IsDefault);
|
||||
|
||||
AddStep("record set ID", () => previousSetID = Beatmap.Value.BeatmapSetInfo.ID);
|
||||
AddAssert("selection changed once", () => changeCount == 1);
|
||||
|
||||
AddAssert("Check ruleset is osu!", () => Ruleset.Value.ID == 0);
|
||||
|
||||
changeRuleset(3);
|
||||
|
||||
AddUntilStep("Check ruleset changed to mania", () => Ruleset.Value.ID == 3);
|
||||
|
||||
AddUntilStep("selection changed", () => changeCount > 1);
|
||||
|
||||
AddAssert("Selected beatmap still same set", () => Beatmap.Value.BeatmapSetInfo.ID == previousSetID);
|
||||
AddAssert("Selected beatmap is mania", () => Beatmap.Value.BeatmapInfo.Ruleset.ID == 3);
|
||||
|
||||
AddAssert("selection changed only fired twice", () => changeCount == 2);
|
||||
|
||||
AddStep("unbind beatmap changed", () => Beatmap.ValueChanged -= onChange);
|
||||
AddStep("change convert setting", () => config.Set(OsuSetting.ShowConvertedBeatmaps, true));
|
||||
|
||||
void onChange(ValueChangedEvent<WorkingBeatmap> valueChangedEvent) => changeCount++;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDifficultyIconSelectingForDifferentRuleset()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user