aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/test/inventory.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:02 -0500
committerJacek Antonelli2008-08-15 23:45:02 -0500
commitd644fc64407dcd14ffcee6a0e9fbe28ee3a4e9bd (patch)
tree7ed0c2c27d717801238a2e6b5749cd5bf88c3059 /linden/indra/test/inventory.cpp
parentSecond Life viewer sources 1.17.3.0 (diff)
downloadmeta-impy-d644fc64407dcd14ffcee6a0e9fbe28ee3a4e9bd.zip
meta-impy-d644fc64407dcd14ffcee6a0e9fbe28ee3a4e9bd.tar.gz
meta-impy-d644fc64407dcd14ffcee6a0e9fbe28ee3a4e9bd.tar.bz2
meta-impy-d644fc64407dcd14ffcee6a0e9fbe28ee3a4e9bd.tar.xz
Second Life viewer sources 1.18.0.6
Diffstat (limited to 'linden/indra/test/inventory.cpp')
-rw-r--r--linden/indra/test/inventory.cpp463
1 files changed, 414 insertions, 49 deletions
diff --git a/linden/indra/test/inventory.cpp b/linden/indra/test/inventory.cpp
index 0539910..944647f 100644
--- a/linden/indra/test/inventory.cpp
+++ b/linden/indra/test/inventory.cpp
@@ -28,12 +28,6 @@
28 * COMPLETENESS OR PERFORMANCE. 28 * COMPLETENESS OR PERFORMANCE.
29 */ 29 */
30 30
31/**
32 *
33 * THOROUGH_DESCRIPTION of inventory.cpp
34 *
35 */
36
37#include "linden_common.h" 31#include "linden_common.h"
38#include "lltut.h" 32#include "lltut.h"
39#include "llinventory.h" 33#include "llinventory.h"
@@ -102,67 +96,438 @@ namespace tut
102 typedef inventory_test::object inventory_object; 96 typedef inventory_test::object inventory_object;
103 tut::inventory_test inv("llinventory"); 97 tut::inventory_test inv("llinventory");
104 98
99//***class LLInventoryType***//
100
101
105 template<> template<> 102 template<> template<>
106 void inventory_object::test<1>() 103 void inventory_object::test<1>()
107 { 104 {
105 LLInventoryType::EType retType = LLInventoryType::lookup("sound");
106 ensure("1.LLInventoryType::lookup(char*) failed", retType == LLInventoryType::IT_SOUND);
107
108 retType = LLInventoryType::lookup("snapshot");
109 ensure("2.LLInventoryType::lookup(char*) failed", retType == LLInventoryType::IT_SNAPSHOT);
110 }
111
112 template<> template<>
113 void inventory_object::test<2>()
114 {
115 const char* retType = LLInventoryType::lookup(LLInventoryType::IT_CALLINGCARD);
116 ensure("1.LLInventoryType::lookup(EType) failed", 0 == strcmp(retType, "callcard"));
117
118 retType = LLInventoryType::lookup(LLInventoryType::IT_LANDMARK);
119 ensure("2.LLInventoryType::lookup(EType) failed", 0 == strcmp(retType, "landmark"));
120
121 }
122
123 template<> template<>
124 void inventory_object::test<3>()
125 {
126 static const char* retType = LLInventoryType::lookupHumanReadable(LLInventoryType::IT_CALLINGCARD);
127 ensure("1.LLInventoryType::lookupHumanReadable(EType) failed", 0 == strcmp(retType, "calling card"));
128
129 retType = LLInventoryType::lookupHumanReadable(LLInventoryType::IT_LANDMARK);
130 ensure("2.LLInventoryType::lookupHumanReadable(EType) failed", 0 == strcmp(retType, "landmark"));
131 }
132
133 template<> template<>
134 void inventory_object::test<4>()
135 {
136 static LLInventoryType::EType retType = LLInventoryType::defaultForAssetType(LLAssetType::AT_TEXTURE);
137 ensure("1.LLInventoryType::defaultForAssetType(LLAssetType EType) failed", retType == LLInventoryType::IT_TEXTURE);
138
139 retType = LLInventoryType::defaultForAssetType(LLAssetType::AT_LANDMARK);
140 ensure("2.LLInventoryType::defaultForAssetType(LLAssetType EType) failed", retType == LLInventoryType::IT_LANDMARK);
141 }
142
143//*****class LLInventoryItem*****//
144
145 template<> template<>
146 void inventory_object::test<5>()
147 {
108 LLPointer<LLInventoryItem> src = create_random_inventory_item(); 148 LLPointer<LLInventoryItem> src = create_random_inventory_item();
109 LLSD sd = ll_create_sd_from_inventory_item(src); 149 LLSD sd = ll_create_sd_from_inventory_item(src);
110 //llinfos << "sd: " << *sd << llendl; 150 //llinfos << "sd: " << *sd << llendl;
111 LLPointer<LLInventoryItem> dst; 151 LLPointer<LLInventoryItem> dst = ll_create_item_from_sd(sd);
152 ensure_equals("1.item id::getUUID() failed", dst->getUUID(), src->getUUID());
153 ensure_equals("2.parent::getParentUUID() failed", dst->getParentUUID(), src->getParentUUID());
154 ensure_equals("3.name::getName() failed", dst->getName(), src->getName());
155 ensure_equals("4.type::getType() failed", dst->getType(), src->getType());
156
157 ensure_equals("5.permissions::getPermissions() failed", dst->getPermissions(), src->getPermissions());
158 ensure_equals("6.description::getDescription() failed", dst->getDescription(), src->getDescription());
159 ensure_equals("7.sale type::getSaleType() failed", dst->getSaleInfo().getSaleType(), src->getSaleInfo().getSaleType());
160 ensure_equals("8.sale price::getSalePrice() failed", dst->getSaleInfo().getSalePrice(), src->getSaleInfo().getSalePrice());
161 ensure_equals("9.asset id::getAssetUUID() failed", dst->getAssetUUID(), src->getAssetUUID());
162 ensure_equals("10.inventory type::getInventoryType() failed", dst->getInventoryType(), src->getInventoryType());
163 ensure_equals("11.flags::getFlags() failed", dst->getFlags(), src->getFlags());
164 ensure_equals("12.creation::getCreationDate() failed", dst->getCreationDate(), src->getCreationDate());
165
166 LLUUID new_item_id, new_parent_id;
167 new_item_id.generate();
168 src->setUUID(new_item_id);
169
170 new_parent_id.generate();
171 src->setParent(new_parent_id);
172
173 LLString new_name = "LindenLab";
174 src->rename(new_name);
175
176 src->setType(LLAssetType::AT_SOUND);
177
178 LLUUID new_asset_id;
179 new_asset_id.generate();
180
181 src->setAssetUUID(new_asset_id);
182 LLString new_desc = "SecondLife Testing";
183 src->setDescription(new_desc);
184
185 S32 new_price = rand();
186 LLSaleInfo new_sale_info(LLSaleInfo::FS_COPY, new_price);
187 src->setSaleInfo(new_sale_info);
188
189 U32 new_flags = rand();
190 S32 new_creation = time(NULL);
191
192 LLPermissions new_perm;
193
194 LLUUID new_creator_id;
195 new_creator_id.generate();
196
197 LLUUID new_owner_id;
198 new_owner_id.generate();
199
200 LLUUID last_owner_id;
201 last_owner_id.generate();
202
203 LLUUID new_group_id;
204 new_group_id.generate();
205 new_perm.init(new_creator_id, new_owner_id, last_owner_id, new_group_id);
206 new_perm.initMasks(PERM_ALL, PERM_ALL, PERM_COPY, PERM_COPY, PERM_MODIFY | PERM_COPY);
207 src->setPermissions(new_perm);
208
209 src->setInventoryType(LLInventoryType::IT_SOUND);
210 src->setFlags(new_flags);
211 src->setCreationDate(new_creation);
212
213 sd = ll_create_sd_from_inventory_item(src);
214 //llinfos << "sd: " << *sd << llendl;
112 dst = ll_create_item_from_sd(sd); 215 dst = ll_create_item_from_sd(sd);
113 ensure_equals("item id", dst->getUUID(), src->getUUID()); 216 ensure_equals("13.item id::getUUID() failed", dst->getUUID(), src->getUUID());
114 ensure_equals("parent", dst->getParentUUID(), src->getParentUUID()); 217 ensure_equals("14.parent::getParentUUID() failed", dst->getParentUUID(), src->getParentUUID());
115 ensure_equals("name", dst->getName(), src->getName()); 218 ensure_equals("15.name::getName() failed", dst->getName(), src->getName());
116 ensure_equals("type", dst->getType(), src->getType()); 219 ensure_equals("16.type::getType() failed", dst->getType(), src->getType());
117 ensure_equals( 220
118 "permissions", 221 ensure_equals("17.permissions::getPermissions() failed", dst->getPermissions(), src->getPermissions());
119 dst->getPermissions(), 222 ensure_equals("18.description::getDescription() failed", dst->getDescription(), src->getDescription());
120 src->getPermissions()); 223 ensure_equals("19.sale type::getSaleType() failed type", dst->getSaleInfo().getSaleType(), src->getSaleInfo().getSaleType());
121 ensure_equals( 224 ensure_equals("20.sale price::getSalePrice() failed price", dst->getSaleInfo().getSalePrice(), src->getSaleInfo().getSalePrice());
122 "description", 225 ensure_equals("21.asset id::getAssetUUID() failed id", dst->getAssetUUID(), src->getAssetUUID());
123 dst->getDescription(), 226 ensure_equals("22.inventory type::getInventoryType() failed type", dst->getInventoryType(), src->getInventoryType());
124 src->getDescription()); 227 ensure_equals("23.flags::getFlags() failed", dst->getFlags(), src->getFlags());
125 ensure_equals( 228 ensure_equals("24.creation::getCreationDate() failed", dst->getCreationDate(), src->getCreationDate());
126 "sale type", 229
127 dst->getSaleInfo().getSaleType(),
128 src->getSaleInfo().getSaleType());
129 ensure_equals(
130 "sale price",
131 dst->getSaleInfo().getSalePrice(),
132 src->getSaleInfo().getSalePrice());
133 ensure_equals("asset id", dst->getAssetUUID(), src->getAssetUUID());
134 ensure_equals(
135 "inventory type",
136 dst->getInventoryType(),
137 src->getInventoryType());
138 ensure_equals("flags", dst->getFlags(), src->getFlags());
139 ensure_equals(
140 "creation",
141 dst->getCreationDate(),
142 src->getCreationDate());
143 } 230 }
144 231
145 template<> template<> 232 template<> template<>
146 void inventory_object::test<2>() 233 void inventory_object::test<6>()
234 {
235 LLPointer<LLInventoryItem> src = create_random_inventory_item();
236
237 LLUUID new_item_id, new_parent_id;
238 new_item_id.generate();
239 src->setUUID(new_item_id);
240
241 new_parent_id.generate();
242 src->setParent(new_parent_id);
243
244 LLString new_name = "LindenLab";
245 src->rename(new_name);
246
247 src->setType(LLAssetType::AT_SOUND);
248
249 LLUUID new_asset_id;
250 new_asset_id.generate();
251
252 src->setAssetUUID(new_asset_id);
253 LLString new_desc = "SecondLife Testing";
254 src->setDescription(new_desc);
255
256 S32 new_price = rand();
257 LLSaleInfo new_sale_info(LLSaleInfo::FS_COPY, new_price);
258 src->setSaleInfo(new_sale_info);
259
260 U32 new_flags = rand();
261 S32 new_creation = time(NULL);
262
263 LLPermissions new_perm;
264
265 LLUUID new_creator_id;
266 new_creator_id.generate();
267
268 LLUUID new_owner_id;
269 new_owner_id.generate();
270
271 LLUUID last_owner_id;
272 last_owner_id.generate();
273
274 LLUUID new_group_id;
275 new_group_id.generate();
276 new_perm.init(new_creator_id, new_owner_id, last_owner_id, new_group_id);
277 new_perm.initMasks(PERM_ALL, PERM_ALL, PERM_COPY, PERM_COPY, PERM_MODIFY | PERM_COPY);
278 src->setPermissions(new_perm);
279
280 src->setInventoryType(LLInventoryType::IT_SOUND);
281 src->setFlags(new_flags);
282 src->setCreationDate(new_creation);
283
284 LLSD sd = ll_create_sd_from_inventory_item(src);
285 LLPointer<LLInventoryItem> dst = ll_create_item_from_sd(sd);
286
287
288 LLPointer<LLInventoryItem> src1 = create_random_inventory_item();
289 src1->copy(src);
290 src1->clone(src);
291
292 ensure_equals("1.item id::getUUID() failed", dst->getUUID(), src1->getUUID());
293 ensure_equals("2.parent::getParentUUID() failed", dst->getParentUUID(), src1->getParentUUID());
294 ensure_equals("3.name::getName() failed", dst->getName(), src1->getName());
295 ensure_equals("4.type::getType() failed", dst->getType(), src1->getType());
296
297 ensure_equals("5.permissions::getPermissions() failed", dst->getPermissions(), src1->getPermissions());
298 ensure_equals("6.description::getDescription() failed", dst->getDescription(), src1->getDescription());
299 ensure_equals("7.sale type::getSaleType() failed type", dst->getSaleInfo().getSaleType(), src1->getSaleInfo().getSaleType());
300 ensure_equals("8.sale price::getSalePrice() failed price", dst->getSaleInfo().getSalePrice(), src1->getSaleInfo().getSalePrice());
301 ensure_equals("9.asset id::getAssetUUID() failed id", dst->getAssetUUID(), src1->getAssetUUID());
302 ensure_equals("10.inventory type::getInventoryType() failed type", dst->getInventoryType(), src1->getInventoryType());
303 ensure_equals("11.flags::getFlags() failed", dst->getFlags(), src1->getFlags());
304 ensure_equals("12.creation::getCreationDate() failed", dst->getCreationDate(), src1->getCreationDate());
305
306 LLPointer<LLInventoryItem> src2;
307 src1->clone(src2);
308
309 ensure_not_equals("13.item id::getUUID() failed", src1->getUUID(), src2->getUUID());
310 ensure_equals("14.parent::getParentUUID() failed", src2->getParentUUID(), src1->getParentUUID());
311 ensure_equals("15.name::getName() failed", src2->getName(), src1->getName());
312 ensure_equals("16.type::getType() failed", src2->getType(), src1->getType());
313
314 ensure_equals("17.permissions::getPermissions() failed", src2->getPermissions(), src1->getPermissions());
315 ensure_equals("18.description::getDescription() failed", src2->getDescription(), src1->getDescription());
316 ensure_equals("19.sale type::getSaleType() failed type", src2->getSaleInfo().getSaleType(), src1->getSaleInfo().getSaleType());
317 ensure_equals("20.sale price::getSalePrice() failed price", src2->getSaleInfo().getSalePrice(), src1->getSaleInfo().getSalePrice());
318 ensure_equals("21.asset id::getAssetUUID() failed id", src2->getAssetUUID(), src1->getAssetUUID());
319 ensure_equals("22.inventory type::getInventoryType() failed type", src2->getInventoryType(), src1->getInventoryType());
320 ensure_equals("23.flags::getFlags() failed", src2->getFlags(), src1->getFlags());
321 ensure_equals("24.creation::getCreationDate() failed", src2->getCreationDate(), src1->getCreationDate());
322
323
324 }
325
326 template<> template<>
327 void inventory_object::test<7>()
328 {
329 FILE* fp = fopen("linden_file.dat","w+");
330 if(!fp)
331 {
332 llerrs << "file could not be opened\n" << llendl;
333 return;
334 }
335
336 LLPointer<LLInventoryItem> src1 = create_random_inventory_item();
337 src1->exportFile(fp, TRUE);
338 fclose(fp);
339
340 LLPointer<LLInventoryItem> src2 = new LLInventoryItem();
341 fp = fopen("linden_file.dat","r+");
342 if(!fp)
343 {
344 llerrs << "file could not be opened\n" << llendl;
345 return;
346 }
347
348 src2->importFile(fp);
349 fclose(fp);
350
351 ensure_equals("1.item id::getUUID() failed", src1->getUUID(), src2->getUUID());
352 ensure_equals("2.parent::getParentUUID() failed", src1->getParentUUID(), src2->getParentUUID());
353 ensure_equals("3.permissions::getPermissions() failed", src1->getPermissions(), src2->getPermissions());
354 ensure_equals("4.sale price::getSalePrice() failed price", src1->getSaleInfo().getSalePrice(), src2->getSaleInfo().getSalePrice());
355 ensure_equals("5.asset id::getAssetUUID() failed id", src1->getAssetUUID(), src2->getAssetUUID());
356 ensure_equals("6.type::getType() failed", src1->getType(), src2->getType());
357 ensure_equals("7.inventory type::getInventoryType() failed type", src1->getInventoryType(), src2->getInventoryType());
358 ensure_equals("8.name::getName() failed", src1->getName(), src2->getName());
359 ensure_equals("9.description::getDescription() failed", src1->getDescription(), src2->getDescription());
360 ensure_equals("10.creation::getCreationDate() failed", src1->getCreationDate(), src2->getCreationDate());
361
362 }
363
364 template<> template<>
365 void inventory_object::test<8>()
366 {
367
368 LLPointer<LLInventoryItem> src1 = create_random_inventory_item();
369
370 std::ostringstream ostream;
371 src1->exportLegacyStream(ostream, TRUE);
372
373 std::istringstream istream(ostream.str());
374 LLPointer<LLInventoryItem> src2 = new LLInventoryItem();
375 src2->importLegacyStream(istream);
376
377 ensure_equals("1.item id::getUUID() failed", src1->getUUID(), src2->getUUID());
378 ensure_equals("2.parent::getParentUUID() failed", src1->getParentUUID(), src2->getParentUUID());
379 ensure_equals("3.permissions::getPermissions() failed", src1->getPermissions(), src2->getPermissions());
380 ensure_equals("4.sale price::getSalePrice() failed price", src1->getSaleInfo().getSalePrice(), src2->getSaleInfo().getSalePrice());
381 ensure_equals("5.asset id::getAssetUUID() failed id", src1->getAssetUUID(), src2->getAssetUUID());
382 ensure_equals("6.type::getType() failed", src1->getType(), src2->getType());
383 ensure_equals("7.inventory type::getInventoryType() failed type", src1->getInventoryType(), src2->getInventoryType());
384 ensure_equals("8.name::getName() failed", src1->getName(), src2->getName());
385 ensure_equals("9.description::getDescription() failed", src1->getDescription(), src2->getDescription());
386 ensure_equals("10.creation::getCreationDate() failed", src1->getCreationDate(), src2->getCreationDate());
387
388
389 }
390
391 template<> template<>
392 void inventory_object::test<9>()
393 {
394// exportFileXML seg-faults for some reason. LLXMLNode is teh suck.
395#if 0
396 LLPointer<LLInventoryItem> src1 = create_random_inventory_item();
397 LLXMLNode* x_node = src1->exportFileXML(TRUE);
398
399 LLPointer<LLInventoryItem> src2 = new LLInventoryItem();
400 src2->importXML(x_node);
401 ensure_equals("1.item id::getUUID() failed", src1->getUUID(), src2->getUUID());
402 ensure_equals("2.parent::getParentUUID() failed", src1->getParentUUID(), src2->getParentUUID());
403 ensure_equals("3.permissions::getPermissions() failed", src1->getPermissions(), src2->getPermissions());
404 ensure_equals("4.sale price::getSalePrice() failed price", src1->getSaleInfo().getSalePrice(), src2->getSaleInfo().getSalePrice());
405 ensure_equals("5.asset id::getAssetUUID() failed id", src1->getAssetUUID(), src2->getAssetUUID());
406 ensure_equals("6.type::getType() failed", src1->getType(), src2->getType());
407 ensure_equals("7.inventory type::getInventoryType() failed type", src1->getInventoryType(), src2->getInventoryType());
408 ensure_equals("8.name::getName() failed", src1->getName(), src2->getName());
409 ensure_equals("9.description::getDescription() failed", src1->getDescription(), src2->getDescription());
410 ensure_equals("10.creation::getCreationDate() failed", src1->getCreationDate(), src2->getCreationDate());
411#endif
412 }
413
414 template<> template<>
415 void inventory_object::test<10>()
416 {
417 LLPointer<LLInventoryItem> src1 = create_random_inventory_item();
418 U8* bin_bucket = new U8[300];
419 S32 bin_bucket_size = src1->packBinaryBucket(bin_bucket, NULL);
420
421 LLPointer<LLInventoryItem> src2 = new LLInventoryItem();
422 src2->unpackBinaryBucket(bin_bucket, bin_bucket_size);
423
424 ensure_equals("1.sale price::getSalePrice() failed price", src1->getSaleInfo().getSalePrice(), src2->getSaleInfo().getSalePrice());
425 ensure_equals("2.sale type::getSaleType() failed type", src1->getSaleInfo().getSaleType(), src2->getSaleInfo().getSaleType());
426 ensure_equals("3.type::getType() failed", src1->getType(), src2->getType());
427 ensure_equals("4.inventory type::getInventoryType() failed type", src1->getInventoryType(), src2->getInventoryType());
428 ensure_equals("5.name::getName() failed", src1->getName(), src2->getName());
429 ensure_equals("6.description::getDescription() failed", src1->getDescription(), src2->getDescription());
430 ensure_equals("7.flags::getFlags() failed", src1->getFlags(), src2->getFlags());
431
432 }
433
434 template<> template<>
435 void inventory_object::test<11>()
436 {
437 LLPointer<LLInventoryItem> src1 = create_random_inventory_item();
438 LLSD retSd = src1->asLLSD();
439 LLPointer<LLInventoryItem> src2 = new LLInventoryItem();
440 src2->fromLLSD(retSd);
441
442 ensure_equals("1.item id::getUUID() failed", src1->getUUID(), src2->getUUID());
443 ensure_equals("2.parent::getParentUUID() failed", src1->getParentUUID(), src2->getParentUUID());
444 ensure_equals("3.permissions::getPermissions() failed", src1->getPermissions(), src2->getPermissions());
445 ensure_equals("4.asset id::getAssetUUID() failed id", src1->getAssetUUID(), src2->getAssetUUID());
446 ensure_equals("5.type::getType() failed", src1->getType(), src2->getType());
447 ensure_equals("6.inventory type::getInventoryType() failed type", src1->getInventoryType(), src2->getInventoryType());
448 ensure_equals("7.flags::getFlags() failed", src1->getFlags(), src2->getFlags());
449 ensure_equals("8.sale type::getSaleType() failed type", src1->getSaleInfo().getSaleType(), src2->getSaleInfo().getSaleType());
450 ensure_equals("9.sale price::getSalePrice() failed price", src1->getSaleInfo().getSalePrice(), src2->getSaleInfo().getSalePrice());
451 ensure_equals("10.name::getName() failed", src1->getName(), src2->getName());
452 ensure_equals("11.description::getDescription() failed", src1->getDescription(), src2->getDescription());
453
454
455 skip_fail("12.creation::getCreationDate()");
456 ensure_equals("12.creation::getCreationDate() failed", src1->getCreationDate(), src2->getCreationDate());
457 }
458
459//******class LLInventoryCategory*******//
460
461 template<> template<>
462 void inventory_object::test<12>()
147 { 463 {
148 LLPointer<LLInventoryCategory> src = create_random_inventory_cat(); 464 LLPointer<LLInventoryCategory> src = create_random_inventory_cat();
149 LLSD sd = ll_create_sd_from_inventory_category(src); 465 LLSD sd = ll_create_sd_from_inventory_category(src);
150 LLPointer<LLInventoryCategory> dst = ll_create_category_from_sd(sd); 466 LLPointer<LLInventoryCategory> dst = ll_create_category_from_sd(sd);
151 ensure_equals("item id", dst->getUUID(), src->getUUID()); 467
152 ensure_equals("parent", dst->getParentUUID(), src->getParentUUID()); 468 ensure_equals("1.item id::getUUID() failed", dst->getUUID(), src->getUUID());
153 ensure_equals("name", dst->getName(), src->getName()); 469 ensure_equals("2.parent::getParentUUID() failed", dst->getParentUUID(), src->getParentUUID());
154 ensure_equals("type", dst->getType(), src->getType()); 470 ensure_equals("3.name::getName() failed", dst->getName(), src->getName());
155 ensure_equals( 471 ensure_equals("4.type::getType() failed", dst->getType(), src->getType());
156 "preferred type", 472 ensure_equals("5.preferred type::getPreferredType() failed", dst->getPreferredType(), src->getPreferredType());
157 dst->getPreferredType(), 473
158 src->getPreferredType()); 474 src->setPreferredType( LLAssetType::AT_TEXTURE);
475 sd = ll_create_sd_from_inventory_category(src);
476 dst = ll_create_category_from_sd(sd);
477 ensure_equals("6.preferred type::getPreferredType() failed", dst->getPreferredType(), src->getPreferredType());
478
479
159 } 480 }
160 481
161/*
162 template<> template<> 482 template<> template<>
163 void inventory_object::test<3>() 483 void inventory_object::test<13>()
484 {
485 FILE* fp = fopen("linden_file.dat","w");
486 if(!fp)
487 {
488 llerrs << "file coudnt be opened\n" << llendl;
489 return;
490 }
491
492 LLPointer<LLInventoryCategory> src1 = create_random_inventory_cat();
493 src1->exportFile(fp, TRUE);
494 fclose(fp);
495
496 LLPointer<LLInventoryCategory> src2 = new LLInventoryCategory();
497 fp = fopen("linden_file.dat","r");
498 if(!fp)
499 {
500 llerrs << "file coudnt be opened\n" << llendl;
501 return;
502 }
503
504 src2->importFile(fp);
505 fclose(fp);
506
507 ensure_equals("1.item id::getUUID() failed", src1->getUUID(), src2->getUUID());
508 ensure_equals("2.parent::getParentUUID() failed", src1->getParentUUID(), src2->getParentUUID());
509 ensure_equals("3.type::getType() failed", src1->getType(), src2->getType());
510 ensure_equals("4.preferred type::getPreferredType() failed", src1->getPreferredType(), src2->getPreferredType());
511 ensure_equals("5.name::getName() failed", src1->getName(), src2->getName());
512 }
513
514 template<> template<>
515 void inventory_object::test<14>()
164 { 516 {
517 LLPointer<LLInventoryCategory> src1 = create_random_inventory_cat();
518
519 std::ostringstream ostream;
520 src1->exportLegacyStream(ostream, TRUE);
521
522 std::istringstream istream(ostream.str());
523 LLPointer<LLInventoryCategory> src2 = new LLInventoryCategory();
524 src2->importLegacyStream(istream);
525
526 ensure_equals("1.item id::getUUID() failed", src1->getUUID(), src2->getUUID());
527 ensure_equals("2.parent::getParentUUID() failed", src1->getParentUUID(), src2->getParentUUID());
528 ensure_equals("3.type::getType() failed", src1->getType(), src2->getType());
529 ensure_equals("4.preferred type::getPreferredType() failed", src1->getPreferredType(), src2->getPreferredType());
530 ensure_equals("5.name::getName() failed", src1->getName(), src2->getName());
165 531
166 } 532 }
167*/
168} 533}