mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 22:56:36 +09:00
Merge branch 'master' into mania-notes
# Conflicts: # osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj
This commit is contained in:
70
osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs
Normal file
70
osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs
Normal file
@ -0,0 +1,70 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Rulesets.Mania.UI;
|
||||
using System.Linq;
|
||||
using System;
|
||||
|
||||
namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
internal class TestCaseManiaPlayfield : TestCase
|
||||
{
|
||||
public override string Description => @"Mania playfield";
|
||||
|
||||
protected override double TimePerAction => 200;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
|
||||
const int max_columns = 10;
|
||||
|
||||
Action<int, SpecialColumnPosition> createPlayfield = (cols, pos) =>
|
||||
{
|
||||
Clear();
|
||||
Add(new ManiaPlayfield(cols)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
SpecialColumnPosition = pos
|
||||
});
|
||||
};
|
||||
|
||||
for (int i = 1; i <= max_columns; i++)
|
||||
{
|
||||
int tempI = i;
|
||||
|
||||
AddStep($"{i} column" + (i > 1 ? "s" : ""), () => createPlayfield(tempI, SpecialColumnPosition.Normal));
|
||||
|
||||
AddStep("Trigger keys down", () => ((ManiaPlayfield)Children.First()).Columns.Children.ForEach(triggerKeyDown));
|
||||
AddStep("Trigger keys up", () => ((ManiaPlayfield)Children.First()).Columns.Children.ForEach(triggerKeyUp));
|
||||
|
||||
AddStep("Left special style", () => createPlayfield(tempI, SpecialColumnPosition.Left));
|
||||
AddStep("Right special style", () => createPlayfield(tempI, SpecialColumnPosition.Right));
|
||||
}
|
||||
|
||||
AddStep("Normal special style", () => createPlayfield(max_columns, SpecialColumnPosition.Normal));
|
||||
}
|
||||
|
||||
private void triggerKeyDown(Column column)
|
||||
{
|
||||
column.TriggerKeyDown(new InputState(), new KeyDownEventArgs
|
||||
{
|
||||
Key = column.Key,
|
||||
Repeat = false
|
||||
});
|
||||
}
|
||||
|
||||
private void triggerKeyUp(Column column)
|
||||
{
|
||||
column.TriggerKeyUp(new InputState(), new KeyUpEventArgs
|
||||
{
|
||||
Key = column.Key
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -6,16 +6,21 @@ using osu.Framework.Graphics;
|
||||
using osu.Game.Overlays.Mods;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
internal class TestCaseModSelectOverlay : TestCase
|
||||
internal class TestCaseMods : TestCase
|
||||
{
|
||||
public override string Description => @"Tests the mod select overlay";
|
||||
public override string Description => @"Mod select overlay and in-game display";
|
||||
|
||||
private ModSelectOverlay modSelect;
|
||||
private ModDisplay modDisplay;
|
||||
|
||||
private RulesetDatabase rulesets;
|
||||
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(RulesetDatabase rulesets)
|
||||
{
|
||||
@ -33,6 +38,16 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
Anchor = Anchor.BottomCentre,
|
||||
});
|
||||
|
||||
Add(modDisplay = new ModDisplay
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Position = new Vector2(0, 25),
|
||||
});
|
||||
|
||||
modDisplay.Current.BindTo(modSelect.SelectedMods);
|
||||
|
||||
AddStep("Toggle", modSelect.ToggleVisibility);
|
||||
|
||||
foreach (var ruleset in rulesets.AllRulesets)
|
@ -8,7 +8,7 @@ using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
|
||||
namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
|
Reference in New Issue
Block a user