diff options
Diffstat (limited to 'OpenSim/Tests/Common/Helpers')
-rw-r--r-- | OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs index fba03ab..0a2b30a 100644 --- a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs | |||
@@ -80,8 +80,26 @@ namespace OpenSim.Tests.Common | |||
80 | /// <returns>The item that was added</returns> | 80 | /// <returns>The item that was added</returns> |
81 | public static TaskInventoryItem AddScript(Scene scene, SceneObjectPart part) | 81 | public static TaskInventoryItem AddScript(Scene scene, SceneObjectPart part) |
82 | { | 82 | { |
83 | return AddScript(scene, part, "scriptItem", "default { state_entry() { llSay(0, \"Hello World\"); } }"); | ||
84 | } | ||
85 | |||
86 | /// <summary> | ||
87 | /// Add a simple script to the given part. | ||
88 | /// </summary> | ||
89 | /// <remarks> | ||
90 | /// TODO: Accept input for item and asset IDs to avoid mysterious script failures that try to use any of these | ||
91 | /// functions more than once in a test. | ||
92 | /// </remarks> | ||
93 | /// <param name="scene"></param> | ||
94 | /// <param name="part"></param> | ||
95 | /// <param name="scriptName">Name of the script to add</param> | ||
96 | /// <param name="scriptSource">LSL script source</param> | ||
97 | /// <returns>The item that was added</returns> | ||
98 | public static TaskInventoryItem AddScript( | ||
99 | Scene scene, SceneObjectPart part, string scriptName, string scriptSource) | ||
100 | { | ||
83 | AssetScriptText ast = new AssetScriptText(); | 101 | AssetScriptText ast = new AssetScriptText(); |
84 | ast.Source = "default { state_entry() { llSay(0, \"Hello World\"); } }"; | 102 | ast.Source = scriptSource; |
85 | ast.Encode(); | 103 | ast.Encode(); |
86 | 104 | ||
87 | UUID assetUuid = new UUID("00000000-0000-0000-1000-000000000000"); | 105 | UUID assetUuid = new UUID("00000000-0000-0000-1000-000000000000"); |
@@ -91,7 +109,7 @@ namespace OpenSim.Tests.Common | |||
91 | scene.AssetService.Store(asset); | 109 | scene.AssetService.Store(asset); |
92 | TaskInventoryItem item | 110 | TaskInventoryItem item |
93 | = new TaskInventoryItem | 111 | = new TaskInventoryItem |
94 | { Name = "scriptItem", AssetID = assetUuid, ItemID = itemUuid, | 112 | { Name = scriptName, AssetID = assetUuid, ItemID = itemUuid, |
95 | Type = (int)AssetType.LSLText, InvType = (int)InventoryType.LSL }; | 113 | Type = (int)AssetType.LSLText, InvType = (int)InventoryType.LSL }; |
96 | part.Inventory.AddInventoryItem(item, true); | 114 | part.Inventory.AddInventoryItem(item, true); |
97 | 115 | ||