diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Tests')
4 files changed, 94 insertions, 13 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs index e140cd5..3a0dd00 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs | |||
@@ -28,20 +28,21 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | using NUnit.Framework; | ||
31 | using OpenMetaverse; | 32 | using OpenMetaverse; |
32 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
33 | 34 | using OpenSim.Tests.Common; | |
34 | using NUnit.Framework; | ||
35 | 35 | ||
36 | namespace OpenSim.Region.Framework.Scenes.Tests | 36 | namespace OpenSim.Region.Framework.Scenes.Tests |
37 | { | 37 | { |
38 | [TestFixture] | 38 | [TestFixture] |
39 | public class BorderTests | 39 | public class BorderTests |
40 | { | 40 | { |
41 | |||
42 | [Test] | 41 | [Test] |
43 | public void TestCross() | 42 | public void TestCross() |
44 | { | 43 | { |
44 | TestHelper.InMethod(); | ||
45 | |||
45 | List<Border> testborders = new List<Border>(); | 46 | List<Border> testborders = new List<Border>(); |
46 | 47 | ||
47 | Border NorthBorder = new Border(); | 48 | Border NorthBorder = new Border(); |
@@ -75,8 +76,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
75 | position = new Vector3(200,280,21); | 76 | position = new Vector3(200,280,21); |
76 | Assert.That(NorthBorder.TestCross(position)); | 77 | Assert.That(NorthBorder.TestCross(position)); |
77 | 78 | ||
78 | |||
79 | |||
80 | // Test automatic border crossing | 79 | // Test automatic border crossing |
81 | // by setting the border crossing aabb to be the whole region | 80 | // by setting the border crossing aabb to be the whole region |
82 | position = new Vector3(25,25,21); // safely within one 256m region | 81 | position = new Vector3(25,25,21); // safely within one 256m region |
@@ -95,12 +94,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
95 | 94 | ||
96 | WestBorder.BorderLine = new Vector3(0, 256, 255); // automatic border cross in the region | 95 | WestBorder.BorderLine = new Vector3(0, 256, 255); // automatic border cross in the region |
97 | Assert.That(WestBorder.TestCross(position)); | 96 | Assert.That(WestBorder.TestCross(position)); |
98 | |||
99 | } | 97 | } |
100 | 98 | ||
101 | [Test] | 99 | [Test] |
102 | public void TestCrossSquare512() | 100 | public void TestCrossSquare512() |
103 | { | 101 | { |
102 | TestHelper.InMethod(); | ||
103 | |||
104 | List<Border> testborders = new List<Border>(); | 104 | List<Border> testborders = new List<Border>(); |
105 | 105 | ||
106 | Border NorthBorder = new Border(); | 106 | Border NorthBorder = new Border(); |
@@ -174,12 +174,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
174 | Assert.That(!b.TestCross(position)); | 174 | Assert.That(!b.TestCross(position)); |
175 | 175 | ||
176 | } | 176 | } |
177 | |||
178 | } | 177 | } |
179 | 178 | ||
180 | [Test] | 179 | [Test] |
181 | public void TestCrossRectangle512x256() | 180 | public void TestCrossRectangle512x256() |
182 | { | 181 | { |
182 | TestHelper.InMethod(); | ||
183 | |||
183 | List<Border> testborders = new List<Border>(); | 184 | List<Border> testborders = new List<Border>(); |
184 | 185 | ||
185 | Border NorthBorder = new Border(); | 186 | Border NorthBorder = new Border(); |
@@ -258,6 +259,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
258 | [Test] | 259 | [Test] |
259 | public void TestCrossOdd512x512w256hole() | 260 | public void TestCrossOdd512x512w256hole() |
260 | { | 261 | { |
262 | TestHelper.InMethod(); | ||
263 | |||
261 | List<Border> testborders = new List<Border>(); | 264 | List<Border> testborders = new List<Border>(); |
262 | // 512____ | 265 | // 512____ |
263 | // | | | 266 | // | | |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs index 3e2a2af..b3c3e22 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs | |||
@@ -53,7 +53,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
53 | public void T010_AddObjects() | 53 | public void T010_AddObjects() |
54 | { | 54 | { |
55 | TestHelper.InMethod(); | 55 | TestHelper.InMethod(); |
56 | // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); | ||
57 | 56 | ||
58 | random = new Random(); | 57 | random = new Random(); |
59 | SceneObjectGroup found; | 58 | SceneObjectGroup found; |
@@ -89,7 +88,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
89 | public void T011_ThreadAddRemoveTest() | 88 | public void T011_ThreadAddRemoveTest() |
90 | { | 89 | { |
91 | TestHelper.InMethod(); | 90 | TestHelper.InMethod(); |
92 | // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); | ||
93 | 91 | ||
94 | // This test adds and removes with mutiple threads, attempting to break the | 92 | // This test adds and removes with mutiple threads, attempting to break the |
95 | // uuid and localid dictionary coherence. | 93 | // uuid and localid dictionary coherence. |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index 0b7608d..e3ef263 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs | |||
@@ -26,13 +26,13 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using System.Reflection; | 30 | using System.Reflection; |
30 | using NUnit.Framework; | 31 | using NUnit.Framework; |
31 | using NUnit.Framework.SyntaxHelpers; | 32 | using NUnit.Framework.SyntaxHelpers; |
32 | using OpenMetaverse; | 33 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
35 | |||
36 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
37 | using OpenSim.Tests.Common; | 37 | using OpenSim.Tests.Common; |
38 | using OpenSim.Tests.Common.Mock; | 38 | using OpenSim.Tests.Common.Mock; |
@@ -260,5 +260,86 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
260 | && (part4.RotationOffset.W - compareQuaternion.W < 0.00003), | 260 | && (part4.RotationOffset.W - compareQuaternion.W < 0.00003), |
261 | "Badness 3"); | 261 | "Badness 3"); |
262 | } | 262 | } |
263 | |||
264 | /// <summary> | ||
265 | /// Test that a new scene object which is already linked is correctly persisted to the persistence layer. | ||
266 | /// </summary> | ||
267 | [Test] | ||
268 | public void TestNewSceneObjectLinkPersistence() | ||
269 | { | ||
270 | TestHelper.InMethod(); | ||
271 | //log4net.Config.XmlConfigurator.Configure(); | ||
272 | |||
273 | TestScene scene = SceneSetupHelpers.SetupScene(); | ||
274 | |||
275 | string rootPartName = "rootpart"; | ||
276 | UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); | ||
277 | string linkPartName = "linkpart"; | ||
278 | UUID linkPartUuid = new UUID("00000000-0000-0000-0001-000000000000"); | ||
279 | |||
280 | SceneObjectPart rootPart | ||
281 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) | ||
282 | { Name = rootPartName, UUID = rootPartUuid }; | ||
283 | SceneObjectPart linkPart | ||
284 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) | ||
285 | { Name = linkPartName, UUID = linkPartUuid }; | ||
286 | |||
287 | SceneObjectGroup sog = new SceneObjectGroup(rootPart); | ||
288 | sog.AddPart(linkPart); | ||
289 | scene.AddNewSceneObject(sog, true); | ||
290 | |||
291 | // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked | ||
292 | // scene backup thread. | ||
293 | scene.Backup(true); | ||
294 | |||
295 | List<SceneObjectGroup> storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID); | ||
296 | |||
297 | Assert.That(storedObjects.Count, Is.EqualTo(1)); | ||
298 | Assert.That(storedObjects[0].Children.Count, Is.EqualTo(2)); | ||
299 | Assert.That(storedObjects[0].Children.ContainsKey(rootPartUuid)); | ||
300 | Assert.That(storedObjects[0].Children.ContainsKey(linkPartUuid)); | ||
301 | } | ||
302 | |||
303 | /// <summary> | ||
304 | /// Test that a delink of a previously linked object is correctly persisted to the database | ||
305 | /// </summary> | ||
306 | [Test] | ||
307 | public void TestDelinkPersistence() | ||
308 | { | ||
309 | TestHelper.InMethod(); | ||
310 | //log4net.Config.XmlConfigurator.Configure(); | ||
311 | |||
312 | TestScene scene = SceneSetupHelpers.SetupScene(); | ||
313 | |||
314 | string rootPartName = "rootpart"; | ||
315 | UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); | ||
316 | string linkPartName = "linkpart"; | ||
317 | UUID linkPartUuid = new UUID("00000000-0000-0000-0001-000000000000"); | ||
318 | |||
319 | SceneObjectPart rootPart | ||
320 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) | ||
321 | { Name = rootPartName, UUID = rootPartUuid }; | ||
322 | SceneObjectPart linkPart | ||
323 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) | ||
324 | { Name = linkPartName, UUID = linkPartUuid }; | ||
325 | |||
326 | SceneObjectGroup sog = new SceneObjectGroup(rootPart); | ||
327 | sog.AddPart(linkPart); | ||
328 | scene.AddNewSceneObject(sog, true); | ||
329 | |||
330 | // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked | ||
331 | // scene backup thread. | ||
332 | scene.Backup(true); | ||
333 | |||
334 | // These changes should occur immediately without waiting for a backup pass | ||
335 | SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false); | ||
336 | scene.DeleteSceneObject(groupToDelete, false); | ||
337 | |||
338 | List<SceneObjectGroup> storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID); | ||
339 | |||
340 | Assert.That(storedObjects.Count, Is.EqualTo(1)); | ||
341 | Assert.That(storedObjects[0].Children.Count, Is.EqualTo(1)); | ||
342 | Assert.That(storedObjects[0].Children.ContainsKey(rootPartUuid)); | ||
343 | } | ||
263 | } | 344 | } |
264 | } | 345 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index e39a362..ab5968c 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs | |||
@@ -173,6 +173,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
173 | 173 | ||
174 | Assert.That(neighbours.Count, Is.EqualTo(2)); | 174 | Assert.That(neighbours.Count, Is.EqualTo(2)); |
175 | } | 175 | } |
176 | |||
176 | public void fixNullPresence() | 177 | public void fixNullPresence() |
177 | { | 178 | { |
178 | string firstName = "testfirstname"; | 179 | string firstName = "testfirstname"; |
@@ -389,8 +390,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
389 | 390 | ||
390 | public static string GetRandomCapsObjectPath() | 391 | public static string GetRandomCapsObjectPath() |
391 | { | 392 | { |
392 | TestHelper.InMethod(); | ||
393 | |||
394 | UUID caps = UUID.Random(); | 393 | UUID caps = UUID.Random(); |
395 | string capsPath = caps.ToString(); | 394 | string capsPath = caps.ToString(); |
396 | capsPath = capsPath.Remove(capsPath.Length - 4, 4); | 395 | capsPath = capsPath.Remove(capsPath.Length - 4, 4); |
@@ -429,4 +428,4 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
429 | return name.ToString(); | 428 | return name.ToString(); |
430 | } | 429 | } |
431 | } | 430 | } |
432 | } | 431 | } \ No newline at end of file |