Add failing test case

This commit is contained in:
Salman Ahmed 2024-01-22 02:07:09 +03:00
parent b588715d21
commit bab14dce31
1 changed files with 35 additions and 4 deletions

View File

@ -32,7 +32,7 @@ public void TestApplyNewSlider()
{
DrawableSlider dho = null;
AddStep("create slider", () => Child = dho = new DrawableSlider(prepareObject(new Slider
AddStep("create slider", () => Child = dho = new DrawableSlider(applyDefaults(new Slider
{
Position = new Vector2(256, 192),
IndexInCurrentCombo = 0,
@ -47,7 +47,7 @@ public void TestApplyNewSlider()
AddWaitStep("wait for progression", 1);
AddStep("apply new slider", () => dho.Apply(prepareObject(new Slider
AddStep("apply new slider", () => dho.Apply(applyDefaults(new Slider
{
Position = new Vector2(256, 192),
ComboIndex = 1,
@ -75,7 +75,7 @@ public void TestBallTintChangedOnAccentChange()
Child = new SkinProvidingContainer(provider)
{
RelativeSizeAxes = Axes.Both,
Child = dho = new DrawableSlider(prepareObject(new Slider
Child = dho = new DrawableSlider(applyDefaults(new Slider
{
Position = new Vector2(256, 192),
IndexInCurrentCombo = 0,
@ -97,7 +97,38 @@ public void TestBallTintChangedOnAccentChange()
AddAssert("ball is red", () => dho.ChildrenOfType<LegacySliderBall>().Single().BallColour == Color4.Red);
}
private Slider prepareObject(Slider slider)
[Test]
public void TestIncreaseRepeatCount()
{
DrawableSlider dho = null;
AddStep("create slider", () =>
{
Child = dho = new DrawableSlider(applyDefaults(new Slider
{
Position = new Vector2(256, 192),
IndexInCurrentCombo = 0,
StartTime = Time.Current,
Path = new SliderPath(PathType.LINEAR, new[]
{
Vector2.Zero,
new Vector2(150, 100),
new Vector2(300, 0),
})
}));
});
AddStep("increase repeat count", () =>
{
dho.HitObject.RepeatCount++;
applyDefaults(dho.HitObject);
});
AddAssert("repeat got custom anchor", () =>
dho.ChildrenOfType<DrawableSliderRepeat>().Single().RelativeAnchorPosition == Vector2.Divide(dho.SliderBody!.PathOffset, dho.DrawSize));
}
private Slider applyDefaults(Slider slider)
{
slider.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
return slider;