Ejemplo n.º 1
0
	void inventory_object::test<8>()
	{
			
		LLPointer<LLInventoryItem> src1 = create_random_inventory_item();

		std::ostringstream ostream;
		src1->exportLegacyStream(ostream, TRUE);
		
		std::istringstream istream(ostream.str());
		LLPointer<LLInventoryItem> src2 = new LLInventoryItem();
		src2->importLegacyStream(istream);
					
		ensure_equals("1.item id::getUUID() failed", src1->getUUID(), src2->getUUID());
		ensure_equals("2.parent::getParentUUID() failed", src1->getParentUUID(), src2->getParentUUID());
		ensure_equals("3.permissions::getPermissions() failed", src1->getPermissions(), src2->getPermissions());
		ensure_equals("4.sale price::getSalePrice() failed price", src1->getSaleInfo().getSalePrice(), src2->getSaleInfo().getSalePrice());
		ensure_equals("5.asset id::getAssetUUID() failed id", src1->getAssetUUID(), src2->getAssetUUID());
		ensure_equals("6.type::getType() failed", src1->getType(), src2->getType());
		ensure_equals("7.inventory type::getInventoryType() failed type", src1->getInventoryType(), src2->getInventoryType());
		ensure_equals("8.name::getName() failed", src1->getName(), src2->getName());
		ensure_equals("9.description::getDescription() failed", src1->getDescription(), src2->getDescription());				
		ensure_equals("10.creation::getCreationDate() failed", src1->getCreationDate(), src2->getCreationDate());
		
		
	}
Ejemplo n.º 2
0
	void inventory_object::test<10>()
	{
		LLPointer<LLInventoryItem> src1 = create_random_inventory_item();
		U8* bin_bucket = new U8[300];
		S32 bin_bucket_size = src1->packBinaryBucket(bin_bucket, NULL);

		LLPointer<LLInventoryItem> src2 = new LLInventoryItem();
		src2->unpackBinaryBucket(bin_bucket, bin_bucket_size);

		ensure_equals("1.sale price::getSalePrice() failed price", src1->getSaleInfo().getSalePrice(), src2->getSaleInfo().getSalePrice());
		ensure_equals("2.sale type::getSaleType() failed type", src1->getSaleInfo().getSaleType(), src2->getSaleInfo().getSaleType());
		ensure_equals("3.type::getType() failed", src1->getType(), src2->getType());
		ensure_equals("4.inventory type::getInventoryType() failed type", src1->getInventoryType(), src2->getInventoryType());
		ensure_equals("5.name::getName() failed", src1->getName(), src2->getName());
		ensure_equals("6.description::getDescription() failed", src1->getDescription(), src2->getDescription());				
		ensure_equals("7.flags::getFlags() failed", src1->getFlags(), src2->getFlags());
	
	}
Ejemplo n.º 3
0
	void inventory_object::test<11>()
	{
		LLPointer<LLInventoryItem> src1 = create_random_inventory_item();
		LLSD retSd = src1->asLLSD();
		LLPointer<LLInventoryItem> src2 = new LLInventoryItem();
		src2->fromLLSD(retSd);

		ensure_equals("1.item id::getUUID() failed", src1->getUUID(), src2->getUUID());
		ensure_equals("2.parent::getParentUUID() failed", src1->getParentUUID(), src2->getParentUUID());
		ensure_equals("3.permissions::getPermissions() failed", src1->getPermissions(), src2->getPermissions());
		ensure_equals("4.asset id::getAssetUUID() failed id", src1->getAssetUUID(), src2->getAssetUUID());
		ensure_equals("5.type::getType() failed", src1->getType(), src2->getType());
		ensure_equals("6.inventory type::getInventoryType() failed type", src1->getInventoryType(), src2->getInventoryType());
		ensure_equals("7.flags::getFlags() failed", src1->getFlags(), src2->getFlags());
		ensure_equals("8.sale type::getSaleType() failed type", src1->getSaleInfo().getSaleType(), src2->getSaleInfo().getSaleType());
		ensure_equals("9.sale price::getSalePrice() failed price", src1->getSaleInfo().getSalePrice(), src2->getSaleInfo().getSalePrice());
		ensure_equals("10.name::getName() failed", src1->getName(), src2->getName());
		ensure_equals("11.description::getDescription() failed", src1->getDescription(), src2->getDescription());				
		ensure_equals("12.creation::getCreationDate() failed", src1->getCreationDate(), src2->getCreationDate());
	}	
