landmarks/locationlandmarks/tsrc/LandmarkTestModule/src/FT_CPosTp133.cpp
changeset 39 3efc7a0e8755
parent 35 1a92308afc46
equal deleted inserted replaced
37:e175e2ba2fb0 39:3efc7a0e8755
    26 #include <EPos_CPosLmDisplayData.h>
    26 #include <EPos_CPosLmDisplayData.h>
    27 #include <EPos_CPosLmDisplayItem.h>
    27 #include <EPos_CPosLmDisplayItem.h>
    28 #include <EPos_TPosLMSortPref.h>
    28 #include <EPos_TPosLMSortPref.h>
    29 #include "FT_CSearchResult.h"
    29 #include "FT_CSearchResult.h"
    30 #include <LbsPosition.h>
    30 #include <LbsPosition.h>
       
    31 #include "FT_LandmarkConstants.h"
    31 
    32 
    32 #include <EPos_CPosLmDatabaseManager.h>
    33 #include <EPos_CPosLmDatabaseManager.h>
    33 #include <EPos_CPosLmMultiDbSearch.h>
    34 #include <EPos_CPosLmMultiDbSearch.h>
    34      
    35      
    35 // CONSTANTS
    36 // CONSTANTS
    36 const TInt KNrOfDatabases = 5;
    37 const TInt KNrOfDatabases = 5;
       
    38 _LIT(KTp133DbFile, "TP133Test.ldb");
    37 // ================= MEMBER FUNCTIONS =======================
    39 // ================= MEMBER FUNCTIONS =======================
    38 
    40 
    39 // ---------------------------------------------------------
    41 // ---------------------------------------------------------
    40 // CPosTp133::CloseTest
    42 // CPosTp133::CloseTest
    41 //
    43 //
    57     iLandmarkSearch = NULL;
    59     iLandmarkSearch = NULL;
    58     
    60     
    59     delete iMultiLandmarkSearch;
    61     delete iMultiLandmarkSearch;
    60     iMultiLandmarkSearch = NULL;
    62     iMultiLandmarkSearch = NULL;
    61     
    63     
       
    64     iJustNowSearchResults->Reset();
       
    65     
    62     TRAPD(err, RemoveAllLmDatabasesL());
    66     TRAPD(err, RemoveAllLmDatabasesL());
    63     if (err != KErrNone) iLog->Log(_L("Problem when removing all lm databases"));
    67     if (err != KErrNone) iLog->Log(_L("Problem when removing all lm databases"));
       
    68     ReleaseLandmarkResources();
    64     }
    69     }
    65 
    70 
    66 // ---------------------------------------------------------
    71 // ---------------------------------------------------------
    67 // CPosTp133::StartL
    72 // CPosTp133::StartL
    68 //
    73 //
    69 // (other items were commented in a header).
    74 // (other items were commented in a header).
    70 // ---------------------------------------------------------
    75 // ---------------------------------------------------------
    71 //
    76 //
    72 void CPosTp133::StartL()
    77 void CPosTp133::StartL()
    73     {
    78     {
    74     _LIT(KDb20, "EPOSLM_020.LDB");
    79     CDesCArray* dbUris = NULL;
    75     _LIT(KDb40, "EPOSLM_040.LDB");
       
    76     _LIT(KDb60, "EPOSLM_060.LDB");
       
    77     _LIT(KDb80, "EPOSLM_080.LDB");
       
    78     _LIT(KDb105, "EPOSLM_105.LDB");
       
    79     
       
    80     // PrepareDatabases
    80     // PrepareDatabases
    81     RemoveAllLmDatabasesL();
    81     RemoveAllLmDatabasesL();
       
    82     // Get the list of Dbs remaining after removing the possible ones.
       
    83     CPosLmDatabaseManager* dbMan = CPosLmDatabaseManager::NewL();
       
    84         CleanupStack::PushL(dbMan);
       
    85         dbUris = dbMan->ListDatabasesLC();
       
    86         
       
    87         TInt initialDbCount = dbUris->Count();
       
    88         CleanupStack::PopAndDestroy(dbUris);
    82     CopyTestDbFileL(KDb20);
    89     CopyTestDbFileL(KDb20);
    83     CopyTestDbFileL(KDb40);
    90     CopyTestDbFileL(KDb40);
    84     CopyTestDbFileL(KDb60);
    91     CopyTestDbFileL(KDb60);
    85     CopyTestDbFileL(KDb80);
    92     CopyTestDbFileL(KDb80);
    86     CopyTestDbFileL(KDb105);
    93     CopyTestDbFileL(KDb105);
    87         
    94         
    88 	iDisplayData = NULL;
    95 	iDisplayData = NULL;
    89 	iLandmarkSearch = NULL;
    96 	iLandmarkSearch = NULL;
    90 	       
    97 	       
    91 	CPosLmDatabaseManager* dbMan = CPosLmDatabaseManager::NewL();
    98      dbUris = dbMan->ListDatabasesLC();
    92     CleanupStack::PushL(dbMan);
       
    93     CDesCArray* dbUris = dbMan->ListDatabasesLC();
       
    94     CleanupStack::Pop(dbUris);
    99     CleanupStack::Pop(dbUris);
    95     CleanupStack::PopAndDestroy(dbMan);
   100     CleanupStack::PopAndDestroy(dbMan);
    96     CleanupStack::PushL(dbUris);
   101     CleanupStack::PushL(dbUris);
    97         
   102         
    98     AssertTrueSecL(dbUris->Count() == KNrOfDatabases, _L("Wrong number of test databases!"));
   103     AssertTrueSecL(dbUris->Count() == initialDbCount+KNrOfDatabases, _L("Wrong number of test databases!"));
    99     
   104     
   100     // Use this db as a template for how the result from multiple db search should be sorted
   105     // Use this db as a template for how the result from multiple db search should be sorted
   101 	// used mostly in LandmarksSortL
   106 	// used mostly in LandmarksSortL
   102 	iDatabase = UseGeneratedDbFileL();
   107     CopyTestDbFileL(KTp133DbFile);
       
   108 	iDatabase = CPosLandmarkDatabase::OpenL(KTp133DbFile);
   103     if (iDatabase->IsInitializingNeeded())
   109     if (iDatabase->IsInitializingNeeded())
   104        {
   110        {
   105        ExecuteAndDeleteLD(iDatabase->InitializeL());
   111        ExecuteAndDeleteLD(iDatabase->InitializeL());
   106        }
   112        }
   107 
   113 
   108  	AppendSearchResultsL();
   114  	AppendSearchResultsL();
       
   115  	// Get only the list of dburi in which this test case operations need to be performed
       
   116  	TInt dbUriCount = dbUris->Count();
   109  	
   117  	
       
   118  	for ( TInt i= 0;i < dbUriCount;i++)
       
   119  	    {
       
   120     iLog->Log((*dbUris)[i]);
       
   121     // Action to be performed only on the newly added dbs in this test case
       
   122         TPtrC dbUri((*dbUris)[i]);
       
   123             if ( (dbUri != KDb20Uri) && (dbUri != KDb40Uri) && (dbUri != KDb60Uri) &&
       
   124                    ( dbUri != KDb80Uri) && (dbUri != KDb105Uri) )
       
   125                 {
       
   126                 dbUris->Delete(i);
       
   127                 }
       
   128 
       
   129  	    }
   110     DoSearchL(iSearchResults, dbUris, ESynchronous);
   130     DoSearchL(iSearchResults, dbUris, ESynchronous);
   111     
   131     
   112     DoSearchL(iSearchResults, dbUris, EAsynchronous);
   132     DoSearchL(iSearchResults, dbUris, EAsynchronous);
   113     
   133     
   114     // Test Partial landmarks
   134     // Test Partial landmarks