aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-07-11 19:54:40 +0100
committerJustin Clark-Casey (justincc)2012-07-11 19:54:40 +0100
commit14d05dc2a907fcb304e622ab85150049b43f4fd5 (patch)
treeb33ecd749dd2105ba899b321ff90784814ee19aa /OpenSim/Tests/Common
parentIf a part has a sit target and an avatar is already sitting, allow another av... (diff)
downloadopensim-SC_OLD-14d05dc2a907fcb304e622ab85150049b43f4fd5.zip
opensim-SC_OLD-14d05dc2a907fcb304e622ab85150049b43f4fd5.tar.gz
opensim-SC_OLD-14d05dc2a907fcb304e622ab85150049b43f4fd5.tar.bz2
opensim-SC_OLD-14d05dc2a907fcb304e622ab85150049b43f4fd5.tar.xz
Add regression TestRezScriptedAttachmentsFromInventory() though this currently only checks for the presence of script items, not for started scripts
Diffstat (limited to 'OpenSim/Tests/Common')
-rw-r--r--OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs3
-rw-r--r--OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs78
2 files changed, 59 insertions, 22 deletions
diff --git a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
index 9607f1f..c4e29e2 100644
--- a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
@@ -69,7 +69,7 @@ namespace OpenSim.Tests.Common
69 } 69 }
70 70
71 /// <summary> 71 /// <summary>
72 /// Add a blank script to the given part. 72 /// Add a simple script to the given part.
73 /// </summary> 73 /// </summary>
74 /// <remarks> 74 /// <remarks>
75 /// TODO: Accept input for item and asset IDs to avoid mysterious script failures that try to use any of these 75 /// TODO: Accept input for item and asset IDs to avoid mysterious script failures that try to use any of these
@@ -81,6 +81,7 @@ namespace OpenSim.Tests.Common
81 public static TaskInventoryItem AddScript(Scene scene, SceneObjectPart part) 81 public static TaskInventoryItem AddScript(Scene scene, SceneObjectPart part)
82 { 82 {
83 AssetScriptText ast = new AssetScriptText(); 83 AssetScriptText ast = new AssetScriptText();
84 ast.Source = "default { state_entry() {} }";
84 ast.Encode(); 85 ast.Encode();
85 86
86 UUID assetUuid = new UUID("00000000-0000-0000-1000-000000000000"); 87 UUID assetUuid = new UUID("00000000-0000-0000-1000-000000000000");
diff --git a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs
index fdc60d8..b3a7c9e 100644
--- a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs
@@ -43,6 +43,57 @@ namespace OpenSim.Tests.Common
43 public static readonly string PATH_DELIMITER = "/"; 43 public static readonly string PATH_DELIMITER = "/";
44 44
45 /// <summary> 45 /// <summary>
46 /// Add an existing scene object as an item in the user's inventory.
47 /// </summary>
48 /// <param name='scene'></param>
49 /// <param name='so'></param>
50 /// <param name='inventoryIdTail'></param>
51 /// <param name='assetIdTail'></param>
52 /// <returns>The inventory item created.</returns>
53 public static InventoryItemBase AddInventoryItem(
54 Scene scene, SceneObjectGroup so, int inventoryIdTail, int assetIdTail)
55 {
56 return AddInventoryItem(
57 scene,
58 so.Name,
59 TestHelpers.ParseTail(inventoryIdTail),
60 InventoryType.Object,
61 AssetHelpers.CreateAsset(TestHelpers.ParseTail(assetIdTail), so),
62 so.OwnerID);
63 }
64
65 /// <summary>
66 /// Creates a notecard in the objects folder and specify an item id.
67 /// </summary>
68 /// <param name="scene"></param>
69 /// <param name="itemName"></param>
70 /// <param name="itemId"></param>
71 /// <param name="itemType"></param>
72 /// <param name="asset">The serialized asset for this item</param>
73 /// <param name="userId"></param>
74 /// <returns></returns>
75 private static InventoryItemBase AddInventoryItem(
76 Scene scene, string itemName, UUID itemId, InventoryType itemType, AssetBase asset, UUID userId)
77 {
78 scene.AssetService.Store(asset);
79
80 InventoryItemBase item = new InventoryItemBase();
81 item.Name = itemName;
82 item.AssetID = asset.FullID;
83 item.ID = itemId;
84 item.Owner = userId;
85 item.AssetType = asset.Type;
86 item.InvType = (int)itemType;
87
88 InventoryFolderBase folder = scene.InventoryService.GetFolderForType(userId, (AssetType)asset.Type);
89
90 item.Folder = folder.ID;
91 scene.AddInventoryItem(item);
92
93 return item;
94 }
95
96 /// <summary>
46 /// Creates a notecard in the objects folder and specify an item id. 97 /// Creates a notecard in the objects folder and specify an item id.
47 /// </summary> 98 /// </summary>
48 /// <param name="scene"></param> 99 /// <param name="scene"></param>
@@ -81,42 +132,27 @@ namespace OpenSim.Tests.Common
81 /// <param name="type">Type of item to create</param> 132 /// <param name="type">Type of item to create</param>
82 /// <returns></returns> 133 /// <returns></returns>
83 public static InventoryItemBase CreateInventoryItem( 134 public static InventoryItemBase CreateInventoryItem(
84 Scene scene, string itemName, UUID itemId, UUID assetId, UUID userId, InventoryType type) 135 Scene scene, string itemName, UUID itemId, UUID assetId, UUID userId, InventoryType itemType)
85 { 136 {
86 AssetBase asset = null; 137 AssetBase asset = null;
87 138
88 if (type == InventoryType.Notecard) 139 if (itemType == InventoryType.Notecard)
89 { 140 {
90 asset = AssetHelpers.CreateNotecardAsset(); 141 asset = AssetHelpers.CreateNotecardAsset();
91 asset.CreatorID = userId.ToString(); 142 asset.CreatorID = userId.ToString();
92 } 143 }
93 else if (type == InventoryType.Object) 144 else if (itemType == InventoryType.Object)
94 { 145 {
95 asset = AssetHelpers.CreateAsset(assetId, SceneHelpers.CreateSceneObject(1, userId)); 146 asset = AssetHelpers.CreateAsset(assetId, SceneHelpers.CreateSceneObject(1, userId));
96 } 147 }
97 else 148 else
98 { 149 {
99 throw new Exception(string.Format("Inventory type {0} not supported", type)); 150 throw new Exception(string.Format("Inventory type {0} not supported", itemType));
100 } 151 }
101 152
102 scene.AssetService.Store(asset); 153 return AddInventoryItem(scene, itemName, itemId, itemType, asset, userId);
103
104 InventoryItemBase item = new InventoryItemBase();
105 item.Name = itemName;
106 item.AssetID = asset.FullID;
107 item.ID = itemId;
108 item.Owner = userId;
109 item.AssetType = asset.Type;
110 item.InvType = (int)type;
111
112 InventoryFolderBase folder = scene.InventoryService.GetFolderForType(userId, AssetType.Notecard);
113
114 item.Folder = folder.ID;
115 scene.AddInventoryItem(item);
116
117 return item;
118 } 154 }
119 155
120 /// <summary> 156 /// <summary>
121 /// Create inventory folders starting from the user's root folder. 157 /// Create inventory folders starting from the user's root folder.
122 /// </summary> 158 /// </summary>