1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 00:13:19 +08:00

Add test coverage of skin editor copy-paste

This commit is contained in:
Bartłomiej Dach 2023-11-23 09:45:38 +09:00
parent f1f820bec3
commit 4edaaa3083
No known key found for this signature in database

View File

@ -335,6 +335,40 @@ namespace osu.Game.Tests.Visual.Gameplay
AddAssert("value is less than default", () => hitErrorMeter.JudgementLineThickness.Value < hitErrorMeter.JudgementLineThickness.Default);
}
[Test]
public void TestCopyPaste()
{
AddStep("paste", () =>
{
InputManager.PressKey(Key.LControl);
InputManager.Key(Key.V);
InputManager.ReleaseKey(Key.LControl);
});
// no assertions. just make sure nothing crashes.
AddStep("select bar hit error blueprint", () =>
{
var blueprint = skinEditor.ChildrenOfType<SkinBlueprint>().First(b => b.Item is BarHitErrorMeter);
skinEditor.SelectedComponents.Clear();
skinEditor.SelectedComponents.Add(blueprint.Item);
});
AddStep("copy", () =>
{
InputManager.PressKey(Key.LControl);
InputManager.Key(Key.C);
InputManager.ReleaseKey(Key.LControl);
});
AddStep("paste", () =>
{
InputManager.PressKey(Key.LControl);
InputManager.Key(Key.V);
InputManager.ReleaseKey(Key.LControl);
});
AddAssert("three hit error meters present",
() => skinEditor.ChildrenOfType<SkinBlueprint>().Count(b => b.Item is BarHitErrorMeter),
() => Is.EqualTo(3));
}
protected override Ruleset CreatePlayerRuleset() => new OsuRuleset();
private partial class TestSkinEditorChangeHandler : SkinEditorChangeHandler