// Construction tests // NewL methods are called by NewLC variants so there's no tests for that // LOCAL_C void TestFilterConstructionL() { CCntFilter* filter = CCntFilter::NewLC(); TTime time; time.UniversalTime(); filter->SetFilterDateTime(time); CCntFilter* clone = CCntFilter::NewLC(filter); test(clone->GetFilterDateTime()==time); CleanupStack::PopAndDestroy(2); //filter,clone }
// SetInclude* are exclusive // SetContactFilterType* is cumulative // LOCAL_C void CheckFilterSettingsL(TBool aSetting) { CCntFilter* filter = CCntFilter::NewLC(); filter->Reset(); filter->SetIncludeModifiedContacts(aSetting); if (aSetting) { test(filter->IncludeModifiedContacts()); test(!filter->IncludeNewContacts()); test(!filter->IncludeDeletedContacts()); } filter->SetIncludeNewContacts(aSetting); if (aSetting) { test(filter->IncludeNewContacts()); test(!filter->IncludeModifiedContacts()); test(!filter->IncludeDeletedContacts()); } filter->SetIncludeDeletedContacts(aSetting); if (aSetting) { test(filter->IncludeDeletedContacts()); test(!filter->IncludeModifiedContacts()); test(!filter->IncludeNewContacts()); } filter->SetContactFilterTypeCard(aSetting); filter->SetContactFilterTypeGroup(aSetting); filter->SetContactFilterTypeTemplate(aSetting); filter->SetContactFilterTypeOwnCard(aSetting); if (aSetting) { test(filter->ContactFilterTypeGroup()); test(filter->ContactFilterTypeCard()); test(filter->ContactFilterTypeTemplate()); test(filter->ContactFilterTypeOwnCard()); } else { test(!filter->ContactFilterTypeGroup()); test(!filter->ContactFilterTypeCard()); test(!filter->ContactFilterTypeTemplate()); test(!filter->ContactFilterTypeOwnCard()); } filter->SetContactFilterTypeALL(aSetting); if (aSetting) { test(filter->ContactFilterTypeALL()); test(filter->ContactFilterTypeGroup()); test(filter->ContactFilterTypeCard()); test(filter->ContactFilterTypeTemplate()); test(filter->ContactFilterTypeOwnCard()); } TTime time; time.UniversalTime(); filter->SetFilterDateTime(time); test(filter->GetFilterDateTime()==time); CleanupStack::PopAndDestroy(filter); }