From b2de0a3ae6e49e07d6f658ec55b8260ab5748627 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Tue, 3 Feb 2009 18:48:04 +0000 Subject: * Now clearing parts list in the old group after a link has occurred * Adjusted existing link tests to reflect this and added some new assertions --- OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 10 +++------- .../Region/Environment/Scenes/Tests/SceneObjectTests.cs | 17 +++++++++-------- 2 files changed, 12 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index c3e3dfc..6388bc1 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -2049,15 +2049,11 @@ namespace OpenSim.Region.Environment.Scenes } m_scene.UnlinkSceneObject(objectGroup.UUID, true); -// objectGroup.Children.Clear(); + objectGroup.Children.Clear(); + + // Can't do this yet since backup still makes use of the root part without any synchronization // objectGroup.m_rootPart = null; - // TODO Deleting the original group object may cause problems later on if they have already - // made it into the update queue. However, sending out updates for those parts is now - // spurious, so it would be good not to send them at some point. - // The traffic caused is always going to be pretty minor, so it's not high priority - //objectGroup.DeleteGroup(); - AttachToBackup(); HasGroupChanged = true; ScheduleGroupForFullUpdate(); diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs index ed2eb79..5e5f5c2 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs @@ -131,7 +131,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests // FIXME: Can't to these tests yet since group 2 still has the parts attached! We can't yet detach since // it might cause SOG.ProcessBackup() to fail due to the race condition. This really needs to be fixed. //Assert.That(grp2.IsDeleted, "SOG 2 was not registered as deleted after link."); - //Assert.That(grp2.Children.Count, Is.EqualTo(0), "Group 2 still contained children after delink."); + Assert.That(grp2.Children.Count, Is.EqualTo(0), "Group 2 still contained children after delink."); Assert.That(grp1.Children.Count == 2); if (debugtest) @@ -173,6 +173,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests if (debugtest) System.Console.WriteLine("Group2: Prim2: OffsetPosition:{0}, OffsetRotation:{1}", part2.AbsolutePosition, part2.RotationOffset); + Assert.That(grp1.Children.Count, Is.EqualTo(1), "Group 1 still contained part2 after delink."); Assert.That(part2.AbsolutePosition == Vector3.Zero); } @@ -224,10 +225,11 @@ namespace OpenSim.Region.Environment.Scenes.Tests grp1.RootPart.UpdateFlag = 0; grp3.RootPart.UpdateFlag = 0; - // At this point we should have 4 parts total in two groups. - + // At this point we should have 4 parts total in two groups. Assert.That(grp1.Children.Count == 2); + Assert.That(grp2.Children.Count, Is.EqualTo(0), "Group 2 still contained parts after delink."); Assert.That(grp3.Children.Count == 2); + Assert.That(grp4.Children.Count, Is.EqualTo(0), "Group 4 still contained parts after delink."); if (debugtest) { @@ -268,13 +270,12 @@ namespace OpenSim.Region.Environment.Scenes.Tests Assert.That(rotEuler2.ApproxEquals(new Vector3(-180, 0, 0), 0.001f) || rotEuler2.ApproxEquals(new Vector3(180, 0, 0), 0.001f)); - // Now we're linking the first group to the second group. This will make the first group child parts of the second one. + // Now we're linking the first group to the third group. This will make the first group child parts of the third one. grp3.LinkToGroup(grp1); - // Delink part 2 - grp1.DelinkFromGroup(part2.LocalId); - - grp1.DelinkFromGroup(part3.LocalId); + // Delink parts 2 and 3 + grp3.DelinkFromGroup(part2.LocalId); + grp3.DelinkFromGroup(part3.LocalId); if (debugtest) { -- cgit v1.1