Rewrite dim test to pass headless

Unfortunately neuters the test a touch, but alas.
This commit is contained in:
Bartłomiej Dach
2022-04-26 23:11:38 +02:00
parent 921e8af3b0
commit a849bfcf60
2 changed files with 14 additions and 16 deletions

View File

@ -119,25 +119,23 @@ namespace osu.Game.Tests.Visual.UserInterface
AddUntilStep("any column dimmed", () => this.ChildrenOfType<ModColumn>().Any(column => !column.Active.Value)); AddUntilStep("any column dimmed", () => this.ChildrenOfType<ModColumn>().Any(column => !column.Active.Value));
ModColumn firstDimmed = null; ModColumn lastColumn = null;
ModPanel firstPanel = null;
AddStep("click first panel on dimmed column", () => AddAssert("last column dimmed", () => !this.ChildrenOfType<ModColumn>().Last().Active.Value);
AddStep("request scroll to last column", () =>
{ {
firstDimmed = this.ChildrenOfType<ModColumn>().First(column => !column.Active.Value); var lastDimContainer = this.ChildrenOfType<ModSelectScreen.ColumnDimContainer>().Last();
firstPanel = firstDimmed.ChildrenOfType<ModPanel>().First(); lastColumn = lastDimContainer.Column;
InputManager.MoveMouseTo(firstPanel); lastDimContainer.RequestScroll?.Invoke(lastDimContainer);
});
AddUntilStep("column undimmed", () => lastColumn.Active.Value);
AddStep("click panel", () =>
{
InputManager.MoveMouseTo(lastColumn.ChildrenOfType<ModPanel>().First());
InputManager.Click(MouseButton.Left); InputManager.Click(MouseButton.Left);
}); });
AddUntilStep("column undimmed", () => firstDimmed.Active.Value); AddUntilStep("panel selected", () => lastColumn.ChildrenOfType<ModPanel>().First().Active.Value);
AddAssert("panel not selected", () => !firstPanel.Active.Value);
AddStep("click panel again", () =>
{
InputManager.MoveMouseTo(firstPanel);
InputManager.Click(MouseButton.Left);
});
AddUntilStep("panel selected", () => firstPanel.Active.Value);
} }
[Test] [Test]

View File

@ -394,7 +394,7 @@ namespace osu.Game.Overlays.Mods
} }
} }
private class ColumnDimContainer : Container internal class ColumnDimContainer : Container
{ {
public ModColumn Column { get; } public ModColumn Column { get; }