aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Tests
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-11-11 17:28:24 +0000
committerJustin Clark-Casey (justincc)2014-11-25 23:23:11 +0000
commit550cf714bc7e974064306956638f08e9b15c30b5 (patch)
tree3a6a91dc00cfe18b4620c10791bb25e0bf65b8f2 /OpenSim/Region/ScriptEngine/Shared/Tests
parentWhen processing incoming attachments via HG, if a request for uuid gathering ... (diff)
downloadopensim-SC-550cf714bc7e974064306956638f08e9b15c30b5.zip
opensim-SC-550cf714bc7e974064306956638f08e9b15c30b5.tar.gz
opensim-SC-550cf714bc7e974064306956638f08e9b15c30b5.tar.bz2
opensim-SC-550cf714bc7e974064306956638f08e9b15c30b5.tar.xz
Fix issue where llRemoteLoadScriptPin() would treat 0 (the default) as a valid set pin in a destination prim rather than the unset no pin state
Adds regression test for this case.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Tests')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs47
1 files changed, 47 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
index 6afe551..eb91bc3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
@@ -237,5 +237,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
237 Assert.IsNotNull(receivedItem); 237 Assert.IsNotNull(receivedItem);
238 Assert.AreEqual(0, receivedItem.CurrentPermissions & (uint)PermissionMask.Modify); 238 Assert.AreEqual(0, receivedItem.CurrentPermissions & (uint)PermissionMask.Modify);
239 } 239 }
240
241 [Test]
242 public void TestLlRemoteLoadScriptPin()
243 {
244 TestHelpers.InMethod();
245// TestHelpers.EnableLogging();
246
247 UUID user1Id = TestHelpers.ParseTail(0x1);
248 UUID user2Id = TestHelpers.ParseTail(0x2);
249
250 SceneObjectGroup sourceSo = SceneHelpers.AddSceneObject((m_scene, "sourceSo", user1Id);
251 m_scene.AddSceneObject(sourceSo);
252 LSL_Api api = new LSL_Api();
253 api.Initialize(m_engine, sourceSo.RootPart, null, null);
254 TaskInventoryHelpers.AddScript(m_scene, sourceSo.RootPart, "script", "Hello World");
255
256 SceneObjectGroup targetSo = SceneHelpers.AddSceneObject(m_scene, "targetSo", user1Id);
257 SceneObjectGroup otherOwnedTargetSo = SceneHelpers.AddSceneObject(m_scene, "otherOwnedTargetSo", user2Id);
258
259 // Test that we cannot load a script when the target pin has never been set (i.e. it is zero)
260 api.llRemoteLoadScriptPin(targetSo.UUID.ToString(), "script", 0, 0, 0);
261 Assert.IsNull(targetSo.RootPart.Inventory.GetInventoryItem("script"));
262
263 // Test that we cannot load a script when the given pin does not match the target
264 targetSo.RootPart.ScriptAccessPin = 5;
265 api.llRemoteLoadScriptPin(targetSo.UUID.ToString(), "script", 3, 0, 0);
266 Assert.IsNull(targetSo.RootPart.Inventory.GetInventoryItem("script"));
267
268 // Test that we cannot load into a prim with a different owner
269 otherOwnedTargetSo.RootPart.ScriptAccessPin = 3;
270 api.llRemoteLoadScriptPin(otherOwnedTargetSo.UUID.ToString(), "script", 3, 0, 0);
271 Assert.IsNull(otherOwnedTargetSo.RootPart.Inventory.GetInventoryItem("script"));
272
273 // Test that we can load a script when given pin and dest pin match.
274 targetSo.RootPart.ScriptAccessPin = 3;
275 api.llRemoteLoadScriptPin(targetSo.UUID.ToString(), "script", 3, 0, 0);
276 TaskInventoryItem insertedItem = targetSo.RootPart.Inventory.GetInventoryItem("script");
277 Assert.IsNotNull(insertedItem);
278
279 // Test that we can no longer load if access pin is unset
280 targetSo.RootPart.Inventory.RemoveInventoryItem(insertedItem.ItemID);
281 Assert.IsNull(targetSo.RootPart.Inventory.GetInventoryItem("script"));
282
283 targetSo.RootPart.ScriptAccessPin = 0;
284 api.llRemoteLoadScriptPin(otherOwnedTargetSo.UUID.ToString(), "script", 3, 0, 0);
285 Assert.IsNull(otherOwnedTargetSo.RootPart.Inventory.GetInventoryItem("script"));
286 }
240 } 287 }
241} \ No newline at end of file 288} \ No newline at end of file