aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-10-16 19:54:40 +0100
committerJustin Clark-Casey2014-10-16 20:18:20 +0100
commitddda314f14b678bc4629836002f0f32be93453e9 (patch)
treee6e88f86295398400e1d3023e14b1de6709edbae
parentFix transferring inventory from prims to agent inventory (diff)
downloadopensim-SC-ddda314f14b678bc4629836002f0f32be93453e9.zip
opensim-SC-ddda314f14b678bc4629836002f0f32be93453e9.tar.gz
opensim-SC-ddda314f14b678bc4629836002f0f32be93453e9.tar.bz2
opensim-SC-ddda314f14b678bc4629836002f0f32be93453e9.tar.xz
Add some more llGiveInventory() regression tests
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs71
1 files changed, 71 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
index 6dd6c17..37caa5d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
@@ -45,6 +45,7 @@ using OpenSim.Region.ScriptEngine.Shared.Instance;
45using OpenSim.Services.Interfaces; 45using OpenSim.Services.Interfaces;
46using OpenSim.Tests.Common; 46using OpenSim.Tests.Common;
47using OpenSim.Tests.Common.Mock; 47using OpenSim.Tests.Common.Mock;
48using PermissionMask = OpenSim.Framework.PermissionMask;
48 49
49namespace OpenSim.Region.ScriptEngine.Shared.Tests 50namespace OpenSim.Region.ScriptEngine.Shared.Tests
50{ 51{
@@ -167,5 +168,75 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
167 Assert.That(copiedItems[0].Name, Is.EqualTo(inventoryItemName)); 168 Assert.That(copiedItems[0].Name, Is.EqualTo(inventoryItemName));
168 } 169 }
169 } 170 }
171
172 /// <summary>
173 /// Test giving inventory from an object to an avatar that is not the object's owner.
174 /// </summary>
175 [Test]
176 public void TestLlGiveInventoryO2DifferentAvatar()
177 {
178 TestHelpers.InMethod();
179 // TestHelpers.EnableLogging();
180
181 UUID user1Id = TestHelpers.ParseTail(0x1);
182 UUID user2Id = TestHelpers.ParseTail(0x2);
183 string inventoryItemName = "item1";
184
185 SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
186 m_scene.AddSceneObject(so1);
187 LSL_Api api = new LSL_Api();
188 api.Initialize(m_engine, so1.RootPart, null, null);
189
190 // Create an object embedded inside the first
191 UUID itemId = TestHelpers.ParseTail(0x20);
192 TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, user1Id);
193
194 UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id);
195
196 api.llGiveInventory(user2Id.ToString(), inventoryItemName);
197
198 InventoryItemBase receivedItem
199 = UserInventoryHelpers.GetInventoryItem(
200 m_scene.InventoryService, user2Id, string.Format("Objects/{0}", inventoryItemName));
201
202 Assert.IsNotNull(receivedItem);
203 }
204
205 /// <summary>
206 /// Test giving inventory from an object to an avatar that is not the object's owner and where the next
207 /// permissions do not include mod.
208 /// </summary>
209 [Test]
210 public void TestLlGiveInventoryO2DifferentAvatarNoMod()
211 {
212 TestHelpers.InMethod();
213// TestHelpers.EnableLogging();
214
215 UUID user1Id = TestHelpers.ParseTail(0x1);
216 UUID user2Id = TestHelpers.ParseTail(0x2);
217 string inventoryItemName = "item1";
218
219 SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
220 m_scene.AddSceneObject(so1);
221 LSL_Api api = new LSL_Api();
222 api.Initialize(m_engine, so1.RootPart, null, null);
223
224 // Create an object embedded inside the first
225 UUID itemId = TestHelpers.ParseTail(0x20);
226 TaskInventoryItem tii
227 = TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, user1Id);
228 tii.NextPermissions &= ~((uint)PermissionMask.Modify);
229
230 UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id);
231
232 api.llGiveInventory(user2Id.ToString(), inventoryItemName);
233
234 InventoryItemBase receivedItem
235 = UserInventoryHelpers.GetInventoryItem(
236 m_scene.InventoryService, user2Id, string.Format("Objects/{0}", inventoryItemName));
237
238 Assert.IsNotNull(receivedItem);
239 Assert.AreEqual(0, receivedItem.CurrentPermissions & (uint)PermissionMask.Modify);
240 }
170 } 241 }
171} \ No newline at end of file 242} \ No newline at end of file