diff options
author | Justin Clark-Casey (justincc) | 2011-12-03 19:32:59 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-12-03 19:32:59 +0000 |
commit | a82aea53f863566037fa4fe3d546f57a49a126fa (patch) | |
tree | d264eec14628de88d44c2d23da8da240a68aa85e /OpenSim/Tests | |
parent | Remove T012_TestAddNeighbourRegion() and T013_TestRemoveNeighbourRegion() sin... (diff) | |
download | opensim-SC-a82aea53f863566037fa4fe3d546f57a49a126fa.zip opensim-SC-a82aea53f863566037fa4fe3d546f57a49a126fa.tar.gz opensim-SC-a82aea53f863566037fa4fe3d546f57a49a126fa.tar.bz2 opensim-SC-a82aea53f863566037fa4fe3d546f57a49a126fa.tar.xz |
Split up test SceneHelpers to provide an AddChildScenePresence() call
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index e4640be..a25eb66 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs | |||
@@ -396,27 +396,42 @@ namespace OpenSim.Tests.Common | |||
396 | /// <returns></returns> | 396 | /// <returns></returns> |
397 | public static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData) | 397 | public static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData) |
398 | { | 398 | { |
399 | string reason; | ||
400 | |||
401 | // We emulate the proper login sequence here by doing things in four stages | 399 | // We emulate the proper login sequence here by doing things in four stages |
402 | 400 | ||
403 | // Stage 0: log the presence | 401 | // Stage 0: login |
404 | scene.PresenceService.LoginAgent(agentData.AgentID.ToString(), agentData.SessionID, agentData.SecureSessionID); | 402 | scene.PresenceService.LoginAgent(agentData.AgentID.ToString(), agentData.SessionID, agentData.SecureSessionID); |
405 | 403 | ||
406 | // Stage 1: simulate login by telling the scene to expect a new user connection | 404 | // Stages 1 & 2 |
407 | if (!scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason)) | 405 | ScenePresence sp = IntroduceClientToScene(scene, agentData, TeleportFlags.ViaLogin); |
406 | |||
407 | // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent. | ||
408 | sp.CompleteMovement(sp.ControllingClient, true); | ||
409 | |||
410 | return sp; | ||
411 | } | ||
412 | |||
413 | private static ScenePresence IntroduceClientToScene(Scene scene, AgentCircuitData agentData, TeleportFlags tf) | ||
414 | { | ||
415 | string reason; | ||
416 | |||
417 | // Stage 1: tell the scene to expect a new user connection | ||
418 | if (!scene.NewUserConnection(agentData, (uint)tf, out reason)) | ||
408 | Console.WriteLine("NewUserConnection failed: " + reason); | 419 | Console.WriteLine("NewUserConnection failed: " + reason); |
409 | 420 | ||
410 | // Stage 2: add the new client as a child agent to the scene | 421 | // Stage 2: add the new client as a child agent to the scene |
411 | TestClient client = new TestClient(agentData, scene); | 422 | TestClient client = new TestClient(agentData, scene); |
412 | scene.AddNewClient(client, PresenceType.User); | 423 | scene.AddNewClient(client, PresenceType.User); |
413 | 424 | ||
414 | // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent. | 425 | return scene.GetScenePresence(agentData.AgentID); |
415 | ScenePresence scp = scene.GetScenePresence(agentData.AgentID); | 426 | } |
416 | scp.CompleteMovement(client, true); | 427 | |
417 | //scp.MakeRootAgent(new Vector3(90, 90, 90), true); | 428 | public static ScenePresence AddChildScenePresence(Scene scene, UUID agentId) |
429 | { | ||
430 | AgentCircuitData acd = GenerateAgentData(agentId); | ||
431 | acd.child = true; | ||
418 | 432 | ||
419 | return scp; | 433 | // XXX: ViaLogin may not be correct for child agents |
434 | return IntroduceClientToScene(scene, acd, TeleportFlags.ViaLogin); | ||
420 | } | 435 | } |
421 | 436 | ||
422 | /// <summary> | 437 | /// <summary> |