aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Tests')
-rw-r--r--OpenSim/Framework/Tests/AnimationTests.cs1
-rw-r--r--OpenSim/Framework/Tests/AssetBaseTest.cs4
-rw-r--r--OpenSim/Framework/Tests/LocationTest.cs21
-rw-r--r--OpenSim/Framework/Tests/MundaneFrameworkTests.cs2
-rw-r--r--OpenSim/Framework/Tests/UtilTest.cs101
5 files changed, 102 insertions, 27 deletions
diff --git a/OpenSim/Framework/Tests/AnimationTests.cs b/OpenSim/Framework/Tests/AnimationTests.cs
index f3be81b..d8f17d0 100644
--- a/OpenSim/Framework/Tests/AnimationTests.cs
+++ b/OpenSim/Framework/Tests/AnimationTests.cs
@@ -32,7 +32,6 @@ using OpenMetaverse;
32using OpenMetaverse.StructuredData; 32using OpenMetaverse.StructuredData;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Tests.Common; 34using OpenSim.Tests.Common;
35using OpenSim.Tests.Common.Mock;
36using Animation = OpenSim.Framework.Animation; 35using Animation = OpenSim.Framework.Animation;
37 36
38namespace OpenSim.Framework.Tests 37namespace OpenSim.Framework.Tests
diff --git a/OpenSim/Framework/Tests/AssetBaseTest.cs b/OpenSim/Framework/Tests/AssetBaseTest.cs
index 25d2393..1975a4d 100644
--- a/OpenSim/Framework/Tests/AssetBaseTest.cs
+++ b/OpenSim/Framework/Tests/AssetBaseTest.cs
@@ -50,19 +50,15 @@ namespace OpenSim.Framework.Tests
50 CheckContainsReferences(AssetType.ImageJPEG , false); 50 CheckContainsReferences(AssetType.ImageJPEG , false);
51 CheckContainsReferences(AssetType.ImageTGA , false); 51 CheckContainsReferences(AssetType.ImageTGA , false);
52 CheckContainsReferences(AssetType.Landmark , false); 52 CheckContainsReferences(AssetType.Landmark , false);
53 CheckContainsReferences(AssetType.LostAndFoundFolder, false);
54 CheckContainsReferences(AssetType.LSLBytecode, false); 53 CheckContainsReferences(AssetType.LSLBytecode, false);
55 CheckContainsReferences(AssetType.LSLText, false); 54 CheckContainsReferences(AssetType.LSLText, false);
56 CheckContainsReferences(AssetType.Notecard, false); 55 CheckContainsReferences(AssetType.Notecard, false);
57 CheckContainsReferences(AssetType.Object, false); 56 CheckContainsReferences(AssetType.Object, false);
58 CheckContainsReferences(AssetType.RootFolder, false);
59 CheckContainsReferences(AssetType.Simstate, false); 57 CheckContainsReferences(AssetType.Simstate, false);
60 CheckContainsReferences(AssetType.SnapshotFolder, false);
61 CheckContainsReferences(AssetType.Sound, false); 58 CheckContainsReferences(AssetType.Sound, false);
62 CheckContainsReferences(AssetType.SoundWAV, false); 59 CheckContainsReferences(AssetType.SoundWAV, false);
63 CheckContainsReferences(AssetType.Texture, false); 60 CheckContainsReferences(AssetType.Texture, false);
64 CheckContainsReferences(AssetType.TextureTGA, false); 61 CheckContainsReferences(AssetType.TextureTGA, false);
65 CheckContainsReferences(AssetType.TrashFolder, false);
66 CheckContainsReferences(AssetType.Unknown, false); 62 CheckContainsReferences(AssetType.Unknown, false);
67 } 63 }
68 64
diff --git a/OpenSim/Framework/Tests/LocationTest.cs b/OpenSim/Framework/Tests/LocationTest.cs
index a56ecb4..3d5d1d2 100644
--- a/OpenSim/Framework/Tests/LocationTest.cs
+++ b/OpenSim/Framework/Tests/LocationTest.cs
@@ -51,21 +51,28 @@ namespace OpenSim.Framework.Tests
51 [Test] 51 [Test]
52 public void locationXYRegionHandle() 52 public void locationXYRegionHandle()
53 { 53 {
54 Location TestLocation1 = new Location(256000,256000); 54 Location TestLocation1 = new Location(255000,256000);
55 Location TestLocation2 = new Location(1099511628032000); 55 Location TestLocation2 = new Location(1095216660736000);
56 Assert.That(TestLocation1 == TestLocation2); 56 Assert.That(TestLocation1 == TestLocation2);
57 57
58 Assert.That(TestLocation2.X == 256000 && TestLocation2.Y == 256000, "Test xy location doesn't match regionhandle provided"); 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");
59 60
60 Assert.That(TestLocation2.RegionHandle == 1099511628032000, 61 Assert.That(TestLocation2.RegionHandle == 1095216660736000,
61 "Location RegionHandle Property didn't match regionhandle provided in constructor"); 62 "Location RegionHandle Property didn't match regionhandle provided in constructor");
62 63
64 ulong RegionHandle = TestLocation1.RegionHandle;
65 Assert.That(RegionHandle.Equals(1095216660736000), "Equals(regionhandle) failed to match the position in the constructor");
63 66
64 TestLocation1 = new Location(256001, 256001); 67 TestLocation2 = new Location(RegionHandle);
65 TestLocation2 = new Location(1099511628032000); 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);
66 Assert.That(TestLocation1 != TestLocation2); 73 Assert.That(TestLocation1 != TestLocation2);
67 74
68 Assert.That(TestLocation1.Equals(256001, 256001), "Equals(x,y) failed to match the position in the constructor"); 75 Assert.That(TestLocation1.Equals(255001, 256001), "Equals(x,y) failed to match the position in the constructor");
69 76
70 Assert.That(TestLocation2.GetHashCode() == (TestLocation2.X.GetHashCode() ^ TestLocation2.Y.GetHashCode()), "GetHashCode failed to produce the expected hashcode"); 77 Assert.That(TestLocation2.GetHashCode() == (TestLocation2.X.GetHashCode() ^ TestLocation2.Y.GetHashCode()), "GetHashCode failed to produce the expected hashcode");
71 78
diff --git a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
index 1dc8053..3f0a031 100644
--- a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
+++ b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
@@ -100,7 +100,7 @@ namespace OpenSim.Framework.Tests
100 cadu.AVHeight = Size1.Z; 100 cadu.AVHeight = Size1.Z;
101 101
102 AgentPosition position2 = new AgentPosition(); 102 AgentPosition position2 = new AgentPosition();
103 position2.CopyFrom(cadu); 103 position2.CopyFrom(cadu, position1.SessionID);
104 104
105 Assert.IsTrue( 105 Assert.IsTrue(
106 position2.AgentID == position1.AgentID 106 position2.AgentID == position1.AgentID
diff --git a/OpenSim/Framework/Tests/UtilTest.cs b/OpenSim/Framework/Tests/UtilTest.cs
index 11ca068..cfe3139 100644
--- a/OpenSim/Framework/Tests/UtilTest.cs
+++ b/OpenSim/Framework/Tests/UtilTest.cs
@@ -173,8 +173,8 @@ namespace OpenSim.Framework.Tests
173 [Test] 173 [Test]
174 public void SLUtilTypeConvertTests() 174 public void SLUtilTypeConvertTests()
175 { 175 {
176 int[] assettypes = new int[]{-1,0,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22 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 ,23,24,25,46,47,48}; 177 ,24,25};
178 string[] contenttypes = new string[] 178 string[] contenttypes = new string[]
179 { 179 {
180 "application/octet-stream", 180 "application/octet-stream",
@@ -186,26 +186,18 @@ namespace OpenSim.Framework.Tests
186 "application/vnd.ll.primitive", 186 "application/vnd.ll.primitive",
187 "application/vnd.ll.notecard", 187 "application/vnd.ll.notecard",
188 "application/vnd.ll.folder", 188 "application/vnd.ll.folder",
189 "application/vnd.ll.rootfolder",
190 "application/vnd.ll.lsltext", 189 "application/vnd.ll.lsltext",
191 "application/vnd.ll.lslbyte", 190 "application/vnd.ll.lslbyte",
192 "image/tga", 191 "image/tga",
193 "application/vnd.ll.bodypart", 192 "application/vnd.ll.bodypart",
194 "application/vnd.ll.trashfolder",
195 "application/vnd.ll.snapshotfolder",
196 "application/vnd.ll.lostandfoundfolder",
197 "audio/x-wav", 193 "audio/x-wav",
198 "image/tga", 194 "image/tga",
199 "image/jpeg", 195 "image/jpeg",
200 "application/vnd.ll.animation", 196 "application/vnd.ll.animation",
201 "application/vnd.ll.gesture", 197 "application/vnd.ll.gesture",
202 "application/x-metaverse-simstate", 198 "application/x-metaverse-simstate",
203 "application/vnd.ll.favoritefolder",
204 "application/vnd.ll.link", 199 "application/vnd.ll.link",
205 "application/vnd.ll.linkfolder", 200 "application/vnd.ll.linkfolder",
206 "application/vnd.ll.currentoutfitfolder",
207 "application/vnd.ll.outfitfolder",
208 "application/vnd.ll.myoutfitsfolder"
209 }; 201 };
210 for (int i=0;i<assettypes.Length;i++) 202 for (int i=0;i<assettypes.Length;i++)
211 { 203 {
@@ -223,7 +215,7 @@ namespace OpenSim.Framework.Tests
223 String.Format("Incorrect AssetType mapped from Content-Type {0}", contenttypes[i])); 215 String.Format("Incorrect AssetType mapped from Content-Type {0}", contenttypes[i]));
224 } 216 }
225 217
226 int[] inventorytypes = new int[] {-1,0,1,2,3,6,7,8,9,10,15,17,18,20}; 218 int[] inventorytypes = new int[] {-1,0,1,2,3,6,7,8,10,15,17,18,20};
227 string[] invcontenttypes = new string[] 219 string[] invcontenttypes = new string[]
228 { 220 {
229 "application/octet-stream", 221 "application/octet-stream",
@@ -233,7 +225,6 @@ namespace OpenSim.Framework.Tests
233 "application/vnd.ll.landmark", 225 "application/vnd.ll.landmark",
234 "application/vnd.ll.primitive", 226 "application/vnd.ll.primitive",
235 "application/vnd.ll.notecard", 227 "application/vnd.ll.notecard",
236 "application/vnd.ll.folder",
237 "application/vnd.ll.rootfolder", 228 "application/vnd.ll.rootfolder",
238 "application/vnd.ll.lsltext", 229 "application/vnd.ll.lsltext",
239 "image/x-j2c", 230 "image/x-j2c",
@@ -272,8 +263,8 @@ namespace OpenSim.Framework.Tests
272 }; 263 };
273 sbyte[] invtypes = new sbyte[] 264 sbyte[] invtypes = new sbyte[]
274 { 265 {
275 0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 3, 18, 18, 18, 18, 6, 6, 7, 7, 8, 9, 10, 10, 10, 10 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
276 , 8, 8, 8, 19, 19, 20, 20, 15, -1 267 , 14, 15, 16, 19, 19, 20, 20, 15, -1
277 }; 268 };
278 269
279 for (int i = 0; i < invtypes.Length; i++) 270 for (int i = 0; i < invtypes.Length; i++)
@@ -282,5 +273,87 @@ namespace OpenSim.Framework.Tests
282 String.Format("Incorrect InventoryType mapped from Content-Type {0}", invcontenttypes[i])); 273 String.Format("Incorrect InventoryType mapped from Content-Type {0}", invcontenttypes[i]));
283 } 274 }
284 } 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 }
285 } 358 }
286} 359}