aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs39
-rw-r--r--OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs27
2 files changed, 60 insertions, 6 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
index 72f74fa..e6b8627 100644
--- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
+++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
@@ -44,8 +44,11 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
44 [TestFixture] 44 [TestFixture]
45 public class PrimCountModuleTests 45 public class PrimCountModuleTests
46 { 46 {
47 /// <summary>
48 /// Test count after a parcel owner owned object is added.
49 /// </summary>
47 [Test] 50 [Test]
48 public void TestAddObject() 51 public void TestAddOwnerObject()
49 { 52 {
50 TestHelper.InMethod(); 53 TestHelper.InMethod();
51// log4net.Config.XmlConfigurator.Configure(); 54// log4net.Config.XmlConfigurator.Configure();
@@ -80,5 +83,39 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
80 Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); 83 Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0));
81 Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(3)); 84 Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(3));
82 } 85 }
86
87 /// <summary>
88 /// Test count after a parcel owner owned object is removed.
89 /// </summary>
90 [Test]
91 public void TestRemoveOwnerObject()
92 {
93 TestHelper.InMethod();
94// log4net.Config.XmlConfigurator.Configure();
95
96 PrimCountModule pcm = new PrimCountModule();
97 LandManagementModule lmm = new LandManagementModule();
98 Scene scene = SceneSetupHelpers.SetupScene();
99 SceneSetupHelpers.SetupSceneModules(scene, lmm, pcm);
100
101 UUID userId = new UUID("00000000-0000-0000-0000-000000000010");
102 UUID dummyUserId = new UUID("99999999-9999-9999-9999-999999999999");
103 ILandObject lo = new LandObject(userId, false, scene);
104 lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
105 lmm.AddLandObject(lo);
106 //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID);
107
108 scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, userId, 0x1), false);
109 SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, userId, 0x10);
110 scene.AddNewSceneObject(sogToDelete, false);
111 scene.DeleteSceneObject(sogToDelete, false);
112
113 Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(1));
114 Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0));
115 Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0));
116 Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(1));
117 Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0));
118 Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(1));
119 }
83 } 120 }
84} \ No newline at end of file 121} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index 87b6389..57850c1 100644
--- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
@@ -488,20 +488,37 @@ namespace OpenSim.Tests.Common.Setup
488 /// <param name="ownerId"></param> 488 /// <param name="ownerId"></param>
489 /// <returns></returns> 489 /// <returns></returns>
490 public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId) 490 public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId)
491 { 491 {
492 return CreateSceneObject(parts, ownerId, 0x1);
493 }
494
495 /// <summary>
496 /// Create a scene object but do not add it to the scene.
497 /// </summary>
498 /// <param name="parts">The number of parts that should be in the scene object</param>
499 /// <param name="ownerId"></param>
500 /// <param name="uuidTail">
501 /// The hexadecimal last part of the UUID for parts created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}"
502 /// will be given to the root part, and incremented for each part thereafter.
503 /// </param>
504 /// <returns></returns>
505 public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId, int uuidTail)
506 {
507 string rawSogId = string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail);
508
492 SceneObjectGroup sog 509 SceneObjectGroup sog
493 = new SceneObjectGroup( 510 = new SceneObjectGroup(
494 CreateSceneObjectPart("part1", new UUID("00000000-0000-0000-0000-000000000001"), ownerId)); 511 CreateSceneObjectPart("part0", new UUID(rawSogId), ownerId));
495 512
496 if (parts > 1) 513 if (parts > 1)
497 for (int i = 2; i <= parts; i++) 514 for (int i = 1; i < parts; i++)
498 sog.AddPart( 515 sog.AddPart(
499 CreateSceneObjectPart( 516 CreateSceneObjectPart(
500 string.Format("obj{0}", i), 517 string.Format("obj{0}", i),
501 new UUID(string.Format("00000000-0000-0000-0000-{0:D12}", i)), 518 new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail + i)),
502 ownerId)); 519 ownerId));
503 520
504 return sog; 521 return sog;
505 } 522 }
506 } 523 }
507} \ No newline at end of file 524} \ No newline at end of file