mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 06:13:04 +08:00
Revert test scene changes
This commit is contained in:
parent
c3221e1a36
commit
8df77ffe92
@ -3,20 +3,14 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Graphics.Containers;
|
|
||||||
using osu.Game.Overlays;
|
|
||||||
using osu.Game.Overlays.Notifications;
|
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
@ -30,35 +24,19 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
public class TestScenePlayerLoader : ManualInputManagerTestScene
|
public class TestScenePlayerLoader : ManualInputManagerTestScene
|
||||||
{
|
{
|
||||||
private TestPlayerLoader loader;
|
private TestPlayerLoader loader;
|
||||||
private TestPlayerLoaderContainer container;
|
private OsuScreenStack stack;
|
||||||
private TestPlayer player;
|
|
||||||
|
|
||||||
[Resolved]
|
|
||||||
private AudioManager audioManager { get; set; }
|
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup() => Schedule(() =>
|
public void Setup() => Schedule(() =>
|
||||||
{
|
{
|
||||||
ResetPlayer(false);
|
InputManager.Child = stack = new OsuScreenStack { RelativeSizeAxes = Axes.Both };
|
||||||
Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
|
Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
|
||||||
});
|
});
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sets the input manager child to a new test player loader container instance.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="interactive">If the test player should behave like the production one.</param>
|
|
||||||
public void ResetPlayer(bool interactive)
|
|
||||||
{
|
|
||||||
player = new TestPlayer(interactive, interactive);
|
|
||||||
loader = new TestPlayerLoader(() => player);
|
|
||||||
container = new TestPlayerLoaderContainer(loader);
|
|
||||||
InputManager.Child = container;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestBlockLoadViaMouseMovement()
|
public void TestBlockLoadViaMouseMovement()
|
||||||
{
|
{
|
||||||
AddStep("load dummy beatmap", () => ResetPlayer(false));
|
AddStep("load dummy beatmap", () => stack.Push(loader = new TestPlayerLoader(() => new TestPlayer(false, false))));
|
||||||
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
||||||
AddRepeatStep("move mouse", () => InputManager.MoveMouseTo(loader.VisualSettings.ScreenSpaceDrawQuad.TopLeft + (loader.VisualSettings.ScreenSpaceDrawQuad.BottomRight - loader.VisualSettings.ScreenSpaceDrawQuad.TopLeft) * RNG.NextSingle()), 20);
|
AddRepeatStep("move mouse", () => InputManager.MoveMouseTo(loader.VisualSettings.ScreenSpaceDrawQuad.TopLeft + (loader.VisualSettings.ScreenSpaceDrawQuad.BottomRight - loader.VisualSettings.ScreenSpaceDrawQuad.TopLeft) * RNG.NextSingle()), 20);
|
||||||
AddAssert("loader still active", () => loader.IsCurrentScreen());
|
AddAssert("loader still active", () => loader.IsCurrentScreen());
|
||||||
@ -71,13 +49,13 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
Player player = null;
|
Player player = null;
|
||||||
SlowLoadPlayer slowPlayer = null;
|
SlowLoadPlayer slowPlayer = null;
|
||||||
|
|
||||||
AddStep("load dummy beatmap", () => ResetPlayer(false));
|
AddStep("load dummy beatmap", () => stack.Push(loader = new TestPlayerLoader(() => player = new TestPlayer(false, false))));
|
||||||
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
||||||
AddStep("mouse in centre", () => InputManager.MoveMouseTo(loader.ScreenSpaceDrawQuad.Centre));
|
AddStep("mouse in centre", () => InputManager.MoveMouseTo(loader.ScreenSpaceDrawQuad.Centre));
|
||||||
AddUntilStep("wait for player to be current", () => player.IsCurrentScreen());
|
AddUntilStep("wait for player to be current", () => player.IsCurrentScreen());
|
||||||
AddStep("load slow dummy beatmap", () =>
|
AddStep("load slow dummy beatmap", () =>
|
||||||
{
|
{
|
||||||
InputManager.Children = container = new TestPlayerLoaderContainer(loader = new TestPlayerLoader(() => slowPlayer = new SlowLoadPlayer(false, false)));
|
stack.Push(loader = new TestPlayerLoader(() => slowPlayer = new SlowLoadPlayer(false, false)));
|
||||||
Scheduler.AddDelayed(() => slowPlayer.AllowLoad.Set(), 5000);
|
Scheduler.AddDelayed(() => slowPlayer.AllowLoad.Set(), 5000);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -87,6 +65,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestModReinstantiation()
|
public void TestModReinstantiation()
|
||||||
{
|
{
|
||||||
|
TestPlayer player = null;
|
||||||
TestMod gameMod = null;
|
TestMod gameMod = null;
|
||||||
TestMod playerMod1 = null;
|
TestMod playerMod1 = null;
|
||||||
TestMod playerMod2 = null;
|
TestMod playerMod2 = null;
|
||||||
@ -94,7 +73,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
AddStep("load player", () =>
|
AddStep("load player", () =>
|
||||||
{
|
{
|
||||||
Mods.Value = new[] { gameMod = new TestMod() };
|
Mods.Value = new[] { gameMod = new TestMod() };
|
||||||
ResetPlayer(true);
|
stack.Push(loader = new TestPlayerLoader(() => player = new TestPlayer()));
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("wait for loader to become current", () => loader.IsCurrentScreen());
|
AddUntilStep("wait for loader to become current", () => loader.IsCurrentScreen());
|
||||||
@ -118,61 +97,6 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
AddAssert("player mods applied", () => playerMod2.Applied);
|
AddAssert("player mods applied", () => playerMod2.Applied);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestMutedNotification()
|
|
||||||
{
|
|
||||||
AddStep("set master volume to 0%", () => audioManager.Volume.Value = 0);
|
|
||||||
AddStep("reset notification lock", () => PlayerLoader.ResetNotificationLock());
|
|
||||||
//AddStep("reset notification overlay", () => notificationOverlay);
|
|
||||||
AddStep("load player", () => ResetPlayer(false));
|
|
||||||
AddUntilStep("wait for player", () => player.IsLoaded);
|
|
||||||
|
|
||||||
AddAssert("check for notification", () => container.NotificationOverlay.UnreadCount.Value == 1);
|
|
||||||
AddAssert("click notification", () =>
|
|
||||||
{
|
|
||||||
var scrollContainer = container.NotificationOverlay.Children.Last() as OsuScrollContainer;
|
|
||||||
var flowContainer = scrollContainer.Children.First() as FillFlowContainer<NotificationSection>;
|
|
||||||
return flowContainer.Children.First().First().Click();
|
|
||||||
});
|
|
||||||
AddAssert("check master volume", () => audioManager.Volume.IsDefault);
|
|
||||||
|
|
||||||
AddStep("restart player", () =>
|
|
||||||
{
|
|
||||||
var lastPlayer = player;
|
|
||||||
player = null;
|
|
||||||
lastPlayer.Restart();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private class TestPlayerLoaderContainer : Container
|
|
||||||
{
|
|
||||||
private TestPlayerLoader loader;
|
|
||||||
|
|
||||||
[Cached]
|
|
||||||
public NotificationOverlay NotificationOverlay { get; } = new NotificationOverlay
|
|
||||||
{
|
|
||||||
Anchor = Anchor.TopRight,
|
|
||||||
Origin = Anchor.TopRight,
|
|
||||||
};
|
|
||||||
|
|
||||||
[Cached]
|
|
||||||
public VolumeOverlay VolumeOverlay { get; } = new VolumeOverlay
|
|
||||||
{
|
|
||||||
Anchor = Anchor.TopLeft,
|
|
||||||
Origin = Anchor.TopLeft,
|
|
||||||
};
|
|
||||||
|
|
||||||
public TestPlayerLoaderContainer(TestPlayerLoader testPlayerLoader)
|
|
||||||
{
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
loader = testPlayerLoader,
|
|
||||||
NotificationOverlay,
|
|
||||||
VolumeOverlay
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class TestPlayerLoader : PlayerLoader
|
private class TestPlayerLoader : PlayerLoader
|
||||||
{
|
{
|
||||||
public new VisualSettings VisualSettings => base.VisualSettings;
|
public new VisualSettings VisualSettings => base.VisualSettings;
|
||||||
|
Loading…
Reference in New Issue
Block a user