improve TestAddSceneObject() to test a multi-part object rather than a single-part

remove-scene-viewer
Justin Clark-Casey (justincc) 2011-09-13 17:40:39 +01:00
parent 306af9934a
commit 88bd71b978
1 changed files with 14 additions and 11 deletions

View File

@ -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");
SceneObjectGroup so
= SceneHelpers.CreateSceneObject(partsToTestCount, TestHelpers.ParseTail(0x1), "obj1", 0x10);
SceneObjectPart[] parts = so.Parts;
SceneObjectPart part
= new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
{ Name = objName, UUID = objUuid };
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]