applayerpluginsandutils/bookmarksupport/test/t_cpropertyreg.cpp
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "testutils.h"
       
    17 #include "propertyreg.h"
       
    18 #include "bkmrkdb.h"
       
    19 #include "bkmrk.h"
       
    20 #include "bkmrkfolder.h"
       
    21 
       
    22 LOCAL_D CTestWrapper* gTestWrapper;
       
    23 
       
    24 _LIT(KFilename, "t_cpropertyreg.cpp");
       
    25 
       
    26 _LIT(KTxtFolder, "propertyTEST folder 1");
       
    27 
       
    28 _LIT8(KData8Bit1, "8BitData");
       
    29 _LIT(KData16Bit1, "16BitData");
       
    30 const TInt KInt1 = 999;
       
    31 const TReal KReal1 = 42.999;
       
    32 
       
    33 const TUid KUid1 = {0x111};
       
    34 const TUid KUid2 = {0x222};
       
    35 const TUid KUid3 = {0x333};
       
    36 const TUid KUid4 = {0x444};
       
    37 const TUid KUid5 = {0x555};
       
    38 const TUid KUid6 = {0x666};
       
    39 const TUid KUid7 = {0x777};
       
    40 const TUid KUid8 = {0x888};
       
    41 const TUid KUid9 = {0x999};
       
    42 const TUid KUid10 = {0xAAA};
       
    43 const TUid KUid11 = {0xBBB};
       
    44 const TUid KUid12 = {0xCCC};
       
    45 
       
    46 LOCAL_D void GeneralTestsL()
       
    47 	{
       
    48 	CPropertyReg* propRegister = CPropertyReg::NewL();
       
    49 	CleanupStack::PushL(propRegister);
       
    50 
       
    51 	propRegister->RegisterPropertyL(CPropertyReg::EGroupDatabase, KUid1, Bookmark::EDataTypeInt);
       
    52 	propRegister->RegisterPropertyL(CPropertyReg::EGroupDatabase, KUid2, Bookmark::EDataTypeReal);
       
    53 	propRegister->RegisterPropertyL(CPropertyReg::EGroupDatabase, KUid3, Bookmark::EDataTypeDes8);
       
    54 	propRegister->RegisterPropertyL(CPropertyReg::EGroupDatabase, KUid4, Bookmark::EDataTypeDes16);
       
    55 	
       
    56 	propRegister->RegisterPropertyL(CPropertyReg::EGroupFolder, KUid5, Bookmark::EDataTypeInt);
       
    57 	propRegister->RegisterPropertyL(CPropertyReg::EGroupFolder, KUid6, Bookmark::EDataTypeReal);
       
    58 	propRegister->RegisterPropertyL(CPropertyReg::EGroupFolder, KUid7, Bookmark::EDataTypeDes8);
       
    59 	propRegister->RegisterPropertyL(CPropertyReg::EGroupFolder, KUid8, Bookmark::EDataTypeDes16);
       
    60 	
       
    61 	propRegister->RegisterPropertyL(CPropertyReg::EGroupBookmark, KUid9, Bookmark::EDataTypeInt);
       
    62 	propRegister->RegisterPropertyL(CPropertyReg::EGroupBookmark, KUid10, Bookmark::EDataTypeReal);
       
    63 	propRegister->RegisterPropertyL(CPropertyReg::EGroupBookmark, KUid11, Bookmark::EDataTypeDes8);
       
    64 	propRegister->RegisterPropertyL(CPropertyReg::EGroupBookmark, KUid12, Bookmark::EDataTypeDes16);
       
    65 	
       
    66 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupDatabase, KUid1, Bookmark::EDataTypeInt) != KErrNotFound);
       
    67 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupDatabase, KUid2, Bookmark::EDataTypeReal) != KErrNotFound);
       
    68 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupDatabase, KUid3, Bookmark::EDataTypeDes8) != KErrNotFound);
       
    69 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupDatabase, KUid4, Bookmark::EDataTypeDes16) != KErrNotFound);
       
    70 
       
    71 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupFolder, KUid5, Bookmark::EDataTypeInt) != KErrNotFound);
       
    72 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupFolder, KUid6, Bookmark::EDataTypeReal) != KErrNotFound);
       
    73 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupFolder, KUid7, Bookmark::EDataTypeDes8) != KErrNotFound);
       
    74 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupFolder, KUid8, Bookmark::EDataTypeDes16) != KErrNotFound);
       
    75 
       
    76 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupBookmark, KUid9, Bookmark::EDataTypeInt) != KErrNotFound);
       
    77 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupBookmark, KUid10, Bookmark::EDataTypeReal) != KErrNotFound);
       
    78 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupBookmark, KUid11, Bookmark::EDataTypeDes8) != KErrNotFound);
       
    79 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupBookmark, KUid12, Bookmark::EDataTypeDes16) != KErrNotFound);
       
    80 	
       
    81 	// some negative cases
       
    82 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupDatabase, KUid1, Bookmark::EDataTypeReal) == KErrNotFound);
       
    83 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupDatabase, KUid1, Bookmark::EDataTypeDes8) == KErrNotFound);
       
    84 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupDatabase, KUid1, Bookmark::EDataTypeDes16) == KErrNotFound);
       
    85 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupFolder, KUid1, Bookmark::EDataTypeInt) == KErrNotFound);
       
    86 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupBookmark, KUid1, Bookmark::EDataTypeInt) == KErrNotFound);
       
    87 	
       
    88 	propRegister->CommitL();
       
    89 	CleanupStack::PopAndDestroy(propRegister);
       
    90 	propRegister = CPropertyReg::NewL();
       
    91 	CleanupStack::PushL(propRegister);
       
    92 	
       
    93 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupDatabase, KUid1, Bookmark::EDataTypeInt) != KErrNotFound);
       
    94 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupDatabase, KUid2, Bookmark::EDataTypeReal) != KErrNotFound);
       
    95 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupDatabase, KUid3, Bookmark::EDataTypeDes8) != KErrNotFound);
       
    96 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupDatabase, KUid4, Bookmark::EDataTypeDes16) != KErrNotFound);
       
    97 
       
    98 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupFolder, KUid5, Bookmark::EDataTypeInt) != KErrNotFound);
       
    99 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupFolder, KUid6, Bookmark::EDataTypeReal) != KErrNotFound);
       
   100 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupFolder, KUid7, Bookmark::EDataTypeDes8) != KErrNotFound);
       
   101 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupFolder, KUid8, Bookmark::EDataTypeDes16) != KErrNotFound);
       
   102 
       
   103 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupBookmark, KUid9, Bookmark::EDataTypeInt) != KErrNotFound);
       
   104 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupBookmark, KUid10, Bookmark::EDataTypeReal) != KErrNotFound);
       
   105 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupBookmark, KUid11, Bookmark::EDataTypeDes8) != KErrNotFound);
       
   106 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupBookmark, KUid12, Bookmark::EDataTypeDes16) != KErrNotFound);
       
   107 	
       
   108 	// some negative cases
       
   109 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupDatabase, KUid1, Bookmark::EDataTypeReal) == KErrNotFound);
       
   110 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupDatabase, KUid1, Bookmark::EDataTypeDes8) == KErrNotFound);
       
   111 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupDatabase, KUid1, Bookmark::EDataTypeDes16) == KErrNotFound);
       
   112 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupFolder, KUid1, Bookmark::EDataTypeInt) == KErrNotFound);
       
   113 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupBookmark, KUid1, Bookmark::EDataTypeInt) == KErrNotFound);
       
   114 	
       
   115 	User::LeaveIfError(propRegister->DeregisterPropertyL(CPropertyReg::EGroupDatabase, KUid1));
       
   116 	User::LeaveIfError(propRegister->DeregisterPropertyL(CPropertyReg::EGroupDatabase, KUid2));
       
   117 	User::LeaveIfError(propRegister->DeregisterPropertyL(CPropertyReg::EGroupDatabase, KUid3));
       
   118 	User::LeaveIfError(propRegister->DeregisterPropertyL(CPropertyReg::EGroupDatabase, KUid4));
       
   119 	
       
   120 	User::LeaveIfError(propRegister->DeregisterPropertyL(CPropertyReg::EGroupFolder, KUid5));
       
   121 	User::LeaveIfError(propRegister->DeregisterPropertyL(CPropertyReg::EGroupFolder, KUid6));
       
   122 	User::LeaveIfError(propRegister->DeregisterPropertyL(CPropertyReg::EGroupFolder, KUid7));
       
   123 	User::LeaveIfError(propRegister->DeregisterPropertyL(CPropertyReg::EGroupFolder, KUid8));
       
   124 	
       
   125 	User::LeaveIfError(propRegister->DeregisterPropertyL(CPropertyReg::EGroupBookmark, KUid9));
       
   126 	User::LeaveIfError(propRegister->DeregisterPropertyL(CPropertyReg::EGroupBookmark, KUid10));
       
   127 	User::LeaveIfError(propRegister->DeregisterPropertyL(CPropertyReg::EGroupBookmark, KUid11));
       
   128 	User::LeaveIfError(propRegister->DeregisterPropertyL(CPropertyReg::EGroupBookmark, KUid12));
       
   129 	
       
   130 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupDatabase, KUid1, Bookmark::EDataTypeInt) == KErrNotFound);
       
   131 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupDatabase, KUid2, Bookmark::EDataTypeReal) == KErrNotFound);
       
   132 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupDatabase, KUid3, Bookmark::EDataTypeDes8) == KErrNotFound);
       
   133 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupDatabase, KUid4, Bookmark::EDataTypeDes16) == KErrNotFound);
       
   134 
       
   135 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupFolder, KUid5, Bookmark::EDataTypeInt) == KErrNotFound);
       
   136 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupFolder, KUid6, Bookmark::EDataTypeReal) == KErrNotFound);
       
   137 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupFolder, KUid7, Bookmark::EDataTypeDes8) == KErrNotFound);
       
   138 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupFolder, KUid8, Bookmark::EDataTypeDes16) == KErrNotFound);
       
   139 
       
   140 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupBookmark, KUid9, Bookmark::EDataTypeInt) == KErrNotFound);
       
   141 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupBookmark, KUid10, Bookmark::EDataTypeReal) == KErrNotFound);
       
   142 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupBookmark, KUid11, Bookmark::EDataTypeDes8) == KErrNotFound);
       
   143 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupBookmark, KUid12, Bookmark::EDataTypeDes16) == KErrNotFound);
       
   144 	
       
   145 	propRegister->CommitL();
       
   146 	CleanupStack::PopAndDestroy(propRegister);
       
   147 	propRegister = CPropertyReg::NewL();
       
   148 	CleanupStack::PushL(propRegister);
       
   149 	
       
   150 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupDatabase, KUid1, Bookmark::EDataTypeInt) == KErrNotFound);
       
   151 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupDatabase, KUid2, Bookmark::EDataTypeReal) == KErrNotFound);
       
   152 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupDatabase, KUid3, Bookmark::EDataTypeDes8) == KErrNotFound);
       
   153 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupDatabase, KUid4, Bookmark::EDataTypeDes16) == KErrNotFound);
       
   154 
       
   155 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupFolder, KUid5, Bookmark::EDataTypeInt) == KErrNotFound);
       
   156 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupFolder, KUid6, Bookmark::EDataTypeReal) == KErrNotFound);
       
   157 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupFolder, KUid7, Bookmark::EDataTypeDes8) == KErrNotFound);
       
   158 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupFolder, KUid8, Bookmark::EDataTypeDes16) == KErrNotFound);
       
   159 
       
   160 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupBookmark, KUid9, Bookmark::EDataTypeInt) == KErrNotFound);
       
   161 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupBookmark, KUid10, Bookmark::EDataTypeReal) == KErrNotFound);
       
   162 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupBookmark, KUid11, Bookmark::EDataTypeDes8) == KErrNotFound);
       
   163 	gTestWrapper->TEST(propRegister->PropertyIndex(CPropertyReg::EGroupBookmark, KUid12, Bookmark::EDataTypeDes16) == KErrNotFound);
       
   164 	
       
   165 	CleanupStack::PopAndDestroy(propRegister);
       
   166 	}
       
   167 
       
   168 LOCAL_D void DatabasePropertyTestsL()
       
   169 	{
       
   170 	TInt retIntVal;
       
   171 	TReal retRealVal;
       
   172 	HBufC* buf16 = HBufC::NewLC(Bookmark::KMaxDescriptorLength);
       
   173 	TPtr buf16Ptr(buf16->Des());
       
   174 	HBufC8* buf8 = HBufC8::NewLC(Bookmark::KMaxDataLength);
       
   175 	TPtr8 buf8Ptr(buf8->Des());
       
   176 
       
   177 	CBookmarkDb* db = CBookmarkDb::NewL(Bookmark::EVisibilityDefault, NULL);
       
   178 	CleanupStack::PushL(db);
       
   179 	
       
   180 	CPropertyReg& propRegister = db->PropertyRegister();
       
   181 		
       
   182 	propRegister.RegisterPropertyL(CPropertyReg::EGroupDatabase, KUid1, Bookmark::EDataTypeInt);
       
   183 	propRegister.RegisterPropertyL(CPropertyReg::EGroupDatabase, KUid2, Bookmark::EDataTypeReal);
       
   184 	propRegister.RegisterPropertyL(CPropertyReg::EGroupDatabase, KUid3, Bookmark::EDataTypeDes8);
       
   185 	propRegister.RegisterPropertyL(CPropertyReg::EGroupDatabase, KUid4, Bookmark::EDataTypeDes16);
       
   186 	
       
   187 	TInt err = db->CustomProperties().GetCustomProperty(KUid1, retIntVal);
       
   188 	gTestWrapper->TESTE(err == KErrNotFound, err);
       
   189 	TRAP(err, db->CustomProperties().SetCustomPropertyL(KUid5, KInt1));
       
   190 	gTestWrapper->TESTE(err == Bookmark::KErrNotRegistered, err);
       
   191 	
       
   192 	TRAP(err, db->CustomProperties().SetCustomPropertyL(KUid1, KInt1));
       
   193 	gTestWrapper->TESTE(err == KErrNone, err);
       
   194 	TRAP(err, db->CustomProperties().SetCustomPropertyL(KUid2, KReal1));
       
   195 	gTestWrapper->TESTE(err == KErrNone, err);
       
   196 	TRAP(err, db->CustomProperties().SetCustomPropertyL(KUid3, KData8Bit1));
       
   197 	gTestWrapper->TESTE(err == KErrNone, err);
       
   198 	TRAP(err, db->CustomProperties().SetCustomPropertyL(KUid4, KData16Bit1));
       
   199 	gTestWrapper->TESTE(err == KErrNone, err);
       
   200 	
       
   201 	err = db->CustomProperties().GetCustomProperty(KUid1, retIntVal);
       
   202 	gTestWrapper->TESTE(err == KErrNone, err);
       
   203 	gTestWrapper->TEST(retIntVal == KInt1);
       
   204 	err = db->CustomProperties().GetCustomProperty(KUid2, retRealVal);
       
   205 	gTestWrapper->TESTE(err == KErrNone, err);
       
   206 	gTestWrapper->TEST(retRealVal == KReal1);
       
   207 	err = db->CustomProperties().GetCustomProperty(KUid3, buf8Ptr);
       
   208 	gTestWrapper->TESTE(err == KErrNone, err);
       
   209 	gTestWrapper->TEST(buf8Ptr.Compare(KData8Bit1) == 0);
       
   210 	err = db->CustomProperties().GetCustomProperty(KUid4, buf16Ptr);
       
   211 	gTestWrapper->TESTE(err == KErrNone, err);
       
   212 	gTestWrapper->TEST(buf16Ptr.Compare(KData16Bit1) == 0);
       
   213 	
       
   214 	db->CommitL();
       
   215 	
       
   216 	CleanupStack::PopAndDestroy(db);
       
   217 	
       
   218 	db = CBookmarkDb::NewL(Bookmark::EVisibilityDefault, NULL);
       
   219 	CleanupStack::PushL(db);
       
   220 	
       
   221 	err = db->CustomProperties().GetCustomProperty(KUid1, retIntVal);
       
   222 	gTestWrapper->TESTE(err == KErrNone, err);
       
   223 	gTestWrapper->TEST(retIntVal == KInt1);
       
   224 	err = db->CustomProperties().GetCustomProperty(KUid2, retRealVal);
       
   225 	gTestWrapper->TESTE(err == KErrNone, err);
       
   226 	gTestWrapper->TEST(retRealVal == KReal1);
       
   227 	err = db->CustomProperties().GetCustomProperty(KUid3, buf8Ptr);
       
   228 	gTestWrapper->TESTE(err == KErrNone, err);
       
   229 	gTestWrapper->TEST(buf8Ptr.Compare(KData8Bit1) == 0);
       
   230 	err = db->CustomProperties().GetCustomProperty(KUid4, buf16Ptr);
       
   231 	gTestWrapper->TESTE(err == KErrNone, err);
       
   232 	gTestWrapper->TEST(buf16Ptr.Compare(KData16Bit1) == 0);
       
   233 	
       
   234 	User::LeaveIfError(propRegister.DeregisterPropertyL(CPropertyReg::EGroupDatabase, KUid1));
       
   235 	User::LeaveIfError(propRegister.DeregisterPropertyL(CPropertyReg::EGroupDatabase, KUid2));
       
   236 	User::LeaveIfError(propRegister.DeregisterPropertyL(CPropertyReg::EGroupDatabase, KUid3));
       
   237 	User::LeaveIfError(propRegister.DeregisterPropertyL(CPropertyReg::EGroupDatabase, KUid4));
       
   238 	
       
   239 	db->CommitL();
       
   240 	
       
   241 	CleanupStack::PopAndDestroy(3);
       
   242 	}
       
   243 
       
   244 LOCAL_D void BookmarkPropertyTestsL()
       
   245 	{
       
   246 	TInt retIntVal;
       
   247 	TReal retRealVal;
       
   248 	HBufC* buf16 = HBufC::NewLC(Bookmark::KMaxDescriptorLength);
       
   249 	TPtr buf16Ptr(buf16->Des());
       
   250 	HBufC8* buf8 = HBufC8::NewLC(Bookmark::KMaxDataLength);
       
   251 	TPtr8 buf8Ptr(buf8->Des());
       
   252 
       
   253 	CBookmarkDb* db = CBookmarkDb::NewL(Bookmark::EVisibilityDefault, NULL);
       
   254 	CleanupStack::PushL(db);
       
   255 	
       
   256 	CPropertyReg& propRegister = db->PropertyRegister();
       
   257 		
       
   258 	propRegister.RegisterPropertyL(CPropertyReg::EGroupFolder, KUid5, Bookmark::EDataTypeInt);
       
   259 	propRegister.RegisterPropertyL(CPropertyReg::EGroupFolder, KUid6, Bookmark::EDataTypeReal);
       
   260 	propRegister.RegisterPropertyL(CPropertyReg::EGroupFolder, KUid7, Bookmark::EDataTypeDes8);
       
   261 	propRegister.RegisterPropertyL(CPropertyReg::EGroupFolder, KUid8, Bookmark::EDataTypeDes16);
       
   262 	
       
   263 	propRegister.RegisterPropertyL(CPropertyReg::EGroupBookmark, KUid9, Bookmark::EDataTypeInt);
       
   264 	propRegister.RegisterPropertyL(CPropertyReg::EGroupBookmark, KUid10, Bookmark::EDataTypeReal);
       
   265 	propRegister.RegisterPropertyL(CPropertyReg::EGroupBookmark, KUid11, Bookmark::EDataTypeDes8);
       
   266 	propRegister.RegisterPropertyL(CPropertyReg::EGroupBookmark, KUid12, Bookmark::EDataTypeDes16);
       
   267 	
       
   268 	CBookmarkFolder& folder = db->CreateFolderL(KTxtFolder, db->RootL());
       
   269 	CBookmark& bookmark = db->CreateBookmarkL(folder);
       
   270 	
       
   271 	CBkmrkProperties& fldProperties = folder.BkmrkPropertiesL();
       
   272 	TInt err = fldProperties.CustomProperties().GetCustomProperty(KUid5, retIntVal);
       
   273 	gTestWrapper->TESTE(err == KErrNotFound, err);
       
   274 	TRAP(err, fldProperties.CustomProperties().SetCustomPropertyL(KUid1, KInt1));
       
   275 	gTestWrapper->TESTE(err == Bookmark::KErrNotRegistered, err);
       
   276 	
       
   277 	TRAP(err, fldProperties.CustomProperties().SetCustomPropertyL(KUid5, KInt1));
       
   278 	gTestWrapper->TESTE(err == KErrNone, err);
       
   279 	TRAP(err, fldProperties.CustomProperties().SetCustomPropertyL(KUid6, KReal1));
       
   280 	gTestWrapper->TESTE(err == KErrNone, err);
       
   281 	TRAP(err, fldProperties.CustomProperties().SetCustomPropertyL(KUid7, KData8Bit1));
       
   282 	gTestWrapper->TESTE(err == KErrNone, err);
       
   283 	TRAP(err, fldProperties.CustomProperties().SetCustomPropertyL(KUid8, KData16Bit1));
       
   284 	gTestWrapper->TESTE(err == KErrNone, err);
       
   285 	
       
   286 	err = fldProperties.CustomProperties().GetCustomProperty(KUid5, retIntVal);
       
   287 	gTestWrapper->TESTE(err == KErrNone, err);
       
   288 	gTestWrapper->TEST(retIntVal == KInt1);
       
   289 	err = fldProperties.CustomProperties().GetCustomProperty(KUid6, retRealVal);
       
   290 	gTestWrapper->TESTE(err == KErrNone, err);
       
   291 	gTestWrapper->TEST(retRealVal == KReal1);
       
   292 	err = fldProperties.CustomProperties().GetCustomProperty(KUid7, buf8Ptr);
       
   293 	gTestWrapper->TESTE(err == KErrNone, err);
       
   294 	gTestWrapper->TEST(buf8Ptr.Compare(KData8Bit1) == 0);
       
   295 	err = fldProperties.CustomProperties().GetCustomProperty(KUid8, buf16Ptr);
       
   296 	gTestWrapper->TESTE(err == KErrNone, err);
       
   297 	gTestWrapper->TEST(buf16Ptr.Compare(KData16Bit1) == 0);
       
   298 	
       
   299 	CBkmrkExtendedProperties& properties = bookmark.BkmrkExtendedPropertiesL();
       
   300 	err = properties.CustomProperties().GetCustomProperty(KUid9, retIntVal);
       
   301 	gTestWrapper->TESTE(err == KErrNotFound, err);
       
   302 	
       
   303 	TRAP(err, properties.CustomProperties().SetCustomPropertyL(KUid9, KInt1));
       
   304 	gTestWrapper->TESTE(err == KErrNone, err);
       
   305 	TRAP(err, properties.CustomProperties().SetCustomPropertyL(KUid10, KReal1));
       
   306 	gTestWrapper->TESTE(err == KErrNone, err);
       
   307 	TRAP(err, properties.CustomProperties().SetCustomPropertyL(KUid11, KData8Bit1));
       
   308 	gTestWrapper->TESTE(err == KErrNone, err);
       
   309 	TRAP(err, properties.CustomProperties().SetCustomPropertyL(KUid12, KData16Bit1));
       
   310 	gTestWrapper->TESTE(err == KErrNone, err);
       
   311 	
       
   312 	err = properties.CustomProperties().GetCustomProperty(KUid9, retIntVal);
       
   313 	gTestWrapper->TESTE(err == KErrNone, err);
       
   314 	gTestWrapper->TEST(retIntVal == KInt1);
       
   315 	err = properties.CustomProperties().GetCustomProperty(KUid10, retRealVal);
       
   316 	gTestWrapper->TESTE(err == KErrNone, err);
       
   317 	gTestWrapper->TEST(retRealVal == KReal1);
       
   318 	err = properties.CustomProperties().GetCustomProperty(KUid11, buf8Ptr);
       
   319 	gTestWrapper->TESTE(err == KErrNone, err);
       
   320 	gTestWrapper->TEST(buf8Ptr.Compare(KData8Bit1) == 0);
       
   321 	err = properties.CustomProperties().GetCustomProperty(KUid12, buf16Ptr);
       
   322 	gTestWrapper->TESTE(err == KErrNone, err);
       
   323 	gTestWrapper->TEST(buf16Ptr.Compare(KData16Bit1) == 0);
       
   324 	
       
   325 	db->CommitL();
       
   326 	
       
   327 	CleanupStack::PopAndDestroy(db);
       
   328 	
       
   329 	db = CBookmarkDb::NewL(Bookmark::EVisibilityDefault, NULL);
       
   330 	CleanupStack::PushL(db);
       
   331 	
       
   332 	CBookmarkFolder& folder2 = static_cast<CBookmarkFolder&>(db->RootL().At(1));
       
   333 	CBkmrkProperties& fldProperties2 = folder2.BkmrkPropertiesL();
       
   334 	
       
   335 	err = fldProperties2.CustomProperties().GetCustomProperty(KUid5, retIntVal);
       
   336 	gTestWrapper->TESTE(err == KErrNone, err);
       
   337 	gTestWrapper->TEST(retIntVal == KInt1);
       
   338 	err = fldProperties2.CustomProperties().GetCustomProperty(KUid6, retRealVal);
       
   339 	gTestWrapper->TESTE(err == KErrNone, err);
       
   340 	gTestWrapper->TEST(retRealVal == KReal1);
       
   341 	err = fldProperties2.CustomProperties().GetCustomProperty(KUid7, buf8Ptr);
       
   342 	gTestWrapper->TESTE(err == KErrNone, err);
       
   343 	gTestWrapper->TEST(buf8Ptr.Compare(KData8Bit1) == 0);
       
   344 	err = fldProperties2.CustomProperties().GetCustomProperty(KUid8, buf16Ptr);
       
   345 	gTestWrapper->TESTE(err == KErrNone, err);
       
   346 	gTestWrapper->TEST(buf16Ptr.Compare(KData16Bit1) == 0);
       
   347 	
       
   348 	CBookmark& bookmark2 = static_cast<CBookmark&>(folder2.At(0));
       
   349 	CBkmrkExtendedProperties& properties2 = bookmark2.BkmrkExtendedPropertiesL();
       
   350 	
       
   351 	err = properties2.CustomProperties().GetCustomProperty(KUid9, retIntVal);
       
   352 	gTestWrapper->TESTE(err == KErrNone, err);
       
   353 	gTestWrapper->TEST(retIntVal == KInt1);
       
   354 	err = properties2.CustomProperties().GetCustomProperty(KUid10, retRealVal);
       
   355 	gTestWrapper->TESTE(err == KErrNone, err);
       
   356 	gTestWrapper->TEST(retRealVal == KReal1);
       
   357 	err = properties2.CustomProperties().GetCustomProperty(KUid11, buf8Ptr);
       
   358 	gTestWrapper->TESTE(err == KErrNone, err);
       
   359 	gTestWrapper->TEST(buf8Ptr.Compare(KData8Bit1) == 0);
       
   360 	err = properties2.CustomProperties().GetCustomProperty(KUid12, buf16Ptr);
       
   361 	gTestWrapper->TESTE(err == KErrNone, err);
       
   362 	gTestWrapper->TEST(buf16Ptr.Compare(KData16Bit1) == 0);
       
   363 	
       
   364 	User::LeaveIfError(propRegister.DeregisterPropertyL(CPropertyReg::EGroupFolder, KUid5));
       
   365 	User::LeaveIfError(propRegister.DeregisterPropertyL(CPropertyReg::EGroupFolder, KUid6));
       
   366 	User::LeaveIfError(propRegister.DeregisterPropertyL(CPropertyReg::EGroupFolder, KUid7));
       
   367 	User::LeaveIfError(propRegister.DeregisterPropertyL(CPropertyReg::EGroupFolder, KUid8));
       
   368 	
       
   369 	User::LeaveIfError(propRegister.DeregisterPropertyL(CPropertyReg::EGroupBookmark, KUid9));
       
   370 	User::LeaveIfError(propRegister.DeregisterPropertyL(CPropertyReg::EGroupBookmark, KUid10));
       
   371 	User::LeaveIfError(propRegister.DeregisterPropertyL(CPropertyReg::EGroupBookmark, KUid11));
       
   372 	User::LeaveIfError(propRegister.DeregisterPropertyL(CPropertyReg::EGroupBookmark, KUid12));
       
   373 	
       
   374 	db->DeleteItemL(folder2.Id(), ETrue);
       
   375 	
       
   376 	db->CommitL();
       
   377 	
       
   378 	CleanupStack::PopAndDestroy(3);
       
   379 	}
       
   380 
       
   381 void DoCPropertyRegUnitL(CTestWrapper* aTest)
       
   382 	{
       
   383 	gTestWrapper = aTest;
       
   384 	gTestWrapper->SetFile(KFilename);
       
   385 	gTestWrapper->Next(_L("*** CPropertyReg tests ***"));
       
   386 	
       
   387 	GeneralTestsL();
       
   388 	
       
   389 	DatabasePropertyTestsL();
       
   390 	BookmarkPropertyTestsL();
       
   391 	}