Fix test failures

This commit is contained in:
smoogipoo
2020-04-22 18:14:21 +09:00
parent 9c22d2f1dd
commit e1142b424d
2 changed files with 15 additions and 38 deletions

View File

@ -10,24 +10,22 @@ using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
using osuTK.Input;
namespace osu.Game.Tests.Visual.Editor
{
public class TestSceneEditorChangeStates : ScreenTestScene
{
private EditorBeatmap editorBeatmap;
private TestEditor editor;
public override void SetUpSteps()
{
base.SetUpSteps();
Screens.Edit.Editor editor = null;
AddStep("load editor", () =>
{
Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
LoadScreen(editor = new Screens.Edit.Editor());
LoadScreen(editor = new TestEditor());
});
AddUntilStep("wait for editor to load", () => editor.ChildrenOfType<HitObjectComposer>().FirstOrDefault()?.IsLoaded == true
@ -160,36 +158,15 @@ namespace osu.Game.Tests.Visual.Editor
AddAssert("no hitobject added", () => addedObject == null);
}
private void addUndoSteps()
private void addUndoSteps() => AddStep("undo", () => editor.Undo());
private void addRedoSteps() => AddStep("redo", () => editor.Redo());
private class TestEditor : Screens.Edit.Editor
{
AddStep("press undo", () =>
{
InputManager.PressKey(Key.LControl);
InputManager.PressKey(Key.Z);
});
public new void Undo() => base.Undo();
AddStep("release keys", () =>
{
InputManager.ReleaseKey(Key.LControl);
InputManager.ReleaseKey(Key.Z);
});
}
private void addRedoSteps()
{
AddStep("press redo", () =>
{
InputManager.PressKey(Key.LControl);
InputManager.PressKey(Key.LShift);
InputManager.PressKey(Key.Z);
});
AddStep("release keys", () =>
{
InputManager.ReleaseKey(Key.LControl);
InputManager.ReleaseKey(Key.LShift);
InputManager.ReleaseKey(Key.Z);
});
public new void Redo() => base.Redo();
}
}
}