diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index fa8277c..c928b1e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs | |||
@@ -91,7 +91,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
91 | grp2.RootPart.ClearUpdateSchedule(); | 91 | grp2.RootPart.ClearUpdateSchedule(); |
92 | 92 | ||
93 | // Link grp2 to grp1. part2 becomes child prim to grp1. grp2 is eliminated. | 93 | // Link grp2 to grp1. part2 becomes child prim to grp1. grp2 is eliminated. |
94 | Assert.IsFalse(grp1.GroupContainsForeignPrims); | ||
94 | grp1.LinkToGroup(grp2); | 95 | grp1.LinkToGroup(grp2); |
96 | Assert.IsTrue(grp1.GroupContainsForeignPrims); | ||
97 | |||
98 | scene.Backup(true); | ||
99 | Assert.IsFalse(grp1.GroupContainsForeignPrims); | ||
95 | 100 | ||
96 | // FIXME: Can't do this test yet since group 2 still has its root part! We can't yet null this since | 101 | // FIXME: Can't do this test yet since group 2 still has its root part! We can't yet null this since |
97 | // it might cause SOG.ProcessBackup() to fail due to the race condition. This really needs to be fixed. | 102 | // it might cause SOG.ProcessBackup() to fail due to the race condition. This really needs to be fixed. |
@@ -143,7 +148,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
143 | 148 | ||
144 | Assert.That(grp1.Parts.Length, Is.EqualTo(1), "Group 1 still contained part2 after delink."); | 149 | Assert.That(grp1.Parts.Length, Is.EqualTo(1), "Group 1 still contained part2 after delink."); |
145 | Assert.That(part2.AbsolutePosition == Vector3.Zero, "The absolute position should be zero"); | 150 | Assert.That(part2.AbsolutePosition == Vector3.Zero, "The absolute position should be zero"); |
146 | Assert.That(grp3.GroupContainsForeignPrims, Is.True); | ||
147 | } | 151 | } |
148 | 152 | ||
149 | [Test] | 153 | [Test] |
@@ -335,30 +339,34 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
335 | SceneObjectPart rootPart | 339 | SceneObjectPart rootPart |
336 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) | 340 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) |
337 | { Name = rootPartName, UUID = rootPartUuid }; | 341 | { Name = rootPartName, UUID = rootPartUuid }; |
342 | |||
338 | SceneObjectPart linkPart | 343 | SceneObjectPart linkPart |
339 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) | 344 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) |
340 | { Name = linkPartName, UUID = linkPartUuid }; | 345 | { Name = linkPartName, UUID = linkPartUuid }; |
346 | SceneObjectGroup linkGroup = new SceneObjectGroup(linkPart); | ||
347 | scene.AddNewSceneObject(linkGroup, true); | ||
341 | 348 | ||
342 | SceneObjectGroup sog = new SceneObjectGroup(rootPart); | 349 | SceneObjectGroup sog = new SceneObjectGroup(rootPart); |
343 | sog.AddPart(linkPart); | 350 | scene.AddNewSceneObject(sog, true); |
344 | scene.AddNewSceneObject(sog, true); | 351 | |
345 | 352 | Assert.IsFalse(sog.GroupContainsForeignPrims); | |
346 | // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked | 353 | sog.LinkToGroup(linkGroup); |
347 | // scene backup thread. | 354 | Assert.IsTrue(sog.GroupContainsForeignPrims); |
355 | |||
348 | scene.Backup(true); | 356 | scene.Backup(true); |
349 | 357 | Assert.AreEqual(1, scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID).Count); | |
358 | |||
350 | // These changes should occur immediately without waiting for a backup pass | 359 | // These changes should occur immediately without waiting for a backup pass |
351 | SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false); | 360 | SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false); |
361 | Assert.IsFalse(groupToDelete.GroupContainsForeignPrims); | ||
352 | 362 | ||
353 | Assert.That(groupToDelete.GroupContainsForeignPrims, Is.True); | ||
354 | scene.DeleteSceneObject(groupToDelete, false); | 363 | scene.DeleteSceneObject(groupToDelete, false); |
355 | Assert.That(groupToDelete.GroupContainsForeignPrims, Is.False); | ||
356 | 364 | ||
357 | List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID); | 365 | List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID); |
358 | 366 | ||
359 | Assert.That(storedObjects.Count, Is.EqualTo(1)); | 367 | Assert.AreEqual(1, storedObjects.Count); |
360 | Assert.That(storedObjects[0].Parts.Length, Is.EqualTo(1)); | 368 | Assert.AreEqual(1, storedObjects[0].Parts.Length); |
361 | Assert.That(storedObjects[0].ContainsPart(rootPartUuid)); | 369 | Assert.IsTrue(storedObjects[0].ContainsPart(rootPartUuid)); |
362 | } | 370 | } |
363 | } | 371 | } |
364 | } | 372 | } |