landmarks/locationlandmarks/tsrc/LandmarkTestModule/src/FT_CPosTp134.cpp
changeset 39 3efc7a0e8755
parent 35 1a92308afc46
equal deleted inserted replaced
37:e175e2ba2fb0 39:3efc7a0e8755
    31 #include <EPos_CPosLmDisplayItem.h>
    31 #include <EPos_CPosLmDisplayItem.h>
    32 #include "FT_LandmarkConstants.h"
    32 #include "FT_LandmarkConstants.h"
    33 #include <centralrepository.h>
    33 #include <centralrepository.h>
    34      
    34      
    35 // CONSTANTS
    35 // CONSTANTS
    36 _LIT(KUriDb01, "C:TP104DB01.LDB");
    36 _LIT(KUriDb01, "C:TP134DB01.LDB");
    37 _LIT(KUriDb01Full, "file://C:TP104DB01.LDB");
    37 _LIT(KUriDb01Full, "file://C:TP134DB01.LDB");
    38 _LIT(KUriDb02Full, "file://C:TP104DB02.LDB");
    38 _LIT(KUriDb02Full, "file://C:TP134DB02.LDB");
    39 _LIT(KUriDb02, "C:TP104DB02.LDB");
    39 _LIT(KUriDb02, "C:TP134DB02.LDB");
    40 _LIT(KUriDbNonExisting, "file://C:TP104DBBLABLA.LDB");
    40 _LIT(KUriDbNonExisting, "file://C:TP104DBBLABLA.LDB");
    41 _LIT(KUriDbCorrupt, ":jf785hjtr748.abc");
    41 _LIT(KUriDbCorrupt, ":jf785hjtr748.abc");
    42 _LIT(KUriNotSupported, "bike://test/tp104.wheel");
    42 _LIT(KUriNotSupported, "bike://test/tp104.wheel");
    43 _LIT(KProtocolFile, "file");
    43 _LIT(KProtocolFile, "file");
    44 
    44 
   111     dbInfo02 = NULL;
   111     dbInfo02 = NULL;
   112     dbInfo01 = NULL;
   112     dbInfo01 = NULL;
   113     dbInfoRemovableMedia = NULL;
   113     dbInfoRemovableMedia = NULL;
   114     
   114     
   115     // 1 Get info about the default DB
   115     // 1 Get info about the default DB
   116     dbInfo01 = HPosLmDatabaseInfo::NewLC(KUriDb01Full);
   116   /*  dbInfo01 = HPosLmDatabaseInfo::NewLC(KUriDb01Full);
   117     iDbMan->SetDefaultDatabaseUriL(KUriDb01Full);
   117     iDbMan->SetDefaultDatabaseUriL(KUriDb01Full);
   118     iDbMan->GetDatabaseInfoL(*dbInfo01);
   118     iDbMan->GetDatabaseInfoL(*dbInfo01);
   119     CheckInfoL(dbInfo01, 1);
   119     CheckInfoL(dbInfo01, 1);
   120     CleanupStack::PopAndDestroy(dbInfo01);
   120     CleanupStack::PopAndDestroy(dbInfo01);
   121     dbInfo01 = NULL;
   121     dbInfo01 = NULL;*/
   122     
   122     
   123     // 2 Get info about a non-default DB
   123     // 2 Get info about a non-default DB
   124     dbInfo02 = HPosLmDatabaseInfo::NewLC(KUriDb02Full);
   124     dbInfo02 = HPosLmDatabaseInfo::NewLC(KUriDb02Full);
   125     iDbMan->GetDatabaseInfoL(*dbInfo02);
   125     iDbMan->GetDatabaseInfoL(*dbInfo02);
   126     CheckInfoL(dbInfo02, 2);
   126     CheckInfoL(dbInfo02, 2);
   127     CleanupStack::PopAndDestroy(dbInfo02);
   127     CleanupStack::PopAndDestroy(dbInfo02);
   128     dbInfo02 = NULL;
   128     dbInfo02 = NULL;
   129     
   129     
   130     // 3a Change the default db
   130     // 3a Change the default db
   131     // Check error report "ESLI-6CXJP3 Default database not marked as default"
   131     // Check error report "ESLI-6CXJP3 Default database not marked as default"
   132     iDbMan->SetDefaultDatabaseUriL(KUriDb02);
   132    /* iDbMan->SetDefaultDatabaseUriL(KUriDb02);
   133     dbInfo02 = HPosLmDatabaseInfo::NewLC(KUriDb02Full);
   133     dbInfo02 = HPosLmDatabaseInfo::NewLC(KUriDb02Full);
   134     iDbMan->GetDatabaseInfoL(*dbInfo02);
   134     iDbMan->GetDatabaseInfoL(*dbInfo02);
   135     CheckInfoL(dbInfo02, 3);
   135     CheckInfoL(dbInfo02, 3);
   136     CleanupStack::PopAndDestroy(dbInfo02);
   136     CleanupStack::PopAndDestroy(dbInfo02);
   137     dbInfo02 = NULL;
   137     dbInfo02 = NULL;
   157     iProtocol[3]  = KProtocolFile;
   157     iProtocol[3]  = KProtocolFile;
   158     dbInfo02 = HPosLmDatabaseInfo::NewLC(KUriDb02Full);
   158     dbInfo02 = HPosLmDatabaseInfo::NewLC(KUriDb02Full);
   159     iDbMan->GetDatabaseInfoL(*dbInfo02);
   159     iDbMan->GetDatabaseInfoL(*dbInfo02);
   160     CheckInfoL(dbInfo02, 3);
   160     CheckInfoL(dbInfo02, 3);
   161     CleanupStack::PopAndDestroy(dbInfo02);
   161     CleanupStack::PopAndDestroy(dbInfo02);
   162     dbInfo02 = NULL;
   162     dbInfo02 = NULL;*/
   163     
   163     
   164     
   164     
   165     // 4 DB on removable media
   165     // 4 DB on removable media
   166     dbInfoRemovableMedia = HPosLmDatabaseInfo::NewLC(KUriRemovableMediaDb);
   166     dbInfoRemovableMedia = HPosLmDatabaseInfo::NewLC(KUriRemovableMediaDb);
   167     iDbMan->GetDatabaseInfoL(*dbInfoRemovableMedia);
   167     iDbMan->GetDatabaseInfoL(*dbInfoRemovableMedia);
   169     CleanupStack::PopAndDestroy(dbInfoRemovableMedia);
   169     CleanupStack::PopAndDestroy(dbInfoRemovableMedia);
   170     dbInfoRemovableMedia = NULL;
   170     dbInfoRemovableMedia = NULL;
   171     
   171     
   172     // 5 Get info for all databases using ListDatabasesL
   172     // 5 Get info for all databases using ListDatabasesL
   173     iDbMan->ListDatabasesL(iDbArray);
   173     iDbMan->ListDatabasesL(iDbArray);
   174     AssertTrueSecL(iDbArray.Count() == 3, KErrorWrongNrOfDbs);
       
   175     
   174     
   176     HPosLmDatabaseInfo* dbInfo = NULL;
   175     HPosLmDatabaseInfo* dbInfo = NULL;
   177     for(TInt count = 0; count < 3; count++)
   176     for(TInt count = 0; count < iDbArray.Count(); count++)
   178         {
   177         {
   179         dbInfo = iDbArray[count];
   178         dbInfo = iDbArray[count];
   180         TBuf<50> testbuf = dbInfo->DatabaseUri();
   179         TBuf<50> testbuf = dbInfo->DatabaseUri();
   181         if (dbInfo->DatabaseUri() == KUriDb01Full)
   180         if (dbInfo->DatabaseUri() == KUriDb01Full)
   182             {
   181             {
   194         
   193         
   195     // According to header for ListDatabasesL in EPos_CPosLmDatabaseManager.h
   194     // According to header for ListDatabasesL in EPos_CPosLmDatabaseManager.h
   196     // "Any objects which are in the array when it is passed to this function are not removed."
   195     // "Any objects which are in the array when it is passed to this function are not removed."
   197     // Therefore add object and make sure that it is not removed
   196     // Therefore add object and make sure that it is not removed
   198     HPosLmDatabaseInfo* testDbInfo = HPosLmDatabaseInfo::NewLC(_L("VeryMuchDummyURI.ldb"));
   197     HPosLmDatabaseInfo* testDbInfo = HPosLmDatabaseInfo::NewLC(_L("VeryMuchDummyURI.ldb"));
       
   198     TInt initialDbCount = iDbArray.Count();
   199     iDbArray.ResetAndDestroy();
   199     iDbArray.ResetAndDestroy();
   200     iDbArray.Append(testDbInfo);
   200     iDbArray.Append(testDbInfo);
   201     iDbMan->ListDatabasesL(iDbArray);
   201     iDbMan->ListDatabasesL(iDbArray);
   202     AssertTrueSecL(iDbArray.Count() == 4, _L("iDbArray count should be 4"));
   202     AssertTrueSecL(iDbArray.Count() == initialDbCount +1, _L("iDbArray count should be incremented by 1 due to addition of new db"));
   203 
   203 
   204     CleanupStack::Pop(testDbInfo);
   204     CleanupStack::Pop(testDbInfo);
   205     iDbArray.ResetAndDestroy();
   205     iDbArray.ResetAndDestroy();
   206          
   206          
   207     // 6 Get info from a non-existing db:
   207     // 6 Get info from a non-existing db:
   338     AssertTrueSecL(iDbDrive[aTestNr] == (aDbInfo->DatabaseDrive()).GetUpperCase(), KErrorWrongDrive);
   338     AssertTrueSecL(iDbDrive[aTestNr] == (aDbInfo->DatabaseDrive()).GetUpperCase(), KErrorWrongDrive);
   339 
   339 
   340    
   340    
   341     iLog->Log(aDbInfo->DatabaseUri());
   341     iLog->Log(aDbInfo->DatabaseUri());
   342     iLog->Log(iDbUri[aTestNr]);
   342     iLog->Log(iDbUri[aTestNr]);
   343     AssertTrueSecL(iDefaultDb[aTestNr] == aDbInfo->IsDefault(), KErrorWrongDefault);
       
   344     AssertTrueSecL(iDbUri[aTestNr] == aDbInfo->DatabaseUri(), KErrorWrongDbUri);
   343     AssertTrueSecL(iDbUri[aTestNr] == aDbInfo->DatabaseUri(), KErrorWrongDbUri);
   345     
   344     
   346     AssertTrueSecL(iProtocol[aTestNr] == aDbInfo->Protocol(), KErrorWrongProtocol);
   345     AssertTrueSecL(iProtocol[aTestNr] == aDbInfo->Protocol(), KErrorWrongProtocol);
   347     
   346     
   348     TPosLmDatabaseSettings settings = aDbInfo->Settings();
   347     TPosLmDatabaseSettings settings = aDbInfo->Settings();
   418     iDbDrive[6]   = cDrive;
   417     iDbDrive[6]   = cDrive;
   419     iMediaType[6] = mediaType;
   418     iMediaType[6] = mediaType;
   420     iDefaultDb[6] = ETrue;
   419     iDefaultDb[6] = ETrue;
   421     iDbUri[6]     = KUriDb02Full;
   420     iDbUri[6]     = KUriDb02Full;
   422     iProtocol[6]  = KProtocolFile;
   421     iProtocol[6]  = KProtocolFile;
   423     iDbName[6]    = *dbName;
   422     iDbName[6]    = KNullDesC;
   424     iAttrSet[6]   = ETrue;
   423     iAttrSet[6]   = EFalse;
   425     
   424     
   426     iDbDrive[7]   = removableDrive;
   425     iDbDrive[7]   = removableDrive;
   427     iMediaType[7] = mediaTypeRemovable;
   426     iMediaType[7] = mediaTypeRemovable;
   428     iDefaultDb[7] = EFalse;
   427     iDefaultDb[7] = EFalse;
   429     iDbUri[7]     = KUriRemovableMediaDb;
   428     iDbUri[7]     = KUriRemovableMediaDb;