mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 07:42:57 +08:00
Add failing test case
This commit is contained in:
parent
3d3f58c252
commit
b1fae2bc6a
@ -15,11 +15,13 @@ using osu.Game.Online.Rooms;
|
||||
using osu.Game.Online.Solo;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mania;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Osu.Judgements;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.Taiko;
|
||||
using osu.Game.Rulesets.Taiko.Mods;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Ranking;
|
||||
using osu.Game.Tests.Beatmaps;
|
||||
@ -34,12 +36,19 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
private Func<RulesetInfo, IBeatmap> createCustomBeatmap;
|
||||
private Func<Ruleset> createCustomRuleset;
|
||||
private Func<Mod[]> createCustomMods;
|
||||
|
||||
private DummyAPIAccess dummyAPI => (DummyAPIAccess)API;
|
||||
|
||||
protected override bool HasCustomSteps => true;
|
||||
|
||||
protected override TestPlayer CreatePlayer(Ruleset ruleset) => new FakeImportingPlayer(false);
|
||||
protected override TestPlayer CreatePlayer(Ruleset ruleset)
|
||||
{
|
||||
if (createCustomMods != null)
|
||||
SelectedMods.Value = SelectedMods.Value.Concat(createCustomMods()).ToList();
|
||||
|
||||
return new FakeImportingPlayer(false);
|
||||
}
|
||||
|
||||
protected new FakeImportingPlayer Player => (FakeImportingPlayer)base.Player;
|
||||
|
||||
@ -277,13 +286,27 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
AddAssert("ensure no submission", () => Player.SubmittedScore == null);
|
||||
}
|
||||
|
||||
private void createPlayerTest(bool allowFail = false, Func<RulesetInfo, IBeatmap> createBeatmap = null, Func<Ruleset> createRuleset = null)
|
||||
[Test]
|
||||
public void TestNoSubmissionWithModsOfDifferentRuleset()
|
||||
{
|
||||
prepareTestAPI(true);
|
||||
|
||||
createPlayerTest(createRuleset: () => new OsuRuleset(), createMods: () => new Mod[] { new TaikoModHidden() });
|
||||
|
||||
AddUntilStep("wait for token request", () => Player.TokenCreationRequested);
|
||||
|
||||
AddStep("exit", () => Player.Exit());
|
||||
AddAssert("ensure no submission", () => Player.SubmittedScore == null);
|
||||
}
|
||||
|
||||
private void createPlayerTest(bool allowFail = false, Func<RulesetInfo, IBeatmap> createBeatmap = null, Func<Ruleset> createRuleset = null, Func<Mod[]> createMods = null)
|
||||
{
|
||||
CreateTest(() => AddStep("set up requirements", () =>
|
||||
{
|
||||
this.allowFail = allowFail;
|
||||
createCustomBeatmap = createBeatmap;
|
||||
createCustomRuleset = createRuleset;
|
||||
createCustomMods = createMods;
|
||||
}));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user