Skip to content

Commit

Permalink
Add failing test case for invalid mod adjustment management
Browse files Browse the repository at this point in the history
  • Loading branch information
bdach committed May 9, 2022
1 parent 5b17e92 commit 38e463d
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions osu.Game.Tests/Visual/UserInterface/TestSceneModSelectScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,38 @@ public void TestColumnHiding()
AddUntilStep("3 columns visible", () => this.ChildrenOfType<ModColumn>().Count(col => col.IsPresent) == 3);
}

[Test]
public void TestCorrectAudioAdjustmentDeapplication()
{
createScreen();
changeRuleset(0);

AddStep("allow track adjustments", () => MusicController.AllowTrackAdjustments = true);

AddStep("set wind up", () => modSelectScreen.SelectedMods.Value = new[] { new ModWindUp() });
AddStep("open customisation menu", () =>
{
InputManager.MoveMouseTo(this.ChildrenOfType<ShearedToggleButton>().Single());
InputManager.Click(MouseButton.Left);
});
AddAssert("frequency above 1", () => MusicController.CurrentTrack.AggregateFrequency.Value > 1);
AddAssert("tempo is 1", () => MusicController.CurrentTrack.AggregateTempo.Value == 1);

AddStep("turn off pitch adjustment", () =>
{
InputManager.MoveMouseTo(this.ChildrenOfType<SettingsCheckbox>().Single());
InputManager.Click(MouseButton.Left);
});
AddAssert("frequency is 1", () => MusicController.CurrentTrack.AggregateFrequency.Value == 1);
AddAssert("tempo above 1", () => MusicController.CurrentTrack.AggregateTempo.Value > 1);

AddStep("reset mods", () => modSelectScreen.SelectedMods.SetDefault());
AddAssert("frequency is 1", () => MusicController.CurrentTrack.AggregateFrequency.Value == 1);
AddAssert("tempo is 1", () => MusicController.CurrentTrack.AggregateTempo.Value == 1);

AddStep("disallow track adjustments", () => MusicController.AllowTrackAdjustments = false);
}

private void waitForColumnLoad() => AddUntilStep("all column content loaded",
() => modSelectScreen.ChildrenOfType<ModColumn>().Any() && modSelectScreen.ChildrenOfType<ModColumn>().All(column => column.IsLoaded && column.ItemsLoaded));

Expand Down

0 comments on commit 38e463d

Please sign in to comment.