Ejemplo n.º 4
0
	void inventory_object::test<9>()
	{
// exportFileXML seg-faults for some reason. LLXMLNode is teh suck.
#if 0		
		LLPointer<LLInventoryItem> src1 = create_random_inventory_item();
		LLXMLNode* x_node = src1->exportFileXML(TRUE);

		LLPointer<LLInventoryItem> src2 = new LLInventoryItem();
		src2->importXML(x_node);
		ensure_equals("1.item id::getUUID() failed", src1->getUUID(), src2->getUUID());
		ensure_equals("2.parent::getParentUUID() failed", src1->getParentUUID(), src2->getParentUUID());
		ensure_equals("3.permissions::getPermissions() failed", src1->getPermissions(), src2->getPermissions());
		ensure_equals("4.sale price::getSalePrice() failed price", src1->getSaleInfo().getSalePrice(), src2->getSaleInfo().getSalePrice());
		ensure_equals("5.asset id::getAssetUUID() failed id", src1->getAssetUUID(), src2->getAssetUUID());
		ensure_equals("6.type::getType() failed", src1->getType(), src2->getType());
		ensure_equals("7.inventory type::getInventoryType() failed type", src1->getInventoryType(), src2->getInventoryType());
		ensure_equals("8.name::getName() failed", src1->getName(), src2->getName());
		ensure_equals("9.description::getDescription() failed", src1->getDescription(), src2->getDescription());				
		ensure_equals("10.creation::getCreationDate() failed", src1->getCreationDate(), src2->getCreationDate());
#endif		
	}
Ejemplo n.º 5
0
	void inventory_object::test<7>()
	{
		FILE* fp = fopen("linden_file.dat","w+");
		if(!fp)
		{
			llerrs << "file could not be opened\n" << llendl;
			return;
		}
			
		LLPointer<LLInventoryItem> src1 = create_random_inventory_item();
		src1->exportFile(fp, TRUE);
		fclose(fp);

		LLPointer<LLInventoryItem> src2 = new LLInventoryItem();	
		fp = fopen("linden_file.dat","r+");
		if(!fp)
		{
			llerrs << "file could not be opened\n" << llendl;
			return;
		}
		
		src2->importFile(fp);
		fclose(fp);
		
		ensure_equals("1.item id::getUUID() failed", src1->getUUID(), src2->getUUID());
		ensure_equals("2.parent::getParentUUID() failed", src1->getParentUUID(), src2->getParentUUID());
		ensure_equals("3.permissions::getPermissions() failed", src1->getPermissions(), src2->getPermissions());
		ensure_equals("4.sale price::getSalePrice() failed price", src1->getSaleInfo().getSalePrice(), src2->getSaleInfo().getSalePrice());
		ensure_equals("5.asset id::getAssetUUID() failed id", src1->getAssetUUID(), src2->getAssetUUID());
		ensure_equals("6.type::getType() failed", src1->getType(), src2->getType());
		ensure_equals("7.inventory type::getInventoryType() failed type", src1->getInventoryType(), src2->getInventoryType());
		ensure_equals("8.name::getName() failed", src1->getName(), src2->getName());
		ensure_equals("9.description::getDescription() failed", src1->getDescription(), src2->getDescription());				
		ensure_equals("10.creation::getCreationDate() failed", src1->getCreationDate(), src2->getCreationDate());
			
	}
