aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Tests')
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs75
1 files changed, 5 insertions, 70 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index df2dacb..946481c 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -135,6 +135,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
135 135
136 GridRegion region = scene.GridService.GetRegionByName(UUID.Zero, scene.RegionInfo.RegionName); 136 GridRegion region = scene.GridService.GetRegionByName(UUID.Zero, scene.RegionInfo.RegionName);
137 string reason; 137 string reason;
138
139 // *** This is the first stage, when a neighbouring region is told that a viewer is about to try and
140 // establish a child scene presence. We pass in the circuit code that the client has to connect with ***
138 // XXX: ViaLogin may not be correct here. 141 // XXX: ViaLogin may not be correct here.
139 scene.SimulationService.CreateAgent(region, acd, (uint)TeleportFlags.ViaLogin, out reason); 142 scene.SimulationService.CreateAgent(region, acd, (uint)TeleportFlags.ViaLogin, out reason);
140 143
@@ -144,6 +147,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
144 // There's no scene presence yet since only an agent circuit has been established. 147 // There's no scene presence yet since only an agent circuit has been established.
145 Assert.That(scene.GetScenePresence(agentId), Is.Null); 148 Assert.That(scene.GetScenePresence(agentId), Is.Null);
146 149
150 // *** This is the second stage, where the client established a child agent/scene presence using the
151 // circuit code given to the scene in stage 1 ***
147 TestClient client = new TestClient(acd, scene); 152 TestClient client = new TestClient(acd, scene);
148 scene.AddNewClient(client, PresenceType.User); 153 scene.AddNewClient(client, PresenceType.User);
149 154
@@ -247,48 +252,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
247// Assert.That(presence, Is.Null, "presence is not null"); 252// Assert.That(presence, Is.Null, "presence is not null");
248// } 253// }
249 254
250 [Test]
251 public void T012_TestAddNeighbourRegion()
252 {
253 TestHelpers.InMethod();
254
255 string reason;
256
257 if (acd1 == null)
258 fixNullPresence();
259
260 scene.NewUserConnection(acd1, 0, out reason);
261 if (testclient == null)
262 testclient = new TestClient(acd1, scene);
263 scene.AddNewClient(testclient, PresenceType.User);
264
265 ScenePresence presence = scene.GetScenePresence(agent1);
266 presence.MakeRootAgent(new Vector3(90,90,90),false);
267
268 string cap = presence.ControllingClient.RequestClientInfo().CapsPath;
269
270 presence.AddNeighbourRegion(region2, cap);
271 presence.AddNeighbourRegion(region3, cap);
272
273 Assert.That(presence.KnownRegionCount, Is.EqualTo(2));
274 }
275
276 [Test]
277 public void T013_TestRemoveNeighbourRegion()
278 {
279 TestHelpers.InMethod();
280
281 ScenePresence presence = scene.GetScenePresence(agent1);
282 presence.RemoveNeighbourRegion(region3);
283
284 Assert.That(presence.KnownRegionCount,Is.EqualTo(1));
285 /*
286 presence.MakeChildAgent;
287 presence.MakeRootAgent;
288 CompleteAvatarMovement
289 */
290 }
291
292 // I'm commenting this test because it does not represent 255 // I'm commenting this test because it does not represent
293 // crossings. The Thread.Sleep's in here are not meaningful mocks, 256 // crossings. The Thread.Sleep's in here are not meaningful mocks,
294 // and they sometimes fail in panda. 257 // and they sometimes fail in panda.
@@ -391,33 +354,5 @@ namespace OpenSim.Region.Framework.Scenes.Tests
391 Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected."); 354 Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected.");
392 Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again."); 355 Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again.");
393 } 356 }
394
395 public void fixNullPresence()
396 {
397 string firstName = "testfirstname";
398
399 AgentCircuitData agent = new AgentCircuitData();
400 agent.AgentID = agent1;
401 agent.firstname = firstName;
402 agent.lastname = "testlastname";
403 agent.SessionID = UUID.Zero;
404 agent.SecureSessionID = UUID.Zero;
405 agent.circuitcode = 123;
406 agent.BaseFolder = UUID.Zero;
407 agent.InventoryFolder = UUID.Zero;
408 agent.startpos = Vector3.Zero;
409 agent.CapsPath = GetRandomCapsObjectPath();
410 agent.Appearance = new AvatarAppearance();
411
412 acd1 = agent;
413 }
414
415 public static string GetRandomCapsObjectPath()
416 {
417 UUID caps = UUID.Random();
418 string capsPath = caps.ToString();
419 capsPath = capsPath.Remove(capsPath.Length - 4, 4);
420 return capsPath;
421 }
422 } 357 }
423} \ No newline at end of file 358} \ No newline at end of file