mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 19:32:55 +08:00
Merge pull request #10324 from peppy/fix-control-point-group-removal
Fix control points not being removed from ControlPointInfo lists when group is removed
This commit is contained in:
commit
d0447d78ed
@ -139,6 +139,22 @@ namespace osu.Game.Tests.NonVisual
|
|||||||
Assert.That(cpi.Groups.Count, Is.EqualTo(0));
|
Assert.That(cpi.Groups.Count, Is.EqualTo(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestRemoveGroupAlsoRemovedControlPoints()
|
||||||
|
{
|
||||||
|
var cpi = new ControlPointInfo();
|
||||||
|
|
||||||
|
var group = cpi.GroupAt(1000, true);
|
||||||
|
|
||||||
|
group.Add(new SampleControlPoint());
|
||||||
|
|
||||||
|
Assert.That(cpi.SamplePoints.Count, Is.EqualTo(1));
|
||||||
|
|
||||||
|
cpi.RemoveGroup(group);
|
||||||
|
|
||||||
|
Assert.That(cpi.SamplePoints.Count, Is.EqualTo(0));
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestAddControlPointToGroup()
|
public void TestAddControlPointToGroup()
|
||||||
{
|
{
|
||||||
|
@ -158,6 +158,9 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
|
|
||||||
public void RemoveGroup(ControlPointGroup group)
|
public void RemoveGroup(ControlPointGroup group)
|
||||||
{
|
{
|
||||||
|
foreach (var item in group.ControlPoints.ToArray())
|
||||||
|
group.Remove(item);
|
||||||
|
|
||||||
group.ItemAdded -= groupItemAdded;
|
group.ItemAdded -= groupItemAdded;
|
||||||
group.ItemRemoved -= groupItemRemoved;
|
group.ItemRemoved -= groupItemRemoved;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user