Ejemplo n.º 6
0
	void inventory_object::test<6>()
	{
		LLPointer<LLInventoryItem> src = create_random_inventory_item();
		
		LLUUID new_item_id, new_parent_id;
		new_item_id.generate();
		src->setUUID(new_item_id);
		
		new_parent_id.generate();
		src->setParent(new_parent_id);
		
		LLString new_name = "LindenLab";
		src->rename(new_name);
		
		src->setType(LLAssetType::AT_SOUND);

		LLUUID new_asset_id;
		new_asset_id.generate();
		
		src->setAssetUUID(new_asset_id);
		LLString new_desc = "SecondLife Testing";
		src->setDescription(new_desc);
		
		S32 new_price = rand();
		LLSaleInfo new_sale_info(LLSaleInfo::FS_COPY, new_price);
		src->setSaleInfo(new_sale_info);

		U32 new_flags = rand();
		S32 new_creation = time(NULL);

		LLPermissions new_perm;

		LLUUID new_creator_id;
		new_creator_id.generate();
	
		LLUUID new_owner_id;
		new_owner_id.generate();

		LLUUID last_owner_id;
		last_owner_id.generate();

		LLUUID new_group_id;
		new_group_id.generate();
		new_perm.init(new_creator_id, new_owner_id, last_owner_id, new_group_id);
		new_perm.initMasks(PERM_ALL, PERM_ALL, PERM_COPY, PERM_COPY, PERM_MODIFY | PERM_COPY);
		src->setPermissions(new_perm);

		src->setInventoryType(LLInventoryType::IT_SOUND);
		src->setFlags(new_flags);
		src->setCreationDate(new_creation);

		LLSD sd = ll_create_sd_from_inventory_item(src);
		LLPointer<LLInventoryItem> dst = ll_create_item_from_sd(sd);


		LLPointer<LLInventoryItem> src1 = create_random_inventory_item();
		src1->copy(src);
		src1->clone(src);
		
		ensure_equals("1.item id::getUUID() failed", dst->getUUID(), src1->getUUID());
		ensure_equals("2.parent::getParentUUID() failed", dst->getParentUUID(), src1->getParentUUID());
		ensure_equals("3.name::getName() failed", dst->getName(), src1->getName());
		ensure_equals("4.type::getType() failed", dst->getType(), src1->getType());
		
		ensure_equals("5.permissions::getPermissions() failed", dst->getPermissions(), src1->getPermissions());
		ensure_equals("6.description::getDescription() failed", dst->getDescription(), src1->getDescription());
		ensure_equals("7.sale type::getSaleType() failed type", dst->getSaleInfo().getSaleType(), src1->getSaleInfo().getSaleType());
		ensure_equals("8.sale price::getSalePrice() failed price", dst->getSaleInfo().getSalePrice(), src1->getSaleInfo().getSalePrice());
		ensure_equals("9.asset id::getAssetUUID() failed id", dst->getAssetUUID(), src1->getAssetUUID());
		ensure_equals("10.inventory type::getInventoryType() failed type", dst->getInventoryType(), src1->getInventoryType());
		ensure_equals("11.flags::getFlags() failed", dst->getFlags(), src1->getFlags());
		ensure_equals("12.creation::getCreationDate() failed", dst->getCreationDate(), src1->getCreationDate());

		LLPointer<LLInventoryItem> src2;
		src1->clone(src2);
		
		ensure_not_equals("13.item id::getUUID() failed", src1->getUUID(), src2->getUUID());
		ensure_equals("14.parent::getParentUUID() failed", src2->getParentUUID(), src1->getParentUUID());
		ensure_equals("15.name::getName() failed", src2->getName(), src1->getName());
		ensure_equals("16.type::getType() failed", src2->getType(), src1->getType());
		
		ensure_equals("17.permissions::getPermissions() failed", src2->getPermissions(), src1->getPermissions());
		ensure_equals("18.description::getDescription() failed", src2->getDescription(), src1->getDescription());
		ensure_equals("19.sale type::getSaleType() failed type", src2->getSaleInfo().getSaleType(), src1->getSaleInfo().getSaleType());
		ensure_equals("20.sale price::getSalePrice() failed price", src2->getSaleInfo().getSalePrice(), src1->getSaleInfo().getSalePrice());
		ensure_equals("21.asset id::getAssetUUID() failed id", src2->getAssetUUID(), src1->getAssetUUID());
		ensure_equals("22.inventory type::getInventoryType() failed type", src2->getInventoryType(), src1->getInventoryType());
		ensure_equals("23.flags::getFlags() failed", src2->getFlags(), src1->getFlags());
		ensure_equals("24.creation::getCreationDate() failed", src2->getCreationDate(), src1->getCreationDate());


	}
