From 88bd71b9786f5af9ce185fa1c885622f41712371 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 13 Sep 2011 17:40:39 +0100 Subject: improve TestAddSceneObject() to test a multi-part object rather than a single-part --- .../Scenes/Tests/SceneObjectBasicTests.cs | 25 ++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index 1ea2329..8f2e21f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs @@ -52,22 +52,25 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelpers.InMethod(); Scene scene = SceneHelpers.SetupScene(); + int partsToTestCount = 3; - string objName = "obj1"; - UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001"); - - SceneObjectPart part - = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) - { Name = objName, UUID = objUuid }; + SceneObjectGroup so + = SceneHelpers.CreateSceneObject(partsToTestCount, TestHelpers.ParseTail(0x1), "obj1", 0x10); + SceneObjectPart[] parts = so.Parts; - Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part), false), Is.True); - - SceneObjectPart retrievedPart = scene.GetSceneObjectPart(objUuid); + Assert.That(scene.AddNewSceneObject(so, false), Is.True); + SceneObjectGroup retrievedSo = scene.GetSceneObjectGroup(so.UUID); + SceneObjectPart[] retrievedParts = retrievedSo.Parts; //m_log.Debug("retrievedPart : {0}", retrievedPart); // If the parts have the same UUID then we will consider them as one and the same - Assert.That(retrievedPart.Name, Is.EqualTo(objName)); - Assert.That(retrievedPart.UUID, Is.EqualTo(objUuid)); + Assert.That(retrievedSo.PrimCount, Is.EqualTo(partsToTestCount)); + + for (int i = 0; i < partsToTestCount; i++) + { + Assert.That(retrievedParts[i].Name, Is.EqualTo(parts[i].Name)); + Assert.That(retrievedParts[i].UUID, Is.EqualTo(parts[i].UUID)); + } } [Test] -- cgit v1.1