mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 17:52:56 +08:00
Move gameplay cursor outside instead and fix potential failure
This commit is contained in:
parent
0771154dd2
commit
fe5e45ea81
@ -2,21 +2,18 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Framework.Timing;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Rulesets.Osu.UI;
|
|
||||||
using osu.Game.Storyboards;
|
using osu.Game.Storyboards;
|
||||||
using osu.Game.Tests.Beatmaps;
|
using osu.Game.Tests.Beatmaps;
|
||||||
using osuTK.Input;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Gameplay
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
{
|
{
|
||||||
@ -45,6 +42,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestPauseWhileInCooldown()
|
public void TestPauseWhileInCooldown()
|
||||||
{
|
{
|
||||||
|
AddStep("move cursor outside", () => InputManager.MoveMouseTo(Player.ScreenSpaceDrawQuad.TopLeft - new Vector2(10)));
|
||||||
|
|
||||||
AddStep("resume player", () => Player.GameplayClockContainer.Start());
|
AddStep("resume player", () => Player.GameplayClockContainer.Start());
|
||||||
AddStep("skip to gameplay", () => Player.GameplayClockContainer.Seek(Player.DrawableRuleset.GameplayStartTime));
|
AddStep("skip to gameplay", () => Player.GameplayClockContainer.Seek(Player.DrawableRuleset.GameplayStartTime));
|
||||||
|
|
||||||
@ -54,14 +53,15 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
AddStep("set active", () => ((Bindable<bool>)host.IsActive).Value = true);
|
AddStep("set active", () => ((Bindable<bool>)host.IsActive).Value = true);
|
||||||
|
|
||||||
AddStep("resume player", () => Player.Resume());
|
AddStep("resume player", () => Player.Resume());
|
||||||
AddStep("click resume overlay", () =>
|
|
||||||
{
|
|
||||||
InputManager.MoveMouseTo(this.ChildrenOfType<OsuResumeOverlay.OsuClickToResumeCursor>().Single());
|
|
||||||
InputManager.Click(MouseButton.Left);
|
|
||||||
});
|
|
||||||
|
|
||||||
AddAssert("pause cooldown active", () => Player.PauseCooldownActive);
|
bool pauseCooldownActive = false;
|
||||||
AddStep("set inactive again", () => ((Bindable<bool>)host.IsActive).Value = false);
|
|
||||||
|
AddStep("set inactive again", () =>
|
||||||
|
{
|
||||||
|
pauseCooldownActive = Player.PauseCooldownActive;
|
||||||
|
((Bindable<bool>)host.IsActive).Value = false;
|
||||||
|
});
|
||||||
|
AddAssert("pause cooldown active", () => pauseCooldownActive);
|
||||||
AddUntilStep("wait for pause", () => Player.GameplayClockContainer.IsPaused.Value);
|
AddUntilStep("wait for pause", () => Player.GameplayClockContainer.IsPaused.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user