mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 10:23:03 +08:00
Add failing test coverage for incorrect treatment of TD in mod presets
This commit is contained in:
parent
3c72c5bccd
commit
adb9ca5a13
@ -167,7 +167,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestAddingFlow()
|
public void TestAddingFlow([Values] bool withSystemModActive)
|
||||||
{
|
{
|
||||||
ModPresetColumn modPresetColumn = null!;
|
ModPresetColumn modPresetColumn = null!;
|
||||||
|
|
||||||
@ -181,7 +181,13 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
AddUntilStep("items loaded", () => modPresetColumn.IsLoaded && modPresetColumn.ItemsLoaded);
|
AddUntilStep("items loaded", () => modPresetColumn.IsLoaded && modPresetColumn.ItemsLoaded);
|
||||||
AddAssert("add preset button disabled", () => !this.ChildrenOfType<AddPresetButton>().Single().Enabled.Value);
|
AddAssert("add preset button disabled", () => !this.ChildrenOfType<AddPresetButton>().Single().Enabled.Value);
|
||||||
|
|
||||||
AddStep("set mods", () => SelectedMods.Value = new Mod[] { new OsuModDaycore(), new OsuModClassic() });
|
AddStep("set mods", () =>
|
||||||
|
{
|
||||||
|
var newMods = new Mod[] { new OsuModDaycore(), new OsuModClassic() };
|
||||||
|
if (withSystemModActive)
|
||||||
|
newMods = newMods.Append(new OsuModTouchDevice()).ToArray();
|
||||||
|
SelectedMods.Value = newMods;
|
||||||
|
});
|
||||||
AddAssert("add preset button enabled", () => this.ChildrenOfType<AddPresetButton>().Single().Enabled.Value);
|
AddAssert("add preset button enabled", () => this.ChildrenOfType<AddPresetButton>().Single().Enabled.Value);
|
||||||
|
|
||||||
AddStep("click add preset button", () =>
|
AddStep("click add preset button", () =>
|
||||||
@ -209,6 +215,9 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
});
|
});
|
||||||
AddUntilStep("popover closed", () => !this.ChildrenOfType<OsuPopover>().Any());
|
AddUntilStep("popover closed", () => !this.ChildrenOfType<OsuPopover>().Any());
|
||||||
AddUntilStep("preset creation occurred", () => this.ChildrenOfType<ModPresetPanel>().Count() == 4);
|
AddUntilStep("preset creation occurred", () => this.ChildrenOfType<ModPresetPanel>().Count() == 4);
|
||||||
|
AddAssert("preset has correct mods",
|
||||||
|
() => this.ChildrenOfType<ModPresetPanel>().Single(panel => panel.Preset.Value.Name == "new preset").Preset.Value.Mods,
|
||||||
|
() => Has.Count.EqualTo(2));
|
||||||
|
|
||||||
AddStep("click add preset button", () =>
|
AddStep("click add preset button", () =>
|
||||||
{
|
{
|
||||||
|
@ -86,6 +86,10 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
AddStep("set mods to HD+HR+DT", () => SelectedMods.Value = new Mod[] { new OsuModHidden(), new OsuModHardRock(), new OsuModDoubleTime() });
|
AddStep("set mods to HD+HR+DT", () => SelectedMods.Value = new Mod[] { new OsuModHidden(), new OsuModHardRock(), new OsuModDoubleTime() });
|
||||||
AddAssert("panel is not active", () => !panel.AsNonNull().Active.Value);
|
AddAssert("panel is not active", () => !panel.AsNonNull().Active.Value);
|
||||||
|
|
||||||
|
// system mods are not included in presets.
|
||||||
|
AddStep("set mods to HR+DT+TD", () => SelectedMods.Value = new Mod[] { new OsuModHardRock(), new OsuModDoubleTime(), new OsuModTouchDevice() });
|
||||||
|
AddAssert("panel is active", () => panel.AsNonNull().Active.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -113,6 +117,10 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
AddStep("set customised mod", () => SelectedMods.Value = new[] { new OsuModDoubleTime { SpeedChange = { Value = 1.25 } } });
|
AddStep("set customised mod", () => SelectedMods.Value = new[] { new OsuModDoubleTime { SpeedChange = { Value = 1.25 } } });
|
||||||
AddStep("activate panel", () => panel.AsNonNull().TriggerClick());
|
AddStep("activate panel", () => panel.AsNonNull().TriggerClick());
|
||||||
assertSelectedModsEquivalentTo(new Mod[] { new OsuModHardRock(), new OsuModDoubleTime { SpeedChange = { Value = 1.5 } } });
|
assertSelectedModsEquivalentTo(new Mod[] { new OsuModHardRock(), new OsuModDoubleTime { SpeedChange = { Value = 1.5 } } });
|
||||||
|
|
||||||
|
AddStep("set system mod", () => SelectedMods.Value = new[] { new OsuModTouchDevice() });
|
||||||
|
AddStep("activate panel", () => panel.AsNonNull().TriggerClick());
|
||||||
|
assertSelectedModsEquivalentTo(new Mod[] { new OsuModTouchDevice(), new OsuModHardRock(), new OsuModDoubleTime { SpeedChange = { Value = 1.5 } } });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertSelectedModsEquivalentTo(IEnumerable<Mod> mods)
|
private void assertSelectedModsEquivalentTo(IEnumerable<Mod> mods)
|
||||||
|
Loading…
Reference in New Issue
Block a user