aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs48
1 files changed, 48 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
index 37caa5d..1ad0a99 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
@@ -238,5 +238,53 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
238 Assert.IsNotNull(receivedItem); 238 Assert.IsNotNull(receivedItem);
239 Assert.AreEqual(0, receivedItem.CurrentPermissions & (uint)PermissionMask.Modify); 239 Assert.AreEqual(0, receivedItem.CurrentPermissions & (uint)PermissionMask.Modify);
240 } 240 }
241
242 [Test]
243 public void TestLlRemoteLoadScriptPin()
244 {
245 TestHelpers.InMethod();
246// TestHelpers.EnableLogging();
247
248 UUID user1Id = TestHelpers.ParseTail(0x1);
249 UUID user2Id = TestHelpers.ParseTail(0x2);
250
251 SceneObjectGroup sourceSo = SceneHelpers.AddSceneObject(m_scene, 1, user1Id, "sourceSo", 0x10);
252 m_scene.AddSceneObject(sourceSo);
253 LSL_Api api = new LSL_Api();
254 api.Initialize(m_engine, sourceSo.RootPart, null, null);
255 TaskInventoryHelpers.AddScript(m_scene, sourceSo.RootPart, "script", "Hello World");
256
257 SceneObjectGroup targetSo = SceneHelpers.AddSceneObject(m_scene, 1, user1Id, "targetSo", 0x20);
258 SceneObjectGroup otherOwnedTargetSo
259 = SceneHelpers.AddSceneObject(m_scene, 1, user2Id, "otherOwnedTargetSo", 0x30);
260
261 // Test that we cannot load a script when the target pin has never been set (i.e. it is zero)
262 api.llRemoteLoadScriptPin(targetSo.UUID.ToString(), "script", 0, 0, 0);
263 Assert.IsNull(targetSo.RootPart.Inventory.GetInventoryItem("script"));
264
265 // Test that we cannot load a script when the given pin does not match the target
266 targetSo.RootPart.ScriptAccessPin = 5;
267 api.llRemoteLoadScriptPin(targetSo.UUID.ToString(), "script", 3, 0, 0);
268 Assert.IsNull(targetSo.RootPart.Inventory.GetInventoryItem("script"));
269
270 // Test that we cannot load into a prim with a different owner
271 otherOwnedTargetSo.RootPart.ScriptAccessPin = 3;
272 api.llRemoteLoadScriptPin(otherOwnedTargetSo.UUID.ToString(), "script", 3, 0, 0);
273 Assert.IsNull(otherOwnedTargetSo.RootPart.Inventory.GetInventoryItem("script"));
274
275 // Test that we can load a script when given pin and dest pin match.
276 targetSo.RootPart.ScriptAccessPin = 3;
277 api.llRemoteLoadScriptPin(targetSo.UUID.ToString(), "script", 3, 0, 0);
278 TaskInventoryItem insertedItem = targetSo.RootPart.Inventory.GetInventoryItem("script");
279 Assert.IsNotNull(insertedItem);
280
281 // Test that we can no longer load if access pin is unset
282 targetSo.RootPart.Inventory.RemoveInventoryItem(insertedItem.ItemID);
283 Assert.IsNull(targetSo.RootPart.Inventory.GetInventoryItem("script"));
284
285 targetSo.RootPart.ScriptAccessPin = 0;
286 api.llRemoteLoadScriptPin(otherOwnedTargetSo.UUID.ToString(), "script", 3, 0, 0);
287 Assert.IsNull(otherOwnedTargetSo.RootPart.Inventory.GetInventoryItem("script"));
288 }
241 } 289 }
242} \ No newline at end of file 290} \ No newline at end of file