本文整理汇总了C++中CContactIdArray::Count方法的典型用法代码示例。如果您正苦于以下问题:C++ CContactIdArray::Count方法的具体用法?C++ CContactIdArray::Count怎么用?C++ CContactIdArray::Count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CContactIdArray
的用法示例。
在下文中一共展示了CContactIdArray::Count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestFindLC
//===============================================================================================
// SEARCHING entries
//===============================================================================================
void TestFindLC(CContactDatabase& aDb, TContactItemId aIccId, TContactItemId aNonIccId)
{
test.Next(_L("Test FindLC"));
// Successful find of icc entry
CContactItemFieldDef* fieldDef=new(ELeave) CContactItemFieldDef;
CleanupStack::PushL(fieldDef);
fieldDef->AppendL(KUidContactFieldFamilyName);
syncChecker->ResetMethodCallCountsL();
CContactIdArray* array = aDb.FindLC(KIccName,fieldDef);
test(syncChecker->ValidateMethodCallCountL() == 1);
test(array!=NULL);
test(array->Count() == 1);
test((*array)[0]==aIccId);
CleanupStack::PopAndDestroy(array);
array=NULL;
test.Next(_L("Test searching when ICC locked"));
// Unsuccessful find of icc entry because icc locked
syncChecker->SetValidateResponseL(MContactSynchroniser::ESearch,KErrLocked);
syncChecker->ResetMethodCallCountsL();
TRAPD(err,array = aDb.FindLC(KIccName,fieldDef));
test(syncChecker->ValidateMethodCallCountL() == 1);
test(err==KErrLocked);
test(array==NULL);
// successful find of non-icc entry, even though icc locked
syncChecker->ResetMethodCallCountsL();
array = aDb.FindLC(KNonIccName,fieldDef);
test(syncChecker->ValidateMethodCallCountL() == 0);
test(array!=NULL);
test(array->Count() == 1);
test((*array)[0]==aNonIccId);
CleanupStack::PopAndDestroy(2,fieldDef); // array, fieldDef
}
示例2: DoCompareCContactIdArray
TBool CPackagerCntComparator::DoCompareCContactIdArray(const CContactIdArray& anArray1, const CContactIdArray& anArray2) const
/** Compares two CContactIdArray items.
@param anArray1 The first CContactIdArray to be compared.
@param anArray2 The second CContactIdArray to be compared.
@return ETrue if the two items are equal, EFalse otherwise. */
{// Need to check for NULL arrays first.
if((!&anArray1) && (!&anArray2))
{
return ETrue;
}
if((!&anArray1) || (!&anArray2))
{
return EFalse;
}
// Check if arrays are same length to begin with.
TInt maxCount = anArray1.Count();
if(!DoCompareTInt(maxCount, anArray2.Count()))
{
return EFalse;
}
for(TInt i=0; i<maxCount; ++i)
{
if(!DoCompareTContactItemId(anArray1[i], anArray2[i]))
{
return EFalse;
}
}
return ETrue;
}
示例3: TestFindInTextDefLC
void TestFindInTextDefLC(CContactDatabase& aDb, TContactItemId aIccId, TContactItemId aNonIccId)
{
test.Next(_L("Test FindInTextDefLC"));
// Successful find of icc entry
syncChecker->SetValidateResponseL(MContactSynchroniser::ESearch,KErrNone);
syncChecker->SetValidateResponseL(MContactSynchroniser::ERead,KErrNone);
TCallBack callBack(findWordSplitterL);
CContactTextDef* textDef=CContactTextDef::NewLC();
textDef->AppendL(TContactTextDefItem(KUidContactFieldFamilyName));
CDesCArray* desArray = new(ELeave) CDesCArrayFlat(5);
desArray->AppendL(_L("icc"));
syncChecker->ResetMethodCallCountsL();
CContactIdArray* array = aDb.FindInTextDefLC(*desArray,textDef,callBack);
//test(syncChecker->ValidateMethodCallCountL() == 3);
test(array!=NULL);
test(array->Count() == 1);
test((*array)[0]==aIccId);
CleanupStack::PopAndDestroy(array);
array=NULL;
test.Next(_L("Test searching when ICC locked"));
// Unsuccessful find of icc entry because icc locked
syncChecker->SetValidateResponseL(MContactSynchroniser::ESearch,KErrLocked);
syncChecker->ResetMethodCallCountsL();
TRAPD(err,array = aDb.FindInTextDefLC(*desArray,textDef,callBack));
test(syncChecker->ValidateMethodCallCountL() == 1);
test(err==KErrLocked);
test(array==NULL);
desArray->Delete(0);
delete desArray;
// successful find of non-icc entry, even though icc locked
CDesCArray* desArray2 = new(ELeave) CDesCArrayFlat(5);
desArray2->AppendL(_L("non-icc"));
syncChecker->ResetMethodCallCountsL();
array = aDb.FindInTextDefLC(*desArray2,textDef,callBack);
test(syncChecker->ValidateMethodCallCountL() == 0);
test(array!=NULL);
test(array->Count() == 1);
test((*array)[0]==aNonIccId);
// both the icc and non-icc entry should match the search criteria, but only the
// non-icc entry should be returned since icc is locked
SetNameField(aDb,aIccId,KNonIccName);
syncChecker->ResetMethodCallCountsL();
TRAP(err,array = aDb.FindInTextDefLC(*desArray2,textDef,callBack));
test(syncChecker->ValidateMethodCallCountL() == 1);
test(err==KErrLocked);
test(array!=NULL);
test(array->Count() == 1);
test((*array)[0]==aNonIccId);
desArray2->Delete(0);
delete desArray2;
SetNameField(aDb,aIccId,KIccName);
CleanupStack::PopAndDestroy(2,textDef); // array, textDef
}
示例4: MatchPhoneNumberL
TLogContactItemId CCntMatchLog::MatchPhoneNumberL(const TDesC& aNumber, TInt aMatchLengthFromRight)
/** Attempts to find a contact item ID for the contact items which contains
the specified telephone number in a telephone, fax or SMS type field.
If more than one contact item contains the telephone number this should be
treated the same as no contact found.
@capability ReadUserData
@param aNumber Phone number string
@param aMatchLengthFromRight Number of digits from the right of the phone number to use
@return The contact Id found that contains the phone number. KLogNullContactId if none or more than one is found. */
{
CContactIdArray* array = NULL;
TLogContactItemId contactId=KLogNullContactId;
array = iContactDb->MatchPhoneNumberL(aNumber, aMatchLengthFromRight);
// Only set contactId if we have exactly one match
if (array->Count() == 1)
{
// we have only one match so set the contact id
contactId = static_cast<TLogContactItemId>((*array)[0]);
}
delete array;
return contactId;
}
示例5: TestPhoneMatchingL
void TestPhoneMatchingL(CContactDatabase& aDb)
{
test.Next(_L("Test phone match"));
CContactIdArray* array = aDb.MatchPhoneNumberL(KTelephoneNum,KMaxPhoneMatchLength);
test(array->Count() == 4);
delete array;
syncChecker->SetValidateResponseL(MContactSynchroniser::ERead,KErrNone);
syncChecker->SetValidateResponseL(MContactSynchroniser::EEdit, KErrNone);
syncChecker->SetValidateWriteResponseL(KErrNone);
aDb.SetDbViewContactType(KUidContactICCEntry);
TContactItemId id = (*aDb.SortedItemsL())[0];
CContactItem* item = aDb.OpenContactLX(id);
CleanupStack::PushL(item);
CContactItemFieldSet& fieldset = item->CardFields();
const TInt pos = fieldset.Find(KUidContactFieldPhoneNumber);
CContactItemField& field = fieldset[pos];
CContactTextField* textfield = field.TextStorage();
textfield->SetTextL(KTelephoneNumModified);
aDb.CommitContactL(*item);
CleanupStack::PopAndDestroy(2); //item, lock record
CContactIdArray* array2 = aDb.MatchPhoneNumberL(KTelephoneNumModified,KMaxPhoneMatchLength);
test(array2->Count() == 1);
delete array2;
}
示例6: CommonIdArrayTestsL
LOCAL_C void CommonIdArrayTestsL(CContactIdArray& aIds,TInt aId)
{
TInt index=aIds.Find(aId);
test(index!=KErrNotFound);
for (TInt ii=0;ii<5;ii++)
{
aIds.MoveL(index,ii);
test(aIds.Count()==5);
const TInt newPos=aIds.Find(aId);
test(newPos==ii);
aIds.MoveL(newPos,index);
test(aIds.Count()==5);
test(aIds.Find(aId)==index);
}
aIds.Remove(index);
test(aIds.Count()==4);
aIds.InsertL(index,aId);
test(aIds.Count()==5);
test(aIds.Find(aId)==index);
test(aIds[index]==aId);
}
示例7: TestMatchPhoneNumberL
void TestMatchPhoneNumberL(CContactDatabase& aDb, TContactItemId aIccId, TContactItemId aNonIccId)
{
// The synchroniser is not called to validate the IDs at for this method because
// phone number resolution needs to be as quick as possible.
// Instead, validation is done when the client attempts to read the items.
test.Next(_L("Test MatchPhoneNumberL"));
// Successful find of icc entry phone number
syncChecker->ResetMethodCallCountsL();
CContactIdArray* array = aDb.MatchPhoneNumberL(KIccNumber,KMaxPhoneMatchLength);
test(syncChecker->ValidateMethodCallCountL() == 0);
test(array!=NULL);
test(array->Count() == 1);
test((*array)[0]==aIccId);
delete array;
array=NULL;
test.Next(_L("Test searching when ICC locked"));
// successful find when icc locked - validation done when entry read
syncChecker->SetValidateResponseL(MContactSynchroniser::ESearch,KErrLocked);
syncChecker->ResetMethodCallCountsL();
TRAPD(err,array = aDb.MatchPhoneNumberL(KIccNumber,KMaxPhoneMatchLength));
test(syncChecker->ValidateMethodCallCountL() == 0);
test(array!=NULL);
test(err==KErrNone);
test((*array)[0]==aIccId);
delete array;
array=NULL;
syncChecker->ResetMethodCallCountsL();
array = aDb.MatchPhoneNumberL(KNonIccNumber,KMaxPhoneMatchLength);
test(syncChecker->ValidateMethodCallCountL() == 0);
test(array!=NULL);
test(array->Count() == 1);
test((*array)[0]==aNonIccId);
delete array;
array=NULL;
}
示例8: CreateHashL
// -----------------------------------------------------------------------------
// TSnapshotItem::CreateHashL
// Create hash value from group content
// -----------------------------------------------------------------------------
void TSnapshotItem::CreateHashL( CContactGroup& aGroup )
{
CMessageDigest* hash = CMessageDigestFactory::NewDigestLC( CMessageDigest::EMD5 );
if ( aGroup.HasItemLabelField() )
{
TPtrC label = aGroup.GetGroupLabelL();
HBufC8* tempBuf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( label );
CleanupStack::PushL( tempBuf );
hash->Update( tempBuf->Des() );
CleanupStack::PopAndDestroy( tempBuf );
}
// Create text field from items on group
CContactIdArray* contactsIdArray = aGroup.ItemsContainedLC();
const TInt idBufferMaxSize( 400 );
HBufC8* tempIdBuf = HBufC8::NewLC( idBufferMaxSize );
TPtr8 tempId = tempIdBuf->Des();
const TInt KMaxNumLength(5);
if ( contactsIdArray ) // this is NULL if there are no objects
{
tempId.AppendNum( contactsIdArray->Count(), EHex );
for (TInt i=0; i< contactsIdArray->Count(); i++ )
{
if ( tempId.Length()+KMaxNumLength > tempId.MaxLength() )
{
// buffer is almost full, don't add any new items
LOGGER_WRITE("buffer full");
break;
}
// add item id
tempId.AppendNum( (*contactsIdArray)[i] , EHex );
}
}
else
{
tempId.AppendNum( 0 );
}
// update hash
hash->Update( tempId );
iHash.Copy( hash->Final() );
CleanupStack::PopAndDestroy( tempIdBuf );
CleanupStack::PopAndDestroy( contactsIdArray );
CleanupStack::PopAndDestroy( hash );
}
示例9: GetContactIdsL
/**
Convert between view indexes and contact ids.
This method makes the request to the server.
@capability ReadUserData
*/
void RContactRemoteView::GetContactIdsL(const CArrayFix<TInt>& aIndexes, CContactIdArray& aContactIds)
{
CBufBase* buffer = CBufFlat::NewL(32);
CleanupStack::PushL(buffer);
RBufWriteStream writeStream(*buffer);
CleanupClosePushL(writeStream);
const TInt count = aIndexes.Count();
writeStream.WriteUint32L(count);
for (TInt i=0; i<count; ++i)
{
writeStream.WriteUint32L(aIndexes[i]);
}
writeStream.CommitL();
CleanupStack::PopAndDestroy(&writeStream); //writeStream.Close()
TPtr8 indexes(buffer->Ptr(0));
const TInt bufferSize = buffer->Size();
TPckg<TInt> size(bufferSize);
HBufC8* buf=HBufC8::NewLC(bufferSize);
TPtr8 ids(buf->Des());
TIpcArgs args(&size, &indexes, &ids);
User::LeaveIfError(SendReceive(ECntGetContactIds,args));
RDesReadStream readStream(ids);
CleanupClosePushL(readStream);
CContactIdArray* array = CContactIdArray::NewLC();
readStream >> *array;
const TInt arrayCount = array->Count();
for(TInt loop=0;loop<arrayCount;loop++)
aContactIds.AddL((*array)[loop]);
CleanupStack::PopAndDestroy(4,buffer); //array, &readStream, buf, buffer
}
示例10: CreateTestContactsL
void CTestResources::CreateTestContactsL()
{
const TInt KContacts = 4;
TInt i;
iContacts = CContactIdArray::NewL();
// Create contacts
for (i=1; i <= KContacts; ++i)
{
CContactCard* card = CContactCard::NewLC();
CContactItemField* field = CContactItemField::NewLC(KStorageTypeText, KUidContactFieldFamilyName);
TBuf<30> name;
name.Format(_L("Contact%02d"), i);
field->TextStorage()->SetTextL(name);
card->AddFieldL(*field);
CleanupStack::Pop(field);
const TContactItemId contactId = iDb->AddNewContactL(*card);
iContacts->AddL(contactId);
CleanupStack::PopAndDestroy(card);
// Eat away contact db events
TContactDbObserverEvent event;
test(iDbEventQueue->ListenForEvent(10,event));
}
// Create a group
CContactItem* group = iDb->CreateContactGroupLC(_L("TestGroup"));
iGroupId = group->Id();
CleanupStack::PopAndDestroy(group);
// Connect half of the contacts to the group
for (i=0; i < iContacts->Count(); ++i)
{
if (i%2 == 0)
{
iDb->AddContactToGroupL((*iContacts)[i], iGroupId);
}
}
}
示例11: CheckFoundL
void CTestResources::CheckFoundL(TInt i)
{
if(i<0 || i>GNumberOfFieldNames)
{
User::Leave(KErrNotSupported);
}
iFindFields->Reset();
if(i==GNumberOfFieldNames)
{
for(TInt k =0; k<i; k++)
{
iFindFields->AppendL(TUid::Uid(GFieldNames[k]));
}
}
else
{
iFindFields->AppendL(TUid::Uid(GFieldNames[i]));
}
CContactIdArray* ids = iDb->FindLC(KStringToFind, iFindFields);
TInt count = ids->Count();
test(count == GNumberOfFinds[i]);
CleanupStack::PopAndDestroy(ids);
}
示例12: HandleContactViewEvent
void CFilteredViewTester::HandleContactViewEvent(const CContactViewBase& aView, const TContactViewEvent& aEvent)
{
switch (aEvent.iEventType)
{
case TContactViewEvent::EReady:
{
if (&aView == iBaseView)
{
iBaseReady = ETrue;
}
else if (&aView == iFilteredView)
{
iFilteredReady = ETrue;
}
if (iFilteredReady && iBaseReady && iState == ECreateView)
{
iState = EAddContacts;
TRAPD(err, NextTestStepL() );
test(err == KErrNone);
}
break;
}
case TContactViewEvent::EItemAdded:
{
if (&aView == iBaseView)
{
test.Printf(_L("Add event received: Base view\r\n"));
iBaseContactsCount++;
}
else if (&aView == iFilteredView)
{
iPosition.AppendL(aEvent.iInt);
test.Printf(_L("Add event received: Filtered view\r\n"));
iFilteredContactsCount++;
}
if (iBaseContactsCount == KNumOfContacts && iFilteredContactsCount == KNumOfContacts && iState == EAddContacts)
{
iState = EDeleteContacts;
NextTestStepL();
}
break;
}
case TContactViewEvent::EItemRemoved:
{
if (&aView == iBaseView)
{
test.Printf(_L("Remove event received: Base view\r\n"));
iBaseContactsCount--;
}
else if (&aView == iFilteredView)
{
test.Printf(_L("Remove event received: Filtered view\r\n"));
iFilteredContactsCount--;
//Verify that deleted contact is the one present in the event received.
//The order is not important.
TBool found = EFalse;
TInt count = iIdArray->Count();
for(TInt loop = 0; loop < count;++loop)
{
if(aEvent.iContactId == (*iIdArray)[loop])
{
found = ETrue;
break;
}
}
test(found);
//test that the underlying position is within the range of total number of contacts.
found = EFalse;
count = iPosition.Count();
for(TInt loop = 0; loop < count;++loop)
{
if(aEvent.iInt == iPosition[loop])
{
found = ETrue;
break;
}
}
test(found);
}
if (iBaseContactsCount == 0 && iFilteredContactsCount == 0 && iState == EDeleteContacts)
{
iState = ETestComplete;
NextTestStepL();
}
break;
}
default:
{
// do nothing...
break;
}
}
}
示例13: ExportContactsL
void CTestContactsPBAPExport::ExportContactsL()
{
TInt err = KErrNone;
// Retrieve the file name to which contact item is to be exported
RFs fsSession;
RFileWriteStream writeStream;
// connect to file system
User::LeaveIfError(fsSession.Connect());
CleanupClosePushL(fsSession);
GetInputFromIni();
// Makes one or more directories.
fsSession.MkDirAll(iExportTo);
// Replaces a single file with another
User::LeaveIfError(writeStream.Replace(fsSession, iExportTo, EFileWrite));
INFO_PRINTF1(_L("Exporting Contact....."));
// Existing database
TPtrC databaseFile(_L("C:contactDb.cdb"));
CContactDatabase* dBase = NULL;
CContactIdArray* idArray = NULL;
// Open the existing database
dBase = CContactDatabase::OpenL(databaseFile);
CleanupStack::PushL(dBase);
// Create Utility class object, to export the contact from database
CTestStep* self = static_cast<CTestStep*>(this);
iExportObj = new(ELeave) CContactsPBAPExportUtilityClass(self);
SetFilterL();
CCntFilter* exportFilter = CCntFilter::NewL();
CleanupStack::PushL(exportFilter);
// Get all the contacts from the database to export
exportFilter->SetContactFilterTypeCard(ETrue);
dBase->FilterDatabaseL(*exportFilter);
idArray = exportFilter->iIds;
CleanupStack::PushL(idArray);
if(iDamageDb)
{
#ifdef _DEBUG
#ifndef __SYMBIAN_CNTMODEL_USE_SQLITE__
TRAPD(err1,dBase->DamageDatabaseL(0x666));
if(err1 == KErrNone)
{
TRAPD(err,iExportObj->ExportvCardL(dBase, iStandard, idArray, writeStream, iContactFilter));
INFO_PRINTF2(_L("Err:%d"),err);
if(err == KErrNotReady)
{
SetTestStepResult(EPass);
}
else
{
SetTestStepResult(EFail);
}
if(dBase->IsDamaged())
{
dBase->RecoverL();
}
}
else
{
INFO_PRINTF2(_L("Could not damage database Err:"),err1);
}
#else
SetTestStepResult(EPass);
#endif
#endif
}
else
{
if(iInvalidFileSystem)
{
#ifdef _DEBUG
fsSession.SetErrorCondition(KErrNotReady);
TRAPD(err,iExportObj->ExportvCardL(dBase, iStandard, idArray, writeStream, iContactFilter));
if(err == KErrNotReady)
{
SetTestStepResult(EPass);
}
else
{
SetTestStepResult(EFail);
}
fsSession.SetErrorCondition(KErrNone);
#endif
}
else
{
if(!iSetOOM)
{
if(idArray->Count() > 0)
//.........这里部分代码省略.........
示例14: HandleContactViewEvent
//.........这里部分代码省略.........
test.Printf(_L("ESortError\n"));
break;
case TContactViewEvent::EServerError:
test.Printf(_L("EServerError\n"));
break;
case TContactViewEvent::EIndexingError:
test.Printf(_L("EIndexingError\n"));
break;
case TContactViewEvent::EItemAdded:
test.Printf(_L("EItemAdded\n"));
break;
case TContactViewEvent::EItemRemoved:
test.Printf(_L("EItemRemoved\n"));
break;
case TContactViewEvent::EGroupChanged:
test.Printf(_L("EGroupChanged\n"));
break;
default:
test.Printf(_L("Er, none of the known event types... "));
break;
}
////////////////////////////////////////////////////////////////////////////////////////////
switch (iCurrentTest)
{
case ECreateLocalView:
test(iLocalView==&aView);
test(aEvent.iEventType==TContactViewEvent::EReady);
break;
case EExerciseLocalView:
test(ETrue);
break;
case ECreateGroupOneView:
test(iGroupViewOne==&aView);
test(aEvent.iEventType==TContactViewEvent::EReady);
break;
case ETestGroupOneView:
test(EFalse);
break;
case ECreateGroupOneViewByName:
test(iGroupViewOneByName==&aView);
test(aEvent.iEventType==TContactViewEvent::EReady);
break;
case ETestGroupOneViewByName:
test(EFalse);
break;
case ECreateGroupOneViewNotInGroup:
test(iGroupViewOneNotInGroup==&aView);
test(aEvent.iEventType==TContactViewEvent::EReady);
break;
case ETestGroupOneViewNotInGroup:
test(EFalse);
break;
case EAllViewsOutOfBoundsAccess:
test(EFalse);
break;
case ECreateUnfiledGroupView:
test(iGroupViewUnfiled==&aView);
test(aEvent.iEventType==TContactViewEvent::EReady);
break;
case ETestUnfiledGroupView:
break;
case ETestUnfiledGroupAddition:
{
// No point testing for each and every notification: the test will
// pass for all notifications.
if (iNumNotificationExpected > 1)
{
break;
}
// Test that adding contact which formed part of iGroupViewUnfiled
// to iGroupOne caused update of iGroupViewUnfiled such that the
// contact no longer forms part of iGroupViewUnfiled (i.e. by adding
// the contact to the group it is no longer unfiled is not a member
// of the unfiled view).
TInt ret(KErrNone);
TRAPD(err1, ret = iGroupViewUnfiled->FindL(KNumContacts) );
test(err1 == KErrNone && ret == KErrNotFound);
// Double check - make sure the number of items in the unfiled
// group view agrees with the number of unfiled items reported by
// the database.
TInt groupViewUnfiledCount(0);
TRAPD(err2, groupViewUnfiledCount = iGroupViewUnfiled->CountL() );
CContactIdArray* dbUnfiled = NULL;
TRAPD(err3, dbUnfiled = iDb.UnfiledContactsL() );
test(err2 == KErrNone && err3 == KErrNone && groupViewUnfiledCount==dbUnfiled->Count() );
delete dbUnfiled;
}
break;
case ENumTests:
default:
test(EFalse);
break;
}
if (--iNumNotificationExpected <= 0)
{
iNumNotificationExpected=0;
NextTest();
}
}
示例15: RunL
void CGroupViewTester::RunL()
{
switch (iCurrentTest)
{
case ECreateLocalView:
iLog.LogLine(_L("=== Create local view"));
iLocalView=CContactLocalView::NewL(*this,iDb,iSortOrder_1,EContactAndGroups/*EContactsOnly*/);
break;
case EExerciseLocalView:
iLog.LogLine(_L("=== Exercise local view"));
ExceriseViewL(*iLocalView);
NextTest();
break;
case ECreateGroupOneView:
{
iLog.LogLine(_L("=== GroupOneView"));
iGroupViewOne=CContactGroupView::NewL(iDb,*iLocalView,*this,iGroupOne->Id(),CContactGroupView::EShowContactsInGroup);
}
break;
case ETestGroupOneView:
{
iLog.LogLine(_L("==== Exercise ETestGroupOneView"));
TInt groupCount = iGroupOne->ItemsContained()->Count();
test(iGroupViewOne->CountL()==groupCount);
const CContactIdArray* array= iGroupOne->ItemsContained();
for (TInt ii=0;ii<groupCount;ii++)
{
test(iGroupViewOne->FindL((*array)[ii])!=KErrNotFound);
}
TestGroupViewSortOrderL(*iGroupViewOne);
NextTest();
}
break;
case ECreateGroupOneViewByName:
{
iLog.LogLine(_L("=== Create GroupOneView By Name"));
iGroupViewOneByName=CContactGroupView::NewL(iDb,*iLocalView,*this,KGroupOneName,CContactGroupView::EShowContactsInGroup);
}
break;
case ETestGroupOneViewByName:
{
iLog.LogLine(_L("==== Exercise ETestGroupOneView By Name"));
TInt groupCount = iGroupOne->ItemsContained()->Count();
test(iGroupViewOneByName->CountL()==groupCount);
const CContactIdArray* array= iGroupOne->ItemsContained();
for (TInt ii=0;ii<groupCount;ii++)
{
test(iGroupViewOneByName->FindL((*array)[ii])!=KErrNotFound);
}
TestGroupViewSortOrderL(*iGroupViewOneByName);
NextTest();
break;
}
case ECreateGroupOneViewNotInGroup:
{
iLog.LogLine(_L("=== Create GroupOneViewNotInGroup By Name"));
iGroupViewOneNotInGroup=CContactGroupView::NewL(iDb,*iLocalView,*this,KGroupOneName,CContactGroupView::EShowContactsNotInGroup);
}
break;
case ETestGroupOneViewNotInGroup:
{
iLog.LogLine(_L("==== Exercise GroupOneViewNotInGroup By Name"));
TInt totalContacts = iLocalView->CountL();
TInt totalNotInGroup = totalContacts - KNumContactsInGroupOne;
test(iGroupViewOneNotInGroup->CountL()==totalNotInGroup);
const CContactIdArray* array= iGroupOne->ItemsContained();
TInt groupCount = array->Count();
for (TInt ii=0;ii<groupCount;ii++)
{
test(iGroupViewOneNotInGroup->FindL((*array)[ii])==KErrNotFound);
}
TestGroupViewSortOrderL(*iGroupViewOneNotInGroup);
NextTest();
break;
}
case EAllViewsOutOfBoundsAccess:
{
//Views depend on their underlying views being in a good state, however
//as some base views are potentially in other processes they must be resistant
//to out of date views accessesing out of bound members, views, should not
//panic but should leave with KErrNotFound;
//local view
TInt err=0;
iLog.LogLine(_L("=== Test views for out of bounds access"));
TInt outCount = iGroupViewOneByName->CountL();
TRAP(err,iGroupViewOneByName->AtL(outCount));
test(err==KErrNotFound);
TRAP(err,iGroupViewOneByName->ContactAtL(outCount));
test(err==KErrNotFound);
NextTest();
}
break;
case ECreateUnfiledGroupView:
{
iLog.LogLine(_L("=== Create Unfiled group view"));
iGroupViewUnfiled=CContactGroupView::NewL(iDb,*iLocalView,*this,KNullContactId,CContactGroupView::EShowContactsNotInAnyGroup);
}
break;
case ETestUnfiledGroupView:
{
//.........这里部分代码省略.........