Add failing test coverage for select/deselect all enable behaviour

This commit is contained in:
Bartłomiej Dach 2022-05-25 21:49:31 +02:00
parent 6558b4a175
commit 4f8b6b52ba
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497
2 changed files with 8 additions and 0 deletions

View File

@ -73,12 +73,15 @@ namespace osu.Game.Tests.Visual.Multiplayer
{
createFreeModSelect();
AddAssert("select all button enabled", () => this.ChildrenOfType<ShearedButton>().ElementAt(1).Enabled.Value);
AddStep("click select all button", () =>
{
InputManager.MoveMouseTo(this.ChildrenOfType<ShearedButton>().ElementAt(1));
InputManager.Click(MouseButton.Left);
});
AddUntilStep("all mods selected", assertAllAvailableModsSelected);
AddAssert("select all button disabled", () => !this.ChildrenOfType<ShearedButton>().ElementAt(1).Enabled.Value);
AddStep("click deselect all button", () =>
{
@ -86,6 +89,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
InputManager.Click(MouseButton.Left);
});
AddUntilStep("all mods deselected", () => !freeModSelectOverlay.SelectedMods.Value.Any());
AddAssert("select all button enabled", () => this.ChildrenOfType<ShearedButton>().ElementAt(1).Enabled.Value);
}
private void createFreeModSelect()

View File

@ -435,8 +435,11 @@ namespace osu.Game.Tests.Visual.UserInterface
createScreen();
changeRuleset(0);
AddAssert("deselect all button disabled", () => !this.ChildrenOfType<ShearedButton>().Last().Enabled.Value);
AddStep("select DT + HD", () => SelectedMods.Value = new Mod[] { new OsuModDoubleTime(), new OsuModHidden() });
AddAssert("DT + HD selected", () => modSelectOverlay.ChildrenOfType<ModPanel>().Count(panel => panel.Active.Value) == 2);
AddAssert("deselect all button enabled", () => this.ChildrenOfType<ShearedButton>().Last().Enabled.Value);
AddStep("click deselect all button", () =>
{
@ -444,6 +447,7 @@ namespace osu.Game.Tests.Visual.UserInterface
InputManager.Click(MouseButton.Left);
});
AddUntilStep("all mods deselected", () => !SelectedMods.Value.Any());
AddAssert("deselect all button disabled", () => !this.ChildrenOfType<ShearedButton>().Last().Enabled.Value);
}
[Test]