diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs | 49 |
1 files changed, 1 insertions, 48 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs index 1966e5a..6afe551 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs | |||
@@ -44,6 +44,7 @@ using OpenSim.Region.ScriptEngine.Shared.Api; | |||
44 | using OpenSim.Region.ScriptEngine.Shared.Instance; | 44 | using OpenSim.Region.ScriptEngine.Shared.Instance; |
45 | using OpenSim.Services.Interfaces; | 45 | using OpenSim.Services.Interfaces; |
46 | using OpenSim.Tests.Common; | 46 | using OpenSim.Tests.Common; |
47 | using PermissionMask = OpenSim.Framework.PermissionMask; | ||
47 | 48 | ||
48 | namespace OpenSim.Region.ScriptEngine.Shared.Tests | 49 | namespace OpenSim.Region.ScriptEngine.Shared.Tests |
49 | { | 50 | { |
@@ -236,53 +237,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
236 | Assert.IsNotNull(receivedItem); | 237 | Assert.IsNotNull(receivedItem); |
237 | Assert.AreEqual(0, receivedItem.CurrentPermissions & (uint)PermissionMask.Modify); | 238 | Assert.AreEqual(0, receivedItem.CurrentPermissions & (uint)PermissionMask.Modify); |
238 | } | 239 | } |
239 | |||
240 | [Test] | ||
241 | public void TestLlRemoteLoadScriptPin() | ||
242 | { | ||
243 | TestHelpers.InMethod(); | ||
244 | // TestHelpers.EnableLogging(); | ||
245 | |||
246 | UUID user1Id = TestHelpers.ParseTail(0x1); | ||
247 | UUID user2Id = TestHelpers.ParseTail(0x2); | ||
248 | |||
249 | SceneObjectGroup sourceSo = SceneHelpers.AddSceneObject(m_scene, 1, user1Id, "sourceSo", 0x10); | ||
250 | m_scene.AddSceneObject(sourceSo); | ||
251 | LSL_Api api = new LSL_Api(); | ||
252 | api.Initialize(m_engine, sourceSo.RootPart, null, null); | ||
253 | TaskInventoryHelpers.AddScript(m_scene, sourceSo.RootPart, "script", "Hello World"); | ||
254 | |||
255 | SceneObjectGroup targetSo = SceneHelpers.AddSceneObject(m_scene, 1, user1Id, "targetSo", 0x20); | ||
256 | SceneObjectGroup otherOwnedTargetSo | ||
257 | = SceneHelpers.AddSceneObject(m_scene, 1, user2Id, "otherOwnedTargetSo", 0x30); | ||
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 | } | ||
287 | } | 240 | } |
288 | } \ No newline at end of file | 241 | } \ No newline at end of file |