diff options
Diffstat (limited to 'OpenSim/Framework/Tests')
-rw-r--r-- | OpenSim/Framework/Tests/AgentCircuitDataTest.cs | 339 |
1 files changed, 339 insertions, 0 deletions
diff --git a/OpenSim/Framework/Tests/AgentCircuitDataTest.cs b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs new file mode 100644 index 0000000..0bf8f64 --- /dev/null +++ b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs | |||
@@ -0,0 +1,339 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | using System.Collections.Generic; | ||
28 | using OpenMetaverse; | ||
29 | using OpenMetaverse.StructuredData; | ||
30 | using NUnit.Framework; | ||
31 | |||
32 | |||
33 | namespace OpenSim.Framework.Tests | ||
34 | { | ||
35 | [TestFixture] | ||
36 | public class AgentCircuitDataTest | ||
37 | { | ||
38 | private UUID AgentId; | ||
39 | private AvatarAppearance AvAppearance; | ||
40 | private byte[] VisualParams; | ||
41 | private UUID BaseFolder; | ||
42 | private string CapsPath; | ||
43 | private Dictionary<ulong, string> ChildrenCapsPaths; | ||
44 | private uint circuitcode = 0949030; | ||
45 | private string firstname; | ||
46 | private string lastname; | ||
47 | private UUID SecureSessionId; | ||
48 | private UUID SessionId; | ||
49 | private Vector3 StartPos; | ||
50 | |||
51 | |||
52 | [SetUp] | ||
53 | public void setup() | ||
54 | { | ||
55 | AgentId = UUID.Random(); | ||
56 | BaseFolder = UUID.Random(); | ||
57 | CapsPath = "http://www.opensimulator.org/Caps/Foo"; | ||
58 | ChildrenCapsPaths = new Dictionary<ulong, string>(); | ||
59 | ChildrenCapsPaths.Add(ulong.MaxValue, "http://www.opensimulator.org/Caps/Foo2"); | ||
60 | firstname = "CoolAvatarTest"; | ||
61 | lastname = "test"; | ||
62 | StartPos = new Vector3(5,23,125); | ||
63 | |||
64 | SecureSessionId = UUID.Random(); | ||
65 | SessionId = UUID.Random(); | ||
66 | |||
67 | AvAppearance = new AvatarAppearance(AgentId); | ||
68 | AvAppearance.SetDefaultWearables(); | ||
69 | VisualParams = new byte[218]; | ||
70 | AvAppearance.SetDefaultParams(VisualParams); | ||
71 | |||
72 | //body | ||
73 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HEIGHT] = 155; | ||
74 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_THICKNESS] = 00; | ||
75 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BODY_FAT] = 0; | ||
76 | |||
77 | //Torso | ||
78 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_TORSO_MUSCLES] = 48; | ||
79 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_NECK_THICKNESS] = 43; | ||
80 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_NECK_LENGTH] = 255; | ||
81 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SHOULDERS] = 94; | ||
82 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_CHEST_MALE_NO_PECS] = 199; | ||
83 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_ARM_LENGTH] = 255; | ||
84 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HAND_SIZE] = 33; | ||
85 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_TORSO_LENGTH] = 240; | ||
86 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LOVE_HANDLES] = 0; | ||
87 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BELLY_SIZE] = 0; | ||
88 | |||
89 | // legs | ||
90 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LEG_MUSCLES] = 82; | ||
91 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LEG_LENGTH] = 255; | ||
92 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HIP_WIDTH] = 84; | ||
93 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HIP_LENGTH] = 166; | ||
94 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BUTT_SIZE] = 64; | ||
95 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SADDLEBAGS] = 89; | ||
96 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BOWED_LEGS] = 127; | ||
97 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_FOOT_SIZE] = 45; | ||
98 | |||
99 | |||
100 | // head | ||
101 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HEAD_SIZE] = 255; | ||
102 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SQUASH_STRETCH_HEAD] = 0; // head stretch | ||
103 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HEAD_SHAPE] = 155; | ||
104 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EGG_HEAD] = 127; | ||
105 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_POINTY_EARS] = 255; | ||
106 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HEAD_LENGTH] = 45; | ||
107 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_FACE_SHEAR] = 127; | ||
108 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_FOREHEAD_ANGLE] = 104; | ||
109 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BIG_BROW] = 94; | ||
110 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_PUFFY_UPPER_CHEEKS] = 0; // upper cheeks | ||
111 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_DOUBLE_CHIN] = 122; // lower cheeks | ||
112 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HIGH_CHEEK_BONES] = 130; | ||
113 | |||
114 | |||
115 | |||
116 | // eyes | ||
117 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYE_SIZE] = 105; | ||
118 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WIDE_EYES] = 135; | ||
119 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYE_SPACING] = 184; | ||
120 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYELID_CORNER_UP] = 230; | ||
121 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYELID_INNER_CORNER_UP] = 120; | ||
122 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYE_DEPTH] = 158; | ||
123 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_UPPER_EYELID_FOLD] = 69; | ||
124 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BAGGY_EYES] = 38; | ||
125 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYELASHES_LONG] = 127; | ||
126 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_POP_EYE] = 127; | ||
127 | |||
128 | VisualParams[(int)AvatarAppearance.VPElement.EYES_EYE_COLOR] = 25; | ||
129 | VisualParams[(int)AvatarAppearance.VPElement.EYES_EYE_LIGHTNESS] = 127; | ||
130 | |||
131 | // ears | ||
132 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BIG_EARS] = 255; | ||
133 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EARS_OUT] = 127; | ||
134 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_ATTACHED_EARLOBES] = 127; | ||
135 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_POINTY_EARS] = 255; | ||
136 | |||
137 | // nose | ||
138 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_NOSE_BIG_OUT] = 79; | ||
139 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WIDE_NOSE] = 35; | ||
140 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BROAD_NOSTRILS] = 86; | ||
141 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LOW_SEPTUM_NOSE] = 112; // nostril division | ||
142 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BULBOUS_NOSE] = 25; | ||
143 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_NOBLE_NOSE_BRIDGE] = 25; // upper bridge | ||
144 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LOWER_BRIDGE_NOSE] = 25; // lower bridge | ||
145 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WIDE_NOSE_BRIDGE] = 25; | ||
146 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_UPTURNED_NOSE_TIP] = 107; | ||
147 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BULBOUS_NOSE_TIP] = 25; | ||
148 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_CROOKED_NOSE] = 127; | ||
149 | |||
150 | |||
151 | // Mouth | ||
152 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LIP_WIDTH] = 122; | ||
153 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_TALL_LIPS] = 10; // lip fullness | ||
154 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LIP_THICKNESS] = 112; | ||
155 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LIP_RATIO] = 137; | ||
156 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_MOUTH_HEIGHT] = 176; | ||
157 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_MOUTH_CORNER] = 140; // Sad --> happy | ||
158 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LIP_CLEFT_DEEP] = 84; | ||
159 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WIDE_LIP_CLEFT] = 84; | ||
160 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SHIFT_MOUTH] = 127; | ||
161 | |||
162 | |||
163 | // chin | ||
164 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WEAK_CHIN] = 119; | ||
165 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SQUARE_JAW] = 5; | ||
166 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_DEEP_CHIN] = 132; | ||
167 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_JAW_ANGLE] = 153; | ||
168 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_JAW_JUT] = 100; | ||
169 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_JOWLS] = 38; | ||
170 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_CLEFT_CHIN] = 89; | ||
171 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_CLEFT_CHIN_UPPER] = 89; | ||
172 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_DOUBLE_CHIN] = 0; | ||
173 | |||
174 | |||
175 | // hair color | ||
176 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_WHITE_HAIR] = 0; | ||
177 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_RAINBOW_COLOR_39] = 0; | ||
178 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_BLONDE_HAIR] = 24; | ||
179 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_RED_HAIR] = 0; | ||
180 | |||
181 | // hair style | ||
182 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_VOLUME] = 160; | ||
183 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_FRONT] = 153; | ||
184 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SIDES] = 153; | ||
185 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_BACK] = 170; | ||
186 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_BIG_FRONT] = 0; | ||
187 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_BIG_TOP] = 117; | ||
188 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_BIG_BACK] = 170; | ||
189 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_FRONT_FRINGE] = 0; | ||
190 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_SIDE_FRINGE] = 142; | ||
191 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_BACK_FRINGE] = 0; | ||
192 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SIDES_FULL] = 146; | ||
193 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SWEEP] = 0; | ||
194 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SHEAR_FRONT] = 0; | ||
195 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SHEAR_BACK] = 0; | ||
196 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_TAPER_FRONT] = 0; | ||
197 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_TAPER_BACK] = 0; | ||
198 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_RUMPLED] = 0; | ||
199 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_PIGTAILS] = 0; | ||
200 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_PONYTAIL] = 0; | ||
201 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SPIKED] = 0; | ||
202 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_TILT] = 0; | ||
203 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_PART_MIDDLE] = 0; | ||
204 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_PART_RIGHT] = 0; | ||
205 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_PART_LEFT] = 0; | ||
206 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_BANGS_PART_MIDDLE] = 155; | ||
207 | |||
208 | //Eyebrows | ||
209 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_EYEBROW_SIZE] = 20; | ||
210 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_EYEBROW_DENSITY] = 140; | ||
211 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_LOWER_EYEBROWS] = 200; // eyebrow height | ||
212 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_ARCED_EYEBROWS] = 124; | ||
213 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_POINTY_EYEBROWS] = 65; | ||
214 | |||
215 | //Facial hair | ||
216 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_THICKNESS] = 65; | ||
217 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_SIDEBURNS] = 235; | ||
218 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_MOUSTACHE] = 75; | ||
219 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_CHIN_CURTAINS] = 140; | ||
220 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_SOULPATCH] = 0; | ||
221 | |||
222 | AvAppearance.VisualParams = VisualParams; | ||
223 | |||
224 | List<byte> wearbyte = new List<byte>(); | ||
225 | for (int i = 0; i < VisualParams.Length; i++) | ||
226 | { | ||
227 | wearbyte.Add(VisualParams[i]); | ||
228 | } | ||
229 | |||
230 | |||
231 | AvAppearance.SetAppearance(AvAppearance.Texture.GetBytes(), wearbyte); | ||
232 | } | ||
233 | |||
234 | /// <summary> | ||
235 | /// Test to ensure that the serialization format is the same and the underlying types don't change without notice | ||
236 | /// oldSerialization is just a json serialization of the OSDMap packed for the AgentCircuitData. | ||
237 | /// The idea is that if the current json serializer cannot parse the old serialization, then the underlying types | ||
238 | /// have changed and are incompatible. | ||
239 | /// </summary> | ||
240 | [Test] | ||
241 | public void HistoricalAgentCircuitDataOSDConversion() | ||
242 | { | ||
243 | string oldSerialization = "{\"agent_id\":\"522675bd-8214-40c1-b3ca-9c7f7fd170be\",\"base_folder\":\"c40b5f5f-476f-496b-bd69-b5a539c434d8\",\"caps_path\":\"http://www.opensimulator.org/Caps/Foo\",\"children_seeds\":[{\"handle\":\"18446744073709551615\",\"seed\":\"http://www.opensimulator.org/Caps/Foo2\"}],\"child\":false,\"circuit_code\":\"949030\",\"first_name\":\"CoolAvatarTest\",\"last_name\":\"test\",\"inventory_folder\":\"c40b5f5f-476f-496b-bd69-b5a539c434d8\",\"secure_session_id\":\"1e608e2b-0ddb-41f6-be0f-926f61cd3e0a\",\"session_id\":\"aa06f798-9d70-4bdb-9bbf-012a02ee2baf\",\"start_pos\":\"<5, 23, 125>\"}"; | ||
244 | AgentCircuitData Agent1Data = new AgentCircuitData(); | ||
245 | Agent1Data.AgentID = new UUID("522675bd-8214-40c1-b3ca-9c7f7fd170be"); | ||
246 | Agent1Data.Appearance = AvAppearance; | ||
247 | Agent1Data.BaseFolder = new UUID("c40b5f5f-476f-496b-bd69-b5a539c434d8"); | ||
248 | Agent1Data.CapsPath = CapsPath; | ||
249 | Agent1Data.child = false; | ||
250 | Agent1Data.ChildrenCapSeeds = ChildrenCapsPaths; | ||
251 | Agent1Data.circuitcode = circuitcode; | ||
252 | Agent1Data.firstname = firstname; | ||
253 | Agent1Data.InventoryFolder = new UUID("c40b5f5f-476f-496b-bd69-b5a539c434d8"); | ||
254 | Agent1Data.lastname = lastname; | ||
255 | Agent1Data.SecureSessionID = new UUID("1e608e2b-0ddb-41f6-be0f-926f61cd3e0a"); | ||
256 | Agent1Data.SessionID = new UUID("aa06f798-9d70-4bdb-9bbf-012a02ee2baf"); | ||
257 | Agent1Data.startpos = StartPos; | ||
258 | |||
259 | OSDMap map2 = (OSDMap)OSDParser.DeserializeJson(oldSerialization); | ||
260 | |||
261 | |||
262 | AgentCircuitData Agent2Data = new AgentCircuitData(); | ||
263 | Agent2Data.UnpackAgentCircuitData(map2); | ||
264 | |||
265 | Assert.That((Agent1Data.AgentID == Agent2Data.AgentID)); | ||
266 | Assert.That((Agent1Data.BaseFolder == Agent2Data.BaseFolder)); | ||
267 | |||
268 | Assert.That((Agent1Data.CapsPath == Agent2Data.CapsPath)); | ||
269 | Assert.That((Agent1Data.child == Agent2Data.child)); | ||
270 | Assert.That((Agent1Data.ChildrenCapSeeds.Count == Agent2Data.ChildrenCapSeeds.Count)); | ||
271 | Assert.That((Agent1Data.circuitcode == Agent2Data.circuitcode)); | ||
272 | Assert.That((Agent1Data.firstname == Agent2Data.firstname)); | ||
273 | Assert.That((Agent1Data.InventoryFolder == Agent2Data.InventoryFolder)); | ||
274 | Assert.That((Agent1Data.lastname == Agent2Data.lastname)); | ||
275 | Assert.That((Agent1Data.SecureSessionID == Agent2Data.SecureSessionID)); | ||
276 | Assert.That((Agent1Data.SessionID == Agent2Data.SessionID)); | ||
277 | Assert.That((Agent1Data.startpos == Agent2Data.startpos)); | ||
278 | /* | ||
279 | Enable this once VisualParams go in the packing method | ||
280 | for (int i=0;i<208;i++) | ||
281 | Assert.That((Agent1Data.Appearance.VisualParams[i] == Agent2Data.Appearance.VisualParams[i])); | ||
282 | */ | ||
283 | } | ||
284 | |||
285 | /// <summary> | ||
286 | /// Test to ensure that the packing and unpacking methods work. | ||
287 | /// </summary> | ||
288 | [Test] | ||
289 | public void TestAgentCircuitDataOSDConversion() | ||
290 | { | ||
291 | AgentCircuitData Agent1Data = new AgentCircuitData(); | ||
292 | Agent1Data.AgentID = AgentId; | ||
293 | Agent1Data.Appearance = AvAppearance; | ||
294 | Agent1Data.BaseFolder = BaseFolder; | ||
295 | Agent1Data.CapsPath = CapsPath; | ||
296 | Agent1Data.child = false; | ||
297 | Agent1Data.ChildrenCapSeeds = ChildrenCapsPaths; | ||
298 | Agent1Data.circuitcode = circuitcode; | ||
299 | Agent1Data.firstname = firstname; | ||
300 | Agent1Data.InventoryFolder = BaseFolder; | ||
301 | Agent1Data.lastname = lastname; | ||
302 | Agent1Data.SecureSessionID = SecureSessionId; | ||
303 | Agent1Data.SessionID = SessionId; | ||
304 | Agent1Data.startpos = StartPos; | ||
305 | |||
306 | |||
307 | OSDMap map = Agent1Data.PackAgentCircuitData(); | ||
308 | string str = OSDParser.SerializeJsonString(map); | ||
309 | //System.Console.WriteLine(str); | ||
310 | OSDMap map2 = (OSDMap)OSDParser.DeserializeJson(str); | ||
311 | |||
312 | |||
313 | AgentCircuitData Agent2Data = new AgentCircuitData(); | ||
314 | Agent2Data.UnpackAgentCircuitData(map2); | ||
315 | |||
316 | Assert.That((Agent1Data.AgentID == Agent2Data.AgentID)); | ||
317 | Assert.That((Agent1Data.BaseFolder == Agent2Data.BaseFolder)); | ||
318 | |||
319 | Assert.That((Agent1Data.CapsPath == Agent2Data.CapsPath)); | ||
320 | Assert.That((Agent1Data.child == Agent2Data.child)); | ||
321 | Assert.That((Agent1Data.ChildrenCapSeeds.Count == Agent2Data.ChildrenCapSeeds.Count)); | ||
322 | Assert.That((Agent1Data.circuitcode == Agent2Data.circuitcode)); | ||
323 | Assert.That((Agent1Data.firstname == Agent2Data.firstname)); | ||
324 | Assert.That((Agent1Data.InventoryFolder == Agent2Data.InventoryFolder)); | ||
325 | Assert.That((Agent1Data.lastname == Agent2Data.lastname)); | ||
326 | Assert.That((Agent1Data.SecureSessionID == Agent2Data.SecureSessionID)); | ||
327 | Assert.That((Agent1Data.SessionID == Agent2Data.SessionID)); | ||
328 | Assert.That((Agent1Data.startpos == Agent2Data.startpos)); | ||
329 | |||
330 | /* | ||
331 | Enable this once VisualParams go in the packing method | ||
332 | for (int i = 0; i < 208; i++) | ||
333 | Assert.That((Agent1Data.Appearance.VisualParams[i] == Agent2Data.Appearance.VisualParams[i])); | ||
334 | */ | ||
335 | |||
336 | |||
337 | } | ||
338 | } | ||
339 | } | ||