1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 08:27:49 +08:00

Add assertions for clipboard content to TestSceneEditorClipboard

This commit is contained in:
Marvin 2024-03-29 15:27:34 +01:00
parent 2f8bef8990
commit 9adb9dd5f8

View File

@ -172,11 +172,34 @@ namespace osu.Game.Tests.Visual.Editing
AddAssert("is three objects", () => EditorBeatmap.HitObjects.Count == 3);
}
[Test]
public void TestCopyCreatesClipboardEntry()
{
var addedObject = new HitCircle { StartTime = 1000 };
AddStep("add hitobject", () => EditorBeatmap.Add(addedObject));
AddStep("select added object", () => EditorBeatmap.SelectedHitObjects.Add(addedObject));
AddStep("copy hitobject", () => Editor.Copy());
AddAssert("clipboard contains entry for hitobjects", () => hostClipboard.GetCustom(ClipboardContent.CLIPBOARD_FORMAT) != null);
}
[Test]
public void TestCutCreatesClipboardEntry()
{
var addedObject = new HitCircle { StartTime = 1000 };
AddStep("add hitobject", () => EditorBeatmap.Add(addedObject));
AddStep("select added object", () => EditorBeatmap.SelectedHitObjects.Add(addedObject));
AddStep("cut hitobject", () => Editor.Cut());
AddAssert("clipboard contains entry for hitobjects", () => hostClipboard.GetCustom(ClipboardContent.CLIPBOARD_FORMAT) != null);
}
[Test]
public void TestCutNothing()
{
AddStep("cut hitobject", () => Editor.Cut());
AddAssert("are no objects", () => EditorBeatmap.HitObjects.Count == 0);
AddAssert("clipboard contains no objects", () => hostClipboard.GetCustom(ClipboardContent.CLIPBOARD_FORMAT) == null);
}
[Test]
@ -184,6 +207,7 @@ namespace osu.Game.Tests.Visual.Editing
{
AddStep("copy hitobject", () => Editor.Copy());
AddAssert("are no objects", () => EditorBeatmap.HitObjects.Count == 0);
AddAssert("clipboard contains no objects", () => hostClipboard.GetCustom(ClipboardContent.CLIPBOARD_FORMAT) == null);
}
[Test]
@ -211,7 +235,7 @@ namespace osu.Game.Tests.Visual.Editing
}
[Test]
public void TestPasteJsonContent()
public void TestPasteRawClipboardCootent()
{
var hitObjects = new List<HitObject>
{
@ -226,7 +250,7 @@ namespace osu.Game.Tests.Visual.Editing
}
[Test]
public void TestPasteUnparseableContent()
public void TestPasteUnparseableClipboardContent()
{
AddStep("store invalid content in clipboard", () => hostClipboard.SetCustom(ClipboardContent.CLIPBOARD_FORMAT, "invalid json content"));