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 partial class TestSceneOverlayActivation : OsuPlayerTestScene
|
|
|
|
|
{
|
2024-10-01 16:00:32 +08:00
|
|
|
|
protected new OverlayTestPlayer Player => (OverlayTestPlayer)base.Player;
|
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",
|
2022-08-15 16:06:24 +08:00
|
|
|
|
() => Player.GameplayClockContainer.CurrentTime > Player.DrawableRuleset.GameplayStartTime);
|
2020-09-27 17:18:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
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-10-07 15:22:39 +08:00
|
|
|
|
AddAssert("local user playing", () => Player.LocalUserPlaying.Value);
|
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-10-07 15:22:39 +08:00
|
|
|
|
AddAssert("local user playing", () => Player.LocalUserPlaying.Value);
|
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());
|
2020-10-07 15:22:39 +08:00
|
|
|
|
AddAssert("local user not playing", () => !Player.LocalUserPlaying.Value);
|
2020-08-14 03:53:17 +08:00
|
|
|
|
AddUntilStep("activation mode is user triggered", () => Player.OverlayActivationMode == OverlayActivation.UserTriggered);
|
2020-08-03 22:00:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestGameplayOverlayActivationReplayLoaded()
|
|
|
|
|
{
|
2020-10-07 15:22:39 +08:00
|
|
|
|
AddAssert("local user playing", () => Player.LocalUserPlaying.Value);
|
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);
|
2020-10-07 15:22:39 +08:00
|
|
|
|
AddAssert("local user not playing", () => !Player.LocalUserPlaying.Value);
|
2020-08-14 03:53:17 +08:00
|
|
|
|
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-10-07 15:22:39 +08:00
|
|
|
|
AddAssert("local user playing", () => Player.LocalUserPlaying.Value);
|
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);
|
2020-10-07 16:20:02 +08:00
|
|
|
|
AddAssert("local user not playing", () => !Player.LocalUserPlaying.Value);
|
2020-08-14 03:53:17 +08:00
|
|
|
|
AddStep("seek to break end", () => Player.GameplayClockContainer.Seek(Beatmap.Value.Beatmap.Breaks.First().EndTime));
|
|
|
|
|
AddUntilStep("activation mode is disabled", () => Player.OverlayActivationMode == OverlayActivation.Disabled);
|
2020-10-07 16:20:02 +08:00
|
|
|
|
AddAssert("local user playing", () => Player.LocalUserPlaying.Value);
|
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 partial class OverlayTestPlayer : TestPlayer
|
2020-08-03 22:00:10 +08:00
|
|
|
|
{
|
|
|
|
|
public new OverlayActivation OverlayActivationMode => base.OverlayActivationMode.Value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|