diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-09-30 14:09:04 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-10-04 07:40:08 +0200 |
commit | df9d882d41b741fef7c5beeddb0abe9d904443d8 (patch) | |
tree | 6f3e90dacad4581b7f1cabe235cca298833a3da4 /tests/auto/gui/kernel | |
parent | 109e088c7c5d0c9325966e88d55fd9f7a58f67ea (diff) |
Port from container.count()/length() to size()
This is semantic patch using ClangTidyTransformator:
auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)
makeRule(cxxMemberCallExpr(on(QtContainerClass),
callee(cxxMethodDecl(hasAnyName({"count", "length"),
parameterCountIs(0))))),
changeTo(cat(access(o, cat("size"), "()"))),
cat("use 'size()' instead of 'count()/length()'"))
a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'.
<classes> are:
// sequential:
"QByteArray",
"QList",
"QQueue",
"QStack",
"QString",
"QVarLengthArray",
"QVector",
// associative:
"QHash",
"QMultiHash",
"QMap",
"QMultiMap",
"QSet",
// Qt has no QMultiSet
Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto/gui/kernel')
6 files changed, 57 insertions, 57 deletions
diff --git a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp index 4163d072e0..ecc821f7b4 100644 --- a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp +++ b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp @@ -170,7 +170,7 @@ void tst_QClipboard::testSignals() QCOMPARE(searchChangedSpy.count(), 0); QCOMPARE(selectionChangedSpy.count(), 0); QCOMPARE(changedSpy.count(), 1); - QCOMPARE(changedSpy.at(0).count(), 1); + QCOMPARE(changedSpy.at(0).size(), 1); QCOMPARE(qvariant_cast<QClipboard::Mode>(changedSpy.at(0).at(0)), QClipboard::Clipboard); changedSpy.clear(); @@ -180,7 +180,7 @@ void tst_QClipboard::testSignals() clipboard->setText(text, QClipboard::Selection); QCOMPARE(selectionChangedSpy.count(), 1); QCOMPARE(changedSpy.count(), 1); - QCOMPARE(changedSpy.at(0).count(), 1); + QCOMPARE(changedSpy.at(0).size(), 1); QCOMPARE(qvariant_cast<QClipboard::Mode>(changedSpy.at(0).at(0)), QClipboard::Selection); } else { QCOMPARE(selectionChangedSpy.count(), 0); @@ -195,7 +195,7 @@ void tst_QClipboard::testSignals() clipboard->setText(text, QClipboard::FindBuffer); QCOMPARE(searchChangedSpy.count(), 1); QCOMPARE(changedSpy.count(), 1); - QCOMPARE(changedSpy.at(0).count(), 1); + QCOMPARE(changedSpy.at(0).size(), 1); QCOMPARE(qvariant_cast<QClipboard::Mode>(changedSpy.at(0).at(0)), QClipboard::FindBuffer); } else { QCOMPARE(searchChangedSpy.count(), 0); diff --git a/tests/auto/gui/kernel/qhighdpi/tst_qhighdpi.cpp b/tests/auto/gui/kernel/qhighdpi/tst_qhighdpi.cpp index 2196724f41..fad3df4daa 100644 --- a/tests/auto/gui/kernel/qhighdpi/tst_qhighdpi.cpp +++ b/tests/auto/gui/kernel/qhighdpi/tst_qhighdpi.cpp @@ -65,7 +65,7 @@ const int standardScreenCount = 3; QJsonArray tst_QHighDpi::createStandardScreens(const QList<qreal> &dpiValues) { - Q_ASSERT(dpiValues.count() == standardScreenCount); + Q_ASSERT(dpiValues.size() == standardScreenCount); // Create row of three screens: screen#0 screen#1 screen#2 return QJsonArray { @@ -361,21 +361,21 @@ void tst_QHighDpi::environment_QT_SCALE_FACTOR_ROUNDING_POLICY() qputenv("QT_SCALE_FACTOR_ROUNDING_POLICY", "PassThrough"); { std::unique_ptr<QGuiApplication> app(createStandardOffscreenApp(dpiValues)); - for (int i = 0; i < dpiValues.count(); ++i) + for (int i = 0; i < dpiValues.size(); ++i) QCOMPARE(app->screens()[i]->devicePixelRatio(), dpiValues[i] / qreal(96)); } qputenv("QT_SCALE_FACTOR_ROUNDING_POLICY", "Round"); { std::unique_ptr<QGuiApplication> app(createStandardOffscreenApp(dpiValues)); - for (int i = 0; i < dpiValues.count(); ++i) + for (int i = 0; i < dpiValues.size(); ++i) QCOMPARE(app->screens()[i]->devicePixelRatio(), qRound(dpiValues[i] / qreal(96))); } qunsetenv("QT_SCALE_FACTOR_ROUNDING_POLICY"); { std::unique_ptr<QGuiApplication> app(createStandardOffscreenApp(dpiValues)); - for (int i = 0; i < dpiValues.count(); ++i) + for (int i = 0; i < dpiValues.size(); ++i) QCOMPARE(app->screens()[i]->devicePixelRatio(), dpiValues[i] / qreal(96)); } } @@ -386,14 +386,14 @@ void tst_QHighDpi::application_setScaleFactorRoundingPolicy() QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::Round); { std::unique_ptr<QGuiApplication> app(createStandardOffscreenApp(dpiValues)); - for (int i = 0; i < dpiValues.count(); ++i) + for (int i = 0; i < dpiValues.size(); ++i) QCOMPARE(app->screens()[i]->devicePixelRatio(), qRound(dpiValues[i] / qreal(96))); } QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); { std::unique_ptr<QGuiApplication> app(createStandardOffscreenApp(dpiValues)); - for (int i = 0; i < dpiValues.count(); ++i) + for (int i = 0; i < dpiValues.size(); ++i) QCOMPARE(app->screens()[i]->devicePixelRatio(), dpiValues[i] / qreal(96)); } @@ -402,7 +402,7 @@ void tst_QHighDpi::application_setScaleFactorRoundingPolicy() qputenv("QT_SCALE_FACTOR_ROUNDING_POLICY", "PassThrough"); { std::unique_ptr<QGuiApplication> app(createStandardOffscreenApp(dpiValues)); - for (int i = 0; i < dpiValues.count(); ++i) + for (int i = 0; i < dpiValues.size(); ++i) QCOMPARE(app->screens()[i]->devicePixelRatio(), dpiValues[i] / qreal(96)); } } @@ -450,7 +450,7 @@ void tst_QHighDpi::screenAt() QFETCH(QList<qreal>, dpiValues); std::unique_ptr<QGuiApplication> app(createStandardOffscreenApp(dpiValues)); - QCOMPARE(app->screens().count(), standardScreenCount); // standard setup + QCOMPARE(app->screens().size(), standardScreenCount); // standard setup // Verify that screenAt() returns the correct or no screen for various points, // for all screens. @@ -459,7 +459,7 @@ void tst_QHighDpi::screenAt() qreal dpi = dpiValues[i++]; // veryfy virtualSiblings and that AA_EnableHighDpiScaling is active - QCOMPARE(screen->virtualSiblings().count(), standardScreenCount); + QCOMPARE(screen->virtualSiblings().size(), standardScreenCount); QCOMPARE(screen->geometry().size(), QSize(standardScreenWidth, standardScreenHeight) * (96.0 / dpi)); // test points on screen diff --git a/tests/auto/gui/kernel/qinputdevice/tst_qinputdevice.cpp b/tests/auto/gui/kernel/qinputdevice/tst_qinputdevice.cpp index 67c65f1160..ac42f0da30 100644 --- a/tests/auto/gui/kernel/qinputdevice/tst_qinputdevice.cpp +++ b/tests/auto/gui/kernel/qinputdevice/tst_qinputdevice.cpp @@ -78,7 +78,7 @@ void tst_QInputDevice::multiSeatDevices() QWindowSystemInterface::registerInputDevice(new QPointingDevice("seat 2 mouse", 2010, QInputDevice::DeviceType::Mouse, QPointingDevice::PointerType::Generic, QInputDevice::Capability::Position | QInputDevice::Capability::Hover, 1, 2, "seat 2", QPointingDeviceUniqueId(), this)); - QVERIFY(QInputDevice::devices().count() >= 4); + QVERIFY(QInputDevice::devices().size() >= 4); QVERIFY(QInputDevicePrivate::fromId(1010)); QVERIFY(QInputDevicePrivate::fromId(1010)->hasCapability(QInputDevice::Capability::Scroll)); QVERIFY(QInputDevicePrivate::fromId(2010)); diff --git a/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp b/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp index 5420adca14..d7cc8a572c 100644 --- a/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp +++ b/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp @@ -263,14 +263,14 @@ void tst_QMouseEvent::grabbers() auto firstEPD = devPriv->pointById(0); QCOMPARE(firstEPD->eventPoint.pressTimestamp(), testMouseWidget->pressTimestamp); QCOMPARE(firstEPD->exclusiveGrabber, grabExclusive ? testMouseWidget : nullptr); - QCOMPARE(firstEPD->passiveGrabbers.count(), grabPassive ? 1 : 0); + QCOMPARE(firstEPD->passiveGrabbers.size(), grabPassive ? 1 : 0); if (grabPassive) QCOMPARE(firstEPD->passiveGrabbers.first(), testMouseWidget); // Ensure that grabbers are forgotten after release delivery QTest::mouseRelease(testMouseWidget, Qt::LeftButton, Qt::KeyboardModifiers(), {10, 10}); QTRY_COMPARE(firstEPD->exclusiveGrabber, nullptr); - QCOMPARE(firstEPD->passiveGrabbers.count(), 0); + QCOMPARE(firstEPD->passiveGrabbers.size(), 0); } void tst_QMouseEvent::velocity() diff --git a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp index b8e673efa3..b2be70b8e7 100644 --- a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp +++ b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp @@ -732,7 +732,7 @@ void tst_QTouchEvent::basicRawEventTranslation() QVERIFY(touchWidget.seenTouchBegin); QVERIFY(!touchWidget.seenTouchUpdate); QVERIFY(!touchWidget.seenTouchEnd); - QCOMPARE(touchWidget.touchBeginPoints.count(), 1); + QCOMPARE(touchWidget.touchBeginPoints.size(), 1); QCOMPARE(touchWidget.timestamp, timestamp); QEventPoint touchBeginPoint = touchWidget.touchBeginPoints.first(); QCOMPARE(touchBeginPoint.id(), 0); @@ -762,7 +762,7 @@ void tst_QTouchEvent::basicRawEventTranslation() QVERIFY(touchWidget.seenTouchBegin); QVERIFY(touchWidget.seenTouchUpdate); QVERIFY(!touchWidget.seenTouchEnd); - QCOMPARE(touchWidget.touchUpdatePoints.count(), 1); + QCOMPARE(touchWidget.touchUpdatePoints.size(), 1); QEventPoint touchUpdatePoint = touchWidget.touchUpdatePoints.first(); QCOMPARE(touchUpdatePoint.id(), 0); QCOMPARE(touchUpdatePoint.state(), rawTouchPoint.state()); @@ -790,7 +790,7 @@ void tst_QTouchEvent::basicRawEventTranslation() QVERIFY(touchWidget.seenTouchBegin); QVERIFY(touchWidget.seenTouchUpdate); QVERIFY(touchWidget.seenTouchEnd); - QCOMPARE(touchWidget.touchEndPoints.count(), 1); + QCOMPARE(touchWidget.touchEndPoints.size(), 1); QEventPoint touchEndPoint = touchWidget.touchEndPoints.first(); QCOMPARE(touchEndPoint.id(), 0); QCOMPARE(touchEndPoint.state(), rawTouchPoint.state()); @@ -859,8 +859,8 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen() QVERIFY(rightWidget.seenTouchBegin); QVERIFY(!rightWidget.seenTouchUpdate); QVERIFY(!rightWidget.seenTouchEnd); - QCOMPARE(leftWidget.touchBeginPoints.count(), 1); - QCOMPARE(rightWidget.touchBeginPoints.count(), 1); + QCOMPARE(leftWidget.touchBeginPoints.size(), 1); + QCOMPARE(rightWidget.touchBeginPoints.size(), 1); const int touchPointId0 = 0; const int touchPointId1 = touchPointId0 + 1; { @@ -907,8 +907,8 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen() QVERIFY(rightWidget.seenTouchBegin); QVERIFY(rightWidget.seenTouchUpdate); QVERIFY(!rightWidget.seenTouchEnd); - QCOMPARE(leftWidget.touchUpdatePoints.count(), 1); - QCOMPARE(rightWidget.touchUpdatePoints.count(), 1); + QCOMPARE(leftWidget.touchUpdatePoints.size(), 1); + QCOMPARE(rightWidget.touchUpdatePoints.size(), 1); { const QEventPoint &leftTouchPoint = leftWidget.touchUpdatePoints.first(); QCOMPARE(leftTouchPoint.id(), touchPointId0); @@ -953,8 +953,8 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen() QVERIFY(rightWidget.seenTouchBegin); QVERIFY(rightWidget.seenTouchUpdate); QVERIFY(rightWidget.seenTouchEnd); - QCOMPARE(leftWidget.touchEndPoints.count(), 1); - QCOMPARE(rightWidget.touchEndPoints.count(), 1); + QCOMPARE(leftWidget.touchEndPoints.size(), 1); + QCOMPARE(rightWidget.touchEndPoints.size(), 1); { const QEventPoint &leftTouchPoint = leftWidget.touchEndPoints.first(); QCOMPARE(leftTouchPoint.id(), touchPointId0); @@ -1012,7 +1012,7 @@ void tst_QTouchEvent::touchOnMultipleTouchscreens() QVERIFY(touchWidget.seenTouchBegin); QVERIFY(!touchWidget.seenTouchUpdate); QVERIFY(!touchWidget.seenTouchEnd); - QCOMPARE(touchWidget.touchBeginPoints.count(), 1); + QCOMPARE(touchWidget.touchBeginPoints.size(), 1); QCOMPARE(touchWidget.timestamp, timestamp); QEventPoint touchBeginPoint = touchWidget.touchBeginPoints.first(); QCOMPARE(touchBeginPoint.id(), 1); @@ -1027,7 +1027,7 @@ void tst_QTouchEvent::touchOnMultipleTouchscreens() QWindowSystemInterface::handleTouchEvent(window, ++timestamp, secondaryTouchScreenDevice, nativeTouchPoints); QCoreApplication::processEvents(); QVERIFY(!touchWidget.seenTouchEnd); - QCOMPARE(touchWidget.touchBeginPoints.count(), 1); + QCOMPARE(touchWidget.touchBeginPoints.size(), 1); QCOMPARE(touchWidget.timestamp, timestamp); touchBeginPoint = touchWidget.touchBeginPoints[0]; QCOMPARE(touchBeginPoint.id(), 10); @@ -1042,7 +1042,7 @@ void tst_QTouchEvent::touchOnMultipleTouchscreens() QWindowSystemInterface::handleTouchEvent(window, ++timestamp, secondaryTouchScreenDevice, nativeTouchPoints); QCoreApplication::processEvents(); QVERIFY(!touchWidget.seenTouchEnd); - QCOMPARE(touchWidget.touchBeginPoints.count(), 1); + QCOMPARE(touchWidget.touchBeginPoints.size(), 1); QCOMPARE(touchWidget.timestamp, timestamp); touchBeginPoint = touchWidget.touchBeginPoints[0]; QCOMPARE(touchBeginPoint.id(), 11); @@ -1058,7 +1058,7 @@ void tst_QTouchEvent::touchOnMultipleTouchscreens() QVERIFY(touchWidget.seenTouchBegin); QVERIFY(touchWidget.seenTouchUpdate); QVERIFY(!touchWidget.seenTouchEnd); - QCOMPARE(touchWidget.touchUpdatePoints.count(), 1); + QCOMPARE(touchWidget.touchUpdatePoints.size(), 1); QEventPoint touchUpdatePoint = touchWidget.touchUpdatePoints.first(); QCOMPARE(touchUpdatePoint.id(), 1); QCOMPARE(touchUpdatePoint.state(), QEventPoint::State::Updated); @@ -1073,7 +1073,7 @@ void tst_QTouchEvent::touchOnMultipleTouchscreens() QVERIFY(touchWidget.seenTouchBegin); QVERIFY(touchWidget.seenTouchUpdate); QVERIFY(touchWidget.seenTouchEnd); - QCOMPARE(touchWidget.touchEndPoints.count(), 1); + QCOMPARE(touchWidget.touchEndPoints.size(), 1); QEventPoint touchEndPoint = touchWidget.touchEndPoints.first(); QCOMPARE(touchEndPoint.id(), 1); QCOMPARE(touchEndPoint.state(), QEventPoint::State::Released); @@ -1098,7 +1098,7 @@ void tst_QTouchEvent::touchOnMultipleTouchscreens() QVERIFY(touchWidget.seenTouchBegin); QVERIFY(touchWidget.seenTouchUpdate); QVERIFY(!touchWidget.seenTouchEnd); - QCOMPARE(touchWidget.touchUpdatePoints.count(), 2); + QCOMPARE(touchWidget.touchUpdatePoints.size(), 2); QCOMPARE(touchWidget.touchUpdatePoints[0].id(), 10); QCOMPARE(touchWidget.touchUpdatePoints[1].id(), 11); @@ -1113,7 +1113,7 @@ void tst_QTouchEvent::touchOnMultipleTouchscreens() QVERIFY(touchWidget.seenTouchBegin); QVERIFY(touchWidget.seenTouchUpdate); QVERIFY(touchWidget.seenTouchEnd); - QCOMPARE(touchWidget.touchEndPoints.count(), 1); + QCOMPARE(touchWidget.touchEndPoints.size(), 1); touchEndPoint = touchWidget.touchEndPoints.first(); QCOMPARE(touchEndPoint.id(), 11); QCOMPARE(touchEndPoint.state(), QEventPoint::State::Released); @@ -1185,9 +1185,9 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad() QVERIFY(!rightWidget.seenTouchBegin); QVERIFY(!rightWidget.seenTouchUpdate); QVERIFY(!rightWidget.seenTouchEnd); - QCOMPARE(leftWidget.touchBeginPoints.count(), 2); - QCOMPARE(rightWidget.touchBeginPoints.count(), 0); - QCOMPARE(leftWidget.lastNormalizedPositions.count(), 2); + QCOMPARE(leftWidget.touchBeginPoints.size(), 2); + QCOMPARE(rightWidget.touchBeginPoints.size(), 0); + QCOMPARE(leftWidget.lastNormalizedPositions.size(), 2); { QEventPoint leftTouchPoint = leftWidget.touchBeginPoints.at(0); qCDebug(lcTests) << "lastNormalizedPositions after press" << leftWidget.lastNormalizedPositions; @@ -1248,9 +1248,9 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad() QVERIFY(!rightWidget.seenTouchBegin); QVERIFY(!rightWidget.seenTouchUpdate); QVERIFY(!rightWidget.seenTouchEnd); - QCOMPARE(leftWidget.touchUpdatePoints.count(), 2); - QCOMPARE(rightWidget.touchUpdatePoints.count(), 0); - QCOMPARE(leftWidget.lastNormalizedPositions.count(), 2); + QCOMPARE(leftWidget.touchUpdatePoints.size(), 2); + QCOMPARE(rightWidget.touchUpdatePoints.size(), 0); + QCOMPARE(leftWidget.lastNormalizedPositions.size(), 2); { QEventPoint leftTouchPoint = leftWidget.touchUpdatePoints.at(0); qCDebug(lcTests) << "lastNormalizedPositions after update" << leftWidget.lastNormalizedPositions; @@ -1311,9 +1311,9 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad() QVERIFY(!rightWidget.seenTouchBegin); QVERIFY(!rightWidget.seenTouchUpdate); QVERIFY(!rightWidget.seenTouchEnd); - QCOMPARE(leftWidget.touchEndPoints.count(), 2); - QCOMPARE(rightWidget.touchEndPoints.count(), 0); - QCOMPARE(leftWidget.lastNormalizedPositions.count(), 2); + QCOMPARE(leftWidget.touchEndPoints.size(), 2); + QCOMPARE(rightWidget.touchEndPoints.size(), 0); + QCOMPARE(leftWidget.lastNormalizedPositions.size(), 2); { QEventPoint leftTouchPoint = leftWidget.touchEndPoints.at(0); qCDebug(lcTests) << "lastNormalizedPositions after release" << leftWidget.lastNormalizedPositions; @@ -1396,16 +1396,16 @@ void tst_QTouchEvent::basicRawEventTranslationOfIds() QVERIFY(touchWidget.seenTouchBegin); QVERIFY(!touchWidget.seenTouchUpdate); QVERIFY(!touchWidget.seenTouchEnd); - QCOMPARE(touchWidget.touchBeginPoints.count(), 2); + QCOMPARE(touchWidget.touchBeginPoints.size(), 2); - for (int i = 0; i < touchWidget.touchBeginPoints.count(); ++i) { + for (int i = 0; i < touchWidget.touchBeginPoints.size(); ++i) { QEventPoint touchBeginPoint = touchWidget.touchBeginPoints.at(i); QCOMPARE(touchBeginPoint.id(), i); QCOMPARE(touchBeginPoint.state(), rawTouchPoints[i].state()); } // moving the point should translate to TouchUpdate - for (int i = 0; i < rawTouchPoints.count(); ++i) { + for (int i = 0; i < rawTouchPoints.size(); ++i) { auto &p = rawTouchPoints[i]; QMutableEventPoint::setState(p, QEventPoint::State::Updated); QMutableEventPoint::setGlobalPosition(p, p.globalPosition() + delta); @@ -1417,7 +1417,7 @@ void tst_QTouchEvent::basicRawEventTranslationOfIds() QVERIFY(touchWidget.seenTouchBegin); QVERIFY(touchWidget.seenTouchUpdate); QVERIFY(!touchWidget.seenTouchEnd); - QCOMPARE(touchWidget.touchUpdatePoints.count(), 2); + QCOMPARE(touchWidget.touchUpdatePoints.size(), 2); QCOMPARE(touchWidget.touchUpdatePoints.at(0).id(), 0); QCOMPARE(touchWidget.touchUpdatePoints.at(1).id(), 1); @@ -1432,7 +1432,7 @@ void tst_QTouchEvent::basicRawEventTranslationOfIds() QVERIFY(touchWidget.seenTouchBegin); QVERIFY(touchWidget.seenTouchUpdate); QCOMPARE(touchWidget.seenTouchEnd, false); - QCOMPARE(touchWidget.touchUpdatePoints.count(), 2); + QCOMPARE(touchWidget.touchUpdatePoints.size(), 2); QCOMPARE(touchWidget.touchUpdatePoints[0].id(), 0); QCOMPARE(touchWidget.touchUpdatePoints[1].id(), 1); @@ -1446,7 +1446,7 @@ void tst_QTouchEvent::basicRawEventTranslationOfIds() QVERIFY(touchWidget.seenTouchBegin); QVERIFY(touchWidget.seenTouchUpdate); QVERIFY(!touchWidget.seenTouchEnd); - QCOMPARE(touchWidget.touchUpdatePoints.count(), 2); + QCOMPARE(touchWidget.touchUpdatePoints.size(), 2); QCOMPARE(touchWidget.touchUpdatePoints[0].id(), 0); QCOMPARE(touchWidget.touchUpdatePoints[1].id(), 42); @@ -1460,7 +1460,7 @@ void tst_QTouchEvent::basicRawEventTranslationOfIds() QVERIFY(touchWidget.seenTouchBegin); QVERIFY(touchWidget.seenTouchUpdate); QVERIFY(touchWidget.seenTouchEnd); - QCOMPARE(touchWidget.touchUpdatePoints.count(), 2); + QCOMPARE(touchWidget.touchUpdatePoints.size(), 2); QCOMPARE(touchWidget.touchUpdatePoints[0].id(), 0); QCOMPARE(touchWidget.touchUpdatePoints[1].id(), 42); } @@ -1824,25 +1824,25 @@ void tst_QTouchEvent::testQGuiAppDelivery() // Now the real thing. QWindowSystemInterface::handleTouchEvent(&w, touchScreenDevice, points); // TouchBegin QCoreApplication::processEvents(); - QCOMPARE(filter.d.count(), 1); + QCOMPARE(filter.d.size(), 1); QCOMPARE(filter.d.contains(touchScreenDevice), true); - QCOMPARE(filter.d.value(touchScreenDevice).points.count(), 1); + QCOMPARE(filter.d.value(touchScreenDevice).points.size(), 1); QCOMPARE(filter.d.value(touchScreenDevice).lastSeenType, QEvent::TouchBegin); points[0].state = QEventPoint::State::Updated; QWindowSystemInterface::handleTouchEvent(&w, touchScreenDevice, points); // TouchUpdate QCoreApplication::processEvents(); - QCOMPARE(filter.d.count(), 1); + QCOMPARE(filter.d.size(), 1); QCOMPARE(filter.d.contains(touchScreenDevice), true); - QCOMPARE(filter.d.value(touchScreenDevice).points.count(), 2); + QCOMPARE(filter.d.value(touchScreenDevice).points.size(), 2); QCOMPARE(filter.d.value(touchScreenDevice).lastSeenType, QEvent::TouchUpdate); points[0].state = QEventPoint::State::Released; QWindowSystemInterface::handleTouchEvent(&w, touchScreenDevice, points); // TouchEnd QCoreApplication::processEvents(); - QCOMPARE(filter.d.count(), 1); + QCOMPARE(filter.d.size(), 1); QCOMPARE(filter.d.contains(touchScreenDevice), true); - QCOMPARE(filter.d.value(touchScreenDevice).points.count(), 3); + QCOMPARE(filter.d.value(touchScreenDevice).points.size(), 3); QCOMPARE(filter.d.value(touchScreenDevice).lastSeenType, QEvent::TouchEnd); } @@ -1885,8 +1885,8 @@ void tst_QTouchEvent::testMultiDevice() QCOMPARE(filter.d.value(touchScreenDevice).lastSeenType, QEvent::TouchBegin); QCOMPARE(filter.d.value(deviceTwo).lastSeenType, QEvent::TouchBegin); - QCOMPARE(filter.d.value(touchScreenDevice).points.count(), 1); - QCOMPARE(filter.d.value(deviceTwo).points.count(), 2); + QCOMPARE(filter.d.value(touchScreenDevice).points.size(), 1); + QCOMPARE(filter.d.value(deviceTwo).points.size(), 2); QCOMPARE(filter.d.value(touchScreenDevice).points.at(0).globalPosition(), area0.center()); // This fails because QGuiApplicationPrivate::processTouchEvent() sends synth-mouse events @@ -1941,7 +1941,7 @@ void tst_QTouchEvent::grabbers() // Ensure that grabbers are persistent between events, within the stored touchpoints QCOMPARE(devPriv->pointById(0)->exclusiveGrabber, grabExclusive ? &w : nullptr); - QCOMPARE(devPriv->pointById(0)->passiveGrabbers.count(), grabPassive ? 1 : 0); + QCOMPARE(devPriv->pointById(0)->passiveGrabbers.size(), grabPassive ? 1 : 0); if (grabPassive) QCOMPARE(devPriv->pointById(0)->passiveGrabbers.first(), &w); diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index 2ebb9472f6..36ff460fdd 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -993,7 +993,7 @@ public: } touchEventType = event->type(); QList<QTouchEvent::TouchPoint> points = event->points(); - for (int i = 0; i < points.count(); ++i) { + for (int i = 0; i < points.size(); ++i) { const auto &point = points.at(i); switch (point.state()) { case QEventPoint::State::Pressed: |