1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-06 03:03:05 +08:00

Merge pull request #14989 from peppy/osu-game-test-scene-improvements

Improve performance of `OsuGameTestScene` based tests
This commit is contained in:
Dan Balasescu 2021-10-07 17:30:50 +09:00 committed by GitHub
commit 061697b4cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 8 deletions

View File

@ -350,13 +350,13 @@ namespace osu.Game.Tests.Visual.Navigation
// since most overlays use a scroll container that absorbs on mouse down // since most overlays use a scroll container that absorbs on mouse down
NowPlayingOverlay nowPlayingOverlay = null; NowPlayingOverlay nowPlayingOverlay = null;
AddStep("enter menu", () => InputManager.Key(Key.Enter)); AddUntilStep("Wait for now playing load", () => (nowPlayingOverlay = Game.ChildrenOfType<NowPlayingOverlay>().FirstOrDefault()) != null);
AddStep("get and press now playing hotkey", () => AddStep("enter menu", () => InputManager.Key(Key.Enter));
{ AddUntilStep("toolbar displayed", () => Game.Toolbar.State.Value == Visibility.Visible);
nowPlayingOverlay = Game.ChildrenOfType<NowPlayingOverlay>().Single();
InputManager.Key(Key.F6); AddStep("open now playing", () => InputManager.Key(Key.F6));
}); AddUntilStep("now playing is visible", () => nowPlayingOverlay.State.Value == Visibility.Visible);
// drag tests // drag tests
@ -417,7 +417,7 @@ namespace osu.Game.Tests.Visual.Navigation
pushEscape(); // returns to osu! logo pushEscape(); // returns to osu! logo
AddStep("Hold escape", () => InputManager.PressKey(Key.Escape)); AddStep("Hold escape", () => InputManager.PressKey(Key.Escape));
AddUntilStep("Wait for intro", () => Game.ScreenStack.CurrentScreen is IntroTriangles); AddUntilStep("Wait for intro", () => Game.ScreenStack.CurrentScreen is IntroScreen);
AddStep("Release escape", () => InputManager.ReleaseKey(Key.Escape)); AddStep("Release escape", () => InputManager.ReleaseKey(Key.Escape));
AddUntilStep("Wait for game exit", () => Game.ScreenStack.CurrentScreen == null); AddUntilStep("Wait for game exit", () => Game.ScreenStack.CurrentScreen == null);
AddStep("test dispose doesn't crash", () => Game.Dispose()); AddStep("test dispose doesn't crash", () => Game.Dispose());

View File

@ -22,6 +22,7 @@ using osu.Game.Scoring;
using osu.Game.Screens; using osu.Game.Screens;
using osu.Game.Screens.Menu; using osu.Game.Screens.Menu;
using osuTK.Graphics; using osuTK.Graphics;
using IntroSequence = osu.Game.Configuration.IntroSequence;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
@ -126,7 +127,8 @@ namespace osu.Game.Tests.Visual
public new Bindable<IReadOnlyList<Mod>> SelectedMods => base.SelectedMods; public new Bindable<IReadOnlyList<Mod>> SelectedMods => base.SelectedMods;
// if we don't do this, when running under nUnit the version that gets populated is that of nUnit. // if we don't apply these changes, when running under nUnit the version that gets populated is that of nUnit.
public override Version AssemblyVersion => new Version(0, 0);
public override string Version => "test game"; public override string Version => "test game";
protected override Loader CreateLoader() => new TestLoader(); protected override Loader CreateLoader() => new TestLoader();
@ -142,6 +144,9 @@ namespace osu.Game.Tests.Visual
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
LocalConfig.SetValue(OsuSetting.IntroSequence, IntroSequence.Circles);
API.Login("Rhythm Champion", "osu!"); API.Login("Rhythm Champion", "osu!");
Dependencies.Get<SessionStatics>().SetValue(Static.MutedAudioNotificationShownOnce, true); Dependencies.Get<SessionStatics>().SetValue(Static.MutedAudioNotificationShownOnce, true);