mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 16:13:57 +09:00
Merge pull request #15989 from bdach/fix-editor-clipboard-test-failure
Fix editor crashing if paste is performed while composer is loading
This commit is contained in:
@ -10,6 +10,7 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Overlays.Dialog;
|
using osu.Game.Overlays.Dialog;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Screens.Edit;
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Tests.Beatmaps.IO;
|
using osu.Game.Tests.Beatmaps.IO;
|
||||||
|
|
||||||
@ -89,6 +90,7 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
confirmEditingBeatmap(() => targetDifficulty);
|
confirmEditingBeatmap(() => targetDifficulty);
|
||||||
|
|
||||||
AddAssert("no objects selected", () => !EditorBeatmap.SelectedHitObjects.Any());
|
AddAssert("no objects selected", () => !EditorBeatmap.SelectedHitObjects.Any());
|
||||||
|
AddUntilStep("wait for drawable ruleset", () => Editor.ChildrenOfType<DrawableRuleset>().SingleOrDefault()?.IsLoaded == true);
|
||||||
AddStep("paste object", () => Editor.Paste());
|
AddStep("paste object", () => Editor.Paste());
|
||||||
|
|
||||||
if (sameRuleset)
|
if (sameRuleset)
|
||||||
|
@ -83,7 +83,9 @@ namespace osu.Game.Screens.Edit.Compose
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
EditorBeatmap.SelectedHitObjects.BindCollectionChanged((_, __) => updateClipboardActionAvailability());
|
EditorBeatmap.SelectedHitObjects.BindCollectionChanged((_, __) => updateClipboardActionAvailability());
|
||||||
clipboard.BindValueChanged(_ => updateClipboardActionAvailability(), true);
|
clipboard.BindValueChanged(_ => updateClipboardActionAvailability());
|
||||||
|
composer.OnLoadComplete += _ => updateClipboardActionAvailability();
|
||||||
|
updateClipboardActionAvailability();
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Clipboard operations
|
#region Clipboard operations
|
||||||
@ -131,7 +133,7 @@ namespace osu.Game.Screens.Edit.Compose
|
|||||||
private void updateClipboardActionAvailability()
|
private void updateClipboardActionAvailability()
|
||||||
{
|
{
|
||||||
CanCut.Value = CanCopy.Value = EditorBeatmap.SelectedHitObjects.Any();
|
CanCut.Value = CanCopy.Value = EditorBeatmap.SelectedHitObjects.Any();
|
||||||
CanPaste.Value = !string.IsNullOrEmpty(clipboard.Value);
|
CanPaste.Value = composer.IsLoaded && !string.IsNullOrEmpty(clipboard.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string formatSelectionAsString()
|
private string formatSelectionAsString()
|
||||||
|
Reference in New Issue
Block a user