aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Attachments/Tests
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-03-18 20:42:08 +0000
committerJustin Clark-Casey (justincc)2013-03-18 20:48:50 +0000
commita7a9a8a614549c7492e4954189e9f4df2473ca1e (patch)
tree3b8f51a0d2740c731fa7502cd03328de5a76d4b0 /OpenSim/Region/CoreModules/Avatar/Attachments/Tests
parentMerge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff)
downloadopensim-SC_OLD-a7a9a8a614549c7492e4954189e9f4df2473ca1e.zip
opensim-SC_OLD-a7a9a8a614549c7492e4954189e9f4df2473ca1e.tar.gz
opensim-SC_OLD-a7a9a8a614549c7492e4954189e9f4df2473ca1e.tar.bz2
opensim-SC_OLD-a7a9a8a614549c7492e4954189e9f4df2473ca1e.tar.xz
Fix recent regression where an item worn to an attachment point that was already occupied did not remove the previous attachment (current behaviour)
Regression was commit ccd6f4 (Tue Mar 5 23:47:36 2013) Added regression test for this case.
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Attachments/Tests')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs64
1 files changed, 63 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index 0ee01c7..624adcf 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -293,7 +293,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
293 // Check appearance status 293 // Check appearance status
294 Assert.That(sp.Appearance.GetAttachments().Count, Is.EqualTo(1)); 294 Assert.That(sp.Appearance.GetAttachments().Count, Is.EqualTo(1));
295 Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest)); 295 Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest));
296
297 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); 296 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1));
298 297
299 // Check events 298 // Check events
@@ -301,6 +300,69 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
301 } 300 }
302 301
303 /// <summary> 302 /// <summary>
303 /// Test wearing an attachment from inventory, as opposed to explicit choosing the rez point
304 /// </summary>
305 [Test]
306 public void TestWearAttachmentFromInventory()
307 {
308 TestHelpers.InMethod();
309// TestHelpers.EnableLogging();
310
311 Scene scene = CreateTestScene();
312 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
313 ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID);
314
315 InventoryItemBase attItem1 = CreateAttachmentItem(scene, ua1.PrincipalID, "att1", 0x10, 0x20);
316 InventoryItemBase attItem2 = CreateAttachmentItem(scene, ua1.PrincipalID, "att2", 0x11, 0x21);
317
318 {
319 scene.AttachmentsModule.RezSingleAttachmentFromInventory(sp, attItem1.ID, (uint)AttachmentPoint.Default);
320
321 // default attachment point is currently the left hand.
322 Assert.That(sp.HasAttachments(), Is.True);
323 List<SceneObjectGroup> attachments = sp.GetAttachments();
324 Assert.That(attachments.Count, Is.EqualTo(1));
325 SceneObjectGroup attSo = attachments[0];
326 Assert.That(attSo.Name, Is.EqualTo(attItem1.Name));
327 Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.LeftHand));
328 Assert.That(attSo.IsAttachment);
329
330 // Check appearance status
331 Assert.That(sp.Appearance.GetAttachments().Count, Is.EqualTo(1));
332 Assert.That(sp.Appearance.GetAttachpoint(attItem1.ID), Is.EqualTo((int)AttachmentPoint.LeftHand));
333 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1));
334
335 // Check events
336 Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(1));
337 }
338
339 // Test wearing a second attachment at the same position
340 // Until multiple attachments at one point is implemented, this will remove the first attachment
341 // This test relies on both attachments having the same default attachment point (in this case LeftHand
342 // since none other has been set).
343 {
344 scene.AttachmentsModule.RezSingleAttachmentFromInventory(sp, attItem2.ID, (uint)AttachmentPoint.Default);
345
346 // default attachment point is currently the left hand.
347 Assert.That(sp.HasAttachments(), Is.True);
348 List<SceneObjectGroup> attachments = sp.GetAttachments();
349 Assert.That(attachments.Count, Is.EqualTo(1));
350 SceneObjectGroup attSo = attachments[0];
351 Assert.That(attSo.Name, Is.EqualTo(attItem2.Name));
352 Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.LeftHand));
353 Assert.That(attSo.IsAttachment);
354
355 // Check appearance status
356 Assert.That(sp.Appearance.GetAttachments().Count, Is.EqualTo(1));
357 Assert.That(sp.Appearance.GetAttachpoint(attItem2.ID), Is.EqualTo((int)AttachmentPoint.LeftHand));
358 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1));
359
360 // Check events
361 Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(3));
362 }
363 }
364
365 /// <summary>
304 /// Test specific conditions associated with rezzing a scripted attachment from inventory. 366 /// Test specific conditions associated with rezzing a scripted attachment from inventory.
305 /// </summary> 367 /// </summary>
306 [Test] 368 [Test]