-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26411 from zacwm/disable-intro-track-pause
Disable pausing music during intro sequence
- Loading branch information
Showing
4 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
osu.Game.Tests/Visual/Menus/TestSceneIntroMusicActionHandling.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Linq; | ||
using NUnit.Framework; | ||
using osu.Framework.Testing; | ||
using osu.Game.Input.Bindings; | ||
using osu.Game.Screens.Menu; | ||
|
||
namespace osu.Game.Tests.Visual.Menus | ||
{ | ||
public partial class TestSceneIntroMusicActionHandling : OsuGameTestScene | ||
{ | ||
private GlobalActionContainer globalActionContainer => Game.ChildrenOfType<GlobalActionContainer>().First(); | ||
|
||
public override void SetUpSteps() | ||
{ | ||
CreateNewGame(); | ||
// we do not want to progress to main menu immediately, hence the override and lack of `ConfirmAtMainMenu()` call here. | ||
} | ||
|
||
[Test] | ||
public void TestPauseDuringIntro() | ||
{ | ||
AddUntilStep("Wait for music", () => Game?.MusicController.IsPlaying == true); | ||
|
||
// Check that pause doesn't work during intro sequence. | ||
AddStep("Toggle playback", () => globalActionContainer.TriggerPressed(GlobalAction.MusicPlay)); | ||
AddAssert("Still playing before menu", () => Game?.MusicController.IsPlaying == true); | ||
AddUntilStep("Wait for main menu", () => Game?.ScreenStack.CurrentScreen is MainMenu menu && menu.IsLoaded); | ||
|
||
// Check that toggling after intro still works. | ||
AddStep("Toggle playback", () => globalActionContainer.TriggerPressed(GlobalAction.MusicPlay)); | ||
AddUntilStep("Music paused", () => Game?.MusicController.IsPlaying == false && Game?.MusicController.UserPauseRequested == true); | ||
AddStep("Toggle playback", () => globalActionContainer.TriggerPressed(GlobalAction.MusicPlay)); | ||
AddUntilStep("Music resumed", () => Game?.MusicController.IsPlaying == true && Game?.MusicController.UserPauseRequested == false); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters