diff options
Diffstat (limited to 'OpenSim/Tests/Common/Helpers')
-rw-r--r-- | OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs index bb4b55f..b4bd50b 100644 --- a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs | |||
@@ -117,25 +117,43 @@ namespace OpenSim.Tests.Common | |||
117 | public static TaskInventoryItem AddScript( | 117 | public static TaskInventoryItem AddScript( |
118 | Scene scene, SceneObjectPart part, string scriptName, string scriptSource) | 118 | Scene scene, SceneObjectPart part, string scriptName, string scriptSource) |
119 | { | 119 | { |
120 | return AddScript(scene, part, UUID.Random(), UUID.Random(), scriptName, scriptSource); | ||
121 | } | ||
122 | |||
123 | /// <summary> | ||
124 | /// Add a simple script to the given part. | ||
125 | /// </summary> | ||
126 | /// <remarks> | ||
127 | /// TODO: Accept input for item and asset IDs so that we have completely replicatable regression tests rather | ||
128 | /// than a random component. | ||
129 | /// </remarks> | ||
130 | /// <param name="scene"></param> | ||
131 | /// <param name="part"></param> | ||
132 | /// <param name="itemId">Item UUID for the script</param> | ||
133 | /// <param name="assetId">Asset UUID for the script</param> | ||
134 | /// <param name="scriptName">Name of the script to add</param> | ||
135 | /// <param name="scriptSource">LSL script source</param> | ||
136 | /// <returns>The item that was added</returns> | ||
137 | public static TaskInventoryItem AddScript( | ||
138 | Scene scene, SceneObjectPart part, UUID itemId, UUID assetId, string scriptName, string scriptSource) | ||
139 | { | ||
120 | AssetScriptText ast = new AssetScriptText(); | 140 | AssetScriptText ast = new AssetScriptText(); |
121 | ast.Source = scriptSource; | 141 | ast.Source = scriptSource; |
122 | ast.Encode(); | 142 | ast.Encode(); |
123 | 143 | ||
124 | UUID assetUuid = UUID.Random(); | ||
125 | UUID itemUuid = UUID.Random(); | ||
126 | |||
127 | AssetBase asset | 144 | AssetBase asset |
128 | = AssetHelpers.CreateAsset(assetUuid, AssetType.LSLText, ast.AssetData, UUID.Zero); | 145 | = AssetHelpers.CreateAsset(assetId, AssetType.LSLText, ast.AssetData, UUID.Zero); |
129 | scene.AssetService.Store(asset); | 146 | scene.AssetService.Store(asset); |
130 | TaskInventoryItem item | 147 | TaskInventoryItem item |
131 | = new TaskInventoryItem | 148 | = new TaskInventoryItem |
132 | { Name = scriptName, AssetID = assetUuid, ItemID = itemUuid, | 149 | { Name = scriptName, AssetID = assetId, ItemID = itemId, |
133 | Type = (int)AssetType.LSLText, InvType = (int)InventoryType.LSL }; | 150 | Type = (int)AssetType.LSLText, InvType = (int)InventoryType.LSL }; |
134 | part.Inventory.AddInventoryItem(item, true); | 151 | part.Inventory.AddInventoryItem(item, true); |
135 | 152 | ||
136 | return item; | 153 | return item; |
137 | } | 154 | } |
138 | 155 | ||
156 | |||
139 | /// <summary> | 157 | /// <summary> |
140 | /// Add a scene object item to the given part. | 158 | /// Add a scene object item to the given part. |
141 | /// </summary> | 159 | /// </summary> |