aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs112
3 files changed, 109 insertions, 10 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 3452f90..35c920b 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3049,8 +3049,8 @@ namespace OpenSim.Region.Framework.Scenes
3049 x = x / Constants.RegionSize; 3049 x = x / Constants.RegionSize;
3050 y = y / Constants.RegionSize; 3050 y = y / Constants.RegionSize;
3051 3051
3052 //m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); 3052// m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX)));
3053 //m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); 3053// m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY)));
3054 if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY)) 3054 if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY))
3055 { 3055 {
3056 byebyeRegions.Add(handle); 3056 byebyeRegions.Add(handle);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index 2e46377..1aa48d7 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -128,7 +128,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
128 IConfig config = configSource.AddConfig("Modules"); 128 IConfig config = configSource.AddConfig("Modules");
129 config.Set("SimulationServices", "LocalSimulationConnectorModule"); 129 config.Set("SimulationServices", "LocalSimulationConnectorModule");
130 130
131 TestScene scene = new SceneHelpers().SetupScene(); 131 SceneHelpers sceneHelpers = new SceneHelpers();
132 TestScene scene = sceneHelpers.SetupScene();
132 SceneHelpers.SetupSceneModules(scene, configSource, lsc); 133 SceneHelpers.SetupSceneModules(scene, configSource, lsc);
133 134
134 UUID agentId = TestHelpers.ParseTail(0x01); 135 UUID agentId = TestHelpers.ParseTail(0x01);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index c750cc5..ea4fb66 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -33,8 +33,9 @@ using OpenMetaverse;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Communications; 34using OpenSim.Framework.Communications;
35using OpenSim.Framework.Servers; 35using OpenSim.Framework.Servers;
36using OpenSim.Region.CoreModules.Framework.EntityTransfer;
37using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.CoreModules.Framework;
38using OpenSim.Region.CoreModules.Framework.EntityTransfer;
38using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 39using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
39using OpenSim.Tests.Common; 40using OpenSim.Tests.Common;
40using OpenSim.Tests.Common.Mock; 41using OpenSim.Tests.Common.Mock;
@@ -49,6 +50,22 @@ namespace OpenSim.Region.Framework.Scenes.Tests
49 [TestFixture] 50 [TestFixture]
50 public class ScenePresenceTeleportTests 51 public class ScenePresenceTeleportTests
51 { 52 {
53 [TestFixtureSetUp]
54 public void FixtureInit()
55 {
56 // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread.
57 Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest;
58 }
59
60 [TestFixtureTearDown]
61 public void TearDown()
62 {
63 // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
64 // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression
65 // tests really shouldn't).
66 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
67 }
68
52 [Test] 69 [Test]
53 public void TestSameRegionTeleport() 70 public void TestSameRegionTeleport()
54 { 71 {
@@ -96,10 +113,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests
96 LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); 113 LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
97 114
98 IConfigSource config = new IniConfigSource(); 115 IConfigSource config = new IniConfigSource();
99 config.AddConfig("Modules"); 116 IConfig modulesConfig = config.AddConfig("Modules");
100 // Not strictly necessary since FriendsModule assumes it is the default (!) 117 modulesConfig.Set("EntityTransferModule", etm.Name);
101 config.Configs["Modules"].Set("EntityTransferModule", etm.Name); 118 modulesConfig.Set("SimulationServices", lscm.Name);
102 config.Configs["Modules"].Set("SimulationServices", lscm.Name); 119 IConfig entityTransferConfig = config.AddConfig("EntityTransfer");
120
121 // In order to run a single threaded regression test we do not want the entity transfer module waiting
122 // for a callback from the destination scene before removing its avatar data.
123 entityTransferConfig.Set("wait_for_callback", false);
103 124
104 SceneHelpers sh = new SceneHelpers(); 125 SceneHelpers sh = new SceneHelpers();
105 TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); 126 TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
@@ -110,12 +131,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
110 Vector3 teleportPosition = new Vector3(10, 11, 12); 131 Vector3 teleportPosition = new Vector3(10, 11, 12);
111 Vector3 teleportLookAt = new Vector3(20, 21, 22); 132 Vector3 teleportLookAt = new Vector3(20, 21, 22);
112 133
113 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId); 134 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager);
114 sp.AbsolutePosition = new Vector3(30, 31, 32); 135 sp.AbsolutePosition = new Vector3(30, 31, 32);
115 136
116 // XXX: A very nasty hack to tell the client about the destination scene without having to crank the whole 137 // XXX: A very nasty hack to tell the client about the destination scene without having to crank the whole
117 // UDP stack (?) 138 // UDP stack (?)
118 ((TestClient)sp.ControllingClient).TeleportTargetScene = sceneB; 139// ((TestClient)sp.ControllingClient).TeleportTargetScene = sceneB;
119 140
120 sceneA.RequestTeleportLocation( 141 sceneA.RequestTeleportLocation(
121 sp.ControllingClient, 142 sp.ControllingClient,
@@ -124,6 +145,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
124 teleportLookAt, 145 teleportLookAt,
125 (uint)TeleportFlags.ViaLocation); 146 (uint)TeleportFlags.ViaLocation);
126 147
148 ((TestClient)sp.ControllingClient).CompleteTeleportClientSide();
149
127 Assert.That(sceneA.GetScenePresence(userId), Is.Null); 150 Assert.That(sceneA.GetScenePresence(userId), Is.Null);
128 151
129 ScenePresence sceneBSp = sceneB.GetScenePresence(userId); 152 ScenePresence sceneBSp = sceneB.GetScenePresence(userId);
@@ -137,5 +160,80 @@ namespace OpenSim.Region.Framework.Scenes.Tests
137 // position instead). 160 // position instead).
138// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); 161// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt));
139 } 162 }
163
164 [Test]
165 public void TestSameSimulatorNeighbouringRegionsTeleport()
166 {
167 TestHelpers.InMethod();
168// TestHelpers.EnableLogging();
169
170 UUID userId = TestHelpers.ParseTail(0x1);
171
172 EntityTransferModule etm = new EntityTransferModule();
173 LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
174
175 IConfigSource config = new IniConfigSource();
176 IConfig modulesConfig = config.AddConfig("Modules");
177 modulesConfig.Set("EntityTransferModule", etm.Name);
178 modulesConfig.Set("SimulationServices", lscm.Name);
179 IConfig entityTransferConfig = config.AddConfig("EntityTransfer");
180
181 // In order to run a single threaded regression test we do not want the entity transfer module waiting
182 // for a callback from the destination scene before removing its avatar data.
183 entityTransferConfig.Set("wait_for_callback", false);
184
185 SceneHelpers sh = new SceneHelpers();
186 TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
187 TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1001, 1000);
188
189 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, etm, lscm);
190 SceneHelpers.SetupSceneModules(sceneA, new CapabilitiesModule());
191 SceneHelpers.SetupSceneModules(sceneB, new CapabilitiesModule());
192
193 Vector3 teleportPosition = new Vector3(10, 11, 12);
194 Vector3 teleportLookAt = new Vector3(20, 21, 22);
195
196 ScenePresence originalSp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager);
197 originalSp.AbsolutePosition = new Vector3(30, 31, 32);
198
199 ScenePresence beforeSceneASp = sceneA.GetScenePresence(userId);
200 Assert.That(beforeSceneASp, Is.Not.Null);
201 Assert.That(beforeSceneASp.IsChildAgent, Is.False);
202
203 ScenePresence beforeSceneBSp = sceneB.GetScenePresence(userId);
204 Assert.That(beforeSceneBSp, Is.Not.Null);
205 Assert.That(beforeSceneBSp.IsChildAgent, Is.True);
206
207 // XXX: A very nasty hack to tell the client about the destination scene without having to crank the whole
208 // UDP stack (?)
209// ((TestClient)beforeSceneASp.ControllingClient).TeleportTargetScene = sceneB;
210
211 sceneA.RequestTeleportLocation(
212 beforeSceneASp.ControllingClient,
213 sceneB.RegionInfo.RegionHandle,
214 teleportPosition,
215 teleportLookAt,
216 (uint)TeleportFlags.ViaLocation);
217
218 ((TestClient)beforeSceneASp.ControllingClient).CompleteTeleportClientSide();
219
220 ScenePresence afterSceneASp = sceneA.GetScenePresence(userId);
221 Assert.That(afterSceneASp, Is.Not.Null);
222 Assert.That(afterSceneASp.IsChildAgent, Is.True);
223
224 ScenePresence afterSceneBSp = sceneB.GetScenePresence(userId);
225 Assert.That(afterSceneBSp, Is.Not.Null);
226 Assert.That(afterSceneBSp.IsChildAgent, Is.False);
227 Assert.That(afterSceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName));
228 Assert.That(afterSceneBSp.AbsolutePosition, Is.EqualTo(teleportPosition));
229
230 // TODO: Add assertions to check correct circuit details in both scenes.
231
232 // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera
233 // position instead).
234// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt));
235
236// TestHelpers.DisableLogging();
237 }
140 } 238 }
141} \ No newline at end of file 239} \ No newline at end of file