2017-05-01 16:00:41 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2017-05-03 11:30:03 +08:00
|
|
|
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
2017-05-03 11:58:46 +08:00
|
|
|
|
using osu.Framework.Input;
|
|
|
|
|
using osu.Framework.Testing;
|
|
|
|
|
using osu.Framework.Graphics;
|
2017-05-03 11:37:47 +08:00
|
|
|
|
using osu.Game.Rulesets.Mania.UI;
|
2017-05-03 11:58:46 +08:00
|
|
|
|
using System.Linq;
|
2017-05-01 16:00:41 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Desktop.VisualTests.Tests
|
|
|
|
|
{
|
|
|
|
|
internal class TestCaseManiaPlayfield : TestCase
|
|
|
|
|
{
|
|
|
|
|
public override string Description => @"Mania playfield";
|
|
|
|
|
|
2017-05-03 11:30:03 +08:00
|
|
|
|
protected override double TimePerAction => 200;
|
2017-05-01 16:24:35 +08:00
|
|
|
|
|
2017-05-01 16:00:41 +08:00
|
|
|
|
public override void Reset()
|
|
|
|
|
{
|
|
|
|
|
base.Reset();
|
|
|
|
|
|
2017-05-03 18:38:15 +08:00
|
|
|
|
const int max_columns = 10;
|
2017-05-03 11:30:03 +08:00
|
|
|
|
|
|
|
|
|
for (int i = 1; i <= max_columns; i++)
|
2017-05-01 16:00:41 +08:00
|
|
|
|
{
|
2017-05-03 11:30:03 +08:00
|
|
|
|
int tempI = i;
|
|
|
|
|
|
2017-05-03 11:58:46 +08:00
|
|
|
|
AddStep($"{i} column" + (i > 1 ? "s" : ""), () =>
|
2017-05-01 16:24:35 +08:00
|
|
|
|
{
|
2017-05-03 11:30:03 +08:00
|
|
|
|
Clear();
|
|
|
|
|
Add(new ManiaPlayfield(tempI)
|
2017-05-01 16:24:35 +08:00
|
|
|
|
{
|
2017-05-03 11:30:03 +08:00
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2017-05-03 11:58:46 +08:00
|
|
|
|
AddStep("Trigger keys down", () => ((ManiaPlayfield)Children.First()).Columns.Children.ForEach(triggerKeyDown));
|
|
|
|
|
AddStep("Trigger keys up", () => ((ManiaPlayfield)Children.First()).Columns.Children.ForEach(triggerKeyUp));
|
2017-05-04 13:46:10 +08:00
|
|
|
|
AddStep("Left special style", () => ((ManiaPlayfield)Children.First()).SpecialColumnPosition = SpecialColumnPosition.Left);
|
|
|
|
|
AddStep("Right special style", () => ((ManiaPlayfield)Children.First()).SpecialColumnPosition = SpecialColumnPosition.Right);
|
2017-05-03 11:30:03 +08:00
|
|
|
|
}
|
2017-05-03 18:38:27 +08:00
|
|
|
|
|
2017-05-04 13:46:10 +08:00
|
|
|
|
AddStep("Normal special style", () => ((ManiaPlayfield)Children.First()).SpecialColumnPosition = SpecialColumnPosition.Normal);
|
2017-05-03 11:30:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void triggerKeyDown(Column column)
|
|
|
|
|
{
|
|
|
|
|
column.TriggerKeyDown(new InputState(), new KeyDownEventArgs
|
|
|
|
|
{
|
|
|
|
|
Key = column.Key,
|
|
|
|
|
Repeat = false
|
2017-05-01 16:00:41 +08:00
|
|
|
|
});
|
2017-05-03 11:30:03 +08:00
|
|
|
|
}
|
2017-05-01 16:24:35 +08:00
|
|
|
|
|
2017-05-03 11:30:03 +08:00
|
|
|
|
private void triggerKeyUp(Column column)
|
|
|
|
|
{
|
|
|
|
|
column.TriggerKeyUp(new InputState(), new KeyUpEventArgs
|
2017-05-01 16:24:35 +08:00
|
|
|
|
{
|
2017-05-03 11:30:03 +08:00
|
|
|
|
Key = column.Key
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-05-01 16:00:41 +08:00
|
|
|
|
}
|