diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index c274a5bea5..f254974b60 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -563,7 +563,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // the client/server crashes rather than logging out normally, the attachment's scripts will resume // without state on relog. Arguably, this is what we want anyway. string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp, false); - + InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); item = m_scene.InventoryService.GetItem(item); diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 6695a9d797..b4ff0554a3 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -81,7 +81,37 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests } [Test] - public void TestAddAttachment() + public void TestAddAttachmentFromGround() + { + TestHelpers.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + UUID userId = TestHelpers.ParseTail(0x1); + string attName = "att"; + + UserAccountHelpers.CreateUserWithInventory(scene, userId); + ScenePresence presence = SceneHelpers.AddScenePresence(scene, userId); + SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName).ParentGroup; + + m_attMod.AttachObject(presence.ControllingClient, so, (uint)AttachmentPoint.Chest, false); + + SceneObjectGroup attSo = scene.GetSceneObjectGroup(so.UUID); + Assert.That(attSo.IsAttachment); + + // Check status on scene presence + Assert.That(presence.HasAttachments(), Is.True); + List attachments = presence.Attachments; + Assert.That(attachments.Count, Is.EqualTo(1)); + Assert.That(attachments[0].Name, Is.EqualTo(attName)); + Assert.That(attachments[0].GetAttachmentPoint(), Is.EqualTo((byte)AttachmentPoint.Chest)); + + // Check item status + Assert.That(presence.Appearance.GetAttachpoint( + attSo.GetFromItemID()), Is.EqualTo((int)AttachmentPoint.Chest)); + } + + [Test] + public void TestAddAttachmentFromInventory() { TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure();