Extend attachment regression test to check for appropriate attach event firing.
This reveals that the event is not being fired when an object is attached from ground, which is incorrect. This check is temporairly disabled.connector_plugin
parent
d26fbf727a
commit
d588467d5b
|
@ -64,6 +64,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
private AutoResetEvent m_chatEvent = new AutoResetEvent(false);
|
private AutoResetEvent m_chatEvent = new AutoResetEvent(false);
|
||||||
// private OSChatMessage m_osChatMessageReceived;
|
// private OSChatMessage m_osChatMessageReceived;
|
||||||
|
|
||||||
|
// Used to test whether the operations have fired the attach event. Must be reset after each test.
|
||||||
|
private int m_numberOfAttachEventsFired;
|
||||||
|
|
||||||
[TestFixtureSetUp]
|
[TestFixtureSetUp]
|
||||||
public void FixtureInit()
|
public void FixtureInit()
|
||||||
{
|
{
|
||||||
|
@ -99,6 +102,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
"attachments-test-scene", TestHelpers.ParseTail(999), 1000, 1000, config);
|
"attachments-test-scene", TestHelpers.ParseTail(999), 1000, 1000, config);
|
||||||
SceneHelpers.SetupSceneModules(scene, config, modules.ToArray());
|
SceneHelpers.SetupSceneModules(scene, config, modules.ToArray());
|
||||||
|
|
||||||
|
scene.EventManager.OnAttach += (localID, itemID, avatarID) => m_numberOfAttachEventsFired++;
|
||||||
|
|
||||||
return scene;
|
return scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,6 +186,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
TestHelpers.InMethod();
|
TestHelpers.InMethod();
|
||||||
// TestHelpers.EnableLogging();
|
// TestHelpers.EnableLogging();
|
||||||
|
|
||||||
|
m_numberOfAttachEventsFired = 0;
|
||||||
|
|
||||||
Scene scene = CreateTestScene();
|
Scene scene = CreateTestScene();
|
||||||
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
|
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
|
||||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1);
|
ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1);
|
||||||
|
@ -189,6 +196,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
|
|
||||||
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID);
|
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID);
|
||||||
|
|
||||||
|
m_numberOfAttachEventsFired = 0;
|
||||||
scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, false);
|
scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, false);
|
||||||
|
|
||||||
// Check status on scene presence
|
// Check status on scene presence
|
||||||
|
@ -216,7 +224,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
|
|
||||||
Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1));
|
Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1));
|
||||||
|
|
||||||
// TestHelpers.DisableLogging();
|
// Check events
|
||||||
|
|
||||||
|
// FIXME: This is currently not occuring!
|
||||||
|
// Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -228,6 +239,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
TestHelpers.InMethod();
|
TestHelpers.InMethod();
|
||||||
// TestHelpers.EnableLogging();
|
// TestHelpers.EnableLogging();
|
||||||
|
|
||||||
|
m_numberOfAttachEventsFired = 0;
|
||||||
|
|
||||||
Scene scene = CreateTestScene();
|
Scene scene = CreateTestScene();
|
||||||
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
|
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
|
||||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1);
|
ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1);
|
||||||
|
@ -247,6 +260,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
|
|
||||||
Assert.That(sp.HasAttachments(), Is.False);
|
Assert.That(sp.HasAttachments(), Is.False);
|
||||||
Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1));
|
Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1));
|
||||||
|
|
||||||
|
// Check events
|
||||||
|
Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -261,6 +277,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
|
|
||||||
InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20);
|
InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20);
|
||||||
|
|
||||||
|
m_numberOfAttachEventsFired = 0;
|
||||||
scene.AttachmentsModule.RezSingleAttachmentFromInventory(
|
scene.AttachmentsModule.RezSingleAttachmentFromInventory(
|
||||||
sp, attItem.ID, (uint)AttachmentPoint.Chest);
|
sp, attItem.ID, (uint)AttachmentPoint.Chest);
|
||||||
|
|
||||||
|
@ -280,6 +297,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest));
|
Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest));
|
||||||
|
|
||||||
Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1));
|
Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1));
|
||||||
|
|
||||||
|
// Check events
|
||||||
|
Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -338,6 +358,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
ISceneEntity so
|
ISceneEntity so
|
||||||
= scene.AttachmentsModule.RezSingleAttachmentFromInventory(
|
= scene.AttachmentsModule.RezSingleAttachmentFromInventory(
|
||||||
sp, attItem.ID, (uint)AttachmentPoint.Chest);
|
sp, attItem.ID, (uint)AttachmentPoint.Chest);
|
||||||
|
|
||||||
|
m_numberOfAttachEventsFired = 0;
|
||||||
scene.AttachmentsModule.DetachSingleAttachmentToGround(sp, so.LocalId);
|
scene.AttachmentsModule.DetachSingleAttachmentToGround(sp, so.LocalId);
|
||||||
|
|
||||||
// Check scene presence status
|
// Check scene presence status
|
||||||
|
@ -353,6 +375,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
|
|
||||||
// Check object in scene
|
// Check object in scene
|
||||||
Assert.That(scene.GetSceneObjectGroup("att"), Is.Not.Null);
|
Assert.That(scene.GetSceneObjectGroup("att"), Is.Not.Null);
|
||||||
|
|
||||||
|
// Check events
|
||||||
|
Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -369,6 +394,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
SceneObjectGroup so
|
SceneObjectGroup so
|
||||||
= (SceneObjectGroup)scene.AttachmentsModule.RezSingleAttachmentFromInventory(
|
= (SceneObjectGroup)scene.AttachmentsModule.RezSingleAttachmentFromInventory(
|
||||||
sp, attItem.ID, (uint)AttachmentPoint.Chest);
|
sp, attItem.ID, (uint)AttachmentPoint.Chest);
|
||||||
|
|
||||||
|
m_numberOfAttachEventsFired = 0;
|
||||||
scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, so);
|
scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, so);
|
||||||
|
|
||||||
// Check status on scene presence
|
// Check status on scene presence
|
||||||
|
@ -380,6 +407,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo(0));
|
Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo(0));
|
||||||
|
|
||||||
Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(0));
|
Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(0));
|
||||||
|
|
||||||
|
// Check events
|
||||||
|
Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -461,10 +491,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
|
|
||||||
SceneObjectGroup rezzedAtt = presence.GetAttachments()[0];
|
SceneObjectGroup rezzedAtt = presence.GetAttachments()[0];
|
||||||
|
|
||||||
|
m_numberOfAttachEventsFired = 0;
|
||||||
scene.IncomingCloseAgent(presence.UUID, false);
|
scene.IncomingCloseAgent(presence.UUID, false);
|
||||||
|
|
||||||
// Check that we can't retrieve this attachment from the scene.
|
// Check that we can't retrieve this attachment from the scene.
|
||||||
Assert.That(scene.GetSceneObjectGroup(rezzedAtt.UUID), Is.Null);
|
Assert.That(scene.GetSceneObjectGroup(rezzedAtt.UUID), Is.Null);
|
||||||
|
|
||||||
|
// Check events
|
||||||
|
Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -480,6 +514,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID);
|
AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID);
|
||||||
acd.Appearance = new AvatarAppearance();
|
acd.Appearance = new AvatarAppearance();
|
||||||
acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID);
|
acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID);
|
||||||
|
|
||||||
|
m_numberOfAttachEventsFired = 0;
|
||||||
ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd);
|
ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd);
|
||||||
|
|
||||||
Assert.That(presence.HasAttachments(), Is.True);
|
Assert.That(presence.HasAttachments(), Is.True);
|
||||||
|
@ -502,6 +538,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
Assert.That(presence.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest));
|
Assert.That(presence.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest));
|
||||||
|
|
||||||
Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1));
|
Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1));
|
||||||
|
|
||||||
|
// Check events. We expect OnAttach to fire on login.
|
||||||
|
Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -522,10 +561,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
|
|
||||||
Vector3 newPosition = new Vector3(1, 2, 4);
|
Vector3 newPosition = new Vector3(1, 2, 4);
|
||||||
|
|
||||||
|
m_numberOfAttachEventsFired = 0;
|
||||||
scene.SceneGraph.UpdatePrimGroupPosition(attSo.LocalId, newPosition, sp.ControllingClient);
|
scene.SceneGraph.UpdatePrimGroupPosition(attSo.LocalId, newPosition, sp.ControllingClient);
|
||||||
|
|
||||||
Assert.That(attSo.AbsolutePosition, Is.EqualTo(sp.AbsolutePosition));
|
Assert.That(attSo.AbsolutePosition, Is.EqualTo(sp.AbsolutePosition));
|
||||||
Assert.That(attSo.RootPart.AttachedPos, Is.EqualTo(newPosition));
|
Assert.That(attSo.RootPart.AttachedPos, Is.EqualTo(newPosition));
|
||||||
|
|
||||||
|
// Check events
|
||||||
|
Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -574,6 +617,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
Vector3 teleportPosition = new Vector3(10, 11, 12);
|
Vector3 teleportPosition = new Vector3(10, 11, 12);
|
||||||
Vector3 teleportLookAt = new Vector3(20, 21, 22);
|
Vector3 teleportLookAt = new Vector3(20, 21, 22);
|
||||||
|
|
||||||
|
m_numberOfAttachEventsFired = 0;
|
||||||
sceneA.RequestTeleportLocation(
|
sceneA.RequestTeleportLocation(
|
||||||
beforeTeleportSp.ControllingClient,
|
beforeTeleportSp.ControllingClient,
|
||||||
sceneB.RegionInfo.RegionHandle,
|
sceneB.RegionInfo.RegionHandle,
|
||||||
|
@ -616,29 +660,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
Assert.That(actualSceneAAttachments.Count, Is.EqualTo(0));
|
Assert.That(actualSceneAAttachments.Count, Is.EqualTo(0));
|
||||||
|
|
||||||
Assert.That(sceneA.GetSceneObjectGroups().Count, Is.EqualTo(0));
|
Assert.That(sceneA.GetSceneObjectGroups().Count, Is.EqualTo(0));
|
||||||
}
|
|
||||||
|
|
||||||
// I'm commenting this test because scene setup NEEDS InventoryService to
|
// Check events
|
||||||
// be non-null
|
Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0));
|
||||||
//[Test]
|
}
|
||||||
// public void T032_CrossAttachments()
|
|
||||||
// {
|
|
||||||
// TestHelpers.InMethod();
|
|
||||||
//
|
|
||||||
// ScenePresence presence = scene.GetScenePresence(agent1);
|
|
||||||
// ScenePresence presence2 = scene2.GetScenePresence(agent1);
|
|
||||||
// presence2.AddAttachment(sog1);
|
|
||||||
// presence2.AddAttachment(sog2);
|
|
||||||
//
|
|
||||||
// ISharedRegionModule serialiser = new SerialiserModule();
|
|
||||||
// SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser);
|
|
||||||
// SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser);
|
|
||||||
//
|
|
||||||
// Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross");
|
|
||||||
//
|
|
||||||
// //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful");
|
|
||||||
// Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted");
|
|
||||||
// Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects");
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue