2020-08-03 22:00:10 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
2020-08-11 02:13:50 +08:00
|
|
|
|
using System.Linq;
|
2020-08-03 22:00:10 +08:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using osu.Game.Overlays;
|
|
|
|
|
using osu.Game.Rulesets;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual.Gameplay
|
|
|
|
|
{
|
|
|
|
|
public class TestSceneOverlayActivation : OsuPlayerTestScene
|
|
|
|
|
{
|
2020-08-14 03:53:17 +08:00
|
|
|
|
protected new OverlayTestPlayer Player => base.Player as OverlayTestPlayer;
|
2020-08-03 22:00:10 +08:00
|
|
|
|
|
2020-09-27 17:18:13 +08:00
|
|
|
|
public override void SetUpSteps()
|
|
|
|
|
{
|
|
|
|
|
base.SetUpSteps();
|
|
|
|
|
|
|
|
|
|
AddUntilStep("gameplay has started",
|
|
|
|
|
() => Player.GameplayClockContainer.GameplayClock.CurrentTime > Player.DrawableRuleset.GameplayStartTime);
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-03 22:00:10 +08:00
|
|
|
|
[Test]
|
2020-08-07 16:17:11 +08:00
|
|
|
|
public void TestGameplayOverlayActivation()
|
2020-08-03 22:00:10 +08:00
|
|
|
|
{
|
2020-08-14 03:53:17 +08:00
|
|
|
|
AddAssert("activation mode is disabled", () => Player.OverlayActivationMode == OverlayActivation.Disabled);
|
2020-08-03 22:00:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestGameplayOverlayActivationPaused()
|
|
|
|
|
{
|
2020-09-27 17:28:20 +08:00
|
|
|
|
AddAssert("activation mode is disabled", () => Player.OverlayActivationMode == OverlayActivation.Disabled);
|
2020-08-14 03:53:17 +08:00
|
|
|
|
AddStep("pause gameplay", () => Player.Pause());
|
|
|
|
|
AddUntilStep("activation mode is user triggered", () => Player.OverlayActivationMode == OverlayActivation.UserTriggered);
|
2020-08-03 22:00:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestGameplayOverlayActivationReplayLoaded()
|
|
|
|
|
{
|
2020-08-14 03:53:17 +08:00
|
|
|
|
AddAssert("activation mode is disabled", () => Player.OverlayActivationMode == OverlayActivation.Disabled);
|
|
|
|
|
AddStep("load a replay", () => Player.DrawableRuleset.HasReplayLoaded.Value = true);
|
|
|
|
|
AddAssert("activation mode is user triggered", () => Player.OverlayActivationMode == OverlayActivation.UserTriggered);
|
2020-08-03 22:00:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
2020-08-11 02:13:50 +08:00
|
|
|
|
[Test]
|
|
|
|
|
public void TestGameplayOverlayActivationBreaks()
|
|
|
|
|
{
|
2020-08-14 03:53:17 +08:00
|
|
|
|
AddAssert("activation mode is disabled", () => Player.OverlayActivationMode == OverlayActivation.Disabled);
|
|
|
|
|
AddStep("seek to break", () => Player.GameplayClockContainer.Seek(Beatmap.Value.Beatmap.Breaks.First().StartTime));
|
|
|
|
|
AddUntilStep("activation mode is user triggered", () => Player.OverlayActivationMode == OverlayActivation.UserTriggered);
|
|
|
|
|
AddStep("seek to break end", () => Player.GameplayClockContainer.Seek(Beatmap.Value.Beatmap.Breaks.First().EndTime));
|
|
|
|
|
AddUntilStep("activation mode is disabled", () => Player.OverlayActivationMode == OverlayActivation.Disabled);
|
2020-08-11 02:13:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
2020-08-14 03:53:17 +08:00
|
|
|
|
protected override TestPlayer CreatePlayer(Ruleset ruleset) => new OverlayTestPlayer();
|
2020-08-03 22:00:10 +08:00
|
|
|
|
|
2020-08-14 03:53:17 +08:00
|
|
|
|
protected class OverlayTestPlayer : TestPlayer
|
2020-08-03 22:00:10 +08:00
|
|
|
|
{
|
|
|
|
|
public new OverlayActivation OverlayActivationMode => base.OverlayActivationMode.Value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|