mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 02:22:56 +08:00
Move test steps into setup
This commit is contained in:
parent
99812bd448
commit
19d529c1c8
@ -85,6 +85,8 @@ namespace osu.Game.Tests.Visual
|
|||||||
manager.Delete(manager.GetAllUsableBeatmapSets());
|
manager.Delete(manager.GetAllUsableBeatmapSets());
|
||||||
var temp = TestResources.GetTestBeatmapForImport();
|
var temp = TestResources.GetTestBeatmapForImport();
|
||||||
manager.Import(temp);
|
manager.Import(temp);
|
||||||
|
Child = screenStackContainer = new ScreenStackCacheContainer { RelativeSizeAxes = Axes.Both };
|
||||||
|
screenStackContainer.ScreenStack.Push(songSelect = new DummySongSelect());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +96,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
[Test]
|
[Test]
|
||||||
public void PlayerLoaderSettingsHoverTest()
|
public void PlayerLoaderSettingsHoverTest()
|
||||||
{
|
{
|
||||||
createSongSelect();
|
setupUserSettings();
|
||||||
AddStep("Start player loader", () => songSelect.Push(playerLoader = new DimAccessiblePlayerLoader(player = new DimAccessiblePlayer())));
|
AddStep("Start player loader", () => songSelect.Push(playerLoader = new DimAccessiblePlayerLoader(player = new DimAccessiblePlayer())));
|
||||||
AddUntilStep(() => playerLoader?.IsLoaded ?? false, "Wait for Player Loader to load");
|
AddUntilStep(() => playerLoader?.IsLoaded ?? false, "Wait for Player Loader to load");
|
||||||
AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent());
|
AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent());
|
||||||
@ -116,7 +118,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
[Test]
|
[Test]
|
||||||
public void PlayerLoaderTransitionTest()
|
public void PlayerLoaderTransitionTest()
|
||||||
{
|
{
|
||||||
createSongSelect();
|
setupUserSettings();
|
||||||
AddStep("Start player loader", () => { songSelect.Push(playerLoader = new DimAccessiblePlayerLoader(player = new DimAccessiblePlayer())); });
|
AddStep("Start player loader", () => { songSelect.Push(playerLoader = new DimAccessiblePlayerLoader(player = new DimAccessiblePlayer())); });
|
||||||
AddUntilStep(() => playerLoader?.IsLoaded ?? false, "Wait for Player Loader to load");
|
AddUntilStep(() => playerLoader?.IsLoaded ?? false, "Wait for Player Loader to load");
|
||||||
AddStep("Allow beatmap to load", () =>
|
AddStep("Allow beatmap to load", () =>
|
||||||
@ -138,7 +140,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
[Test]
|
[Test]
|
||||||
public void StoryboardBackgroundVisibilityTest()
|
public void StoryboardBackgroundVisibilityTest()
|
||||||
{
|
{
|
||||||
performSetup();
|
performFullSetup();
|
||||||
createFakeStoryboard();
|
createFakeStoryboard();
|
||||||
waitForDim();
|
waitForDim();
|
||||||
AddAssert("Background is invisible, storyboard is visible", () => songSelect.IsBackgroundInvisible() && player.IsStoryboardVisible());
|
AddAssert("Background is invisible, storyboard is visible", () => songSelect.IsBackgroundInvisible() && player.IsStoryboardVisible());
|
||||||
@ -157,7 +159,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
[Test]
|
[Test]
|
||||||
public void StoryboardTransitionTest()
|
public void StoryboardTransitionTest()
|
||||||
{
|
{
|
||||||
performSetup();
|
performFullSetup();
|
||||||
createFakeStoryboard();
|
createFakeStoryboard();
|
||||||
AddUntilStep(() =>
|
AddUntilStep(() =>
|
||||||
{
|
{
|
||||||
@ -176,7 +178,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
[Test]
|
[Test]
|
||||||
public void DisableUserDimTest()
|
public void DisableUserDimTest()
|
||||||
{
|
{
|
||||||
performSetup();
|
performFullSetup();
|
||||||
AddStep("Test User Undimming", () => songSelect.DimEnabled.Value = false);
|
AddStep("Test User Undimming", () => songSelect.DimEnabled.Value = false);
|
||||||
waitForDim();
|
waitForDim();
|
||||||
AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed());
|
AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed());
|
||||||
@ -188,7 +190,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
[Test]
|
[Test]
|
||||||
public void EnableUserDimTest()
|
public void EnableUserDimTest()
|
||||||
{
|
{
|
||||||
performSetup();
|
performFullSetup();
|
||||||
AddStep("Test User Dimming", () => songSelect.DimEnabled.Value = true);
|
AddStep("Test User Dimming", () => songSelect.DimEnabled.Value = true);
|
||||||
waitForDim();
|
waitForDim();
|
||||||
AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed());
|
AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed());
|
||||||
@ -200,7 +202,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
[Test]
|
[Test]
|
||||||
public void PauseTest()
|
public void PauseTest()
|
||||||
{
|
{
|
||||||
performSetup(true);
|
performFullSetup(true);
|
||||||
AddStep("Transition to Pause", () =>
|
AddStep("Transition to Pause", () =>
|
||||||
{
|
{
|
||||||
if (!player.IsPaused.Value)
|
if (!player.IsPaused.Value)
|
||||||
@ -216,7 +218,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
[Test]
|
[Test]
|
||||||
public void TransitionTest()
|
public void TransitionTest()
|
||||||
{
|
{
|
||||||
performSetup();
|
performFullSetup();
|
||||||
AddStep("Transition to Results", () => player.Push(new FadeAccesibleResults(new ScoreInfo { User = new User { Username = "osu!" } })));
|
AddStep("Transition to Results", () => player.Push(new FadeAccesibleResults(new ScoreInfo { User = new User { Username = "osu!" } })));
|
||||||
waitForDim();
|
waitForDim();
|
||||||
AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed());
|
AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed());
|
||||||
@ -229,7 +231,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
[Test]
|
[Test]
|
||||||
public void TransitionOutTest()
|
public void TransitionOutTest()
|
||||||
{
|
{
|
||||||
performSetup();
|
performFullSetup();
|
||||||
AddUntilStep(() =>
|
AddUntilStep(() =>
|
||||||
{
|
{
|
||||||
if (!songSelect.IsCurrentScreen())
|
if (!songSelect.IsCurrentScreen())
|
||||||
@ -261,9 +263,9 @@ namespace osu.Game.Tests.Visual
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
private void performSetup(bool allowPause = false)
|
private void performFullSetup(bool allowPause = false)
|
||||||
{
|
{
|
||||||
createSongSelect();
|
setupUserSettings();
|
||||||
|
|
||||||
AddStep("Start player loader", () =>
|
AddStep("Start player loader", () =>
|
||||||
{
|
{
|
||||||
@ -280,19 +282,15 @@ namespace osu.Game.Tests.Visual
|
|||||||
AddUntilStep(() => player.IsLoaded, "Wait for player to load");
|
AddUntilStep(() => player.IsLoaded, "Wait for player to load");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createSongSelect()
|
private void setupUserSettings()
|
||||||
{
|
{
|
||||||
AddStep("Create new screen stack", () => Child = screenStackContainer = new ScreenStackCacheContainer { RelativeSizeAxes = Axes.Both });
|
AddUntilStep(() => songSelect.Carousel.SelectedBeatmap != null, "Song select has selection");
|
||||||
AddUntilStep(() => screenStackContainer.IsLoaded, "Wait for screen stack creation");
|
AddStep("Set default user settings", () =>
|
||||||
AddStep("Create new song select", () => screenStackContainer.ScreenStack.Push(songSelect = new DummySongSelect()));
|
|
||||||
AddUntilStep(() => songSelect.IsLoaded, "Wait for song select to load");
|
|
||||||
AddStep("Set user settings", () =>
|
|
||||||
{
|
{
|
||||||
Beatmap.Value.Mods.Value = Beatmap.Value.Mods.Value.Concat(new[] { new OsuModNoFail() });
|
Beatmap.Value.Mods.Value = Beatmap.Value.Mods.Value.Concat(new[] { new OsuModNoFail() });
|
||||||
songSelect.DimLevel.Value = 0.7f;
|
songSelect.DimLevel.Value = 0.7f;
|
||||||
songSelect.BlurLevel.Value = 0.0f;
|
songSelect.BlurLevel.Value = 0.0f;
|
||||||
});
|
});
|
||||||
AddUntilStep(() => songSelect.Carousel.SelectedBeatmap != null, "Song select has selection");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DummySongSelect : PlaySongSelect
|
private class DummySongSelect : PlaySongSelect
|
||||||
|
Loading…
Reference in New Issue
Block a user