From 5f9ccd486f9f8317cce3badcb62d646766c5642c Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Fri, 28 Nov 2008 20:58:12 +0000
Subject: * test: Extend take object test to finally check that the object made
it into user inventory and that it was removed from the scene
---
.../Environment/Scenes/Tests/SceneObjectTests.cs | 18 ++++++++++++------
.../Region/Environment/Scenes/Tests/SceneTestUtils.cs | 17 ++++++++++++++++-
2 files changed, 28 insertions(+), 7 deletions(-)
(limited to 'OpenSim/Region/Environment')
diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs
index 500512e..ba231ca 100644
--- a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs
+++ b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs
@@ -105,17 +105,18 @@ namespace OpenSim.Region.Environment.Scenes.Tests
}
///
- /// Test deleting an object asynchronously to user inventory. Doesn't yet do what it says on the tin.
+ /// Test deleting an object asynchronously to user inventory.
///
[Test]
public void TestDeleteSceneObjectAsyncToUserInventory()
{
- log4net.Config.XmlConfigurator.Configure();
+ //log4net.Config.XmlConfigurator.Configure();
UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
+ string myObjectName = "Fred";
TestScene scene = SceneTestUtils.SetupScene();
- SceneObjectPart part = SceneTestUtils.AddSceneObject(scene);
+ SceneObjectPart part = SceneTestUtils.AddSceneObject(scene, myObjectName);
((LocalUserServices)scene.CommsManager.UserService).AddPlugin(new TestUserDataPlugin());
((LocalInventoryService)scene.CommsManager.InventoryService).AddPlugin(new TestInventoryDataPlugin());
@@ -131,11 +132,16 @@ namespace OpenSim.Region.Environment.Scenes.Tests
Assert.That(userInfo, Is.Not.Null);
Assert.That(userInfo.RootFolder, Is.Not.Null);
- SceneTestUtils.DeleteSceneObjectAsync(scene, part, DeRezAction.TakeCopy, userInfo.RootFolder.ID, client);
+ SceneTestUtils.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client);
+
+ // Check that we now have the taken part in our inventory
+ Assert.That(myObjectName, Is.EqualTo(userInfo.RootFolder.FindItemByPath(myObjectName).Name));
- // TODO: test that the object actually made it successfully into inventory
+ // Check that the taken part has actually disappeared
+ SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
+ Assert.That(retrievedPart, Is.Null);
- log4net.LogManager.Shutdown();
+ //log4net.LogManager.Shutdown();
}
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs
index b169d9a..985c8a3 100644
--- a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs
+++ b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs
@@ -111,17 +111,32 @@ namespace OpenSim.Region.Environment.Scenes.Tests
return client;
}
+
+ ///
+ /// Add a test object
+ ///
+ ///
+ ///
+ public static SceneObjectPart AddSceneObject(Scene scene)
+ {
+ return AddSceneObject(scene, null);
+ }
///
/// Add a test object
///
///
+ ///
///
- public static SceneObjectPart AddSceneObject(Scene scene)
+ public static SceneObjectPart AddSceneObject(Scene scene, string name)
{
SceneObjectGroup sceneObject = new SceneObjectGroup();
SceneObjectPart part
= new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero);
+
+ if (name != null)
+ part.Name = name;
+
//part.UpdatePrimFlags(false, false, true);
part.ObjectFlags |= (uint)PrimFlags.Phantom;
sceneObject.SetRootPart(part);
--
cgit v1.1