diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs | 23 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Setup/TaskInventoryHelpers.cs | 68 |
2 files changed, 70 insertions, 21 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index 717517b..1c8f078 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs | |||
@@ -53,25 +53,6 @@ namespace OpenSim.Region.Framework.Tests | |||
53 | [TestFixture] | 53 | [TestFixture] |
54 | public class TaskInventoryTests | 54 | public class TaskInventoryTests |
55 | { | 55 | { |
56 | protected TaskInventoryItem CreateSOItem1(Scene scene, SceneObjectPart part) | ||
57 | { | ||
58 | AssetNotecard nc = new AssetNotecard(); | ||
59 | nc.BodyText = "Hello World!"; | ||
60 | nc.Encode(); | ||
61 | UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); | ||
62 | UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); | ||
63 | AssetBase ncAsset | ||
64 | = AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero); | ||
65 | scene.AssetService.Store(ncAsset); | ||
66 | TaskInventoryItem ncItem | ||
67 | = new TaskInventoryItem | ||
68 | { Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid, | ||
69 | Type = (int)AssetType.Notecard, InvType = (int)InventoryType.Notecard }; | ||
70 | part.Inventory.AddInventoryItem(ncItem, true); | ||
71 | |||
72 | return ncItem; | ||
73 | } | ||
74 | |||
75 | [Test] | 56 | [Test] |
76 | public void TestRezObjectFromInventoryItem() | 57 | public void TestRezObjectFromInventoryItem() |
77 | { | 58 | { |
@@ -132,7 +113,7 @@ namespace OpenSim.Region.Framework.Tests | |||
132 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); | 113 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); |
133 | SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); | 114 | SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); |
134 | SceneObjectPart sop1 = sog1.RootPart; | 115 | SceneObjectPart sop1 = sog1.RootPart; |
135 | TaskInventoryItem sopItem1 = CreateSOItem1(scene, sop1); | 116 | TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1); |
136 | InventoryFolderBase folder | 117 | InventoryFolderBase folder |
137 | = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; | 118 | = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; |
138 | 119 | ||
@@ -158,7 +139,7 @@ namespace OpenSim.Region.Framework.Tests | |||
158 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); | 139 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); |
159 | SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); | 140 | SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); |
160 | SceneObjectPart sop1 = sog1.RootPart; | 141 | SceneObjectPart sop1 = sog1.RootPart; |
161 | TaskInventoryItem sopItem1 = CreateSOItem1(scene, sop1); | 142 | TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1); |
162 | 143 | ||
163 | // Perform test | 144 | // Perform test |
164 | scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); | 145 | scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); |
diff --git a/OpenSim/Tests/Common/Setup/TaskInventoryHelpers.cs b/OpenSim/Tests/Common/Setup/TaskInventoryHelpers.cs new file mode 100644 index 0000000..48724f4 --- /dev/null +++ b/OpenSim/Tests/Common/Setup/TaskInventoryHelpers.cs | |||
@@ -0,0 +1,68 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using OpenMetaverse; | ||
30 | using OpenMetaverse.Assets; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Region.Framework.Scenes; | ||
33 | using OpenSim.Services.Interfaces; | ||
34 | |||
35 | namespace OpenSim.Tests.Common | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// Utility functions for carrying out task inventory tests. | ||
39 | /// </summary> | ||
40 | /// | ||
41 | public static class TaskInventoryHelpers | ||
42 | { | ||
43 | /// <summary> | ||
44 | /// Add a notecard item to the given part. | ||
45 | /// </summary> | ||
46 | /// <param name="scene"></param> | ||
47 | /// <param name="part"></param> | ||
48 | /// <returns>The item that was added</returns> | ||
49 | public static TaskInventoryItem AddNotecard(Scene scene, SceneObjectPart part) | ||
50 | { | ||
51 | AssetNotecard nc = new AssetNotecard(); | ||
52 | nc.BodyText = "Hello World!"; | ||
53 | nc.Encode(); | ||
54 | UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); | ||
55 | UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); | ||
56 | AssetBase ncAsset | ||
57 | = AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero); | ||
58 | scene.AssetService.Store(ncAsset); | ||
59 | TaskInventoryItem ncItem | ||
60 | = new TaskInventoryItem | ||
61 | { Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid, | ||
62 | Type = (int)AssetType.Notecard, InvType = (int)InventoryType.Notecard }; | ||
63 | part.Inventory.AddInventoryItem(ncItem, true); | ||
64 | |||
65 | return ncItem; | ||
66 | } | ||
67 | } | ||
68 | } \ No newline at end of file | ||