summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qhash
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-10-26 09:30:49 +0100
committerLars Knoll <lars.knoll@qt.io>2020-11-03 16:28:14 +0100
commitf8c30759d98603908b408464ea6d98413fc81eec (patch)
treeed1f7828c517d9ebafb401fe8955eee45fdc44f1 /tests/auto/corelib/tools/qhash
parenta9c52dbdf47a6a070b84c8d34ae3c0c29a8ac1e8 (diff)
Make the QMultiHash(const QHash &) constructor explicit
And add a QMultiHash::unite(const QHash &) method to avoid a copy of the data when inserting a QHash into a multi hash. Change-Id: I864aa9d2b9b7b2c367c3c4d140a2ce2f5408ae09 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/tools/qhash')
-rw-r--r--tests/auto/corelib/tools/qhash/tst_qhash.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
index d63ed7043e..3174bd60b8 100644
--- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp
+++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
@@ -1320,6 +1320,12 @@ void tst_QHash::qmultihash_specific()
QVERIFY(map1.remove(42,5));
QVERIFY(map2.remove(42,5));
QVERIFY(map1 == map2);
+
+ QHash<int, int> hash;
+ hash.insert(-1, -1);
+ map2.unite(hash);
+ QCOMPARE(map2.count(), 6);
+ QCOMPARE(map2[-1], -1);
}
}