osu/osu.Game.Tests/Visual/Navigation/TestSceneBeatmapEditor.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

62 lines
1.9 KiB
C#
Raw Normal View History

2023-04-28 17:36:31 +00:00
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using DeepEqual.Syntax;
using NUnit.Framework;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Menu;
namespace osu.Game.Tests.Visual.Navigation
{
public partial class TestSceneBeatmapEditor : OsuGameTestScene
{
[Test]
public void TestCancelNavigationToEditor()
{
2023-04-28 18:23:00 +00:00
BeatmapSetInfo[]? beatmapSets = null;
2023-04-28 17:36:31 +00:00
AddStep("Timestamp current beatmapsets", () =>
{
Game.Realm.Run(realm =>
{
beatmapSets = realm.All<BeatmapSetInfo>().Where(x => !x.DeletePending).ToArray();
});
});
2023-04-28 18:23:00 +00:00
AddStep("Set current beatmap to default", () =>
2023-04-28 17:36:31 +00:00
{
2023-04-28 18:23:00 +00:00
Game.Beatmap.SetDefault();
});
2023-04-28 17:36:31 +00:00
2023-04-28 18:23:00 +00:00
AddStep("Open editor loader", () =>
{
2023-04-28 17:36:31 +00:00
Game.ScreenStack.Push(new EditorLoader());
});
2023-04-28 18:23:00 +00:00
AddUntilStep("wait for editor", () => Game.ScreenStack.CurrentScreen is EditorLoader);
AddStep("close editor while loading", () =>
{
Game.ScreenStack.CurrentScreen.Exit();
});
2023-04-28 17:36:31 +00:00
AddUntilStep("wait for editor", () => Game.ScreenStack.CurrentScreen is MainMenu);
2023-04-28 18:23:00 +00:00
BeatmapSetInfo[]? currentSetInfos = null;
2023-04-28 17:36:31 +00:00
AddStep("Get current beatmaps", () =>
{
Game.Realm.Run(realm =>
{
currentSetInfos = realm.All<BeatmapSetInfo>().Where(x => !x.DeletePending).ToArray();
});
});
2023-04-28 18:23:00 +00:00
AddAssert("dummy beatmap didn't appear", () => currentSetInfos.IsDeepEqual(beatmapSets) && currentSetInfos is not null);
2023-04-28 17:36:31 +00:00
}
}
}