1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 12:27:26 +08:00
osu-lazer/osu.Game.Tests/Visual/Navigation/TestSceneBeatmapEditorNavigation.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-29 01:36:31 +08: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 TestSceneBeatmapEditorNavigation : OsuGameTestScene
2023-04-29 01:36:31 +08:00
{
[Test]
public void TestCancelNavigationToEditor()
{
2023-04-29 02:23:00 +08:00
BeatmapSetInfo[]? beatmapSets = null;
2023-04-29 01:36:31 +08:00
AddStep("Timestamp current beatmapsets", () =>
{
Game.Realm.Run(realm =>
{
beatmapSets = realm.All<BeatmapSetInfo>().Where(x => !x.DeletePending).ToArray();
});
});
2023-04-29 02:23:00 +08:00
AddStep("Set current beatmap to default", () =>
2023-04-29 01:36:31 +08:00
{
2023-04-29 02:23:00 +08:00
Game.Beatmap.SetDefault();
});
2023-04-29 01:36:31 +08:00
2023-04-29 02:23:00 +08:00
AddStep("Open editor loader", () =>
{
2023-04-29 01:36:31 +08:00
Game.ScreenStack.Push(new EditorLoader());
});
2023-04-29 02:23:00 +08:00
AddUntilStep("wait for editor", () => Game.ScreenStack.CurrentScreen is EditorLoader);
AddStep("close editor while loading", () =>
{
Game.ScreenStack.CurrentScreen.Exit();
});
2023-04-29 01:36:31 +08:00
AddUntilStep("wait for editor", () => Game.ScreenStack.CurrentScreen is MainMenu);
2023-04-29 02:23:00 +08:00
BeatmapSetInfo[]? currentSetInfos = null;
2023-04-29 01:36:31 +08:00
AddStep("Get current beatmaps", () =>
{
Game.Realm.Run(realm =>
{
currentSetInfos = realm.All<BeatmapSetInfo>().Where(x => !x.DeletePending).ToArray();
});
});
2023-04-29 02:23:00 +08:00
AddAssert("dummy beatmap didn't appear", () => currentSetInfos.IsDeepEqual(beatmapSets) && currentSetInfos is not null);
2023-04-29 01:36:31 +08:00
}
}
}