aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs22
1 files changed, 19 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index 8d2128c..8337345 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -291,21 +291,37 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
291 { 291 {
292 TestHelpers.InMethod(); 292 TestHelpers.InMethod();
293 293
294 Scene scene = CreateTestScene(); 294 Scene scene = CreateScriptingEnabledTestScene();
295 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); 295 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
296 ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID); 296 ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1);
297 297
298 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10); 298 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10);
299 TaskInventoryHelpers.AddScript(scene, so.RootPart); 299 TaskInventoryItem scriptItem
300 = TaskInventoryHelpers.AddScript(
301 scene,
302 so.RootPart,
303 "scriptItem",
304 "default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }");
305
300 InventoryItemBase userItem = UserInventoryHelpers.AddInventoryItem(scene, so, 0x100, 0x1000); 306 InventoryItemBase userItem = UserInventoryHelpers.AddInventoryItem(scene, so, 0x100, 0x1000);
301 307
308 // FIXME: Right now, we have to do a tricksy chat listen to make sure we know when the script is running.
309 // In the future, we need to be able to do this programatically more predicably.
310 scene.EventManager.OnChatFromWorld += OnChatFromWorld;
311
302 scene.AttachmentsModule.RezSingleAttachmentFromInventory(sp, userItem.ID, (uint)AttachmentPoint.Chest); 312 scene.AttachmentsModule.RezSingleAttachmentFromInventory(sp, userItem.ID, (uint)AttachmentPoint.Chest);
303 313
314 m_chatEvent.WaitOne(60000);
315
304 // TODO: Need to have a test that checks the script is actually started but this involves a lot more 316 // TODO: Need to have a test that checks the script is actually started but this involves a lot more
305 // plumbing of the script engine and either pausing for events or more infrastructure to turn off various 317 // plumbing of the script engine and either pausing for events or more infrastructure to turn off various
306 // script engine delays/asychronicity that isn't helpful in an automated regression testing context. 318 // script engine delays/asychronicity that isn't helpful in an automated regression testing context.
307 SceneObjectGroup attSo = scene.GetSceneObjectGroup(so.Name); 319 SceneObjectGroup attSo = scene.GetSceneObjectGroup(so.Name);
308 Assert.That(attSo.ContainsScripts(), Is.True); 320 Assert.That(attSo.ContainsScripts(), Is.True);
321
322 TaskInventoryItem reRezzedScriptItem = attSo.RootPart.Inventory.GetInventoryItem(scriptItem.Name);
323 IScriptModule xengine = scene.RequestModuleInterface<IScriptModule>();
324 Assert.That(xengine.GetScriptState(reRezzedScriptItem.ItemID), Is.True);
309 } 325 }
310 326
311 [Test] 327 [Test]