diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs | 80 |
1 files changed, 58 insertions, 22 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index 0a82c4f..80f198d 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs | |||
@@ -49,25 +49,28 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
49 | [Test] | 49 | [Test] |
50 | public void TestAddSceneObject() | 50 | public void TestAddSceneObject() |
51 | { | 51 | { |
52 | TestHelper.InMethod(); | 52 | TestHelpers.InMethod(); |
53 | 53 | ||
54 | Scene scene = SceneSetupHelpers.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] |
@@ -76,9 +79,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
76 | /// </summary> | 79 | /// </summary> |
77 | public void TestAddExistingSceneObjectUuid() | 80 | public void TestAddExistingSceneObjectUuid() |
78 | { | 81 | { |
79 | TestHelper.InMethod(); | 82 | TestHelpers.InMethod(); |
80 | 83 | ||
81 | Scene scene = SceneSetupHelpers.SetupScene(); | 84 | Scene scene = SceneHelpers.SetupScene(); |
82 | 85 | ||
83 | string obj1Name = "Alfred"; | 86 | string obj1Name = "Alfred"; |
84 | string obj2Name = "Betty"; | 87 | string obj2Name = "Betty"; |
@@ -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. |
@@ -110,10 +146,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
110 | [Test] | 146 | [Test] |
111 | public void TestDeleteSceneObject() | 147 | public void TestDeleteSceneObject() |
112 | { | 148 | { |
113 | TestHelper.InMethod(); | 149 | TestHelpers.InMethod(); |
114 | 150 | ||
115 | TestScene scene = SceneSetupHelpers.SetupScene(); | 151 | TestScene scene = SceneHelpers.SetupScene(); |
116 | SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); | 152 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); |
117 | scene.DeleteSceneObject(part.ParentGroup, false); | 153 | scene.DeleteSceneObject(part.ParentGroup, false); |
118 | 154 | ||
119 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | 155 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); |
@@ -126,20 +162,20 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
126 | [Test] | 162 | [Test] |
127 | public void TestDeleteSceneObjectAsync() | 163 | public void TestDeleteSceneObjectAsync() |
128 | { | 164 | { |
129 | TestHelper.InMethod(); | 165 | TestHelpers.InMethod(); |
130 | //log4net.Config.XmlConfigurator.Configure(); | 166 | //log4net.Config.XmlConfigurator.Configure(); |
131 | 167 | ||
132 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); | 168 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); |
133 | 169 | ||
134 | TestScene scene = SceneSetupHelpers.SetupScene(); | 170 | TestScene scene = SceneHelpers.SetupScene(); |
135 | 171 | ||
136 | // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. | 172 | // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. |
137 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; | 173 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; |
138 | sogd.Enabled = false; | 174 | sogd.Enabled = false; |
139 | 175 | ||
140 | SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); | 176 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); |
141 | 177 | ||
142 | IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId); | 178 | IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient; |
143 | scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { part.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero); | 179 | scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { part.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero); |
144 | 180 | ||
145 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | 181 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); |