diff options
author | Justin Clark-Casey (justincc) | 2011-05-21 00:37:20 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-05-21 00:37:20 +0100 |
commit | 084059319c125983ac43534797282ddec394cb59 (patch) | |
tree | eec520169cf04dc35a8931941372ec543eef3388 /OpenSim | |
parent | move test task inventory notecard item creation into a new TastInventoryHelpe... (diff) | |
download | opensim-SC-084059319c125983ac43534797282ddec394cb59.zip opensim-SC-084059319c125983ac43534797282ddec394cb59.tar.gz opensim-SC-084059319c125983ac43534797282ddec394cb59.tar.bz2 opensim-SC-084059319c125983ac43534797282ddec394cb59.tar.xz |
refactor: move scene object item creation code into TaskInventoryHelpers
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs | 10 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Setup/TaskInventoryHelpers.cs | 23 |
2 files changed, 24 insertions, 9 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index 1c8f078..32bb068 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs | |||
@@ -66,15 +66,8 @@ namespace OpenSim.Region.Framework.Tests | |||
66 | 66 | ||
67 | // Create an object embedded inside the first | 67 | // Create an object embedded inside the first |
68 | UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); | 68 | UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); |
69 | |||
70 | SceneObjectGroup taskSceneObject = SceneSetupHelpers.CreateSceneObject(1, UUID.Zero); | ||
71 | AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject); | ||
72 | scene.AssetService.Store(taskSceneObjectAsset); | ||
73 | TaskInventoryItem taskSceneObjectItem | 69 | TaskInventoryItem taskSceneObjectItem |
74 | = new TaskInventoryItem | 70 | = TaskInventoryHelpers.AddSceneObjectItem(scene, sop1, "tso", taskSceneObjectItemId); |
75 | { Name = "tso", AssetID = taskSceneObjectAsset.FullID, ItemID = taskSceneObjectItemId, | ||
76 | Type = (int)AssetType.Object, InvType = (int)InventoryType.Object }; | ||
77 | sop1.Inventory.AddInventoryItem(taskSceneObjectItem, true); | ||
78 | 71 | ||
79 | scene.AddSceneObject(sog1); | 72 | scene.AddSceneObject(sog1); |
80 | 73 | ||
@@ -114,6 +107,7 @@ namespace OpenSim.Region.Framework.Tests | |||
114 | SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); | 107 | SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); |
115 | SceneObjectPart sop1 = sog1.RootPart; | 108 | SceneObjectPart sop1 = sog1.RootPart; |
116 | TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1); | 109 | TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1); |
110 | |||
117 | InventoryFolderBase folder | 111 | InventoryFolderBase folder |
118 | = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; | 112 | = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; |
119 | 113 | ||
diff --git a/OpenSim/Tests/Common/Setup/TaskInventoryHelpers.cs b/OpenSim/Tests/Common/Setup/TaskInventoryHelpers.cs index 48724f4..4467573 100644 --- a/OpenSim/Tests/Common/Setup/TaskInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Setup/TaskInventoryHelpers.cs | |||
@@ -32,7 +32,7 @@ using OpenSim.Framework; | |||
32 | using OpenSim.Region.Framework.Scenes; | 32 | using OpenSim.Region.Framework.Scenes; |
33 | using OpenSim.Services.Interfaces; | 33 | using OpenSim.Services.Interfaces; |
34 | 34 | ||
35 | namespace OpenSim.Tests.Common | 35 | namespace OpenSim.Tests.Common.Setup |
36 | { | 36 | { |
37 | /// <summary> | 37 | /// <summary> |
38 | /// Utility functions for carrying out task inventory tests. | 38 | /// Utility functions for carrying out task inventory tests. |
@@ -64,5 +64,26 @@ namespace OpenSim.Tests.Common | |||
64 | 64 | ||
65 | return ncItem; | 65 | return ncItem; |
66 | } | 66 | } |
67 | |||
68 | /// <summary> | ||
69 | /// Add a scene object item to the given part. | ||
70 | /// </summary> | ||
71 | /// <param name="scene"></param> | ||
72 | /// <param name="sop"></param> | ||
73 | /// <param name="itemName"></param> | ||
74 | /// <param name="id"></param> | ||
75 | public static TaskInventoryItem AddSceneObjectItem(Scene scene, SceneObjectPart sop, string itemName, UUID id) | ||
76 | { | ||
77 | SceneObjectGroup taskSceneObject = SceneSetupHelpers.CreateSceneObject(1, UUID.Zero); | ||
78 | AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject); | ||
79 | scene.AssetService.Store(taskSceneObjectAsset); | ||
80 | TaskInventoryItem taskSceneObjectItem | ||
81 | = new TaskInventoryItem | ||
82 | { Name = itemName, AssetID = taskSceneObjectAsset.FullID, ItemID = id, | ||
83 | Type = (int)AssetType.Object, InvType = (int)InventoryType.Object }; | ||
84 | sop.Inventory.AddInventoryItem(taskSceneObjectItem, true); | ||
85 | |||
86 | return taskSceneObjectItem; | ||
87 | } | ||
67 | } | 88 | } |
68 | } \ No newline at end of file | 89 | } \ No newline at end of file |