aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-03-23 22:29:27 +0000
committerJustin Clark-Casey (justincc)2011-03-23 22:29:27 +0000
commitde88227bc486788197b3a7c842c8b60f82b0a29b (patch)
treee48342e8a2d2096cf0355eea92dbf68805ad1e77
parentuse a 3 part object for the pcm test rather than a 1 part, for improved test ... (diff)
downloadopensim-SC_OLD-de88227bc486788197b3a7c842c8b60f82b0a29b.zip
opensim-SC_OLD-de88227bc486788197b3a7c842c8b60f82b0a29b.tar.gz
opensim-SC_OLD-de88227bc486788197b3a7c842c8b60f82b0a29b.tar.bz2
opensim-SC_OLD-de88227bc486788197b3a7c842c8b60f82b0a29b.tar.xz
refactor: simplify part of AddSceneObject() test setup by moving sog construction into SceneSetupHelpers.CreateSceneObject()
-rw-r--r--OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs11
-rw-r--r--OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs32
2 files changed, 33 insertions, 10 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
index 8c1b6a3..72f74fa 100644
--- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
+++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
@@ -62,16 +62,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
62 lmm.AddLandObject(lo); 62 lmm.AddLandObject(lo);
63 //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); 63 //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID);
64 64
65 SceneObjectPart part1 65 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, userId);
66 = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
67 { Name = "obj1", UUID = new UUID("00000000-0000-0000-0000-000000000001") };
68 SceneObjectGroup sog = new SceneObjectGroup(part1);
69 sog.AddPart(
70 new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
71 { Name = "obj2", UUID = new UUID("00000000-0000-0000-0000-000000000002") });
72 sog.AddPart(
73 new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
74 { Name = "obj3", UUID = new UUID("00000000-0000-0000-0000-000000000003") });
75 66
76 Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(0)); 67 Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(0));
77 Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); 68 Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0));
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index aa4b285..b7b7383 100644
--- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
@@ -465,5 +465,37 @@ namespace OpenSim.Tests.Common.Setup
465 465
466 return part; 466 return part;
467 } 467 }
468
469 /// <summary>
470 /// Create a scene object but do not add it to the scene.
471 /// </summary>
472 /// <remarks>
473 /// UUID always starts at 00000000-0000-0000-0000-000000000001
474 /// </remarks>
475 /// <param name="parts">The number of parts that should be in the scene object</param>
476 /// <param name="ownerId"></param>
477 /// <returns></returns>
478 public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId)
479 {
480 SceneObjectPart rootPart
481 = new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
482 { Name = "part1", UUID = new UUID("00000000-0000-0000-0000-000000000001") };
483 SceneObjectGroup sog = new SceneObjectGroup(rootPart);
484
485 if (parts > 1)
486 {
487 for (int i = 2; i <= parts; i++)
488 {
489 sog.AddPart(
490 new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
491 {
492 Name = string.Format("obj{0}", i),
493 UUID = new UUID(string.Format("00000000-0000-0000-0000-{0:D12}", i))
494 });
495 }
496 }
497
498 return sog;
499 }
468 } 500 }
469} 501}