mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 16:02:55 +08:00
Fix test failures
This commit is contained in:
parent
d31a59b074
commit
0bc3073d49
@ -42,6 +42,7 @@ namespace osu.Game.Rulesets.Mania.Tests
|
|||||||
public void TestDragOffscreenSelectionVerticallyUpScroll()
|
public void TestDragOffscreenSelectionVerticallyUpScroll()
|
||||||
{
|
{
|
||||||
DrawableHitObject lastObject = null;
|
DrawableHitObject lastObject = null;
|
||||||
|
double originalTime = 0;
|
||||||
Vector2 originalPosition = Vector2.Zero;
|
Vector2 originalPosition = Vector2.Zero;
|
||||||
|
|
||||||
setScrollStep(ScrollingDirection.Up);
|
setScrollStep(ScrollingDirection.Up);
|
||||||
@ -49,6 +50,7 @@ namespace osu.Game.Rulesets.Mania.Tests
|
|||||||
AddStep("seek to last object", () =>
|
AddStep("seek to last object", () =>
|
||||||
{
|
{
|
||||||
lastObject = this.ChildrenOfType<DrawableHitObject>().Single(d => d.HitObject == composer.EditorBeatmap.HitObjects.Last());
|
lastObject = this.ChildrenOfType<DrawableHitObject>().Single(d => d.HitObject == composer.EditorBeatmap.HitObjects.Last());
|
||||||
|
originalTime = lastObject.HitObject.StartTime;
|
||||||
Clock.Seek(composer.EditorBeatmap.HitObjects.Last().StartTime);
|
Clock.Seek(composer.EditorBeatmap.HitObjects.Last().StartTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -64,19 +66,20 @@ namespace osu.Game.Rulesets.Mania.Tests
|
|||||||
|
|
||||||
AddStep("move mouse downwards", () =>
|
AddStep("move mouse downwards", () =>
|
||||||
{
|
{
|
||||||
InputManager.MoveMouseTo(lastObject, new Vector2(0, 20));
|
InputManager.MoveMouseTo(lastObject, new Vector2(0, lastObject.ScreenSpaceDrawQuad.Height * 2));
|
||||||
InputManager.ReleaseButton(MouseButton.Left);
|
InputManager.ReleaseButton(MouseButton.Left);
|
||||||
});
|
});
|
||||||
|
|
||||||
AddAssert("hitobjects not moved columns", () => composer.EditorBeatmap.HitObjects.All(h => ((ManiaHitObject)h).Column == 0));
|
AddAssert("hitobjects not moved columns", () => composer.EditorBeatmap.HitObjects.All(h => ((ManiaHitObject)h).Column == 0));
|
||||||
AddAssert("hitobjects moved downwards", () => lastObject.DrawPosition.Y - originalPosition.Y > 0);
|
AddAssert("hitobjects moved downwards", () => lastObject.DrawPosition.Y - originalPosition.Y > 0);
|
||||||
AddAssert("hitobjects not moved too far", () => lastObject.DrawPosition.Y - originalPosition.Y < 50);
|
AddAssert("hitobject has moved time", () => lastObject.HitObject.StartTime == originalTime + 125);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestDragOffscreenSelectionVerticallyDownScroll()
|
public void TestDragOffscreenSelectionVerticallyDownScroll()
|
||||||
{
|
{
|
||||||
DrawableHitObject lastObject = null;
|
DrawableHitObject lastObject = null;
|
||||||
|
double originalTime = 0;
|
||||||
Vector2 originalPosition = Vector2.Zero;
|
Vector2 originalPosition = Vector2.Zero;
|
||||||
|
|
||||||
setScrollStep(ScrollingDirection.Down);
|
setScrollStep(ScrollingDirection.Down);
|
||||||
@ -84,6 +87,7 @@ namespace osu.Game.Rulesets.Mania.Tests
|
|||||||
AddStep("seek to last object", () =>
|
AddStep("seek to last object", () =>
|
||||||
{
|
{
|
||||||
lastObject = this.ChildrenOfType<DrawableHitObject>().Single(d => d.HitObject == composer.EditorBeatmap.HitObjects.Last());
|
lastObject = this.ChildrenOfType<DrawableHitObject>().Single(d => d.HitObject == composer.EditorBeatmap.HitObjects.Last());
|
||||||
|
originalTime = lastObject.HitObject.StartTime;
|
||||||
Clock.Seek(composer.EditorBeatmap.HitObjects.Last().StartTime);
|
Clock.Seek(composer.EditorBeatmap.HitObjects.Last().StartTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -99,13 +103,13 @@ namespace osu.Game.Rulesets.Mania.Tests
|
|||||||
|
|
||||||
AddStep("move mouse upwards", () =>
|
AddStep("move mouse upwards", () =>
|
||||||
{
|
{
|
||||||
InputManager.MoveMouseTo(lastObject, new Vector2(0, -20));
|
InputManager.MoveMouseTo(lastObject, new Vector2(0, -lastObject.ScreenSpaceDrawQuad.Height * 2));
|
||||||
InputManager.ReleaseButton(MouseButton.Left);
|
InputManager.ReleaseButton(MouseButton.Left);
|
||||||
});
|
});
|
||||||
|
|
||||||
AddAssert("hitobjects not moved columns", () => composer.EditorBeatmap.HitObjects.All(h => ((ManiaHitObject)h).Column == 0));
|
AddAssert("hitobjects not moved columns", () => composer.EditorBeatmap.HitObjects.All(h => ((ManiaHitObject)h).Column == 0));
|
||||||
AddAssert("hitobjects moved upwards", () => originalPosition.Y - lastObject.DrawPosition.Y > 0);
|
AddAssert("hitobjects moved upwards", () => originalPosition.Y - lastObject.DrawPosition.Y > 0);
|
||||||
AddAssert("hitobjects not moved too far", () => originalPosition.Y - lastObject.DrawPosition.Y < 50);
|
AddAssert("hitobject has moved time", () => lastObject.HitObject.StartTime == originalTime + 125);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -207,7 +211,7 @@ namespace osu.Game.Rulesets.Mania.Tests
|
|||||||
};
|
};
|
||||||
|
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
EditorBeatmap.Add(new Note { StartTime = 100 * i });
|
EditorBeatmap.Add(new Note { StartTime = 125 * i });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
|
|
||||||
foreach (var grid in grids)
|
foreach (var grid in grids)
|
||||||
{
|
{
|
||||||
foreach (var line in grid.AliveObjects.OfType<DrawableGridLine>())
|
foreach (var line in grid.Objects.OfType<DrawableGridLine>())
|
||||||
{
|
{
|
||||||
Vector2 linePos = line.ToSpaceOfOtherDrawable(line.OriginPosition, this);
|
Vector2 linePos = line.ToSpaceOfOtherDrawable(line.OriginPosition, this);
|
||||||
float d = Vector2.Distance(position, linePos);
|
float d = Vector2.Distance(position, linePos);
|
||||||
|
Loading…
Reference in New Issue
Block a user