1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 12:45:09 +08:00

update tests

This commit is contained in:
OliBomby 2024-07-05 14:33:15 +02:00
parent c05f48979b
commit 9013c119ab

View File

@ -332,14 +332,29 @@ namespace osu.Game.Tests.Visual.Editing
});
});
doubleClickNodeSamplePiece(0, 0);
clickNodeSamplePiece(0, 0);
editorTimeIs(0);
doubleClickNodeSamplePiece(0, 1);
clickNodeSamplePiece(0, 1);
editorTimeIs(813);
doubleClickNodeSamplePiece(0, 2);
clickNodeSamplePiece(0, 2);
editorTimeIs(1627);
doubleClickSamplePiece(0);
clickSamplePiece(0);
editorTimeIs(406);
seekSamplePiece(-1);
editorTimeIs(0);
samplePopoverIsOpen();
seekSamplePiece(-1);
editorTimeIs(0);
samplePopoverIsOpen();
seekSamplePiece(1);
editorTimeIs(406);
seekSamplePiece(1);
editorTimeIs(813);
seekSamplePiece(1);
editorTimeIs(1627);
seekSamplePiece(1);
editorTimeIs(1627);
}
[Test]
@ -521,7 +536,7 @@ namespace osu.Game.Tests.Visual.Editing
private void clickSamplePiece(int objectIndex) => AddStep($"click {objectIndex.ToOrdinalWords()} sample piece", () =>
{
var samplePiece = this.ChildrenOfType<SamplePointPiece>().Single(piece => piece.HitObject == EditorBeatmap.HitObjects.ElementAt(objectIndex));
var samplePiece = this.ChildrenOfType<SamplePointPiece>().Single(piece => piece is not NodeSamplePointPiece && piece.HitObject == EditorBeatmap.HitObjects.ElementAt(objectIndex));
InputManager.MoveMouseTo(samplePiece);
InputManager.Click(MouseButton.Left);
@ -535,22 +550,19 @@ namespace osu.Game.Tests.Visual.Editing
InputManager.Click(MouseButton.Left);
});
private void doubleClickSamplePiece(int objectIndex) => AddStep($"double-click {objectIndex.ToOrdinalWords()} sample piece", () =>
private void seekSamplePiece(int direction) => AddStep($"seek sample piece {direction}", () =>
{
var samplePiece = this.ChildrenOfType<SamplePointPiece>().Single(piece => piece is not NodeSamplePointPiece && piece.HitObject == EditorBeatmap.HitObjects.ElementAt(objectIndex));
InputManager.MoveMouseTo(samplePiece);
InputManager.Click(MouseButton.Left);
InputManager.Click(MouseButton.Left);
InputManager.PressKey(Key.ShiftLeft);
InputManager.PressKey(Key.AltLeft);
InputManager.Key(direction < 1 ? Key.Left : Key.Right);
InputManager.ReleaseKey(Key.AltLeft);
InputManager.ReleaseKey(Key.ShiftLeft);
});
private void doubleClickNodeSamplePiece(int objectIndex, int nodeIndex) => AddStep($"double-click {objectIndex.ToOrdinalWords()} object {nodeIndex.ToOrdinalWords()} node sample piece", () =>
private void samplePopoverIsOpen() => AddUntilStep("sample popover is open", () =>
{
var samplePiece = this.ChildrenOfType<NodeSamplePointPiece>().Where(piece => piece.HitObject == EditorBeatmap.HitObjects.ElementAt(objectIndex)).ToArray()[nodeIndex];
InputManager.MoveMouseTo(samplePiece);
InputManager.Click(MouseButton.Left);
InputManager.Click(MouseButton.Left);
var popover = this.ChildrenOfType<SamplePointPiece.SampleEditPopover>().SingleOrDefault(o => o.IsPresent);
return popover != null;
});
private void samplePopoverHasNoFocus() => AddUntilStep("sample popover textbox not focused", () =>