void CPersistenceTests::IccL() { CContactSyncChecker::ResetL(); CContactItem* iccEntry = CContactICCEntry::NewL(iCntTestImpl.GetSysTemplate()); PUSH(iccEntry); TCnt theCnt(iccEntry); theCnt[KUidContactFieldGivenName] = _L("Johny"); theCnt[KUidContactFieldFamilyName] = _L("Herbert"); iCntTestImpl.CreateL(*iccEntry); POPD(iccEntry); }
CContactItem* CPackagerCntFactory::doCreateDefaultCContactItemL() const /** Implementation method for constructing a new default CContactItem object. @return a Pointer to the CContactItem object. */ { CPlTestImpl* plCntTestImpl = CPlTestImpl::NewLC(); plCntTestImpl->CreateDatabaseL(nsCntTestImpl::KSecureDBName, ETrue); const CContactTemplate& goldenTemplate = plCntTestImpl->GetSysTemplate();//const_cast<CContactTemplate&>(thePersistenceLayer->ContactProperties().SystemTemplateL());; CContactItem* theItem = CContactCard::NewLC(&goldenTemplate); TCnt theCnt(theItem); theCnt[KUidContactFieldGivenName] = KContactItemGivenName; theCnt[KUidContactFieldFamilyName] = KContactItemFamilyName; theCnt[KUidContactFieldPhoneNumber] & KHome & KVoice & KCell = KContactItemFirstPhoneNumber; theCnt[KUidContactFieldPhoneNumber] & KHome & KVoice & KCell += KContactItemSecondPhoneNumber; theCnt[KUidContactFieldEMail] & KHome = KContactItemFirstEmail; theCnt[KUidContactFieldAddress] & KHome = KContactItemFirstAddress; theCnt[KUidContactFieldLocality] & KHome = KContactItemFirstLocality; theCnt[KUidContactFieldIMAddress] & KHome & KWv = KContactItemIMAddress; theCnt[KUidContactFieldSecondName] = KContactItemSecondName; theCnt[KUidContactFieldCompanyName] = KContactItemCompanyName; theCnt[KUidContactFieldJobTitle] = KContactItemJobTitle; theCnt[KUidContactFieldPhoneNumber] & KWork & KVoice = KContactItemThirdPhoneNumber; theCnt[KUidContactFieldEMail] & KWork = KContactItemSecondEmail; theCnt[KUidContactFieldUrl] & KWork = KContactItemURL; theCnt[KUidContactFieldAddress] & KWork = KContactItemSecondAddress; theCnt[KUidContactFieldLocality] & KWork = KContactItemSecondLocality; theCnt[KUidContactFieldCustom1] = _L("Filterable 1"); theCnt[KUidContactFieldCustom2] = _L("Filterable 2"); theCnt[KUidContactFieldGivenNamePronunciation] = KContactItemGivenNamePronunciation; theCnt[KUidContactFieldFamilyNamePronunciation] = KContactItemFamilyNamePronunciation; theCnt[KUidContactFieldSIPID] & KPoc = KContactItemFirstSIPID; theCnt[KUidContactFieldSIPID] & KSwis = KContactItemSecondSIPID; theCnt[KUidContactFieldSIPID] & KVoip = KContactItemThirdSIPID; CleanupStack::Pop(theItem); CleanupStack::PopAndDestroy(plCntTestImpl); return theItem; }
void CPackagerTests::ContactItemTestL() { CCntPackager* thePackage = CCntPackager::NewL(); CleanupStack::PushL(thePackage); test.Next(_L("ContactItemTestL")); iCntTestImpl.CreateDatabaseL(nsCntTestImpl::KSecureDBName, ETrue); const CContactTemplate& goldenTemplate = iCntTestImpl.GetSysTemplate(); //iTempl = iCntTestImpl.GetSysTemplate(); #ifdef __T_PACKAGER_DUMP_CONTACT__ TESTTRAP(iCntTestImpl.DumpContactL(goldenTemplate, _L("Template"))); #endif CContactItem* card = CContactCard::NewLC(&goldenTemplate); TCnt theCnt(card); theCnt[KUidContactFieldGivenName] = _L("David"); theCnt[KUidContactFieldFamilyName] = _L("Coulthard"); theCnt[KUidContactFieldPhoneNumber] & KHome & KVoice & KCell = _L("mo1 39849342"); theCnt[KUidContactFieldPhoneNumber] & KHome & KVoice & KCell += _L("mo2 34530903495803948503984545"); theCnt[KUidContactFieldEMail] & KHome = _L("home@email"); theCnt[KUidContactFieldAddress] & KHome = _L("Home addresssssss"); theCnt[KUidContactFieldLocality] & KHome = _L("Glazgo"); theCnt[KUidContactFieldIMAddress] & KHome & KWv = _L("wireless@village"); theCnt[KUidContactFieldSecondName] = _L("Second name"); theCnt[KUidContactFieldCompanyName] = _L("McLaren"); theCnt[KUidContactFieldJobTitle] = _L("Driver"); theCnt[KUidContactFieldPhoneNumber] & KWork & KVoice = _L("work Tel 2342"); theCnt[KUidContactFieldEMail] & KWork = _L("work@email"); theCnt[KUidContactFieldUrl] & KWork = _L("sdfsd"); theCnt[KUidContactFieldAddress] & KWork = _L("afas df asd"); theCnt[KUidContactFieldLocality] & KWork = _L("sdfsd"); theCnt[KUidContactFieldCustom1] = _L("Filterable 1"); theCnt[KUidContactFieldCustom2] = _L("Filterable 2"); theCnt[KUidContactFieldGivenNamePronunciation] = _L("first name re"); theCnt[KUidContactFieldFamilyNamePronunciation] = _L("Last name re"); theCnt[KUidContactFieldSIPID] & KPoc = _L("SIP POC"); theCnt[KUidContactFieldSIPID] & KSwis = _L("SIP SWIS"); theCnt[KUidContactFieldSIPID] & KVoip = _L("SIP VOIP"); #ifdef __T_PACKAGER_DUMP_CONTACT__ TESTTRAP(iCntTestImpl.DumpContactL(*card, _L("Before Creation"))); #endif iCntTestImpl.CreateL(*card); // For now, call this to allocate memory for buffer in packager. TPtrC8 theBuffer = thePackage->GetTransmittingBuffer(); TInt err = KErrNoMemory; while(err==KErrNoMemory) { TRAPD(error, (theBuffer.Set(thePackage->PackL(*card)))); err = error; if(error==KErrNoMemory) { thePackage->GetTransmittingBuffer(); } } CContactItem* cntItem = thePackage->UnpackCntItemLC(); // CleanupStack::PushL(cntItem); err = CompareContactItemTestL(cntItem, card); User::LeaveIfError(err); CleanupStack::PopAndDestroy(3, thePackage); // POPD(cntItem); // POPD(card); // POPD(thePackage); }