diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs | 48 |
1 files changed, 43 insertions, 5 deletions
diff --git a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs index 7058d1e..fba03ab 100644 --- a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs | |||
@@ -45,20 +45,23 @@ namespace OpenSim.Tests.Common | |||
45 | /// </summary> | 45 | /// </summary> |
46 | /// <param name="scene"></param> | 46 | /// <param name="scene"></param> |
47 | /// <param name="part"></param> | 47 | /// <param name="part"></param> |
48 | /// <param name="itemName"></param> | ||
49 | /// <param name="itemID"></param> | ||
50 | /// <param name="assetID"></param> | ||
48 | /// <returns>The item that was added</returns> | 51 | /// <returns>The item that was added</returns> |
49 | public static TaskInventoryItem AddNotecard(Scene scene, SceneObjectPart part) | 52 | public static TaskInventoryItem AddNotecard(Scene scene, SceneObjectPart part, string itemName, UUID itemID, UUID assetID) |
50 | { | 53 | { |
51 | AssetNotecard nc = new AssetNotecard(); | 54 | AssetNotecard nc = new AssetNotecard(); |
52 | nc.BodyText = "Hello World!"; | 55 | nc.BodyText = "Hello World!"; |
53 | nc.Encode(); | 56 | nc.Encode(); |
54 | UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); | 57 | |
55 | UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); | ||
56 | AssetBase ncAsset | 58 | AssetBase ncAsset |
57 | = AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero); | 59 | = AssetHelpers.CreateAsset(assetID, AssetType.Notecard, nc.AssetData, UUID.Zero); |
58 | scene.AssetService.Store(ncAsset); | 60 | scene.AssetService.Store(ncAsset); |
61 | |||
59 | TaskInventoryItem ncItem | 62 | TaskInventoryItem ncItem |
60 | = new TaskInventoryItem | 63 | = new TaskInventoryItem |
61 | { Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid, | 64 | { Name = itemName, AssetID = assetID, ItemID = itemID, |
62 | Type = (int)AssetType.Notecard, InvType = (int)InventoryType.Notecard }; | 65 | Type = (int)AssetType.Notecard, InvType = (int)InventoryType.Notecard }; |
63 | part.Inventory.AddInventoryItem(ncItem, true); | 66 | part.Inventory.AddInventoryItem(ncItem, true); |
64 | 67 | ||
@@ -66,8 +69,43 @@ namespace OpenSim.Tests.Common | |||
66 | } | 69 | } |
67 | 70 | ||
68 | /// <summary> | 71 | /// <summary> |
72 | /// Add a simple script to the given part. | ||
73 | /// </summary> | ||
74 | /// <remarks> | ||
75 | /// TODO: Accept input for item and asset IDs to avoid mysterious script failures that try to use any of these | ||
76 | /// functions more than once in a test. | ||
77 | /// </remarks> | ||
78 | /// <param name="scene"></param> | ||
79 | /// <param name="part"></param> | ||
80 | /// <returns>The item that was added</returns> | ||
81 | public static TaskInventoryItem AddScript(Scene scene, SceneObjectPart part) | ||
82 | { | ||
83 | AssetScriptText ast = new AssetScriptText(); | ||
84 | ast.Source = "default { state_entry() { llSay(0, \"Hello World\"); } }"; | ||
85 | ast.Encode(); | ||
86 | |||
87 | UUID assetUuid = new UUID("00000000-0000-0000-1000-000000000000"); | ||
88 | UUID itemUuid = new UUID("00000000-0000-0000-1100-000000000000"); | ||
89 | AssetBase asset | ||
90 | = AssetHelpers.CreateAsset(assetUuid, AssetType.LSLText, ast.AssetData, UUID.Zero); | ||
91 | scene.AssetService.Store(asset); | ||
92 | TaskInventoryItem item | ||
93 | = new TaskInventoryItem | ||
94 | { Name = "scriptItem", AssetID = assetUuid, ItemID = itemUuid, | ||
95 | Type = (int)AssetType.LSLText, InvType = (int)InventoryType.LSL }; | ||
96 | part.Inventory.AddInventoryItem(item, true); | ||
97 | |||
98 | return item; | ||
99 | } | ||
100 | |||
101 | /// <summary> | ||
69 | /// Add a scene object item to the given part. | 102 | /// Add a scene object item to the given part. |
70 | /// </summary> | 103 | /// </summary> |
104 | /// <remarks> | ||
105 | /// TODO: Accept input for item and asset IDs to avoid mysterious script failures that try to use any of these | ||
106 | /// functions more than once in a test. | ||
107 | /// </remarks> | ||
108 | /// | ||
71 | /// <param name="scene"></param> | 109 | /// <param name="scene"></param> |
72 | /// <param name="sop"></param> | 110 | /// <param name="sop"></param> |
73 | /// <param name="itemName"></param> | 111 | /// <param name="itemName"></param> |