diff options
author | Justin Clark-Casey (justincc) | 2014-04-03 00:19:53 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-04-03 00:19:53 +0100 |
commit | e6d0dcd4e80275b96322eb10b31a2b339e4a2d17 (patch) | |
tree | 2563e97bad5770551262be0dacdc0dca771777b1 /OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs | |
parent | String matching in REST handlers: must allow '-' as a separator, because the ... (diff) | |
download | opensim-SC_OLD-e6d0dcd4e80275b96322eb10b31a2b339e4a2d17.zip opensim-SC_OLD-e6d0dcd4e80275b96322eb10b31a2b339e4a2d17.tar.gz opensim-SC_OLD-e6d0dcd4e80275b96322eb10b31a2b339e4a2d17.tar.bz2 opensim-SC_OLD-e6d0dcd4e80275b96322eb10b31a2b339e4a2d17.tar.xz |
Fix bug where crossing to a neighbouring region and back again would trigger an exception, and a second recross would stop the user moving until relog
Also fixes an issue where sitting avatar counts became inaccurate after any cross.
Part of the problem was due to cloning code using MemberwiseClone() but not resetting certain collection structures.
Adds regression test for this case.
In relation to http://opensimulator.org/mantis/view.php?id=7050
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs | 107 |
1 files changed, 106 insertions, 1 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs index 4d07741..d65b0b6 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs | |||
@@ -26,10 +26,12 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using Nini.Config; | 30 | using Nini.Config; |
30 | using NUnit.Framework; | 31 | using NUnit.Framework; |
31 | using OpenMetaverse; | 32 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Region.CoreModules.Framework; | ||
33 | using OpenSim.Region.CoreModules.Framework.EntityTransfer; | 35 | using OpenSim.Region.CoreModules.Framework.EntityTransfer; |
34 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 36 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
35 | using OpenSim.Region.CoreModules.World.Land; | 37 | using OpenSim.Region.CoreModules.World.Land; |
@@ -101,7 +103,110 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
101 | /// Test cross with no prim limit module. | 103 | /// Test cross with no prim limit module. |
102 | /// </summary> | 104 | /// </summary> |
103 | /// <remarks> | 105 | /// <remarks> |
104 | /// XXX: This test may be better off in a specific PrimLimitsModuleTest class in optional module tests in the | 106 | /// Possibly this should belong in ScenePresenceCrossingTests, though here it is the object that is being moved |
107 | /// where the avatar is just a passenger. | ||
108 | /// </remarks> | ||
109 | [Test] | ||
110 | public void TestCrossOnSameSimulatorWithSittingAvatar() | ||
111 | { | ||
112 | TestHelpers.InMethod(); | ||
113 | // TestHelpers.EnableLogging(); | ||
114 | |||
115 | UUID userId = TestHelpers.ParseTail(0x1); | ||
116 | int sceneObjectIdTail = 0x2; | ||
117 | Vector3 so1StartPos = new Vector3(128, 10, 20); | ||
118 | |||
119 | EntityTransferModule etmA = new EntityTransferModule(); | ||
120 | EntityTransferModule etmB = new EntityTransferModule(); | ||
121 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); | ||
122 | |||
123 | IConfigSource config = new IniConfigSource(); | ||
124 | IConfig modulesConfig = config.AddConfig("Modules"); | ||
125 | modulesConfig.Set("EntityTransferModule", etmA.Name); | ||
126 | modulesConfig.Set("SimulationServices", lscm.Name); | ||
127 | IConfig entityTransferConfig = config.AddConfig("EntityTransfer"); | ||
128 | |||
129 | // In order to run a single threaded regression test we do not want the entity transfer module waiting | ||
130 | // for a callback from the destination scene before removing its avatar data. | ||
131 | entityTransferConfig.Set("wait_for_callback", false); | ||
132 | |||
133 | SceneHelpers sh = new SceneHelpers(); | ||
134 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); | ||
135 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1000, 999); | ||
136 | |||
137 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); | ||
138 | SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA); | ||
139 | SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB); | ||
140 | |||
141 | SceneObjectGroup so1 = SceneHelpers.AddSceneObject(sceneA, 1, userId, "", sceneObjectIdTail); | ||
142 | UUID so1Id = so1.UUID; | ||
143 | so1.AbsolutePosition = so1StartPos; | ||
144 | |||
145 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); | ||
146 | TestClient tc = new TestClient(acd, sceneA); | ||
147 | List<TestClient> destinationTestClients = new List<TestClient>(); | ||
148 | EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients); | ||
149 | |||
150 | ScenePresence sp1SceneA = SceneHelpers.AddScenePresence(sceneA, tc, acd); | ||
151 | sp1SceneA.AbsolutePosition = so1StartPos; | ||
152 | sp1SceneA.HandleAgentRequestSit(sp1SceneA.ControllingClient, sp1SceneA.UUID, so1.UUID, Vector3.Zero); | ||
153 | |||
154 | // Cross | ||
155 | sceneA.SceneGraph.UpdatePrimGroupPosition( | ||
156 | so1.LocalId, new Vector3(so1StartPos.X, so1StartPos.Y - 20, so1StartPos.Z), userId); | ||
157 | |||
158 | SceneObjectGroup so1PostCross; | ||
159 | |||
160 | { | ||
161 | ScenePresence sp1SceneAPostCross = sceneA.GetScenePresence(userId); | ||
162 | Assert.IsTrue(sp1SceneAPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly false"); | ||
163 | |||
164 | ScenePresence sp1SceneBPostCross = sceneB.GetScenePresence(userId); | ||
165 | TestClient sceneBTc = ((TestClient)sp1SceneBPostCross.ControllingClient); | ||
166 | sceneBTc.CompleteMovement(); | ||
167 | |||
168 | Assert.IsFalse(sp1SceneBPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly true"); | ||
169 | Assert.IsTrue(sp1SceneBPostCross.IsSatOnObject); | ||
170 | |||
171 | Assert.IsNull(sceneA.GetSceneObjectGroup(so1Id), "uck"); | ||
172 | so1PostCross = sceneB.GetSceneObjectGroup(so1Id); | ||
173 | Assert.NotNull(so1PostCross); | ||
174 | Assert.AreEqual(1, so1PostCross.GetSittingAvatarsCount()); | ||
175 | Assert.AreEqual(1, so1PostCross.GetLinkedAvatars().Count); | ||
176 | } | ||
177 | |||
178 | Vector3 so1PostCrossPos = so1PostCross.AbsolutePosition; | ||
179 | |||
180 | // Console.WriteLine("CRISSCROSS"); | ||
181 | |||
182 | // Recross | ||
183 | sceneB.SceneGraph.UpdatePrimGroupPosition( | ||
184 | so1PostCross.LocalId, new Vector3(so1PostCrossPos.X, so1PostCrossPos.Y + 20, so1PostCrossPos.Z), userId); | ||
185 | |||
186 | { | ||
187 | ScenePresence sp1SceneBPostReCross = sceneB.GetScenePresence(userId); | ||
188 | Assert.IsTrue(sp1SceneBPostReCross.IsChildAgent, "sp1SceneBPostReCross.IsChildAgent unexpectedly false"); | ||
189 | |||
190 | ScenePresence sp1SceneAPostReCross = sceneA.GetScenePresence(userId); | ||
191 | TestClient sceneATc = ((TestClient)sp1SceneAPostReCross.ControllingClient); | ||
192 | sceneATc.CompleteMovement(); | ||
193 | |||
194 | Assert.IsFalse(sp1SceneAPostReCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly true"); | ||
195 | Assert.IsTrue(sp1SceneAPostReCross.IsSatOnObject); | ||
196 | |||
197 | Assert.IsNull(sceneB.GetSceneObjectGroup(so1Id), "uck2"); | ||
198 | SceneObjectGroup so1PostReCross = sceneA.GetSceneObjectGroup(so1Id); | ||
199 | Assert.NotNull(so1PostReCross); | ||
200 | Assert.AreEqual(1, so1PostReCross.GetSittingAvatarsCount()); | ||
201 | Assert.AreEqual(1, so1PostReCross.GetLinkedAvatars().Count); | ||
202 | } | ||
203 | } | ||
204 | |||
205 | /// <summary> | ||
206 | /// Test cross with no prim limit module. | ||
207 | /// </summary> | ||
208 | /// <remarks> | ||
209 | /// XXX: This test may FCbe better off in a specific PrimLimitsModuleTest class in optional module tests in the | ||
105 | /// future (though it is configured as active by default, so not really optional). | 210 | /// future (though it is configured as active by default, so not really optional). |
106 | /// </remarks> | 211 | /// </remarks> |
107 | [Test] | 212 | [Test] |