aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-09-29 00:07:11 +0100
committerJustin Clark-Casey (justincc)2012-09-29 00:07:11 +0100
commitd588467d5b77c5c71bb8efd415af6a2a5faf1b10 (patch)
tree7c2e292035d9e5183f7b31af793c3fb03b23bc31 /OpenSim/Region/CoreModules
parentComment out unused RestPlugins text in OpenSimDefaults.ini (diff)
downloadopensim-SC-d588467d5b77c5c71bb8efd415af6a2a5faf1b10.zip
opensim-SC-d588467d5b77c5c71bb8efd415af6a2a5faf1b10.tar.gz
opensim-SC-d588467d5b77c5c71bb8efd415af6a2a5faf1b10.tar.bz2
opensim-SC-d588467d5b77c5c71bb8efd415af6a2a5faf1b10.tar.xz
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.
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs74
1 files changed, 49 insertions, 25 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index 51e10f5..8d4e2e0 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -64,6 +64,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
64 private AutoResetEvent m_chatEvent = new AutoResetEvent(false); 64 private AutoResetEvent m_chatEvent = new AutoResetEvent(false);
65// private OSChatMessage m_osChatMessageReceived; 65// private OSChatMessage m_osChatMessageReceived;
66 66
67 // Used to test whether the operations have fired the attach event. Must be reset after each test.
68 private int m_numberOfAttachEventsFired;
69
67 [TestFixtureSetUp] 70 [TestFixtureSetUp]
68 public void FixtureInit() 71 public void FixtureInit()
69 { 72 {
@@ -99,6 +102,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
99 "attachments-test-scene", TestHelpers.ParseTail(999), 1000, 1000, config); 102 "attachments-test-scene", TestHelpers.ParseTail(999), 1000, 1000, config);
100 SceneHelpers.SetupSceneModules(scene, config, modules.ToArray()); 103 SceneHelpers.SetupSceneModules(scene, config, modules.ToArray());
101 104
105 scene.EventManager.OnAttach += (localID, itemID, avatarID) => m_numberOfAttachEventsFired++;
106
102 return scene; 107 return scene;
103 } 108 }
104 109
@@ -181,6 +186,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
181 TestHelpers.InMethod(); 186 TestHelpers.InMethod();
182// TestHelpers.EnableLogging(); 187// TestHelpers.EnableLogging();
183 188
189 m_numberOfAttachEventsFired = 0;
190
184 Scene scene = CreateTestScene(); 191 Scene scene = CreateTestScene();
185 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); 192 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
186 ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1); 193 ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1);
@@ -189,6 +196,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
189 196
190 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID); 197 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID);
191 198
199 m_numberOfAttachEventsFired = 0;
192 scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, false); 200 scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, false);
193 201
194 // Check status on scene presence 202 // Check status on scene presence
@@ -216,7 +224,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
216 224
217 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); 225 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1));
218 226
219// TestHelpers.DisableLogging(); 227 // Check events
228
229 // FIXME: This is currently not occuring!
230// Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(1));
220 } 231 }
221 232
222 /// <summary> 233 /// <summary>
@@ -228,6 +239,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
228 TestHelpers.InMethod(); 239 TestHelpers.InMethod();
229// TestHelpers.EnableLogging(); 240// TestHelpers.EnableLogging();
230 241
242 m_numberOfAttachEventsFired = 0;
243
231 Scene scene = CreateTestScene(); 244 Scene scene = CreateTestScene();
232 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); 245 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
233 ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1); 246 ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1);
@@ -247,6 +260,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
247 260
248 Assert.That(sp.HasAttachments(), Is.False); 261 Assert.That(sp.HasAttachments(), Is.False);
249 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); 262 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1));
263
264 // Check events
265 Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0));
250 } 266 }
251 267
252 [Test] 268 [Test]
@@ -261,6 +277,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
261 277
262 InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20); 278 InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20);
263 279
280 m_numberOfAttachEventsFired = 0;
264 scene.AttachmentsModule.RezSingleAttachmentFromInventory( 281 scene.AttachmentsModule.RezSingleAttachmentFromInventory(
265 sp, attItem.ID, (uint)AttachmentPoint.Chest); 282 sp, attItem.ID, (uint)AttachmentPoint.Chest);
266 283
@@ -280,6 +297,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
280 Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest)); 297 Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest));
281 298
282 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); 299 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1));
300
301 // Check events
302 Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(1));
283 } 303 }
284 304
285 /// <summary> 305 /// <summary>
@@ -338,6 +358,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
338 ISceneEntity so 358 ISceneEntity so
339 = scene.AttachmentsModule.RezSingleAttachmentFromInventory( 359 = scene.AttachmentsModule.RezSingleAttachmentFromInventory(
340 sp, attItem.ID, (uint)AttachmentPoint.Chest); 360 sp, attItem.ID, (uint)AttachmentPoint.Chest);
361
362 m_numberOfAttachEventsFired = 0;
341 scene.AttachmentsModule.DetachSingleAttachmentToGround(sp, so.LocalId); 363 scene.AttachmentsModule.DetachSingleAttachmentToGround(sp, so.LocalId);
342 364
343 // Check scene presence status 365 // Check scene presence status
@@ -353,6 +375,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
353 375
354 // Check object in scene 376 // Check object in scene
355 Assert.That(scene.GetSceneObjectGroup("att"), Is.Not.Null); 377 Assert.That(scene.GetSceneObjectGroup("att"), Is.Not.Null);
378
379 // Check events
380 Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(1));
356 } 381 }
357 382
358 [Test] 383 [Test]
@@ -369,6 +394,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
369 SceneObjectGroup so 394 SceneObjectGroup so
370 = (SceneObjectGroup)scene.AttachmentsModule.RezSingleAttachmentFromInventory( 395 = (SceneObjectGroup)scene.AttachmentsModule.RezSingleAttachmentFromInventory(
371 sp, attItem.ID, (uint)AttachmentPoint.Chest); 396 sp, attItem.ID, (uint)AttachmentPoint.Chest);
397
398 m_numberOfAttachEventsFired = 0;
372 scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, so); 399 scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, so);
373 400
374 // Check status on scene presence 401 // Check status on scene presence
@@ -380,6 +407,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
380 Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo(0)); 407 Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo(0));
381 408
382 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(0)); 409 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(0));
410
411 // Check events
412 Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(1));
383 } 413 }
384 414
385 /// <summary> 415 /// <summary>
@@ -461,10 +491,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
461 491
462 SceneObjectGroup rezzedAtt = presence.GetAttachments()[0]; 492 SceneObjectGroup rezzedAtt = presence.GetAttachments()[0];
463 493
494 m_numberOfAttachEventsFired = 0;
464 scene.IncomingCloseAgent(presence.UUID, false); 495 scene.IncomingCloseAgent(presence.UUID, false);
465 496
466 // Check that we can't retrieve this attachment from the scene. 497 // Check that we can't retrieve this attachment from the scene.
467 Assert.That(scene.GetSceneObjectGroup(rezzedAtt.UUID), Is.Null); 498 Assert.That(scene.GetSceneObjectGroup(rezzedAtt.UUID), Is.Null);
499
500 // Check events
501 Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0));
468 } 502 }
469 503
470 [Test] 504 [Test]
@@ -480,6 +514,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
480 AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID); 514 AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID);
481 acd.Appearance = new AvatarAppearance(); 515 acd.Appearance = new AvatarAppearance();
482 acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID); 516 acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID);
517
518 m_numberOfAttachEventsFired = 0;
483 ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd); 519 ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd);
484 520
485 Assert.That(presence.HasAttachments(), Is.True); 521 Assert.That(presence.HasAttachments(), Is.True);
@@ -502,6 +538,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
502 Assert.That(presence.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest)); 538 Assert.That(presence.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest));
503 539
504 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); 540 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1));
541
542 // Check events. We expect OnAttach to fire on login.
543 Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(1));
505 } 544 }
506 545
507 [Test] 546 [Test]
@@ -522,10 +561,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
522 561
523 Vector3 newPosition = new Vector3(1, 2, 4); 562 Vector3 newPosition = new Vector3(1, 2, 4);
524 563
564 m_numberOfAttachEventsFired = 0;
525 scene.SceneGraph.UpdatePrimGroupPosition(attSo.LocalId, newPosition, sp.ControllingClient); 565 scene.SceneGraph.UpdatePrimGroupPosition(attSo.LocalId, newPosition, sp.ControllingClient);
526 566
527 Assert.That(attSo.AbsolutePosition, Is.EqualTo(sp.AbsolutePosition)); 567 Assert.That(attSo.AbsolutePosition, Is.EqualTo(sp.AbsolutePosition));
528 Assert.That(attSo.RootPart.AttachedPos, Is.EqualTo(newPosition)); 568 Assert.That(attSo.RootPart.AttachedPos, Is.EqualTo(newPosition));
569
570 // Check events
571 Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0));
529 } 572 }
530 573
531 [Test] 574 [Test]
@@ -574,6 +617,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
574 Vector3 teleportPosition = new Vector3(10, 11, 12); 617 Vector3 teleportPosition = new Vector3(10, 11, 12);
575 Vector3 teleportLookAt = new Vector3(20, 21, 22); 618 Vector3 teleportLookAt = new Vector3(20, 21, 22);
576 619
620 m_numberOfAttachEventsFired = 0;
577 sceneA.RequestTeleportLocation( 621 sceneA.RequestTeleportLocation(
578 beforeTeleportSp.ControllingClient, 622 beforeTeleportSp.ControllingClient,
579 sceneB.RegionInfo.RegionHandle, 623 sceneB.RegionInfo.RegionHandle,
@@ -616,29 +660,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
616 Assert.That(actualSceneAAttachments.Count, Is.EqualTo(0)); 660 Assert.That(actualSceneAAttachments.Count, Is.EqualTo(0));
617 661
618 Assert.That(sceneA.GetSceneObjectGroups().Count, Is.EqualTo(0)); 662 Assert.That(sceneA.GetSceneObjectGroups().Count, Is.EqualTo(0));
619 }
620 663
621 // I'm commenting this test because scene setup NEEDS InventoryService to 664 // Check events
622 // be non-null 665 Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0));
623 //[Test] 666 }
624// public void T032_CrossAttachments()
625// {
626// TestHelpers.InMethod();
627//
628// ScenePresence presence = scene.GetScenePresence(agent1);
629// ScenePresence presence2 = scene2.GetScenePresence(agent1);
630// presence2.AddAttachment(sog1);
631// presence2.AddAttachment(sog2);
632//
633// ISharedRegionModule serialiser = new SerialiserModule();
634// SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser);
635// SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser);
636//
637// Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross");
638//
639// //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful");
640// Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted");
641// Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects");
642// }
643 } 667 }
644} 668} \ No newline at end of file