mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 19:32:55 +08:00
Modify existing test coverage to demonstrate failure with touch
This commit is contained in:
parent
363fc0d5da
commit
10901075be
@ -7,6 +7,7 @@ using NUnit.Framework;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
@ -120,7 +121,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestExpandedStatePersistsWhenClicked()
|
public void TestHoverExpandsAndCollapsesWhenHeaderTouched()
|
||||||
{
|
{
|
||||||
AddStep("add customisable mod", () =>
|
AddStep("add customisable mod", () =>
|
||||||
{
|
{
|
||||||
@ -128,34 +129,20 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
panel.Enabled.Value = true;
|
panel.Enabled.Value = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("hover header", () => InputManager.MoveMouseTo(header));
|
AddStep("touch header", () =>
|
||||||
checkExpanded(true);
|
|
||||||
|
|
||||||
AddStep("click", () => InputManager.Click(MouseButton.Left));
|
|
||||||
checkExpanded(false);
|
|
||||||
AddStep("click", () => InputManager.Click(MouseButton.Left));
|
|
||||||
checkExpanded(true);
|
|
||||||
|
|
||||||
AddStep("move away", () => InputManager.MoveMouseTo(Vector2.One));
|
|
||||||
checkExpanded(true);
|
|
||||||
|
|
||||||
AddStep("click", () => InputManager.Click(MouseButton.Left));
|
|
||||||
checkExpanded(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestHoverExpandsAndCollapsesWhenHeaderClicked()
|
|
||||||
{
|
{
|
||||||
AddStep("add customisable mod", () =>
|
var touch = new Touch(TouchSource.Touch1, header.ScreenSpaceDrawQuad.Centre);
|
||||||
{
|
InputManager.BeginTouch(touch);
|
||||||
SelectedMods.Value = new[] { new OsuModDoubleTime() };
|
Schedule(() => InputManager.EndTouch(touch));
|
||||||
panel.Enabled.Value = true;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("hover header", () => InputManager.MoveMouseTo(header));
|
|
||||||
checkExpanded(true);
|
checkExpanded(true);
|
||||||
|
|
||||||
AddStep("click", () => InputManager.Click(MouseButton.Left));
|
AddStep("touch away from header", () =>
|
||||||
|
{
|
||||||
|
var touch = new Touch(TouchSource.Touch1, header.ScreenSpaceDrawQuad.TopLeft - new Vector2(10));
|
||||||
|
InputManager.BeginTouch(touch);
|
||||||
|
Schedule(() => InputManager.EndTouch(touch));
|
||||||
|
});
|
||||||
checkExpanded(false);
|
checkExpanded(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user