/** create local view with sortorder containing all (existing) uids, database contains 10 contacts with a fieldset containing no fields. */ void CContactViewTest::EmptyFieldsetTestL() { ALLPRINT(KTest5); ClosePersistanceL(EFalse); ResetDatabaseL(); TInt i; for(i = 0; i < iContacts; ++i) { const TContactItemId cid = iIterate->NextL(); OpenL(cid, *iViewAll); iFields->Reset(); CommitL(); } TInt length = iExistingUidsArray->Count(); ResetSortL(); for(i = 0 ; i < length ; ++i) { iSortOrder->AppendL( TUid::Uid( (*iExistingUidsArray)[i] ) ); } OpenPersistanceL(); iObserver->SetView( CreateViewL() ); iObserver->iMainFunc = NULL; iObserver->iDoFunc = &CContactViewTest::doEmptyFieldsetTestL; }
EXPORT_C void CEikTextListBox::ConstructFromResourceL(TResourceReader& aReader) { _AKNTRACE_FUNC_ENTER; RestoreCommonListBoxPropertiesL(aReader); iRequiredCellCharWidth = aReader.ReadInt16(); TInt array_id = aReader.ReadInt32(); if (array_id) { CDesCArray* desArray = iCoeEnv->ReadDesCArrayResourceL(array_id); CleanupStack::PushL(desArray); iModel = new(ELeave) CTextListBoxModel; ((CTextListBoxModel*)iModel)->ConstructL(desArray); CleanupStack::Pop(); } else { iModel = new(ELeave) CTextListBoxModel; ((CTextListBoxModel*)iModel)->ConstructL(); } CreateItemDrawerL(); ((CTextListItemDrawer*)iItemDrawer)->SetCellWidthInChars(iRequiredCellCharWidth); CreateViewL(); UpdateViewColors(); UpdateItemDrawerColors(); _AKNTRACE_FUNC_EXIT; }
/** create local view with empty sortorder, database is contains ten empty contacts */ void CContactViewTest::AllEmptyTestL() { ALLPRINT(KTest1); ResetSortL(); iObserver->SetView( CreateViewL() ); iObserver->iMainFunc = NULL; iObserver->iDoFunc = &CContactViewTest::doAllEmptyTestL; }
/** Set all fields of all contacts to contain their own label string use empty sort order */ void CContactViewTest::MissingFieldTestL() { ALLPRINT(KTest7); ClosePersistanceL(EFalse); ResetDatabaseL(); for(TInt i = 0; i < iContacts; ++i) { const TContactItemId cid = iIterate->NextL(); OpenL(cid, *iViewAll); SetContactL(); CommitL(); } ResetSortL(); OpenPersistanceL(); iObserver->SetView( CreateViewL() ); iObserver->iMainFunc = NULL; iObserver->iDoFunc = &CContactViewTest::doMissingFieldTestL; }
/** create local view with sortorder containing all (existing) uids, database contains 10 empty contacts */ void CContactViewTest::ContactEmptyTestL() { ALLPRINT(KTest3); ClosePersistanceL(EFalse); ResetDatabaseL(); ResetSortL(); TInt length = iExistingUidsArray->Count(); TInt i = 0; for( ; i < length ; ++i) { iSortOrder->AppendL( TUid::Uid( (*iExistingUidsArray)[i] ) ); } OpenPersistanceL(); iObserver->SetView( CreateViewL() ); iObserver->iMainFunc = NULL; iObserver->iDoFunc = &CContactViewTest::doContactEmptyTestL; }
/** check that a field is generated for each view contact and that field matches list of missing of fields remove generated field from contact item and repopulate contact view repeat until view contact field is null */ void CContactViewTest::doMissingFieldTestL(const CContactViewBase &aLView) { ClosePersistanceL(ETrue); TBool end = ETrue; TInt length = aLView.CountL(); TInt manyfields = 0; TInt i; //iterate through ini file, that stores list of expected field in order const TPtrC mfield = GetNextFieldL(); INTCOMPARE( length , ==, iContacts, 0, 0 ); iIterate->Reset(); for(i = 0; i < length; ++i) { const TInt loc = aLView.FindL(iIterate->NextL()); const CViewContact &vcontact = aLView.ContactAtL( loc ); manyfields = vcontact.FieldCount(); const TPtrC vfield = vcontact.Field(0); INTCOMPARE( manyfields , ==, 1, i, 0 ); //compare view contact field to field stored in ini file STRINGCOMPARE( vfield, ==, mfield, i, 0 ); //if view contact field is null, end test end = end && (vfield == KNullDesC); //find view contact field in contact item and set to null, if field not found, end test end = end || !FindAndClearFieldL( vcontact.Id(), vfield ); } if( end ) { iObserver->iMainFunc = NULL; iObserver->iDoFunc = NULL; iObserver->CleanView(); } else { //if test not complete, reset view and repopulate OpenPersistanceL(); iObserver->CleanView(); iObserver->SetView( CreateViewL() ); } }
/** Delete all fields from all contacts */ void CContactViewTest::EmptyFieldsetSortTestL() { ALLPRINT(KTest6); ClosePersistanceL(EFalse); ResetDatabaseL(); TInt i; for(i = 0; i < iContacts; ++i) { const TContactItemId cid = iIterate->NextL(); OpenL(cid, *iViewAll); //deletes all fields iFields->Reset(); CommitL(); } ResetSortL(); OpenPersistanceL(); iObserver->SetView( CreateViewL() ); iObserver->iMainFunc = NULL; iObserver->iDoFunc = &CContactViewTest::doEmptyFieldsetSortTestL; }
/** populate database with full, medium or empty contacts */ void CContactViewTest::PerformanceTestL() { ClosePersistanceL( EFalse ); ResetDatabaseL(iPerformanceContacts); //populate contacts if( EMedium == iFullness ) { if( EFew == iPerformanceContacts ) { ALLPRINT(KTest81); } TInt i = 0; for(; i < iContacts; ++i) { const TContactItemId cid = iIterate->NextL(); OpenL(cid, *iViewAll); SetMediumL(); CommitL(); } } else if( EFull == iFullness ) { if( EFew == iPerformanceContacts ) { ALLPRINT(KTest82); } TInt i = 0; for(; i < iContacts; ++i) { const TContactItemId cid = iIterate->NextL(); OpenL(cid, *iViewAll); SetFullL(); CommitL(); } } else { if( EFew == iPerformanceContacts ) { ALLPRINT(KTest8); } } /** Print the number of contacts used for this test */ switch( iPerformanceContacts ) { case EFew: { _LIT(KFewContacts,"Few contacts"); ALLPRINT( KFewContacts ); iPerformanceContacts = EMid; break; } case EMid: { _LIT(KMidContacts,"Mid contacts"); ALLPRINT( KMidContacts ); iPerformanceContacts = EMany; break; } case EMany: { _LIT(KManyContacts,"Many contacts"); ALLPRINT( KManyContacts ); iPerformanceContacts = EMax; break; } case EMax: { _LIT(KMaxContacts,"Max contacts"); ALLPRINT( KMaxContacts ); iPerformanceContacts = EDone; break; } default: { _LIT(KInvalidContacts,"bad performance contacts"); User::Panic(KInvalidContacts, 333 ); break; } } _LIT(KStartCompact,"Start Compact"); ALLPRINT( KStartCompact ); iContactsDatabase->CompactL();//to make sure that the server is not busy doing automatic compaction _LIT(KEndCompact,"End Compact"); ALLPRINT( KEndCompact ); //Create sortorder with typical uids ResetSortL(); iSortOrder->AppendL(KUidContactFieldGivenName); iSortOrder->AppendL(KUidContactFieldAdditionalName); iSortOrder->AppendL(KUidContactFieldFamilyName); iSortOrder->AppendL(KUidContactFieldPhoneNumber); OpenPersistanceL(); _LIT(KStartView,"Start view creation"); ALLPRINT( KStartView ); //note time view is created iStartC.UniversalTime(); iObserver->SetView( CreateViewL() ); //note time vie creat is completed iStartP.UniversalTime(); _LIT(KEndView,"End view creation, wait for view to be populated"); ALLPRINT( KEndView ); iObserver->iMainFunc = NULL; iObserver->iDoFunc = &CContactViewTest::doPerformanceTestL; }