1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 16:07:24 +08:00

Added tests for new Taiko touch control schemes

This commit is contained in:
OpenSauce 2023-01-11 12:04:52 +00:00
parent d2247f704d
commit 32d1d5a34a
2 changed files with 28 additions and 22 deletions

View File

@ -3,7 +3,7 @@
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Testing; using osu.Game.Rulesets.Taiko.Configuration;
using osu.Game.Rulesets.Taiko.UI; using osu.Game.Rulesets.Taiko.UI;
using osu.Game.Tests.Visual; using osu.Game.Tests.Visual;
@ -14,10 +14,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
{ {
private DrumTouchInputArea drumTouchInputArea = null!; private DrumTouchInputArea drumTouchInputArea = null!;
[SetUpSteps] private void createDrum(TaikoTouchControlScheme _forcedControlScheme)
public void SetUpSteps()
{
AddStep("create drum", () =>
{ {
Child = new TaikoInputManager(new TaikoRuleset().RulesetInfo) Child = new TaikoInputManager(new TaikoRuleset().RulesetInfo)
{ {
@ -34,15 +31,20 @@ namespace osu.Game.Rulesets.Taiko.Tests
{ {
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre, Origin = Anchor.BottomCentre,
}, ForceControlScheme = _forcedControlScheme
}, }
}
}; };
});
} }
[Test] [Test]
public void TestDrum() public void TestDrum()
{ {
AddStep("create drum (kddk)", () => createDrum(TaikoTouchControlScheme.KDDK));
AddStep("show drum", () => drumTouchInputArea.Show());
AddStep("create drum (ddkk)", () => createDrum(TaikoTouchControlScheme.DDKK));
AddStep("show drum", () => drumTouchInputArea.Show());
AddStep("create drum (kkdd)", () => createDrum(TaikoTouchControlScheme.KKDD));
AddStep("show drum", () => drumTouchInputArea.Show()); AddStep("show drum", () => drumTouchInputArea.Show());
} }

View File

@ -24,6 +24,7 @@ namespace osu.Game.Rulesets.Taiko.UI
/// </summary> /// </summary>
public partial class DrumTouchInputArea : VisibilityContainer public partial class DrumTouchInputArea : VisibilityContainer
{ {
public TaikoTouchControlScheme? ForceControlScheme { get; set; }
// visibility state affects our child. we always want to handle input. // visibility state affects our child. we always want to handle input.
public override bool PropagatePositionalInputSubTree => true; public override bool PropagatePositionalInputSubTree => true;
public override bool PropagateNonPositionalInputSubTree => true; public override bool PropagateNonPositionalInputSubTree => true;
@ -55,7 +56,10 @@ namespace osu.Game.Rulesets.Taiko.UI
const float centre_region = 0.80f; const float centre_region = 0.80f;
if (ForceControlScheme == null)
config.BindWith(TaikoRulesetSetting.TouchControlScheme, configTouchControlScheme); config.BindWith(TaikoRulesetSetting.TouchControlScheme, configTouchControlScheme);
else
configTouchControlScheme.Value = (TaikoTouchControlScheme)ForceControlScheme;
Children = new Drawable[] Children = new Drawable[]
{ {