summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
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/widgets
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/widgets')
-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
3 files changed, 15 insertions, 15 deletions
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");
}