Split up test SceneHelpers to provide an AddChildScenePresence() call

iar_mods
Justin Clark-Casey (justincc) 2011-12-03 19:32:59 +00:00
parent a4d82895be
commit a82aea53f8
2 changed files with 26 additions and 10 deletions

View File

@ -166,6 +166,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Please note that unlike the other tests here, this doesn't rely on anything set up in the instance fields. /// Please note that unlike the other tests here, this doesn't rely on anything set up in the instance fields.
/// INCOMPLETE
/// </remarks> /// </remarks>
[Test] [Test]
public void TestChildAgentEstablishedInNeighbour() public void TestChildAgentEstablishedInNeighbour()

View File

@ -396,27 +396,42 @@ namespace OpenSim.Tests.Common
/// <returns></returns> /// <returns></returns>
public static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData) public static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData)
{ {
string reason;
// We emulate the proper login sequence here by doing things in four stages // We emulate the proper login sequence here by doing things in four stages
// Stage 0: log the presence // Stage 0: login
scene.PresenceService.LoginAgent(agentData.AgentID.ToString(), agentData.SessionID, agentData.SecureSessionID); scene.PresenceService.LoginAgent(agentData.AgentID.ToString(), agentData.SessionID, agentData.SecureSessionID);
// Stage 1: simulate login by telling the scene to expect a new user connection // Stages 1 & 2
if (!scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason)) ScenePresence sp = IntroduceClientToScene(scene, agentData, TeleportFlags.ViaLogin);
// Stage 3: Complete the entrance into the region. This converts the child agent into a root agent.
sp.CompleteMovement(sp.ControllingClient, true);
return sp;
}
private static ScenePresence IntroduceClientToScene(Scene scene, AgentCircuitData agentData, TeleportFlags tf)
{
string reason;
// Stage 1: tell the scene to expect a new user connection
if (!scene.NewUserConnection(agentData, (uint)tf, out reason))
Console.WriteLine("NewUserConnection failed: " + reason); Console.WriteLine("NewUserConnection failed: " + reason);
// Stage 2: add the new client as a child agent to the scene // Stage 2: add the new client as a child agent to the scene
TestClient client = new TestClient(agentData, scene); TestClient client = new TestClient(agentData, scene);
scene.AddNewClient(client, PresenceType.User); scene.AddNewClient(client, PresenceType.User);
// Stage 3: Complete the entrance into the region. This converts the child agent into a root agent. return scene.GetScenePresence(agentData.AgentID);
ScenePresence scp = scene.GetScenePresence(agentData.AgentID); }
scp.CompleteMovement(client, true);
//scp.MakeRootAgent(new Vector3(90, 90, 90), true);
return scp; public static ScenePresence AddChildScenePresence(Scene scene, UUID agentId)
{
AgentCircuitData acd = GenerateAgentData(agentId);
acd.child = true;
// XXX: ViaLogin may not be correct for child agents
return IntroduceClientToScene(scene, acd, TeleportFlags.ViaLogin);
} }
/// <summary> /// <summary>