add regression test for detaching an attachment to the scene

bulletsim
Justin Clark-Casey (justincc) 2011-08-26 22:17:05 +01:00
parent 002313bf13
commit 1dba047e4d
1 changed files with 33 additions and 0 deletions

View File

@ -146,6 +146,39 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
Assert.That(presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo((int)AttachmentPoint.Chest)); Assert.That(presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo((int)AttachmentPoint.Chest));
} }
[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<SceneObjectGroup> 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] [Test]
public void TestDetachAttachmentToInventory() public void TestDetachAttachmentToInventory()
{ {