public void TestSongContinuesAfterExitPlayer(bool withUserPause)
        {
            Player player = null;

            WorkingBeatmap beatmap() => Game.Beatmap.Value;

            PushAndConfirm(() => new TestSongSelect());

            AddStep("import beatmap", () => ImportBeatmapTest.LoadOszIntoOsu(Game, virtualTrack: true).Wait());

            AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);

            if (withUserPause)
            {
                AddStep("pause", () => Game.Dependencies.Get <MusicController>().Stop(true));
            }

            AddStep("press enter", () => InputManager.Key(Key.Enter));

            AddUntilStep("wait for player", () => (player = Game.ScreenStack.CurrentScreen as Player) != null);
            AddUntilStep("wait for fail", () => player.HasFailed);

            AddUntilStep("wait for track stop", () => !Game.MusicController.IsPlaying);
            AddAssert("Ensure time before preview point", () => Game.MusicController.CurrentTrack.CurrentTime < beatmap().Metadata.PreviewTime);

            pushEscape();

            AddUntilStep("wait for track playing", () => Game.MusicController.IsPlaying);
            AddAssert("Ensure time wasn't reset to preview point", () => Game.MusicController.CurrentTrack.CurrentTime < beatmap().Metadata.PreviewTime);
        }
        private void load(OsuGameBase osu, IAPIProvider api, RulesetStore rulesets)
        {
            this.api      = api;
            this.rulesets = rulesets;

            testBeatmap = ImportBeatmapTest.LoadOszIntoOsu(osu).Result;
        }
Example #3
0
        public void TestRetryCountIncrements()
        {
            Player player = null;

            PushAndConfirm(() => new TestPlaySongSelect());

            AddStep("import beatmap", () => ImportBeatmapTest.LoadQuickOszIntoOsu(Game).Wait());

            AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);

            AddStep("press enter", () => InputManager.Key(Key.Enter));

            AddUntilStep("wait for player", () =>
            {
                // dismiss any notifications that may appear (ie. muted notification).
                clickMouseInCentre();
                return((player = Game.ScreenStack.CurrentScreen as Player) != null);
            });

            AddAssert("retry count is 0", () => player.RestartCount == 0);

            AddStep("attempt to retry", () => player.ChildrenOfType <HotkeyRetryOverlay>().First().Action());
            AddUntilStep("wait for old player gone", () => Game.ScreenStack.CurrentScreen != player);

            AddUntilStep("get new player", () => (player = Game.ScreenStack.CurrentScreen as Player) != null);
            AddAssert("retry count is 1", () => player.RestartCount == 1);
        }
Example #4
0
        public void TestRetryFromResults()
        {
            Player        player  = null;
            ResultsScreen results = null;

            WorkingBeatmap beatmap() => Game.Beatmap.Value;

            PushAndConfirm(() => new TestPlaySongSelect());

            AddStep("import beatmap", () => ImportBeatmapTest.LoadQuickOszIntoOsu(Game).Wait());

            AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);

            AddStep("set mods", () => Game.SelectedMods.Value = new Mod[] { new OsuModNoFail(), new OsuModDoubleTime {
                                                                                SpeedChange = { Value = 2 }
                                                                            } });

            AddStep("press enter", () => InputManager.Key(Key.Enter));

            AddUntilStep("wait for player", () =>
            {
                // dismiss any notifications that may appear (ie. muted notification).
                clickMouseInCentre();
                return((player = Game.ScreenStack.CurrentScreen as Player) != null);
            });

            AddUntilStep("wait for track playing", () => beatmap().Track.IsRunning);
            AddStep("seek to near end", () => player.ChildrenOfType <GameplayClockContainer>().First().Seek(beatmap().Beatmap.HitObjects[^ 1].StartTime - 1000));
        private void load(OsuGameBase osu, APIAccess api, RulesetStore rulesets)
        {
            Bindable <BeatmapInfo> beatmapBindable = new Bindable <BeatmapInfo>();

            var imported = ImportBeatmapTest.LoadOszIntoOsu(osu);

            Child = backgroundSprite = new UpdateableBeatmapBackgroundSprite {
                RelativeSizeAxes = Axes.Both
            };

            backgroundSprite.Beatmap.BindTo(beatmapBindable);

            var req = new GetBeatmapSetRequest(1);

            api.Queue(req);

            AddStep("null", () => beatmapBindable.Value = null);

            AddStep("imported", () => beatmapBindable.Value = imported.Beatmaps.First());

            if (api.IsLoggedIn)
            {
                AddUntilStep(() => req.Result != null, "wait for api response");

                AddStep("online", () => beatmapBindable.Value = new BeatmapInfo
                {
                    BeatmapSet = req.Result?.ToBeatmapSet(rulesets)
                });
            }
            else
            {
                AddStep("online (login first)", () => { });
            }
        }
        public void TestPerformAtMenuFromPlayerLoader()
        {
            AddStep("import beatmap", () => ImportBeatmapTest.LoadQuickOszIntoOsu(Game).Wait());
            PushAndConfirm(() => new TestPlaySongSelect());

            AddStep("Press enter", () => InputManager.Key(Key.Enter));
            AddUntilStep("Wait for new screen", () => Game.ScreenStack.CurrentScreen is PlayerLoader);

            AddStep("try to perform", () => Game.PerformFromScreen(_ => actionPerformed = true));
            AddUntilStep("returned to song select", () => Game.ScreenStack.CurrentScreen is MainMenu);
            AddAssert("did perform", () => actionPerformed);
        }
