From e261c974704098e5d1238ef800ef49d3ec7e75b8 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Fri, 21 Nov 2008 18:17:01 +0000 Subject: * On delete to inventory, actually remove the group from the scene before the async stage. * Last time I accidentally left the existing code in place that merely wiped the group from the client (but not the scene) * Put in an incomplete 'delete object o inventory' test to assert that this happens --- .../Scenes/AsyncSceneObjectGroupDeleter.cs | 7 +------ .../Environment/Scenes/Tests/SceneObjectTests.cs | 22 +++++++++++++++------- .../Environment/Scenes/Tests/SceneTestUtils.cs | 7 +++++-- 3 files changed, 21 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs index d92ff89..44c5a13 100644 --- a/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs +++ b/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs @@ -42,7 +42,6 @@ namespace OpenSim.Region.Environment.Scenes public IClientAPI remoteClient; public SceneObjectGroup objectGroup; public UUID folderID; - public bool permissionToDelete; } /// @@ -88,7 +87,6 @@ namespace OpenSim.Region.Environment.Scenes dtis.folderID = folderID; dtis.objectGroup = objectGroup; dtis.remoteClient = remoteClient; - dtis.permissionToDelete = permissionToDelete; m_inventoryDeletes.Enqueue(dtis); } @@ -96,9 +94,8 @@ namespace OpenSim.Region.Environment.Scenes if (Enabled) m_inventoryTicker.Start(); - // Visually remove it, even if it isnt really gone yet. if (permissionToDelete) - objectGroup.DeleteGroup(false); + m_scene.DeleteSceneObject(objectGroup, false); } private void InventoryRunDeleteTimer(object sender, ElapsedEventArgs e) @@ -129,8 +126,6 @@ namespace OpenSim.Region.Environment.Scenes try { - if (x.permissionToDelete) - m_scene.DeleteSceneObject(x.objectGroup, false); m_scene.DeleteToInventory(x.destination, x.folderID, x.objectGroup, x.remoteClient); } catch (Exception e) diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs index 66ea59e..e0d6a99 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs @@ -70,27 +70,35 @@ namespace OpenSim.Region.Environment.Scenes.Tests } /// - /// Test removing an object from a scene. + /// Test deleting an object from a scene. /// [Test] - public void TestRemoveSceneObject() + public void TestDeleteSceneObject() { TestScene scene = SceneTestUtils.SetupScene(); SceneObjectPart part = SceneTestUtils.AddSceneObject(scene); scene.DeleteSceneObject(part.ParentGroup, false); - SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); - + SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); Assert.That(retrievedPart, Is.Null); } /// - /// Test removing an object + /// Test deleting an object to user inventory /// - public void TestRemoveSceneObjectAsync() + [Test] + public void TestDeleteSceneObjectToUserInventory() { + UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); + TestScene scene = SceneTestUtils.SetupScene(); - SceneObjectPart part = SceneTestUtils.AddSceneObject(scene); + SceneObjectPart part = SceneTestUtils.AddSceneObject(scene); + + IClientAPI client = SceneTestUtils.AddRootAgent(scene, agentId); + scene.DeRezObject(client, part.LocalId, UUID.Zero, 9, UUID.Zero); + + SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); + Assert.That(retrievedPart, Is.Null); } } } \ 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 31fe0b6..2589368 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs @@ -75,7 +75,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests /// /// /// - public static void AddRootAgent(Scene scene, UUID agentId) + public static IClientAPI AddRootAgent(Scene scene, UUID agentId) { string firstName = "testfirstname"; @@ -92,7 +92,10 @@ namespace OpenSim.Region.Environment.Scenes.Tests agent.CapsPath = "http://wibble.com"; scene.NewUserConnection(agent); - scene.AddNewClient(new TestClient(agent), false); + IClientAPI client = new TestClient(agent); + scene.AddNewClient(client, false); + + return client; } /// -- cgit v1.1