1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 02:13:21 +08:00

Adjust skin editor scene library test for extensibility

This commit is contained in:
Bartłomiej Dach 2022-05-07 22:41:48 +02:00
parent 3bb22dece6
commit 836de49135
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497

View File

@ -20,20 +20,21 @@ namespace osu.Game.Tests.Visual.Navigation
{ {
public class TestSceneSkinEditorSceneLibrary : OsuGameTestScene public class TestSceneSkinEditorSceneLibrary : OsuGameTestScene
{ {
private SkinEditor skinEditor; private TestPlaySongSelect songSelect;
private SkinEditor skinEditor => Game.ChildrenOfType<SkinEditor>().FirstOrDefault();
public override void SetUpSteps() private void advanceToSongSelect()
{ {
base.SetUpSteps();
Screens.Select.SongSelect songSelect = null;
PushAndConfirm(() => songSelect = new TestPlaySongSelect()); PushAndConfirm(() => songSelect = new TestPlaySongSelect());
AddUntilStep("wait for song select", () => songSelect.BeatmapSetsLoaded); AddUntilStep("wait for song select", () => songSelect.BeatmapSetsLoaded);
AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely()); AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely());
AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault); AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);
}
private void openSkinEditor()
{
AddStep("open skin editor", () => AddStep("open skin editor", () =>
{ {
InputManager.PressKey(Key.ControlLeft); InputManager.PressKey(Key.ControlLeft);
@ -42,13 +43,15 @@ namespace osu.Game.Tests.Visual.Navigation
InputManager.ReleaseKey(Key.ControlLeft); InputManager.ReleaseKey(Key.ControlLeft);
InputManager.ReleaseKey(Key.ShiftLeft); InputManager.ReleaseKey(Key.ShiftLeft);
}); });
AddUntilStep("skin editor loaded", () => skinEditor != null);
AddUntilStep("get skin editor", () => (skinEditor = Game.ChildrenOfType<SkinEditor>().FirstOrDefault()) != null);
} }
[Test] [Test]
public void TestEditComponentDuringGameplay() public void TestEditComponentDuringGameplay()
{ {
advanceToSongSelect();
openSkinEditor();
switchToGameplayScene(); switchToGameplayScene();
BarHitErrorMeter hitErrorMeter = null; BarHitErrorMeter hitErrorMeter = null;
@ -85,6 +88,8 @@ namespace osu.Game.Tests.Visual.Navigation
[Test] [Test]
public void TestAutoplayCompatibleModsRetainedOnEnteringGameplay() public void TestAutoplayCompatibleModsRetainedOnEnteringGameplay()
{ {
advanceToSongSelect();
openSkinEditor();
AddStep("select DT", () => Game.SelectedMods.Value = new Mod[] { new OsuModDoubleTime() }); AddStep("select DT", () => Game.SelectedMods.Value = new Mod[] { new OsuModDoubleTime() });
switchToGameplayScene(); switchToGameplayScene();
@ -95,6 +100,8 @@ namespace osu.Game.Tests.Visual.Navigation
[Test] [Test]
public void TestAutoplayIncompatibleModsRemovedOnEnteringGameplay() public void TestAutoplayIncompatibleModsRemovedOnEnteringGameplay()
{ {
advanceToSongSelect();
openSkinEditor();
AddStep("select no fail and spun out", () => Game.SelectedMods.Value = new Mod[] { new OsuModNoFail(), new OsuModSpunOut() }); AddStep("select no fail and spun out", () => Game.SelectedMods.Value = new Mod[] { new OsuModNoFail(), new OsuModSpunOut() });
switchToGameplayScene(); switchToGameplayScene();
@ -105,6 +112,8 @@ namespace osu.Game.Tests.Visual.Navigation
[Test] [Test]
public void TestDuplicateAutoplayModRemovedOnEnteringGameplay() public void TestDuplicateAutoplayModRemovedOnEnteringGameplay()
{ {
advanceToSongSelect();
openSkinEditor();
AddStep("select autoplay", () => Game.SelectedMods.Value = new Mod[] { new OsuModAutoplay() }); AddStep("select autoplay", () => Game.SelectedMods.Value = new Mod[] { new OsuModAutoplay() });
switchToGameplayScene(); switchToGameplayScene();
@ -115,6 +124,8 @@ namespace osu.Game.Tests.Visual.Navigation
[Test] [Test]
public void TestCinemaModRemovedOnEnteringGameplay() public void TestCinemaModRemovedOnEnteringGameplay()
{ {
advanceToSongSelect();
openSkinEditor();
AddStep("select cinema", () => Game.SelectedMods.Value = new Mod[] { new OsuModCinema() }); AddStep("select cinema", () => Game.SelectedMods.Value = new Mod[] { new OsuModCinema() });
switchToGameplayScene(); switchToGameplayScene();