mirror of
https://github.com/ppy/osu.git
synced 2025-03-06 03:42:55 +08:00
Fixing tests
For some reason moving the mouse and clicking doesn't work with "dotnet test", but works when you run the osu.Game.Tests project.
This commit is contained in:
parent
ecc260030a
commit
c282f0e603
@ -106,14 +106,15 @@ namespace osu.Game.Tests.Visual.Settings
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestSingleBindResetButton()
|
public void TestSingleBindingResetButton()
|
||||||
{
|
{
|
||||||
SettingsKeyBindingRow settingsKeyBindingRow = null;
|
SettingsKeyBindingRow settingsKeyBindingRow = null;
|
||||||
|
|
||||||
AddStep("click first row with two bindings", () =>
|
AddStep("click first row", () =>
|
||||||
{
|
{
|
||||||
settingsKeyBindingRow = panel.ChildrenOfType<SettingsKeyBindingRow>().First(row => row.KeyBindingRow.Defaults.Count() > 1);
|
settingsKeyBindingRow = panel.ChildrenOfType<SettingsKeyBindingRow>().First();
|
||||||
InputManager.MoveMouseTo(settingsKeyBindingRow.KeyBindingRow);
|
|
||||||
|
InputManager.MoveMouseTo(settingsKeyBindingRow);
|
||||||
InputManager.Click(MouseButton.Left);
|
InputManager.Click(MouseButton.Left);
|
||||||
InputManager.PressKey(Key.P);
|
InputManager.PressKey(Key.P);
|
||||||
InputManager.ReleaseKey(Key.P);
|
InputManager.ReleaseKey(Key.P);
|
||||||
@ -123,40 +124,43 @@ namespace osu.Game.Tests.Visual.Settings
|
|||||||
|
|
||||||
AddStep("click reset button for bindings", () =>
|
AddStep("click reset button for bindings", () =>
|
||||||
{
|
{
|
||||||
var clearButton = settingsKeyBindingRow.ChildrenOfType<RestoreDefaultValueButton<bool>>().Single();
|
var resetButton = settingsKeyBindingRow.ChildrenOfType<RestoreDefaultValueButton<bool>>().First();
|
||||||
|
|
||||||
InputManager.MoveMouseTo(clearButton);
|
resetButton.Click();
|
||||||
InputManager.Click(MouseButton.Left);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("restore button hidden", () => settingsKeyBindingRow.ChildrenOfType<RestoreDefaultValueButton<bool>>().First().Alpha == 0);
|
AddUntilStep("restore button hidden", () => settingsKeyBindingRow.ChildrenOfType<RestoreDefaultValueButton<bool>>().First().Alpha == 0);
|
||||||
|
|
||||||
AddAssert("first binding cleared", () => settingsKeyBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().ElementAt(0).KeyBinding.KeyCombination.Equals(settingsKeyBindingRow.KeyBindingRow.Defaults.ElementAt(0)));
|
AddAssert("binding cleared", () => settingsKeyBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().ElementAt(0).KeyBinding.KeyCombination.Equals(settingsKeyBindingRow.KeyBindingRow.Defaults.ElementAt(0)));
|
||||||
AddAssert("second binding cleared", () => settingsKeyBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().ElementAt(1).KeyBinding.KeyCombination.Equals(settingsKeyBindingRow.KeyBindingRow.Defaults.ElementAt(1)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestResetAllBindingsButton()
|
public void TestResetAllBindingsButton()
|
||||||
{
|
{
|
||||||
KeyBindingRow keyBindingRow = null;
|
SettingsKeyBindingRow settingsKeyBindingRow = null;
|
||||||
|
|
||||||
AddStep("click first row and press p", () =>
|
AddStep("click first row", () =>
|
||||||
{
|
{
|
||||||
keyBindingRow = panel.ChildrenOfType<KeyBindingRow>().First();
|
settingsKeyBindingRow = panel.ChildrenOfType<SettingsKeyBindingRow>().First();
|
||||||
InputManager.MoveMouseTo(keyBindingRow);
|
|
||||||
|
InputManager.MoveMouseTo(settingsKeyBindingRow);
|
||||||
InputManager.Click(MouseButton.Left);
|
InputManager.Click(MouseButton.Left);
|
||||||
InputManager.PressKey(Key.P);
|
InputManager.PressKey(Key.P);
|
||||||
InputManager.ReleaseKey(Key.P);
|
InputManager.ReleaseKey(Key.P);
|
||||||
});
|
});
|
||||||
AddStep("click reset button for all bindings", () =>
|
|
||||||
{
|
|
||||||
var clearButton = panel.ChildrenOfType<ResetButton>().First();
|
|
||||||
|
|
||||||
InputManager.MoveMouseTo(clearButton);
|
AddUntilStep("restore button shown", () => settingsKeyBindingRow.ChildrenOfType<RestoreDefaultValueButton<bool>>().First().Alpha > 0);
|
||||||
InputManager.Click(MouseButton.Left);
|
|
||||||
|
AddStep("click reset button for bindings", () =>
|
||||||
|
{
|
||||||
|
var resetButton = panel.ChildrenOfType<ResetButton>().First();
|
||||||
|
|
||||||
|
resetButton.Click();
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("bindings cleared", () => keyBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().ElementAt(0).KeyBinding.KeyCombination.Equals(keyBindingRow.Defaults.ElementAt(0)));
|
AddUntilStep("restore button hidden", () => settingsKeyBindingRow.ChildrenOfType<RestoreDefaultValueButton<bool>>().First().Alpha == 0);
|
||||||
|
|
||||||
|
AddAssert("binding cleared", () => settingsKeyBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().ElementAt(0).KeyBinding.KeyCombination.Equals(settingsKeyBindingRow.KeyBindingRow.Defaults.ElementAt(0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
Loading…
Reference in New Issue
Block a user