refactor: simplify part of AddSceneObject() test setup by moving sog construction into SceneSetupHelpers.CreateSceneObject()
parent
88673c86a4
commit
de88227bc4
|
@ -62,16 +62,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
|
|||
lmm.AddLandObject(lo);
|
||||
//scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID);
|
||||
|
||||
SceneObjectPart part1
|
||||
= new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
|
||||
{ Name = "obj1", UUID = new UUID("00000000-0000-0000-0000-000000000001") };
|
||||
SceneObjectGroup sog = new SceneObjectGroup(part1);
|
||||
sog.AddPart(
|
||||
new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
|
||||
{ Name = "obj2", UUID = new UUID("00000000-0000-0000-0000-000000000002") });
|
||||
sog.AddPart(
|
||||
new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
|
||||
{ Name = "obj3", UUID = new UUID("00000000-0000-0000-0000-000000000003") });
|
||||
SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, userId);
|
||||
|
||||
Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(0));
|
||||
Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0));
|
||||
|
|
|
@ -465,5 +465,37 @@ namespace OpenSim.Tests.Common.Setup
|
|||
|
||||
return part;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a scene object but do not add it to the scene.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// UUID always starts at 00000000-0000-0000-0000-000000000001
|
||||
/// </remarks>
|
||||
/// <param name="parts">The number of parts that should be in the scene object</param>
|
||||
/// <param name="ownerId"></param>
|
||||
/// <returns></returns>
|
||||
public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId)
|
||||
{
|
||||
SceneObjectPart rootPart
|
||||
= new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
|
||||
{ Name = "part1", UUID = new UUID("00000000-0000-0000-0000-000000000001") };
|
||||
SceneObjectGroup sog = new SceneObjectGroup(rootPart);
|
||||
|
||||
if (parts > 1)
|
||||
{
|
||||
for (int i = 2; i <= parts; i++)
|
||||
{
|
||||
sog.AddPart(
|
||||
new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
|
||||
{
|
||||
Name = string.Format("obj{0}", i),
|
||||
UUID = new UUID(string.Format("00000000-0000-0000-0000-{0:D12}", i))
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return sog;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue