From de88227bc486788197b3a7c842c8b60f82b0a29b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 Mar 2011 22:29:27 +0000 Subject: refactor: simplify part of AddSceneObject() test setup by moving sog construction into SceneSetupHelpers.CreateSceneObject() --- OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'OpenSim/Tests/Common') 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 return part; } + + /// + /// Create a scene object but do not add it to the scene. + /// + /// + /// UUID always starts at 00000000-0000-0000-0000-000000000001 + /// + /// The number of parts that should be in the scene object + /// + /// + 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; + } } } -- cgit v1.1