diff options
Merge branch 'master' into careminster
Conflicts:
OpenSim/Framework/Watchdog.cs
OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
OpenSim/Region/Framework/Scenes/Scene.cs
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
OpenSim/Region/Framework/Scenes/ScenePresence.cs
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 2eb0ac5..8423d43 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | |||
@@ -118,7 +118,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
118 | 118 | ||
119 | Scene scene = CreateDefaultTestScene(); | 119 | Scene scene = CreateDefaultTestScene(); |
120 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); | 120 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); |
121 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID); | 121 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1); |
122 | 122 | ||
123 | string attName = "att"; | 123 | string attName = "att"; |
124 | 124 | ||
@@ -149,9 +149,41 @@ 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 | ||
157 | /// <summary> | ||
158 | /// Test that we do not attempt to attach an in-world object that someone else is sitting on. | ||
159 | /// </summary> | ||
160 | [Test] | ||
161 | public void TestAddSatOnAttachmentFromGround() | ||
162 | { | ||
163 | TestHelpers.InMethod(); | ||
164 | // TestHelpers.EnableLogging(); | ||
165 | |||
166 | Scene scene = CreateDefaultTestScene(); | ||
167 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); | ||
168 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1); | ||
169 | |||
170 | string attName = "att"; | ||
171 | |||
172 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID); | ||
173 | |||
174 | UserAccount ua2 = UserAccountHelpers.CreateUserWithInventory(scene, 0x2); | ||
175 | ScenePresence sp2 = SceneHelpers.AddScenePresence(scene, ua2); | ||
176 | |||
177 | // Put avatar within 10m of the prim so that sit doesn't fail. | ||
178 | sp2.AbsolutePosition = new Vector3(0, 0, 0); | ||
179 | sp2.HandleAgentRequestSit(sp2.ControllingClient, sp2.UUID, so.UUID, Vector3.Zero); | ||
180 | |||
181 | scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, false); | ||
182 | |||
183 | Assert.That(sp.HasAttachments(), Is.False); | ||
184 | Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); | ||
185 | } | ||
186 | |||
155 | [Test] | 187 | [Test] |
156 | public void TestAddAttachmentFromInventory() | 188 | public void TestAddAttachmentFromInventory() |
157 | { | 189 | { |
@@ -181,6 +213,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
181 | // Check appearance status | 213 | // Check appearance status |
182 | Assert.That(sp.Appearance.GetAttachments().Count, Is.EqualTo(1)); | 214 | Assert.That(sp.Appearance.GetAttachments().Count, Is.EqualTo(1)); |
183 | Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest)); | 215 | Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest)); |
216 | |||
217 | Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); | ||
184 | } | 218 | } |
185 | 219 | ||
186 | [Test] | 220 | [Test] |
@@ -239,6 +273,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
239 | 273 | ||
240 | // Check item status | 274 | // Check item status |
241 | Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo(0)); | 275 | Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo(0)); |
276 | |||
277 | Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(0)); | ||
242 | } | 278 | } |
243 | 279 | ||
244 | /// <summary> | 280 | /// <summary> |
@@ -300,6 +336,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
300 | Assert.That(retreivedAttachments[0].ItemID, Is.EqualTo(attItem.ID)); | 336 | Assert.That(retreivedAttachments[0].ItemID, Is.EqualTo(attItem.ID)); |
301 | Assert.That(retreivedAttachments[0].AssetID, Is.EqualTo(attItem.AssetID)); | 337 | Assert.That(retreivedAttachments[0].AssetID, Is.EqualTo(attItem.AssetID)); |
302 | Assert.That(presence.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest)); | 338 | Assert.That(presence.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest)); |
339 | |||
340 | Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); | ||
303 | } | 341 | } |
304 | 342 | ||
305 | [Test] | 343 | [Test] |
@@ -399,6 +437,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
399 | Assert.That(actualSceneBAtt.Name, Is.EqualTo(attItem.Name)); | 437 | Assert.That(actualSceneBAtt.Name, Is.EqualTo(attItem.Name)); |
400 | Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest)); | 438 | Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest)); |
401 | 439 | ||
440 | Assert.That(sceneB.GetSceneObjectGroups().Count, Is.EqualTo(1)); | ||
441 | |||
402 | // Check attachments have been removed from sceneA | 442 | // Check attachments have been removed from sceneA |
403 | ScenePresence afterTeleportSceneASp = sceneA.GetScenePresence(ua1.PrincipalID); | 443 | ScenePresence afterTeleportSceneASp = sceneA.GetScenePresence(ua1.PrincipalID); |
404 | 444 | ||
@@ -410,6 +450,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
410 | // This is the actual attachment, which should no longer exist | 450 | // This is the actual attachment, which should no longer exist |
411 | List<SceneObjectGroup> actualSceneAAttachments = afterTeleportSceneASp.GetAttachments(); | 451 | List<SceneObjectGroup> actualSceneAAttachments = afterTeleportSceneASp.GetAttachments(); |
412 | Assert.That(actualSceneAAttachments.Count, Is.EqualTo(0)); | 452 | Assert.That(actualSceneAAttachments.Count, Is.EqualTo(0)); |
453 | |||
454 | Assert.That(sceneA.GetSceneObjectGroups().Count, Is.EqualTo(0)); | ||
413 | } | 455 | } |
414 | 456 | ||
415 | // I'm commenting this test because scene setup NEEDS InventoryService to | 457 | // I'm commenting this test because scene setup NEEDS InventoryService to |