From b62811633f07820848ec960e228989f02e30f68c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Nov 2023 17:17:19 +0900 Subject: [PATCH] Add test coverage of touching and missing not enabled touch mod --- .../Mods/TestSceneOsuModTouchDevice.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModTouchDevice.cs b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModTouchDevice.cs index 5134265741..bcfa407684 100644 --- a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModTouchDevice.cs +++ b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModTouchDevice.cs @@ -104,6 +104,24 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods AddAssert("no toasts displayed", () => testOnScreenDisplay.ToastCount, () => Is.Zero); } + [Test] + public void TestTouchMiss() + { + // ensure mouse is active (and that it's not suppressed due to touches in previous tests) + AddStep("click mouse", () => InputManager.Click(MouseButton.Left)); + + AddUntilStep("wait until 200 near", () => Player.GameplayClockContainer.CurrentTime, () => Is.GreaterThanOrEqualTo(200).Within(500)); + AddStep("slow down", () => Player.GameplayClockContainer.AdjustmentsFromMods.Frequency.Value = 0.2); + AddUntilStep("wait until 200", () => Player.GameplayClockContainer.CurrentTime, () => Is.GreaterThanOrEqualTo(200)); + AddStep("touch playfield", () => + { + var touch = new Touch(TouchSource.Touch1, Player.DrawableRuleset.Playfield.ScreenSpaceDrawQuad.Centre); + InputManager.BeginTouch(touch); + InputManager.EndTouch(touch); + }); + AddAssert("touch device mod not activated", () => Player.Mods.Value, () => Has.No.InstanceOf()); + } + [Test] public void TestSecondObjectTouched() {