Beispiel #1
0
        private Func <Player> playToResults()
        {
            Player player = null;

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

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

            AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely());

            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));
Beispiel #2
0
        public void TestRetryCountIncrements()
        {
            Player player = null;

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

            AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely());

            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);
        }
Beispiel #3
0
        private void advanceToSongSelect()
        {
            PushAndConfirm(() => songSelect = new TestPlaySongSelect());
            AddUntilStep("wait for song select", () => songSelect.BeatmapSetsLoaded);

            AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely());

            AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);
        }
Beispiel #4
0
        public void TestGameplayKeyBindings()
        {
            AddAssert("databased key is default", () => firstOsuRulesetKeyBindings.KeyCombination.Keys.SequenceEqual(new[] { InputKey.Z }));

            AddStep("open settings", () => { Game.Settings.Show(); });

            // Until step requires as settings has a delayed load.
            AddUntilStep("wait for button", () => configureBindingsButton?.Enabled.Value == true);
            AddStep("scroll to section", () => Game.Settings.SectionsContainer.ScrollTo(configureBindingsButton));
            AddStep("press button", () => configureBindingsButton.TriggerClick());
            AddUntilStep("wait for panel", () => keyBindingPanel?.IsLoaded == true);
            AddUntilStep("wait for osu subsection", () => osuBindingSubsection?.IsLoaded == true);
            AddStep("scroll to section", () => keyBindingPanel.SectionsContainer.ScrollTo(osuBindingSubsection));
            AddWaitStep("wait for scroll to end", 3);
            AddStep("start rebinding first osu! key", () =>
            {
                var button = osuBindingSubsection.ChildrenOfType <KeyBindingRow>().First();

                InputManager.MoveMouseTo(button);
                InputManager.Click(MouseButton.Left);
            });

            AddStep("Press 's'", () => InputManager.Key(Key.S));

            AddUntilStep("wait for database updated", () => firstOsuRulesetKeyBindings.KeyCombination.Keys.SequenceEqual(new[] { InputKey.S }));

            AddStep("close settings", () => Game.Settings.Hide());

            AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely());

            PushAndConfirm(() => new PlaySongSelect());

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

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

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

            AddUntilStep("wait for gameplay", () => player?.IsBreakTime.Value == false);

            AddStep("press 'z'", () => InputManager.Key(Key.Z));
            AddAssert("key counter didn't increase", () => keyCounter.CountPresses == 0);

            AddStep("press 's'", () => InputManager.Key(Key.S));
            AddAssert("key counter did increase", () => keyCounter.CountPresses == 1);
        }
        private void switchToGameplayScene()
        {
            AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely());
            AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);

            AddStep("Click gameplay scene button", () =>
            {
                InputManager.MoveMouseTo(skinEditor.ChildrenOfType <SkinEditorSceneLibrary.SceneButton>().First(b => b.Text == "Gameplay"));
                InputManager.Click(MouseButton.Left);
            });

            AddUntilStep("wait for player", () =>
            {
                DismissAnyNotifications();
                return(Game.ScreenStack.CurrentScreen is Player);
            });
        }
 private void importAndWaitForSongSelect()
 {
     AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely());
     PushAndConfirm(() => new TestPlaySongSelect());
     AddUntilStep("beatmap updated", () => Game.Beatmap.Value.BeatmapSetInfo.OnlineID == 241526);
 }
Beispiel #7
0
        public void TestEditComponentDuringGameplay()
        {
            Screens.Select.SongSelect songSelect = null;
            PushAndConfirm(() => songSelect = new TestPlaySongSelect());
            AddUntilStep("wait for song select", () => songSelect.BeatmapSetsLoaded);

            AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely());

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

            SkinEditor skinEditor = null;

            AddStep("open skin editor", () =>
            {
                InputManager.PressKey(Key.ControlLeft);
                InputManager.PressKey(Key.ShiftLeft);
                InputManager.Key(Key.S);
                InputManager.ReleaseKey(Key.ControlLeft);
                InputManager.ReleaseKey(Key.ShiftLeft);
            });

            AddUntilStep("get skin editor", () => (skinEditor = Game.ChildrenOfType <SkinEditor>().FirstOrDefault()) != null);

            AddStep("Click gameplay scene button", () =>
            {
                skinEditor.ChildrenOfType <SkinEditorSceneLibrary.SceneButton>().First(b => b.Text == "Gameplay").TriggerClick();
            });

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

            BarHitErrorMeter hitErrorMeter = null;

            AddUntilStep("select bar hit error blueprint", () =>
            {
                var blueprint = skinEditor.ChildrenOfType <SkinBlueprint>().FirstOrDefault(b => b.Item is BarHitErrorMeter);

                if (blueprint == null)
                {
                    return(false);
                }

                hitErrorMeter = (BarHitErrorMeter)blueprint.Item;
                skinEditor.SelectedComponents.Clear();
                skinEditor.SelectedComponents.Add(blueprint.Item);
                return(true);
            });

            AddAssert("value is default", () => hitErrorMeter.JudgementLineThickness.IsDefault);

            AddStep("hover first slider", () =>
            {
                InputManager.MoveMouseTo(
                    skinEditor.ChildrenOfType <SkinSettingsToolbox>().First()
                    .ChildrenOfType <SettingsSlider <float> >().First()
                    .ChildrenOfType <SliderBar <float> >().First()
                    );
            });

            AddStep("adjust slider via keyboard", () => InputManager.Key(Key.Left));

            AddAssert("value is less than default", () => hitErrorMeter.JudgementLineThickness.Value < hitErrorMeter.JudgementLineThickness.Default);
        }
Beispiel #8
0
 private void load(OsuGameBase osu)
 {
     importedSet = BeatmapImportHelper.LoadQuickOszIntoOsu(osu).GetResultSafely();
 }