Ejemplo n.º 7
0
	void inventory_object::test<6>()
	{
		LLPointer<LLInventoryItem> src = create_random_inventory_item();
		
		LLUUID new_item_id, new_parent_id;
		new_item_id.generate();
		src->setUUID(new_item_id);
		
		new_parent_id.generate();
		src->setParent(new_parent_id);
		
		std::string new_name = "LindenLab";
		src->rename(new_name);
		
		src->setType(LLAssetType::AT_SOUND);

		LLUUID new_asset_id;
		new_asset_id.generate();
		
		src->setAssetUUID(new_asset_id);
		std::string new_desc = "GIS Testing";
		src->setDescription(new_desc);
		
		S32 new_price = rand();
		LLSaleInfo new_sale_info(LLSaleInfo::FS_COPY, new_price);
		src->setSaleInfo(new_sale_info);

		U32 new_flags = rand();
		S32 new_creation = time(NULL);

		LLPermissions new_perm;

		LLUUID new_creator_id;
		new_creator_id.generate();
	
		LLUUID new_owner_id;
		new_owner_id.generate();

		LLUUID last_owner_id;
		last_owner_id.generate();

		LLUUID new_group_id;
		new_group_id.generate();
		new_perm.init(new_creator_id, new_owner_id, last_owner_id, new_group_id);
		new_perm.initMasks(PERM_ALL, PERM_ALL, PERM_COPY, PERM_COPY, PERM_MODIFY | PERM_COPY);
		src->setPermissions(new_perm);

		src->setInventoryType(LLInventoryType::IT_SOUND);
		src->setFlags(new_flags);
		src->setCreationDate(new_creation);

		// test a save/load cycle to LLSD and back again
		LLSD sd = ll_create_sd_from_inventory_item(src);
		LLPointer<LLInventoryItem> dst = new LLInventoryItem;
		bool successful_parse = dst->fromLLSD(sd);
		ensure_equals("0.LLInventoryItem::fromLLSD()", successful_parse, true);

		LLPointer<LLInventoryItem> src1 = create_random_inventory_item();
		src1->copyItem(src);
		
		ensure_equals("1.item id::getUUID() failed", dst->getUUID(), src1->getUUID());
		ensure_equals("2.parent::getParentUUID() failed", dst->getParentUUID(), src1->getParentUUID());
		ensure_equals("3.name::getName() failed", dst->getName(), src1->getName());
		ensure_equals("4.type::getType() failed", dst->getType(), src1->getType());
		
		ensure_equals("5.permissions::getPermissions() failed", dst->getPermissions(), src1->getPermissions());
		ensure_equals("6.description::getDescription() failed", dst->getDescription(), src1->getDescription());
		ensure_equals("7.sale type::getSaleType() failed type", dst->getSaleInfo().getSaleType(), src1->getSaleInfo().getSaleType());
		ensure_equals("8.sale price::getSalePrice() failed price", dst->getSaleInfo().getSalePrice(), src1->getSaleInfo().getSalePrice());
		ensure_equals("9.asset id::getAssetUUID() failed id", dst->getAssetUUID(), src1->getAssetUUID());
		ensure_equals("10.inventory type::getInventoryType() failed type", dst->getInventoryType(), src1->getInventoryType());
		ensure_equals("11.flags::getFlags() failed", dst->getFlags(), src1->getFlags());
		ensure_equals("12.creation::getCreationDate() failed", dst->getCreationDate(), src1->getCreationDate());

		// quick test to make sure generateUUID() really works
		src1->generateUUID();	
		ensure_not_equals("13.item id::generateUUID() failed", src->getUUID(), src1->getUUID());
	}