mirror of
https://github.com/ppy/osu
synced 2024-12-13 10:28:17 +00:00
Add test coverage of playlist exit confirmation
This commit is contained in:
parent
9d457535c6
commit
0a2265b0e8
@ -26,6 +26,7 @@ using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Menu;
|
||||
using osu.Game.Screens.OnlinePlay.Lounge;
|
||||
using osu.Game.Screens.OnlinePlay.Playlists;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Ranking;
|
||||
using osu.Game.Screens.Select;
|
||||
@ -45,6 +46,57 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
|
||||
private Vector2 optionsButtonPosition => Game.ToScreenSpace(new Vector2(click_padding, click_padding));
|
||||
|
||||
[TestCase(false)]
|
||||
[TestCase(true)]
|
||||
public void TestConfirmationRequiredToDiscardPlaylist(bool withPlaylistItemAdded)
|
||||
{
|
||||
Screens.OnlinePlay.Playlists.Playlists playlistScreen = null;
|
||||
|
||||
AddUntilStep("wait for dialog overlay", () => Game.ChildrenOfType<DialogOverlay>().SingleOrDefault() != null);
|
||||
|
||||
PushAndConfirm(() => playlistScreen = new Screens.OnlinePlay.Playlists.Playlists());
|
||||
|
||||
AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely());
|
||||
|
||||
AddStep("open create screen", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(playlistScreen.ChildrenOfType<CreatePlaylistsRoomButton>().Single());
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
|
||||
if (withPlaylistItemAdded)
|
||||
{
|
||||
AddUntilStep("wait for settings displayed",
|
||||
() => (playlistScreen.CurrentSubScreen as PlaylistsRoomSubScreen)?.ChildrenOfType<PlaylistsRoomSettingsOverlay>().SingleOrDefault()?.State.Value == Visibility.Visible);
|
||||
|
||||
AddStep("edit playlist", () => InputManager.Key(Key.Enter));
|
||||
|
||||
AddUntilStep("wait for song select", () => (playlistScreen.CurrentSubScreen as PlaylistsSongSelect)?.BeatmapSetsLoaded == true);
|
||||
|
||||
AddUntilStep("wait for selection", () => !Game.Beatmap.IsDefault);
|
||||
|
||||
AddStep("add item", () => InputManager.Key(Key.Enter));
|
||||
|
||||
AddUntilStep("wait for return to playlist screen", () => playlistScreen.CurrentSubScreen is PlaylistsRoomSubScreen);
|
||||
|
||||
pushEscape();
|
||||
AddAssert("confirmation dialog shown", () => Game.ChildrenOfType<DialogOverlay>().Single().CurrentDialog is not null);
|
||||
|
||||
AddStep("confirm exit", () => InputManager.Key(Key.Enter));
|
||||
|
||||
AddAssert("dialog dismissed", () => Game.ChildrenOfType<DialogOverlay>().Single().CurrentDialog == null);
|
||||
|
||||
exitViaEscapeAndConfirm();
|
||||
}
|
||||
else
|
||||
{
|
||||
pushEscape();
|
||||
AddAssert("confirmation dialog not shown", () => Game.ChildrenOfType<DialogOverlay>().Single().CurrentDialog == null);
|
||||
|
||||
exitViaEscapeAndConfirm();
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestExitSongSelectWithEscape()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user