refactor: move scene object item creation code into TaskInventoryHelpers

bulletsim
Justin Clark-Casey (justincc) 2011-05-21 00:37:20 +01:00
parent 9103fe84d5
commit 084059319c
2 changed files with 24 additions and 9 deletions

View File

@ -66,15 +66,8 @@ namespace OpenSim.Region.Framework.Tests
// Create an object embedded inside the first
UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
SceneObjectGroup taskSceneObject = SceneSetupHelpers.CreateSceneObject(1, UUID.Zero);
AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject);
scene.AssetService.Store(taskSceneObjectAsset);
TaskInventoryItem taskSceneObjectItem
= new TaskInventoryItem
{ Name = "tso", AssetID = taskSceneObjectAsset.FullID, ItemID = taskSceneObjectItemId,
Type = (int)AssetType.Object, InvType = (int)InventoryType.Object };
sop1.Inventory.AddInventoryItem(taskSceneObjectItem, true);
= TaskInventoryHelpers.AddSceneObjectItem(scene, sop1, "tso", taskSceneObjectItemId);
scene.AddSceneObject(sog1);
@ -114,6 +107,7 @@ namespace OpenSim.Region.Framework.Tests
SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID);
SceneObjectPart sop1 = sog1.RootPart;
TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1);
InventoryFolderBase folder
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0];

View File

@ -32,7 +32,7 @@ using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
namespace OpenSim.Tests.Common
namespace OpenSim.Tests.Common.Setup
{
/// <summary>
/// Utility functions for carrying out task inventory tests.
@ -64,5 +64,26 @@ namespace OpenSim.Tests.Common
return ncItem;
}
/// <summary>
/// Add a scene object item to the given part.
/// </summary>
/// <param name="scene"></param>
/// <param name="sop"></param>
/// <param name="itemName"></param>
/// <param name="id"></param>
public static TaskInventoryItem AddSceneObjectItem(Scene scene, SceneObjectPart sop, string itemName, UUID id)
{
SceneObjectGroup taskSceneObject = SceneSetupHelpers.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 };
sop.Inventory.AddInventoryItem(taskSceneObjectItem, true);
return taskSceneObjectItem;
}
}
}