diff options
Diffstat (limited to 'OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs')
-rw-r--r-- | OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs index 1703597..4e60ca9 100644 --- a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs | |||
@@ -52,7 +52,22 @@ namespace OpenSim.Tests.Common | |||
52 | /// <returns></returns> | 52 | /// <returns></returns> |
53 | public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID userId) | 53 | public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID userId) |
54 | { | 54 | { |
55 | return CreateInventoryItem(scene, itemName, UUID.Random(), userId); | 55 | return CreateInventoryItem(scene, itemName, UUID.Random(), UUID.Random(), userId, InventoryType.Notecard); |
56 | } | ||
57 | |||
58 | /// <summary> | ||
59 | /// Creates an item of the given type with an accompanying asset. | ||
60 | /// </summary> | ||
61 | /// <param name="scene"></param> | ||
62 | /// <param name="itemName"></param> | ||
63 | /// <param name="itemId"></param> | ||
64 | /// <param name="userId"></param> | ||
65 | /// <param name="type">Type of item to create</param> | ||
66 | /// <returns></returns> | ||
67 | public static InventoryItemBase CreateInventoryItem( | ||
68 | Scene scene, string itemName, UUID userId, InventoryType type) | ||
69 | { | ||
70 | return CreateInventoryItem(scene, itemName, UUID.Random(), UUID.Random(), userId, type); | ||
56 | } | 71 | } |
57 | 72 | ||
58 | /// <summary> | 73 | /// <summary> |
@@ -61,18 +76,32 @@ namespace OpenSim.Tests.Common | |||
61 | /// <param name="scene"></param> | 76 | /// <param name="scene"></param> |
62 | /// <param name="itemName"></param> | 77 | /// <param name="itemName"></param> |
63 | /// <param name="itemId"></param> | 78 | /// <param name="itemId"></param> |
79 | /// <param name="assetId"></param> | ||
64 | /// <param name="userId"></param> | 80 | /// <param name="userId"></param> |
81 | /// <param name="type">Type of item to create</param> | ||
65 | /// <returns></returns> | 82 | /// <returns></returns> |
66 | public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID itemId, UUID userId) | 83 | public static InventoryItemBase CreateInventoryItem( |
84 | Scene scene, string itemName, UUID itemId, UUID assetId, UUID userId, InventoryType type) | ||
67 | { | 85 | { |
68 | AssetBase asset = AssetHelpers.CreateAsset(scene, userId); | 86 | AssetBase asset = null; |
87 | |||
88 | if (type == InventoryType.Notecard) | ||
89 | asset = AssetHelpers.CreateAsset(scene, userId); | ||
90 | else if (type == InventoryType.Object) | ||
91 | asset | ||
92 | = AssetHelpers.CreateAsset(assetId, SceneHelpers.CreateSceneObject(1, userId)); | ||
93 | else | ||
94 | throw new Exception(string.Format("Inventory type {0} not supported", type)); | ||
95 | |||
96 | scene.AssetService.Store(asset); | ||
97 | |||
69 | InventoryItemBase item = new InventoryItemBase(); | 98 | InventoryItemBase item = new InventoryItemBase(); |
70 | item.Name = itemName; | 99 | item.Name = itemName; |
71 | item.AssetID = asset.FullID; | 100 | item.AssetID = asset.FullID; |
72 | item.ID = itemId; | 101 | item.ID = itemId; |
73 | item.Owner = userId; | 102 | item.Owner = userId; |
74 | item.AssetType = asset.Type; | 103 | item.AssetType = asset.Type; |
75 | item.InvType = (int)InventoryType.Notecard; | 104 | item.InvType = (int)type; |
76 | 105 | ||
77 | InventoryFolderBase folder = scene.InventoryService.GetFolderForType(userId, AssetType.Notecard); | 106 | InventoryFolderBase folder = scene.InventoryService.GetFolderForType(userId, AssetType.Notecard); |
78 | 107 | ||