From eb699df5f6c7a68a500e38dc994ed7c2f2aa89d9 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 18 Feb 2011 22:49:19 +0000 Subject: [PATCH] On SceneSetupHelpers, go back to calling ScenePresence.CompleteMovement() for the last stage of AddRootAgent() instead of SP.MakeRootAgent() Going this extra step doesn't appear to cause any test failures. This is arguably better for test purposes, though at some stage another method may arise which does just call AddRootAgent(). --- .../Scenes/Tests/ScenePresenceTests.cs | 60 +++++++++++++------ .../Tests/Common/Setup/SceneSetupHelpers.cs | 8 +-- 2 files changed, 44 insertions(+), 24 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index ddff89669a..92c73be722 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs @@ -172,25 +172,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(neighbours.Count, Is.EqualTo(2)); } - - public void fixNullPresence() - { - string firstName = "testfirstname"; - - AgentCircuitData agent = new AgentCircuitData(); - agent.AgentID = agent1; - agent.firstname = firstName; - agent.lastname = "testlastname"; - agent.SessionID = UUID.Zero; - agent.SecureSessionID = UUID.Zero; - agent.circuitcode = 123; - agent.BaseFolder = UUID.Zero; - agent.InventoryFolder = UUID.Zero; - agent.startpos = Vector3.Zero; - agent.CapsPath = GetRandomCapsObjectPath(); - - acd1 = agent; - } [Test] public void T013_TestRemoveNeighbourRegion() @@ -208,6 +189,28 @@ namespace OpenSim.Region.Framework.Scenes.Tests CompleteAvatarMovement */ } + + /// + /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region + /// + /// + /// Please note that unlike the other tests here, this doesn't rely on structures + /// + [Test] + public void TestChildAgentEstablished() + { + UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); + + TestScene myScene1 = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); + TestScene myScene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); + + SceneSetupHelpers.AddRootAgent(myScene1, agent1Id); + ScenePresence childPresence = myScene2.GetScenePresence(agent1); + + // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents +// Assert.That(childPresence, Is.Not.Null); +// Assert.That(childPresence.IsChildAgent, Is.True); + } // I'm commenting this test, because this is not supposed to happen here //[Test] @@ -330,7 +333,26 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected."); Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again."); } + + public void fixNullPresence() + { + string firstName = "testfirstname"; + AgentCircuitData agent = new AgentCircuitData(); + agent.AgentID = agent1; + agent.firstname = firstName; + agent.lastname = "testlastname"; + agent.SessionID = UUID.Zero; + agent.SecureSessionID = UUID.Zero; + agent.circuitcode = 123; + agent.BaseFolder = UUID.Zero; + agent.InventoryFolder = UUID.Zero; + agent.startpos = Vector3.Zero; + agent.CapsPath = GetRandomCapsObjectPath(); + + acd1 = agent; + } + public static string GetRandomCapsObjectPath() { UUID caps = UUID.Random(); diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 8b1649635c..d199e42440 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -504,12 +504,10 @@ namespace OpenSim.Tests.Common.Setup TestClient client = new TestClient(agentData, scene); scene.AddNewClient(client); - // Stage 3: Invoke agent crossing, which converts the child agent into a root agent (with appearance, - // inventory, etc.) - //scene.AgentCrossing(agentData.AgentID, new Vector3(90, 90, 90), false); OBSOLETE - + // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent. ScenePresence scp = scene.GetScenePresence(agentData.AgentID); - scp.MakeRootAgent(new Vector3(90, 90, 90), true); + scp.CompleteMovement(client); + //scp.MakeRootAgent(new Vector3(90, 90, 90), true); return client; }