diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs | 58 |
1 files changed, 47 insertions, 11 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index 1ea2329..80f198d 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 | |||
52 | TestHelpers.InMethod(); | 52 | TestHelpers.InMethod(); |
53 | 53 | ||
54 | Scene scene = SceneHelpers.SetupScene(); | 54 | Scene scene = SceneHelpers.SetupScene(); |
55 | int partsToTestCount = 3; | ||
55 | 56 | ||
56 | string objName = "obj1"; | 57 | SceneObjectGroup so |
57 | UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001"); | 58 | = SceneHelpers.CreateSceneObject(partsToTestCount, TestHelpers.ParseTail(0x1), "obj1", 0x10); |
58 | 59 | SceneObjectPart[] parts = so.Parts; | |
59 | SceneObjectPart part | ||
60 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) | ||
61 | { Name = objName, UUID = objUuid }; | ||
62 | 60 | ||
63 | Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part), false), Is.True); | 61 | Assert.That(scene.AddNewSceneObject(so, false), Is.True); |
64 | 62 | SceneObjectGroup retrievedSo = scene.GetSceneObjectGroup(so.UUID); | |
65 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(objUuid); | 63 | SceneObjectPart[] retrievedParts = retrievedSo.Parts; |
66 | 64 | ||
67 | //m_log.Debug("retrievedPart : {0}", retrievedPart); | 65 | //m_log.Debug("retrievedPart : {0}", retrievedPart); |
68 | // If the parts have the same UUID then we will consider them as one and the same | 66 | // If the parts have the same UUID then we will consider them as one and the same |
69 | Assert.That(retrievedPart.Name, Is.EqualTo(objName)); | 67 | Assert.That(retrievedSo.PrimCount, Is.EqualTo(partsToTestCount)); |
70 | Assert.That(retrievedPart.UUID, Is.EqualTo(objUuid)); | 68 | |
69 | for (int i = 0; i < partsToTestCount; i++) | ||
70 | { | ||
71 | Assert.That(retrievedParts[i].Name, Is.EqualTo(parts[i].Name)); | ||
72 | Assert.That(retrievedParts[i].UUID, Is.EqualTo(parts[i].UUID)); | ||
73 | } | ||
71 | } | 74 | } |
72 | 75 | ||
73 | [Test] | 76 | [Test] |
@@ -103,6 +106,39 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
103 | Assert.That(retrievedPart.Name, Is.EqualTo(obj1Name)); | 106 | Assert.That(retrievedPart.Name, Is.EqualTo(obj1Name)); |
104 | Assert.That(retrievedPart.UUID, Is.EqualTo(objUuid)); | 107 | Assert.That(retrievedPart.UUID, Is.EqualTo(objUuid)); |
105 | } | 108 | } |
109 | |||
110 | /// <summary> | ||
111 | /// Test retrieving a scene object via the local id of one of its parts. | ||
112 | /// </summary> | ||
113 | [Test] | ||
114 | public void TestGetSceneObjectByPartLocalId() | ||
115 | { | ||
116 | TestHelpers.InMethod(); | ||
117 | |||
118 | Scene scene = SceneHelpers.SetupScene(); | ||
119 | int partsToTestCount = 3; | ||
120 | |||
121 | SceneObjectGroup so | ||
122 | = SceneHelpers.CreateSceneObject(partsToTestCount, TestHelpers.ParseTail(0x1), "obj1", 0x10); | ||
123 | SceneObjectPart[] parts = so.Parts; | ||
124 | |||
125 | scene.AddNewSceneObject(so, false); | ||
126 | |||
127 | // Test getting via the root part's local id | ||
128 | Assert.That(scene.GetGroupByPrim(so.LocalId), Is.Not.Null); | ||
129 | |||
130 | // Test getting via a non root part's local id | ||
131 | Assert.That(scene.GetGroupByPrim(parts[partsToTestCount - 1].LocalId), Is.Not.Null); | ||
132 | |||
133 | // Test that we don't get back an object for a local id that doesn't exist | ||
134 | Assert.That(scene.GetGroupByPrim(999), Is.Null); | ||
135 | |||
136 | // Now delete the scene object and check again | ||
137 | scene.DeleteSceneObject(so, false); | ||
138 | |||
139 | Assert.That(scene.GetGroupByPrim(so.LocalId), Is.Null); | ||
140 | Assert.That(scene.GetGroupByPrim(parts[partsToTestCount - 1].LocalId), Is.Null); | ||
141 | } | ||
106 | 142 | ||
107 | /// <summary> | 143 | /// <summary> |
108 | /// Test deleting an object from a scene. | 144 | /// Test deleting an object from a scene. |