summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-06-19 20:53:25 +0200
committerLars Knoll <lars.knoll@qt.io>2020-07-06 21:31:14 +0200
commitdf853fed66d891077ae2d04ecfa171d7e2cd5202 (patch)
treebf29d3718eeee1e17d1640841595de0ba8cda4cf /tests/auto
parent3711bf85ae85c9398642ae276cbd90b5bfaa6688 (diff)
Use qsizetype in QList
The change creates a slight source incompatibility. The main things to take care of are * code using printf statements on list.size(). Using qsizetype in printf statements will always require a cast to work on both 32 and 64 bit. * A few places where overloads now get ambiguous. One example is QRandomGenerator::bounded() that has overloads for int, uint and double, but not int64. * Streaming list.size() to a QDataStream will change the format depending on the architecture. [ChangeLog][QtCore][QList] QList now uses qsizetype to index into elements. Change-Id: Iaff562a4d072b97f458417b670f95971bd47cbc6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp4
-rw-r--r--tests/auto/gui/painting/qregion/tst_qregion.cpp2
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp4
-rw-r--r--tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp24
-rw-r--r--tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp2
-rw-r--r--tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp4
6 files changed, 20 insertions, 20 deletions
diff --git a/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp b/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp
index 0a780d3e46..eb9941868e 100644
--- a/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp
+++ b/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp
@@ -2022,8 +2022,8 @@ void tst_QCborValue::validation_data()
QTest::addRow("very-large-array-overflow2") << raw("\x9b\0\0\0\1""\0\0\0\2" "\0\0") << 0 << CborErrorDataTooLarge;
} else {
// 64-bit Qt 6
- QTest::addRow("very-large-array-no-overflow") << raw("\x9b\x07\xff\xff\xff" "\xff\xff\xff\xff" "\0\0");
- QTest::addRow("very-large-array-overflow") << raw("\x9b\x40\0\0\0" "\0\0\0\0" "\0\0");
+ QTest::addRow("very-large-array-no-overflow") << raw("\x9b\x07\xff\xff\xff" "\xff\xff\xff\xff" "\0\0") << 0 << CborErrorDataTooLarge;
+ QTest::addRow("very-large-array-overflow") << raw("\x9b\x40\0\0\0" "\0\0\0\0" "\0\0") << 0 << CborErrorDataTooLarge;
}
}
diff --git a/tests/auto/gui/painting/qregion/tst_qregion.cpp b/tests/auto/gui/painting/qregion/tst_qregion.cpp
index 92b265197e..93d2baf332 100644
--- a/tests/auto/gui/painting/qregion/tst_qregion.cpp
+++ b/tests/auto/gui/painting/qregion/tst_qregion.cpp
@@ -335,7 +335,7 @@ void tst_QRegion::emptyPolygonRegion()
QTEST(int(std::distance(r.begin(), r.end())), "numRects");
QList<QRect> rects;
std::copy(r.begin(), r.end(), std::back_inserter(rects));
- QTEST(rects.size(), "numRects");
+ QTEST(int(rects.size()), "numRects");
QTEST(rects, "rects");
}
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index aeb5c367da..0868ec04f8 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -4817,8 +4817,8 @@ void tst_QNetworkReply::ioPostToHttpFromSocket()
QCOMPARE(reply->readAll().trimmed(), md5sum(data).toHex());
- QTEST(authenticationRequiredSpy.count(), "authenticationRequiredCount");
- QTEST(proxyAuthenticationRequiredSpy.count(), "proxyAuthenticationRequiredCount");
+ QTEST(int(authenticationRequiredSpy.count()), "authenticationRequiredCount");
+ QTEST(int(proxyAuthenticationRequiredSpy.count()), "proxyAuthenticationRequiredCount");
}
void tst_QNetworkReply::ioPostToHttpFromSocketSynchronous_data()
diff --git a/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp b/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
index df4a138724..f53988908a 100644
--- a/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
+++ b/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
@@ -191,7 +191,7 @@ void tst_QDialogButtonBox::testConstructor3()
QDialogButtonBox buttonBox(buttons, (Qt::Orientation)orientation);
QCOMPARE(int(buttonBox.orientation()), orientation);
- QTEST(buttonBox.buttons().count(), "buttonCount");
+ QTEST(int(buttonBox.buttons().count()), "buttonCount");
}
void tst_QDialogButtonBox::testConstructor4_data()
@@ -226,7 +226,7 @@ void tst_QDialogButtonBox::testConstructor4()
QDialogButtonBox buttonBox(buttons);
QCOMPARE(buttonBox.orientation(), Qt::Horizontal);
- QTEST(buttonBox.buttons().count(), "buttonCount");
+ QTEST(int(buttonBox.buttons().count()), "buttonCount");
}
void tst_QDialogButtonBox::setOrientation_data()
@@ -292,9 +292,9 @@ void tst_QDialogButtonBox::addButton1()
QCOMPARE(buttonBox.buttons().count(), 0);
QPushButton *button = new QPushButton();
buttonBox.addButton(button, role);
- QTEST(buttonBox.buttons().count(), "totalCount");
+ QTEST(int(buttonBox.buttons().count()), "totalCount");
QList<QAbstractButton *> children = buttonBox.findChildren<QAbstractButton *>();
- QTEST(children.count(), "totalCount");
+ QTEST(int(children.count()), "totalCount");
delete button;
}
@@ -319,9 +319,9 @@ void tst_QDialogButtonBox::addButton2()
QDialogButtonBox buttonBox;
QCOMPARE(buttonBox.buttons().count(), 0);
buttonBox.addButton(text, role);
- QTEST(buttonBox.buttons().count(), "totalCount");
+ QTEST(int(buttonBox.buttons().count()), "totalCount");
QList<QAbstractButton *> children = buttonBox.findChildren<QAbstractButton *>();
- QTEST(children.count(), "totalCount");
+ QTEST(int(children.count()), "totalCount");
}
void tst_QDialogButtonBox::addButton3_data()
@@ -346,9 +346,9 @@ void tst_QDialogButtonBox::addButton3()
QDialogButtonBox buttonBox;
QCOMPARE(buttonBox.buttons().count(), 0);
buttonBox.addButton(button);
- QTEST(buttonBox.buttons().count(), "totalCount");
+ QTEST(int(buttonBox.buttons().count()), "totalCount");
QList<QAbstractButton *> children = buttonBox.findChildren<QAbstractButton *>();
- QTEST(children.count(), "totalCount");
+ QTEST(int(children.count()), "totalCount");
}
void tst_QDialogButtonBox::clear_data()
@@ -389,7 +389,7 @@ void tst_QDialogButtonBox::removeButton()
QCOMPARE(buttonBox.buttons().count(), 0);
QPushButton *button = new QPushButton("RemoveButton test");
buttonBox.addButton(button, roleToAdd);
- QTEST(buttonBox.buttons().count(), "expectedCount");
+ QTEST(int(buttonBox.buttons().count()), "expectedCount");
buttonBox.removeButton(button);
QCOMPARE(buttonBox.buttons().count(), 0);
@@ -622,9 +622,9 @@ void tst_QDialogButtonBox::testSignals()
if (clicked2.count() > 0)
QCOMPARE(qvariant_cast<QAbstractButton *>(clicked2.at(0).at(0)), clickMe);
- QTEST(accept.count(), "acceptCount");
- QTEST(reject.count(), "rejectCount");
- QTEST(helpRequested.count(), "helpRequestedCount");
+ QTEST(int(accept.count()), "acceptCount");
+ QTEST(int(reject.count()), "rejectCount");
+ QTEST(int(helpRequested.count()), "helpRequestedCount");
}
void tst_QDialogButtonBox::testSignalOrder()
diff --git a/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp b/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp
index 4fb5d262ca..a164be8712 100644
--- a/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp
+++ b/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp
@@ -391,7 +391,7 @@ void tst_QGroupBox::clicked()
else
QTest::mouseClick(&testWidget, Qt::LeftButton);
- QTEST(spy.count(), "clickedCount");
+ QTEST(int(spy.count()), "clickedCount");
if (spy.count() > 0)
QTEST(spy.at(0).at(0).toBool(), "finalCheck");
QTEST(testWidget.isChecked(), "finalCheck");
diff --git a/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp b/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp
index 1cb6c6831f..502535502d 100644
--- a/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp
+++ b/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp
@@ -247,7 +247,7 @@ void tst_QTabBar::removeTab()
tabbar.setCurrentIndex(currentIndex);
QSignalSpy spy(&tabbar, SIGNAL(currentChanged(int)));
tabbar.removeTab(deleteIndex);
- QTEST(spy.count(), "spyCount");
+ QTEST(int(spy.count()), "spyCount");
QTEST(tabbar.currentIndex(), "finalIndex");
}
@@ -278,7 +278,7 @@ void tst_QTabBar::hideTab()
tabbar.setCurrentIndex(currentIndex);
QSignalSpy spy(&tabbar, &QTabBar::currentChanged);
tabbar.setTabVisible(hideIndex, false);
- QTEST(spy.count(), "spyCount");
+ QTEST(int(spy.count()), "spyCount");
QTEST(tabbar.currentIndex(), "finalIndex");
}