Add TestAddTaskInventoryItem()

iar_mods
Justin Clark-Casey (justincc) 2012-02-07 21:00:47 +00:00
parent 773994723a
commit bd928218dd
2 changed files with 34 additions and 4 deletions

View File

@ -52,6 +52,30 @@ namespace OpenSim.Region.Framework.Tests
[TestFixture]
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()
{
@ -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);

View File

@ -72,15 +72,21 @@ namespace OpenSim.Tests.Common
/// <param name="sop"></param>
/// <param name="itemName"></param>
/// <param name="id"></param>
public static TaskInventoryItem AddSceneObject(Scene scene, SceneObjectPart sop, string itemName, UUID id)
/// <param name="userId"></param>
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;