From cff7664a37305fde7bca3df84994c3a6a3a9c62e Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Tue, 3 Feb 2009 19:13:17 +0000 Subject: * Mark the old group after linking as deleted * Add unit test assertions to check this --- .../Environment/Scenes/Tests/SceneObjectTests.cs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Tests') diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs index 5e5f5c2..2164b0d 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs @@ -128,9 +128,9 @@ namespace OpenSim.Region.Environment.Scenes.Tests // Link grp2 to grp1. part2 becomes child prim to grp1. grp2 is eliminated. grp1.LinkToGroup(grp2); - // FIXME: Can't to these tests yet since group 2 still has the parts attached! We can't yet detach since + // FIXME: Can't do this test yet since group 2 still has its root part! We can't yet null this 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.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(grp1.Children.Count == 2); @@ -220,16 +220,14 @@ namespace OpenSim.Region.Environment.Scenes.Tests // Link grp4 to grp3. grp3.LinkToGroup(grp4); - - // Required for linking - grp1.RootPart.UpdateFlag = 0; - grp3.RootPart.UpdateFlag = 0; - + // At this point we should have 4 parts total in two groups. Assert.That(grp1.Children.Count == 2); + Assert.That(grp2.IsDeleted, "Group 2 was not registered as deleted after link."); 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."); + Assert.That(grp4.IsDeleted, "Group 4 was not registered as deleted after link."); + Assert.That(grp4.Children.Count, Is.EqualTo(0), "Group 4 still contained parts after delink."); if (debugtest) { @@ -243,7 +241,11 @@ namespace OpenSim.Region.Environment.Scenes.Tests System.Console.WriteLine("Group3: Pos:{0}, Rot:{1}", grp3.AbsolutePosition, grp3.Rotation); System.Console.WriteLine("Group3: Prim1: OffsetPosition:{0}, OffsetRotation:{1}", part3.OffsetPosition, part3.RotationOffset); System.Console.WriteLine("Group3: Prim2: OffsetPosition:{0}, OffsetRotation:{1}", part4.OffsetPosition, part4.RotationOffset); - } + } + + // Required for linking + grp1.RootPart.UpdateFlag = 0; + grp3.RootPart.UpdateFlag = 0; // root part should have no offset position or rotation Assert.That(part1.OffsetPosition == Vector3.Zero && part1.RotationOffset == Quaternion.Identity); -- cgit v1.1