From 696bd448334c89607c95385f05a53e2ab72cb984 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 17 Aug 2011 00:37:33 +0100 Subject: Add new regression TestRezAttachmentsOnAvatarEntrance() to do simple attachments check --- .../Tests/Common/Helpers/UserInventoryHelpers.cs | 37 +++++++++++++++++++--- 1 file changed, 33 insertions(+), 4 deletions(-) (limited to 'OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs') 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 /// public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID userId) { - return CreateInventoryItem(scene, itemName, UUID.Random(), userId); + return CreateInventoryItem(scene, itemName, UUID.Random(), UUID.Random(), userId, InventoryType.Notecard); + } + + /// + /// Creates an item of the given type with an accompanying asset. + /// + /// + /// + /// + /// + /// Type of item to create + /// + public static InventoryItemBase CreateInventoryItem( + Scene scene, string itemName, UUID userId, InventoryType type) + { + return CreateInventoryItem(scene, itemName, UUID.Random(), UUID.Random(), userId, type); } /// @@ -61,18 +76,32 @@ namespace OpenSim.Tests.Common /// /// /// + /// /// + /// Type of item to create /// - public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID itemId, UUID userId) + public static InventoryItemBase CreateInventoryItem( + Scene scene, string itemName, UUID itemId, UUID assetId, UUID userId, InventoryType type) { - AssetBase asset = AssetHelpers.CreateAsset(scene, userId); + AssetBase asset = null; + + if (type == InventoryType.Notecard) + asset = AssetHelpers.CreateAsset(scene, userId); + else if (type == InventoryType.Object) + asset + = AssetHelpers.CreateAsset(assetId, SceneHelpers.CreateSceneObject(1, userId)); + else + throw new Exception(string.Format("Inventory type {0} not supported", type)); + + scene.AssetService.Store(asset); + InventoryItemBase item = new InventoryItemBase(); item.Name = itemName; item.AssetID = asset.FullID; item.ID = itemId; item.Owner = userId; item.AssetType = asset.Type; - item.InvType = (int)InventoryType.Notecard; + item.InvType = (int)type; InventoryFolderBase folder = scene.InventoryService.GetFolderForType(userId, AssetType.Notecard); -- cgit v1.1