mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 17:32:54 +08: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:
commit
2e640ff2ad
@ -10,6 +10,7 @@ using osu.Game.Beatmaps;
|
||||
using osu.Game.Overlays.Dialog;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Tests.Beatmaps.IO;
|
||||
|
||||
@ -89,6 +90,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
confirmEditingBeatmap(() => targetDifficulty);
|
||||
|
||||
AddAssert("no objects selected", () => !EditorBeatmap.SelectedHitObjects.Any());
|
||||
AddUntilStep("wait for drawable ruleset", () => Editor.ChildrenOfType<DrawableRuleset>().SingleOrDefault()?.IsLoaded == true);
|
||||
AddStep("paste object", () => Editor.Paste());
|
||||
|
||||
if (sameRuleset)
|
||||
|
@ -83,7 +83,9 @@ namespace osu.Game.Screens.Edit.Compose
|
||||
{
|
||||
base.LoadComplete();
|
||||
EditorBeatmap.SelectedHitObjects.BindCollectionChanged((_, __) => updateClipboardActionAvailability());
|
||||
clipboard.BindValueChanged(_ => updateClipboardActionAvailability(), true);
|
||||
clipboard.BindValueChanged(_ => updateClipboardActionAvailability());
|
||||
composer.OnLoadComplete += _ => updateClipboardActionAvailability();
|
||||
updateClipboardActionAvailability();
|
||||
}
|
||||
|
||||
#region Clipboard operations
|
||||
@ -131,7 +133,7 @@ namespace osu.Game.Screens.Edit.Compose
|
||||
private void updateClipboardActionAvailability()
|
||||
{
|
||||
CanCut.Value = CanCopy.Value = EditorBeatmap.SelectedHitObjects.Any();
|
||||
CanPaste.Value = !string.IsNullOrEmpty(clipboard.Value);
|
||||
CanPaste.Value = composer.IsLoaded && !string.IsNullOrEmpty(clipboard.Value);
|
||||
}
|
||||
|
||||
private string formatSelectionAsString()
|
||||
|
Loading…
Reference in New Issue
Block a user