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); }
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));
public void TestSongSelectBackActionHandling() { TestPlaySongSelect songSelect = null; PushAndConfirm(() => songSelect = new TestPlaySongSelect()); AddStep("set filter", () => songSelect.ChildrenOfType <SearchTextBox>().Single().Current.Value = "test"); AddStep("press back", () => InputManager.Click(MouseButton.Button1)); AddAssert("still at song select", () => Game.ScreenStack.CurrentScreen == songSelect); AddAssert("filter cleared", () => string.IsNullOrEmpty(songSelect.ChildrenOfType <SearchTextBox>().Single().Current.Value)); AddStep("set filter again", () => songSelect.ChildrenOfType <SearchTextBox>().Single().Current.Value = "test"); AddStep("open collections dropdown", () => { InputManager.MoveMouseTo(songSelect.ChildrenOfType <CollectionFilterDropdown>().Single()); InputManager.Click(MouseButton.Left); }); AddStep("press back once", () => InputManager.Click(MouseButton.Button1)); AddAssert("still at song select", () => Game.ScreenStack.CurrentScreen == songSelect); AddAssert("collections dropdown closed", () => songSelect .ChildrenOfType <CollectionFilterDropdown>().Single() .ChildrenOfType <Dropdown <CollectionFilterMenuItem> .DropdownMenu>().Single().State == MenuState.Closed); AddStep("press back a second time", () => InputManager.Click(MouseButton.Button1)); AddAssert("filter cleared", () => string.IsNullOrEmpty(songSelect.ChildrenOfType <SearchTextBox>().Single().Current.Value)); AddStep("press back a third time", () => InputManager.Click(MouseButton.Button1)); ConfirmAtMainMenu(); }
public void TestOpenModSelectOverlayUsingAction() { TestPlaySongSelect songSelect = null; PushAndConfirm(() => songSelect = new TestPlaySongSelect()); AddStep("Show mods overlay", () => InputManager.Key(Key.F1)); AddAssert("Overlay was shown", () => songSelect.ModSelectOverlay.State.Value == Visibility.Visible); }
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); }
public void TestExitSongSelectWithEscape() { TestPlaySongSelect songSelect = null; PushAndConfirm(() => songSelect = new TestPlaySongSelect()); AddStep("Show mods overlay", () => songSelect.ModSelectOverlay.Show()); AddAssert("Overlay was shown", () => songSelect.ModSelectOverlay.State.Value == Visibility.Visible); pushEscape(); AddAssert("Overlay was hidden", () => songSelect.ModSelectOverlay.State.Value == Visibility.Hidden); exitViaEscapeAndConfirm(); }
public void TestMenuMakesMusic() { TestPlaySongSelect songSelect = null; PushAndConfirm(() => songSelect = new TestPlaySongSelect()); AddUntilStep("wait for no track", () => Game.MusicController.CurrentTrack.IsDummyDevice); AddStep("return to menu", () => songSelect.Exit()); AddUntilStep("wait for track", () => !Game.MusicController.CurrentTrack.IsDummyDevice && Game.MusicController.IsPlaying); }
public void TestExitSongSelectWithClick() { TestPlaySongSelect songSelect = null; PushAndConfirm(() => songSelect = new TestPlaySongSelect()); AddStep("Show mods overlay", () => songSelect.ModSelectOverlay.Show()); AddAssert("Overlay was shown", () => songSelect.ModSelectOverlay.State.Value == Visibility.Visible); AddStep("Move mouse to backButton", () => InputManager.MoveMouseTo(backButtonPosition)); // BackButton handles hover using its child button, so this checks whether or not any of BackButton's children are hovered. AddUntilStep("Back button is hovered", () => Game.ChildrenOfType <BackButton>().First().Children.Any(c => c.IsHovered)); AddStep("Click back button", () => InputManager.Click(MouseButton.Left)); AddUntilStep("Overlay was hidden", () => songSelect.ModSelectOverlay.State.Value == Visibility.Hidden); exitViaBackButtonAndConfirm(); }
public void TestExitSongSelectWithClick() { TestPlaySongSelect songSelect = null; PushAndConfirm(() => songSelect = new TestPlaySongSelect()); AddStep("Show mods overlay", () => songSelect.ModSelectOverlay.Show()); AddAssert("Overlay was shown", () => songSelect.ModSelectOverlay.State.Value == Visibility.Visible); AddStep("Move mouse to dimmed area", () => InputManager.MoveMouseTo(new Vector2( songSelect.ScreenSpaceDrawQuad.TopLeft.X + 1, songSelect.ScreenSpaceDrawQuad.TopLeft.Y + songSelect.ScreenSpaceDrawQuad.Height / 2))); AddStep("Click left mouse button", () => InputManager.Click(MouseButton.Left)); AddUntilStep("Overlay was hidden", () => songSelect.ModSelectOverlay.State.Value == Visibility.Hidden); exitViaBackButtonAndConfirm(); }
public void TestBeatmapOptionsInput() { TestPlaySongSelect songSelect = null; PushAndConfirm(() => songSelect = new TestPlaySongSelect()); AddStep("Show options overlay", () => songSelect.BeatmapOptionsOverlay.Show()); AddStep("Change ruleset to osu!taiko", () => { InputManager.PressKey(Key.ControlLeft); InputManager.Key(Key.Number2); InputManager.ReleaseKey(Key.ControlLeft); }); AddAssert("Ruleset changed to osu!taiko", () => Game.Toolbar.ChildrenOfType <ToolbarRulesetSelector>().Single().Current.Value.ID == 1); AddAssert("Options overlay still visible", () => songSelect.BeatmapOptionsOverlay.State.Value == Visibility.Visible); }
public void TestModSelectInput() { AddUntilStep("Wait for toolbar to load", () => Game.Toolbar.IsLoaded); TestPlaySongSelect songSelect = null; PushAndConfirm(() => songSelect = new TestPlaySongSelect()); AddStep("Show mods overlay", () => songSelect.ModSelectOverlay.Show()); AddStep("Change ruleset to osu!taiko", () => { InputManager.PressKey(Key.ControlLeft); InputManager.Key(Key.Number2); InputManager.ReleaseKey(Key.ControlLeft); }); AddAssert("Ruleset changed to osu!taiko", () => Game.Toolbar.ChildrenOfType <ToolbarRulesetSelector>().Single().Current.Value.OnlineID == 1); AddAssert("Mods overlay still visible", () => songSelect.ModSelectOverlay.State.Value == Visibility.Visible); }
public void TestSongContinuesAfterExitPlayer(bool withUserPause) { 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.LoadOszIntoOsu(Game, virtualTrack: true).WaitSafely()); 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", () => { // dismiss any notifications that may appear (ie. muted notification). clickMouseInCentre(); return((player = Game.ScreenStack.CurrentScreen as Player) != null); }); AddUntilStep("wait for fail", () => player.GameplayState.HasFailed); AddUntilStep("wait for track stop", () => !Game.MusicController.IsPlaying); AddAssert("Ensure time before preview point", () => Game.MusicController.CurrentTrack.CurrentTime < beatmap().BeatmapInfo.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().BeatmapInfo.Metadata.PreviewTime); }
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); }
private void advanceToSongSelect() { PushAndConfirm(() => songSelect = new TestPlaySongSelect()); AddUntilStep("wait for song select", () => songSelect.BeatmapSetsLoaded); }