Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Improve batch-fetch semantics tests
Ensure that if a contact is requested multiple times in a single
batch, that it still has the appropriate number of details (that is,
without duplicates etc).
  • Loading branch information
Chris Adams authored and chriadam committed Oct 21, 2020
1 parent 239d0d4 commit 8e180aa
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/auto/qcontactmanager/tst_qcontactmanager.cpp
Expand Up @@ -1371,6 +1371,9 @@ void tst_QContactManager::batch()
QCOMPARE(batchFetch.at(0).detail<QContactName>().value(nameField), na.value(nameField));
QCOMPARE(batchFetch.at(1).detail<QContactName>().value(nameField), nb.value(nameField));
QCOMPARE(batchFetch.at(2).detail<QContactName>().value(nameField), nc.value(nameField));
QCOMPARE(batchFetch.at(0).details<QContactPhoneNumber>().count(), 1);
QCOMPARE(batchFetch.at(1).details<QContactPhoneNumber>().count(), 1);
QCOMPARE(batchFetch.at(2).details<QContactPhoneNumber>().count(), 1);

/* Now an empty id */
batchIds.clear();
Expand Down Expand Up @@ -1408,6 +1411,20 @@ void tst_QContactManager::batch()
QCOMPARE(batchFetch.at(4).detail<QContactName>().value(nameField), na.value(nameField));
QCOMPARE(batchFetch.at(5).detail<QContactName>().value(nameField), nb.value(nameField));

QCOMPARE(batchFetch.at(0).details<QContactPhoneNumber>().count(), 1);
QCOMPARE(batchFetch.at(1).details<QContactPhoneNumber>().count(), 1);
QCOMPARE(batchFetch.at(2).details<QContactPhoneNumber>().count(), 1);
QCOMPARE(batchFetch.at(3).details<QContactPhoneNumber>().count(), 1);
QCOMPARE(batchFetch.at(4).details<QContactPhoneNumber>().count(), 1);
QCOMPARE(batchFetch.at(5).details<QContactPhoneNumber>().count(), 1);

QCOMPARE(batchFetch.at(0).details<QContactPhoneNumber>().at(0).number(), QString::fromLatin1("34567"));
QCOMPARE(batchFetch.at(1).details<QContactPhoneNumber>().at(0).number(), QString::fromLatin1("234567"));
QCOMPARE(batchFetch.at(2).details<QContactPhoneNumber>().at(0).number(), QString::fromLatin1("34567"));
QCOMPARE(batchFetch.at(3).details<QContactPhoneNumber>().at(0).number(), QString::fromLatin1("1234567"));
QCOMPARE(batchFetch.at(4).details<QContactPhoneNumber>().at(0).number(), QString::fromLatin1("1234567"));
QCOMPARE(batchFetch.at(5).details<QContactPhoneNumber>().at(0).number(), QString::fromLatin1("234567"));

/* Now delete them all */
QList<QContactId> ids;
ids << ContactId::apiId(a) << ContactId::apiId(b) << ContactId::apiId(c);
Expand Down

0 comments on commit 8e180aa

Please sign in to comment.