aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-07-06 23:07:50 +0100
committerJustin Clark-Casey (justincc)2012-07-06 23:07:50 +0100
commit056c9a59b2fee1e459915bd1ca908107c7c9695d (patch)
treef163c93b07ff267f523fe2c31e90a7631526a30b
parentMantis 6077 trim NPC chat on channel zero. (diff)
downloadopensim-SC_OLD-056c9a59b2fee1e459915bd1ca908107c7c9695d.zip
opensim-SC_OLD-056c9a59b2fee1e459915bd1ca908107c7c9695d.tar.gz
opensim-SC_OLD-056c9a59b2fee1e459915bd1ca908107c7c9695d.tar.bz2
opensim-SC_OLD-056c9a59b2fee1e459915bd1ca908107c7c9695d.tar.xz
Add assert to attachment regression tests to check that number of objects in the scene graph
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs18
3 files changed, 38 insertions, 5 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index 7856953..c1ba8a8 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -149,6 +149,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
149 InventoryFolderBase targetFolder = scene.InventoryService.GetFolderForType(sp.UUID, AssetType.Object); 149 InventoryFolderBase targetFolder = scene.InventoryService.GetFolderForType(sp.UUID, AssetType.Object);
150 Assert.That(attachmentItem.Folder, Is.EqualTo(targetFolder.ID)); 150 Assert.That(attachmentItem.Folder, Is.EqualTo(targetFolder.ID));
151 151
152 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1));
153
152// TestHelpers.DisableLogging(); 154// TestHelpers.DisableLogging();
153 } 155 }
154 156
@@ -181,6 +183,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
181 // Check appearance status 183 // Check appearance status
182 Assert.That(sp.Appearance.GetAttachments().Count, Is.EqualTo(1)); 184 Assert.That(sp.Appearance.GetAttachments().Count, Is.EqualTo(1));
183 Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest)); 185 Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest));
186
187 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1));
184 } 188 }
185 189
186 [Test] 190 [Test]
@@ -239,6 +243,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
239 243
240 // Check item status 244 // Check item status
241 Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo(0)); 245 Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo(0));
246
247 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(0));
242 } 248 }
243 249
244 /// <summary> 250 /// <summary>
@@ -300,6 +306,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
300 Assert.That(retreivedAttachments[0].ItemID, Is.EqualTo(attItem.ID)); 306 Assert.That(retreivedAttachments[0].ItemID, Is.EqualTo(attItem.ID));
301 Assert.That(retreivedAttachments[0].AssetID, Is.EqualTo(attItem.AssetID)); 307 Assert.That(retreivedAttachments[0].AssetID, Is.EqualTo(attItem.AssetID));
302 Assert.That(presence.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest)); 308 Assert.That(presence.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest));
309
310 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1));
303 } 311 }
304 312
305 [Test] 313 [Test]
@@ -399,6 +407,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
399 Assert.That(actualSceneBAtt.Name, Is.EqualTo(attItem.Name)); 407 Assert.That(actualSceneBAtt.Name, Is.EqualTo(attItem.Name));
400 Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest)); 408 Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest));
401 409
410 // Teleporting attachments should not end up in the scene graph
411 Assert.That(sceneB.GetSceneObjectGroups().Count, Is.EqualTo(1));
412
402 // Check attachments have been removed from sceneA 413 // Check attachments have been removed from sceneA
403 ScenePresence afterTeleportSceneASp = sceneA.GetScenePresence(ua1.PrincipalID); 414 ScenePresence afterTeleportSceneASp = sceneA.GetScenePresence(ua1.PrincipalID);
404 415
@@ -410,6 +421,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
410 // This is the actual attachment, which should no longer exist 421 // This is the actual attachment, which should no longer exist
411 List<SceneObjectGroup> actualSceneAAttachments = afterTeleportSceneASp.GetAttachments(); 422 List<SceneObjectGroup> actualSceneAAttachments = afterTeleportSceneASp.GetAttachments();
412 Assert.That(actualSceneAAttachments.Count, Is.EqualTo(0)); 423 Assert.That(actualSceneAAttachments.Count, Is.EqualTo(0));
424
425 // Teleporting attachments should not end up in the scene graph
426 Assert.That(sceneA.GetSceneObjectGroups().Count, Is.EqualTo(0));
413 } 427 }
414 428
415 // I'm commenting this test because scene setup NEEDS InventoryService to 429 // I'm commenting this test because scene setup NEEDS InventoryService to
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 6239d51..d98c01d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -4474,6 +4474,17 @@ namespace OpenSim.Region.Framework.Scenes
4474 } 4474 }
4475 4475
4476 /// <summary> 4476 /// <summary>
4477 /// Get all the scene object groups.
4478 /// </summary>
4479 /// <returns>
4480 /// The scene object groups. If the scene is empty then an empty list is returned.
4481 /// </returns>
4482 public List<SceneObjectGroup> GetSceneObjectGroups()
4483 {
4484 return m_sceneGraph.GetSceneObjectGroups();
4485 }
4486
4487 /// <summary>
4477 /// Get a group via its UUID 4488 /// Get a group via its UUID
4478 /// </summary> 4489 /// </summary>
4479 /// <param name="fullID"></param> 4490 /// <param name="fullID"></param>
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index a59758f..bc9a585 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -958,6 +958,18 @@ namespace OpenSim.Region.Framework.Scenes
958 } 958 }
959 959
960 /// <summary> 960 /// <summary>
961 /// Get all the scene object groups.
962 /// </summary>
963 /// <returns>
964 /// The scene object groups. If the scene is empty then an empty list is returned.
965 /// </returns>
966 protected internal List<SceneObjectGroup> GetSceneObjectGroups()
967 {
968 lock (SceneObjectGroupsByFullID)
969 return new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values);
970 }
971
972 /// <summary>
961 /// Get a group in the scene 973 /// Get a group in the scene
962 /// </summary> 974 /// </summary>
963 /// <param name="fullID">UUID of the group</param> 975 /// <param name="fullID">UUID of the group</param>
@@ -1100,11 +1112,7 @@ namespace OpenSim.Region.Framework.Scenes
1100 /// <param name="action"></param> 1112 /// <param name="action"></param>
1101 protected internal void ForEachSOG(Action<SceneObjectGroup> action) 1113 protected internal void ForEachSOG(Action<SceneObjectGroup> action)
1102 { 1114 {
1103 List<SceneObjectGroup> objlist; 1115 foreach (SceneObjectGroup obj in GetSceneObjectGroups())
1104 lock (SceneObjectGroupsByFullID)
1105 objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values);
1106
1107 foreach (SceneObjectGroup obj in objlist)
1108 { 1116 {
1109 try 1117 try
1110 { 1118 {