diff options
author | Justin Clarke Casey | 2009-02-03 19:13:17 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-02-03 19:13:17 +0000 |
commit | cff7664a37305fde7bca3df84994c3a6a3a9c62e (patch) | |
tree | 4d8900000e5d6febd5ce1b6dd62cb1b5e7b379e1 /OpenSim | |
parent | OK, commenting the return again :-/ (diff) | |
download | opensim-SC_OLD-cff7664a37305fde7bca3df84994c3a6a3a9c62e.zip opensim-SC_OLD-cff7664a37305fde7bca3df84994c3a6a3a9c62e.tar.gz opensim-SC_OLD-cff7664a37305fde7bca3df84994c3a6a3a9c62e.tar.bz2 opensim-SC_OLD-cff7664a37305fde7bca3df84994c3a6a3a9c62e.tar.xz |
* Mark the old group after linking as deleted
* Add unit test assertions to check this
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs | 20 |
2 files changed, 13 insertions, 10 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 6388bc1..bdede36 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -2049,7 +2049,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
2049 | } | 2049 | } |
2050 | 2050 | ||
2051 | m_scene.UnlinkSceneObject(objectGroup.UUID, true); | 2051 | m_scene.UnlinkSceneObject(objectGroup.UUID, true); |
2052 | objectGroup.Children.Clear(); | 2052 | objectGroup.m_isDeleted = true; |
2053 | objectGroup.m_parts.Clear(); | ||
2053 | 2054 | ||
2054 | // Can't do this yet since backup still makes use of the root part without any synchronization | 2055 | // Can't do this yet since backup still makes use of the root part without any synchronization |
2055 | // objectGroup.m_rootPart = null; | 2056 | // objectGroup.m_rootPart = null; |
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 | |||
128 | // Link grp2 to grp1. part2 becomes child prim to grp1. grp2 is eliminated. | 128 | // Link grp2 to grp1. part2 becomes child prim to grp1. grp2 is eliminated. |
129 | grp1.LinkToGroup(grp2); | 129 | grp1.LinkToGroup(grp2); |
130 | 130 | ||
131 | // FIXME: Can't to these tests yet since group 2 still has the parts attached! We can't yet detach since | 131 | // FIXME: Can't do this test yet since group 2 still has its root part! We can't yet null this since |
132 | // it might cause SOG.ProcessBackup() to fail due to the race condition. This really needs to be fixed. | 132 | // it might cause SOG.ProcessBackup() to fail due to the race condition. This really needs to be fixed. |
133 | //Assert.That(grp2.IsDeleted, "SOG 2 was not registered as deleted after link."); | 133 | Assert.That(grp2.IsDeleted, "SOG 2 was not registered as deleted after link."); |
134 | Assert.That(grp2.Children.Count, Is.EqualTo(0), "Group 2 still contained children after delink."); | 134 | Assert.That(grp2.Children.Count, Is.EqualTo(0), "Group 2 still contained children after delink."); |
135 | Assert.That(grp1.Children.Count == 2); | 135 | Assert.That(grp1.Children.Count == 2); |
136 | 136 | ||
@@ -220,16 +220,14 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
220 | 220 | ||
221 | // Link grp4 to grp3. | 221 | // Link grp4 to grp3. |
222 | grp3.LinkToGroup(grp4); | 222 | grp3.LinkToGroup(grp4); |
223 | 223 | ||
224 | // Required for linking | ||
225 | grp1.RootPart.UpdateFlag = 0; | ||
226 | grp3.RootPart.UpdateFlag = 0; | ||
227 | |||
228 | // At this point we should have 4 parts total in two groups. | 224 | // At this point we should have 4 parts total in two groups. |
229 | Assert.That(grp1.Children.Count == 2); | 225 | Assert.That(grp1.Children.Count == 2); |
226 | Assert.That(grp2.IsDeleted, "Group 2 was not registered as deleted after link."); | ||
230 | Assert.That(grp2.Children.Count, Is.EqualTo(0), "Group 2 still contained parts after delink."); | 227 | Assert.That(grp2.Children.Count, Is.EqualTo(0), "Group 2 still contained parts after delink."); |
231 | Assert.That(grp3.Children.Count == 2); | 228 | Assert.That(grp3.Children.Count == 2); |
232 | Assert.That(grp4.Children.Count, Is.EqualTo(0), "Group 4 still contained parts after delink."); | 229 | Assert.That(grp4.IsDeleted, "Group 4 was not registered as deleted after link."); |
230 | Assert.That(grp4.Children.Count, Is.EqualTo(0), "Group 4 still contained parts after delink."); | ||
233 | 231 | ||
234 | if (debugtest) | 232 | if (debugtest) |
235 | { | 233 | { |
@@ -243,7 +241,11 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
243 | System.Console.WriteLine("Group3: Pos:{0}, Rot:{1}", grp3.AbsolutePosition, grp3.Rotation); | 241 | System.Console.WriteLine("Group3: Pos:{0}, Rot:{1}", grp3.AbsolutePosition, grp3.Rotation); |
244 | System.Console.WriteLine("Group3: Prim1: OffsetPosition:{0}, OffsetRotation:{1}", part3.OffsetPosition, part3.RotationOffset); | 242 | System.Console.WriteLine("Group3: Prim1: OffsetPosition:{0}, OffsetRotation:{1}", part3.OffsetPosition, part3.RotationOffset); |
245 | System.Console.WriteLine("Group3: Prim2: OffsetPosition:{0}, OffsetRotation:{1}", part4.OffsetPosition, part4.RotationOffset); | 243 | System.Console.WriteLine("Group3: Prim2: OffsetPosition:{0}, OffsetRotation:{1}", part4.OffsetPosition, part4.RotationOffset); |
246 | } | 244 | } |
245 | |||
246 | // Required for linking | ||
247 | grp1.RootPart.UpdateFlag = 0; | ||
248 | grp3.RootPart.UpdateFlag = 0; | ||
247 | 249 | ||
248 | // root part should have no offset position or rotation | 250 | // root part should have no offset position or rotation |
249 | Assert.That(part1.OffsetPosition == Vector3.Zero && part1.RotationOffset == Quaternion.Identity); | 251 | Assert.That(part1.OffsetPosition == Vector3.Zero && part1.RotationOffset == Quaternion.Identity); |