From 76135eec5bfcd31357f8e698538747eb72fb8233 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 21 May 2010 21:46:41 +0100
Subject: add test to make sure that adding an object where one already exists
in the scene with that uuid fails
---
.../Scenes/Tests/SceneObjectBasicTests.cs | 34 ++++++++++++++++++++++
1 file changed, 34 insertions(+)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
index 4fe4a6a..39f8acf 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
@@ -72,6 +72,40 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(retrievedPart.Name, Is.EqualTo(objName));
Assert.That(retrievedPart.UUID, Is.EqualTo(objUuid));
}
+
+ [Test]
+ ///
+ /// It shouldn't be possible to add a scene object if one with that uuid already exists in the scene.
+ ///
+ public void TestAddExistingSceneObjectUuid()
+ {
+ TestHelper.InMethod();
+
+ Scene scene = SceneSetupHelpers.SetupScene();
+
+ string obj1Name = "Alfred";
+ string obj2Name = "Betty";
+ UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001");
+
+ SceneObjectPart part1
+ = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
+ { Name = obj1Name, UUID = objUuid };
+
+ Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part1), false), Is.True);
+
+ SceneObjectPart part2
+ = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
+ { Name = obj2Name, UUID = objUuid };
+
+ Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part2), false), Is.False);
+
+ SceneObjectPart retrievedPart = scene.GetSceneObjectPart(objUuid);
+
+ //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(obj1Name));
+ Assert.That(retrievedPart.UUID, Is.EqualTo(objUuid));
+ }
///
/// Test deleting an object from a scene.
--
cgit v1.1