Skip to content

Commit 01d1033

Browse files
Retain control point selection over undo/redo operations
Updated `ControlPointList` to re-establish the selected group by looking up its timestamp in the restored beatmap state, rather than relying on instance equality which fails after undo/redo patching. Improved the logic to handle moved control points by falling back to selecting the closest timing point if an exact time match is not found. Updated `TestSceneTimingScreen` to verify that selection is correctly retained and fixed group count assertions to match the actual state of the test beatmap.
1 parent 2817c6b commit 01d1033

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

osu.Game.Tests/Visual/Editing/TestSceneTimingScreen.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,15 @@ public void TestSelectedRetainedOverUndo()
105105
return timingScreen.SelectedGroup.Value?.ControlPoints.Any(c => c is TimingControlPoint) == true && timingScreen.SelectedGroup.Value?.Time == 2170;
106106
});
107107

108-
AddAssert("check group count", () => editorBeatmap.ControlPointInfo.Groups.Count, () => Is.EqualTo(10));
108+
AddAssert("check group count", () => editorBeatmap.ControlPointInfo.Groups.Count, () => Is.EqualTo(9));
109109

110110
AddStep("Adjust offset", () =>
111111
{
112112
InputManager.MoveMouseTo(timingScreen.ChildrenOfType<TimingAdjustButton>().First().ScreenSpaceDrawQuad.Centre + new Vector2(20, 0));
113113
InputManager.Click(MouseButton.Left);
114114
});
115115

116-
AddAssert("check group count", () => editorBeatmap.ControlPointInfo.Groups.Count, () => Is.EqualTo(10));
116+
AddAssert("check group count", () => editorBeatmap.ControlPointInfo.Groups.Count, () => Is.EqualTo(9));
117117
}
118118

119119
[Test]

0 commit comments

Comments
 (0)