diff options
author | Justin Clark-Casey (justincc) | 2014-05-22 19:55:34 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-05-22 19:55:34 +0100 |
commit | 15b50ae737cf316cfe9db6843f06f7b3799f139e (patch) | |
tree | 085e9247f0208b61ba843d9b2ccec60bb62466e9 /OpenSim/Region/CoreModules/Avatar/Chat | |
parent | Simplify regression TestInterRegionChatDistanceEastWest() by making the child... (diff) | |
download | opensim-SC-15b50ae737cf316cfe9db6843f06f7b3799f139e.zip opensim-SC-15b50ae737cf316cfe9db6843f06f7b3799f139e.tar.gz opensim-SC-15b50ae737cf316cfe9db6843f06f7b3799f139e.tar.bz2 opensim-SC-15b50ae737cf316cfe9db6843f06f7b3799f139e.tar.xz |
Extend regression TestInterRegionChatDistanceEastWest() to test in range chat both ways.
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Chat')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs | 55 |
1 files changed, 38 insertions, 17 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs index c5eb2ad..fac9bd4 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs | |||
@@ -119,39 +119,60 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat.Tests | |||
119 | // TODO: May need to create special complete no-op test physics module rather than basic physics, since | 119 | // TODO: May need to create special complete no-op test physics module rather than basic physics, since |
120 | // physics is irrelevant to this test. | 120 | // physics is irrelevant to this test. |
121 | sp1.Flying = true; | 121 | sp1.Flying = true; |
122 | |||
123 | // When sp1 logs in to sceneEast, it sets up a child agent in sceneWest and informs the sp2 client to | ||
124 | // make the connection. For this test, will simplify this chain by making the connection directly. | ||
125 | ScenePresence sp1Child = SceneHelpers.AddChildScenePresence(sceneWest, sp1Uuid); | ||
126 | TestClient sp1ChildClient = (TestClient)sp1Child.ControllingClient; | ||
127 | |||
122 | sp1.AbsolutePosition = sp1Position; | 128 | sp1.AbsolutePosition = sp1Position; |
123 | 129 | ||
124 | ScenePresence sp2 = SceneHelpers.AddScenePresence(sceneWest, sp2Uuid); | 130 | ScenePresence sp2 = SceneHelpers.AddScenePresence(sceneWest, sp2Uuid); |
125 | TestClient sp2Client = (TestClient)sp2.ControllingClient; | 131 | TestClient sp2Client = (TestClient)sp2.ControllingClient; |
126 | |||
127 | // When sp2 logs in to sceneWest, it sets up a child agent in sceneEast and informs the sp2 client to | ||
128 | // make the connection. For this test, will simplify this chain by making the connection separately here. | ||
129 | ScenePresence sp2Child = SceneHelpers.AddChildScenePresence(sceneEast, sp2Uuid); | ||
130 | |||
131 | sp2.Flying = true; | 132 | sp2.Flying = true; |
132 | sp2.AbsolutePosition = sp2Position; | ||
133 | 133 | ||
134 | ScenePresence sp2Child = SceneHelpers.AddChildScenePresence(sceneEast, sp2Uuid); | ||
134 | TestClient sp2ChildClient = (TestClient)sp2Child.ControllingClient; | 135 | TestClient sp2ChildClient = (TestClient)sp2Child.ControllingClient; |
135 | 136 | ||
136 | // We must update the scene in order to make the new root agent sp2 in sceneWest trigger a position update to its | 137 | sp2.AbsolutePosition = sp2Position; |
137 | // child in sceneEast. | 138 | |
139 | // We must update the scenes in order to make the root new root agents trigger position updates in their | ||
140 | // children. | ||
138 | sceneWest.Update(1); | 141 | sceneWest.Update(1); |
142 | sceneEast.Update(1); | ||
143 | |||
144 | // Check child positions are correct. | ||
145 | Assert.AreEqual( | ||
146 | new Vector3(sp1Position.X + sceneEast.RegionInfo.RegionSizeX, sp1Position.Y, sp1Position.Z), | ||
147 | sp1ChildClient.SceneAgent.AbsolutePosition); | ||
139 | 148 | ||
140 | // Check child position is correct. | ||
141 | Assert.AreEqual( | 149 | Assert.AreEqual( |
142 | new Vector3(sp2Position.X - sceneWest.RegionInfo.RegionSizeX, sp2Position.Y, sp2Position.Z), | 150 | new Vector3(sp2Position.X - sceneWest.RegionInfo.RegionSizeX, sp2Position.Y, sp2Position.Z), |
143 | sp2ChildClient.SceneAgent.AbsolutePosition); | 151 | sp2ChildClient.SceneAgent.AbsolutePosition); |
144 | 152 | ||
145 | // Check chat received | 153 | // Check chat from sp1 |
146 | string receivedChatMessage = ""; | 154 | { |
155 | string receivedChatMessage = ""; | ||
156 | |||
157 | sp2ChildClient.OnReceivedChatMessage | ||
158 | += (message, type, fromPos, fromName, fromAgentID, ownerID, source, audible) => receivedChatMessage = message; | ||
159 | |||
160 | string testMessage = "'ello darling"; | ||
161 | sp1Client.Chat(0, ChatTypeEnum.Say, testMessage); | ||
162 | } | ||
163 | |||
164 | // Check chat from sp2 | ||
165 | { | ||
166 | string receivedChatMessage = ""; | ||
147 | 167 | ||
148 | sp2ChildClient.OnReceivedChatMessage | 168 | sp1ChildClient.OnReceivedChatMessage |
149 | += (message, type, fromPos, fromName, fromAgentID, ownerID, source, audible) => receivedChatMessage = message; | 169 | += (message, type, fromPos, fromName, fromAgentID, ownerID, source, audible) => receivedChatMessage = message; |
150 | 170 | ||
151 | string testMessage = "'ello darling"; | 171 | string testMessage = "fantastic cats"; |
152 | sp1Client.Chat(0, ChatTypeEnum.Say, testMessage); | 172 | sp2Client.Chat(0, ChatTypeEnum.Say, testMessage); |
153 | 173 | ||
154 | Assert.AreEqual(testMessage, receivedChatMessage); | 174 | Assert.AreEqual(testMessage, receivedChatMessage); |
175 | } | ||
155 | } | 176 | } |
156 | } | 177 | } |
157 | } \ No newline at end of file | 178 | } \ No newline at end of file |