mirror of
https://github.com/osukey/osukey.git
synced 2025-06-08 21:07:59 +09:00
Add coverage for spinning in both directions
This commit is contained in:
parent
37ecab3f2f
commit
31a1f8b9a7
@ -15,6 +15,11 @@ using osuTK;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Replays;
|
||||||
|
using osu.Game.Rulesets.Osu.Replays;
|
||||||
|
using osu.Game.Rulesets.Osu.UI;
|
||||||
|
using osu.Game.Rulesets.Replays;
|
||||||
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Storyboards;
|
using osu.Game.Storyboards;
|
||||||
using static osu.Game.Tests.Visual.OsuTestScene.ClockBackedTestWorkingBeatmap;
|
using static osu.Game.Tests.Visual.OsuTestScene.ClockBackedTestWorkingBeatmap;
|
||||||
|
|
||||||
@ -86,6 +91,44 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
() => Precision.AlmostEquals(drawableSpinner.Disc.RotationAbsolute, finalAbsoluteDiscRotation, 100));
|
() => Precision.AlmostEquals(drawableSpinner.Disc.RotationAbsolute, finalAbsoluteDiscRotation, 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestRotationDirection([Values(true, false)] bool clockwise)
|
||||||
|
{
|
||||||
|
if (clockwise)
|
||||||
|
{
|
||||||
|
AddStep("flip replay", () =>
|
||||||
|
{
|
||||||
|
var drawableRuleset = this.ChildrenOfType<DrawableOsuRuleset>().Single();
|
||||||
|
var score = drawableRuleset.ReplayScore;
|
||||||
|
var scoreWithFlippedReplay = new Score
|
||||||
|
{
|
||||||
|
ScoreInfo = score.ScoreInfo,
|
||||||
|
Replay = flipReplay(score.Replay)
|
||||||
|
};
|
||||||
|
drawableRuleset.SetReplayScore(scoreWithFlippedReplay);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
addSeekStep(5000);
|
||||||
|
|
||||||
|
AddAssert("disc spin direction correct", () => clockwise ? drawableSpinner.Disc.Rotation > 0 : drawableSpinner.Disc.Rotation < 0);
|
||||||
|
AddAssert("spinner symbol direction correct", () => clockwise ? spinnerSymbol.Rotation > 0 : spinnerSymbol.Rotation < 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Replay flipReplay(Replay scoreReplay) => new Replay
|
||||||
|
{
|
||||||
|
Frames = scoreReplay
|
||||||
|
.Frames
|
||||||
|
.Cast<OsuReplayFrame>()
|
||||||
|
.Select(replayFrame =>
|
||||||
|
{
|
||||||
|
var flippedPosition = new Vector2(OsuPlayfield.BASE_SIZE.X - replayFrame.Position.X, replayFrame.Position.Y);
|
||||||
|
return new OsuReplayFrame(replayFrame.Time, flippedPosition, replayFrame.Actions.ToArray());
|
||||||
|
})
|
||||||
|
.Cast<ReplayFrame>()
|
||||||
|
.ToList()
|
||||||
|
};
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestSpinPerMinuteOnRewind()
|
public void TestSpinPerMinuteOnRewind()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user