29 using System.Collections.Generic;
30 using System.Reflection;
32 using NUnit.Framework;
34 using OpenMetaverse.Assets;
35 using OpenSim.Framework;
36 using OpenSim.Region.Framework.Interfaces;
37 using OpenSim.Region.Framework.Scenes;
38 using OpenSim.Tests.Common;
45 protected UUID m_userId =
new UUID(
"00000000-0000-0000-0000-100000000000");
46 protected UUID m_groupId =
new UUID(
"00000000-0000-0000-8888-000000000000");
47 protected UUID m_otherUserId =
new UUID(
"99999999-9999-9999-9999-999999999999");
69 SceneHelpers.SetupSceneModules(m_scene, lmm, m_pcm);
74 lo.LandData.Name =
"m_lo";
77 m_lo = lmm.AddLandObject(lo);
81 lo2.GetSquareLandBitmap(xParcelDivider, 0, (int)
Constants.
RegionSize, (
int)Constants.RegionSize));
82 lo2.LandData.Name =
"m_lo2";
83 m_lo2 = lmm.AddLandObject(lo2);
94 Assert.That(pc.Owner, Is.EqualTo(0));
95 Assert.That(pc.Group, Is.EqualTo(0));
96 Assert.That(pc.Others, Is.EqualTo(0));
97 Assert.That(pc.Total, Is.EqualTo(0));
98 Assert.That(pc.Selected, Is.EqualTo(0));
99 Assert.That(pc.Users[m_userId], Is.EqualTo(0));
100 Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0));
101 Assert.That(pc.Simulator, Is.EqualTo(0));
110 TestHelpers.InMethod();
115 SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_userId,
"a", 0x01);
116 m_scene.AddNewSceneObject(sog,
false);
118 Assert.That(pc.Owner, Is.EqualTo(3));
119 Assert.That(pc.Group, Is.EqualTo(0));
120 Assert.That(pc.Others, Is.EqualTo(0));
121 Assert.That(pc.Total, Is.EqualTo(3));
122 Assert.That(pc.Selected, Is.EqualTo(0));
123 Assert.That(pc.Users[m_userId], Is.EqualTo(3));
124 Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0));
125 Assert.That(pc.Simulator, Is.EqualTo(3));
128 SceneObjectGroup sog2 = SceneHelpers.CreateSceneObject(2, m_userId,
"b", 0x10);
129 m_scene.AddNewSceneObject(sog2,
false);
131 Assert.That(pc.Owner, Is.EqualTo(5));
132 Assert.That(pc.Group, Is.EqualTo(0));
133 Assert.That(pc.Others, Is.EqualTo(0));
134 Assert.That(pc.Total, Is.EqualTo(5));
135 Assert.That(pc.Selected, Is.EqualTo(0));
136 Assert.That(pc.Users[m_userId], Is.EqualTo(5));
137 Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0));
138 Assert.That(pc.Simulator, Is.EqualTo(5));
147 TestHelpers.InMethod();
152 SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_userId,
"a", 0x01);
153 m_scene.AddNewSceneObject(sog,
false);
154 m_scene.SceneGraph.DuplicateObject(sog.LocalId, Vector3.Zero, 0, m_userId, UUID.Zero, Quaternion.Identity);
156 Assert.That(pc.Owner, Is.EqualTo(6));
157 Assert.That(pc.Group, Is.EqualTo(0));
158 Assert.That(pc.Others, Is.EqualTo(0));
159 Assert.That(pc.Total, Is.EqualTo(6));
160 Assert.That(pc.Selected, Is.EqualTo(0));
161 Assert.That(pc.Users[m_userId], Is.EqualTo(6));
162 Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0));
163 Assert.That(pc.Simulator, Is.EqualTo(6));
173 TestHelpers.InMethod();
176 SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_userId,
"a", 0x01);
177 m_scene.AddNewSceneObject(sog,
false);
178 SceneObjectGroup sog2 = SceneHelpers.CreateSceneObject(2, m_userId,
"b", 0x10);
179 m_scene.AddNewSceneObject(sog2,
false);
182 sog.AbsolutePosition =
new Vector3(254, 2, 2);
186 Assert.That(pclo1.Owner, Is.EqualTo(2));
187 Assert.That(pclo1.Group, Is.EqualTo(0));
188 Assert.That(pclo1.Others, Is.EqualTo(0));
189 Assert.That(pclo1.Total, Is.EqualTo(2));
190 Assert.That(pclo1.Selected, Is.EqualTo(0));
191 Assert.That(pclo1.Users[m_userId], Is.EqualTo(2));
192 Assert.That(pclo1.Users[m_otherUserId], Is.EqualTo(0));
193 Assert.That(pclo1.Simulator, Is.EqualTo(5));
197 Assert.That(pclo2.Owner, Is.EqualTo(3));
198 Assert.That(pclo2.Group, Is.EqualTo(0));
199 Assert.That(pclo2.Others, Is.EqualTo(0));
200 Assert.That(pclo2.Total, Is.EqualTo(3));
201 Assert.That(pclo2.Selected, Is.EqualTo(0));
202 Assert.That(pclo2.Users[m_userId], Is.EqualTo(3));
203 Assert.That(pclo2.Users[m_otherUserId], Is.EqualTo(0));
204 Assert.That(pclo2.Simulator, Is.EqualTo(5));
207 sog.AbsolutePosition =
new Vector3(2, 2, 2);
209 Assert.That(pclo1.Owner, Is.EqualTo(5));
210 Assert.That(pclo1.Group, Is.EqualTo(0));
211 Assert.That(pclo1.Others, Is.EqualTo(0));
212 Assert.That(pclo1.Total, Is.EqualTo(5));
213 Assert.That(pclo1.Selected, Is.EqualTo(0));
214 Assert.That(pclo1.Users[m_userId], Is.EqualTo(5));
215 Assert.That(pclo1.Users[m_otherUserId], Is.EqualTo(0));
216 Assert.That(pclo1.Simulator, Is.EqualTo(5));
218 Assert.That(pclo2.Owner, Is.EqualTo(0));
219 Assert.That(pclo2.Group, Is.EqualTo(0));
220 Assert.That(pclo2.Others, Is.EqualTo(0));
221 Assert.That(pclo2.Total, Is.EqualTo(0));
222 Assert.That(pclo2.Selected, Is.EqualTo(0));
223 Assert.That(pclo2.Users[m_userId], Is.EqualTo(0));
224 Assert.That(pclo2.Users[m_otherUserId], Is.EqualTo(0));
225 Assert.That(pclo2.Simulator, Is.EqualTo(5));
234 TestHelpers.InMethod();
239 m_scene.AddNewSceneObject(SceneHelpers.CreateSceneObject(1, m_userId,
"a", 0x1),
false);
240 SceneObjectGroup sogToDelete = SceneHelpers.CreateSceneObject(3, m_userId,
"b", 0x10);
241 m_scene.AddNewSceneObject(sogToDelete,
false);
242 m_scene.DeleteSceneObject(sogToDelete,
false);
244 Assert.That(pc.Owner, Is.EqualTo(1));
245 Assert.That(pc.Group, Is.EqualTo(0));
246 Assert.That(pc.Others, Is.EqualTo(0));
247 Assert.That(pc.Total, Is.EqualTo(1));
248 Assert.That(pc.Selected, Is.EqualTo(0));
249 Assert.That(pc.Users[m_userId], Is.EqualTo(1));
250 Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0));
251 Assert.That(pc.Simulator, Is.EqualTo(1));
257 TestHelpers.InMethod();
260 m_lo.DeedToGroup(m_groupId);
264 SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_otherUserId,
"a", 0x01);
265 sog.GroupID = m_groupId;
266 m_scene.AddNewSceneObject(sog,
false);
268 Assert.That(pc.Owner, Is.EqualTo(0));
269 Assert.That(pc.Group, Is.EqualTo(3));
270 Assert.That(pc.Others, Is.EqualTo(0));
271 Assert.That(pc.Total, Is.EqualTo(3));
272 Assert.That(pc.Selected, Is.EqualTo(0));
275 Assert.That(pc.Users[m_userId], Is.EqualTo(0));
276 Assert.That(pc.Users[m_groupId], Is.EqualTo(0));
277 Assert.That(pc.Users[m_otherUserId], Is.EqualTo(3));
279 Assert.That(pc.Simulator, Is.EqualTo(3));
288 TestHelpers.InMethod();
291 m_lo.DeedToGroup(m_groupId);
295 SceneObjectGroup sogToKeep = SceneHelpers.CreateSceneObject(1, m_userId,
"a", 0x1);
296 sogToKeep.GroupID = m_groupId;
297 m_scene.AddNewSceneObject(sogToKeep,
false);
299 SceneObjectGroup sogToDelete = SceneHelpers.CreateSceneObject(3, m_userId,
"b", 0x10);
300 m_scene.AddNewSceneObject(sogToDelete,
false);
301 m_scene.DeleteSceneObject(sogToDelete,
false);
303 Assert.That(pc.Owner, Is.EqualTo(0));
304 Assert.That(pc.Group, Is.EqualTo(1));
305 Assert.That(pc.Others, Is.EqualTo(0));
306 Assert.That(pc.Total, Is.EqualTo(1));
307 Assert.That(pc.Selected, Is.EqualTo(0));
308 Assert.That(pc.Users[m_userId], Is.EqualTo(1));
309 Assert.That(pc.Users[m_groupId], Is.EqualTo(0));
310 Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0));
311 Assert.That(pc.Simulator, Is.EqualTo(1));
317 TestHelpers.InMethod();
322 SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_otherUserId,
"a", 0x01);
323 m_scene.AddNewSceneObject(sog,
false);
325 Assert.That(pc.Owner, Is.EqualTo(0));
326 Assert.That(pc.Group, Is.EqualTo(0));
327 Assert.That(pc.Others, Is.EqualTo(3));
328 Assert.That(pc.Total, Is.EqualTo(3));
329 Assert.That(pc.Selected, Is.EqualTo(0));
330 Assert.That(pc.Users[m_userId], Is.EqualTo(0));
331 Assert.That(pc.Users[m_otherUserId], Is.EqualTo(3));
332 Assert.That(pc.Simulator, Is.EqualTo(3));
338 TestHelpers.InMethod();
343 m_scene.AddNewSceneObject(SceneHelpers.CreateSceneObject(1, m_otherUserId,
"a", 0x1),
false);
344 SceneObjectGroup sogToDelete = SceneHelpers.CreateSceneObject(3, m_otherUserId,
"b", 0x10);
345 m_scene.AddNewSceneObject(sogToDelete,
false);
346 m_scene.DeleteSceneObject(sogToDelete,
false);
348 Assert.That(pc.Owner, Is.EqualTo(0));
349 Assert.That(pc.Group, Is.EqualTo(0));
350 Assert.That(pc.Others, Is.EqualTo(1));
351 Assert.That(pc.Total, Is.EqualTo(1));
352 Assert.That(pc.Selected, Is.EqualTo(0));
353 Assert.That(pc.Users[m_userId], Is.EqualTo(0));
354 Assert.That(pc.Users[m_otherUserId], Is.EqualTo(1));
355 Assert.That(pc.Simulator, Is.EqualTo(1));
364 TestHelpers.InMethod();
367 SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_userId,
"a", 0x01);
368 m_scene.AddNewSceneObject(sog,
false);
370 m_pcm.TaintPrimCount();
372 Assert.That(pc.Owner, Is.EqualTo(3));
373 Assert.That(pc.Group, Is.EqualTo(0));
374 Assert.That(pc.Others, Is.EqualTo(0));
375 Assert.That(pc.Total, Is.EqualTo(3));
376 Assert.That(pc.Selected, Is.EqualTo(0));
377 Assert.That(pc.Users[m_userId], Is.EqualTo(3));
378 Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0));
379 Assert.That(pc.Simulator, Is.EqualTo(3));
void TestAddOthersObject()
void TestRemoveGroupObject()
Test count after a parcel owner owned object is removed.
void TestRemoveOthersObject()
void TestAddGroupObject()
A scene object group is conceptually an object in the scene. The object is constituted of SceneObject...
ILandObject m_lo
A parcel that covers the entire sim except for a 1 unit wide strip on the eastern side...
Keeps track of a specific piece of land's information
void TestCopyOwnerObject()
Test count after a parcel owner owned copied object is added.
void TestAddOwnerObject()
Test count after a parcel owner owned object is added.
void TestMoveOwnerObject()
Test that parcel counts update correctly when an object is moved between parcels, where that movement...
void TestTaint()
Test the count is correct after is has been tainted.
void TestRemoveOwnerObject()
Test count after a parcel owner owned object is removed.
Helpers for setting up scenes.
ILandObject m_lo2
A parcel that covers just the eastern strip of the sim.
void TestInitialCounts()
Test that counts before we do anything are correct.