1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 19:42:55 +08:00

test(TestSceneOsuTouchInput): simplify draw hierarchy

An InputTrigger is considered active as long as
This commit is contained in:
tsrk 2023-06-18 17:51:17 +02:00
parent 886a1e98da
commit c8afd057bd
No known key found for this signature in database
GPG Key ID: EBD46BB3049B56D6

View File

@ -1,7 +1,6 @@
// 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.
using System;
using System.Diagnostics;
using System.Linq;
using NUnit.Framework;
@ -39,8 +38,6 @@ namespace osu.Game.Rulesets.Osu.Tests
private DefaultKeyCounter rightKeyCounter = null!;
private KeyCounterController controller = null!;
private OsuInputManager osuInputManager = null!;
private Container mainContent = null!;
@ -52,37 +49,31 @@ namespace osu.Game.Rulesets.Osu.Tests
AddStep("Create tests", () =>
{
InputTrigger triggerLeft;
InputTrigger triggerRight;
Children = new Drawable[]
{
osuInputManager = new OsuInputManager(new OsuRuleset().RulesetInfo)
{
Children = new Drawable[]
Child = mainContent = new Container
{
controller = new KeyCounterController(),
mainContent = new DependencyProvidingContainer
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Children = new Drawable[]
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
CachedDependencies = new (Type, object)[] { (typeof(KeyCounterController), controller) },
Children = new Drawable[]
new OsuCursorContainer
{
new OsuCursorContainer
{
Depth = float.MinValue,
}
Depth = float.MinValue,
},
triggerLeft = new TestActionKeyCounterTrigger(OsuAction.LeftButton),
triggerRight = new TestActionKeyCounterTrigger(OsuAction.RightButton)
},
}
},
},
new TouchVisualiser(),
};
InputTrigger triggerLeft;
InputTrigger triggerRight;
controller.Add(triggerLeft = new TestActionKeyCounterTrigger(OsuAction.LeftButton));
controller.Add(triggerRight = new TestActionKeyCounterTrigger(OsuAction.RightButton));
mainContent.AddRange(new[]
{
leftKeyCounter = new DefaultKeyCounter(triggerLeft)