diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index e6d5a2f..41f61ac 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs | |||
@@ -66,8 +66,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
66 | public void TestLinkDelink2SceneObjects() | 66 | public void TestLinkDelink2SceneObjects() |
67 | { | 67 | { |
68 | TestHelpers.InMethod(); | 68 | TestHelpers.InMethod(); |
69 | 69 | ||
70 | bool debugtest = false; | 70 | bool debugtest = false; |
71 | 71 | ||
72 | Scene scene = new SceneHelpers().SetupScene(); | 72 | Scene scene = new SceneHelpers().SetupScene(); |
73 | SceneObjectGroup grp1 = SceneHelpers.AddSceneObject(scene); | 73 | SceneObjectGroup grp1 = SceneHelpers.AddSceneObject(scene); |
@@ -83,7 +83,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
83 | 83 | ||
84 | // <180,0,0> | 84 | // <180,0,0> |
85 | grp2.UpdateGroupRotationR(Quaternion.CreateFromEulers(180 * Utils.DEG_TO_RAD, 0, 0)); | 85 | grp2.UpdateGroupRotationR(Quaternion.CreateFromEulers(180 * Utils.DEG_TO_RAD, 0, 0)); |
86 | 86 | ||
87 | // Required for linking | 87 | // Required for linking |
88 | grp1.RootPart.ClearUpdateSchedule(); | 88 | grp1.RootPart.ClearUpdateSchedule(); |
89 | grp2.RootPart.ClearUpdateSchedule(); | 89 | grp2.RootPart.ClearUpdateSchedule(); |
@@ -111,7 +111,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
111 | } | 111 | } |
112 | 112 | ||
113 | // root part should have no offset position or rotation | 113 | // root part should have no offset position or rotation |
114 | Assert.That(part1.OffsetPosition == Vector3.Zero && part1.RotationOffset == Quaternion.Identity, | 114 | Assert.That(part1.OffsetPosition == Vector3.Zero && part1.RotationOffset == Quaternion.Identity, |
115 | "root part should have no offset position or rotation"); | 115 | "root part should have no offset position or rotation"); |
116 | 116 | ||
117 | // offset position should be root part position - part2.absolute position. | 117 | // offset position should be root part position - part2.absolute position. |
@@ -125,13 +125,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
125 | // There's a euler anomoly at 180, 0, 0 so expect 180 to turn into -180. | 125 | // There's a euler anomoly at 180, 0, 0 so expect 180 to turn into -180. |
126 | part1.RotationOffset.GetEulerAngles(out roll, out pitch, out yaw); | 126 | part1.RotationOffset.GetEulerAngles(out roll, out pitch, out yaw); |
127 | Vector3 rotEuler1 = new Vector3(roll * Utils.RAD_TO_DEG, pitch * Utils.RAD_TO_DEG, yaw * Utils.RAD_TO_DEG); | 127 | Vector3 rotEuler1 = new Vector3(roll * Utils.RAD_TO_DEG, pitch * Utils.RAD_TO_DEG, yaw * Utils.RAD_TO_DEG); |
128 | 128 | ||
129 | if (debugtest) | 129 | if (debugtest) |
130 | m_log.Debug(rotEuler1); | 130 | m_log.Debug(rotEuler1); |
131 | 131 | ||
132 | part2.RotationOffset.GetEulerAngles(out roll, out pitch, out yaw); | 132 | part2.RotationOffset.GetEulerAngles(out roll, out pitch, out yaw); |
133 | Vector3 rotEuler2 = new Vector3(roll * Utils.RAD_TO_DEG, pitch * Utils.RAD_TO_DEG, yaw * Utils.RAD_TO_DEG); | 133 | Vector3 rotEuler2 = new Vector3(roll * Utils.RAD_TO_DEG, pitch * Utils.RAD_TO_DEG, yaw * Utils.RAD_TO_DEG); |
134 | 134 | ||
135 | if (debugtest) | 135 | if (debugtest) |
136 | m_log.Debug(rotEuler2); | 136 | m_log.Debug(rotEuler2); |
137 | 137 | ||
@@ -153,7 +153,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
153 | public void TestLinkDelink2groups4SceneObjects() | 153 | public void TestLinkDelink2groups4SceneObjects() |
154 | { | 154 | { |
155 | TestHelpers.InMethod(); | 155 | TestHelpers.InMethod(); |
156 | 156 | ||
157 | bool debugtest = false; | 157 | bool debugtest = false; |
158 | 158 | ||
159 | Scene scene = new SceneHelpers().SetupScene(); | 159 | Scene scene = new SceneHelpers().SetupScene(); |
@@ -194,7 +194,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
194 | 194 | ||
195 | // Link grp4 to grp3. | 195 | // Link grp4 to grp3. |
196 | grp3.LinkToGroup(grp4); | 196 | grp3.LinkToGroup(grp4); |
197 | 197 | ||
198 | // At this point we should have 4 parts total in two groups. | 198 | // At this point we should have 4 parts total in two groups. |
199 | Assert.That(grp1.Parts.Length == 2, "Group1 children count should be 2"); | 199 | Assert.That(grp1.Parts.Length == 2, "Group1 children count should be 2"); |
200 | Assert.That(grp2.IsDeleted, "Group 2 was not registered as deleted after link."); | 200 | Assert.That(grp2.IsDeleted, "Group 2 was not registered as deleted after link."); |
@@ -202,7 +202,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
202 | Assert.That(grp3.Parts.Length == 2, "Group3 children count should be 2"); | 202 | Assert.That(grp3.Parts.Length == 2, "Group3 children count should be 2"); |
203 | Assert.That(grp4.IsDeleted, "Group 4 was not registered as deleted after link."); | 203 | Assert.That(grp4.IsDeleted, "Group 4 was not registered as deleted after link."); |
204 | Assert.That(grp4.Parts.Length, Is.EqualTo(0), "Group 4 still contained parts after delink."); | 204 | Assert.That(grp4.Parts.Length, Is.EqualTo(0), "Group 4 still contained parts after delink."); |
205 | 205 | ||
206 | if (debugtest) | 206 | if (debugtest) |
207 | { | 207 | { |
208 | m_log.Debug("--------After Link-------"); | 208 | m_log.Debug("--------After Link-------"); |
@@ -273,13 +273,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
273 | Assert.That(part2.AbsolutePosition == Vector3.Zero, "Badness 1"); | 273 | Assert.That(part2.AbsolutePosition == Vector3.Zero, "Badness 1"); |
274 | Assert.That(part4.OffsetPosition == new Vector3(20, 20, 20), "Badness 2"); | 274 | Assert.That(part4.OffsetPosition == new Vector3(20, 20, 20), "Badness 2"); |
275 | Quaternion compareQuaternion = new Quaternion(0, 0.7071068f, 0, 0.7071068f); | 275 | Quaternion compareQuaternion = new Quaternion(0, 0.7071068f, 0, 0.7071068f); |
276 | Assert.That((part4.RotationOffset.X - compareQuaternion.X < 0.00003) | 276 | Assert.That((part4.RotationOffset.X - compareQuaternion.X < 0.00003) |
277 | && (part4.RotationOffset.Y - compareQuaternion.Y < 0.00003) | 277 | && (part4.RotationOffset.Y - compareQuaternion.Y < 0.00003) |
278 | && (part4.RotationOffset.Z - compareQuaternion.Z < 0.00003) | 278 | && (part4.RotationOffset.Z - compareQuaternion.Z < 0.00003) |
279 | && (part4.RotationOffset.W - compareQuaternion.W < 0.00003), | 279 | && (part4.RotationOffset.W - compareQuaternion.W < 0.00003), |
280 | "Badness 3"); | 280 | "Badness 3"); |
281 | } | 281 | } |
282 | 282 | ||
283 | /// <summary> | 283 | /// <summary> |
284 | /// Test that a new scene object which is already linked is correctly persisted to the persistence layer. | 284 | /// Test that a new scene object which is already linked is correctly persisted to the persistence layer. |
285 | /// </summary> | 285 | /// </summary> |
@@ -288,37 +288,37 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
288 | { | 288 | { |
289 | TestHelpers.InMethod(); | 289 | TestHelpers.InMethod(); |
290 | //log4net.Config.XmlConfigurator.Configure(); | 290 | //log4net.Config.XmlConfigurator.Configure(); |
291 | 291 | ||
292 | TestScene scene = new SceneHelpers().SetupScene(); | 292 | TestScene scene = new SceneHelpers().SetupScene(); |
293 | 293 | ||
294 | string rootPartName = "rootpart"; | 294 | string rootPartName = "rootpart"; |
295 | UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); | 295 | UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); |
296 | string linkPartName = "linkpart"; | 296 | string linkPartName = "linkpart"; |
297 | UUID linkPartUuid = new UUID("00000000-0000-0000-0001-000000000000"); | 297 | UUID linkPartUuid = new UUID("00000000-0000-0000-0001-000000000000"); |
298 | 298 | ||
299 | SceneObjectPart rootPart | 299 | SceneObjectPart rootPart |
300 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) | 300 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) |
301 | { Name = rootPartName, UUID = rootPartUuid }; | 301 | { Name = rootPartName, UUID = rootPartUuid }; |
302 | SceneObjectPart linkPart | 302 | SceneObjectPart linkPart |
303 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) | 303 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) |
304 | { Name = linkPartName, UUID = linkPartUuid }; | 304 | { Name = linkPartName, UUID = linkPartUuid }; |
305 | 305 | ||
306 | SceneObjectGroup sog = new SceneObjectGroup(rootPart); | 306 | SceneObjectGroup sog = new SceneObjectGroup(rootPart); |
307 | sog.AddPart(linkPart); | 307 | sog.AddPart(linkPart); |
308 | scene.AddNewSceneObject(sog, true); | 308 | scene.AddNewSceneObject(sog, true); |
309 | 309 | ||
310 | // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked | 310 | // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked |
311 | // scene backup thread. | 311 | // scene backup thread. |
312 | scene.Backup(true); | 312 | scene.Backup(true); |
313 | 313 | ||
314 | List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID); | 314 | List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID); |
315 | 315 | ||
316 | Assert.That(storedObjects.Count, Is.EqualTo(1)); | 316 | Assert.That(storedObjects.Count, Is.EqualTo(1)); |
317 | Assert.That(storedObjects[0].Parts.Length, Is.EqualTo(2)); | 317 | Assert.That(storedObjects[0].Parts.Length, Is.EqualTo(2)); |
318 | Assert.That(storedObjects[0].ContainsPart(rootPartUuid)); | 318 | Assert.That(storedObjects[0].ContainsPart(rootPartUuid)); |
319 | Assert.That(storedObjects[0].ContainsPart(linkPartUuid)); | 319 | Assert.That(storedObjects[0].ContainsPart(linkPartUuid)); |
320 | } | 320 | } |
321 | 321 | ||
322 | /// <summary> | 322 | /// <summary> |
323 | /// Test that a delink of a previously linked object is correctly persisted to the database | 323 | /// Test that a delink of a previously linked object is correctly persisted to the database |
324 | /// </summary> | 324 | /// </summary> |
@@ -327,20 +327,20 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
327 | { | 327 | { |
328 | TestHelpers.InMethod(); | 328 | TestHelpers.InMethod(); |
329 | //log4net.Config.XmlConfigurator.Configure(); | 329 | //log4net.Config.XmlConfigurator.Configure(); |
330 | 330 | ||
331 | TestScene scene = new SceneHelpers().SetupScene(); | 331 | TestScene scene = new SceneHelpers().SetupScene(); |
332 | 332 | ||
333 | string rootPartName = "rootpart"; | 333 | string rootPartName = "rootpart"; |
334 | UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); | 334 | UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); |
335 | string linkPartName = "linkpart"; | 335 | string linkPartName = "linkpart"; |
336 | UUID linkPartUuid = new UUID("00000000-0000-0000-0001-000000000000"); | 336 | UUID linkPartUuid = new UUID("00000000-0000-0000-0001-000000000000"); |
337 | 337 | ||
338 | SceneObjectPart rootPart | 338 | SceneObjectPart rootPart |
339 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) | 339 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) |
340 | { Name = rootPartName, UUID = rootPartUuid }; | 340 | { Name = rootPartName, UUID = rootPartUuid }; |
341 | 341 | ||
342 | SceneObjectPart linkPart | 342 | SceneObjectPart linkPart |
343 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) | 343 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) |
344 | { Name = linkPartName, UUID = linkPartUuid }; | 344 | { Name = linkPartName, UUID = linkPartUuid }; |
345 | SceneObjectGroup linkGroup = new SceneObjectGroup(linkPart); | 345 | SceneObjectGroup linkGroup = new SceneObjectGroup(linkPart); |
346 | scene.AddNewSceneObject(linkGroup, true); | 346 | scene.AddNewSceneObject(linkGroup, true); |
@@ -359,13 +359,15 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
359 | SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false); | 359 | SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false); |
360 | Assert.IsFalse(groupToDelete.GroupContainsForeignPrims); | 360 | Assert.IsFalse(groupToDelete.GroupContainsForeignPrims); |
361 | 361 | ||
362 | /* backup is async | ||
362 | scene.DeleteSceneObject(groupToDelete, false); | 363 | scene.DeleteSceneObject(groupToDelete, false); |
363 | 364 | ||
364 | List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID); | 365 | List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID); |
365 | 366 | ||
366 | Assert.AreEqual(1, storedObjects.Count); | 367 | Assert.AreEqual(1, storedObjects.Count); |
367 | Assert.AreEqual(1, storedObjects[0].Parts.Length); | 368 | Assert.AreEqual(1, storedObjects[0].Parts.Length); |
368 | Assert.IsTrue(storedObjects[0].ContainsPart(rootPartUuid)); | 369 | Assert.IsTrue(storedObjects[0].ContainsPart(rootPartUuid)); |
370 | */ | ||
369 | } | 371 | } |
370 | } | 372 | } |
371 | } | 373 | } |