46
46
void testLateSearch();
47
47
void testAddressableFields();
48
48
void testExtendedFieldMatch();
49
void testSimilarPhoneNumbers();
51
52
QContact createContact(const QString &firstName,
474
475
QCOMPARE(watcher.contactId(), contact.id().toString());
478
void ContactWatcherTest::testSimilarPhoneNumbers()
480
QString contactIdentifierA("+352 661 123456");
481
QString contactIdentifierB("+352 691 123456");
482
QContact contactA = createContact("FirstName",
485
QStringList() << contactIdentifierA,
486
QList<int>() << 0 << 1 << 2,
487
QList<int>() << 3 << 4 << 5);
488
QContact contactB = createContact("FirstName",
491
QStringList() << contactIdentifierB,
492
QList<int>() << 0 << 1 << 2,
493
QList<int>() << 3 << 4 << 5);
494
ContactWatcher watcherA;
495
QSignalSpy contactIdSpyA(&watcherA, SIGNAL(contactIdChanged()));
497
// try to match contact A
498
watcherA.setIdentifier(contactIdentifierA);
501
watcherA.componentComplete();
503
// signal will be fired now
504
QTRY_COMPARE(contactIdSpyA.count(), 1);
506
QCOMPARE(watcherA.contactId(), contactA.id().toString());
508
ContactWatcher watcherB;
509
QSignalSpy contactIdSpyB(&watcherB, SIGNAL(contactIdChanged()));
512
watcherB.componentComplete();
514
// try to match contact B
515
watcherB.setIdentifier(contactIdentifierB);
517
// signal will be fired now
518
QTRY_COMPARE(contactIdSpyB.count(), 1);
520
QCOMPARE(watcherB.contactId(), contactB.id().toString());
477
523
QContact ContactWatcherTest::createContact(const QString &firstName,
478
524
const QString &lastName,
479
525
const QString &avatarUrl,