mirror of
https://github.com/ppy/osu.git
synced 2024-11-13 17:27:48 +08:00
Add column testcase
This commit is contained in:
parent
2ed978deaa
commit
55a5dfa9b6
45
osu.Game.Rulesets.Mania.Tests/ManiaInputTestCase.cs
Normal file
45
osu.Game.Rulesets.Mania.Tests/ManiaInputTestCase.cs
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Input.Bindings;
|
||||||
|
using osu.Game.Tests.Visual;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.Tests
|
||||||
|
{
|
||||||
|
public abstract class ManiaInputTestCase : OsuTestCase
|
||||||
|
{
|
||||||
|
private readonly Container<Drawable> content;
|
||||||
|
protected override Container<Drawable> Content => content ?? base.Content;
|
||||||
|
|
||||||
|
protected ManiaInputTestCase(int keys)
|
||||||
|
{
|
||||||
|
base.Content.Add(content = new LocalInputManager(keys));
|
||||||
|
}
|
||||||
|
|
||||||
|
private class LocalInputManager : ManiaInputManager
|
||||||
|
{
|
||||||
|
public LocalInputManager(int variant)
|
||||||
|
: base(new ManiaRuleset().RulesetInfo, variant)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override RulesetKeyBindingContainer CreateKeyBindingContainer(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique)
|
||||||
|
=> new LocalKeyBindingContainer(ruleset, variant, unique);
|
||||||
|
|
||||||
|
private class LocalKeyBindingContainer : RulesetKeyBindingContainer
|
||||||
|
{
|
||||||
|
public LocalKeyBindingContainer(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique)
|
||||||
|
: base(ruleset, variant, unique)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void ReloadMappings()
|
||||||
|
{
|
||||||
|
KeyBindings = DefaultKeyBindings;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
39
osu.Game.Rulesets.Mania.Tests/TestCaseColumn.cs
Normal file
39
osu.Game.Rulesets.Mania.Tests/TestCaseColumn.cs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Game.Rulesets.Mania.UI;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.Tests
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestCaseColumn : ManiaInputTestCase
|
||||||
|
{
|
||||||
|
public TestCaseColumn()
|
||||||
|
: base(1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
Child = new ManiaInputManager(new ManiaRuleset().RulesetInfo, 1)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Height = 0.85f,
|
||||||
|
Child = new Column
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
AccentColour = Color4.OrangeRed,
|
||||||
|
Action = ManiaAction.Special1
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
|
|
||||||
protected RulesetInputManager(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique)
|
protected RulesetInputManager(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique)
|
||||||
{
|
{
|
||||||
InternalChild = KeyBindingContainer = new RulesetKeyBindingContainer(ruleset, variant, unique);
|
InternalChild = KeyBindingContainer = CreateKeyBindingContainer(ruleset, variant, unique);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Action mapping (for replays)
|
#region Action mapping (for replays)
|
||||||
@ -247,6 +247,9 @@ namespace osu.Game.Rulesets.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
protected virtual RulesetKeyBindingContainer CreateKeyBindingContainer(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique)
|
||||||
|
=> new RulesetKeyBindingContainer(ruleset, variant, unique);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user