mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 08:49:59 +09:00
Ensure editor clock is stopped before testing gameplay
This commit is contained in:
@ -68,6 +68,37 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestGameplayTestWhenTrackRunning()
|
||||||
|
{
|
||||||
|
AddStep("start track", () => EditorClock.Start());
|
||||||
|
AddAssert("sample playback enabled", () => !Editor.SamplePlaybackDisabled.Value);
|
||||||
|
|
||||||
|
AddStep("click test gameplay button", () =>
|
||||||
|
{
|
||||||
|
var button = Editor.ChildrenOfType<TestGameplayButton>().Single();
|
||||||
|
|
||||||
|
InputManager.MoveMouseTo(button);
|
||||||
|
InputManager.Click(MouseButton.Left);
|
||||||
|
});
|
||||||
|
|
||||||
|
EditorPlayer editorPlayer = null;
|
||||||
|
AddUntilStep("player pushed", () => (editorPlayer = Stack.CurrentScreen as EditorPlayer) != null);
|
||||||
|
AddAssert("editor track stopped", () => !EditorClock.IsRunning);
|
||||||
|
AddAssert("sample playback disabled", () => Editor.SamplePlaybackDisabled.Value);
|
||||||
|
|
||||||
|
AddStep("exit player", () => editorPlayer.Exit());
|
||||||
|
AddUntilStep("current screen is editor", () => Stack.CurrentScreen is Editor);
|
||||||
|
AddUntilStep("background has correct params", () =>
|
||||||
|
{
|
||||||
|
var background = this.ChildrenOfType<BackgroundScreenBeatmap>().Single();
|
||||||
|
return background.Colour == Color4.DarkGray && background.BlurAmount.Value == 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("start track", () => EditorClock.Start());
|
||||||
|
AddAssert("sample playback re-enabled", () => !Editor.SamplePlaybackDisabled.Value);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestCancelGameplayTestWithUnsavedChanges()
|
public void TestCancelGameplayTestWithUnsavedChanges()
|
||||||
{
|
{
|
||||||
|
@ -545,9 +545,9 @@ namespace osu.Game.Screens.Edit
|
|||||||
|
|
||||||
public override void OnSuspending(IScreen next)
|
public override void OnSuspending(IScreen next)
|
||||||
{
|
{
|
||||||
refetchBeatmap();
|
|
||||||
|
|
||||||
base.OnSuspending(next);
|
base.OnSuspending(next);
|
||||||
|
clock.Stop();
|
||||||
|
refetchBeatmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refetchBeatmap()
|
private void refetchBeatmap()
|
||||||
|
Reference in New Issue
Block a user