2022-09-12 10:50:16 +00:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
2022-09-12 15:50:11 +00:00
|
|
|
using System.Linq;
|
2022-09-12 10:50:16 +00:00
|
|
|
using NUnit.Framework;
|
|
|
|
using osu.Game.Beatmaps;
|
2022-09-12 23:38:29 +00:00
|
|
|
using osu.Game.Rulesets;
|
|
|
|
using osu.Game.Rulesets.Osu;
|
2022-09-12 10:50:16 +00:00
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
|
|
|
using osu.Game.Tests.Beatmaps;
|
2022-09-12 15:50:11 +00:00
|
|
|
using osuTK.Input;
|
2022-09-12 10:50:16 +00:00
|
|
|
|
2022-09-12 23:38:29 +00:00
|
|
|
namespace osu.Game.Tests.Visual.Editing
|
2022-09-12 10:50:16 +00:00
|
|
|
{
|
2022-09-12 23:38:29 +00:00
|
|
|
public partial class TestSceneSelectionBlueprintDeselection : EditorTestScene
|
2022-09-12 10:50:16 +00:00
|
|
|
{
|
2022-09-12 23:38:29 +00:00
|
|
|
protected override Ruleset CreateEditorRuleset() => new OsuRuleset();
|
|
|
|
|
2022-09-12 10:50:16 +00:00
|
|
|
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new TestBeatmap(ruleset, false);
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestSingleDeleteAtSameTime()
|
|
|
|
{
|
|
|
|
HitCircle? circle1 = null;
|
|
|
|
|
|
|
|
AddStep("add two circles at the same time", () =>
|
|
|
|
{
|
|
|
|
EditorClock.Seek(0);
|
2022-09-12 15:50:11 +00:00
|
|
|
circle1 = new HitCircle();
|
|
|
|
var circle2 = new HitCircle();
|
2022-09-13 06:03:13 +00:00
|
|
|
|
2022-09-12 10:50:16 +00:00
|
|
|
EditorBeatmap.Add(circle1);
|
|
|
|
EditorBeatmap.Add(circle2);
|
2022-09-13 06:03:13 +00:00
|
|
|
|
2022-09-12 10:50:16 +00:00
|
|
|
EditorBeatmap.SelectedHitObjects.Add(circle1);
|
|
|
|
EditorBeatmap.SelectedHitObjects.Add(circle2);
|
|
|
|
});
|
|
|
|
|
|
|
|
AddStep("delete the first circle", () => EditorBeatmap.Remove(circle1));
|
2022-09-13 06:03:13 +00:00
|
|
|
AddAssert("one hitobject remains", () => EditorBeatmap.HitObjects.Count == 1);
|
|
|
|
AddAssert("one hitobject selected", () => EditorBeatmap.SelectedHitObjects.Count == 1);
|
2022-09-12 10:50:16 +00:00
|
|
|
}
|
2022-09-12 15:50:11 +00:00
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestBigStackDeleteAtSameTime()
|
|
|
|
{
|
|
|
|
AddStep("add 20 circles at the same time", () =>
|
|
|
|
{
|
|
|
|
EditorClock.Seek(0);
|
|
|
|
|
|
|
|
for (int i = 0; i < 20; i++)
|
|
|
|
{
|
|
|
|
EditorBeatmap.Add(new HitCircle());
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
AddStep("select half of the circles", () =>
|
|
|
|
{
|
|
|
|
foreach (var hitObject in EditorBeatmap.HitObjects.SkipLast(10).Reverse())
|
|
|
|
{
|
|
|
|
EditorBeatmap.SelectedHitObjects.Add(hitObject);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
AddStep("delete all selected circles", () =>
|
|
|
|
{
|
|
|
|
InputManager.PressKey(Key.Delete);
|
|
|
|
InputManager.ReleaseKey(Key.Delete);
|
|
|
|
});
|
2022-09-13 06:03:13 +00:00
|
|
|
|
|
|
|
AddAssert("10 hitobjects remain", () => EditorBeatmap.HitObjects.Count == 10);
|
|
|
|
AddAssert("no hitobjects selected", () => EditorBeatmap.SelectedHitObjects.Count == 0);
|
2022-09-12 15:50:11 +00:00
|
|
|
}
|
2022-09-12 10:50:16 +00:00
|
|
|
}
|
|
|
|
}
|