Add TestAddTaskInventoryItem()
parent
773994723a
commit
bd928218dd
|
@ -52,6 +52,30 @@ namespace OpenSim.Region.Framework.Tests
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TaskInventoryTests
|
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]
|
[Test]
|
||||||
public void TestRezObjectFromInventoryItem()
|
public void TestRezObjectFromInventoryItem()
|
||||||
{
|
{
|
||||||
|
@ -66,7 +90,7 @@ namespace OpenSim.Region.Framework.Tests
|
||||||
// Create an object embedded inside the first
|
// Create an object embedded inside the first
|
||||||
UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
|
UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
|
||||||
TaskInventoryItem taskSceneObjectItem
|
TaskInventoryItem taskSceneObjectItem
|
||||||
= TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId);
|
= TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID);
|
||||||
|
|
||||||
scene.AddSceneObject(sog1);
|
scene.AddSceneObject(sog1);
|
||||||
|
|
||||||
|
|
|
@ -72,15 +72,21 @@ namespace OpenSim.Tests.Common
|
||||||
/// <param name="sop"></param>
|
/// <param name="sop"></param>
|
||||||
/// <param name="itemName"></param>
|
/// <param name="itemName"></param>
|
||||||
/// <param name="id"></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);
|
SceneObjectGroup taskSceneObject = SceneHelpers.CreateSceneObject(1, UUID.Zero);
|
||||||
AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject);
|
AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject);
|
||||||
scene.AssetService.Store(taskSceneObjectAsset);
|
scene.AssetService.Store(taskSceneObjectAsset);
|
||||||
TaskInventoryItem taskSceneObjectItem
|
TaskInventoryItem taskSceneObjectItem
|
||||||
= new TaskInventoryItem
|
= new TaskInventoryItem
|
||||||
{ Name = itemName, AssetID = taskSceneObjectAsset.FullID, ItemID = id,
|
{ Name = itemName,
|
||||||
Type = (int)AssetType.Object, InvType = (int)InventoryType.Object };
|
AssetID = taskSceneObjectAsset.FullID,
|
||||||
|
ItemID = id,
|
||||||
|
OwnerID = userId,
|
||||||
|
Type = (int)AssetType.Object,
|
||||||
|
InvType = (int)InventoryType.Object };
|
||||||
sop.Inventory.AddInventoryItem(taskSceneObjectItem, true);
|
sop.Inventory.AddInventoryItem(taskSceneObjectItem, true);
|
||||||
|
|
||||||
return taskSceneObjectItem;
|
return taskSceneObjectItem;
|
||||||
|
|
Loading…
Reference in New Issue