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
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", () =>
{
nowPlayingOverlay = Game.ChildrenOfType<NowPlayingOverlay>().Single();
InputManager.Key(Key.F6);
});
AddStep("enter menu", () => InputManager.Key(Key.Enter));
AddUntilStep("toolbar displayed", () => Game.Toolbar.State.Value == Visibility.Visible);
AddStep("open now playing", () => InputManager.Key(Key.F6));
AddUntilStep("now playing is visible", () => nowPlayingOverlay.State.Value == Visibility.Visible);
// drag tests
@ -417,7 +417,7 @@ namespace osu.Game.Tests.Visual.Navigation
pushEscape(); // returns to osu! logo
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));
AddUntilStep("Wait for game exit", () => Game.ScreenStack.CurrentScreen == null);
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.Menu;
using osuTK.Graphics;
using IntroSequence = osu.Game.Configuration.IntroSequence;
namespace osu.Game.Tests.Visual
{
@ -126,7 +127,8 @@ namespace osu.Game.Tests.Visual
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";
protected override Loader CreateLoader() => new TestLoader();
@ -142,6 +144,9 @@ namespace osu.Game.Tests.Visual
protected override void LoadComplete()
{
base.LoadComplete();
LocalConfig.SetValue(OsuSetting.IntroSequence, IntroSequence.Circles);
API.Login("Rhythm Champion", "osu!");
Dependencies.Get<SessionStatics>().SetValue(Static.MutedAudioNotificationShownOnce, true);