示例#1
0
        public void TestAllowSwitchAfterDiscardingUnsavedChanges()
        {
            BeatmapInfo         targetDifficulty = null;
            PromptForSaveDialog saveDialog       = null;

            AddStep("remove first hitobject", () => EditorBeatmap.RemoveAt(0));

            AddStep("set target difficulty", () => targetDifficulty = importedBeatmapSet.Beatmaps.Last(beatmap => !beatmap.Equals(Beatmap.Value.BeatmapInfo)));
            switchToDifficulty(() => targetDifficulty);

            AddUntilStep("prompt for save dialog shown", () =>
            {
                saveDialog = this.ChildrenOfType <PromptForSaveDialog>().Single();
                return(saveDialog != null);
            });
            AddStep("discard changes", () =>
            {
                var continueButton = saveDialog.ChildrenOfType <PopupDialogOkButton>().Single();
                continueButton.TriggerClick();
            });

            confirmEditingBeatmap(() => targetDifficulty);

            AddStep("exit editor forcefully", () => Stack.Exit());
            // ensure editor loader didn't resume.
            AddAssert("stack empty", () => Stack.CurrentScreen == null);
        }