mirror of
https://github.com/ppy/osu.git
synced 2025-02-14 02:43:02 +08:00
Split up assertions
This commit is contained in:
parent
449bee98cc
commit
28994166bc
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
@ -44,6 +45,8 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
}).ToArray();
|
}).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Slider SelectedSlider => (Slider)EditorBeatmap.SelectedHitObjects[0];
|
||||||
|
|
||||||
[TestCase(0, 250)]
|
[TestCase(0, 250)]
|
||||||
[TestCase(0, 200)]
|
[TestCase(0, 200)]
|
||||||
[TestCase(1, 80)]
|
[TestCase(1, 80)]
|
||||||
@ -87,13 +90,14 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
InputManager.ReleaseKey(Key.LControl);
|
InputManager.ReleaseKey(Key.LControl);
|
||||||
});
|
});
|
||||||
|
|
||||||
AddAssert("Slider was reversed correctly", () =>
|
AddAssert("Slider has correct length", () =>
|
||||||
{
|
Precision.AlmostEquals(SelectedSlider.Path.Distance, oldDistance));
|
||||||
var slider = (Slider)EditorBeatmap.SelectedHitObjects[0];
|
|
||||||
return Vector2.Distance(slider.Position, oldEndPos) < 1
|
AddAssert("Slider has correct start position", () =>
|
||||||
&& Vector2.Distance(slider.EndPosition, oldStartPos) < 1
|
Vector2.Distance(SelectedSlider.Position, oldEndPos) < 1);
|
||||||
&& Math.Abs(slider.Path.Distance - oldDistance) < 1e-10;
|
|
||||||
});
|
AddAssert("Slider has correct end position", () =>
|
||||||
|
Vector2.Distance(SelectedSlider.EndPosition, oldStartPos) < 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user