forked from ppy/osu
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into convert-path-string-new
- Loading branch information
Showing
58 changed files
with
340 additions
and
338 deletions.
There are no files selected for viewing
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
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
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 |
---|---|---|
@@ -1,9 +1,6 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using System; | ||
using System.Linq; | ||
using NUnit.Framework; | ||
using osu.Framework.Allocation; | ||
|
@@ -21,10 +18,12 @@ namespace osu.Game.Tests.Visual.Gameplay | |
[Description("player pause/fail screens")] | ||
public partial class TestSceneGameplayMenuOverlay : OsuManualInputManagerTestScene | ||
{ | ||
private FailOverlay failOverlay; | ||
private PauseOverlay pauseOverlay; | ||
private FailOverlay failOverlay = null!; | ||
private PauseOverlay pauseOverlay = null!; | ||
|
||
private GlobalActionContainer globalActionContainer = null!; | ||
|
||
private GlobalActionContainer globalActionContainer; | ||
private bool triggeredRetryButton; | ||
|
||
[BackgroundDependencyLoader] | ||
private void load(OsuGameBase game) | ||
|
@@ -35,12 +34,18 @@ private void load(OsuGameBase game) | |
[SetUp] | ||
public void SetUp() => Schedule(() => | ||
{ | ||
triggeredRetryButton = false; | ||
|
||
globalActionContainer.Children = new Drawable[] | ||
{ | ||
pauseOverlay = new PauseOverlay | ||
{ | ||
OnResume = () => Logger.Log(@"Resume"), | ||
OnRetry = () => Logger.Log(@"Retry"), | ||
OnRetry = () => | ||
{ | ||
Logger.Log(@"Retry"); | ||
triggeredRetryButton = true; | ||
}, | ||
OnQuit = () => Logger.Log(@"Quit"), | ||
}, | ||
failOverlay = new FailOverlay | ||
|
@@ -224,17 +229,9 @@ public void TestClickSelection() | |
{ | ||
showOverlay(); | ||
|
||
bool triggered = false; | ||
AddStep("Click retry button", () => | ||
{ | ||
var lastAction = pauseOverlay.OnRetry; | ||
pauseOverlay.OnRetry = () => triggered = true; | ||
|
||
getButton(1).TriggerClick(); | ||
pauseOverlay.OnRetry = lastAction; | ||
}); | ||
AddStep("Click retry button", () => getButton(1).TriggerClick()); | ||
|
||
AddAssert("Action was triggered", () => triggered); | ||
AddAssert("Retry was triggered", () => triggeredRetryButton); | ||
AddAssert("Overlay is closed", () => pauseOverlay.State.Value == Visibility.Hidden); | ||
} | ||
|
||
|
@@ -252,25 +249,9 @@ public void TestEnterKeySelection() | |
InputManager.Key(Key.Down); | ||
}); | ||
|
||
bool triggered = false; | ||
Action lastAction = null; | ||
AddStep("Press enter", () => | ||
{ | ||
lastAction = pauseOverlay.OnRetry; | ||
pauseOverlay.OnRetry = () => triggered = true; | ||
InputManager.Key(Key.Enter); | ||
}); | ||
AddStep("Press enter", () => InputManager.Key(Key.Enter)); | ||
|
||
AddAssert("Action was triggered", () => | ||
{ | ||
if (lastAction != null) | ||
{ | ||
pauseOverlay.OnRetry = lastAction; | ||
lastAction = null; | ||
} | ||
|
||
return triggered; | ||
}); | ||
AddAssert("Retry was triggered", () => triggeredRetryButton); | ||
AddAssert("Overlay is closed", () => pauseOverlay.State.Value == Visibility.Hidden); | ||
} | ||
|
||
|
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 |
---|---|---|
@@ -1,8 +1,6 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using System.Linq; | ||
using NUnit.Framework; | ||
using osu.Framework.Allocation; | ||
|
@@ -12,6 +10,7 @@ | |
using osu.Framework.Testing; | ||
using osu.Game.Beatmaps; | ||
using osu.Game.Database; | ||
using osu.Game.Localisation; | ||
using osu.Game.Online.API.Requests.Responses; | ||
using osu.Game.Online.Spectator; | ||
using osu.Game.Rulesets.Osu; | ||
|
@@ -39,13 +38,13 @@ public partial class TestSceneSpectator : ScreenTestScene | |
protected override bool UseOnlineAPI => true; | ||
|
||
[Resolved] | ||
private OsuGameBase game { get; set; } | ||
private OsuGameBase game { get; set; } = null!; | ||
|
||
private TestSpectatorClient spectatorClient => dependenciesScreen.SpectatorClient; | ||
private DependenciesScreen dependenciesScreen; | ||
private SoloSpectatorScreen spectatorScreen; | ||
private DependenciesScreen dependenciesScreen = null!; | ||
private SoloSpectatorScreen spectatorScreen = null!; | ||
|
||
private BeatmapSetInfo importedBeatmap; | ||
private BeatmapSetInfo importedBeatmap = null!; | ||
private int importedBeatmapId; | ||
|
||
[SetUpSteps] | ||
|
@@ -188,7 +187,7 @@ public void TestHostRetriesWhileWatching() | |
|
||
waitForPlayerCurrent(); | ||
|
||
Player lastPlayer = null; | ||
Player lastPlayer = null!; | ||
AddStep("store first player", () => lastPlayer = player); | ||
|
||
start(); | ||
|
@@ -214,6 +213,11 @@ public void TestHostFails() | |
checkPaused(false); // Should continue playing until out of frames | ||
checkPaused(true); // And eventually stop after running out of frames and fail. | ||
// Todo: Should check for + display a failed message. | ||
|
||
AddAssert("fail overlay present", () => player.ChildrenOfType<FailOverlay>().Single().IsPresent); | ||
AddAssert("overlay can only quit", () => player.ChildrenOfType<FailOverlay>().Single().Buttons.Single().Text == GameplayMenuOverlayStrings.Quit); | ||
AddStep("press quit button", () => player.ChildrenOfType<FailOverlay>().Single().Buttons.Single().TriggerClick()); | ||
AddAssert("player exited", () => Stack.CurrentScreen is SoloSpectatorScreen); | ||
} | ||
|
||
[Test] | ||
|
@@ -278,7 +282,7 @@ public void TestFinalFramesPurgedBeforeEndingPlay() | |
[Test] | ||
public void TestFinalFrameInBundleHasHeader() | ||
{ | ||
FrameDataBundle lastBundle = null; | ||
FrameDataBundle? lastBundle = null; | ||
|
||
AddStep("bind to client", () => spectatorClient.OnNewFrames += (_, bundle) => lastBundle = bundle); | ||
|
||
|
@@ -287,8 +291,8 @@ public void TestFinalFrameInBundleHasHeader() | |
finish(); | ||
|
||
AddUntilStep("bundle received", () => lastBundle != null); | ||
AddAssert("first frame does not have header", () => lastBundle.Frames[0].Header == null); | ||
AddAssert("last frame has header", () => lastBundle.Frames[^1].Header != null); | ||
AddAssert("first frame does not have header", () => lastBundle?.Frames[0].Header == null); | ||
AddAssert("last frame has header", () => lastBundle?.Frames[^1].Header != null); | ||
} | ||
|
||
[Test] | ||
|
@@ -383,7 +387,7 @@ public void TestFailedStateDuringLoading() | |
} | ||
|
||
private OsuFramedReplayInputHandler replayHandler => | ||
(OsuFramedReplayInputHandler)Stack.ChildrenOfType<OsuInputManager>().First().ReplayInputHandler; | ||
(OsuFramedReplayInputHandler)Stack.ChildrenOfType<OsuInputManager>().First().ReplayInputHandler!; | ||
|
||
private Player player => this.ChildrenOfType<Player>().Single(); | ||
|
||
|
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.