summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-05-17 09:55:09 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-05-18 17:54:15 +0200
commit042bab072a65f2f3054531ec4f7eb28afbe38e78 (patch)
treebe71505367ac84ea54cb4f9bd5abdec8bd1b473f /tests
parent7b736e1faf1fb6ed69a0a4b53b96ec3a9e9941e8 (diff)
Fix return value of qGlobalPostedEventsCount()
The unsigned return value was very un-Qt-ish, and, indeed, tst_QCoreApplication just stored the result in ints. Port to qsizetype, being the type of the expression that the function calculates. Task-number: QTBUG-103532 Change-Id: I95a81a686439b0686faad7a430adeaab66dc9e8d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
index 93d8198090..8ddca93cb7 100644
--- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
+++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
@@ -520,7 +520,7 @@ class GlobalPostedEventsCountObject : public QObject
Q_OBJECT
public:
- QList<int> globalPostedEventsCount;
+ QList<qsizetype> globalPostedEventsCount;
bool event(QEvent *event) override
{
@@ -537,7 +537,7 @@ void tst_QCoreApplication::globalPostedEventsCount()
TestApplication app(argc, argv);
QCoreApplication::sendPostedEvents();
- QCOMPARE(qGlobalPostedEventsCount(), 0u);
+ QCOMPARE(qGlobalPostedEventsCount(), qsizetype(0));
GlobalPostedEventsCountObject x;
QCoreApplication::postEvent(&x, new QEvent(QEvent::User));
@@ -545,17 +545,12 @@ void tst_QCoreApplication::globalPostedEventsCount()
QCoreApplication::postEvent(&x, new QEvent(QEvent::User));
QCoreApplication::postEvent(&x, new QEvent(QEvent::User));
QCoreApplication::postEvent(&x, new QEvent(QEvent::User));
- QCOMPARE(qGlobalPostedEventsCount(), 5u);
+ QCOMPARE(qGlobalPostedEventsCount(), qsizetype(5));
QCoreApplication::sendPostedEvents();
- QCOMPARE(qGlobalPostedEventsCount(), 0u);
-
- QList<int> expected = QList<int>()
- << 4
- << 3
- << 2
- << 1
- << 0;
+ QCOMPARE(qGlobalPostedEventsCount(), qsizetype(0));
+
+ const QList<qsizetype> expected = {4, 3, 2, 1, 0};
QCOMPARE(x.globalPostedEventsCount, expected);
}
#endif // QT_BUILD_INTERNAL