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>
This commit is contained in:
Volker Hilsheimer 2022-03-20 13:30:39 +01:00
parent c0dbc02680
commit 1fe5ea3f83
2 changed files with 2 additions and 2 deletions

View File

@ -595,7 +595,7 @@ void tst_QHash::erase_edge_case()
for (qsizetype i = 0; i < numBuckets * 4 && index < 2; ++i) { for (qsizetype i = 0; i < numBuckets * 4 && index < 2; ++i) {
const size_t hash = qHash(i, QHashSeed::globalSeed()); const size_t hash = qHash(i, QHashSeed::globalSeed());
const size_t bucketForHash = QHashPrivate::GrowthPolicy::bucketForHash(numBuckets, hash); const size_t bucketForHash = QHashPrivate::GrowthPolicy::bucketForHash(numBuckets, hash);
if (bucketForHash == numBuckets - 1) if (qsizetype(bucketForHash) == numBuckets - 1)
keys[index++] = i; keys[index++] = i;
} }
QCOMPARE(index, 2); // Sanity check. If this fails then the test needs an update! QCOMPARE(index, 2); // Sanity check. If this fails then the test needs an update!

View File

@ -709,7 +709,7 @@ void tst_QAbstractButton::buttonPressKeys()
const auto buttonPressKeys = QGuiApplicationPrivate::platformTheme() const auto buttonPressKeys = QGuiApplicationPrivate::platformTheme()
->themeHint(QPlatformTheme::ButtonPressKeys) ->themeHint(QPlatformTheme::ButtonPressKeys)
.value<QList<Qt::Key>>(); .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]); QTest::keyClick(testWidget, buttonPressKeys[i]);
QCOMPARE(click_count, i + 1); QCOMPARE(click_count, i + 1);
} }