-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29446 from OliBomby/last-anchor
Fix path control points losing curve type on save/reload or undo
- Loading branch information
Showing
3 changed files
with
59 additions
and
6 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderChangeStates.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Linq; | ||
using NUnit.Framework; | ||
using osu.Game.Beatmaps; | ||
using osu.Game.Rulesets.Objects; | ||
using osu.Game.Rulesets.Objects.Types; | ||
using osu.Game.Rulesets.Osu.Objects; | ||
using osu.Game.Tests.Beatmaps; | ||
using osuTK; | ||
|
||
namespace osu.Game.Rulesets.Osu.Tests.Editor | ||
{ | ||
public partial class TestSceneSliderChangeStates : TestSceneOsuEditor | ||
{ | ||
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new TestBeatmap(ruleset, false); | ||
|
||
[TestCase(SplineType.Catmull)] | ||
[TestCase(SplineType.BSpline)] | ||
[TestCase(SplineType.Linear)] | ||
[TestCase(SplineType.PerfectCurve)] | ||
public void TestSliderRetainsCurveTypes(SplineType splineType) | ||
{ | ||
Slider? slider = null; | ||
PathType pathType = new PathType(splineType); | ||
|
||
AddStep("add slider", () => EditorBeatmap.Add(slider = new Slider | ||
{ | ||
StartTime = 500, | ||
Path = new SliderPath(new[] | ||
{ | ||
new PathControlPoint(Vector2.Zero, pathType), | ||
new PathControlPoint(new Vector2(200, 0), pathType), | ||
}) | ||
})); | ||
AddAssert("slider has correct spline type", () => ((Slider)EditorBeatmap.HitObjects[0]).Path.ControlPoints.All(p => p.Type == pathType)); | ||
AddStep("remove object", () => EditorBeatmap.Remove(slider)); | ||
AddAssert("slider removed", () => EditorBeatmap.HitObjects.Count == 0); | ||
addUndoSteps(); | ||
AddAssert("slider not removed", () => EditorBeatmap.HitObjects.Count == 1); | ||
AddAssert("slider has correct spline type", () => ((Slider)EditorBeatmap.HitObjects[0]).Path.ControlPoints.All(p => p.Type == pathType)); | ||
} | ||
|
||
private void addUndoSteps() => AddStep("undo", () => Editor.Undo()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters