From 7e705987738729ddbb01de3554d99de24f0f7a87 Mon Sep 17 00:00:00 2001 From: tsrk Date: Thu, 15 Jun 2023 12:02:30 +0200 Subject: [PATCH] test: move back key counter tests in ctor --- .../Visual/Gameplay/TestSceneKeyCounter.cs | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneKeyCounter.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneKeyCounter.cs index 7bf9738fb4..d7c2b1c7dd 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneKeyCounter.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneKeyCounter.cs @@ -22,8 +22,6 @@ namespace osu.Game.Tests.Visual.Gameplay [Cached] private readonly KeyCounterController controller; - private readonly KeyCounterDisplay defaultDisplay; - public TestSceneKeyCounter() { Children = new Drawable[] @@ -36,9 +34,9 @@ namespace osu.Game.Tests.Visual.Gameplay RelativeSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Spacing = new Vector2(72.7f), - Children = new[] + Children = new KeyCounterDisplay[] { - defaultDisplay = new DefaultKeyCounterDisplay + new DefaultKeyCounterDisplay { Origin = Anchor.Centre, Anchor = Anchor.Centre, @@ -59,12 +57,6 @@ namespace osu.Game.Tests.Visual.Gameplay new KeyCounterMouseTrigger(MouseButton.Left), new KeyCounterMouseTrigger(MouseButton.Right), }); - } - - [Test] - public void TestDoThings() - { - var testCounter = (DefaultKeyCounter)defaultDisplay.Counters.First(); AddStep("Add random", () => { @@ -72,15 +64,16 @@ namespace osu.Game.Tests.Visual.Gameplay controller.Add(new KeyCounterKeyboardTrigger(key)); }); - Key testKey = ((KeyCounterKeyboardTrigger)controller.Triggers.First()).Key; + InputTrigger testTrigger = controller.Triggers.First(); + Key testKey = ((KeyCounterKeyboardTrigger)testTrigger).Key; addPressKeyStep(); - AddAssert($"Check {testKey} counter after keypress", () => testCounter.CountPresses.Value == 1); + AddAssert($"Check {testKey} counter after keypress", () => testTrigger.ActivationCount.Value == 1); addPressKeyStep(); - AddAssert($"Check {testKey} counter after keypress", () => testCounter.CountPresses.Value == 2); + AddAssert($"Check {testKey} counter after keypress", () => testTrigger.ActivationCount.Value == 2); AddStep("Disable counting", () => controller.IsCounting.Value = false); addPressKeyStep(); - AddAssert($"Check {testKey} count has not changed", () => testCounter.CountPresses.Value == 2); + AddAssert($"Check {testKey} count has not changed", () => testTrigger.ActivationCount.Value == 2); void addPressKeyStep() => AddStep($"Press {testKey} key", () => InputManager.Key(testKey)); }