summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2022-03-20 13:30:39 +0100
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2022-03-24 13:23:16 +0100
commit1fe5ea3f836c3962a5919a48b46275545e008cf6 (patch)
tree90ae2603d7c8e0abb9f68235d339843b21ffe08f /tests
parentc0dbc02680b693bf487770db9c3ad05d10ef6040 (diff)
Fix compiler warnings in tests
Don't mix unsigned and signed types in comparisons. Pick-to: 6.3 Change-Id: Ia4ba9c114177425a21cadc8cafe8179928315a5d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/tools/qhash/tst_qhash.cpp2
-rw-r--r--tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
index 9ed1ce67aa..fac4ac7007 100644
--- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp
+++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
@@ -595,7 +595,7 @@ void tst_QHash::erase_edge_case()
for (qsizetype i = 0; i < numBuckets * 4 && index < 2; ++i) {
const size_t hash = qHash(i, QHashSeed::globalSeed());
const size_t bucketForHash = QHashPrivate::GrowthPolicy::bucketForHash(numBuckets, hash);
- if (bucketForHash == numBuckets - 1)
+ if (qsizetype(bucketForHash) == numBuckets - 1)
keys[index++] = i;
}
QCOMPARE(index, 2); // Sanity check. If this fails then the test needs an update!
diff --git a/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp b/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp
index 937a77ca2c..a24cb25eb4 100644
--- a/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp
+++ b/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp
@@ -709,7 +709,7 @@ void tst_QAbstractButton::buttonPressKeys()
const auto buttonPressKeys = QGuiApplicationPrivate::platformTheme()
->themeHint(QPlatformTheme::ButtonPressKeys)
.value<QList<Qt::Key>>();
- for (int i = 0; i < buttonPressKeys.length(); ++i) {
+ for (uint i = 0; i < buttonPressKeys.length(); ++i) {
QTest::keyClick(testWidget, buttonPressKeys[i]);
QCOMPARE(click_count, i + 1);
}