diff options
author | Sean Dague | 2008-10-01 18:51:12 +0000 |
---|---|---|
committer | Sean Dague | 2008-10-01 18:51:12 +0000 |
commit | 0f7f3b45cc612a0d64d1b4667ae55b194260eac0 (patch) | |
tree | dfd2ad3c96b4bf209adc0e81b22e78493a215639 /OpenSim | |
parent | one class per file please. (diff) | |
download | opensim-SC-0f7f3b45cc612a0d64d1b4667ae55b194260eac0.zip opensim-SC-0f7f3b45cc612a0d64d1b4667ae55b194260eac0.tar.gz opensim-SC-0f7f3b45cc612a0d64d1b4667ae55b194260eac0.tar.bz2 opensim-SC-0f7f3b45cc612a0d64d1b4667ae55b194260eac0.tar.xz |
add basic store retrieve prim inventory test. the prim
inventory interfaces definitely need some rethinking.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Data/Tests/BasicRegionTest.cs | 63 |
1 files changed, 60 insertions, 3 deletions
diff --git a/OpenSim/Data/Tests/BasicRegionTest.cs b/OpenSim/Data/Tests/BasicRegionTest.cs index 548a242..80d4fd4 100644 --- a/OpenSim/Data/Tests/BasicRegionTest.cs +++ b/OpenSim/Data/Tests/BasicRegionTest.cs | |||
@@ -45,6 +45,12 @@ namespace OpenSim.Data.Tests | |||
45 | public UUID prim1; | 45 | public UUID prim1; |
46 | public UUID prim2; | 46 | public UUID prim2; |
47 | public UUID prim3; | 47 | public UUID prim3; |
48 | public UUID item1; | ||
49 | public UUID item2; | ||
50 | public UUID item3; | ||
51 | |||
52 | public string itemname1 = "item1"; | ||
53 | |||
48 | public double height1; | 54 | public double height1; |
49 | public double height2; | 55 | public double height2; |
50 | 56 | ||
@@ -63,6 +69,9 @@ namespace OpenSim.Data.Tests | |||
63 | prim1 = UUID.Random(); | 69 | prim1 = UUID.Random(); |
64 | prim2 = UUID.Random(); | 70 | prim2 = UUID.Random(); |
65 | prim3 = UUID.Random(); | 71 | prim3 = UUID.Random(); |
72 | item1 = UUID.Random(); | ||
73 | item2 = UUID.Random(); | ||
74 | item3 = UUID.Random(); | ||
66 | height1 = 20; | 75 | height1 = 20; |
67 | height2 = 100; | 76 | height2 = 100; |
68 | } | 77 | } |
@@ -148,13 +157,37 @@ namespace OpenSim.Data.Tests | |||
148 | } | 157 | } |
149 | 158 | ||
150 | [Test] | 159 | [Test] |
151 | public void T013_PrimInventory() | 160 | public void T021_PrimInventoryStore() |
152 | { | 161 | { |
162 | SceneObjectGroup sog = FindSOG("object1", region1); | ||
163 | InventoryItemBase i = NewItem(item1, UUID.Zero, UUID.Zero, itemname1, UUID.Zero); | ||
164 | |||
165 | Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, i, UUID.Zero), Is.True); | ||
166 | TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); | ||
167 | Assert.That(t.Name, Is.EqualTo(itemname1)); | ||
168 | |||
169 | // TODO: seriously??? this is the way we need to loop to get this? | ||
170 | |||
171 | List<TaskInventoryItem> list = new List<TaskInventoryItem>(); | ||
172 | foreach (UUID uuid in sog.RootPart.GetInventoryList()) | ||
173 | { | ||
174 | list.Add(sog.GetInventoryItem(sog.RootPart.LocalId, uuid)); | ||
175 | } | ||
153 | 176 | ||
177 | db.StorePrimInventory(prim1, list); | ||
178 | } | ||
179 | |||
180 | [Test] | ||
181 | public void T022_PrimInventoryRetrieve() | ||
182 | { | ||
183 | SceneObjectGroup sog = FindSOG("object1", region1); | ||
184 | TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); | ||
185 | |||
186 | Assert.That(t.Name, Is.EqualTo(itemname1)); | ||
154 | } | 187 | } |
155 | 188 | ||
156 | [Test] | 189 | [Test] |
157 | public void T021_RemoveObjectWrongRegion() | 190 | public void T051_RemoveObjectWrongRegion() |
158 | { | 191 | { |
159 | db.RemoveObject(prim1, UUID.Random()); | 192 | db.RemoveObject(prim1, UUID.Random()); |
160 | SceneObjectGroup sog = FindSOG("object1", region1); | 193 | SceneObjectGroup sog = FindSOG("object1", region1); |
@@ -162,7 +195,7 @@ namespace OpenSim.Data.Tests | |||
162 | } | 195 | } |
163 | 196 | ||
164 | [Test] | 197 | [Test] |
165 | public void T022_RemoveObject() | 198 | public void T052_RemoveObject() |
166 | { | 199 | { |
167 | db.RemoveObject(prim1, region1); | 200 | db.RemoveObject(prim1, region1); |
168 | SceneObjectGroup sog = FindSOG("object1", region1); | 201 | SceneObjectGroup sog = FindSOG("object1", region1); |
@@ -303,5 +336,29 @@ namespace OpenSim.Data.Tests | |||
303 | return sog; | 336 | return sog; |
304 | } | 337 | } |
305 | 338 | ||
339 | // These are copied from the Inventory Item tests | ||
340 | |||
341 | private InventoryItemBase NewItem(UUID id, UUID parent, UUID owner, string name, UUID asset) | ||
342 | { | ||
343 | InventoryItemBase i = new InventoryItemBase(); | ||
344 | i.ID = id; | ||
345 | i.Folder = parent; | ||
346 | i.Owner = owner; | ||
347 | i.Creator = owner; | ||
348 | i.Name = name; | ||
349 | i.Description = name; | ||
350 | i.AssetID = asset; | ||
351 | return i; | ||
352 | } | ||
353 | |||
354 | private InventoryFolderBase NewFolder(UUID id, UUID parent, UUID owner, string name) | ||
355 | { | ||
356 | InventoryFolderBase f = new InventoryFolderBase(); | ||
357 | f.ID = id; | ||
358 | f.ParentID = parent; | ||
359 | f.Owner = owner; | ||
360 | f.Name = name; | ||
361 | return f; | ||
362 | } | ||
306 | } | 363 | } |
307 | } \ No newline at end of file | 364 | } \ No newline at end of file |