-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reimplement missing gameplay test hotkeys from stable #28705
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
1e4db77
Implement autoplay toggle for editor test play
bdach e28befb
Implement quick pause toggle for editor test play
bdach d85c467
Implement quick exit hotkeys for editor test play
bdach 3d61a21
Add test coverage
bdach 29c3ff0
Enable NRT in `RulesetInputManager`
bdach 7f1d113
Add failing test coverage for replay detach
bdach 294aa09
Clear pressed keys and last replay frame when detaching replay from r…
bdach 84c7d34
Fix user-pressed keys remaining pressed whtn autoplay is turned on
bdach e73faae
Merge branch 'master' into editor-test-play
bdach 0ab13e4
Use alternative method of releasing user-pressed keys when activating…
bdach 371ca4c
Remove unnecessary null-conditional operators
frenzibyte e4f9071
Update test to match new behaviour
frenzibyte File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
osu.Game.Rulesets.Catch.Tests/TestSceneCatchReplayHandling.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,36 @@ | ||
// 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.Rulesets.Catch.Beatmaps; | ||
using osu.Game.Rulesets.Catch.UI; | ||
using osu.Game.Scoring; | ||
using osu.Game.Tests.Visual; | ||
using osuTK.Input; | ||
|
||
namespace osu.Game.Rulesets.Catch.Tests | ||
{ | ||
public partial class TestSceneCatchReplayHandling : OsuManualInputManagerTestScene | ||
{ | ||
[Test] | ||
public void TestReplayDetach() | ||
{ | ||
DrawableCatchRuleset drawableRuleset = null!; | ||
float catcherPosition = 0; | ||
|
||
AddStep("create drawable ruleset", () => Child = drawableRuleset = new DrawableCatchRuleset(new CatchRuleset(), new CatchBeatmap(), [])); | ||
AddStep("attach replay", () => drawableRuleset.SetReplayScore(new Score())); | ||
AddStep("store catcher position", () => catcherPosition = drawableRuleset.ChildrenOfType<Catcher>().Single().X); | ||
AddStep("hold down left", () => InputManager.PressKey(Key.Left)); | ||
AddAssert("catcher didn't move", () => drawableRuleset.ChildrenOfType<Catcher>().Single().X, () => Is.EqualTo(catcherPosition)); | ||
AddStep("release left", () => InputManager.ReleaseKey(Key.Left)); | ||
|
||
AddStep("detach replay", () => drawableRuleset.SetReplayScore(null)); | ||
AddStep("hold down left", () => InputManager.PressKey(Key.Left)); | ||
AddUntilStep("catcher moved", () => drawableRuleset.ChildrenOfType<Catcher>().Single().X, () => Is.Not.EqualTo(catcherPosition)); | ||
AddStep("release left", () => InputManager.ReleaseKey(Key.Left)); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ public GlobalActionContainer(OsuGameBase? game) | |
/// </remarks> | ||
public override IEnumerable<IKeyBinding> DefaultKeyBindings => globalKeyBindings | ||
.Concat(editorKeyBindings) | ||
.Concat(editorTestPlayKeyBindings) | ||
.Concat(inGameKeyBindings) | ||
.Concat(replayKeyBindings) | ||
.Concat(songSelectKeyBindings) | ||
|
@@ -68,6 +69,9 @@ public static IEnumerable<KeyBinding> GetDefaultBindingsFor(GlobalActionCategory | |
case GlobalActionCategory.Overlays: | ||
return overlayKeyBindings; | ||
|
||
case GlobalActionCategory.EditorTestPlay: | ||
return editorTestPlayKeyBindings; | ||
|
||
default: | ||
throw new ArgumentOutOfRangeException(nameof(category), category, $"Unexpected {nameof(GlobalActionCategory)}"); | ||
} | ||
|
@@ -100,7 +104,6 @@ public static IEnumerable<GlobalAction> GetGlobalActionsFor(GlobalActionCategory | |
new KeyBinding(new[] { InputKey.Control, InputKey.Shift, InputKey.F }, GlobalAction.ToggleFPSDisplay), | ||
new KeyBinding(new[] { InputKey.Control, InputKey.T }, GlobalAction.ToggleToolbar), | ||
new KeyBinding(new[] { InputKey.Control, InputKey.Shift, InputKey.S }, GlobalAction.ToggleSkinEditor), | ||
new KeyBinding(new[] { InputKey.Control, InputKey.P }, GlobalAction.ToggleProfile), | ||
|
||
new KeyBinding(new[] { InputKey.Control, InputKey.Alt, InputKey.R }, GlobalAction.ResetInputSettings), | ||
|
||
|
@@ -118,6 +121,7 @@ public static IEnumerable<GlobalAction> GetGlobalActionsFor(GlobalActionCategory | |
new KeyBinding(new[] { InputKey.Control, InputKey.B }, GlobalAction.ToggleBeatmapListing), | ||
new KeyBinding(new[] { InputKey.Control, InputKey.O }, GlobalAction.ToggleSettings), | ||
new KeyBinding(new[] { InputKey.Control, InputKey.N }, GlobalAction.ToggleNotifications), | ||
new KeyBinding(new[] { InputKey.Control, InputKey.P }, GlobalAction.ToggleProfile), | ||
}; | ||
|
||
private static IEnumerable<KeyBinding> editorKeyBindings => new[] | ||
|
@@ -145,6 +149,14 @@ public static IEnumerable<GlobalAction> GetGlobalActionsFor(GlobalActionCategory | |
new KeyBinding(new[] { InputKey.Control, InputKey.E }, GlobalAction.EditorToggleScaleControl), | ||
}; | ||
|
||
private static IEnumerable<KeyBinding> editorTestPlayKeyBindings => new[] | ||
{ | ||
new KeyBinding(new[] { InputKey.Tab }, GlobalAction.EditorTestPlayToggleAutoplay), | ||
new KeyBinding(new[] { InputKey.Control, InputKey.P }, GlobalAction.EditorTestPlayToggleQuickPause), | ||
new KeyBinding(new[] { InputKey.F1 }, GlobalAction.EditorTestPlayQuickExitToInitialTime), | ||
new KeyBinding(new[] { InputKey.F2 }, GlobalAction.EditorTestPlayQuickExitToCurrentTime), | ||
}; | ||
|
||
private static IEnumerable<KeyBinding> inGameKeyBindings => new[] | ||
{ | ||
new KeyBinding(InputKey.Space, GlobalAction.SkipCutscene), | ||
|
@@ -432,6 +444,18 @@ public enum GlobalAction | |
|
||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorToggleScaleControl))] | ||
EditorToggleScaleControl, | ||
|
||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorTestPlayToggleAutoplay))] | ||
EditorTestPlayToggleAutoplay, | ||
|
||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorTestPlayToggleQuickPause))] | ||
EditorTestPlayToggleQuickPause, | ||
|
||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorTestPlayQuickExitToInitialTime))] | ||
EditorTestPlayQuickExitToInitialTime, | ||
|
||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorTestPlayQuickExitToCurrentTime))] | ||
EditorTestPlayQuickExitToCurrentTime, | ||
} | ||
|
||
public enum GlobalActionCategory | ||
|
@@ -442,6 +466,7 @@ public enum GlobalActionCategory | |
Replay, | ||
SongSelect, | ||
AudioControl, | ||
Overlays | ||
Overlays, | ||
EditorTestPlay, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These getting a separate section will likely look gratuitous but it bypasses several issues:
|
||
} | ||
} |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is moved/deprioritised to the overlay toggle section because in its previous place it was blocking the quick pause hotkey.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checks out since it's an overlay toggle key binding in itself.