plugins/contacts/symbian/contactsmodel/tsrc/cntplsql/src/t_cqwertypredictivesearchtable.cpp
changeset 5 603d3f8b6302
parent 0 876b1a06bc25
equal deleted inserted replaced
3:e4ebb16b39ea 5:603d3f8b6302
    90 void UT_CQwertyPredictiveSearchTable::ConstructL()
    90 void UT_CQwertyPredictiveSearchTable::ConstructL()
    91     {
    91     {
    92     // The ConstructL from the base class CEUnitTestSuiteClass must be called.
    92     // The ConstructL from the base class CEUnitTestSuiteClass must be called.
    93     // It generates the test case table.
    93     // It generates the test case table.
    94     CEUnitTestSuiteClass::ConstructL();
    94     CEUnitTestSuiteClass::ConstructL();
    95     
    95 
    96 
       
    97 #if defined(USE_ORBIT_KEYMAP)
       
    98     // Create singleton outside actual test cases so that it is not treated as
    96     // Create singleton outside actual test cases so that it is not treated as
    99     // resource leak, since it can't be deleted.
    97     // resource leak, since it can't be deleted.
   100     HbKeymapFactory::instance();
    98     HbKeymapFactory::instance();
   101 #endif
       
   102     }
    99     }
   103     
   100     
   104 // -----------------------------------------------------------------------------
   101 // -----------------------------------------------------------------------------
   105 // UT_CQwertyPredictiveSearchTable::SetupL
   102 // UT_CQwertyPredictiveSearchTable::SetupL
   106 // Must start with an empty DB file for each test case
   103 // Must start with an empty DB file for each test case
   235 
   232 
   236     iTable->DeleteL(*contact, lowDiskErrorOccurred);
   233     iTable->DeleteL(*contact, lowDiskErrorOccurred);
   237     CleanupStack::PopAndDestroy(contact);
   234     CleanupStack::PopAndDestroy(contact);
   238     
   235     
   239     CheckItemCountL(InitTableVector());
   236     CheckItemCountL(InitTableVector());
       
   237     }
       
   238 
       
   239 // -----------------------------------------------------------------------------
       
   240 // UT_CQwertyPredictiveSearchTable::UT_UnmappedMailAddressL
       
   241 // -----------------------------------------------------------------------------
       
   242 //
       
   243 void UT_CQwertyPredictiveSearchTable::UT_UnmappedMailAddressL()
       
   244     {
       
   245     // All names and mail addresses begin with unmapped characters, so contact
       
   246     // is not stored to QWERTY tables at all.
       
   247     _LIT(KUnmappedName, "8nbrAtStart");
       
   248     _LIT(KNameWithUnmappedChars, "rname28afterNbr");
       
   249     _LIT(KUnmappedMail, "mailto:123user@domain");
       
   250     _LIT(KUnmappedMail2, "800@call.id");
       
   251     _LIT(KUnmappedMail3, "5begins@by.nbr");
       
   252     AddContactL(KTestContactId, KUnmappedName, KNullDesC, KUnmappedMail, KUnmappedMail2); 
       
   253     // Check tables are empty
       
   254     CheckItemCountL(InitTableVector());
       
   255     
       
   256     
       
   257     // One mail address begin with a mapped character
       
   258     AddContactL(KTestContactId2, KNullDesC, KNameWithUnmappedChars, 
       
   259                 KUnmappedMail, KUnmappedMail2, KMail);
       
   260     
       
   261     QVector<TInt> result = InitTableVector();
       
   262     result[3] = 1; // KNameWithUnmappedChars
       
   263     result[4] = 1; // KMail
       
   264     CheckItemCountL(result);
       
   265     
       
   266    
       
   267     // All mail addresses begin with unmapped characters, but contact can be
       
   268     // searched by first name and last name. Contact is stored to QWERTY tables.
       
   269     AddContactL(KTestContactId3, KNameWithUnmappedChars, KLastName, 
       
   270                 KUnmappedMail, KUnmappedMail2, KUnmappedMail3);
       
   271     
       
   272     result[2] = 1; // KLastName
       
   273     result[3] = 2; // Second KNameWithUnmappedChars
       
   274     CheckItemCountL(result);
   240     }
   275     }
   241 
   276 
   242 // -----------------------------------------------------------------------------
   277 // -----------------------------------------------------------------------------
   243 // UT_CQwertyPredictiveSearchTable::InitTableVector
   278 // UT_CQwertyPredictiveSearchTable::InitTableVector
   244 // -----------------------------------------------------------------------------
   279 // -----------------------------------------------------------------------------
   396     "UT_CQwertyPredictiveSearchTable",
   431     "UT_CQwertyPredictiveSearchTable",
   397     "DeleteL",
   432     "DeleteL",
   398     "FUNCTIONALITY",
   433     "FUNCTIONALITY",
   399     SetupL, UT_DeleteLL, Teardown )
   434     SetupL, UT_DeleteLL, Teardown )
   400 
   435 
       
   436 EUNIT_TEST(
       
   437     "CreateInDbL - unmapped mail address",
       
   438     "UT_CQwertyPredictiveSearchTable",
       
   439     "CreateInDbL",
       
   440     "FUNCTIONALITY",
       
   441     SetupL, UT_UnmappedMailAddressL, Teardown )
       
   442 
   401 EUNIT_END_TEST_TABLE
   443 EUNIT_END_TEST_TABLE
   402 
   444 
   403 //  END OF FILE
   445 //  END OF FILE