From 1dba047e4d4be6213cfade45630f2b906a5a5755 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 26 Aug 2011 22:17:05 +0100 Subject: add regression test for detaching an attachment to the scene --- .../Attachments/Tests/AttachmentsModuleTests.cs | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index afcf05a..afa61bc 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -147,6 +147,39 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests } [Test] + public void TestDetachAttachmentToScene() + { + TestHelpers.InMethod(); + log4net.Config.XmlConfigurator.Configure(); + + UUID userId = TestHelpers.ParseTail(0x1); + UUID attItemId = TestHelpers.ParseTail(0x2); + UUID attAssetId = TestHelpers.ParseTail(0x3); + string attName = "att"; + + UserAccountHelpers.CreateUserWithInventory(scene, userId); + ScenePresence presence = SceneHelpers.AddScenePresence(scene, userId); + InventoryItemBase attItem + = UserInventoryHelpers.CreateInventoryItem( + scene, attName, attItemId, attAssetId, userId, InventoryType.Object); + + UUID attSoId = m_attMod.RezSingleAttachmentFromInventory( + presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); + m_attMod.DetachSingleAttachmentToGround(attSoId, presence.ControllingClient); + + // Check status on scene presence + Assert.That(presence.HasAttachments(), Is.False); + List attachments = presence.Attachments; + Assert.That(attachments.Count, Is.EqualTo(0)); + + // Check item status + Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItemId)), Is.Null); + + // Check object in scene + Assert.That(scene.GetSceneObjectGroup("att"), Is.Not.Null); + } + + [Test] public void TestDetachAttachmentToInventory() { TestHelpers.InMethod(); -- cgit v1.1