Example #7
0
        public override void SetUpSteps()
        {
            base.SetUpSteps();

            AddStep("import beatmap", () =>
            {
                importedBeatmap   = ImportBeatmapTest.LoadOszIntoOsu(game, virtualTrack: true).Result;
                importedBeatmapId = importedBeatmap.Beatmaps.First(b => b.RulesetID == 0).OnlineBeatmapID ?? -1;
            });

            AddStep("add streaming client", () =>
            {
                Remove(testSpectatorClient);
                Add(testSpectatorClient);
            });

            finish();
        }
        private void loadToPlayerNonBreakTime()
        {
            Player player = null;

            Screens.Select.SongSelect songSelect = null;
            PushAndConfirm(() => songSelect = new TestSceneScreenNavigation.TestPlaySongSelect());
            AddUntilStep("wait for song select", () => songSelect.BeatmapSetsLoaded);

            AddStep("import beatmap", () => ImportBeatmapTest.LoadOszIntoOsu(Game, virtualTrack: true).Wait());
            AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);
            AddStep("press enter", () => InputManager.Key(Key.Enter));

            AddUntilStep("wait for player", () =>
            {
                // dismiss any notifications that may appear (ie. muted notification).
                clickMouseInCentre();
                return((player = Game.ScreenStack.CurrentScreen as Player) != null);
            });

            AddUntilStep("wait for play time active", () => !player.IsBreakTime.Value);
        }
        public void TestRetryFromResults()
        {
            Player        player  = null;
            ResultsScreen results = null;

            WorkingBeatmap beatmap() => Game.Beatmap.Value;

            PushAndConfirm(() => new TestSongSelect());

            AddStep("import beatmap", () => ImportBeatmapTest.LoadQuickOszIntoOsu(Game).Wait());

            AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);

            AddStep("set autoplay", () => Game.SelectedMods.Value = new[] { new OsuModAutoplay() });

            AddStep("press enter", () => InputManager.Key(Key.Enter));
            AddUntilStep("wait for player", () => (player = Game.ScreenStack.CurrentScreen as Player) != null);
            AddStep("seek to end", () => player.ChildrenOfType <GameplayClockContainer>().First().Seek(beatmap().Track.Length));
            AddUntilStep("wait for pass", () => (results = Game.ScreenStack.CurrentScreen as ResultsScreen) != null && results.IsLoaded);
            AddStep("attempt to retry", () => results.ChildrenOfType <HotkeyRetryOverlay>().First().Action());
            AddUntilStep("wait for player", () => Game.ScreenStack.CurrentScreen != player && Game.ScreenStack.CurrentScreen is Player);
        }
Example #10
0
        public void SetupSteps()
        {
            DependenciesScreen dependenciesScreen = null;

            AddStep("load dependencies", () =>
            {
                spectatorClient = new TestSpectatorClient();

                // The screen gets suspended so it stops receiving updates.
                Child = spectatorClient;

                LoadScreen(dependenciesScreen = new DependenciesScreen(spectatorClient));
            });

            AddUntilStep("wait for dependencies to load", () => dependenciesScreen.IsLoaded);

            AddStep("import beatmap", () =>
            {
                importedBeatmap   = ImportBeatmapTest.LoadOszIntoOsu(game, virtualTrack: true).Result;
                importedBeatmapId = importedBeatmap.Beatmaps.First(b => b.RulesetID == 0).OnlineBeatmapID ?? -1;
            });
        }
Example #11
0
 private void load()
 {
     importedSet       = ImportBeatmapTest.LoadOszIntoOsu(game, virtualTrack: true).Result;
     importedBeatmap   = importedSet.Beatmaps.First(b => b.RulesetID == 0);
     importedBeatmapId = importedBeatmap.OnlineBeatmapID ?? -1;
 }
Example #12
0
 private void load(OsuGameBase osu)
 {
     importedSet = ImportBeatmapTest.LoadQuickOszIntoOsu(osu).Result;
 }
Example #13
0
 private void importAndWaitForSongSelect()
 {
     AddStep("import beatmap", () => ImportBeatmapTest.LoadQuickOszIntoOsu(Game).Wait());
     PushAndConfirm(() => new TestPlaySongSelect());
     AddUntilStep("beatmap updated", () => Game.Beatmap.Value.BeatmapSetInfo.OnlineBeatmapSetID == 241526);
 }
Example #14
0
 public override void SetUpSteps()
 {
     AddStep("import test beatmap", () => importedBeatmapSet = ImportBeatmapTest.LoadOszIntoOsu(game).Result);
     base.SetUpSteps();
 }