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

Add failing test

This commit is contained in:
Dean Herbert 2020-05-04 13:31:49 +09:00
parent bcf7b160db
commit 02b9f51bdd

View File

@ -24,10 +24,12 @@ using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Rulesets.Taiko;
using osu.Game.Scoring;
using osu.Game.Screens.Play;
using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Carousel;
using osu.Game.Screens.Select.Filter;
using osu.Game.Users;
using osuTK.Input;
namespace osu.Game.Tests.Visual.SongSelect
@ -769,6 +771,70 @@ namespace osu.Game.Tests.Visual.SongSelect
AddAssert("Check first item in group selected", () => Beatmap.Value.BeatmapInfo == groupIcon.Items.First().Beatmap);
}
[Test]
public void TestChangeRulesetWhilePresentingScore()
{
changeRuleset(0);
createSongSelect();
addRulesetImportStep(0);
addRulesetImportStep(1);
AddStep("present score", () =>
{
var presentBeatmap = manager.QueryBeatmap(b => b.RulesetID == 0);
var switchBeatmap = manager.QueryBeatmap(b => b.RulesetID == 1);
// this ruleset change should be overridden by the present.
Ruleset.Value = switchBeatmap.Ruleset;
songSelect.PresentScore(new ScoreInfo
{
User = new User { Username = "woo" },
Beatmap = presentBeatmap,
Ruleset = presentBeatmap.Ruleset
});
});
AddUntilStep("wait for results screen presented", () => !songSelect.IsCurrentScreen());
AddAssert("check beatmap is correct for score", () => Beatmap.Value.BeatmapInfo.Equals(manager.QueryBeatmap(b => b.RulesetID == 0)));
AddAssert("check ruleset is correct for score", () => Ruleset.Value.ID == 0);
}
[Test]
public void TestChangeBeatmapWhilePresentingScore()
{
changeRuleset(0);
createSongSelect();
addRulesetImportStep(0);
addRulesetImportStep(1);
AddStep("present score", () =>
{
var presentBeatmap = manager.QueryBeatmap(b => b.RulesetID == 0);
var switchBeatmap = manager.QueryBeatmap(b => b.RulesetID == 1);
// this beatmap change should be overridden by the present.
Beatmap.Value = manager.GetWorkingBeatmap(switchBeatmap);
songSelect.PresentScore(new ScoreInfo
{
User = new User { Username = "woo" },
Beatmap = presentBeatmap,
Ruleset = presentBeatmap.Ruleset
});
});
AddUntilStep("wait for results screen presented", () => !songSelect.IsCurrentScreen());
AddAssert("check beatmap is correct for score", () => Beatmap.Value.BeatmapInfo.Equals(manager.QueryBeatmap(b => b.RulesetID == 0)));
AddAssert("check ruleset is correct for score", () => Ruleset.Value.ID == 0);
}
private void waitForInitialSelection()
{
AddUntilStep("wait for initial selection", () => !Beatmap.IsDefault);
@ -882,6 +948,8 @@ namespace osu.Game.Tests.Visual.SongSelect
public WorkingBeatmap CurrentBeatmapDetailsBeatmap => BeatmapDetails.Beatmap;
public new BeatmapCarousel Carousel => base.Carousel;
public new void PresentScore(ScoreInfo score) => base.PresentScore(score);
protected override bool OnStart()
{
StartRequested?.Invoke();