mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 06:52:56 +08:00
Add failing tests for preserving clipboard content
This commit is contained in:
parent
3fc72271f1
commit
79d0f4835e
@ -71,6 +71,40 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
AddAssert("stack empty", () => Stack.CurrentScreen == null);
|
AddAssert("stack empty", () => Stack.CurrentScreen == null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestClipboardPreservedAfterSwitch([Values] bool sameRuleset)
|
||||||
|
{
|
||||||
|
BeatmapInfo targetDifficulty = null;
|
||||||
|
|
||||||
|
AddStep("select first object", () => EditorBeatmap.SelectedHitObjects.Add(EditorBeatmap.HitObjects.First()));
|
||||||
|
AddStep("copy object", () => Editor.Copy());
|
||||||
|
|
||||||
|
AddStep("set target difficulty", () =>
|
||||||
|
{
|
||||||
|
targetDifficulty = sameRuleset
|
||||||
|
? importedBeatmapSet.Beatmaps.Last(beatmap => !beatmap.Equals(Beatmap.Value.BeatmapInfo) && beatmap.RulesetID == Beatmap.Value.BeatmapInfo.RulesetID)
|
||||||
|
: importedBeatmapSet.Beatmaps.Last(beatmap => !beatmap.Equals(Beatmap.Value.BeatmapInfo) && beatmap.RulesetID != Beatmap.Value.BeatmapInfo.RulesetID);
|
||||||
|
});
|
||||||
|
switchToDifficulty(() => targetDifficulty);
|
||||||
|
confirmEditingBeatmap(() => targetDifficulty);
|
||||||
|
|
||||||
|
AddAssert("no objects selected", () => !EditorBeatmap.SelectedHitObjects.Any());
|
||||||
|
AddStep("paste object", () => Editor.Paste());
|
||||||
|
|
||||||
|
if (sameRuleset)
|
||||||
|
AddAssert("object was pasted", () => EditorBeatmap.SelectedHitObjects.Any());
|
||||||
|
else
|
||||||
|
AddAssert("object was not pasted", () => !EditorBeatmap.SelectedHitObjects.Any());
|
||||||
|
|
||||||
|
AddStep("exit editor", () => Stack.Exit());
|
||||||
|
|
||||||
|
AddUntilStep("prompt for save dialog shown", () => DialogOverlay.CurrentDialog is PromptForSaveDialog);
|
||||||
|
AddStep("discard changes", () => ((PromptForSaveDialog)DialogOverlay.CurrentDialog).PerformOkAction());
|
||||||
|
|
||||||
|
// ensure editor loader didn't resume.
|
||||||
|
AddAssert("stack empty", () => Stack.CurrentScreen == null);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestPreventSwitchDueToUnsavedChanges()
|
public void TestPreventSwitchDueToUnsavedChanges()
|
||||||
{
|
{
|
||||||
|
@ -80,7 +80,7 @@ namespace osu.Game.Screens.Edit.Compose
|
|||||||
public bool OnPressed(PlatformAction action)
|
public bool OnPressed(PlatformAction action)
|
||||||
{
|
{
|
||||||
if (action == PlatformAction.Copy)
|
if (action == PlatformAction.Copy)
|
||||||
host.GetClipboard().SetText(formatSelectionAsString());
|
host.GetClipboard()?.SetText(formatSelectionAsString());
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user