phoneengine/phonecntfinder2/tsrc/u_cphcntmatch2/u_cphcntmatch2.cpp
changeset 72 c76a0b1755b9
parent 46 bc5a64e5bc3c
equal deleted inserted replaced
64:6aaf0276100e 72:c76a0b1755b9
    47     void cleanupTestCase();
    47     void cleanupTestCase();
    48     void testFirstNameEmpty();
    48     void testFirstNameEmpty();
    49     void testFirstNameNotEmpty();
    49     void testFirstNameNotEmpty();
    50     void testLastNameEmpty();
    50     void testLastNameEmpty();
    51     void testLastNameNotEmpty();
    51     void testLastNameNotEmpty();
       
    52     void testGroupNameEmpty();
       
    53     void testGroupNameNotEmpty();
    52     void testNumberEmpty();
    54     void testNumberEmpty();
    53     void testNumberNotEmpty();
    55     void testNumberNotEmpty();
    54     //void testSeveralFirstNames();
    56     //void testSeveralFirstNames();
    55     //void testEmptyList();
    57     //void testEmptyList();
    56     void testPhoneNumberOverride();
    58     void testPhoneNumberOverride();
   214 
   216 
   215     err = contact.removeDetail(&lastname);
   217     err = contact.removeDetail(&lastname);
   216     err = cm->removeContact(contact.localId());
   218     err = cm->removeContact(contact.localId());
   217     }
   219     }
   218 
   220 
       
   221 void U_CPhCntMatch2::testGroupNameEmpty()
       
   222     {
       
   223     QContact contact;
       
   224     QContactName lastname;
       
   225     lastname.setLastName("");
       
   226     bool err = contact.saveDetail(&lastname); 
       
   227     err = cm->saveContact(&contact);
       
   228     delete mMatch;
       
   229     TRAP_IGNORE( mMatch = CPhCntMatch2::NewL(contact) );
       
   230     mMatchIf = mMatch;
       
   231     Q_ASSERT(mMatchIf->GroupName().Length() == 0);
       
   232 
       
   233     err = contact.removeDetail(&lastname);
       
   234     err = cm->removeContact(contact.localId());
       
   235     }
       
   236 
       
   237 
       
   238 void U_CPhCntMatch2::testGroupNameNotEmpty()
       
   239     {
       
   240     QContact contact;
       
   241     contact.setType(QContactType::TypeGroup);
       
   242     _LIT(KGroupName, "groupname");
       
   243     QContactName groupname;
       
   244     groupname.setCustomLabel("groupname");
       
   245     bool err = contact.saveDetail(&groupname); 
       
   246     err = cm->saveContact(&contact);
       
   247     delete mMatch;
       
   248     TRAP_IGNORE( mMatch = CPhCntMatch2::NewL(contact) );
       
   249     mMatchIf = mMatch;
       
   250     HBufC* buf = NULL;
       
   251     buf = mMatchIf->GroupName().AllocL();
       
   252     QString qBuf((QChar*)buf->Ptr(),buf->Length());
       
   253     Q_ASSERT(*buf == KGroupName());
       
   254     delete buf;
       
   255 
       
   256     err = contact.removeDetail(&groupname);
       
   257     err = cm->removeContact(contact.localId());
       
   258     }
       
   259 
   219 void U_CPhCntMatch2::testNumberEmpty()
   260 void U_CPhCntMatch2::testNumberEmpty()
   220     {
   261     {
   221     QContact contact;
   262     QContact contact;
   222     QContactPhoneNumber number;
   263     QContactPhoneNumber number;
   223     number.setNumber("");
   264     number.setNumber("");