diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2014-12-22 21:31:02 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-01-21 11:23:43 +0100 |
commit | 914c5eb36a2515714b90c375449bee060db5f4f5 (patch) | |
tree | 75e573930e59ab4260ff8f14c1509a62e9229982 /tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp | |
parent | b9365aed6a6699e4ae1c1638217565a18ebf6de6 (diff) |
QAssociativeIterable: add find()
This is like value(), but returns an iterator instead of the value().
[ChangeLog][QtCore][QAssociativeIterable] Added find().
Change-Id: I029fc8f91cef78f718d419587a2a50ffd2bf7632
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Diffstat (limited to 'tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp')
-rw-r--r-- | tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index 757576c6da..ddf387ed8d 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -4407,10 +4407,13 @@ void tst_QVariant::iterateContainerElements() QCOMPARE(varMap.value(QString::number(key)).value<MAPPED_TYPE>(), expected); \ QCOMPARE(varHash.value(QString::number(key)).value<MAPPED_TYPE>(), expected); \ QCOMPARE(actual, expected); \ + const QAssociativeIterable::const_iterator it = mappingIter.find(key); \ + QVERIFY(it != mappingIter.end()); \ + QCOMPARE(it.value().value<MAPPED_TYPE>(), expected); \ } \ QCOMPARE(numSeen, (int)std::distance(mapping.begin(), mapping.end())); \ QCOMPARE(containerIter, containerEnd); \ - \ + QVERIFY(mappingIter.find(10) == mappingIter.end()); \ } TEST_ASSOCIATIVE_ITERATION(QHash, int, bool) |