mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 20:05:29 +08:00
Temporarily emptying TestSceneKeysPerSecondCounter
until a good test can be found
This commit is contained in:
parent
b52a07c16a
commit
edb8e5e33e
@ -1,77 +1,9 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using NUnit.Framework;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Game.Rulesets;
|
|
||||||
using osu.Game.Rulesets.Mania;
|
|
||||||
using osu.Game.Rulesets.UI;
|
|
||||||
using osu.Game.Screens.Play;
|
|
||||||
using osu.Game.Screens.Play.HUD.KPSCounter;
|
|
||||||
using osuTK;
|
|
||||||
using osuTK.Input;
|
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Gameplay
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
{
|
{
|
||||||
public class TestSceneKeysPerSecondCounter : PlayerTestScene
|
public class TestSceneKeysPerSecondCounter : OsuManualInputManagerTestScene
|
||||||
{
|
{
|
||||||
protected override Ruleset CreatePlayerRuleset() => new ManiaRuleset();
|
|
||||||
protected override bool HasCustomSteps => false;
|
|
||||||
protected override bool Autoplay => false;
|
|
||||||
protected override TestPlayer CreatePlayer(Ruleset ruleset) => new TestPlayer(true, false);
|
|
||||||
|
|
||||||
private GameplayClock gameplayClock;
|
|
||||||
private DrawableRuleset drawableRuleset;
|
|
||||||
|
|
||||||
private KeysPerSecondCounter counter;
|
|
||||||
|
|
||||||
private void createCounter()
|
|
||||||
{
|
|
||||||
AddStep("Create counter", () =>
|
|
||||||
{
|
|
||||||
gameplayClock = Player.GameplayClockContainer.GameplayClock;
|
|
||||||
drawableRuleset = Player.DrawableRuleset;
|
|
||||||
|
|
||||||
Player.HUDOverlay.Add(counter = new KeysPerSecondCounter
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Scale = new Vector2(5),
|
|
||||||
});
|
|
||||||
counter.SmoothingTime.Value = 0;
|
|
||||||
});
|
|
||||||
AddUntilStep("Counter created", () => Player.HUDOverlay.Contains(counter));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestBasic()
|
|
||||||
{
|
|
||||||
createCounter();
|
|
||||||
|
|
||||||
AddStep("press 1 key", () => InputManager.Key(Key.D));
|
|
||||||
AddAssert("KPS = 1", () => counter.Current.Value == 1);
|
|
||||||
AddUntilStep("Wait for KPS cooldown", () => counter.Current.Value <= 0);
|
|
||||||
AddStep("press 4 keys", () =>
|
|
||||||
{
|
|
||||||
InputManager.Key(Key.D);
|
|
||||||
InputManager.Key(Key.F);
|
|
||||||
InputManager.Key(Key.J);
|
|
||||||
InputManager.Key(Key.K);
|
|
||||||
});
|
|
||||||
AddAssert("KPS = 4", () => counter.Current.Value == 4);
|
|
||||||
AddStep("Pause player", () => Player.Pause());
|
|
||||||
AddAssert("KPS = 4", () => counter.Current.Value == 4);
|
|
||||||
AddStep("Resume player", () => Player.Resume());
|
|
||||||
AddStep("press 4 keys", () =>
|
|
||||||
{
|
|
||||||
InputManager.Key(Key.D);
|
|
||||||
InputManager.Key(Key.F);
|
|
||||||
InputManager.Key(Key.J);
|
|
||||||
InputManager.Key(Key.K);
|
|
||||||
});
|
|
||||||
AddAssert("KPS = 8", () => counter.Current.Value == 8);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user