diff options
author | Justin Clark-Casey (justincc) | 2012-02-07 21:00:47 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-02-07 21:00:47 +0000 |
commit | bd928218dd0845bb0aef46749e8a393d0a9e4fbc (patch) | |
tree | 3357b2d284e900f4d96efe75a928612cc10e83c1 /OpenSim | |
parent | Add warning about only uncommenting EstateConnectionString if you know what y... (diff) | |
download | opensim-SC-bd928218dd0845bb0aef46749e8a393d0a9e4fbc.zip opensim-SC-bd928218dd0845bb0aef46749e8a393d0a9e4fbc.tar.gz opensim-SC-bd928218dd0845bb0aef46749e8a393d0a9e4fbc.tar.bz2 opensim-SC-bd928218dd0845bb0aef46749e8a393d0a9e4fbc.tar.xz |
Add TestAddTaskInventoryItem()
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs | 26 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs | 12 |
2 files changed, 34 insertions, 4 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index 1abef8d..e4b607d 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs | |||
@@ -53,6 +53,30 @@ namespace OpenSim.Region.Framework.Tests | |||
53 | public class TaskInventoryTests | 53 | public class TaskInventoryTests |
54 | { | 54 | { |
55 | [Test] | 55 | [Test] |
56 | public void TestAddTaskInventoryItem() | ||
57 | { | ||
58 | TestHelpers.InMethod(); | ||
59 | // log4net.Config.XmlConfigurator.Configure(); | ||
60 | |||
61 | Scene scene = SceneHelpers.SetupScene(); | ||
62 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); | ||
63 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); | ||
64 | SceneObjectPart sop1 = sog1.RootPart; | ||
65 | |||
66 | // Create an object embedded inside the first | ||
67 | UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); | ||
68 | TaskInventoryItem taskSceneObjectItem | ||
69 | = TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID); | ||
70 | |||
71 | TaskInventoryItem addedItem = sop1.Inventory.GetInventoryItem(taskSceneObjectItemId); | ||
72 | Assert.That(addedItem.ItemID, Is.EqualTo(taskSceneObjectItemId)); | ||
73 | Assert.That(addedItem.OwnerID, Is.EqualTo(user1.PrincipalID)); | ||
74 | Assert.That(addedItem.ParentID, Is.EqualTo(sop1.UUID)); | ||
75 | Assert.That(addedItem.InvType, Is.EqualTo((int)InventoryType.Object)); | ||
76 | Assert.That(addedItem.Type, Is.EqualTo((int)AssetType.Object)); | ||
77 | } | ||
78 | |||
79 | [Test] | ||
56 | public void TestRezObjectFromInventoryItem() | 80 | public void TestRezObjectFromInventoryItem() |
57 | { | 81 | { |
58 | TestHelpers.InMethod(); | 82 | TestHelpers.InMethod(); |
@@ -66,7 +90,7 @@ namespace OpenSim.Region.Framework.Tests | |||
66 | // Create an object embedded inside the first | 90 | // Create an object embedded inside the first |
67 | UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); | 91 | UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); |
68 | TaskInventoryItem taskSceneObjectItem | 92 | TaskInventoryItem taskSceneObjectItem |
69 | = TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId); | 93 | = TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID); |
70 | 94 | ||
71 | scene.AddSceneObject(sog1); | 95 | scene.AddSceneObject(sog1); |
72 | 96 | ||
diff --git a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs index a8f0d59..7058d1e 100644 --- a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs | |||
@@ -72,15 +72,21 @@ namespace OpenSim.Tests.Common | |||
72 | /// <param name="sop"></param> | 72 | /// <param name="sop"></param> |
73 | /// <param name="itemName"></param> | 73 | /// <param name="itemName"></param> |
74 | /// <param name="id"></param> | 74 | /// <param name="id"></param> |
75 | public static TaskInventoryItem AddSceneObject(Scene scene, SceneObjectPart sop, string itemName, UUID id) | 75 | /// <param name="userId"></param> |
76 | public static TaskInventoryItem AddSceneObject( | ||
77 | Scene scene, SceneObjectPart sop, string itemName, UUID id, UUID userId) | ||
76 | { | 78 | { |
77 | SceneObjectGroup taskSceneObject = SceneHelpers.CreateSceneObject(1, UUID.Zero); | 79 | SceneObjectGroup taskSceneObject = SceneHelpers.CreateSceneObject(1, UUID.Zero); |
78 | AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject); | 80 | AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject); |
79 | scene.AssetService.Store(taskSceneObjectAsset); | 81 | scene.AssetService.Store(taskSceneObjectAsset); |
80 | TaskInventoryItem taskSceneObjectItem | 82 | TaskInventoryItem taskSceneObjectItem |
81 | = new TaskInventoryItem | 83 | = new TaskInventoryItem |
82 | { Name = itemName, AssetID = taskSceneObjectAsset.FullID, ItemID = id, | 84 | { Name = itemName, |
83 | Type = (int)AssetType.Object, InvType = (int)InventoryType.Object }; | 85 | AssetID = taskSceneObjectAsset.FullID, |
86 | ItemID = id, | ||
87 | OwnerID = userId, | ||
88 | Type = (int)AssetType.Object, | ||
89 | InvType = (int)InventoryType.Object }; | ||
84 | sop.Inventory.AddInventoryItem(taskSceneObjectItem, true); | 90 | sop.Inventory.AddInventoryItem(taskSceneObjectItem, true); |
85 | 91 | ||
86 | return taskSceneObjectItem; | 92 | return taskSceneObjectItem; |