summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qhash
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/tools/qhash')
-rw-r--r--tests/auto/corelib/tools/qhash/tst_qhash.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
index 11e7237ba4..50c2b0d84e 100644
--- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp
+++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
@@ -101,6 +101,8 @@ private slots:
void QTBUG98265();
void detachAndReferences();
+
+ void lookupUsingKeyIterator();
};
struct IdentityTracker {
@@ -2699,5 +2701,20 @@ void tst_QHash::detachAndReferences()
#endif
}
+void tst_QHash::lookupUsingKeyIterator()
+{
+ QHash<QString, QString> hash;
+ hash.reserve(1);
+ qsizetype minCapacity = hash.capacity();
+ // Beholden to internal implementation details:
+ qsizetype rehashLimit = minCapacity == 64 ? 63 : 8;
+
+ for (char16_t c = u'a'; c <= u'a' + rehashLimit; ++c)
+ hash.insert(QString(QChar(c)), u"h"_qs);
+
+ for (auto it = hash.keyBegin(), end = hash.keyEnd(); it != end; ++it)
+ QVERIFY(!hash[*it].isEmpty());
+}
+
QTEST_APPLESS_MAIN(tst_QHash)
#include "tst_qhash.moc"