From bd928218dd0845bb0aef46749e8a393d0a9e4fbc Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 7 Feb 2012 21:00:47 +0000
Subject: Add TestAddTaskInventoryItem()
---
.../Framework/Scenes/Tests/TaskInventoryTests.cs | 26 +++++++++++++++++++++-
.../Tests/Common/Helpers/TaskInventoryHelpers.cs | 12 +++++++---
2 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
index 1abef8d..e4b607d 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
@@ -53,6 +53,30 @@ namespace OpenSim.Region.Framework.Tests
public class TaskInventoryTests
{
[Test]
+ public void TestAddTaskInventoryItem()
+ {
+ TestHelpers.InMethod();
+// log4net.Config.XmlConfigurator.Configure();
+
+ Scene scene = SceneHelpers.SetupScene();
+ UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
+ SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID);
+ SceneObjectPart sop1 = sog1.RootPart;
+
+ // Create an object embedded inside the first
+ UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
+ TaskInventoryItem taskSceneObjectItem
+ = TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID);
+
+ TaskInventoryItem addedItem = sop1.Inventory.GetInventoryItem(taskSceneObjectItemId);
+ Assert.That(addedItem.ItemID, Is.EqualTo(taskSceneObjectItemId));
+ Assert.That(addedItem.OwnerID, Is.EqualTo(user1.PrincipalID));
+ Assert.That(addedItem.ParentID, Is.EqualTo(sop1.UUID));
+ Assert.That(addedItem.InvType, Is.EqualTo((int)InventoryType.Object));
+ Assert.That(addedItem.Type, Is.EqualTo((int)AssetType.Object));
+ }
+
+ [Test]
public void TestRezObjectFromInventoryItem()
{
TestHelpers.InMethod();
@@ -66,7 +90,7 @@ namespace OpenSim.Region.Framework.Tests
// Create an object embedded inside the first
UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
TaskInventoryItem taskSceneObjectItem
- = TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId);
+ = TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID);
scene.AddSceneObject(sog1);
diff --git a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
index a8f0d59..7058d1e 100644
--- a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
@@ -72,15 +72,21 @@ namespace OpenSim.Tests.Common
///
///
///
- public static TaskInventoryItem AddSceneObject(Scene scene, SceneObjectPart sop, string itemName, UUID id)
+ ///
+ public static TaskInventoryItem AddSceneObject(
+ Scene scene, SceneObjectPart sop, string itemName, UUID id, UUID userId)
{
SceneObjectGroup taskSceneObject = SceneHelpers.CreateSceneObject(1, UUID.Zero);
AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject);
scene.AssetService.Store(taskSceneObjectAsset);
TaskInventoryItem taskSceneObjectItem
= new TaskInventoryItem
- { Name = itemName, AssetID = taskSceneObjectAsset.FullID, ItemID = id,
- Type = (int)AssetType.Object, InvType = (int)InventoryType.Object };
+ { Name = itemName,
+ AssetID = taskSceneObjectAsset.FullID,
+ ItemID = id,
+ OwnerID = userId,
+ Type = (int)AssetType.Object,
+ InvType = (int)InventoryType.Object };
sop.Inventory.AddInventoryItem(taskSceneObjectItem, true);
return taskSceneObjectItem;
--
cgit v1.1