mirror of
https://github.com/ppy/osu.git
synced 2025-01-30 00:53:10 +08:00
Merge pull request #21266 from peppy/editor-test-play-dont-retain-test-time
When returning to the editor after test play, use the original editor time rather than the point of exit
This commit is contained in:
commit
8bde669de1
@ -178,7 +178,7 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestSharedClockState()
|
public void TestClockTimeTransferIsOneDirectional()
|
||||||
{
|
{
|
||||||
AddStep("seek to 00:01:00", () => EditorClock.Seek(60_000));
|
AddStep("seek to 00:01:00", () => EditorClock.Seek(60_000));
|
||||||
AddStep("click test gameplay button", () =>
|
AddStep("click test gameplay button", () =>
|
||||||
@ -195,15 +195,15 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
GameplayClockContainer gameplayClockContainer = null;
|
GameplayClockContainer gameplayClockContainer = null;
|
||||||
AddStep("fetch gameplay clock", () => gameplayClockContainer = editorPlayer.ChildrenOfType<GameplayClockContainer>().First());
|
AddStep("fetch gameplay clock", () => gameplayClockContainer = editorPlayer.ChildrenOfType<GameplayClockContainer>().First());
|
||||||
AddUntilStep("gameplay clock running", () => gameplayClockContainer.IsRunning);
|
AddUntilStep("gameplay clock running", () => gameplayClockContainer.IsRunning);
|
||||||
|
// when the gameplay test is entered, the clock is expected to continue from where it was in the main editor...
|
||||||
AddAssert("gameplay time past 00:01:00", () => gameplayClockContainer.CurrentTime >= 60_000);
|
AddAssert("gameplay time past 00:01:00", () => gameplayClockContainer.CurrentTime >= 60_000);
|
||||||
|
|
||||||
double timeAtPlayerExit = 0;
|
|
||||||
AddWaitStep("wait some", 5);
|
AddWaitStep("wait some", 5);
|
||||||
AddStep("store time before exit", () => timeAtPlayerExit = gameplayClockContainer.CurrentTime);
|
|
||||||
|
|
||||||
AddStep("exit player", () => editorPlayer.Exit());
|
AddStep("exit player", () => editorPlayer.Exit());
|
||||||
AddUntilStep("current screen is editor", () => Stack.CurrentScreen is Editor);
|
AddUntilStep("current screen is editor", () => Stack.CurrentScreen is Editor);
|
||||||
AddAssert("time is past player exit", () => EditorClock.CurrentTime >= timeAtPlayerExit);
|
// but when exiting from gameplay test back to editor, the expectation is that the editor time should revert to what it was at the point of initiating the gameplay test.
|
||||||
|
AddAssert("time reverted to 00:01:00", () => EditorClock.CurrentTime, () => Is.EqualTo(60_000));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void TearDownSteps()
|
public override void TearDownSteps()
|
||||||
|
@ -74,7 +74,6 @@ namespace osu.Game.Screens.Edit.GameplayTest
|
|||||||
{
|
{
|
||||||
musicController.Stop();
|
musicController.Stop();
|
||||||
|
|
||||||
editorState.Time = GameplayClockContainer.CurrentTime;
|
|
||||||
editor.RestoreState(editorState);
|
editor.RestoreState(editorState);
|
||||||
return base.OnExiting(e);
|
return base.OnExiting(e);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user