diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Tests/AgentCircuitDataTest.cs | 356 | ||||
-rw-r--r-- | OpenSim/Framework/Tests/AgentCircuitManagerTests.cs | 199 | ||||
-rw-r--r-- | OpenSim/Framework/Tests/AnimationTests.cs | 91 | ||||
-rw-r--r-- | OpenSim/Framework/Tests/AssetBaseTest.cs | 72 | ||||
-rw-r--r-- | OpenSim/Framework/Tests/CacheTests.cs | 125 | ||||
-rw-r--r-- | OpenSim/Framework/Tests/LocationTest.cs | 90 | ||||
-rw-r--r-- | OpenSim/Framework/Tests/MundaneFrameworkTests.cs | 308 | ||||
-rw-r--r-- | OpenSim/Framework/Tests/PrimeNumberHelperTests.cs | 144 | ||||
-rw-r--r-- | OpenSim/Framework/Tests/UtilTest.cs | 359 |
9 files changed, 1744 insertions, 0 deletions
diff --git a/OpenSim/Framework/Tests/AgentCircuitDataTest.cs b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs new file mode 100644 index 0000000..95e9439 --- /dev/null +++ b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs | |||
@@ -0,0 +1,356 @@ | |||
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 | |||
28 | using System.Collections.Generic; | ||
29 | using OpenMetaverse; | ||
30 | using OpenMetaverse.StructuredData; | ||
31 | using NUnit.Framework; | ||
32 | using OpenSim.Tests.Common; | ||
33 | |||
34 | namespace OpenSim.Framework.Tests | ||
35 | { | ||
36 | [TestFixture] | ||
37 | public class AgentCircuitDataTest : OpenSimTestCase | ||
38 | { | ||
39 | private UUID AgentId; | ||
40 | private AvatarAppearance AvAppearance; | ||
41 | private byte[] VisualParams; | ||
42 | private UUID BaseFolder; | ||
43 | private string CapsPath; | ||
44 | private Dictionary<ulong, string> ChildrenCapsPaths; | ||
45 | private uint circuitcode = 0949030; | ||
46 | private string firstname; | ||
47 | private string lastname; | ||
48 | private UUID SecureSessionId; | ||
49 | private UUID SessionId; | ||
50 | private Vector3 StartPos; | ||
51 | |||
52 | |||
53 | [SetUp] | ||
54 | public void setup() | ||
55 | { | ||
56 | AgentId = UUID.Random(); | ||
57 | BaseFolder = UUID.Random(); | ||
58 | CapsPath = "http://www.opensimulator.org/Caps/Foo"; | ||
59 | ChildrenCapsPaths = new Dictionary<ulong, string>(); | ||
60 | ChildrenCapsPaths.Add(ulong.MaxValue, "http://www.opensimulator.org/Caps/Foo2"); | ||
61 | firstname = "CoolAvatarTest"; | ||
62 | lastname = "test"; | ||
63 | StartPos = new Vector3(5,23,125); | ||
64 | |||
65 | SecureSessionId = UUID.Random(); | ||
66 | SessionId = UUID.Random(); | ||
67 | |||
68 | AvAppearance = new AvatarAppearance(); | ||
69 | VisualParams = new byte[218]; | ||
70 | |||
71 | //body | ||
72 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HEIGHT] = 155; | ||
73 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_THICKNESS] = 00; | ||
74 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BODY_FAT] = 0; | ||
75 | |||
76 | //Torso | ||
77 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_TORSO_MUSCLES] = 48; | ||
78 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_NECK_THICKNESS] = 43; | ||
79 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_NECK_LENGTH] = 255; | ||
80 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SHOULDERS] = 94; | ||
81 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_CHEST_MALE_NO_PECS] = 199; | ||
82 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_ARM_LENGTH] = 255; | ||
83 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HAND_SIZE] = 33; | ||
84 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_TORSO_LENGTH] = 240; | ||
85 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LOVE_HANDLES] = 0; | ||
86 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BELLY_SIZE] = 0; | ||
87 | |||
88 | // legs | ||
89 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LEG_MUSCLES] = 82; | ||
90 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LEG_LENGTH] = 255; | ||
91 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HIP_WIDTH] = 84; | ||
92 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HIP_LENGTH] = 166; | ||
93 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BUTT_SIZE] = 64; | ||
94 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SADDLEBAGS] = 89; | ||
95 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BOWED_LEGS] = 127; | ||
96 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_FOOT_SIZE] = 45; | ||
97 | |||
98 | |||
99 | // head | ||
100 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HEAD_SIZE] = 255; | ||
101 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SQUASH_STRETCH_HEAD] = 0; // head stretch | ||
102 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HEAD_SHAPE] = 155; | ||
103 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EGG_HEAD] = 127; | ||
104 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_POINTY_EARS] = 255; | ||
105 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HEAD_LENGTH] = 45; | ||
106 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_FACE_SHEAR] = 127; | ||
107 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_FOREHEAD_ANGLE] = 104; | ||
108 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BIG_BROW] = 94; | ||
109 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_PUFFY_UPPER_CHEEKS] = 0; // upper cheeks | ||
110 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_DOUBLE_CHIN] = 122; // lower cheeks | ||
111 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HIGH_CHEEK_BONES] = 130; | ||
112 | |||
113 | |||
114 | |||
115 | // eyes | ||
116 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYE_SIZE] = 105; | ||
117 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WIDE_EYES] = 135; | ||
118 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYE_SPACING] = 184; | ||
119 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYELID_CORNER_UP] = 230; | ||
120 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYELID_INNER_CORNER_UP] = 120; | ||
121 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYE_DEPTH] = 158; | ||
122 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_UPPER_EYELID_FOLD] = 69; | ||
123 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BAGGY_EYES] = 38; | ||
124 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYELASHES_LONG] = 127; | ||
125 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_POP_EYE] = 127; | ||
126 | |||
127 | VisualParams[(int)AvatarAppearance.VPElement.EYES_EYE_COLOR] = 25; | ||
128 | VisualParams[(int)AvatarAppearance.VPElement.EYES_EYE_LIGHTNESS] = 127; | ||
129 | |||
130 | // ears | ||
131 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BIG_EARS] = 255; | ||
132 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EARS_OUT] = 127; | ||
133 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_ATTACHED_EARLOBES] = 127; | ||
134 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_POINTY_EARS] = 255; | ||
135 | |||
136 | // nose | ||
137 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_NOSE_BIG_OUT] = 79; | ||
138 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WIDE_NOSE] = 35; | ||
139 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BROAD_NOSTRILS] = 86; | ||
140 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LOW_SEPTUM_NOSE] = 112; // nostril division | ||
141 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BULBOUS_NOSE] = 25; | ||
142 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_NOBLE_NOSE_BRIDGE] = 25; // upper bridge | ||
143 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LOWER_BRIDGE_NOSE] = 25; // lower bridge | ||
144 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WIDE_NOSE_BRIDGE] = 25; | ||
145 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_UPTURNED_NOSE_TIP] = 107; | ||
146 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BULBOUS_NOSE_TIP] = 25; | ||
147 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_CROOKED_NOSE] = 127; | ||
148 | |||
149 | |||
150 | // Mouth | ||
151 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LIP_WIDTH] = 122; | ||
152 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_TALL_LIPS] = 10; // lip fullness | ||
153 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LIP_THICKNESS] = 112; | ||
154 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LIP_RATIO] = 137; | ||
155 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_MOUTH_HEIGHT] = 176; | ||
156 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_MOUTH_CORNER] = 140; // Sad --> happy | ||
157 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LIP_CLEFT_DEEP] = 84; | ||
158 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WIDE_LIP_CLEFT] = 84; | ||
159 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SHIFT_MOUTH] = 127; | ||
160 | |||
161 | |||
162 | // chin | ||
163 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WEAK_CHIN] = 119; | ||
164 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SQUARE_JAW] = 5; | ||
165 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_DEEP_CHIN] = 132; | ||
166 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_JAW_ANGLE] = 153; | ||
167 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_JAW_JUT] = 100; | ||
168 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_JOWLS] = 38; | ||
169 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_CLEFT_CHIN] = 89; | ||
170 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_CLEFT_CHIN_UPPER] = 89; | ||
171 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_DOUBLE_CHIN] = 0; | ||
172 | |||
173 | |||
174 | // hair color | ||
175 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_WHITE_HAIR] = 0; | ||
176 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_RAINBOW_COLOR_39] = 0; | ||
177 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_BLONDE_HAIR] = 24; | ||
178 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_RED_HAIR] = 0; | ||
179 | |||
180 | // hair style | ||
181 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_VOLUME] = 160; | ||
182 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_FRONT] = 153; | ||
183 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SIDES] = 153; | ||
184 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_BACK] = 170; | ||
185 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_BIG_FRONT] = 0; | ||
186 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_BIG_TOP] = 117; | ||
187 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_BIG_BACK] = 170; | ||
188 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_FRONT_FRINGE] = 0; | ||
189 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_SIDE_FRINGE] = 142; | ||
190 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_BACK_FRINGE] = 0; | ||
191 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SIDES_FULL] = 146; | ||
192 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SWEEP] = 0; | ||
193 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SHEAR_FRONT] = 0; | ||
194 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SHEAR_BACK] = 0; | ||
195 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_TAPER_FRONT] = 0; | ||
196 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_TAPER_BACK] = 0; | ||
197 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_RUMPLED] = 0; | ||
198 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_PIGTAILS] = 0; | ||
199 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_PONYTAIL] = 0; | ||
200 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SPIKED] = 0; | ||
201 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_TILT] = 0; | ||
202 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_PART_MIDDLE] = 0; | ||
203 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_PART_RIGHT] = 0; | ||
204 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_PART_LEFT] = 0; | ||
205 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_BANGS_PART_MIDDLE] = 155; | ||
206 | |||
207 | //Eyebrows | ||
208 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_EYEBROW_SIZE] = 20; | ||
209 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_EYEBROW_DENSITY] = 140; | ||
210 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_LOWER_EYEBROWS] = 200; // eyebrow height | ||
211 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_ARCED_EYEBROWS] = 124; | ||
212 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_POINTY_EYEBROWS] = 65; | ||
213 | |||
214 | //Facial hair | ||
215 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_THICKNESS] = 65; | ||
216 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_SIDEBURNS] = 235; | ||
217 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_MOUSTACHE] = 75; | ||
218 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_CHIN_CURTAINS] = 140; | ||
219 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_SOULPATCH] = 0; | ||
220 | |||
221 | AvAppearance.VisualParams = VisualParams; | ||
222 | |||
223 | List<byte> wearbyte = new List<byte>(); | ||
224 | for (int i = 0; i < VisualParams.Length; i++) | ||
225 | { | ||
226 | wearbyte.Add(VisualParams[i]); | ||
227 | } | ||
228 | |||
229 | AvAppearance.SetAppearance(AvAppearance.Texture, (byte[])VisualParams.Clone()); | ||
230 | } | ||
231 | |||
232 | /// <summary> | ||
233 | /// Test to ensure that the serialization format is the same and the underlying types don't change without notice | ||
234 | /// oldSerialization is just a json serialization of the OSDMap packed for the AgentCircuitData. | ||
235 | /// The idea is that if the current json serializer cannot parse the old serialization, then the underlying types | ||
236 | /// have changed and are incompatible. | ||
237 | /// </summary> | ||
238 | [Test] | ||
239 | public void HistoricalAgentCircuitDataOSDConversion() | ||
240 | { | ||
241 | 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>\"}"; | ||
242 | AgentCircuitData Agent1Data = new AgentCircuitData(); | ||
243 | Agent1Data.AgentID = new UUID("522675bd-8214-40c1-b3ca-9c7f7fd170be"); | ||
244 | Agent1Data.Appearance = AvAppearance; | ||
245 | Agent1Data.BaseFolder = new UUID("c40b5f5f-476f-496b-bd69-b5a539c434d8"); | ||
246 | Agent1Data.CapsPath = CapsPath; | ||
247 | Agent1Data.child = false; | ||
248 | Agent1Data.ChildrenCapSeeds = ChildrenCapsPaths; | ||
249 | Agent1Data.circuitcode = circuitcode; | ||
250 | Agent1Data.firstname = firstname; | ||
251 | Agent1Data.InventoryFolder = new UUID("c40b5f5f-476f-496b-bd69-b5a539c434d8"); | ||
252 | Agent1Data.lastname = lastname; | ||
253 | Agent1Data.SecureSessionID = new UUID("1e608e2b-0ddb-41f6-be0f-926f61cd3e0a"); | ||
254 | Agent1Data.SessionID = new UUID("aa06f798-9d70-4bdb-9bbf-012a02ee2baf"); | ||
255 | Agent1Data.startpos = StartPos; | ||
256 | |||
257 | |||
258 | OSDMap map2; | ||
259 | try | ||
260 | { | ||
261 | map2 = (OSDMap) OSDParser.DeserializeJson(oldSerialization); | ||
262 | |||
263 | |||
264 | AgentCircuitData Agent2Data = new AgentCircuitData(); | ||
265 | Agent2Data.UnpackAgentCircuitData(map2); | ||
266 | |||
267 | Assert.That((Agent1Data.AgentID == Agent2Data.AgentID)); | ||
268 | Assert.That((Agent1Data.BaseFolder == Agent2Data.BaseFolder)); | ||
269 | |||
270 | Assert.That((Agent1Data.CapsPath == Agent2Data.CapsPath)); | ||
271 | Assert.That((Agent1Data.child == Agent2Data.child)); | ||
272 | Assert.That((Agent1Data.ChildrenCapSeeds.Count == Agent2Data.ChildrenCapSeeds.Count)); | ||
273 | Assert.That((Agent1Data.circuitcode == Agent2Data.circuitcode)); | ||
274 | Assert.That((Agent1Data.firstname == Agent2Data.firstname)); | ||
275 | Assert.That((Agent1Data.InventoryFolder == Agent2Data.InventoryFolder)); | ||
276 | Assert.That((Agent1Data.lastname == Agent2Data.lastname)); | ||
277 | Assert.That((Agent1Data.SecureSessionID == Agent2Data.SecureSessionID)); | ||
278 | Assert.That((Agent1Data.SessionID == Agent2Data.SessionID)); | ||
279 | Assert.That((Agent1Data.startpos == Agent2Data.startpos)); | ||
280 | } | ||
281 | catch (LitJson.JsonException) | ||
282 | { | ||
283 | //intermittant litjson errors :P | ||
284 | Assert.That(1 == 1); | ||
285 | } | ||
286 | /* | ||
287 | Enable this once VisualParams go in the packing method | ||
288 | for (int i=0;i<208;i++) | ||
289 | Assert.That((Agent1Data.Appearance.VisualParams[i] == Agent2Data.Appearance.VisualParams[i])); | ||
290 | */ | ||
291 | } | ||
292 | |||
293 | /// <summary> | ||
294 | /// Test to ensure that the packing and unpacking methods work. | ||
295 | /// </summary> | ||
296 | [Test] | ||
297 | public void TestAgentCircuitDataOSDConversion() | ||
298 | { | ||
299 | AgentCircuitData Agent1Data = new AgentCircuitData(); | ||
300 | Agent1Data.AgentID = AgentId; | ||
301 | Agent1Data.Appearance = AvAppearance; | ||
302 | Agent1Data.BaseFolder = BaseFolder; | ||
303 | Agent1Data.CapsPath = CapsPath; | ||
304 | Agent1Data.child = false; | ||
305 | Agent1Data.ChildrenCapSeeds = ChildrenCapsPaths; | ||
306 | Agent1Data.circuitcode = circuitcode; | ||
307 | Agent1Data.firstname = firstname; | ||
308 | Agent1Data.InventoryFolder = BaseFolder; | ||
309 | Agent1Data.lastname = lastname; | ||
310 | Agent1Data.SecureSessionID = SecureSessionId; | ||
311 | Agent1Data.SessionID = SessionId; | ||
312 | Agent1Data.startpos = StartPos; | ||
313 | |||
314 | OSDMap map2; | ||
315 | OSDMap map = Agent1Data.PackAgentCircuitData(); | ||
316 | try | ||
317 | { | ||
318 | string str = OSDParser.SerializeJsonString(map); | ||
319 | //System.Console.WriteLine(str); | ||
320 | map2 = (OSDMap) OSDParser.DeserializeJson(str); | ||
321 | } | ||
322 | catch (System.NullReferenceException) | ||
323 | { | ||
324 | //spurious litjson errors :P | ||
325 | map2 = map; | ||
326 | Assert.That(1==1); | ||
327 | return; | ||
328 | } | ||
329 | |||
330 | AgentCircuitData Agent2Data = new AgentCircuitData(); | ||
331 | Agent2Data.UnpackAgentCircuitData(map2); | ||
332 | |||
333 | Assert.That((Agent1Data.AgentID == Agent2Data.AgentID)); | ||
334 | Assert.That((Agent1Data.BaseFolder == Agent2Data.BaseFolder)); | ||
335 | |||
336 | Assert.That((Agent1Data.CapsPath == Agent2Data.CapsPath)); | ||
337 | Assert.That((Agent1Data.child == Agent2Data.child)); | ||
338 | Assert.That((Agent1Data.ChildrenCapSeeds.Count == Agent2Data.ChildrenCapSeeds.Count)); | ||
339 | Assert.That((Agent1Data.circuitcode == Agent2Data.circuitcode)); | ||
340 | Assert.That((Agent1Data.firstname == Agent2Data.firstname)); | ||
341 | Assert.That((Agent1Data.InventoryFolder == Agent2Data.InventoryFolder)); | ||
342 | Assert.That((Agent1Data.lastname == Agent2Data.lastname)); | ||
343 | Assert.That((Agent1Data.SecureSessionID == Agent2Data.SecureSessionID)); | ||
344 | Assert.That((Agent1Data.SessionID == Agent2Data.SessionID)); | ||
345 | Assert.That((Agent1Data.startpos == Agent2Data.startpos)); | ||
346 | |||
347 | /* | ||
348 | Enable this once VisualParams go in the packing method | ||
349 | for (int i = 0; i < 208; i++) | ||
350 | Assert.That((Agent1Data.Appearance.VisualParams[i] == Agent2Data.Appearance.VisualParams[i])); | ||
351 | */ | ||
352 | |||
353 | |||
354 | } | ||
355 | } | ||
356 | } | ||
diff --git a/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs b/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs new file mode 100644 index 0000000..ae132c8 --- /dev/null +++ b/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs | |||
@@ -0,0 +1,199 @@ | |||
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 NUnit.Framework; | ||
30 | using System; | ||
31 | |||
32 | namespace OpenSim.Framework.Tests | ||
33 | { | ||
34 | [TestFixture] | ||
35 | public class AgentCircuitManagerTests | ||
36 | { | ||
37 | private AgentCircuitData m_agentCircuitData1; | ||
38 | private AgentCircuitData m_agentCircuitData2; | ||
39 | private UUID AgentId1; | ||
40 | private UUID AgentId2; | ||
41 | private uint circuitcode1; | ||
42 | private uint circuitcode2; | ||
43 | |||
44 | private UUID SessionId1; | ||
45 | private UUID SessionId2; | ||
46 | private Random rnd = new Random(Environment.TickCount); | ||
47 | |||
48 | [SetUp] | ||
49 | public void setup() | ||
50 | { | ||
51 | |||
52 | AgentId1 = UUID.Random(); | ||
53 | AgentId2 = UUID.Random(); | ||
54 | circuitcode1 = (uint) rnd.Next((int)uint.MinValue, int.MaxValue); | ||
55 | circuitcode2 = (uint) rnd.Next((int)uint.MinValue, int.MaxValue); | ||
56 | SessionId1 = UUID.Random(); | ||
57 | SessionId2 = UUID.Random(); | ||
58 | UUID BaseFolder = UUID.Random(); | ||
59 | string CapsPath = "http://www.opensimulator.org/Caps/Foo"; | ||
60 | Dictionary<ulong,string> ChildrenCapsPaths = new Dictionary<ulong, string>(); | ||
61 | ChildrenCapsPaths.Add(ulong.MaxValue, "http://www.opensimulator.org/Caps/Foo2"); | ||
62 | string firstname = "CoolAvatarTest"; | ||
63 | string lastname = "test"; | ||
64 | Vector3 StartPos = new Vector3(5, 23, 125); | ||
65 | |||
66 | UUID SecureSessionId = UUID.Random(); | ||
67 | // TODO: unused: UUID SessionId = UUID.Random(); | ||
68 | |||
69 | m_agentCircuitData1 = new AgentCircuitData(); | ||
70 | m_agentCircuitData1.AgentID = AgentId1; | ||
71 | m_agentCircuitData1.Appearance = new AvatarAppearance(); | ||
72 | m_agentCircuitData1.BaseFolder = BaseFolder; | ||
73 | m_agentCircuitData1.CapsPath = CapsPath; | ||
74 | m_agentCircuitData1.child = false; | ||
75 | m_agentCircuitData1.ChildrenCapSeeds = ChildrenCapsPaths; | ||
76 | m_agentCircuitData1.circuitcode = circuitcode1; | ||
77 | m_agentCircuitData1.firstname = firstname; | ||
78 | m_agentCircuitData1.InventoryFolder = BaseFolder; | ||
79 | m_agentCircuitData1.lastname = lastname; | ||
80 | m_agentCircuitData1.SecureSessionID = SecureSessionId; | ||
81 | m_agentCircuitData1.SessionID = SessionId1; | ||
82 | m_agentCircuitData1.startpos = StartPos; | ||
83 | |||
84 | m_agentCircuitData2 = new AgentCircuitData(); | ||
85 | m_agentCircuitData2.AgentID = AgentId2; | ||
86 | m_agentCircuitData2.Appearance = new AvatarAppearance(); | ||
87 | m_agentCircuitData2.BaseFolder = BaseFolder; | ||
88 | m_agentCircuitData2.CapsPath = CapsPath; | ||
89 | m_agentCircuitData2.child = false; | ||
90 | m_agentCircuitData2.ChildrenCapSeeds = ChildrenCapsPaths; | ||
91 | m_agentCircuitData2.circuitcode = circuitcode2; | ||
92 | m_agentCircuitData2.firstname = firstname; | ||
93 | m_agentCircuitData2.InventoryFolder = BaseFolder; | ||
94 | m_agentCircuitData2.lastname = lastname; | ||
95 | m_agentCircuitData2.SecureSessionID = SecureSessionId; | ||
96 | m_agentCircuitData2.SessionID = SessionId2; | ||
97 | m_agentCircuitData2.startpos = StartPos; | ||
98 | } | ||
99 | |||
100 | /// <summary> | ||
101 | /// Validate that adding the circuit works appropriately | ||
102 | /// </summary> | ||
103 | [Test] | ||
104 | public void AddAgentCircuitTest() | ||
105 | { | ||
106 | AgentCircuitManager agentCircuitManager = new AgentCircuitManager(); | ||
107 | agentCircuitManager.AddNewCircuit(circuitcode1,m_agentCircuitData1); | ||
108 | agentCircuitManager.AddNewCircuit(circuitcode2, m_agentCircuitData2); | ||
109 | AgentCircuitData agent = agentCircuitManager.GetAgentCircuitData(circuitcode1); | ||
110 | |||
111 | Assert.That((m_agentCircuitData1.AgentID == agent.AgentID)); | ||
112 | Assert.That((m_agentCircuitData1.BaseFolder == agent.BaseFolder)); | ||
113 | |||
114 | Assert.That((m_agentCircuitData1.CapsPath == agent.CapsPath)); | ||
115 | Assert.That((m_agentCircuitData1.child == agent.child)); | ||
116 | Assert.That((m_agentCircuitData1.ChildrenCapSeeds.Count == agent.ChildrenCapSeeds.Count)); | ||
117 | Assert.That((m_agentCircuitData1.circuitcode == agent.circuitcode)); | ||
118 | Assert.That((m_agentCircuitData1.firstname == agent.firstname)); | ||
119 | Assert.That((m_agentCircuitData1.InventoryFolder == agent.InventoryFolder)); | ||
120 | Assert.That((m_agentCircuitData1.lastname == agent.lastname)); | ||
121 | Assert.That((m_agentCircuitData1.SecureSessionID == agent.SecureSessionID)); | ||
122 | Assert.That((m_agentCircuitData1.SessionID == agent.SessionID)); | ||
123 | Assert.That((m_agentCircuitData1.startpos == agent.startpos)); | ||
124 | } | ||
125 | |||
126 | /// <summary> | ||
127 | /// Validate that removing the circuit code removes it appropriately | ||
128 | /// </summary> | ||
129 | [Test] | ||
130 | public void RemoveAgentCircuitTest() | ||
131 | { | ||
132 | AgentCircuitManager agentCircuitManager = new AgentCircuitManager(); | ||
133 | agentCircuitManager.AddNewCircuit(circuitcode1, m_agentCircuitData1); | ||
134 | agentCircuitManager.AddNewCircuit(circuitcode2, m_agentCircuitData2); | ||
135 | agentCircuitManager.RemoveCircuit(circuitcode2); | ||
136 | |||
137 | AgentCircuitData agent = agentCircuitManager.GetAgentCircuitData(circuitcode2); | ||
138 | Assert.That(agent == null); | ||
139 | |||
140 | } | ||
141 | |||
142 | /// <summary> | ||
143 | /// Validate that changing the circuit code works | ||
144 | /// </summary> | ||
145 | [Test] | ||
146 | public void ChangeAgentCircuitCodeTest() | ||
147 | { | ||
148 | AgentCircuitManager agentCircuitManager = new AgentCircuitManager(); | ||
149 | agentCircuitManager.AddNewCircuit(circuitcode1, m_agentCircuitData1); | ||
150 | agentCircuitManager.AddNewCircuit(circuitcode2, m_agentCircuitData2); | ||
151 | bool result = false; | ||
152 | |||
153 | result = agentCircuitManager.TryChangeCiruitCode(circuitcode1, 393930); | ||
154 | |||
155 | AgentCircuitData agent = agentCircuitManager.GetAgentCircuitData(393930); | ||
156 | AgentCircuitData agent2 = agentCircuitManager.GetAgentCircuitData(circuitcode1); | ||
157 | Assert.That(agent != null); | ||
158 | Assert.That(agent2 == null); | ||
159 | Assert.That(result); | ||
160 | |||
161 | } | ||
162 | |||
163 | /// <summary> | ||
164 | /// Validates that the login authentication scheme is working | ||
165 | /// First one should be authorized | ||
166 | /// Rest should not be authorized | ||
167 | /// </summary> | ||
168 | [Test] | ||
169 | public void ValidateLoginTest() | ||
170 | { | ||
171 | AgentCircuitManager agentCircuitManager = new AgentCircuitManager(); | ||
172 | agentCircuitManager.AddNewCircuit(circuitcode1, m_agentCircuitData1); | ||
173 | agentCircuitManager.AddNewCircuit(circuitcode2, m_agentCircuitData2); | ||
174 | |||
175 | // should be authorized | ||
176 | AuthenticateResponse resp = agentCircuitManager.AuthenticateSession(SessionId1, AgentId1, circuitcode1); | ||
177 | Assert.That(resp.Authorised); | ||
178 | |||
179 | |||
180 | //should not be authorized | ||
181 | resp = agentCircuitManager.AuthenticateSession(SessionId1, UUID.Random(), circuitcode1); | ||
182 | Assert.That(!resp.Authorised); | ||
183 | |||
184 | resp = agentCircuitManager.AuthenticateSession(UUID.Random(), AgentId1, circuitcode1); | ||
185 | Assert.That(!resp.Authorised); | ||
186 | |||
187 | resp = agentCircuitManager.AuthenticateSession(SessionId1, AgentId1, circuitcode2); | ||
188 | Assert.That(!resp.Authorised); | ||
189 | |||
190 | resp = agentCircuitManager.AuthenticateSession(SessionId2, AgentId1, circuitcode2); | ||
191 | Assert.That(!resp.Authorised); | ||
192 | |||
193 | agentCircuitManager.RemoveCircuit(circuitcode2); | ||
194 | |||
195 | resp = agentCircuitManager.AuthenticateSession(SessionId2, AgentId2, circuitcode2); | ||
196 | Assert.That(!resp.Authorised); | ||
197 | } | ||
198 | } | ||
199 | } | ||
diff --git a/OpenSim/Framework/Tests/AnimationTests.cs b/OpenSim/Framework/Tests/AnimationTests.cs new file mode 100644 index 0000000..d8f17d0 --- /dev/null +++ b/OpenSim/Framework/Tests/AnimationTests.cs | |||
@@ -0,0 +1,91 @@ | |||
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 | |||
28 | using System; | ||
29 | using System.Reflection; | ||
30 | using NUnit.Framework; | ||
31 | using OpenMetaverse; | ||
32 | using OpenMetaverse.StructuredData; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Tests.Common; | ||
35 | using Animation = OpenSim.Framework.Animation; | ||
36 | |||
37 | namespace OpenSim.Framework.Tests | ||
38 | { | ||
39 | [TestFixture] | ||
40 | public class AnimationTests : OpenSimTestCase | ||
41 | { | ||
42 | private Animation anim1 = null; | ||
43 | private Animation anim2 = null; | ||
44 | private UUID animUUID1 = UUID.Zero; | ||
45 | private UUID objUUID1 = UUID.Zero; | ||
46 | private UUID animUUID2 = UUID.Zero; | ||
47 | private UUID objUUID2 = UUID.Zero; | ||
48 | |||
49 | [SetUp] | ||
50 | public void Setup() | ||
51 | { | ||
52 | animUUID1 = UUID.Random(); | ||
53 | animUUID2 = UUID.Random(); | ||
54 | objUUID1 = UUID.Random(); | ||
55 | objUUID2 = UUID.Random(); | ||
56 | |||
57 | anim1 = new Animation(animUUID1, 1, objUUID1); | ||
58 | anim2 = new Animation(animUUID2, 1, objUUID2); | ||
59 | } | ||
60 | |||
61 | [Test] | ||
62 | public void AnimationOSDTest() | ||
63 | { | ||
64 | Assert.That(anim1.AnimID==animUUID1 && anim1.ObjectID == objUUID1 && anim1.SequenceNum ==1, "The Animation Constructor didn't set the fields correctly"); | ||
65 | OSD updateMessage = anim1.PackUpdateMessage(); | ||
66 | Assert.That(updateMessage is OSDMap, "Packed UpdateMessage isn't an OSDMap"); | ||
67 | OSDMap updateMap = (OSDMap) updateMessage; | ||
68 | Assert.That(updateMap.ContainsKey("animation"), "Packed Message doesn't contain an animation element"); | ||
69 | Assert.That(updateMap.ContainsKey("object_id"), "Packed Message doesn't contain an object_id element"); | ||
70 | Assert.That(updateMap.ContainsKey("seq_num"), "Packed Message doesn't contain a seq_num element"); | ||
71 | Assert.That(updateMap["animation"].AsUUID() == animUUID1); | ||
72 | Assert.That(updateMap["object_id"].AsUUID() == objUUID1); | ||
73 | Assert.That(updateMap["seq_num"].AsInteger() == 1); | ||
74 | |||
75 | Animation anim3 = new Animation(updateMap); | ||
76 | |||
77 | Assert.That(anim3.ObjectID == anim1.ObjectID && anim3.AnimID == anim1.AnimID && anim3.SequenceNum == anim1.SequenceNum, "OSDMap Constructor failed to set the properties correctly."); | ||
78 | |||
79 | anim3.UnpackUpdateMessage(anim2.PackUpdateMessage()); | ||
80 | |||
81 | Assert.That(anim3.ObjectID == objUUID2 && anim3.AnimID == animUUID2 && anim3.SequenceNum == 1, "Animation.UnpackUpdateMessage failed to set the properties correctly."); | ||
82 | |||
83 | Animation anim4 = new Animation(); | ||
84 | anim4.AnimID = anim2.AnimID; | ||
85 | anim4.ObjectID = anim2.ObjectID; | ||
86 | anim4.SequenceNum = anim2.SequenceNum; | ||
87 | |||
88 | Assert.That(anim4.ObjectID == objUUID2 && anim4.AnimID == animUUID2 && anim4.SequenceNum == 1, "void constructor and manual field population failed to set the properties correctly."); | ||
89 | } | ||
90 | } | ||
91 | } \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Tests/AssetBaseTest.cs b/OpenSim/Framework/Tests/AssetBaseTest.cs new file mode 100644 index 0000000..1975a4d --- /dev/null +++ b/OpenSim/Framework/Tests/AssetBaseTest.cs | |||
@@ -0,0 +1,72 @@ | |||
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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using NUnit.Framework; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Tests.Common; | ||
34 | |||
35 | namespace OpenSim.Framework.Tests | ||
36 | { | ||
37 | [TestFixture] | ||
38 | public class AssetBaseTest : OpenSimTestCase | ||
39 | { | ||
40 | [Test] | ||
41 | public void TestContainsReferences() | ||
42 | { | ||
43 | CheckContainsReferences(AssetType.Bodypart, true); | ||
44 | CheckContainsReferences(AssetType.Clothing, true); | ||
45 | |||
46 | CheckContainsReferences(AssetType.Animation, false); | ||
47 | CheckContainsReferences(AssetType.CallingCard, false); | ||
48 | CheckContainsReferences(AssetType.Folder , false); | ||
49 | CheckContainsReferences(AssetType.Gesture , false); | ||
50 | CheckContainsReferences(AssetType.ImageJPEG , false); | ||
51 | CheckContainsReferences(AssetType.ImageTGA , false); | ||
52 | CheckContainsReferences(AssetType.Landmark , false); | ||
53 | CheckContainsReferences(AssetType.LSLBytecode, false); | ||
54 | CheckContainsReferences(AssetType.LSLText, false); | ||
55 | CheckContainsReferences(AssetType.Notecard, false); | ||
56 | CheckContainsReferences(AssetType.Object, false); | ||
57 | CheckContainsReferences(AssetType.Simstate, false); | ||
58 | CheckContainsReferences(AssetType.Sound, false); | ||
59 | CheckContainsReferences(AssetType.SoundWAV, false); | ||
60 | CheckContainsReferences(AssetType.Texture, false); | ||
61 | CheckContainsReferences(AssetType.TextureTGA, false); | ||
62 | CheckContainsReferences(AssetType.Unknown, false); | ||
63 | } | ||
64 | |||
65 | private void CheckContainsReferences(AssetType assetType, bool expected) | ||
66 | { | ||
67 | AssetBase asset = new AssetBase(UUID.Zero, String.Empty, (sbyte)assetType, UUID.Zero.ToString()); | ||
68 | bool actual = asset.ContainsReferences; | ||
69 | Assert.AreEqual(expected, actual, "Expected "+assetType+".ContainsReferences to be "+expected+" but was "+actual+"."); | ||
70 | } | ||
71 | } | ||
72 | } | ||
diff --git a/OpenSim/Framework/Tests/CacheTests.cs b/OpenSim/Framework/Tests/CacheTests.cs new file mode 100644 index 0000000..c709860 --- /dev/null +++ b/OpenSim/Framework/Tests/CacheTests.cs | |||
@@ -0,0 +1,125 @@ | |||
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 | |||
28 | using System; | ||
29 | using NUnit.Framework; | ||
30 | using OpenMetaverse; | ||
31 | using OpenSim.Tests.Common; | ||
32 | |||
33 | namespace OpenSim.Framework.Tests | ||
34 | { | ||
35 | [TestFixture] | ||
36 | public class CacheTests : OpenSimTestCase | ||
37 | { | ||
38 | private Cache cache; | ||
39 | private UUID cacheItemUUID; | ||
40 | [SetUp] | ||
41 | public void Build() | ||
42 | { | ||
43 | cache = new Cache(); | ||
44 | cache = new Cache(CacheMedium.Memory,CacheStrategy.Aggressive,CacheFlags.AllowUpdate); | ||
45 | cacheItemUUID = UUID.Random(); | ||
46 | MemoryCacheItem cachedItem = new MemoryCacheItem(cacheItemUUID.ToString(),DateTime.Now + TimeSpan.FromDays(1)); | ||
47 | byte[] foo = new byte[1]; | ||
48 | foo[0] = 255; | ||
49 | cachedItem.Store(foo); | ||
50 | cache.Store(cacheItemUUID.ToString(), cachedItem); | ||
51 | } | ||
52 | [Test] | ||
53 | public void TestRetreive() | ||
54 | { | ||
55 | CacheItemBase citem = (CacheItemBase)cache.Get(cacheItemUUID.ToString()); | ||
56 | byte[] data = (byte[]) citem.Retrieve(); | ||
57 | Assert.That(data.Length == 1, "Cached Item should have one byte element"); | ||
58 | Assert.That(data[0] == 255, "Cached Item element should be 255"); | ||
59 | } | ||
60 | |||
61 | [Test] | ||
62 | public void TestNotInCache() | ||
63 | { | ||
64 | UUID randomNotIn = UUID.Random(); | ||
65 | while (randomNotIn == cacheItemUUID) | ||
66 | { | ||
67 | randomNotIn = UUID.Random(); | ||
68 | } | ||
69 | object citem = cache.Get(randomNotIn.ToString()); | ||
70 | Assert.That(citem == null, "Item should not be in Cache"); | ||
71 | } | ||
72 | |||
73 | |||
74 | [Test] | ||
75 | public void ExpireItemManually() | ||
76 | { | ||
77 | UUID ImmediateExpiryUUID = UUID.Random(); | ||
78 | MemoryCacheItem cachedItem = new MemoryCacheItem(ImmediateExpiryUUID.ToString(), TimeSpan.FromDays(1)); | ||
79 | byte[] foo = new byte[1]; | ||
80 | foo[0] = 1; | ||
81 | cachedItem.Store(foo); | ||
82 | cache.Store(cacheItemUUID.ToString(), cachedItem); | ||
83 | cache.Invalidate(cacheItemUUID.ToString()); | ||
84 | cache.Get(cacheItemUUID.ToString()); | ||
85 | object citem = cache.Get(cacheItemUUID.ToString()); | ||
86 | Assert.That(citem == null, "Item should not be in Cache because we manually invalidated it"); | ||
87 | } | ||
88 | |||
89 | [Test] | ||
90 | public void ClearCacheTest() | ||
91 | { | ||
92 | UUID ImmediateExpiryUUID = UUID.Random(); | ||
93 | MemoryCacheItem cachedItem = new MemoryCacheItem(ImmediateExpiryUUID.ToString(), DateTime.Now - TimeSpan.FromDays(1)); | ||
94 | byte[] foo = new byte[1]; | ||
95 | foo[0] = 1; | ||
96 | cachedItem.Store(foo); | ||
97 | cache.Store(cacheItemUUID.ToString(), cachedItem); | ||
98 | cache.Clear(); | ||
99 | |||
100 | object citem = cache.Get(cacheItemUUID.ToString()); | ||
101 | Assert.That(citem == null, "Item should not be in Cache because we manually invalidated it"); | ||
102 | } | ||
103 | |||
104 | [Test] | ||
105 | public void CacheItemMundane() | ||
106 | { | ||
107 | UUID Random1 = UUID.Random(); | ||
108 | UUID Random2 = UUID.Random(); | ||
109 | byte[] data = new byte[0]; | ||
110 | CacheItemBase cb1 = new CacheItemBase(Random1.ToString(), DateTime.Now + TimeSpan.FromDays(1)); | ||
111 | CacheItemBase cb2 = new CacheItemBase(Random2.ToString(), DateTime.Now + TimeSpan.FromDays(1)); | ||
112 | CacheItemBase cb3 = new CacheItemBase(Random1.ToString(), DateTime.Now + TimeSpan.FromDays(1)); | ||
113 | |||
114 | cb1.Store(data); | ||
115 | |||
116 | Assert.That(cb1.Equals(cb3), "cb1 should equal cb3, their uuids are the same"); | ||
117 | Assert.That(!cb2.Equals(cb1), "cb2 should not equal cb1, their uuids are NOT the same"); | ||
118 | Assert.That(cb1.IsLocked() == false, "CacheItemBase default is false"); | ||
119 | Assert.That(cb1.Retrieve() == null, "Virtual Retrieve method should return null"); | ||
120 | |||
121 | |||
122 | } | ||
123 | |||
124 | } | ||
125 | } | ||
diff --git a/OpenSim/Framework/Tests/LocationTest.cs b/OpenSim/Framework/Tests/LocationTest.cs new file mode 100644 index 0000000..3d5d1d2 --- /dev/null +++ b/OpenSim/Framework/Tests/LocationTest.cs | |||
@@ -0,0 +1,90 @@ | |||
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 | |||
28 | using NUnit.Framework; | ||
29 | using OpenSim.Tests.Common; | ||
30 | |||
31 | namespace OpenSim.Framework.Tests | ||
32 | { | ||
33 | [TestFixture] | ||
34 | public class LocationTest : OpenSimTestCase | ||
35 | { | ||
36 | [Test] | ||
37 | public void locationRegionHandleRegionHandle() | ||
38 | { | ||
39 | //1099511628032000 | ||
40 | // 256000 | ||
41 | // 256000 | ||
42 | Location TestLocation1 = new Location(1099511628032000); | ||
43 | Location TestLocation2 = new Location(1099511628032000); | ||
44 | Assert.That(TestLocation1 == TestLocation2); | ||
45 | |||
46 | TestLocation1 = new Location(1099511628032001); | ||
47 | TestLocation2 = new Location(1099511628032000); | ||
48 | Assert.That(TestLocation1 != TestLocation2); | ||
49 | } | ||
50 | |||
51 | [Test] | ||
52 | public void locationXYRegionHandle() | ||
53 | { | ||
54 | Location TestLocation1 = new Location(255000,256000); | ||
55 | Location TestLocation2 = new Location(1095216660736000); | ||
56 | Assert.That(TestLocation1 == TestLocation2); | ||
57 | |||
58 | Assert.That(TestLocation1.X == 255000 && TestLocation1.Y == 256000, "Test xy location doesn't match position in the constructor"); | ||
59 | Assert.That(TestLocation2.X == 255000 && TestLocation2.Y == 256000, "Test xy location doesn't match regionhandle provided"); | ||
60 | |||
61 | Assert.That(TestLocation2.RegionHandle == 1095216660736000, | ||
62 | "Location RegionHandle Property didn't match regionhandle provided in constructor"); | ||
63 | |||
64 | ulong RegionHandle = TestLocation1.RegionHandle; | ||
65 | Assert.That(RegionHandle.Equals(1095216660736000), "Equals(regionhandle) failed to match the position in the constructor"); | ||
66 | |||
67 | TestLocation2 = new Location(RegionHandle); | ||
68 | Assert.That(TestLocation2.Equals(255000, 256000), "Decoded regionhandle failed to match the original position in the constructor"); | ||
69 | |||
70 | |||
71 | TestLocation1 = new Location(255001, 256001); | ||
72 | TestLocation2 = new Location(1095216660736000); | ||
73 | Assert.That(TestLocation1 != TestLocation2); | ||
74 | |||
75 | Assert.That(TestLocation1.Equals(255001, 256001), "Equals(x,y) failed to match the position in the constructor"); | ||
76 | |||
77 | Assert.That(TestLocation2.GetHashCode() == (TestLocation2.X.GetHashCode() ^ TestLocation2.Y.GetHashCode()), "GetHashCode failed to produce the expected hashcode"); | ||
78 | |||
79 | Location TestLocation3; | ||
80 | object cln = TestLocation2.Clone(); | ||
81 | TestLocation3 = (Location) cln; | ||
82 | Assert.That(TestLocation3.X == TestLocation2.X && TestLocation3.Y == TestLocation2.Y, | ||
83 | "Cloned Location values do not match"); | ||
84 | |||
85 | Assert.That(TestLocation2.Equals(cln), "Cloned object failed .Equals(obj) Test"); | ||
86 | |||
87 | } | ||
88 | |||
89 | } | ||
90 | } | ||
diff --git a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs new file mode 100644 index 0000000..3f0a031 --- /dev/null +++ b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs | |||
@@ -0,0 +1,308 @@ | |||
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 | |||
28 | using NUnit.Framework; | ||
29 | using OpenSim.Framework; | ||
30 | using OpenMetaverse; | ||
31 | using OpenMetaverse.StructuredData; | ||
32 | using System; | ||
33 | using System.Globalization; | ||
34 | using System.Threading; | ||
35 | using OpenSim.Tests.Common; | ||
36 | |||
37 | namespace OpenSim.Framework.Tests | ||
38 | { | ||
39 | [TestFixture] | ||
40 | public class MundaneFrameworkTests : OpenSimTestCase | ||
41 | { | ||
42 | private bool m_RegionSettingsOnSaveEventFired; | ||
43 | private bool m_RegionLightShareDataOnSaveEventFired; | ||
44 | |||
45 | |||
46 | [Test] | ||
47 | public void ChildAgentDataUpdate01() | ||
48 | { | ||
49 | // code coverage | ||
50 | ChildAgentDataUpdate cadu = new ChildAgentDataUpdate(); | ||
51 | Assert.IsFalse(cadu.alwaysrun, "Default is false"); | ||
52 | } | ||
53 | |||
54 | [Test] | ||
55 | public void AgentPositionTest01() | ||
56 | { | ||
57 | UUID AgentId1 = UUID.Random(); | ||
58 | UUID SessionId1 = UUID.Random(); | ||
59 | uint CircuitCode1 = uint.MinValue; | ||
60 | Vector3 Size1 = Vector3.UnitZ; | ||
61 | Vector3 Position1 = Vector3.UnitX; | ||
62 | Vector3 LeftAxis1 = Vector3.UnitY; | ||
63 | Vector3 UpAxis1 = Vector3.UnitZ; | ||
64 | Vector3 AtAxis1 = Vector3.UnitX; | ||
65 | |||
66 | ulong RegionHandle1 = ulong.MinValue; | ||
67 | byte[] Throttles1 = new byte[] {0, 1, 0}; | ||
68 | |||
69 | Vector3 Velocity1 = Vector3.Zero; | ||
70 | float Far1 = 256; | ||
71 | |||
72 | bool ChangedGrid1 = false; | ||
73 | Vector3 Center1 = Vector3.Zero; | ||
74 | |||
75 | AgentPosition position1 = new AgentPosition(); | ||
76 | position1.AgentID = AgentId1; | ||
77 | position1.SessionID = SessionId1; | ||
78 | position1.CircuitCode = CircuitCode1; | ||
79 | position1.Size = Size1; | ||
80 | position1.Position = Position1; | ||
81 | position1.LeftAxis = LeftAxis1; | ||
82 | position1.UpAxis = UpAxis1; | ||
83 | position1.AtAxis = AtAxis1; | ||
84 | position1.RegionHandle = RegionHandle1; | ||
85 | position1.Throttles = Throttles1; | ||
86 | position1.Velocity = Velocity1; | ||
87 | position1.Far = Far1; | ||
88 | position1.ChangedGrid = ChangedGrid1; | ||
89 | position1.Center = Center1; | ||
90 | |||
91 | ChildAgentDataUpdate cadu = new ChildAgentDataUpdate(); | ||
92 | cadu.AgentID = AgentId1.Guid; | ||
93 | cadu.ActiveGroupID = UUID.Zero.Guid; | ||
94 | cadu.throttles = Throttles1; | ||
95 | cadu.drawdistance = Far1; | ||
96 | cadu.Position = Position1; | ||
97 | cadu.Velocity = Velocity1; | ||
98 | cadu.regionHandle = RegionHandle1; | ||
99 | cadu.cameraPosition = Center1; | ||
100 | cadu.AVHeight = Size1.Z; | ||
101 | |||
102 | AgentPosition position2 = new AgentPosition(); | ||
103 | position2.CopyFrom(cadu, position1.SessionID); | ||
104 | |||
105 | Assert.IsTrue( | ||
106 | position2.AgentID == position1.AgentID | ||
107 | && position2.Size == position1.Size | ||
108 | && position2.Position == position1.Position | ||
109 | && position2.Velocity == position1.Velocity | ||
110 | && position2.Center == position1.Center | ||
111 | && position2.RegionHandle == position1.RegionHandle | ||
112 | && position2.Far == position1.Far | ||
113 | |||
114 | ,"Copy From ChildAgentDataUpdate failed"); | ||
115 | |||
116 | position2 = new AgentPosition(); | ||
117 | |||
118 | Assert.IsFalse(position2.AgentID == position1.AgentID, "Test Error, position2 should be a blank uninitialized AgentPosition"); | ||
119 | position2.Unpack(position1.Pack(), null); | ||
120 | |||
121 | Assert.IsTrue(position2.AgentID == position1.AgentID, "Agent ID didn't unpack the same way it packed"); | ||
122 | Assert.IsTrue(position2.Position == position1.Position, "Position didn't unpack the same way it packed"); | ||
123 | Assert.IsTrue(position2.Velocity == position1.Velocity, "Velocity didn't unpack the same way it packed"); | ||
124 | Assert.IsTrue(position2.SessionID == position1.SessionID, "SessionID didn't unpack the same way it packed"); | ||
125 | Assert.IsTrue(position2.CircuitCode == position1.CircuitCode, "CircuitCode didn't unpack the same way it packed"); | ||
126 | Assert.IsTrue(position2.LeftAxis == position1.LeftAxis, "LeftAxis didn't unpack the same way it packed"); | ||
127 | Assert.IsTrue(position2.UpAxis == position1.UpAxis, "UpAxis didn't unpack the same way it packed"); | ||
128 | Assert.IsTrue(position2.AtAxis == position1.AtAxis, "AtAxis didn't unpack the same way it packed"); | ||
129 | Assert.IsTrue(position2.RegionHandle == position1.RegionHandle, "RegionHandle didn't unpack the same way it packed"); | ||
130 | Assert.IsTrue(position2.ChangedGrid == position1.ChangedGrid, "ChangedGrid didn't unpack the same way it packed"); | ||
131 | Assert.IsTrue(position2.Center == position1.Center, "Center didn't unpack the same way it packed"); | ||
132 | Assert.IsTrue(position2.Size == position1.Size, "Size didn't unpack the same way it packed"); | ||
133 | |||
134 | } | ||
135 | |||
136 | [Test] | ||
137 | public void RegionSettingsTest01() | ||
138 | { | ||
139 | RegionSettings settings = new RegionSettings(); | ||
140 | settings.OnSave += RegionSaveFired; | ||
141 | settings.Save(); | ||
142 | settings.OnSave -= RegionSaveFired; | ||
143 | |||
144 | // string str = settings.LoadedCreationDate; | ||
145 | // int dt = settings.LoadedCreationDateTime; | ||
146 | // string id = settings.LoadedCreationID; | ||
147 | // string time = settings.LoadedCreationTime; | ||
148 | |||
149 | Assert.That(m_RegionSettingsOnSaveEventFired, "RegionSettings Save Event didn't Fire"); | ||
150 | |||
151 | } | ||
152 | public void RegionSaveFired(RegionSettings settings) | ||
153 | { | ||
154 | m_RegionSettingsOnSaveEventFired = true; | ||
155 | } | ||
156 | |||
157 | [Test] | ||
158 | public void InventoryItemBaseConstructorTest01() | ||
159 | { | ||
160 | InventoryItemBase b1 = new InventoryItemBase(); | ||
161 | Assert.That(b1.ID == UUID.Zero, "void constructor should create an inventory item with ID = UUID.Zero"); | ||
162 | Assert.That(b1.Owner == UUID.Zero, "void constructor should create an inventory item with Owner = UUID.Zero"); | ||
163 | |||
164 | UUID ItemID = UUID.Random(); | ||
165 | UUID OwnerID = UUID.Random(); | ||
166 | |||
167 | InventoryItemBase b2 = new InventoryItemBase(ItemID); | ||
168 | Assert.That(b2.ID == ItemID, "ID constructor should create an inventory item with ID = ItemID"); | ||
169 | Assert.That(b2.Owner == UUID.Zero, "ID constructor should create an inventory item with Owner = UUID.Zero"); | ||
170 | |||
171 | InventoryItemBase b3 = new InventoryItemBase(ItemID,OwnerID); | ||
172 | Assert.That(b3.ID == ItemID, "ID,OwnerID constructor should create an inventory item with ID = ItemID"); | ||
173 | Assert.That(b3.Owner == OwnerID, "ID,OwnerID constructor should create an inventory item with Owner = OwnerID"); | ||
174 | |||
175 | } | ||
176 | |||
177 | [Test] | ||
178 | public void AssetMetaDataNonNullContentTypeTest01() | ||
179 | { | ||
180 | AssetMetadata assetMetadata = new AssetMetadata(); | ||
181 | assetMetadata.ContentType = "image/jp2"; | ||
182 | Assert.That(assetMetadata.Type == (sbyte)AssetType.Texture, "Content type should be AssetType.Texture"); | ||
183 | Assert.That(assetMetadata.ContentType == "image/jp2", "Text of content type should be image/jp2"); | ||
184 | UUID rndID = UUID.Random(); | ||
185 | assetMetadata.ID = rndID.ToString(); | ||
186 | Assert.That(assetMetadata.ID.ToLower() == rndID.ToString().ToLower(), "assetMetadata.ID Setter/Getter not Consistent"); | ||
187 | DateTime fixedTime = DateTime.Now; | ||
188 | assetMetadata.CreationDate = fixedTime; | ||
189 | } | ||
190 | |||
191 | [Test] | ||
192 | public void RegionLightShareDataCloneSaveTest01() | ||
193 | { | ||
194 | RegionLightShareData rlsd = new RegionLightShareData(); | ||
195 | rlsd.OnSave += RegionLightShareDataSaveFired; | ||
196 | rlsd.Save(); | ||
197 | rlsd.OnSave -= RegionLightShareDataSaveFired; | ||
198 | Assert.IsTrue(m_RegionLightShareDataOnSaveEventFired, "OnSave Event Never Fired"); | ||
199 | |||
200 | object o = rlsd.Clone(); | ||
201 | RegionLightShareData dupe = (RegionLightShareData) o; | ||
202 | Assert.IsTrue(rlsd.sceneGamma == dupe.sceneGamma, "Memberwise Clone of RegionLightShareData failed"); | ||
203 | } | ||
204 | public void RegionLightShareDataSaveFired(RegionLightShareData settings) | ||
205 | { | ||
206 | m_RegionLightShareDataOnSaveEventFired = true; | ||
207 | } | ||
208 | |||
209 | [Test] | ||
210 | public void EstateSettingsMundateTests() | ||
211 | { | ||
212 | EstateSettings es = new EstateSettings(); | ||
213 | es.AddBan(null); | ||
214 | UUID bannedUserId = UUID.Random(); | ||
215 | es.AddBan(new EstateBan() | ||
216 | { BannedHostAddress = string.Empty, | ||
217 | BannedHostIPMask = string.Empty, | ||
218 | BannedHostNameMask = string.Empty, | ||
219 | BannedUserID = bannedUserId} | ||
220 | ); | ||
221 | Assert.IsTrue(es.IsBanned(bannedUserId), "User Should be banned but is not."); | ||
222 | Assert.IsFalse(es.IsBanned(UUID.Zero), "User Should not be banned but is."); | ||
223 | |||
224 | es.RemoveBan(bannedUserId); | ||
225 | |||
226 | Assert.IsFalse(es.IsBanned(bannedUserId), "User Should not be banned but is."); | ||
227 | |||
228 | es.AddEstateManager(UUID.Zero); | ||
229 | |||
230 | es.AddEstateManager(bannedUserId); | ||
231 | Assert.IsTrue(es.IsEstateManagerOrOwner(bannedUserId), "bannedUserId should be EstateManager but isn't."); | ||
232 | |||
233 | es.RemoveEstateManager(bannedUserId); | ||
234 | Assert.IsFalse(es.IsEstateManagerOrOwner(bannedUserId), "bannedUserID is estateManager but shouldn't be"); | ||
235 | |||
236 | Assert.IsFalse(es.HasAccess(bannedUserId), "bannedUserID has access but shouldn't"); | ||
237 | |||
238 | es.AddEstateUser(bannedUserId); | ||
239 | |||
240 | Assert.IsTrue(es.HasAccess(bannedUserId), "bannedUserID doesn't have access but should"); | ||
241 | es.RemoveEstateUser(bannedUserId); | ||
242 | |||
243 | es.AddEstateManager(bannedUserId); | ||
244 | |||
245 | Assert.IsTrue(es.HasAccess(bannedUserId), "bannedUserID doesn't have access but should"); | ||
246 | |||
247 | Assert.That(es.EstateGroups.Length == 0, "No Estate Groups Added.. so the array should be 0 length"); | ||
248 | |||
249 | es.AddEstateGroup(bannedUserId); | ||
250 | |||
251 | Assert.That(es.EstateGroups.Length == 1, "1 Estate Groups Added.. so the array should be 1 length"); | ||
252 | |||
253 | Assert.That(es.EstateGroups[0] == bannedUserId,"User ID should be in EstateGroups"); | ||
254 | |||
255 | } | ||
256 | |||
257 | [Test] | ||
258 | public void InventoryFolderBaseConstructorTest01() | ||
259 | { | ||
260 | UUID uuid1 = UUID.Random(); | ||
261 | UUID uuid2 = UUID.Random(); | ||
262 | |||
263 | InventoryFolderBase fld = new InventoryFolderBase(uuid1); | ||
264 | Assert.That(fld.ID == uuid1, "ID constructor failed to save value in ID field."); | ||
265 | |||
266 | fld = new InventoryFolderBase(uuid1, uuid2); | ||
267 | Assert.That(fld.ID == uuid1, "ID,Owner constructor failed to save value in ID field."); | ||
268 | Assert.That(fld.Owner == uuid2, "ID,Owner constructor failed to save value in ID field."); | ||
269 | } | ||
270 | |||
271 | [Test] | ||
272 | public void AsssetBaseConstructorTest01() | ||
273 | { | ||
274 | AssetBase abase = new AssetBase(); | ||
275 | Assert.IsNotNull(abase.Metadata, "void constructor of AssetBase should have created a MetaData element but didn't."); | ||
276 | UUID itemID = UUID.Random(); | ||
277 | UUID creatorID = UUID.Random(); | ||
278 | abase = new AssetBase(itemID.ToString(), "test item", (sbyte) AssetType.Texture, creatorID.ToString()); | ||
279 | |||
280 | Assert.IsNotNull(abase.Metadata, "string,string,sbyte,string constructor of AssetBase should have created a MetaData element but didn't."); | ||
281 | Assert.That(abase.ID == itemID.ToString(), "string,string,sbyte,string constructor failed to set ID property"); | ||
282 | Assert.That(abase.Metadata.CreatorID == creatorID.ToString(), "string,string,sbyte,string constructor failed to set Creator ID"); | ||
283 | |||
284 | |||
285 | abase = new AssetBase(itemID.ToString(), "test item", -1, creatorID.ToString()); | ||
286 | Assert.IsNotNull(abase.Metadata, "string,string,sbyte,string constructor of AssetBase with unknown type should have created a MetaData element but didn't."); | ||
287 | Assert.That(abase.Metadata.Type == -1, "Unknown Type passed to string,string,sbyte,string constructor and was a known type when it came out again"); | ||
288 | |||
289 | AssetMetadata metts = new AssetMetadata(); | ||
290 | metts.FullID = itemID; | ||
291 | metts.ID = string.Empty; | ||
292 | metts.Name = "test item"; | ||
293 | abase.Metadata = metts; | ||
294 | |||
295 | Assert.That(abase.ToString() == itemID.ToString(), "ToString is overriden to be fullID.ToString()"); | ||
296 | Assert.That(abase.ID == itemID.ToString(),"ID should be MetaData.FullID.ToString() when string.empty or null is provided to the ID property"); | ||
297 | } | ||
298 | |||
299 | [Test] | ||
300 | public void CultureSetCultureTest01() | ||
301 | { | ||
302 | CultureInfo ci = new CultureInfo("en-US", false); | ||
303 | Culture.SetCurrentCulture(); | ||
304 | Assert.That(Thread.CurrentThread.CurrentCulture.Name == ci.Name, "SetCurrentCulture failed to set thread culture to en-US"); | ||
305 | |||
306 | } | ||
307 | } | ||
308 | } \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Tests/PrimeNumberHelperTests.cs b/OpenSim/Framework/Tests/PrimeNumberHelperTests.cs new file mode 100644 index 0000000..82e13e5 --- /dev/null +++ b/OpenSim/Framework/Tests/PrimeNumberHelperTests.cs | |||
@@ -0,0 +1,144 @@ | |||
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 | |||
28 | using System; | ||
29 | using System.Reflection; | ||
30 | using NUnit.Framework; | ||
31 | using OpenMetaverse; | ||
32 | using OpenMetaverse.StructuredData; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Tests.Common; | ||
35 | |||
36 | namespace OpenSim.Framework.Tests | ||
37 | { | ||
38 | [TestFixture] | ||
39 | public class PrimeNumberHelperTests : OpenSimTestCase | ||
40 | { | ||
41 | [Test] | ||
42 | public void TestGetPrime() | ||
43 | { | ||
44 | int prime1 = PrimeNumberHelper.GetPrime(7919); | ||
45 | Assert.That(prime1 == 8419, "Prime Number Get Prime Failed, 7919 is prime"); | ||
46 | Assert.That(PrimeNumberHelper.IsPrime(prime1),"Prime1 should be prime"); | ||
47 | Assert.That(PrimeNumberHelper.IsPrime(7919), "7919 is prime but is falsely failing the prime test"); | ||
48 | prime1 = PrimeNumberHelper.GetPrime(Int32.MaxValue - 1); | ||
49 | Assert.That(prime1 == -1, "prime1 should have been -1 since there are no primes between Int32.MaxValue-1 and Int32.MaxValue"); | ||
50 | |||
51 | } | ||
52 | |||
53 | [Test] | ||
54 | public void Test1000SmallPrimeNumbers() | ||
55 | { | ||
56 | int[] primes = { | ||
57 | 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, | ||
58 | 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191 | ||
59 | , 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, | ||
60 | 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, | ||
61 | 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, | ||
62 | 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, | ||
63 | 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, | ||
64 | 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, | ||
65 | 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, | ||
66 | 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, | ||
67 | 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, | ||
68 | 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, | ||
69 | 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, | ||
70 | 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, | ||
71 | 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, | ||
72 | 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, | ||
73 | 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, | ||
74 | 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, | ||
75 | 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, | ||
76 | 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, | ||
77 | 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, | ||
78 | 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, | ||
79 | 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, | ||
80 | 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, | ||
81 | 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, | ||
82 | 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, | ||
83 | 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, | ||
84 | 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209, | ||
85 | 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, | ||
86 | 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, 3433, 3449, 3457, 3461, | ||
87 | 3463, 3467, 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, | ||
88 | 3571, 3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677, | ||
89 | 3691, 3697, 3701, 3709, 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, | ||
90 | 3821, 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923, | ||
91 | 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, | ||
92 | 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177, | ||
93 | 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, | ||
94 | 4297, 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447, | ||
95 | 4451, 4457, 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, | ||
96 | 4583, 4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, 4691, | ||
97 | 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, | ||
98 | 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967, | ||
99 | 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, | ||
100 | 5087, 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 5227, | ||
101 | 5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, | ||
102 | 5387, 5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443, 5449, 5471, 5477, 5479, | ||
103 | 5483, 5501, 5503, 5507, 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, | ||
104 | 5639, 5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711, 5717, 5737, | ||
105 | 5741, 5743, 5749, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, | ||
106 | 5857, 5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007, | ||
107 | 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131, | ||
108 | 6133, 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221, 6229, 6247, 6257, 6263, | ||
109 | 6269, 6271, 6277, 6287, 6299, 6301, 6311, 6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, | ||
110 | 6367, 6373, 6379, 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473, 6481, 6491, 6521, 6529, | ||
111 | 6547, 6551, 6553, 6563, 6569, 6571, 6577, 6581, 6599, 6607, 6619, 6637, 6653, 6659, 6661, | ||
112 | 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733, 6737, 6761, 6763, 6779, 6781, 6791, | ||
113 | 6793, 6803, 6823, 6827, 6829, 6833, 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6911, | ||
114 | 6917, 6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, 7001, 7013, 7019, 7027, | ||
115 | 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193, | ||
116 | 7207, 7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, 7283, 7297, 7307, 7309, 7321, 7331, | ||
117 | 7333, 7349, 7351, 7369, 7393, 7411, 7417, 7433, 7451, 7457, 7459, 7477, 7481, 7487, 7489, | ||
118 | 7499, 7507, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561, 7573, 7577, 7583, 7589, | ||
119 | 7591, 7603, 7607, 7621, 7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717, | ||
120 | 7723, 7727, 7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7867, 7873, | ||
121 | 7877, 7879, 7883, 7901, 7907, 7919 | ||
122 | }; | ||
123 | for (int i = 0; i < primes.Length; i++) | ||
124 | { | ||
125 | Assert.That(PrimeNumberHelper.IsPrime(primes[i]),primes[i] + " is prime but is erroniously failing the prime test"); | ||
126 | } | ||
127 | |||
128 | int[] nonprimes = { | ||
129 | 4, 6, 8, 10, 14, 16, 18, 22, 28, 30, 36, 40, 42, 46, 52, 58, 60, 66, 70, 72, 78, 82, 88, | ||
130 | 96, 366, 372, 378, 382, 388, 396, 400, 408, 418, 420, 430, 432, 438, 442, 448, 456, 460, 462, | ||
131 | 466, 478, 486, 490, 498, 502, 508, 856, 858, 862, 876, 880, 882, 886, 906, 910, 918, 928, 936, | ||
132 | 940, 946, 952, 966, 970, 976, 982, 990, 996, 1008, 1740, 1746, 1752, 1758, 4650, 4656, 4662, | ||
133 | 4672, 4678, 4690, 7740, 7752, 7756, 7758, 7788, 7792, 7816, 7822, 7828, 7840, 7852, 7866, 7872, | ||
134 | 7876, 7878, 7882, 7900, 7906, 7918 | ||
135 | }; | ||
136 | for (int i = 0; i < nonprimes.Length; i++) | ||
137 | { | ||
138 | Assert.That(!PrimeNumberHelper.IsPrime(nonprimes[i]), nonprimes[i] + " is not prime but is erroniously passing the prime test"); | ||
139 | } | ||
140 | |||
141 | Assert.That(PrimeNumberHelper.IsPrime(3)); | ||
142 | } | ||
143 | } | ||
144 | } \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Tests/UtilTest.cs b/OpenSim/Framework/Tests/UtilTest.cs new file mode 100644 index 0000000..cfe3139 --- /dev/null +++ b/OpenSim/Framework/Tests/UtilTest.cs | |||
@@ -0,0 +1,359 @@ | |||
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 | |||
28 | using System; | ||
29 | using NUnit.Framework; | ||
30 | using OpenMetaverse; | ||
31 | using OpenSim.Tests.Common; | ||
32 | |||
33 | namespace OpenSim.Framework.Tests | ||
34 | { | ||
35 | [TestFixture] | ||
36 | public class UtilTests : OpenSimTestCase | ||
37 | { | ||
38 | [Test] | ||
39 | public void VectorOperationTests() | ||
40 | { | ||
41 | Vector3 v1, v2; | ||
42 | double expectedDistance; | ||
43 | double expectedMagnitude; | ||
44 | double lowPrecisionTolerance = 0.001; | ||
45 | |||
46 | //Lets test a simple case of <0,0,0> and <5,5,5> | ||
47 | { | ||
48 | v1 = new Vector3(0, 0, 0); | ||
49 | v2 = new Vector3(5, 5, 5); | ||
50 | expectedDistance = 8.66; | ||
51 | Assert.That(Util.GetDistanceTo(v1, v2), | ||
52 | new DoubleToleranceConstraint(expectedDistance, lowPrecisionTolerance), | ||
53 | "Calculated distance between two vectors was not within tolerances."); | ||
54 | |||
55 | expectedMagnitude = 0; | ||
56 | Assert.That(Util.GetMagnitude(v1), Is.EqualTo(0), "Magnitude of null vector was not zero."); | ||
57 | |||
58 | expectedMagnitude = 8.66; | ||
59 | Assert.That(Util.GetMagnitude(v2), | ||
60 | new DoubleToleranceConstraint(expectedMagnitude, lowPrecisionTolerance), | ||
61 | "Magnitude of vector was incorrect."); | ||
62 | |||
63 | TestDelegate d = delegate() { Util.GetNormalizedVector(v1); }; | ||
64 | bool causesArgumentException = TestHelpers.AssertThisDelegateCausesArgumentException(d); | ||
65 | Assert.That(causesArgumentException, Is.True, | ||
66 | "Getting magnitude of null vector did not cause argument exception."); | ||
67 | |||
68 | Vector3 expectedNormalizedVector = new Vector3(.577f, .577f, .577f); | ||
69 | double expectedNormalizedMagnitude = 1; | ||
70 | Vector3 normalizedVector = Util.GetNormalizedVector(v2); | ||
71 | Assert.That(normalizedVector, | ||
72 | new VectorToleranceConstraint(expectedNormalizedVector, lowPrecisionTolerance), | ||
73 | "Normalized vector generated from vector was not what was expected."); | ||
74 | Assert.That(Util.GetMagnitude(normalizedVector), | ||
75 | new DoubleToleranceConstraint(expectedNormalizedMagnitude, lowPrecisionTolerance), | ||
76 | "Normalized vector generated from vector does not have magnitude of 1."); | ||
77 | } | ||
78 | |||
79 | //Lets test a simple case of <0,0,0> and <0,0,0> | ||
80 | { | ||
81 | v1 = new Vector3(0, 0, 0); | ||
82 | v2 = new Vector3(0, 0, 0); | ||
83 | expectedDistance = 0; | ||
84 | Assert.That(Util.GetDistanceTo(v1, v2), | ||
85 | new DoubleToleranceConstraint(expectedDistance, lowPrecisionTolerance), | ||
86 | "Calculated distance between two vectors was not within tolerances."); | ||
87 | |||
88 | expectedMagnitude = 0; | ||
89 | Assert.That(Util.GetMagnitude(v1), Is.EqualTo(0), "Magnitude of null vector was not zero."); | ||
90 | |||
91 | expectedMagnitude = 0; | ||
92 | Assert.That(Util.GetMagnitude(v2), | ||
93 | new DoubleToleranceConstraint(expectedMagnitude, lowPrecisionTolerance), | ||
94 | "Magnitude of vector was incorrect."); | ||
95 | |||
96 | TestDelegate d = delegate() { Util.GetNormalizedVector(v1); }; | ||
97 | bool causesArgumentException = TestHelpers.AssertThisDelegateCausesArgumentException(d); | ||
98 | Assert.That(causesArgumentException, Is.True, | ||
99 | "Getting magnitude of null vector did not cause argument exception."); | ||
100 | |||
101 | d = delegate() { Util.GetNormalizedVector(v2); }; | ||
102 | causesArgumentException = TestHelpers.AssertThisDelegateCausesArgumentException(d); | ||
103 | Assert.That(causesArgumentException, Is.True, | ||
104 | "Getting magnitude of null vector did not cause argument exception."); | ||
105 | } | ||
106 | |||
107 | //Lets test a simple case of <0,0,0> and <-5,-5,-5> | ||
108 | { | ||
109 | v1 = new Vector3(0, 0, 0); | ||
110 | v2 = new Vector3(-5, -5, -5); | ||
111 | expectedDistance = 8.66; | ||
112 | Assert.That(Util.GetDistanceTo(v1, v2), | ||
113 | new DoubleToleranceConstraint(expectedDistance, lowPrecisionTolerance), | ||
114 | "Calculated distance between two vectors was not within tolerances."); | ||
115 | |||
116 | expectedMagnitude = 0; | ||
117 | Assert.That(Util.GetMagnitude(v1), Is.EqualTo(0), "Magnitude of null vector was not zero."); | ||
118 | |||
119 | expectedMagnitude = 8.66; | ||
120 | Assert.That(Util.GetMagnitude(v2), | ||
121 | new DoubleToleranceConstraint(expectedMagnitude, lowPrecisionTolerance), | ||
122 | "Magnitude of vector was incorrect."); | ||
123 | |||
124 | TestDelegate d = delegate() { Util.GetNormalizedVector(v1); }; | ||
125 | bool causesArgumentException = TestHelpers.AssertThisDelegateCausesArgumentException(d); | ||
126 | Assert.That(causesArgumentException, Is.True, | ||
127 | "Getting magnitude of null vector did not cause argument exception."); | ||
128 | |||
129 | Vector3 expectedNormalizedVector = new Vector3(-.577f, -.577f, -.577f); | ||
130 | double expectedNormalizedMagnitude = 1; | ||
131 | Vector3 normalizedVector = Util.GetNormalizedVector(v2); | ||
132 | Assert.That(normalizedVector, | ||
133 | new VectorToleranceConstraint(expectedNormalizedVector, lowPrecisionTolerance), | ||
134 | "Normalized vector generated from vector was not what was expected."); | ||
135 | Assert.That(Util.GetMagnitude(normalizedVector), | ||
136 | new DoubleToleranceConstraint(expectedNormalizedMagnitude, lowPrecisionTolerance), | ||
137 | "Normalized vector generated from vector does not have magnitude of 1."); | ||
138 | } | ||
139 | } | ||
140 | |||
141 | [Test] | ||
142 | public void UUIDTests() | ||
143 | { | ||
144 | Assert.IsTrue(Util.isUUID("01234567-89ab-Cdef-0123-456789AbCdEf"), | ||
145 | "A correct UUID wasn't recognized."); | ||
146 | Assert.IsFalse(Util.isUUID("FOOBAR67-89ab-Cdef-0123-456789AbCdEf"), | ||
147 | "UUIDs with non-hex characters are recognized as correct UUIDs."); | ||
148 | Assert.IsFalse(Util.isUUID("01234567"), | ||
149 | "Too short UUIDs are recognized as correct UUIDs."); | ||
150 | Assert.IsFalse(Util.isUUID("01234567-89ab-Cdef-0123-456789AbCdEf0"), | ||
151 | "Too long UUIDs are recognized as correct UUIDs."); | ||
152 | Assert.IsFalse(Util.isUUID("01234567-89ab-Cdef-0123+456789AbCdEf"), | ||
153 | "UUIDs with wrong format are recognized as correct UUIDs."); | ||
154 | } | ||
155 | |||
156 | [Test] | ||
157 | public void GetHashGuidTests() | ||
158 | { | ||
159 | string string1 = "This is one string"; | ||
160 | string string2 = "This is another"; | ||
161 | |||
162 | // Two consecutive runs should equal the same | ||
163 | Assert.AreEqual(Util.GetHashGuid(string1, "secret1"), Util.GetHashGuid(string1, "secret1")); | ||
164 | Assert.AreEqual(Util.GetHashGuid(string2, "secret1"), Util.GetHashGuid(string2, "secret1")); | ||
165 | |||
166 | // Varying data should not eqal the same | ||
167 | Assert.AreNotEqual(Util.GetHashGuid(string1, "secret1"), Util.GetHashGuid(string2, "secret1")); | ||
168 | |||
169 | // Varying secrets should not eqal the same | ||
170 | Assert.AreNotEqual(Util.GetHashGuid(string1, "secret1"), Util.GetHashGuid(string1, "secret2")); | ||
171 | } | ||
172 | |||
173 | [Test] | ||
174 | public void SLUtilTypeConvertTests() | ||
175 | { | ||
176 | int[] assettypes = new int[]{-1,0,1,2,3,5,6,7,8,10,11,12,13,17,18,19,20,21,22 | ||
177 | ,24,25}; | ||
178 | string[] contenttypes = new string[] | ||
179 | { | ||
180 | "application/octet-stream", | ||
181 | "image/x-j2c", | ||
182 | "audio/ogg", | ||
183 | "application/vnd.ll.callingcard", | ||
184 | "application/vnd.ll.landmark", | ||
185 | "application/vnd.ll.clothing", | ||
186 | "application/vnd.ll.primitive", | ||
187 | "application/vnd.ll.notecard", | ||
188 | "application/vnd.ll.folder", | ||
189 | "application/vnd.ll.lsltext", | ||
190 | "application/vnd.ll.lslbyte", | ||
191 | "image/tga", | ||
192 | "application/vnd.ll.bodypart", | ||
193 | "audio/x-wav", | ||
194 | "image/tga", | ||
195 | "image/jpeg", | ||
196 | "application/vnd.ll.animation", | ||
197 | "application/vnd.ll.gesture", | ||
198 | "application/x-metaverse-simstate", | ||
199 | "application/vnd.ll.link", | ||
200 | "application/vnd.ll.linkfolder", | ||
201 | }; | ||
202 | for (int i=0;i<assettypes.Length;i++) | ||
203 | { | ||
204 | Assert.That(SLUtil.SLAssetTypeToContentType(assettypes[i]) == contenttypes[i], "Expecting {0} but got {1}", contenttypes[i], SLUtil.SLAssetTypeToContentType(assettypes[i])); | ||
205 | } | ||
206 | |||
207 | for (int i = 0; i < contenttypes.Length; i++) | ||
208 | { | ||
209 | int expected; | ||
210 | if (contenttypes[i] == "image/tga") | ||
211 | expected = 12; // if we know only the content-type "image/tga", then we assume the asset type is TextureTGA; not ImageTGA | ||
212 | else | ||
213 | expected = assettypes[i]; | ||
214 | Assert.AreEqual(expected, SLUtil.ContentTypeToSLAssetType(contenttypes[i]), | ||
215 | String.Format("Incorrect AssetType mapped from Content-Type {0}", contenttypes[i])); | ||
216 | } | ||
217 | |||
218 | int[] inventorytypes = new int[] {-1,0,1,2,3,6,7,8,10,15,17,18,20}; | ||
219 | string[] invcontenttypes = new string[] | ||
220 | { | ||
221 | "application/octet-stream", | ||
222 | "image/x-j2c", | ||
223 | "audio/ogg", | ||
224 | "application/vnd.ll.callingcard", | ||
225 | "application/vnd.ll.landmark", | ||
226 | "application/vnd.ll.primitive", | ||
227 | "application/vnd.ll.notecard", | ||
228 | "application/vnd.ll.rootfolder", | ||
229 | "application/vnd.ll.lsltext", | ||
230 | "image/x-j2c", | ||
231 | "application/vnd.ll.primitive", | ||
232 | "application/vnd.ll.clothing", | ||
233 | "application/vnd.ll.gesture" | ||
234 | }; | ||
235 | |||
236 | for (int i=0;i<inventorytypes.Length;i++) | ||
237 | { | ||
238 | Assert.AreEqual(invcontenttypes[i], SLUtil.SLInvTypeToContentType(inventorytypes[i]), | ||
239 | String.Format("Incorrect Content-Type mapped from InventoryType {0}", inventorytypes[i])); | ||
240 | } | ||
241 | |||
242 | invcontenttypes = new string[] | ||
243 | { | ||
244 | "image/x-j2c","image/jp2","image/tga", | ||
245 | "image/jpeg","application/ogg","audio/ogg", | ||
246 | "audio/x-wav","application/vnd.ll.callingcard", | ||
247 | "application/x-metaverse-callingcard", | ||
248 | "application/vnd.ll.landmark", | ||
249 | "application/x-metaverse-landmark", | ||
250 | "application/vnd.ll.clothing", | ||
251 | "application/x-metaverse-clothing","application/vnd.ll.bodypart", | ||
252 | "application/x-metaverse-bodypart","application/vnd.ll.primitive", | ||
253 | "application/x-metaverse-primitive","application/vnd.ll.notecard", | ||
254 | "application/x-metaverse-notecard","application/vnd.ll.folder", | ||
255 | "application/vnd.ll.rootfolder","application/vnd.ll.lsltext", | ||
256 | "application/x-metaverse-lsl","application/vnd.ll.lslbyte", | ||
257 | "application/x-metaverse-lso","application/vnd.ll.trashfolder", | ||
258 | "application/vnd.ll.snapshotfolder", | ||
259 | "application/vnd.ll.lostandfoundfolder","application/vnd.ll.animation", | ||
260 | "application/x-metaverse-animation","application/vnd.ll.gesture", | ||
261 | "application/x-metaverse-gesture","application/x-metaverse-simstate", | ||
262 | "application/octet-stream" | ||
263 | }; | ||
264 | sbyte[] invtypes = new sbyte[] | ||
265 | { | ||
266 | 0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 3, 18, 18, 18, 18, 6, 6, 7, 7, -1, 8, 10, 10, 10, 10 | ||
267 | , 14, 15, 16, 19, 19, 20, 20, 15, -1 | ||
268 | }; | ||
269 | |||
270 | for (int i = 0; i < invtypes.Length; i++) | ||
271 | { | ||
272 | Assert.AreEqual(invtypes[i], SLUtil.ContentTypeToSLInvType(invcontenttypes[i]), | ||
273 | String.Format("Incorrect InventoryType mapped from Content-Type {0}", invcontenttypes[i])); | ||
274 | } | ||
275 | } | ||
276 | |||
277 | [Test] | ||
278 | public void FakeParcelIDTests() | ||
279 | { | ||
280 | byte[] hexBytes8 = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }; | ||
281 | byte[] hexBytes16 = { | ||
282 | 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87, | ||
283 | 0x77, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f }; | ||
284 | UInt64 var64Bit = (UInt64)0xfedcba9876543210; | ||
285 | |||
286 | //Region handle is for location 255000,256000. | ||
287 | ulong regionHandle1 = 1095216660736000; | ||
288 | uint x1 = 100; | ||
289 | uint y1 = 200; | ||
290 | uint z1 = 22; | ||
291 | ulong regionHandle2; | ||
292 | uint x2, y2, z2; | ||
293 | UUID fakeParcelID1, uuid; | ||
294 | |||
295 | ulong bigInt64 = Util.BytesToUInt64Big(hexBytes8); | ||
296 | Assert.AreEqual(var64Bit, bigInt64, | ||
297 | "BytesToUint64Bit conversion of 8 bytes to UInt64 failed."); | ||
298 | |||
299 | //Test building and decoding using some typical input values | ||
300 | fakeParcelID1 = Util.BuildFakeParcelID(regionHandle1, x1, y1); | ||
301 | Util.ParseFakeParcelID(fakeParcelID1, out regionHandle2, out x2, out y2); | ||
302 | Assert.AreEqual(regionHandle1, regionHandle2, | ||
303 | "region handle decoded from FakeParcelID wth X/Y failed."); | ||
304 | Assert.AreEqual(x1, x2, | ||
305 | "X coordinate decoded from FakeParcelID wth X/Y failed."); | ||
306 | Assert.AreEqual(y1, y2, | ||
307 | "Y coordinate decoded from FakeParcelID wth X/Y failed."); | ||
308 | |||
309 | fakeParcelID1 = Util.BuildFakeParcelID(regionHandle1, x1, y1, z1); | ||
310 | Util.ParseFakeParcelID(fakeParcelID1, out regionHandle2, out x2, out y2, out z2); | ||
311 | Assert.AreEqual(regionHandle1, regionHandle2, | ||
312 | "region handle decoded from FakeParcelID with X/Y/Z failed."); | ||
313 | Assert.AreEqual(x1, x2, | ||
314 | "X coordinate decoded from FakeParcelID with X/Y/Z failed."); | ||
315 | Assert.AreEqual(y1, y2, | ||
316 | "Y coordinate decoded from FakeParcelID with X/Y/Z failed."); | ||
317 | Assert.AreEqual(z1, z2, | ||
318 | "Z coordinate decoded from FakeParcelID with X/Y/Z failed."); | ||
319 | |||
320 | //Do some more extreme tests to check the encoding and decoding | ||
321 | x1 = 0x55aa; | ||
322 | y1 = 0x9966; | ||
323 | z1 = 0x5a96; | ||
324 | |||
325 | fakeParcelID1 = Util.BuildFakeParcelID(var64Bit, x1, y1); | ||
326 | Util.ParseFakeParcelID(fakeParcelID1, out regionHandle2, out x2, out y2); | ||
327 | Assert.AreEqual(var64Bit, regionHandle2, | ||
328 | "region handle decoded from FakeParcelID with X/Y/Z failed."); | ||
329 | Assert.AreEqual(x1, x2, | ||
330 | "X coordinate decoded from FakeParcelID with X/Y/Z failed."); | ||
331 | Assert.AreEqual(y1, y2, | ||
332 | "Y coordinate decoded from FakeParcelID with X/Y/Z failed."); | ||
333 | |||
334 | fakeParcelID1 = Util.BuildFakeParcelID(var64Bit, x1, y1, z1); | ||
335 | Util.ParseFakeParcelID(fakeParcelID1, out regionHandle2, out x2, out y2, out z2); | ||
336 | Assert.AreEqual(var64Bit, regionHandle2, | ||
337 | "region handle decoded from FakeParcelID with X/Y/Z failed."); | ||
338 | Assert.AreEqual(x1, x2, | ||
339 | "X coordinate decoded from FakeParcelID with X/Y/Z failed."); | ||
340 | Assert.AreEqual(y1, y2, | ||
341 | "Y coordinate decoded from FakeParcelID with X/Y/Z failed."); | ||
342 | Assert.AreEqual(z1, z2, | ||
343 | "Z coordinate decoded from FakeParcelID with X/Y/Z failed."); | ||
344 | |||
345 | |||
346 | x1 = 64; | ||
347 | y1 = 192; | ||
348 | fakeParcelID1 = Util.BuildFakeParcelID(regionHandle1, x1, y1); | ||
349 | Util.FakeParcelIDToGlobalPosition(fakeParcelID1, out x2, out y2); | ||
350 | Assert.AreEqual(255000+x1, x2, | ||
351 | "Global X coordinate decoded from regionHandle failed."); | ||
352 | Assert.AreEqual(256000+y1, y2, | ||
353 | "Global Y coordinate decoded from regionHandle failed."); | ||
354 | |||
355 | uuid = new UUID("00dd0700-00d1-0700-3800-000032000000"); | ||
356 | Util.FakeParcelIDToGlobalPosition(uuid, out x2, out y2); | ||
357 | } | ||
358 | } | ||
359 | } | ||