diff options
Diffstat (limited to 'tests/auto/quick')
58 files changed, 2074 insertions, 2074 deletions
diff --git a/tests/auto/quick/examples/tst_examples.cpp b/tests/auto/quick/examples/tst_examples.cpp index fd58dab328..d1c31a080d 100644 --- a/tests/auto/quick/examples/tst_examples.cpp +++ b/tests/auto/quick/examples/tst_examples.cpp @@ -103,7 +103,7 @@ to have them tested by the examples() test. */ void tst_examples::namingConvention(const QDir &d) { - for (int ii = 0; ii < excludedDirs.count(); ++ii) { + for (int ii = 0; ii < excludedDirs.size(); ++ii) { QString s = excludedDirs.at(ii); if (d.absolutePath().endsWith(s)) return; @@ -157,7 +157,7 @@ void tst_examples::namingConvention() QStringList tst_examples::findQmlFiles(const QDir &d) { - for (int ii = 0; ii < excludedDirs.count(); ++ii) { + for (int ii = 0; ii < excludedDirs.size(); ++ii) { QString s = excludedDirs.at(ii); if (d.absolutePath().endsWith(s)) return QStringList(); @@ -172,7 +172,7 @@ QStringList tst_examples::findQmlFiles(const QDir &d) foreach (const QString &file, files) { if (file.at(0).isLower()) { bool superContinue = false; - for (int ii = 0; ii < excludedFiles.count(); ++ii) { + for (int ii = 0; ii < excludedFiles.size(); ++ii) { QString e = excludedFiles.at(ii); if (d.absoluteFilePath(file).endsWith(e)) { superContinue = true; diff --git a/tests/auto/quick/pointerhandlers/flickableinterop/tst_flickableinterop.cpp b/tests/auto/quick/pointerhandlers/flickableinterop/tst_flickableinterop.cpp index 84cfe0e7fd..7a0206c04f 100644 --- a/tests/auto/quick/pointerhandlers/flickableinterop/tst_flickableinterop.cpp +++ b/tests/auto/quick/pointerhandlers/flickableinterop/tst_flickableinterop.cpp @@ -103,7 +103,7 @@ void tst_FlickableInterop::touchTapButton() QTest::touchEvent(window, touchDevice).release(1, p1, window); QQuickTouchUtils::flush(window); QTRY_VERIFY(!button->property("pressed").toBool()); - QCOMPARE(tappedSpy.count(), 1); + QCOMPARE(tappedSpy.size(), 1); // We can drag <= dragThreshold and the button still acts normal, Flickable doesn't grab p1 = button->mapToScene(QPointF(20, 20)).toPoint(); @@ -117,7 +117,7 @@ void tst_FlickableInterop::touchTapButton() QTest::touchEvent(window, touchDevice).release(1, p1, window); QQuickTouchUtils::flush(window); QTRY_VERIFY(!button->property("pressed").toBool()); - QCOMPARE(tappedSpy.count(), 2); + QCOMPARE(tappedSpy.size(), 2); } void tst_FlickableInterop::touchDragFlickableBehindButton_data() @@ -167,7 +167,7 @@ void tst_FlickableInterop::touchDragFlickableBehindButton() QTest::touchEvent(window, touchDevice).release(1, p1, window); QQuickTouchUtils::flush(window); QVERIFY(!button->property("pressed").toBool()); - QCOMPARE(tappedSpy.count(), 0); + QCOMPARE(tappedSpy.size(), 0); } void tst_FlickableInterop::mouseClickButton_data() @@ -197,7 +197,7 @@ void tst_FlickableInterop::mouseClickButton() QTRY_VERIFY(button->property("pressed").toBool()); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); QTRY_VERIFY(!button->property("pressed").toBool()); - QCOMPARE(tappedSpy.count(), 1); + QCOMPARE(tappedSpy.size(), 1); // We can drag <= dragThreshold and the button still acts normal, Flickable doesn't grab p1 = button->mapToScene(QPointF(20, 20)).toPoint(); @@ -208,7 +208,7 @@ void tst_FlickableInterop::mouseClickButton() QVERIFY(button->property("pressed").toBool()); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); QTRY_VERIFY(!button->property("pressed").toBool()); - QCOMPARE(tappedSpy.count(), 2); + QCOMPARE(tappedSpy.size(), 2); } void tst_FlickableInterop::mouseDragFlickableBehindButton_data() @@ -254,7 +254,7 @@ void tst_FlickableInterop::mouseDragFlickableBehindButton() QVERIFY(!button->property("pressed").toBool()); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); QVERIFY(!button->property("pressed").toBool()); - QCOMPARE(tappedSpy.count(), 0); + QCOMPARE(tappedSpy.size(), 0); } void tst_FlickableInterop::touchDragSlider() @@ -306,8 +306,8 @@ void tst_FlickableInterop::touchDragSlider() // Release, and do not expect the tapped signal QTest::touchEvent(window, touchDevice).release(1, p1, window); QQuickTouchUtils::flush(window); - QCOMPARE(tappedSpy.count(), 0); - QCOMPARE(translationChangedSpy.count(), 1); + QCOMPARE(tappedSpy.size(), 0); + QCOMPARE(translationChangedSpy.size(), 1); } void tst_FlickableInterop::mouseDragSlider_data() @@ -391,8 +391,8 @@ void tst_FlickableInterop::mouseDragSlider() // Release, and do not expect the tapped signal QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); - QCOMPARE(tappedSpy.count(), 0); - QCOMPARE(translationChangedSpy.count(), expectedDragHandlerActive ? 1 : 0); + QCOMPARE(tappedSpy.size(), 0); + QCOMPARE(translationChangedSpy.size(), expectedDragHandlerActive ? 1 : 0); } void tst_FlickableInterop::touchDragFlickableBehindSlider() @@ -437,8 +437,8 @@ void tst_FlickableInterop::touchDragFlickableBehindSlider() QTest::touchEvent(window, touchDevice).release(1, p1, window); QQuickTouchUtils::flush(window); QVERIFY(!slider->property("pressed").toBool()); - QCOMPARE(tappedSpy.count(), 0); - QCOMPARE(translationChangedSpy.count(), 0); + QCOMPARE(tappedSpy.size(), 0); + QCOMPARE(translationChangedSpy.size(), 0); } void tst_FlickableInterop::mouseDragFlickableBehindSlider() @@ -479,8 +479,8 @@ void tst_FlickableInterop::mouseDragFlickableBehindSlider() QCOMPARE(i, 2); QVERIFY(!slider->property("pressed").toBool()); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); - QCOMPARE(tappedSpy.count(), 0); - QCOMPARE(translationChangedSpy.count(), 0); + QCOMPARE(tappedSpy.size(), 0); + QCOMPARE(translationChangedSpy.size(), 0); } void tst_FlickableInterop::touchDragFlickableBehindItemWithHandlers_data() diff --git a/tests/auto/quick/pointerhandlers/mousearea_interop/tst_mousearea_interop.cpp b/tests/auto/quick/pointerhandlers/mousearea_interop/tst_mousearea_interop.cpp index c4059a1fbd..723ad0b63e 100644 --- a/tests/auto/quick/pointerhandlers/mousearea_interop/tst_mousearea_interop.cpp +++ b/tests/auto/quick/pointerhandlers/mousearea_interop/tst_mousearea_interop.cpp @@ -178,11 +178,11 @@ void tst_MouseAreaInterop::hoverHandlerDoesntHoverOnPress() // QTBUG-72843 QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, p); QTRY_COMPARE(ma->pressed(), true); QCOMPARE(handler->isHovered(), true); - QCOMPARE(hoveredChangedSpy.count(), 0); + QCOMPARE(hoveredChangedSpy.size(), 0); QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p); QTRY_COMPARE(ma->pressed(), false); QCOMPARE(handler->isHovered(), true); - QCOMPARE(hoveredChangedSpy.count(), 0); + QCOMPARE(hoveredChangedSpy.size(), 0); } void tst_MouseAreaInterop::doubleClickInMouseAreaWithDragHandlerInGrandparent() @@ -199,8 +199,8 @@ void tst_MouseAreaInterop::doubleClickInMouseAreaWithDragHandlerInGrandparent() QPoint p = ma->mapToScene(ma->boundingRect().center()).toPoint(); QTest::mouseDClick(&window, Qt::LeftButton, Qt::NoModifier, p); - QCOMPARE(dClickSpy.count(), 1); - QCOMPARE(dragActiveSpy.count(), 0); + QCOMPARE(dClickSpy.size(), 1); + QCOMPARE(dragActiveSpy.size(), 0); } QTEST_MAIN(tst_MouseAreaInterop) diff --git a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp index 46dd07bb5a..ab64f6bb24 100644 --- a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp +++ b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp @@ -145,7 +145,7 @@ void tst_MptaInterop::touchesThenPinch() QQuickTouchUtils::flush(window); QVERIFY(tp.at(0)->property("pressed").toBool()); QTRY_VERIFY(tp.at(1)->property("pressed").toBool()); - QCOMPARE(mptaPressedSpy.count(), 2); + QCOMPARE(mptaPressedSpy.size(), 2); // Press a third touchpoint: MPTA grabs it too QPoint p3 = mpta->mapToScene(QPointF(110, 200)).toPoint(); @@ -154,8 +154,8 @@ void tst_MptaInterop::touchesThenPinch() QCOMPARE(tp.at(0)->property("pressed").toBool(), true); QCOMPARE(tp.at(1)->property("pressed").toBool(), true); QCOMPARE(tp.at(2)->property("pressed").toBool(), true); - QCOMPARE(mptaPressedSpy.count(), 3); - QCOMPARE(mptaCanceledSpy.count(), 0); + QCOMPARE(mptaPressedSpy.size(), 3); + QCOMPARE(mptaCanceledSpy.size(), 0); QCOMPARE(devPriv->pointById(1)->exclusiveGrabber, mpta); QCOMPARE(devPriv->pointById(2)->exclusiveGrabber, mpta); QCOMPARE(devPriv->pointById(3)->exclusiveGrabber, mpta); @@ -255,7 +255,7 @@ void tst_MptaInterop::touchesThenPinch() touch.release(2, p2).commit(); QQuickTouchUtils::flush(window); - QTRY_COMPARE(mptaReleasedSpy.count(), 1); + QTRY_COMPARE(mptaReleasedSpy.size(), 1); } void tst_MptaInterop::unloadHandlerWithPassiveGrab() diff --git a/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp b/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp index 00999e4fd1..15222467d0 100644 --- a/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp @@ -153,21 +153,21 @@ void tst_DragHandler::touchDrag() QCOMPARE(dragHandler->centroid().scenePosition(), scenePressPos); QCOMPARE(dragHandler->centroid().scenePressPosition(), scenePressPos); QCOMPARE(dragHandler->centroid().velocity(), QVector2D()); - QCOMPARE(centroidChangedSpy.count(), 1); + QCOMPARE(centroidChangedSpy.size(), 1); p1 += QPoint(dragThreshold, 0); QTest::touchEvent(window, touchDevice).move(1, p1, window); QQuickTouchUtils::flush(window); qCDebug(lcPointerTests) << "velocity after drag" << dragHandler->centroid().velocity(); if (dragThreshold > 0) QTRY_VERIFY(!qFuzzyIsNull(dragHandler->centroid().velocity().x())); - QCOMPARE(centroidChangedSpy.count(), 2); + QCOMPARE(centroidChangedSpy.size(), 2); QVERIFY(!dragHandler->active()); p1 += QPoint(1, 0); QTest::touchEvent(window, touchDevice).move(1, p1, window); QQuickTouchUtils::flush(window); QTRY_VERIFY(dragHandler->active()); - QCOMPARE(translationChangedSpy.count(), 0); - QCOMPARE(centroidChangedSpy.count(), 3); + QCOMPARE(translationChangedSpy.size(), 0); + QCOMPARE(centroidChangedSpy.size(), 3); QCOMPARE(dragHandler->persistentTranslation().x(), 0); QCOMPARE(dragHandler->activeTranslation().x(), 0); QPointF sceneGrabPos = p1; @@ -186,15 +186,15 @@ void tst_DragHandler::touchDrag() QCOMPARE(dragHandler->persistentTranslation().y(), 0); QCOMPARE(dragHandler->activeTranslation().y(), 0); QVERIFY(dragHandler->centroid().velocity().x() > 0); - QCOMPARE(centroidChangedSpy.count(), 4); + QCOMPARE(centroidChangedSpy.size(), 4); QTest::touchEvent(window, touchDevice).release(1, p1, window); QQuickTouchUtils::flush(window); QTRY_VERIFY(!dragHandler->active()); QCOMPARE(dragHandler->centroid().pressedButtons(), Qt::NoButton); QCOMPARE(dragHandler->centroid().velocity(), QVector2D()); QCOMPARE(ball->mapToScene(ballCenter).toPoint(), p1); - QCOMPARE(translationChangedSpy.count(), 1); - QCOMPARE(centroidChangedSpy.count(), 5); + QCOMPARE(translationChangedSpy.size(), 1); + QCOMPARE(centroidChangedSpy.size(), 5); QCOMPARE(dragHandler->persistentTranslation().x(), dragThreshold + 20); // Drag again: activeTranslation starts over, while persistentTranslation accumulates @@ -290,13 +290,13 @@ void tst_DragHandler::mouseDrag() QCOMPARE(dragHandler->centroid().scenePosition(), scenePressPos); QCOMPARE(dragHandler->centroid().scenePressPosition(), scenePressPos); QCOMPARE(dragHandler->centroid().velocity(), QVector2D()); - QCOMPARE(centroidChangedSpy.count(), 1); + QCOMPARE(centroidChangedSpy.size(), 1); } p1 += QPoint(dragThreshold, 0); QTest::mouseMove(window, p1); if (shouldDrag) { // QTRY_VERIFY(dragHandler->centroid().velocity().x() > 0); // TODO QTBUG-33891 - QCOMPARE(centroidChangedSpy.count(), 2); + QCOMPARE(centroidChangedSpy.size(), 2); QVERIFY(!dragHandler->active()); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::ArrowCursor); @@ -308,9 +308,9 @@ void tst_DragHandler::mouseDrag() QTRY_VERIFY(dragHandler->active()); else QVERIFY(!dragHandler->active()); - QCOMPARE(translationChangedSpy.count(), 0); + QCOMPARE(translationChangedSpy.size(), 0); if (shouldDrag) - QCOMPARE(centroidChangedSpy.count(), 3); + QCOMPARE(centroidChangedSpy.size(), 3); QCOMPARE(dragHandler->persistentTranslation().x(), 0.0); QCOMPARE(dragHandler->activeTranslation().x(), 0.0); QPointF sceneGrabPos = p1; @@ -330,7 +330,7 @@ void tst_DragHandler::mouseDrag() QCOMPARE(dragHandler->persistentTranslation().y(), 0.0); QCOMPARE(dragHandler->activeTranslation().y(), 0.0); // QVERIFY(dragHandler->centroid().velocity().x() > 0); // TODO QTBUG-33891 - QCOMPARE(centroidChangedSpy.count(), 4); + QCOMPARE(centroidChangedSpy.size(), 4); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::ClosedHandCursor); #endif @@ -340,8 +340,8 @@ void tst_DragHandler::mouseDrag() QCOMPARE(dragHandler->centroid().pressedButtons(), Qt::NoButton); if (shouldDrag) QCOMPARE(ball->mapToScene(ballCenter).toPoint(), p1); - QCOMPARE(translationChangedSpy.count(), shouldDrag ? 1 : 0); - QCOMPARE(centroidChangedSpy.count(), shouldDrag ? 5 : 0); + QCOMPARE(translationChangedSpy.size(), shouldDrag ? 1 : 0); + QCOMPARE(centroidChangedSpy.size(), shouldDrag ? 5 : 0); #if QT_CONFIG(cursor) QTest::mouseMove(window, p1 + QPoint(1, 0)); // TODO after fixing QTBUG-53987, don't send mouseMove QCOMPARE(window->cursor().shape(), Qt::ArrowCursor); @@ -388,19 +388,19 @@ void tst_DragHandler::mouseDragThreshold() QCOMPARE(dragHandler->centroid().scenePosition(), scenePressPos); QCOMPARE(dragHandler->centroid().scenePressPosition(), scenePressPos); QCOMPARE(dragHandler->centroid().velocity(), QVector2D()); - QCOMPARE(centroidChangedSpy.count(), 1); + QCOMPARE(centroidChangedSpy.size(), 1); p1 += QPoint(qMax(1, dragThreshold), 0); // QTBUG-85431: zero-distance mouse moves are not delivered QTest::mouseMove(window, p1); if (dragThreshold > 0) QTRY_VERIFY(dragHandler->centroid().velocity().x() > 0); - QCOMPARE(centroidChangedSpy.count(), 2); + QCOMPARE(centroidChangedSpy.size(), 2); // the handler is not yet active, unless the drag threshold was already exceeded QCOMPARE(dragHandler->active(), dragThreshold == 0); p1 += QPoint(1, 0); QTest::mouseMove(window, p1); QTRY_VERIFY(dragHandler->active()); - QCOMPARE(translationChangedSpy.count(), dragThreshold ? 0 : 1); - QCOMPARE(centroidChangedSpy.count(), 3); + QCOMPARE(translationChangedSpy.size(), dragThreshold ? 0 : 1); + QCOMPARE(centroidChangedSpy.size(), 3); #if QT_DEPRECATED_SINCE(6, 2) QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED QCOMPARE(dragHandler->translation().x(), dragThreshold ? 0 : 2); @@ -426,13 +426,13 @@ QT_WARNING_POP QCOMPARE(dragHandler->activeTranslation().x(), dragThreshold + (dragThreshold ? 20 : 21)); QCOMPARE(dragHandler->activeTranslation().y(), 0.0); QVERIFY(dragHandler->centroid().velocity().x() > 0); - QCOMPARE(centroidChangedSpy.count(), 4); + QCOMPARE(centroidChangedSpy.size(), 4); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); QTRY_VERIFY(!dragHandler->active()); QCOMPARE(dragHandler->centroid().pressedButtons(), Qt::NoButton); QCOMPARE(ball->mapToScene(ballCenter).toPoint(), p1); - QCOMPARE(translationChangedSpy.count(), dragThreshold ? 1 : 2); - QCOMPARE(centroidChangedSpy.count(), 5); + QCOMPARE(translationChangedSpy.size(), dragThreshold ? 1 : 2); + QCOMPARE(centroidChangedSpy.size(), 5); } void tst_DragHandler::dragFromMargin() // QTBUG-74966 @@ -591,13 +591,13 @@ void tst_DragHandler::touchDragMulti() touchSeq.stationary(1).press(2, p2, window).commit(); QQuickTouchUtils::flush(window); QVERIFY(!dragHandler1->active()); - QCOMPARE(centroidChangedSpy1.count(), 2); + QCOMPARE(centroidChangedSpy1.size(), 2); QCOMPARE(dragHandler1->centroid().position(), ball1Center); QCOMPARE(dragHandler1->centroid().pressPosition(), ball1Center); QCOMPARE(dragHandler1->centroid().scenePosition(), scenePressPos1); QCOMPARE(dragHandler1->centroid().scenePressPosition(), scenePressPos1); QVERIFY(!dragHandler2->active()); - QCOMPARE(centroidChangedSpy2.count(), 2); + QCOMPARE(centroidChangedSpy2.size(), 2); QCOMPARE(dragHandler2->centroid().position(), ball2Center); QCOMPARE(dragHandler2->centroid().pressPosition(), ball2Center); QCOMPARE(dragHandler2->centroid().scenePosition(), scenePressPos2); @@ -607,13 +607,13 @@ void tst_DragHandler::touchDragMulti() touchSeq.move(1, p1, window).move(2, p2, window).commit(); QQuickTouchUtils::flush(window); QVERIFY(!dragHandler1->active()); - QCOMPARE(centroidChangedSpy1.count(), 3); + QCOMPARE(centroidChangedSpy1.size(), 3); QCOMPARE(dragHandler1->centroid().position(), ball1Center + QPointF(dragThreshold, 0)); QCOMPARE(dragHandler1->centroid().pressPosition(), ball1Center); QCOMPARE(dragHandler1->centroid().scenePosition().toPoint(), p1); QCOMPARE(dragHandler1->centroid().scenePressPosition(), scenePressPos1); QVERIFY(!dragHandler2->active()); - QCOMPARE(centroidChangedSpy2.count(), 3); + QCOMPARE(centroidChangedSpy2.size(), 3); QCOMPARE(dragHandler2->centroid().position(), ball2Center + QPointF(0, dragThreshold)); QCOMPARE(dragHandler2->centroid().pressPosition(), ball2Center); QCOMPARE(dragHandler2->centroid().scenePosition().toPoint(), p2); @@ -624,7 +624,7 @@ void tst_DragHandler::touchDragMulti() QQuickTouchUtils::flush(window); QTRY_VERIFY(dragHandler1->active()); QVERIFY(dragHandler2->active()); - QCOMPARE(translationChangedSpy1.count(), 0); + QCOMPARE(translationChangedSpy1.size(), 0); #if QT_DEPRECATED_SINCE(6, 2) QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED QCOMPARE(dragHandler1->translation().x(), 0.0); @@ -638,7 +638,7 @@ QT_WARNING_POP p1 += QPoint(19, 0); p2 += QPoint(0, 19); QVERIFY(dragHandler2->active()); - QCOMPARE(translationChangedSpy2.count(), 0); + QCOMPARE(translationChangedSpy2.size(), 0); #if QT_DEPRECATED_SINCE(6, 2) QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED QCOMPARE(dragHandler2->translation().x(), 0.0); @@ -682,12 +682,12 @@ QT_WARNING_POP QVERIFY(dragHandler2->active()); QCOMPARE(dragHandler1->centroid().pressedButtons(), Qt::NoButton); QCOMPARE(ball1->mapToScene(ball1Center).toPoint(), p1); - QCOMPARE(translationChangedSpy1.count(), 1); + QCOMPARE(translationChangedSpy1.size(), 1); touchSeq.release(2, p2, window).commit(); QQuickTouchUtils::flush(window); QTRY_VERIFY(!dragHandler2->active()); QCOMPARE(ball2->mapToScene(ball2Center).toPoint(), p2); - QCOMPARE(translationChangedSpy2.count(), 1); + QCOMPARE(translationChangedSpy2.size(), 1); } void tst_DragHandler::touchDragMultiSliders_data() @@ -893,7 +893,7 @@ void tst_DragHandler::touchPinchAndMouseMove() for (int i = 0; i < 10; ++i) { p1 += delta; QTest::mouseMove(window, p1); - QCOMPARE(rectMovedSpy.count(), 0); + QCOMPARE(rectMovedSpy.size(), 0); } } diff --git a/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp b/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp index a32ee13961..d3981badda 100644 --- a/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp @@ -99,45 +99,45 @@ void tst_HoverHandler::hoverHandlerAndUnderlyingHoverHandler() QTest::mouseMove(window, outOfSidebar); QCOMPARE(topSidebarHH->isHovered(), false); - QCOMPARE(sidebarHoveredSpy.count(), 0); + QCOMPARE(sidebarHoveredSpy.size(), 0); QCOMPARE(buttonHH->isHovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 0); + QCOMPARE(buttonHoveredSpy.size(), 0); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::ArrowCursor); #endif QTest::mouseMove(window, rightOfButton); QCOMPARE(topSidebarHH->isHovered(), true); - QCOMPARE(sidebarHoveredSpy.count(), 1); + QCOMPARE(sidebarHoveredSpy.size(), 1); QCOMPARE(buttonHH->isHovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 0); + QCOMPARE(buttonHoveredSpy.size(), 0); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::OpenHandCursor); #endif QTest::mouseMove(window, buttonCenter); QCOMPARE(topSidebarHH->isHovered(), !blocking); - QCOMPARE(sidebarHoveredSpy.count(), blocking ? 2 : 1); + QCOMPARE(sidebarHoveredSpy.size(), blocking ? 2 : 1); QCOMPARE(buttonHH->isHovered(), true); - QCOMPARE(buttonHoveredSpy.count(), 1); + QCOMPARE(buttonHoveredSpy.size(), 1); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::PointingHandCursor); #endif QTest::mouseMove(window, rightOfButton); QCOMPARE(topSidebarHH->isHovered(), true); - QCOMPARE(sidebarHoveredSpy.count(), blocking ? 3 : 1); + QCOMPARE(sidebarHoveredSpy.size(), blocking ? 3 : 1); QCOMPARE(buttonHH->isHovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 2); + QCOMPARE(buttonHoveredSpy.size(), 2); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::OpenHandCursor); #endif QTest::mouseMove(window, outOfSidebar); QCOMPARE(topSidebarHH->isHovered(), false); - QCOMPARE(sidebarHoveredSpy.count(), blocking ? 4 : 2); + QCOMPARE(sidebarHoveredSpy.size(), blocking ? 4 : 2); QCOMPARE(buttonHH->isHovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 2); + QCOMPARE(buttonHoveredSpy.size(), 2); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::ArrowCursor); #endif @@ -170,45 +170,45 @@ void tst_HoverHandler::mouseAreaAndUnderlyingHoverHandler() QTest::mouseMove(window, outOfSidebar); QCOMPARE(topSidebarHH->isHovered(), false); - QCOMPARE(sidebarHoveredSpy.count(), 0); + QCOMPARE(sidebarHoveredSpy.size(), 0); QCOMPARE(buttonMA->hovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 0); + QCOMPARE(buttonHoveredSpy.size(), 0); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::ArrowCursor); #endif QTest::mouseMove(window, rightOfButton); QCOMPARE(topSidebarHH->isHovered(), true); - QCOMPARE(sidebarHoveredSpy.count(), 1); + QCOMPARE(sidebarHoveredSpy.size(), 1); QCOMPARE(buttonMA->hovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 0); + QCOMPARE(buttonHoveredSpy.size(), 0); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::OpenHandCursor); #endif QTest::mouseMove(window, buttonCenter); QCOMPARE(topSidebarHH->isHovered(), true); - QCOMPARE(sidebarHoveredSpy.count(), 1); + QCOMPARE(sidebarHoveredSpy.size(), 1); QCOMPARE(buttonMA->hovered(), true); - QCOMPARE(buttonHoveredSpy.count(), 1); + QCOMPARE(buttonHoveredSpy.size(), 1); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::UpArrowCursor); #endif QTest::mouseMove(window, rightOfButton); QCOMPARE(topSidebarHH->isHovered(), true); - QCOMPARE(sidebarHoveredSpy.count(), 1); + QCOMPARE(sidebarHoveredSpy.size(), 1); QCOMPARE(buttonMA->hovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 2); + QCOMPARE(buttonHoveredSpy.size(), 2); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::OpenHandCursor); #endif QTest::mouseMove(window, outOfSidebar); QCOMPARE(topSidebarHH->isHovered(), false); - QCOMPARE(sidebarHoveredSpy.count(), 2); + QCOMPARE(sidebarHoveredSpy.size(), 2); QCOMPARE(buttonMA->hovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 2); + QCOMPARE(buttonHoveredSpy.size(), 2); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::ArrowCursor); #endif @@ -236,45 +236,45 @@ void tst_HoverHandler::hoverHandlerAndUnderlyingMouseArea() QTest::mouseMove(window, outOfSidebar); QCOMPARE(bottomSidebarMA->hovered(), false); - QCOMPARE(sidebarHoveredSpy.count(), 0); + QCOMPARE(sidebarHoveredSpy.size(), 0); QCOMPARE(buttonHH->isHovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 0); + QCOMPARE(buttonHoveredSpy.size(), 0); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::ArrowCursor); #endif QTest::mouseMove(window, rightOfButton); QCOMPARE(bottomSidebarMA->hovered(), true); - QCOMPARE(sidebarHoveredSpy.count(), 1); + QCOMPARE(sidebarHoveredSpy.size(), 1); QCOMPARE(buttonHH->isHovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 0); + QCOMPARE(buttonHoveredSpy.size(), 0); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::ClosedHandCursor); #endif QTest::mouseMove(window, buttonCenter); QCOMPARE(bottomSidebarMA->hovered(), false); - QCOMPARE(sidebarHoveredSpy.count(), 2); + QCOMPARE(sidebarHoveredSpy.size(), 2); QCOMPARE(buttonHH->isHovered(), true); - QCOMPARE(buttonHoveredSpy.count(), 1); + QCOMPARE(buttonHoveredSpy.size(), 1); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::PointingHandCursor); #endif QTest::mouseMove(window, rightOfButton); QCOMPARE(bottomSidebarMA->hovered(), true); - QCOMPARE(sidebarHoveredSpy.count(), 3); + QCOMPARE(sidebarHoveredSpy.size(), 3); QCOMPARE(buttonHH->isHovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 2); + QCOMPARE(buttonHoveredSpy.size(), 2); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::ClosedHandCursor); #endif QTest::mouseMove(window, outOfSidebar); QCOMPARE(bottomSidebarMA->hovered(), false); - QCOMPARE(sidebarHoveredSpy.count(), 4); + QCOMPARE(sidebarHoveredSpy.size(), 4); QCOMPARE(buttonHH->isHovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 2); + QCOMPARE(buttonHoveredSpy.size(), 2); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::ArrowCursor); #endif @@ -309,21 +309,21 @@ void tst_HoverHandler::disabledHoverHandlerAndUnderlyingMouseArea() QTest::mouseMove(window, outOfSidebar); QCOMPARE(bottomSidebarMA->hovered(), false); - QCOMPARE(sidebarHoveredSpy.count(), 0); + QCOMPARE(sidebarHoveredSpy.size(), 0); QCOMPARE(buttonHH->isHovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 0); + QCOMPARE(buttonHoveredSpy.size(), 0); QTest::mouseMove(window, buttonCenter); QCOMPARE(bottomSidebarMA->hovered(), true); - QCOMPARE(sidebarHoveredSpy.count(), 1); + QCOMPARE(sidebarHoveredSpy.size(), 1); QCOMPARE(buttonHH->isHovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 0); + QCOMPARE(buttonHoveredSpy.size(), 0); QTest::mouseMove(window, rightOfButton); QCOMPARE(bottomSidebarMA->hovered(), true); - QCOMPARE(sidebarHoveredSpy.count(), 1); + QCOMPARE(sidebarHoveredSpy.size(), 1); QCOMPARE(buttonHH->isHovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 0); + QCOMPARE(buttonHoveredSpy.size(), 0); } void tst_HoverHandler::hoverHandlerOnDisabledItem() @@ -350,15 +350,15 @@ void tst_HoverHandler::hoverHandlerOnDisabledItem() QTest::mouseMove(window, rightOfButton); QCOMPARE(buttonHH->isHovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 0); + QCOMPARE(buttonHoveredSpy.size(), 0); QTest::mouseMove(window, buttonCenter); QCOMPARE(buttonHH->isHovered(), true); - QCOMPARE(buttonHoveredSpy.count(), 1); + QCOMPARE(buttonHoveredSpy.size(), 1); QTest::mouseMove(window, rightOfButton); QCOMPARE(buttonHH->isHovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 2); + QCOMPARE(buttonHoveredSpy.size(), 2); } void tst_HoverHandler::movingItemWithHoverHandler() @@ -414,21 +414,21 @@ void tst_HoverHandler::margin() // QTBUG-85303 QTest::mouseMove(window, {10, 10}); QCOMPARE(hh->isHovered(), false); - QCOMPARE(hoveredSpy.count(), 0); + QCOMPARE(hoveredSpy.size(), 0); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::ArrowCursor); #endif QTest::mouseMove(window, leftMargin); QCOMPARE(hh->isHovered(), true); - QCOMPARE(hoveredSpy.count(), 1); + QCOMPARE(hoveredSpy.size(), 1); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::OpenHandCursor); #endif QTest::mouseMove(window, itemCenter); QCOMPARE(hh->isHovered(), true); - QCOMPARE(hoveredSpy.count(), 1); + QCOMPARE(hoveredSpy.size(), 1); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::OpenHandCursor); #endif diff --git a/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp b/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp index 0eb9cffa09..243af23ef5 100644 --- a/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp @@ -74,9 +74,9 @@ void tst_QQuickPinchHandler::pinchProperties() QVERIFY(rootItem != nullptr); QSignalSpy targetSpy(pinchHandler, SIGNAL(targetChanged())); pinchHandler->setTarget(rootItem); - QCOMPARE(targetSpy.count(),1); + QCOMPARE(targetSpy.size(),1); pinchHandler->setTarget(rootItem); - QCOMPARE(targetSpy.count(),1); + QCOMPARE(targetSpy.size(),1); // axis /* @@ -138,14 +138,14 @@ void tst_QQuickPinchHandler::pinchProperties() QCOMPARE(pinchHandler->minimumScale(), 0.25); QCOMPARE(pinchHandler->maximumScale(), 1.5); - QCOMPARE(scaleMinSpy.count(),1); - QCOMPARE(scaleMaxSpy.count(),1); + QCOMPARE(scaleMinSpy.size(),1); + QCOMPARE(scaleMaxSpy.size(),1); pinchHandler->setMinimumScale(0.25); pinchHandler->setMaximumScale(1.5); - QCOMPARE(scaleMinSpy.count(),1); - QCOMPARE(scaleMaxSpy.count(),1); + QCOMPARE(scaleMinSpy.size(),1); + QCOMPARE(scaleMaxSpy.size(),1); // minimum and maximum rotation properties QSignalSpy rotMinSpy(pinchHandler, SIGNAL(minimumRotationChanged())); @@ -160,14 +160,14 @@ void tst_QQuickPinchHandler::pinchProperties() QCOMPARE(pinchHandler->minimumRotation(), -90.0); QCOMPARE(pinchHandler->maximumRotation(), 45.0); - QCOMPARE(rotMinSpy.count(),1); - QCOMPARE(rotMaxSpy.count(),1); + QCOMPARE(rotMinSpy.size(),1); + QCOMPARE(rotMaxSpy.size(),1); pinchHandler->setMinimumRotation(-90.0); pinchHandler->setMaximumRotation(45.0); - QCOMPARE(rotMinSpy.count(),1); - QCOMPARE(rotMaxSpy.count(),1); + QCOMPARE(rotMinSpy.size(),1); + QCOMPARE(rotMaxSpy.size(),1); } QEventPoint makeTouchPoint(int id, QPoint p, QQuickView *v, QQuickItem *i) @@ -213,7 +213,7 @@ void tst_QQuickPinchHandler::scale() // it is outside its bounds. pinchSequence.stationary(0).press(1, p1, window).commit(); QQuickTouchUtils::flush(window); - QTRY_COMPARE(grabChangedSpy.count(), 1); // passive grab + QTRY_COMPARE(grabChangedSpy.size(), 1); // passive grab QPoint pd(10, 10); // move one point until PinchHandler activates @@ -229,7 +229,7 @@ void tst_QQuickPinchHandler::scale() QCOMPARE(pinchHandler->firstPoint().sceneGrabPosition(), pinchHandler->firstPoint().scenePosition()); QCOMPARE(pinchHandler->lastPoint().sceneGrabPosition(), pinchHandler->lastPoint().scenePosition()); // first point got a passive grab; both points got exclusive grabs - QCOMPARE(grabChangedSpy.count(), 3); + QCOMPARE(grabChangedSpy.size(), 3); QLineF line(p0, p1); const qreal startLength = line.length(); diff --git a/tests/auto/quick/pointerhandlers/qquickpointhandler/tst_qquickpointhandler.cpp b/tests/auto/quick/pointerhandlers/qquickpointhandler/tst_qquickpointhandler.cpp index eea1946316..5683261635 100644 --- a/tests/auto/quick/pointerhandlers/qquickpointhandler/tst_qquickpointhandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquickpointhandler/tst_qquickpointhandler.cpp @@ -82,20 +82,20 @@ void tst_PointHandler::singleTouch() QTest::touchEvent(window, touchDevice).press(1, point, window); QQuickTouchUtils::flush(window); QTRY_COMPARE(handler->active(), true); - QCOMPARE(activeSpy.count(), 1); - QCOMPARE(pointSpy.count(), 1); + QCOMPARE(activeSpy.size(), 1); + QCOMPARE(pointSpy.size(), 1); QCOMPARE(handler->point().position().toPoint(), point); QCOMPARE(handler->point().scenePosition().toPoint(), point); QCOMPARE(handler->point().pressedButtons(), Qt::NoButton); QCOMPARE(handler->translation(), QVector2D()); - QCOMPARE(translationSpy.count(), 1); + QCOMPARE(translationSpy.size(), 1); point += QPoint(10, 10); QTest::touchEvent(window, touchDevice).move(1, point, window); QQuickTouchUtils::flush(window); QCOMPARE(handler->active(), true); - QCOMPARE(activeSpy.count(), 1); - QCOMPARE(pointSpy.count(), 2); + QCOMPARE(activeSpy.size(), 1); + QCOMPARE(pointSpy.size(), 2); QCOMPARE(handler->point().position().toPoint(), point); QCOMPARE(handler->point().scenePosition().toPoint(), point); QCOMPARE(handler->point().pressPosition().toPoint(), QPoint(100, 100)); @@ -104,15 +104,15 @@ void tst_PointHandler::singleTouch() QVERIFY(handler->point().velocity().x() > 0); QVERIFY(handler->point().velocity().y() > 0); QCOMPARE(handler->translation(), QVector2D(10, 10)); - QCOMPARE(translationSpy.count(), 2); + QCOMPARE(translationSpy.size(), 2); QTest::touchEvent(window, touchDevice).release(1, point, window); QQuickTouchUtils::flush(window); QTRY_COMPARE(handler->active(), false); - QCOMPARE(activeSpy.count(), 2); - QCOMPARE(pointSpy.count(), 3); + QCOMPARE(activeSpy.size(), 2); + QCOMPARE(pointSpy.size(), 3); QCOMPARE(handler->translation(), QVector2D()); - QCOMPARE(translationSpy.count(), 3); + QCOMPARE(translationSpy.size(), 3); } void tst_PointHandler::tabletStylus() @@ -138,8 +138,8 @@ void tst_PointHandler::tabletStylus() QWindowSystemInterface::handleTabletEvent(window, point, window->mapToGlobal(point), int(QInputDevice::DeviceType::Stylus), int(QPointingDevice::PointerType::Pen), Qt::LeftButton, 0.5, 25, 35, 0.6, 12.3, 3, stylusId, Qt::NoModifier); QTRY_COMPARE(handler->active(), true); - QCOMPARE(activeSpy.count(), 1); - QCOMPARE(pointSpy.count(), 1); + QCOMPARE(activeSpy.size(), 1); + QCOMPARE(pointSpy.size(), 1); QCOMPARE(handler->point().position().toPoint(), pointLocalDPI); QCOMPARE(handler->point().scenePosition().toPoint(), pointLocalDPI); QCOMPARE(handler->point().pressedButtons(), Qt::LeftButton); @@ -147,16 +147,16 @@ void tst_PointHandler::tabletStylus() QCOMPARE(handler->point().rotation(), 12.3); QCOMPARE(handler->point().uniqueId().numericId(), stylusId); QCOMPARE(handler->translation(), QVector2D()); - QCOMPARE(translationSpy.count(), 1); + QCOMPARE(translationSpy.size(), 1); QPoint delta(10, 10); QPoint deltaLocalDPI = QHighDpi::fromNativeLocalPosition(delta, window); point += delta; QWindowSystemInterface::handleTabletEvent(window, point, window->mapToGlobal(point), int(QInputDevice::DeviceType::Stylus), int(QPointingDevice::PointerType::Pen), Qt::LeftButton, 0.45, 23, 33, 0.57, 15.6, 3, stylusId, Qt::NoModifier); - QTRY_COMPARE(pointSpy.count(), 2); + QTRY_COMPARE(pointSpy.size(), 2); QCOMPARE(handler->active(), true); - QCOMPARE(activeSpy.count(), 1); + QCOMPARE(activeSpy.size(), 1); QCOMPARE(handler->point().position().toPoint(), pointLocalDPI + deltaLocalDPI); QCOMPARE(handler->point().scenePosition().toPoint(), pointLocalDPI + deltaLocalDPI); QCOMPARE(handler->point().pressPosition().toPoint(), pointLocalDPI); @@ -168,15 +168,15 @@ void tst_PointHandler::tabletStylus() QVERIFY(handler->point().velocity().x() > 0); QVERIFY(handler->point().velocity().y() > 0); QCOMPARE(handler->translation(), QVector2D(deltaLocalDPI)); - QCOMPARE(translationSpy.count(), 2); + QCOMPARE(translationSpy.size(), 2); QWindowSystemInterface::handleTabletEvent(window, point, window->mapToGlobal(point), int(QInputDevice::DeviceType::Stylus), int(QPointingDevice::PointerType::Pen), Qt::NoButton, 0, 0, 0, 0, 0, 0, stylusId, Qt::NoModifier); QTRY_COMPARE(handler->active(), false); - QCOMPARE(activeSpy.count(), 2); - QCOMPARE(pointSpy.count(), 3); + QCOMPARE(activeSpy.size(), 2); + QCOMPARE(pointSpy.size(), 3); QCOMPARE(handler->translation(), QVector2D()); - QCOMPARE(translationSpy.count(), 3); + QCOMPARE(translationSpy.size(), 3); } void tst_PointHandler::simultaneousMultiTouch() @@ -185,7 +185,7 @@ void tst_PointHandler::simultaneousMultiTouch() createView(windowPtr, "multiPointTracker.qml"); QQuickView * window = windowPtr.data(); QList<QQuickPointHandler *> handlers = window->rootObject()->findChildren<QQuickPointHandler *>(); - QCOMPARE(handlers.count(), 3); + QCOMPARE(handlers.size(), 3); QVector<QSignalSpy*> activeSpies; QVector<QSignalSpy*> pointSpies; @@ -362,7 +362,7 @@ void tst_PointHandler::pressedMultipleButtons() QPoint point(100,100); - for (int i = 0; i < buttons.count(); ++i) { + for (int i = 0; i < buttons.size(); ++i) { int btns = int(buttons.at(i)); int release = 0; if (i > 0) { @@ -382,8 +382,8 @@ void tst_PointHandler::pressedMultipleButtons() QTest::mousePress(windowPtr.data(), Qt::NoButton, Qt::NoModifier, point); QCOMPARE(handler->active(), false); - QCOMPARE(activeSpy.count(), activeChangeCount); - QCOMPARE(pointSpy.count(), changeCount); + QCOMPARE(activeSpy.size(), activeChangeCount); + QCOMPARE(pointSpy.size(), changeCount); } QTEST_MAIN(tst_PointHandler) diff --git a/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp b/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp index 3c016967ea..638ce43def 100644 --- a/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp @@ -127,7 +127,7 @@ void tst_TapHandler::touchGesturePolicyDragThreshold() QTest::touchEvent(window, touchDevice).release(1, p1, window); QQuickTouchUtils::flush(window); QTRY_VERIFY(!buttonDragThreshold->property("pressed").toBool()); - QCOMPARE(dragThresholdTappedSpy.count(), 1); + QCOMPARE(dragThresholdTappedSpy.size(), 1); QCOMPARE(buttonDragThreshold->property("tappedPosition").toPoint(), p1); QCOMPARE(tapHandler->point().position(), QPointF()); @@ -148,7 +148,7 @@ void tst_TapHandler::touchGesturePolicyDragThreshold() QTest::touchEvent(window, touchDevice).release(1, p1, window); QQuickTouchUtils::flush(window); QVERIFY(!buttonDragThreshold->property("pressed").toBool()); - QCOMPARE(dragThresholdTappedSpy.count(), 0); + QCOMPARE(dragThresholdTappedSpy.size(), 0); } void tst_TapHandler::mouseGesturePolicyDragThreshold() @@ -173,7 +173,7 @@ void tst_TapHandler::mouseGesturePolicyDragThreshold() QVERIFY(buttonDragThreshold->property("pressed").toBool()); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); QTRY_VERIFY(!buttonDragThreshold->property("pressed").toBool()); - QTRY_COMPARE(dragThresholdTappedSpy.count(), 1); + QTRY_COMPARE(dragThresholdTappedSpy.size(), 1); QCOMPARE(buttonDragThreshold->property("tappedPosition").toPoint(), p1); QCOMPARE(tapHandler->point().position(), QPointF()); @@ -190,7 +190,7 @@ void tst_TapHandler::mouseGesturePolicyDragThreshold() QTRY_VERIFY(!buttonDragThreshold->property("pressed").toBool()); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); QVERIFY(!buttonDragThreshold->property("pressed").toBool()); - QCOMPARE(dragThresholdTappedSpy.count(), 0); + QCOMPARE(dragThresholdTappedSpy.size(), 0); } void tst_TapHandler::touchMouseGesturePolicyDragThreshold() @@ -210,8 +210,8 @@ void tst_TapHandler::touchMouseGesturePolicyDragThreshold() QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, p1); QTRY_VERIFY(buttonDragThreshold->property("pressed").toBool()); QTest::mouseMove(window, p2); - QTRY_COMPARE(canceledSpy.count(), 1); - QCOMPARE(tappedSpy.count(), 0); + QTRY_COMPARE(canceledSpy.size(), 1); + QCOMPARE(tappedSpy.size(), 0); QCOMPARE(buttonDragThreshold->property("pressed").toBool(), false); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p2); @@ -222,7 +222,7 @@ void tst_TapHandler::touchMouseGesturePolicyDragThreshold() QTest::touchEvent(window, touchDevice).release(1, p1, window); QQuickTouchUtils::flush(window); QTRY_VERIFY(!buttonDragThreshold->property("pressed").toBool()); - QCOMPARE(tappedSpy.count(), 1); + QCOMPARE(tappedSpy.size(), 1); // Press touch, drag it outside the button, release QTest::touchEvent(window, touchDevice).press(1, p1, window); @@ -233,16 +233,16 @@ void tst_TapHandler::touchMouseGesturePolicyDragThreshold() QTRY_COMPARE(buttonDragThreshold->property("pressed").toBool(), false); QTest::touchEvent(window, touchDevice).release(1, p2, window); QQuickTouchUtils::flush(window); - QTRY_COMPARE(canceledSpy.count(), 2); - QCOMPARE(tappedSpy.count(), 1); // didn't increase + QTRY_COMPARE(canceledSpy.size(), 2); + QCOMPARE(tappedSpy.size(), 1); // didn't increase QCOMPARE(buttonDragThreshold->property("pressed").toBool(), false); // Press and release mouse, verify that it still works QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, p1); QTRY_VERIFY(buttonDragThreshold->property("pressed").toBool()); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); - QTRY_COMPARE(tappedSpy.count(), 2); - QCOMPARE(canceledSpy.count(), 2); // didn't increase + QTRY_COMPARE(tappedSpy.size(), 2); + QCOMPARE(canceledSpy.size(), 2); // didn't increase QCOMPARE(buttonDragThreshold->property("pressed").toBool(), false); } @@ -268,7 +268,7 @@ void tst_TapHandler::touchGesturePolicyWithinBounds() QTest::touchEvent(window, touchDevice).release(1, p1, window); QQuickTouchUtils::flush(window); QTRY_VERIFY(!buttonWithinBounds->property("pressed").toBool()); - QCOMPARE(withinBoundsTappedSpy.count(), 1); + QCOMPARE(withinBoundsTappedSpy.size(), 1); // WithinBounds button is no longer pressed if touchpoint leaves bounds withinBoundsTappedSpy.clear(); @@ -283,7 +283,7 @@ void tst_TapHandler::touchGesturePolicyWithinBounds() QTest::touchEvent(window, touchDevice).release(1, p1, window); QQuickTouchUtils::flush(window); QVERIFY(!buttonWithinBounds->property("pressed").toBool()); - QCOMPARE(withinBoundsTappedSpy.count(), 0); + QCOMPARE(withinBoundsTappedSpy.size(), 0); } void tst_TapHandler::mouseGesturePolicyWithinBounds() @@ -305,7 +305,7 @@ void tst_TapHandler::mouseGesturePolicyWithinBounds() QVERIFY(buttonWithinBounds->property("pressed").toBool()); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); QTRY_VERIFY(!buttonWithinBounds->property("pressed").toBool()); - QCOMPARE(withinBoundsTappedSpy.count(), 1); + QCOMPARE(withinBoundsTappedSpy.size(), 1); // WithinBounds button is no longer pressed if touchpoint leaves bounds withinBoundsTappedSpy.clear(); @@ -317,7 +317,7 @@ void tst_TapHandler::mouseGesturePolicyWithinBounds() QTRY_VERIFY(!buttonWithinBounds->property("pressed").toBool()); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); QVERIFY(!buttonWithinBounds->property("pressed").toBool()); - QCOMPARE(withinBoundsTappedSpy.count(), 0); + QCOMPARE(withinBoundsTappedSpy.size(), 0); } void tst_TapHandler::touchGesturePolicyReleaseWithinBounds() @@ -351,7 +351,7 @@ void tst_TapHandler::touchGesturePolicyReleaseWithinBounds() QTest::touchEvent(window, touchDevice).release(1, p1, window); QQuickTouchUtils::flush(window); QTRY_VERIFY(!buttonReleaseWithinBounds->property("pressed").toBool()); - QCOMPARE(releaseWithinBoundsTappedSpy.count(), 1); + QCOMPARE(releaseWithinBoundsTappedSpy.size(), 1); // ReleaseWithinBounds button does not emit tapped if released out of bounds releaseWithinBoundsTappedSpy.clear(); @@ -366,7 +366,7 @@ void tst_TapHandler::touchGesturePolicyReleaseWithinBounds() QTest::touchEvent(window, touchDevice).release(1, p1, window); QQuickTouchUtils::flush(window); QTRY_VERIFY(!buttonReleaseWithinBounds->property("pressed").toBool()); - QCOMPARE(releaseWithinBoundsTappedSpy.count(), 0); + QCOMPARE(releaseWithinBoundsTappedSpy.size(), 0); } void tst_TapHandler::mouseGesturePolicyReleaseWithinBounds() @@ -395,7 +395,7 @@ void tst_TapHandler::mouseGesturePolicyReleaseWithinBounds() QVERIFY(buttonReleaseWithinBounds->property("pressed").toBool()); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); QTRY_VERIFY(!buttonReleaseWithinBounds->property("pressed").toBool()); - QCOMPARE(releaseWithinBoundsTappedSpy.count(), 1); + QCOMPARE(releaseWithinBoundsTappedSpy.size(), 1); // ReleaseWithinBounds button does not emit tapped if released out of bounds releaseWithinBoundsTappedSpy.clear(); @@ -407,7 +407,7 @@ void tst_TapHandler::mouseGesturePolicyReleaseWithinBounds() QVERIFY(buttonReleaseWithinBounds->property("pressed").toBool()); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); QTRY_VERIFY(!buttonReleaseWithinBounds->property("pressed").toBool()); - QCOMPARE(releaseWithinBoundsTappedSpy.count(), 0); + QCOMPARE(releaseWithinBoundsTappedSpy.size(), 0); } void tst_TapHandler::gesturePolicyDragWithinBounds_data() @@ -469,7 +469,7 @@ void tst_TapHandler::gesturePolicyDragWithinBounds() QCOMPARE(window.rootObject()->property("feedbackText"), expectedFeedback); if (expectedCanceled) - QCOMPARE(canceledSpy.count(), 1); + QCOMPARE(canceledSpy.size(), 1); } void tst_TapHandler::touchMultiTap() @@ -491,7 +491,7 @@ void tst_TapHandler::touchMultiTap() QTest::touchEvent(window, touchDevice).release(1, p1, window); QQuickTouchUtils::flush(window); QTRY_VERIFY(!button->property("pressed").toBool()); - QCOMPARE(tappedSpy.count(), 1); + QCOMPARE(tappedSpy.size(), 1); // Tap again in exactly the same place (not likely with touch in the real world) QTest::touchEvent(window, touchDevice).press(1, p1, window); @@ -500,7 +500,7 @@ void tst_TapHandler::touchMultiTap() QTest::touchEvent(window, touchDevice).release(1, p1, window); QQuickTouchUtils::flush(window); QTRY_VERIFY(!button->property("pressed").toBool()); - QCOMPARE(tappedSpy.count(), 2); + QCOMPARE(tappedSpy.size(), 2); // Tap a third time, nearby p1 += QPoint(dragThreshold, dragThreshold); @@ -510,7 +510,7 @@ void tst_TapHandler::touchMultiTap() QTest::touchEvent(window, touchDevice).release(1, p1, window); QQuickTouchUtils::flush(window); QTRY_VERIFY(!button->property("pressed").toBool()); - QCOMPARE(tappedSpy.count(), 3); + QCOMPARE(tappedSpy.size(), 3); // Tap a fourth time, drifting farther away p1 += QPoint(dragThreshold, dragThreshold); @@ -520,7 +520,7 @@ void tst_TapHandler::touchMultiTap() QTest::touchEvent(window, touchDevice).release(1, p1, window); QQuickTouchUtils::flush(window); QTRY_VERIFY(!button->property("pressed").toBool()); - QCOMPARE(tappedSpy.count(), 4); + QCOMPARE(tappedSpy.size(), 4); } void tst_TapHandler::mouseMultiTap() @@ -540,14 +540,14 @@ void tst_TapHandler::mouseMultiTap() QTRY_VERIFY(button->property("pressed").toBool()); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); QTRY_VERIFY(!button->property("pressed").toBool()); - QCOMPARE(tappedSpy.count(), 1); + QCOMPARE(tappedSpy.size(), 1); // Tap again in exactly the same place (not likely with touch in the real world) QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, p1); QTRY_VERIFY(button->property("pressed").toBool()); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); QTRY_VERIFY(!button->property("pressed").toBool()); - QCOMPARE(tappedSpy.count(), 2); + QCOMPARE(tappedSpy.size(), 2); // Tap a third time, nearby p1 += QPoint(dragThreshold, dragThreshold); @@ -555,7 +555,7 @@ void tst_TapHandler::mouseMultiTap() QTRY_VERIFY(button->property("pressed").toBool()); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); QTRY_VERIFY(!button->property("pressed").toBool()); - QCOMPARE(tappedSpy.count(), 3); + QCOMPARE(tappedSpy.size(), 3); // Tap a fourth time, drifting farther away p1 += QPoint(dragThreshold, dragThreshold); @@ -563,7 +563,7 @@ void tst_TapHandler::mouseMultiTap() QTRY_VERIFY(button->property("pressed").toBool()); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); QTRY_VERIFY(!button->property("pressed").toBool()); - QCOMPARE(tappedSpy.count(), 4); + QCOMPARE(tappedSpy.size(), 4); } void tst_TapHandler::touchLongPress() @@ -583,24 +583,24 @@ void tst_TapHandler::touchLongPress() // Reduce the threshold so that we can get a long press quickly tapHandler->setLongPressThreshold(0.5); - QCOMPARE(longPressThresholdChangedSpy.count(), 1); + QCOMPARE(longPressThresholdChangedSpy.size(), 1); // Press and hold QPoint p1 = button->mapToScene(button->clipRect().center()).toPoint(); QTest::touchEvent(window, touchDevice).press(1, p1, window); QQuickTouchUtils::flush(window); QTRY_VERIFY(button->property("pressed").toBool()); - QTRY_COMPARE(longPressedSpy.count(), 1); + QTRY_COMPARE(longPressedSpy.size(), 1); timeHeldSpy.wait(); // the longer we hold it, the more this will occur - qDebug() << "held" << tapHandler->timeHeld() << "secs; timeHeld updated" << timeHeldSpy.count() << "times"; - QVERIFY(timeHeldSpy.count() > 0); + qDebug() << "held" << tapHandler->timeHeld() << "secs; timeHeld updated" << timeHeldSpy.size() << "times"; + QVERIFY(timeHeldSpy.size() > 0); QVERIFY(tapHandler->timeHeld() > 0.4); // Should be > 0.5 but slow CI and timer granularity can interfere // Release and verify that tapped was not emitted QTest::touchEvent(window, touchDevice).release(1, p1, window); QQuickTouchUtils::flush(window); QTRY_VERIFY(!button->property("pressed").toBool()); - QCOMPARE(tappedSpy.count(), 0); + QCOMPARE(tappedSpy.size(), 0); } void tst_TapHandler::mouseLongPress() @@ -620,22 +620,22 @@ void tst_TapHandler::mouseLongPress() // Reduce the threshold so that we can get a long press quickly tapHandler->setLongPressThreshold(0.5); - QCOMPARE(longPressThresholdChangedSpy.count(), 1); + QCOMPARE(longPressThresholdChangedSpy.size(), 1); // Press and hold QPoint p1 = button->mapToScene(button->clipRect().center()).toPoint(); QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, p1); QTRY_VERIFY(button->property("pressed").toBool()); - QTRY_COMPARE(longPressedSpy.count(), 1); + QTRY_COMPARE(longPressedSpy.size(), 1); timeHeldSpy.wait(); // the longer we hold it, the more this will occur - qDebug() << "held" << tapHandler->timeHeld() << "secs; timeHeld updated" << timeHeldSpy.count() << "times"; - QVERIFY(timeHeldSpy.count() > 0); + qDebug() << "held" << tapHandler->timeHeld() << "secs; timeHeld updated" << timeHeldSpy.size() << "times"; + QVERIFY(timeHeldSpy.size() > 0); QVERIFY(tapHandler->timeHeld() > 0.4); // Should be > 0.5 but slow CI and timer granularity can interfere // Release and verify that tapped was not emitted QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1, 500); QTRY_VERIFY(!button->property("pressed").toBool()); - QCOMPARE(tappedSpy.count(), 0); + QCOMPARE(tappedSpy.size(), 0); } void tst_TapHandler::buttonsMultiTouch() @@ -697,11 +697,11 @@ void tst_TapHandler::buttonsMultiTouch() touchSeq.stationary(2).stationary(3).release(1, p1, window).commit(); QQuickTouchUtils::flush(window); QTRY_VERIFY(!buttonDragThreshold->property("pressed").toBool()); - QCOMPARE(dragThresholdTappedSpy.count(), 1); + QCOMPARE(dragThresholdTappedSpy.size(), 1); QVERIFY(buttonWithinBounds->property("pressed").toBool()); - QCOMPARE(withinBoundsTappedSpy.count(), 0); + QCOMPARE(withinBoundsTappedSpy.size(), 0); QVERIFY(buttonReleaseWithinBounds->property("pressed").toBool()); - QCOMPARE(releaseWithinBoundsTappedSpy.count(), 0); + QCOMPARE(releaseWithinBoundsTappedSpy.size(), 0); touchSeq.stationary(2).stationary(3).press(1, p1, window).commit(); QQuickTouchUtils::flush(window); QTRY_VERIFY(buttonDragThreshold->property("pressed").toBool()); @@ -712,11 +712,11 @@ void tst_TapHandler::buttonsMultiTouch() touchSeq.stationary(1).stationary(3).release(2, p2, window).commit(); QQuickTouchUtils::flush(window); QTRY_VERIFY(!buttonWithinBounds->property("pressed").toBool()); - QCOMPARE(withinBoundsTappedSpy.count(), 1); + QCOMPARE(withinBoundsTappedSpy.size(), 1); QVERIFY(buttonDragThreshold->property("pressed").toBool()); - QCOMPARE(dragThresholdTappedSpy.count(), 1); + QCOMPARE(dragThresholdTappedSpy.size(), 1); QVERIFY(buttonReleaseWithinBounds->property("pressed").toBool()); - QCOMPARE(releaseWithinBoundsTappedSpy.count(), 0); + QCOMPARE(releaseWithinBoundsTappedSpy.size(), 0); touchSeq.stationary(1).stationary(3).press(2, p2, window).commit(); QQuickTouchUtils::flush(window); QVERIFY(buttonDragThreshold->property("pressed").toBool()); @@ -726,11 +726,11 @@ void tst_TapHandler::buttonsMultiTouch() // can release bottom button and press again: others stay pressed the whole time touchSeq.stationary(1).stationary(2).release(3, p3, window).commit(); QQuickTouchUtils::flush(window); - QCOMPARE(releaseWithinBoundsTappedSpy.count(), 1); + QCOMPARE(releaseWithinBoundsTappedSpy.size(), 1); QVERIFY(buttonWithinBounds->property("pressed").toBool()); - QCOMPARE(withinBoundsTappedSpy.count(), 1); + QCOMPARE(withinBoundsTappedSpy.size(), 1); QVERIFY(!buttonReleaseWithinBounds->property("pressed").toBool()); - QCOMPARE(dragThresholdTappedSpy.count(), 1); + QCOMPARE(dragThresholdTappedSpy.size(), 1); touchSeq.stationary(1).stationary(2).press(3, p3, window).commit(); QQuickTouchUtils::flush(window); QTRY_VERIFY(buttonDragThreshold->property("pressed").toBool()); @@ -759,18 +759,18 @@ void tst_TapHandler::componentUserBehavioralOverride() // Press QPoint p1 = button->mapToScene(button->clipRect().center()).toPoint(); QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, p1); - QTRY_COMPARE(userPressedChangedSpy.count(), 1); - QCOMPARE(innerPressedChangedSpy.count(), 0); - QCOMPARE(innerGrabChangedSpy.count(), 0); - QCOMPARE(userGrabChangedSpy.count(), 1); + QTRY_COMPARE(userPressedChangedSpy.size(), 1); + QCOMPARE(innerPressedChangedSpy.size(), 0); + QCOMPARE(innerGrabChangedSpy.size(), 0); + QCOMPARE(userGrabChangedSpy.size(), 1); // Release QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); - QTRY_COMPARE(userPressedChangedSpy.count(), 2); - QCOMPARE(innerPressedChangedSpy.count(), 0); - QCOMPARE(tappedSpy.count(), 1); // only because the override handler makes that happen - QCOMPARE(innerGrabChangedSpy.count(), 0); - QCOMPARE(userGrabChangedSpy.count(), 2); + QTRY_COMPARE(userPressedChangedSpy.size(), 2); + QCOMPARE(innerPressedChangedSpy.size(), 0); + QCOMPARE(tappedSpy.size(), 1); // only because the override handler makes that happen + QCOMPARE(innerGrabChangedSpy.size(), 0); + QCOMPARE(userGrabChangedSpy.size(), 2); } void tst_TapHandler::rightLongPressIgnoreWheel() @@ -801,14 +801,14 @@ void tst_TapHandler::rightLongPressIgnoreWheel() QWheelEvent wheelEvent(p1, p1, QPoint(0, 0), QPoint(0, 0), Qt::NoButton, Qt::NoModifier, Qt::ScrollEnd, false, Qt::MouseEventNotSynthesized); QGuiApplication::sendEvent(window, &wheelEvent); - QTRY_COMPARE(longPressedSpy.count(), 1); + QTRY_COMPARE(longPressedSpy.size(), 1); QCOMPARE(tap->isPressed(), true); - QCOMPARE(tappedSpy.count(), 0); + QCOMPARE(tappedSpy.size(), 0); // Release QTest::mouseRelease(window, Qt::RightButton, Qt::NoModifier, p1, 500); QTRY_COMPARE(tap->isPressed(), false); - QCOMPARE(tappedSpy.count(), 0); + QCOMPARE(tappedSpy.size(), 0); } void tst_TapHandler::negativeZStackingOrder() // QTBUG-83114 @@ -826,8 +826,8 @@ void tst_TapHandler::negativeZStackingOrder() // QTBUG-83114 QSignalSpy clickSpyChild(childTapHandler, &QQuickTapHandler::tapped); QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, QPoint(150, 100)); - QCOMPARE(clickSpyChild.count(), 1); - QCOMPARE(clickSpyParent.count(), 1); + QCOMPARE(clickSpyChild.size(), 1); + QCOMPARE(clickSpyParent.size(), 1); auto order = root->property("taps").toList(); QVERIFY(order.at(0) == "childTapHandler"); QVERIFY(order.at(1) == "parentTapHandler"); @@ -836,8 +836,8 @@ void tst_TapHandler::negativeZStackingOrder() // QTBUG-83114 childTapHandler->parentItem()->setZ(-1); root->setProperty("taps", QVariantList()); QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, QPoint(150, 100)); - QCOMPARE(clickSpyChild.count(), 2); - QCOMPARE(clickSpyParent.count(), 2); + QCOMPARE(clickSpyChild.size(), 2); + QCOMPARE(clickSpyParent.size(), 2); order = root->property("taps").toList(); QVERIFY(order.at(0) == "parentTapHandler"); QVERIFY(order.at(1) == "childTapHandler"); @@ -895,12 +895,12 @@ void tst_TapHandler::nestedDoubleTap() // QTBUG-102625 QTest::mouseDClick(&window, Qt::LeftButton, Qt::NoModifier, QPoint(150, 100)); - QCOMPARE(childSpy.count(), 1); + QCOMPARE(childSpy.size(), 1); // If the child gets by with a passive grab, both handlers see tap and double-tap. // If the child takes an exclusive grab and stops event propagation, the parent doesn't see them. - QCOMPARE(parentSpy.count(), + QCOMPARE(parentSpy.size(), childGesturePolicy == QQuickTapHandler::GesturePolicy::DragThreshold ? 1 : 0); - QCOMPARE(root->property("taps").toList().count(), + QCOMPARE(root->property("taps").toList().size(), childGesturePolicy == QQuickTapHandler::GesturePolicy::DragThreshold ? 4 : 2); } diff --git a/tests/auto/quick/pointerhandlers/qquickwheelhandler/tst_qquickwheelhandler.cpp b/tests/auto/quick/pointerhandlers/qquickwheelhandler/tst_qquickwheelhandler.cpp index 3b9599e435..d87acc3200 100644 --- a/tests/auto/quick/pointerhandlers/qquickwheelhandler/tst_qquickwheelhandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquickwheelhandler/tst_qquickwheelhandler.cpp @@ -165,13 +165,13 @@ void tst_QQuickWheelHandler::singleHandler() sendWheelEvent(window, eventPos, eventAngleDelta, eventPixelDelta, eventModifiers, Qt::NoScrollPhase, eventInverted); } QCOMPARE(rect->position().toPoint(), expectedPosition); - QCOMPARE(activeChangedSpy.count(), 1); + QCOMPARE(activeChangedSpy.size(), 1); QCOMPARE(handler->active(), true); QCOMPARE(rect->scale(), expectedScale); QCOMPARE(rect->rotation(), expectedRotation); if (!eventPhases) { QTRY_COMPARE(handler->active(), false); - QCOMPARE(activeChangedSpy.count(), 2); + QCOMPARE(activeChangedSpy.size(), 2); } // restore by rotating backwards @@ -181,7 +181,7 @@ void tst_QQuickWheelHandler::singleHandler() } else { sendWheelEvent(window, eventPos, eventAngleDelta * -1, eventPixelDelta * -1, eventModifiers, Qt::NoScrollPhase, eventInverted); } - QCOMPARE(activeChangedSpy.count(), eventPhases ? 2 : 3); + QCOMPARE(activeChangedSpy.size(), eventPhases ? 2 : 3); QCOMPARE(handler->active(), !eventPhases); QCOMPARE(rect->position().toPoint(), QPoint(0, 0)); QCOMPARE(rect->scale(), 1); @@ -306,13 +306,13 @@ void tst_QQuickWheelHandler::nestedHandler() QCOMPARE(innerRect->scale(), innerScale); QCOMPARE(innerRect->rotation(), innerRotation); QCOMPARE(outerRect->position().toPoint(), outerPosition); - QCOMPARE(outerActiveChangedSpy.count(), 1); + QCOMPARE(outerActiveChangedSpy.size(), 1); QCOMPARE(outerHandler->active(), true); QCOMPARE(outerRect->scale(), outerScale); QCOMPARE(outerRect->rotation(), outerRotation); if (!eventPhases) { QTRY_COMPARE(outerHandler->active(), false); - QCOMPARE(outerActiveChangedSpy.count(), 2); + QCOMPARE(outerActiveChangedSpy.size(), 2); } } @@ -355,9 +355,9 @@ void tst_QQuickWheelHandler::blocking() qreal outerPosWas = outerRect->position().x(); sendWheelEvent(window, eventPos, {0, 120}, {0, 0}, Qt::NoModifier, Qt::NoScrollPhase, false); - QTRY_COMPARE(innerActiveChangedSpy.count(), 2); + QTRY_COMPARE(innerActiveChangedSpy.size(), 2); QCOMPARE(innerRect->position().x(), innerPosWas + 15); - QCOMPARE(outerActiveChangedSpy.count(), blocking ? 0 : 2); + QCOMPARE(outerActiveChangedSpy.size(), blocking ? 0 : 2); QCOMPARE(outerRect->position().x(), outerPosWas + (blocking ? 0 : 15)); } diff --git a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp index 8be86cdec4..1a01a8aca5 100644 --- a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp +++ b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp @@ -132,10 +132,10 @@ void tst_qquickanimatedimage::frameCount() const QUrl origSource = anim->source(); anim->setSource(QUrl()); QCOMPARE(anim->frameCount(), 0); - QCOMPARE(frameCountChangedSpy.count(), 1); + QCOMPARE(frameCountChangedSpy.size(), 1); anim->setSource(origSource); QCOMPARE(anim->frameCount(), 3); - QCOMPARE(frameCountChangedSpy.count(), 2); + QCOMPARE(frameCountChangedSpy.size(), 2); delete anim; } @@ -169,13 +169,13 @@ void tst_qquickanimatedimage::mirror_running() QVERIFY(spy.isValid()); anim->setPlaying(true); - QTRY_VERIFY(spy.count() == 1); spy.clear(); + QTRY_VERIFY(spy.size() == 1); spy.clear(); anim->setMirror(true); QCOMPARE(anim->currentFrame(), 1); QImage frame1_flipped = window.grabWindow(); - QTRY_VERIFY(spy.count() == 1); spy.clear(); + QTRY_VERIFY(spy.size() == 1); spy.clear(); QCOMPARE(anim->currentFrame(), 0); // animation only has 2 frames, should cycle back to first QImage frame0_flipped = window.grabWindow(); @@ -336,48 +336,48 @@ void tst_qquickanimatedimage::sourceSizeChanges() // Local ctxt->setContextProperty("srcImage", QUrl("")); QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Null); - QTRY_COMPARE(sourceSizeSpy.count(), 0); + QTRY_COMPARE(sourceSizeSpy.size(), 0); ctxt->setContextProperty("srcImage", testFileUrl("hearts.gif")); QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 1); + QTRY_COMPARE(sourceSizeSpy.size(), 1); ctxt->setContextProperty("srcImage", testFileUrl("hearts.gif")); QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 1); + QTRY_COMPARE(sourceSizeSpy.size(), 1); ctxt->setContextProperty("srcImage", testFileUrl("hearts_copy.gif")); QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 1); + QTRY_COMPARE(sourceSizeSpy.size(), 1); ctxt->setContextProperty("srcImage", testFileUrl("colors.gif")); QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 2); + QTRY_COMPARE(sourceSizeSpy.size(), 2); ctxt->setContextProperty("srcImage", QUrl("")); QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Null); - QTRY_COMPARE(sourceSizeSpy.count(), 3); + QTRY_COMPARE(sourceSizeSpy.size(), 3); // Remote ctxt->setContextProperty("srcImage", server.url("/hearts.gif")); QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 4); + QTRY_COMPARE(sourceSizeSpy.size(), 4); ctxt->setContextProperty("srcImage", server.url("/hearts.gif")); QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 4); + QTRY_COMPARE(sourceSizeSpy.size(), 4); ctxt->setContextProperty("srcImage", server.url("/hearts_copy.gif")); QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 4); + QTRY_COMPARE(sourceSizeSpy.size(), 4); ctxt->setContextProperty("srcImage", server.url("/colors.gif")); QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 5); + QTRY_COMPARE(sourceSizeSpy.size(), 5); ctxt->setContextProperty("srcImage", QUrl("")); QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Null); - QTRY_COMPARE(sourceSizeSpy.count(), 6); + QTRY_COMPARE(sourceSizeSpy.size(), 6); delete anim; } @@ -453,17 +453,17 @@ void tst_qquickanimatedimage::progressAndStatusChanges() ctxt->setContextProperty("srcImage", testFileUrl("stickman.gif")); QTRY_COMPARE(obj->status(), QQuickImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); - QTRY_COMPARE(sourceSpy.count(), 0); - QTRY_COMPARE(progressSpy.count(), 0); - QTRY_COMPARE(statusSpy.count(), 0); + QTRY_COMPARE(sourceSpy.size(), 0); + QTRY_COMPARE(progressSpy.size(), 0); + QTRY_COMPARE(statusSpy.size(), 0); // Loading local file ctxt->setContextProperty("srcImage", testFileUrl("colors.gif")); QTRY_COMPARE(obj->status(), QQuickImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); - QTRY_COMPARE(sourceSpy.count(), 1); - QTRY_COMPARE(progressSpy.count(), 0); - QTRY_COMPARE(statusSpy.count(), 1); + QTRY_COMPARE(sourceSpy.size(), 1); + QTRY_COMPARE(progressSpy.size(), 0); + QTRY_COMPARE(statusSpy.size(), 1); // Loading remote file ctxt->setContextProperty("srcImage", server.url("/stickman.gif")); @@ -471,16 +471,16 @@ void tst_qquickanimatedimage::progressAndStatusChanges() QTRY_COMPARE(obj->progress(), 0.0); QTRY_COMPARE(obj->status(), QQuickImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); - QTRY_COMPARE(sourceSpy.count(), 2); - QTRY_VERIFY(progressSpy.count() > 1); - QTRY_COMPARE(statusSpy.count(), 3); + QTRY_COMPARE(sourceSpy.size(), 2); + QTRY_VERIFY(progressSpy.size() > 1); + QTRY_COMPARE(statusSpy.size(), 3); ctxt->setContextProperty("srcImage", ""); QTRY_COMPARE(obj->status(), QQuickImage::Null); QTRY_COMPARE(obj->progress(), 0.0); - QTRY_COMPARE(sourceSpy.count(), 3); - QTRY_VERIFY(progressSpy.count() > 2); - QTRY_COMPARE(statusSpy.count(), 4); + QTRY_COMPARE(sourceSpy.size(), 3); + QTRY_VERIFY(progressSpy.size() > 2); + QTRY_COMPARE(statusSpy.size(), 4); delete obj; } @@ -506,40 +506,40 @@ void tst_qquickanimatedimage::playingAndPausedChanges() obj->setProperty("paused", false); QTRY_VERIFY(obj->isPlaying()); QTRY_VERIFY(!obj->isPaused()); - QTRY_COMPARE(playingSpy.count(), 0); - QTRY_COMPARE(pausedSpy.count(), 0); + QTRY_COMPARE(playingSpy.size(), 0); + QTRY_COMPARE(pausedSpy.size(), 0); obj->setProperty("playing", false); obj->setProperty("paused", true); QTRY_VERIFY(!obj->isPlaying()); QTRY_VERIFY(obj->isPaused()); - QTRY_COMPARE(playingSpy.count(), 1); - QTRY_COMPARE(pausedSpy.count(), 1); + QTRY_COMPARE(playingSpy.size(), 1); + QTRY_COMPARE(pausedSpy.size(), 1); obj->setProperty("playing", true); obj->setProperty("paused", false); QTRY_VERIFY(obj->isPlaying()); QTRY_VERIFY(!obj->isPaused()); - QTRY_COMPARE(playingSpy.count(), 2); - QTRY_COMPARE(pausedSpy.count(), 2); + QTRY_COMPARE(playingSpy.size(), 2); + QTRY_COMPARE(pausedSpy.size(), 2); ctxt->setContextProperty("srcImage", testFileUrl("stickman.gif")); QTRY_VERIFY(obj->isPlaying()); QTRY_VERIFY(!obj->isPaused()); - QTRY_COMPARE(playingSpy.count(), 2); - QTRY_COMPARE(pausedSpy.count(), 2); + QTRY_COMPARE(playingSpy.size(), 2); + QTRY_COMPARE(pausedSpy.size(), 2); obj->setProperty("paused", true); QTRY_VERIFY(obj->isPlaying()); QTRY_VERIFY(obj->isPaused()); - QTRY_COMPARE(playingSpy.count(), 2); - QTRY_COMPARE(pausedSpy.count(), 3); + QTRY_COMPARE(playingSpy.size(), 2); + QTRY_COMPARE(pausedSpy.size(), 3); obj->setProperty("playing", false); QTRY_VERIFY(!obj->isPlaying()); QTRY_VERIFY(!obj->isPaused()); - QTRY_COMPARE(playingSpy.count(), 3); - QTRY_COMPARE(pausedSpy.count(), 4); + QTRY_COMPARE(playingSpy.size(), 3); + QTRY_COMPARE(pausedSpy.size(), 4); obj->setProperty("playing", true); @@ -547,8 +547,8 @@ void tst_qquickanimatedimage::playingAndPausedChanges() ctxt->setContextProperty("srcImage", testFileUrl("green.png")); QTRY_VERIFY(!obj->isPlaying()); QTRY_VERIFY(!obj->isPaused()); - QTRY_COMPARE(playingSpy.count(), 5); - QTRY_COMPARE(pausedSpy.count(), 4); + QTRY_COMPARE(playingSpy.size(), 5); + QTRY_COMPARE(pausedSpy.size(), 4); delete obj; } @@ -626,15 +626,15 @@ void tst_qquickanimatedimage::currentFrame() anim->setCurrentFrame(1); QCOMPARE(anim->currentFrame(), 1); - QCOMPARE(frameChangedSpy.count(), 1); - QCOMPARE(currentFrameChangedSpy.count(), 1); + QCOMPARE(frameChangedSpy.size(), 1); + QCOMPARE(currentFrameChangedSpy.size(), 1); QCOMPARE(anim->property("currentFrameChangeCount"), 1); QCOMPARE(anim->property("frameChangeCount"), 1); evaluate<void>(anim, "scriptedSetCurrentFrame(2)"); QCOMPARE(anim->currentFrame(), 2); - QCOMPARE(frameChangedSpy.count(), 2); - QCOMPARE(currentFrameChangedSpy.count(), 2); + QCOMPARE(frameChangedSpy.size(), 2); + QCOMPARE(currentFrameChangedSpy.size(), 2); QCOMPARE(anim->property("currentFrameChangeCount"), 2); QCOMPARE(anim->property("frameChangeCount"), 2); } diff --git a/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp index c9f16af86a..72c807bdf8 100644 --- a/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp +++ b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp @@ -63,7 +63,7 @@ void tst_qquickanimatedsprite::test_properties() sprite->setRunning(false); QVERIFY(!sprite->running()); // The finished() signal shouldn't be emitted when running is manually set to false. - QCOMPARE(finishedSpy.count(), 0); + QCOMPARE(finishedSpy.size(), 0); sprite->setInterpolate(false); QVERIFY(!sprite->interpolate()); } @@ -87,11 +87,11 @@ void tst_qquickanimatedsprite::test_runningChangedSignal() QVERIFY(finishedSpy.isValid()); sprite->setRunning(true); - QTRY_COMPARE(runningChangedSpy.count(), 1); - QCOMPARE(finishedSpy.count(), 0); + QTRY_COMPARE(runningChangedSpy.size(), 1); + QCOMPARE(finishedSpy.size(), 0); QTRY_VERIFY(!sprite->running()); - QTRY_COMPARE(runningChangedSpy.count(), 2); - QCOMPARE(finishedSpy.count(), 1); + QTRY_COMPARE(runningChangedSpy.size(), 2); + QCOMPARE(finishedSpy.size(), 1); } void tst_qquickanimatedsprite::test_startStop() @@ -114,12 +114,12 @@ void tst_qquickanimatedsprite::test_startStop() sprite->start(); QVERIFY(sprite->running()); - QTRY_COMPARE(runningChangedSpy.count(), 1); - QCOMPARE(finishedSpy.count(), 0); + QTRY_COMPARE(runningChangedSpy.size(), 1); + QCOMPARE(finishedSpy.size(), 0); sprite->stop(); QVERIFY(!sprite->running()); - QTRY_COMPARE(runningChangedSpy.count(), 2); - QCOMPARE(finishedSpy.count(), 0); + QTRY_COMPARE(runningChangedSpy.size(), 2); + QCOMPARE(finishedSpy.size(), 0); sprite->setCurrentFrame(2); sprite->start(); @@ -154,12 +154,12 @@ void tst_qquickanimatedsprite::test_frameChangedSignal() QVERIFY(!sprite->paused()); QCOMPARE(sprite->loops(), 3); QCOMPARE(sprite->frameCount(), 6); - QCOMPARE(frameChangedSpy.count(), 0); + QCOMPARE(frameChangedSpy.size(), 0); frameChangedSpy.clear(); sprite->setRunning(true); QTRY_VERIFY(!sprite->running()); - QCOMPARE(frameChangedSpy.count(), 3*6 + 1); + QCOMPARE(frameChangedSpy.size(), 3*6 + 1); int prevFrame = -1; int loopCounter = 0; @@ -257,7 +257,7 @@ void tst_qquickanimatedsprite::test_largeAnimation() sprite->setRunning(true); QTRY_VERIFY_WITH_TIMEOUT(!sprite->running(), 100000 /* make sure we wait until its done*/ ); if (frameSync) - QVERIFY(isWithinRange(3*40, int(frameChangedSpy.count()), 3*40 + 1)); + QVERIFY(isWithinRange(3*40, int(frameChangedSpy.size()), 3*40 + 1)); int prevFrame = -1; int loopCounter = 0; int maxFrame = 0; @@ -375,8 +375,8 @@ void tst_qquickanimatedsprite::test_implicitSize() QVERIFY(frameImplicitWidthChangedSpy.isValid()); sprite->setFrameWidth(20); - QCOMPARE(frameWidthChangedSpy.count(), 1); - QCOMPARE(frameImplicitWidthChangedSpy.count(), 1); + QCOMPARE(frameWidthChangedSpy.size(), 1); + QCOMPARE(frameImplicitWidthChangedSpy.size(), 1); // Ensure that implicitHeight matches frameHeight. QSignalSpy frameHeightChangedSpy(sprite, SIGNAL(frameHeightChanged(int))); @@ -386,8 +386,8 @@ void tst_qquickanimatedsprite::test_implicitSize() QVERIFY(frameImplicitHeightChangedSpy.isValid()); sprite->setFrameHeight(20); - QCOMPARE(frameHeightChangedSpy.count(), 1); - QCOMPARE(frameImplicitHeightChangedSpy.count(), 1); + QCOMPARE(frameHeightChangedSpy.size(), 1); + QCOMPARE(frameImplicitHeightChangedSpy.size(), 1); } void tst_qquickanimatedsprite::test_infiniteLoops() @@ -409,7 +409,7 @@ void tst_qquickanimatedsprite::test_infiniteLoops() // The finished() signal shouldn't be emitted for infinite animations. const int previousFrame = sprite->currentFrame(); QTRY_VERIFY(sprite->currentFrame() != previousFrame); - QCOMPARE(finishedSpy.count(), 0); + QCOMPARE(finishedSpy.size(), 0); } void tst_qquickanimatedsprite::test_finishBehavior() diff --git a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp index 4b0e38ba65..f7a84ca979 100644 --- a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp +++ b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp @@ -121,8 +121,8 @@ void tst_qquickanimations::simpleProperty() QCOMPARE(animation.target(), &rect); QCOMPARE(animation.property(), QLatin1String("x")); QCOMPARE(animation.to().toReal(), 200.0); - QCOMPARE(fromChangedSpy.count(), 0); - QCOMPARE(toChangedSpy.count(), 1); + QCOMPARE(fromChangedSpy.size(), 0); + QCOMPARE(toChangedSpy.size(), 1); animation.start(); QVERIFY(animation.isRunning()); QTest::qWait(animation.duration()); @@ -137,8 +137,8 @@ void tst_qquickanimations::simpleProperty() QCOMPARE(animation.currentTime(), 125); QCOMPARE(rect.x(),100.0); animation.setFrom(100); - QCOMPARE(fromChangedSpy.count(), 1); - QCOMPARE(toChangedSpy.count(), 1); + QCOMPARE(fromChangedSpy.size(), 1); + QCOMPARE(toChangedSpy.size(), 1); } void tst_qquickanimations::simpleNumber() @@ -153,8 +153,8 @@ void tst_qquickanimations::simpleNumber() QCOMPARE(animation.target(), &rect); QCOMPARE(animation.property(), QLatin1String("x")); QCOMPARE(animation.to(), qreal(200)); - QCOMPARE(fromChangedSpy.count(), 0); - QCOMPARE(toChangedSpy.count(), 1); + QCOMPARE(fromChangedSpy.size(), 0); + QCOMPARE(toChangedSpy.size(), 1); animation.start(); QVERIFY(animation.isRunning()); QTest::qWait(animation.duration()); @@ -169,8 +169,8 @@ void tst_qquickanimations::simpleNumber() QCOMPARE(animation.currentTime(), 125); QCOMPARE(rect.x(), qreal(100)); animation.setFrom(100); - QCOMPARE(fromChangedSpy.count(), 1); - QCOMPARE(toChangedSpy.count(), 1); + QCOMPARE(fromChangedSpy.size(), 1); + QCOMPARE(toChangedSpy.size(), 1); } void tst_qquickanimations::simpleColor() @@ -185,8 +185,8 @@ void tst_qquickanimations::simpleColor() QCOMPARE(animation.target(), &rect); QCOMPARE(animation.property(), QLatin1String("color")); QCOMPARE(animation.to(), QColor("red")); - QCOMPARE(fromChangedSpy.count(), 0); - QCOMPARE(toChangedSpy.count(), 1); + QCOMPARE(fromChangedSpy.size(), 0); + QCOMPARE(toChangedSpy.size(), 1); animation.start(); QVERIFY(animation.isRunning()); QTest::qWait(animation.duration()); @@ -204,8 +204,8 @@ void tst_qquickanimations::simpleColor() rect.setColor(QColor("green")); animation.setFrom(QColor("blue")); QCOMPARE(animation.from(), QColor("blue")); - QCOMPARE(fromChangedSpy.count(), 1); - QCOMPARE(toChangedSpy.count(), 1); + QCOMPARE(fromChangedSpy.size(), 1); + QCOMPARE(toChangedSpy.size(), 1); animation.restart(); QCOMPARE(rect.color(), QColor("blue")); QVERIFY(animation.isRunning()); @@ -226,8 +226,8 @@ void tst_qquickanimations::simpleRotation() QCOMPARE(animation.property(), QLatin1String("rotation")); QCOMPARE(animation.to(), qreal(270)); QCOMPARE(animation.direction(), QQuickRotationAnimation::Numerical); - QCOMPARE(fromChangedSpy.count(), 0); - QCOMPARE(toChangedSpy.count(), 1); + QCOMPARE(fromChangedSpy.size(), 0); + QCOMPARE(toChangedSpy.size(), 1); animation.start(); QVERIFY(animation.isRunning()); QTest::qWait(animation.duration()); @@ -242,8 +242,8 @@ void tst_qquickanimations::simpleRotation() QCOMPARE(animation.currentTime(), 125); QCOMPARE(rect.rotation(), qreal(135)); animation.setFrom(90); - QCOMPARE(fromChangedSpy.count(), 1); - QCOMPARE(toChangedSpy.count(), 1); + QCOMPARE(fromChangedSpy.size(), 1); + QCOMPARE(toChangedSpy.size(), 1); } void tst_qquickanimations::simplePath() @@ -667,11 +667,11 @@ void tst_qquickanimations::resume() QSignalSpy spy(&animation, SIGNAL(pausedChanged(bool))); animation.pause(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QVERIFY(animation.isPaused()); animation.stop(); QVERIFY(!animation.isPaused()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); // Load QtQuick to ensure that QQuickPropertyAnimation is registered as PropertyAnimation { @@ -683,12 +683,12 @@ void tst_qquickanimations::resume() QByteArray message = "<Unknown File>: QML PropertyAnimation: setPaused() cannot be used when animation isn't running."; QTest::ignoreMessage(QtWarningMsg, message); animation.pause(); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QVERIFY(!animation.isPaused()); animation.resume(); QVERIFY(!animation.isPaused()); QVERIFY(!animation.isRunning()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_qquickanimations::dotProperty() @@ -727,7 +727,7 @@ void tst_qquickanimations::badTypes() QScopedPointer<QObject> obj(c.create()); QVERIFY(obj.isNull()); - QCOMPARE(c.errors().count(), 1); + QCOMPARE(c.errors().size(), 1); QCOMPARE(c.errors().at(0).description(), QLatin1String("Invalid property assignment: number expected")); } @@ -739,7 +739,7 @@ void tst_qquickanimations::badTypes() QScopedPointer<QObject> obj(c.create()); QVERIFY(obj.isNull()); - QCOMPARE(c.errors().count(), 1); + QCOMPARE(c.errors().size(), 1); QCOMPARE(c.errors().at(0).description(), QLatin1String("Invalid property assignment: color expected")); } @@ -1047,12 +1047,12 @@ void tst_qquickanimations::disabledTransition() QSignalSpy runningSpy(trans, SIGNAL(runningChanged())); QQuickItemPrivate::get(rect)->setState(""); QCOMPARE(myRect->x(),qreal(200)); - QCOMPARE(runningSpy.count(), 1); //stopped -> running + QCOMPARE(runningSpy.size(), 1); //stopped -> running QVERIFY(trans->running()); QTest::qWait(300); QTIMED_COMPARE(myRect->x(),qreal(100)); QVERIFY(!trans->running()); - QCOMPARE(runningSpy.count(), 2); //running -> stopped + QCOMPARE(runningSpy.size(), 2); //running -> stopped } void tst_qquickanimations::invalidDuration() @@ -1226,7 +1226,7 @@ void tst_qquickanimations::easingProperties() QVERIFY(animObject != nullptr); QCOMPARE(animObject->easing().type(), QEasingCurve::BezierSpline); QVector<QPointF> points = animObject->easing().toCubicSpline(); - QCOMPARE(points.count(), 3); + QCOMPARE(points.size(), 3); QCOMPARE(points.at(0), QPointF(0.5, 0.2)); QCOMPARE(points.at(1), QPointF(0.13, 0.65)); QCOMPARE(points.at(2), QPointF(1.0, 1.0)); @@ -1355,7 +1355,7 @@ void tst_qquickanimations::signalOrder() colorAnimation->setDuration(duration); animation->start(); - QTRY_VERIFY(finishedSpy.count()); + QTRY_VERIFY(finishedSpy.size()); QCOMPARE(actualSignalOrder, expectedSignalOrder); } @@ -1678,7 +1678,7 @@ void tst_qquickanimations::unsetAnimatorProxyJobWindow() item.setParentItem(&dummy); QSignalSpy spy(&window, SIGNAL(sceneGraphInitialized())); window.show(); - if (spy.count() < 1) + if (spy.size() < 1) spy.wait(); QCOMPARE(proxy.job().data(), job); } @@ -1705,8 +1705,8 @@ void tst_qquickanimations::finished() QVERIFY(finishedSpy.isValid()); QVERIFY(simpleTopLevelAnimation->setProperty("running", QVariant(true))); - QTRY_COMPARE(stoppedSpy.count(), 1); - QCOMPARE(finishedSpy.count(), 1); + QTRY_COMPARE(stoppedSpy.size(), 1); + QCOMPARE(finishedSpy.size(), 1); // Test that the signal is properly revisioned and hence accessible from QML. QCOMPARE(root->property("finishedUsableInQml").toBool(), true); @@ -1733,9 +1733,9 @@ void tst_qquickanimations::finished() QObject *transitionRect = root->property("transitionRect").value<QObject*>(); QVERIFY(transitionRect); QVERIFY(transitionRect->setProperty("state", QVariant(QLatin1String("go")))); - QTRY_COMPARE(runningChangedSpy.count(), 1); - QCOMPARE(stoppedSpy.count(), 0); - QCOMPARE(finishedSpy.count(), 0); + QTRY_COMPARE(runningChangedSpy.size(), 1); + QCOMPARE(stoppedSpy.size(), 0); + QCOMPARE(finishedSpy.size(), 0); } // Test that finished() is not emitted for animations within a Behavior. @@ -1752,8 +1752,8 @@ void tst_qquickanimations::finished() QVERIFY(root->setProperty("bar", QVariant(1.0))); QTRY_COMPARE(root->property("bar").toReal(), 1.0); - QCOMPARE(stoppedSpy.count(), 0); - QCOMPARE(finishedSpy.count(), 0); + QCOMPARE(stoppedSpy.size(), 0); + QCOMPARE(finishedSpy.size(), 0); } } @@ -2095,8 +2095,8 @@ void tst_qquickanimations::changePropertiesDuringAnimation() // mid-animation. if (loops != QQuickAbstractAnimation::Infinite) QVERIFY(numberAnimation->qtAnimation()->currentLoop() < numberAnimation->loops()); - QCOMPARE(startedSpy.count(), 0); - QCOMPARE(stoppedSpy.count(), 0); + QCOMPARE(startedSpy.size(), 0); + QCOMPARE(stoppedSpy.size(), 0); } void tst_qquickanimations::infiniteLoopsWithoutFrom() diff --git a/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp b/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp index e65a67c045..5ea11729d8 100644 --- a/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp +++ b/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp @@ -341,7 +341,7 @@ void tst_qquickbehaviors::runningTrue() QSignalSpy runningSpy(animation, SIGNAL(runningChanged(bool))); rect->setProperty("myValue", 180); - QTRY_VERIFY(runningSpy.count() > 0); + QTRY_VERIFY(runningSpy.size() > 0); } //QTBUG-12295 @@ -579,7 +579,7 @@ void tst_qquickbehaviors::aliasedProperty() QSignalSpy targetValueSpy(behavior, SIGNAL(targetValueChanged())); QQuickItemPrivate::get(rect.data())->setState("moved"); QCOMPARE(behavior->targetValue(), 400); - QCOMPARE(targetValueSpy.count(), 1); + QCOMPARE(targetValueSpy.size(), 1); QScopedPointer<QQuickRectangle> acc(qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("acc"))); QScopedPointer<QQuickRectangle> range(qobject_cast<QQuickRectangle*>(acc->findChild<QQuickRectangle*>("range"))); QTRY_VERIFY(acc->property("value").toDouble() > 0); @@ -615,7 +615,7 @@ void tst_qquickbehaviors::oneWay() QQuickRectangle *myRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRectOneWay")); myRect->setProperty("x", 100); QCOMPARE(behavior->targetValue(), 100); - QCOMPARE(targetValueSpy.count(), 1); + QCOMPARE(targetValueSpy.size(), 1); QCOMPARE(behavior->enabled(), false); qreal x = myRect->x(); QCOMPARE(x, qreal(100)); //should change immediately @@ -625,7 +625,7 @@ void tst_qquickbehaviors::oneWay() myRect->setProperty("x", 0); QCOMPARE(behavior->targetValue(), 0); - QCOMPARE(targetValueSpy.count(), 2); + QCOMPARE(targetValueSpy.size(), 2); QCOMPARE(behavior->enabled(), true); QCOMPARE(myAnimation->isRunning(), true); QVERIFY(myRect->x() > 0.0); diff --git a/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp b/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp index 793ab8d8c9..a217c4ea1b 100644 --- a/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp +++ b/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp @@ -435,7 +435,7 @@ void tst_qquickborderimage::statusChanges() if (remote) server.sendDelayedItem(); QTRY_COMPARE(obj->status(), finalStatus); - QCOMPARE(spy.count(), emissions); + QCOMPARE(spy.size(), emissions); delete obj; } @@ -460,48 +460,48 @@ void tst_qquickborderimage::sourceSizeChanges() // Local ctxt->setContextProperty("srcImage", QUrl("")); QTRY_COMPARE(obj->status(), QQuickBorderImage::Null); - QTRY_COMPARE(sourceSizeSpy.count(), 0); + QTRY_COMPARE(sourceSizeSpy.size(), 0); ctxt->setContextProperty("srcImage", testFileUrl("heart200.png")); QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 1); + QTRY_COMPARE(sourceSizeSpy.size(), 1); ctxt->setContextProperty("srcImage", testFileUrl("heart200.png")); QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 1); + QTRY_COMPARE(sourceSizeSpy.size(), 1); ctxt->setContextProperty("srcImage", testFileUrl("heart200_copy.png")); QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 1); + QTRY_COMPARE(sourceSizeSpy.size(), 1); ctxt->setContextProperty("srcImage", testFileUrl("colors.png")); QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 2); + QTRY_COMPARE(sourceSizeSpy.size(), 2); ctxt->setContextProperty("srcImage", QUrl("")); QTRY_COMPARE(obj->status(), QQuickBorderImage::Null); - QTRY_COMPARE(sourceSizeSpy.count(), 3); + QTRY_COMPARE(sourceSizeSpy.size(), 3); // Remote ctxt->setContextProperty("srcImage", server.url("/heart200.png")); QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 4); + QTRY_COMPARE(sourceSizeSpy.size(), 4); ctxt->setContextProperty("srcImage", server.url("/heart200.png")); QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 4); + QTRY_COMPARE(sourceSizeSpy.size(), 4); ctxt->setContextProperty("srcImage", server.url("/heart200_copy.png")); QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 4); + QTRY_COMPARE(sourceSizeSpy.size(), 4); ctxt->setContextProperty("srcImage", server.url("/colors.png")); QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 5); + QTRY_COMPARE(sourceSizeSpy.size(), 5); ctxt->setContextProperty("srcImage", QUrl("")); QTRY_COMPARE(obj->status(), QQuickBorderImage::Null); - QTRY_COMPARE(sourceSizeSpy.count(), 6); + QTRY_COMPARE(sourceSizeSpy.size(), 6); delete obj; } @@ -532,17 +532,17 @@ void tst_qquickborderimage::progressAndStatusChanges() ctxt->setContextProperty("srcImage", testFileUrl("heart200.png")); QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); - QTRY_COMPARE(sourceSpy.count(), 0); - QTRY_COMPARE(progressSpy.count(), 0); - QTRY_COMPARE(statusSpy.count(), 0); + QTRY_COMPARE(sourceSpy.size(), 0); + QTRY_COMPARE(progressSpy.size(), 0); + QTRY_COMPARE(statusSpy.size(), 0); // Loading local file ctxt->setContextProperty("srcImage", testFileUrl("colors.png")); QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); - QTRY_COMPARE(sourceSpy.count(), 1); - QTRY_COMPARE(progressSpy.count(), 0); - QTRY_COMPARE(statusSpy.count(), 1); + QTRY_COMPARE(sourceSpy.size(), 1); + QTRY_COMPARE(progressSpy.size(), 0); + QTRY_COMPARE(statusSpy.size(), 1); // Loading remote file ctxt->setContextProperty("srcImage", server.url("/heart200.png")); @@ -550,16 +550,16 @@ void tst_qquickborderimage::progressAndStatusChanges() QTRY_COMPARE(obj->progress(), 0.0); QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); - QTRY_COMPARE(sourceSpy.count(), 2); - QTRY_VERIFY(progressSpy.count() > 1); - QTRY_COMPARE(statusSpy.count(), 3); + QTRY_COMPARE(sourceSpy.size(), 2); + QTRY_VERIFY(progressSpy.size() > 1); + QTRY_COMPARE(statusSpy.size(), 3); ctxt->setContextProperty("srcImage", ""); QTRY_COMPARE(obj->status(), QQuickBorderImage::Null); QTRY_COMPARE(obj->progress(), 0.0); - QTRY_COMPARE(sourceSpy.count(), 3); - QTRY_VERIFY(progressSpy.count() > 2); - QTRY_COMPARE(statusSpy.count(), 4); + QTRY_COMPARE(sourceSpy.size(), 3); + QTRY_VERIFY(progressSpy.size() > 2); + QTRY_COMPARE(statusSpy.size(), 4); delete obj; } @@ -614,7 +614,7 @@ void tst_qquickborderimage::multiFrame() if (asynchronous) { QCOMPARE(image->frameCount(), 0); QTRY_COMPARE(image->frameCount(), 4); - QCOMPARE(countSpy.count(), 1); + QCOMPARE(countSpy.size(), 1); } else { QCOMPARE(image->frameCount(), 4); } @@ -636,7 +636,7 @@ void tst_qquickborderimage::multiFrame() image->setCurrentFrame(1); QTRY_COMPARE(image->status(), QQuickImageBase::Ready); - QCOMPARE(currentSpy.count(), 1); + QCOMPARE(currentSpy.size(), 1); QCOMPARE(image->currentFrame(), 1); contents = view.grabWindow(); // The middle of the second frame looks green, approximately qRgba(0x3a, 0xd2, 0x31, 0xff) diff --git a/tests/auto/quick/qquickboundaryrule/tst_qquickboundaryrule.cpp b/tests/auto/quick/qquickboundaryrule/tst_qquickboundaryrule.cpp index e5b33bb1c2..2964238849 100644 --- a/tests/auto/quick/qquickboundaryrule/tst_qquickboundaryrule.cpp +++ b/tests/auto/quick/qquickboundaryrule/tst_qquickboundaryrule.cpp @@ -55,26 +55,26 @@ void tst_qquickboundaryrule::dragHandler() QVERIFY(ok); QCOMPARE(boundaryRule->property("peakOvershoot").toReal(&ok), 0); QVERIFY(ok); - QCOMPARE(overshootChangedSpy.count(), 0); + QCOMPARE(overshootChangedSpy.size(), 0); // restricted drag: halfway into overshoot p1 += QPoint(20, 0); QTest::mouseMove(&window, p1); QCOMPARE(target->position().x(), 117.5); QCOMPARE(boundaryRule->property("currentOvershoot").toReal(), 20); QCOMPARE(boundaryRule->property("peakOvershoot").toReal(), 20); - QCOMPARE(overshootChangedSpy.count(), 1); + QCOMPARE(overshootChangedSpy.size(), 1); // restricted drag: maximum overshoot p1 += QPoint(80, 0); QTest::mouseMove(&window, p1); QCOMPARE(target->position().x(), 140); QCOMPARE(boundaryRule->property("currentOvershoot").toReal(), 100); QCOMPARE(boundaryRule->property("peakOvershoot").toReal(), 100); - QCOMPARE(overshootChangedSpy.count(), 2); + QCOMPARE(overshootChangedSpy.size(), 2); // release and let it return to bounds QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p1); QTRY_COMPARE(dragHandler->active(), false); - QTRY_COMPARE(returnedSpy.count(), 1); - QCOMPARE(overshootChangedSpy.count(), 3); + QTRY_COMPARE(returnedSpy.size(), 1); + QCOMPARE(overshootChangedSpy.size(), 3); QCOMPARE(boundaryRule->property("currentOvershoot").toReal(&ok), 0); QVERIFY(ok); QCOMPARE(boundaryRule->property("peakOvershoot").toReal(&ok), 0); diff --git a/tests/auto/quick/qquickcolorgroup/tst_qquickcolorgroup.cpp b/tests/auto/quick/qquickcolorgroup/tst_qquickcolorgroup.cpp index f1bc591bd3..046cd5a14c 100644 --- a/tests/auto/quick/qquickcolorgroup/tst_qquickcolorgroup.cpp +++ b/tests/auto/quick/qquickcolorgroup/tst_qquickcolorgroup.cpp @@ -46,7 +46,7 @@ void tst_QQuickColorGroup::checkColorProperty() qvariant_cast<QColor>(property.read(&defaultGroup))); constexpr int expectedNotificationsCount = 2; // One from write + one from reset - QCOMPARE(sp.count(), expectedNotificationsCount); + QCOMPARE(sp.size(), expectedNotificationsCount); } void tst_QQuickColorGroup::checkColorProperty_data() @@ -73,7 +73,7 @@ void tst_QQuickColorGroup::colorGroupChangedWhenColorChanged() group.setMid(Qt::blue); - QCOMPARE(sp.count(), 1); + QCOMPARE(sp.size(), 1); } QTEST_MAIN(tst_QQuickColorGroup) diff --git a/tests/auto/quick/qquickdeliveryagent/tst_qquickdeliveryagent.cpp b/tests/auto/quick/qquickdeliveryagent/tst_qquickdeliveryagent.cpp index ab462fce72..1c917e207b 100644 --- a/tests/auto/quick/qquickdeliveryagent/tst_qquickdeliveryagent.cpp +++ b/tests/auto/quick/qquickdeliveryagent/tst_qquickdeliveryagent.cpp @@ -178,7 +178,7 @@ void tst_qquickdeliveryagent::passiveGrabberOrder() auto devPriv = QPointingDevicePrivate::get(QPointingDevice::primaryPointingDevice()); const auto &persistentPoint = devPriv->activePoints.values().first(); qCDebug(lcTests) << "passive grabbers" << persistentPoint.passiveGrabbers << "contexts" << persistentPoint.passiveGrabbersContext; - QCOMPARE(persistentPoint.passiveGrabbers.count(), 2); + QCOMPARE(persistentPoint.passiveGrabbers.size(), 2); QCOMPARE(persistentPoint.passiveGrabbers.first(), subsceneTap); QCOMPARE(persistentPoint.passiveGrabbersContext.first(), subscene.deliveryAgent); QCOMPARE(persistentPoint.passiveGrabbers.last(), rootTap); @@ -186,10 +186,10 @@ void tst_qquickdeliveryagent::passiveGrabberOrder() QTest::mouseRelease(&view, Qt::LeftButton); QTest::qWait(100); // QQuickWindow::event() has failsafe: clear all grabbers after release - QCOMPARE(persistentPoint.passiveGrabbers.count(), 0); + QCOMPARE(persistentPoint.passiveGrabbers.size(), 0); qCDebug(lcTests) << "TapHandlers emitted tapped in this order:" << spy.senders; - QCOMPARE(spy.senders.count(), 2); + QCOMPARE(spy.senders.size(), 2); // passive grabbers are visited in order, and emit tapped() at that time QCOMPARE(spy.senders.first(), subsceneTap); QCOMPARE(spy.senders.last(), rootTap); @@ -278,7 +278,7 @@ void tst_qquickdeliveryagent::passiveGrabberItems() QTest::mousePress(&view, Qt::LeftButton, Qt::NoModifier, QPoint(exclusiveGrabber->x() + 1, exclusiveGrabber->y() + 1)); auto devPriv = QPointingDevicePrivate::get(QPointingDevice::primaryPointingDevice()); const auto &persistentPoint = devPriv->activePoints.values().first(); - QTRY_COMPARE(persistentPoint.passiveGrabbers.count(), 1); + QTRY_COMPARE(persistentPoint.passiveGrabbers.size(), 1); QCOMPARE(persistentPoint.passiveGrabbers.first(), passiveGrabber); QCOMPARE(persistentPoint.exclusiveGrabber, exclusiveGrabber); QVERIFY(exclusiveGrabber->lastPressed); @@ -294,7 +294,7 @@ void tst_qquickdeliveryagent::passiveGrabberItems() // since it became the exclusive grabber on mouseMove QTRY_VERIFY(!passiveGrabber->lastPressed); QVERIFY(exclusiveGrabber->lastPressed); - QCOMPARE(persistentPoint.passiveGrabbers.count(), 0); + QCOMPARE(persistentPoint.passiveGrabbers.size(), 0); QCOMPARE(persistentPoint.exclusiveGrabber, nullptr); exclusiveGrabber->lastPressed = false; @@ -303,7 +303,7 @@ void tst_qquickdeliveryagent::passiveGrabberItems() QTest::mousePress(&view, Qt::LeftButton, Qt::NoModifier, QPoint(exclusiveGrabber->x() + 1, exclusiveGrabber->y() + 1)); const auto &pressedPoint = devPriv->activePoints.values().first(); - QTRY_COMPARE(pressedPoint.passiveGrabbers.count(), 1); + QTRY_COMPARE(pressedPoint.passiveGrabbers.size(), 1); QCOMPARE(pressedPoint.passiveGrabbers.first(), passiveGrabber); QCOMPARE(pressedPoint.exclusiveGrabber, exclusiveGrabber); QVERIFY(exclusiveGrabber->lastPressed); @@ -318,7 +318,7 @@ void tst_qquickdeliveryagent::passiveGrabberItems() // Both the passive and the exclusive grabber get the mouseRelease event QTRY_VERIFY(!passiveGrabber->lastPressed); QVERIFY(!exclusiveGrabber->lastPressed); - QCOMPARE(pressedPoint.passiveGrabbers.count(), 0); + QCOMPARE(pressedPoint.passiveGrabbers.size(), 0); QCOMPARE(pressedPoint.exclusiveGrabber, nullptr); } @@ -352,7 +352,7 @@ void tst_qquickdeliveryagent::tapHandlerDoesntOverrideSubsceneGrabber() // QTBUG QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, clickPos); qCDebug(lcTests) << "clicking subscene TextEdit set cursorPos to" << cursorPos; QVERIFY(textEdit->property("cursorPosition").toInt() > cursorPos); - QCOMPARE(clickSpy.count(), 0); // doesn't tap + QCOMPARE(clickSpy.size(), 0); // doesn't tap } void tst_qquickdeliveryagent::undoDelegationWhenSubsceneFocusCleared() // QTBUG-105192 diff --git a/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp b/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp index 04d2784f20..c35f31b8f2 100644 --- a/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp +++ b/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp @@ -344,7 +344,7 @@ void tst_qquickdesignersupport::basicStates() QVERIFY(stateGroup); - QCOMPARE(stateGroup->states().count(), 2 ); + QCOMPARE(stateGroup->states().size(), 2 ); QQuickState *state01 = stateGroup->states().first(); QQuickState *state02 = stateGroup->states().last(); @@ -390,7 +390,7 @@ void tst_qquickdesignersupport::statesPropertyChanges() QVERIFY(stateGroup); - QCOMPARE(stateGroup->states().count(), 2 ); + QCOMPARE(stateGroup->states().size(), 2 ); QQuickState *state01 = stateGroup->states().first(); QQuickState *state02 = stateGroup->states().last(); @@ -409,7 +409,7 @@ void tst_qquickdesignersupport::statesPropertyChanges() QCOMPARE(state01->operationCount(), 1); - QCOMPARE(statePrivate01->operations.count(), 1); + QCOMPARE(statePrivate01->operations.size(), 1); QQuickStateOperation *propertyChange = statePrivate01->operations.at(0).data(); @@ -444,7 +444,7 @@ void tst_qquickdesignersupport::statesPropertyChanges() QCOMPARE(rootItem, QQuickDesignerSupportPropertyChanges::targetObject(newPropertyChange)); QCOMPARE(state01->operationCount(), 2); - QCOMPARE(statePrivate01->operations.count(), 2); + QCOMPARE(statePrivate01->operations.size(), 2); QCOMPARE(QQuickDesignerSupportPropertyChanges::stateObject(newPropertyChange), state01); diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp index 89fe6b373b..2d0681e9b8 100644 --- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp +++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp @@ -73,7 +73,7 @@ public: protected: void touchEvent(QTouchEvent *ev) override { - QCOMPARE(ev->points().count(), 1); + QCOMPARE(ev->points().size(), 1); auto touchpoint = ev->points().first(); switch (touchpoint.state()) { case QEventPoint::State::Pressed: @@ -353,27 +353,27 @@ void tst_qquickflickable::boundsBehavior() flickable->setBoundsBehavior(QQuickFlickable::DragAndOvershootBounds); QCOMPARE(flickable->boundsBehavior(), QQuickFlickable::DragAndOvershootBounds); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); flickable->setBoundsBehavior(QQuickFlickable::DragAndOvershootBounds); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); flickable->setBoundsBehavior(QQuickFlickable::DragOverBounds); QCOMPARE(flickable->boundsBehavior(), QQuickFlickable::DragOverBounds); - QCOMPARE(spy.count(),2); + QCOMPARE(spy.size(),2); flickable->setBoundsBehavior(QQuickFlickable::DragOverBounds); - QCOMPARE(spy.count(),2); + QCOMPARE(spy.size(),2); flickable->setBoundsBehavior(QQuickFlickable::StopAtBounds); QCOMPARE(flickable->boundsBehavior(), QQuickFlickable::StopAtBounds); - QCOMPARE(spy.count(),3); + QCOMPARE(spy.size(),3); flickable->setBoundsBehavior(QQuickFlickable::StopAtBounds); - QCOMPARE(spy.count(),3); + QCOMPARE(spy.size(),3); flickable->setBoundsBehavior(QQuickFlickable::OvershootBounds); QCOMPARE(flickable->boundsBehavior(), QQuickFlickable::OvershootBounds); - QCOMPARE(spy.count(),4); + QCOMPARE(spy.size(),4); flickable->setBoundsBehavior(QQuickFlickable::OvershootBounds); - QCOMPARE(spy.count(),4); + QCOMPARE(spy.size(),4); delete flickable; } @@ -406,23 +406,23 @@ void tst_qquickflickable::rebound() flick(window.data(), QPoint(20,20), QPoint(120,120), 200); QTRY_COMPARE(window->rootObject()->property("transitionsStarted").toInt(), 2); - QCOMPARE(hMoveSpy.count(), 1); - QCOMPARE(vMoveSpy.count(), 1); - QCOMPARE(movementStartedSpy.count(), 1); - QCOMPARE(movementEndedSpy.count(), 0); + QCOMPARE(hMoveSpy.size(), 1); + QCOMPARE(vMoveSpy.size(), 1); + QCOMPARE(movementStartedSpy.size(), 1); + QCOMPARE(movementEndedSpy.size(), 0); QVERIFY(rebound->running()); QTRY_VERIFY(!flickable->isMoving()); QCOMPARE(flickable->contentX(), 0.0); QCOMPARE(flickable->contentY(), 0.0); - QCOMPARE(hMoveSpy.count(), 2); - QCOMPARE(vMoveSpy.count(), 2); - QCOMPARE(movementStartedSpy.count(), 1); - QCOMPARE(movementEndedSpy.count(), 1); + QCOMPARE(hMoveSpy.size(), 2); + QCOMPARE(vMoveSpy.size(), 2); + QCOMPARE(movementStartedSpy.size(), 1); + QCOMPARE(movementEndedSpy.size(), 1); QCOMPARE(window->rootObject()->property("transitionsStarted").toInt(), 2); QVERIFY(!rebound->running()); - QCOMPARE(reboundSpy.count(), 2); + QCOMPARE(reboundSpy.size(), 2); hMoveSpy.clear(); vMoveSpy.clear(); @@ -438,19 +438,19 @@ void tst_qquickflickable::rebound() QVERIFY(flickable->isMoving()); QTRY_VERIFY(window->rootObject()->property("transitionsStarted").toInt() >= 1); - QCOMPARE(hMoveSpy.count(), 1); - QCOMPARE(vMoveSpy.count(), 1); - QCOMPARE(movementStartedSpy.count(), 1); + QCOMPARE(hMoveSpy.size(), 1); + QCOMPARE(vMoveSpy.size(), 1); + QCOMPARE(movementStartedSpy.size(), 1); QTRY_VERIFY(!flickable->isMoving()); QCOMPARE(flickable->contentX(), 0.0); // moving started/stopped signals should only have been emitted once, // and when they are, all transitions should have finished - QCOMPARE(hMoveSpy.count(), 2); - QCOMPARE(vMoveSpy.count(), 2); - QCOMPARE(movementStartedSpy.count(), 1); - QCOMPARE(movementEndedSpy.count(), 1); + QCOMPARE(hMoveSpy.size(), 2); + QCOMPARE(vMoveSpy.size(), 2); + QCOMPARE(movementStartedSpy.size(), 1); + QCOMPARE(movementEndedSpy.size(), 1); hMoveSpy.clear(); vMoveSpy.clear(); @@ -465,16 +465,16 @@ void tst_qquickflickable::rebound() flick(window.data(), QPoint(20,20), QPoint(120,120), 200); QCOMPARE(window->rootObject()->property("transitionsStarted").toInt(), 0); - QCOMPARE(hMoveSpy.count(), 1); - QCOMPARE(vMoveSpy.count(), 1); - QCOMPARE(movementStartedSpy.count(), 1); - QCOMPARE(movementEndedSpy.count(), 0); + QCOMPARE(hMoveSpy.size(), 1); + QCOMPARE(vMoveSpy.size(), 1); + QCOMPARE(movementStartedSpy.size(), 1); + QCOMPARE(movementEndedSpy.size(), 0); QTRY_VERIFY(!flickable->isMoving()); - QCOMPARE(hMoveSpy.count(), 2); - QCOMPARE(vMoveSpy.count(), 2); - QCOMPARE(movementStartedSpy.count(), 1); - QCOMPARE(movementEndedSpy.count(), 1); + QCOMPARE(hMoveSpy.size(), 2); + QCOMPARE(vMoveSpy.size(), 2); + QCOMPARE(movementStartedSpy.size(), 1); + QCOMPARE(movementEndedSpy.size(), 1); QCOMPARE(window->rootObject()->property("transitionsStarted").toInt(), 0); } @@ -491,9 +491,9 @@ void tst_qquickflickable::maximumFlickVelocity() flickable->setMaximumFlickVelocity(2.0); QCOMPARE(flickable->maximumFlickVelocity(), 2.0); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); flickable->setMaximumFlickVelocity(2.0); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); delete flickable; } @@ -511,9 +511,9 @@ void tst_qquickflickable::flickDeceleration() flickable->setFlickDeceleration(2.0); QCOMPARE(flickable->flickDeceleration(), 2.0); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); flickable->setFlickDeceleration(2.0); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); delete flickable; } @@ -537,9 +537,9 @@ void tst_qquickflickable::pressDelay() flickable->setPressDelay(200); QCOMPARE(flickable->pressDelay(), 200); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); flickable->setPressDelay(200); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); QQuickItem *mouseArea = window->rootObject()->findChild<QQuickItem*>("mouseArea"); QSignalSpy clickedSpy(mouseArea, SIGNAL(clicked(QQuickMouseEvent*))); @@ -552,11 +552,11 @@ void tst_qquickflickable::pressDelay() // But, it should occur eventually QTRY_VERIFY(mouseArea->property("pressed").toBool()); - QCOMPARE(clickedSpy.count(),0); + QCOMPARE(clickedSpy.size(),0); // On release the clicked signal should be emitted QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(150, 150)); - QCOMPARE(clickedSpy.count(),1); + QCOMPARE(clickedSpy.size(),1); // Press and release position should match QCOMPARE(flickable->property("pressX").toReal(), flickable->property("releaseX").toReal()); @@ -570,11 +570,11 @@ void tst_qquickflickable::pressDelay() // The press should not occur immediately QVERIFY(!mouseArea->property("pressed").toBool()); - QCOMPARE(clickedSpy.count(),0); + QCOMPARE(clickedSpy.size(),0); // On release the press, release and clicked signal should be emitted QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(180, 180)); - QCOMPARE(clickedSpy.count(),1); + QCOMPARE(clickedSpy.size(),1); // Press and release position should match QCOMPARE(flickable->property("pressX").toReal(), flickable->property("releaseX").toReal()); @@ -595,7 +595,7 @@ void tst_qquickflickable::pressDelay() // On release the clicked signal should *not* be emitted QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(150, 190)); - QCOMPARE(clickedSpy.count(),1); + QCOMPARE(clickedSpy.size(),1); } // QTBUG-17361 @@ -779,19 +779,19 @@ void tst_qquickflickable::flickableDirection() flickable->setFlickableDirection(QQuickFlickable::HorizontalAndVerticalFlick); QCOMPARE(flickable->flickableDirection(), QQuickFlickable::HorizontalAndVerticalFlick); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); flickable->setFlickableDirection(QQuickFlickable::AutoFlickDirection); QCOMPARE(flickable->flickableDirection(), QQuickFlickable::AutoFlickDirection); - QCOMPARE(spy.count(),2); + QCOMPARE(spy.size(),2); flickable->setFlickableDirection(QQuickFlickable::HorizontalFlick); QCOMPARE(flickable->flickableDirection(), QQuickFlickable::HorizontalFlick); - QCOMPARE(spy.count(),3); + QCOMPARE(spy.size(),3); flickable->setFlickableDirection(QQuickFlickable::HorizontalFlick); QCOMPARE(flickable->flickableDirection(), QQuickFlickable::HorizontalFlick); - QCOMPARE(spy.count(),3); + QCOMPARE(spy.size(),3); delete flickable; } @@ -864,7 +864,7 @@ void tst_qquickflickable::returnToBounds() QTRY_COMPARE(obj->contentY(), 0.); QVERIFY(!rebound->running()); - QCOMPARE(reboundSpy.count(), setRebound ? 2 : 0); + QCOMPARE(reboundSpy.size(), setRebound ? 2 : 0); } void tst_qquickflickable::returnToBounds_data() @@ -902,7 +902,7 @@ void tst_qquickflickable::wheel() QTRY_VERIFY(flick->contentY() > 0); QCOMPARE(flick->contentX(), qreal(0)); - QTRY_COMPARE(moveEndSpy.count(), 1); + QTRY_COMPARE(moveEndSpy.size(), 1); QCOMPARE(fp->velocityTimeline.isActive(), false); QCOMPARE(fp->timeline.isActive(), false); QTest::qWait(50); // make sure that onContentYChanged won't sneak in again @@ -927,7 +927,7 @@ void tst_qquickflickable::wheel() QTRY_VERIFY(flick->contentX() > 0); QCOMPARE(flick->contentY(), qreal(0)); - QTRY_COMPARE(moveEndSpy.count(), 2); + QTRY_COMPARE(moveEndSpy.size(), 2); QCOMPARE(fp->velocityTimeline.isActive(), false); QCOMPARE(fp->timeline.isActive(), false); QTest::qWait(50); // make sure that onContentXChanged won't sneak in again @@ -981,7 +981,7 @@ void tst_qquickflickable::trackpad() QGuiApplication::sendEvent(window.data(), &event); } - QTRY_COMPARE(moveEndSpy.count(), 1); // QTBUG-55871 + QTRY_COMPARE(moveEndSpy.size(), 1); // QTBUG-55871 QCOMPARE(flick->property("movementsAfterEnd").value<int>(), 0); // QTBUG-55886 } @@ -1018,7 +1018,7 @@ void tst_qquickflickable::nestedTrackpad() event.setTimestamp(timestamp++); QGuiApplication::sendEvent(&window, &event); } - QTRY_COMPARE(innerMoveEndSpy.count(), 1); + QTRY_COMPARE(innerMoveEndSpy.size(), 1); innerFlickable->setContentX(0); QCOMPARE(innerFlickable->contentX(), qreal(0)); @@ -1042,7 +1042,7 @@ void tst_qquickflickable::nestedTrackpad() event.setTimestamp(timestamp++); QGuiApplication::sendEvent(&window, &event); } - QTRY_COMPARE(outerMoveEndSpy.count(), 1); + QTRY_COMPARE(outerMoveEndSpy.size(), 1); } void tst_qquickflickable::movingAndFlicking_data() @@ -1114,15 +1114,15 @@ void tst_qquickflickable::movingAndFlicking() QCOMPARE(flickable->property("movingInContentX").value<bool>(), true); QCOMPARE(flickable->property("movingInContentY").value<bool>(), true); - QCOMPARE(moveSpy.count(), 1); - QCOMPARE(vMoveSpy.count(), verticalEnabled ? 1 : 0); - QCOMPARE(hMoveSpy.count(), horizontalEnabled ? 1 : 0); - QCOMPARE(flickSpy.count(), 1); - QCOMPARE(vFlickSpy.count(), verticalEnabled ? 1 : 0); - QCOMPARE(hFlickSpy.count(), horizontalEnabled ? 1 : 0); + QCOMPARE(moveSpy.size(), 1); + QCOMPARE(vMoveSpy.size(), verticalEnabled ? 1 : 0); + QCOMPARE(hMoveSpy.size(), horizontalEnabled ? 1 : 0); + QCOMPARE(flickSpy.size(), 1); + QCOMPARE(vFlickSpy.size(), verticalEnabled ? 1 : 0); + QCOMPARE(hFlickSpy.size(), horizontalEnabled ? 1 : 0); - QCOMPARE(moveStartSpy.count(), 1); - QCOMPARE(flickStartSpy.count(), 1); + QCOMPARE(moveStartSpy.size(), 1); + QCOMPARE(flickStartSpy.size(), 1); // wait for any motion to end QTRY_VERIFY(!flickable->isMoving()); @@ -1133,17 +1133,17 @@ void tst_qquickflickable::movingAndFlicking() QVERIFY(!flickable->isFlickingHorizontally()); QVERIFY(!flickable->isFlickingVertically()); - QCOMPARE(moveSpy.count(), 2); - QCOMPARE(vMoveSpy.count(), verticalEnabled ? 2 : 0); - QCOMPARE(hMoveSpy.count(), horizontalEnabled ? 2 : 0); - QCOMPARE(flickSpy.count(), 2); - QCOMPARE(vFlickSpy.count(), verticalEnabled ? 2 : 0); - QCOMPARE(hFlickSpy.count(), horizontalEnabled ? 2 : 0); + QCOMPARE(moveSpy.size(), 2); + QCOMPARE(vMoveSpy.size(), verticalEnabled ? 2 : 0); + QCOMPARE(hMoveSpy.size(), horizontalEnabled ? 2 : 0); + QCOMPARE(flickSpy.size(), 2); + QCOMPARE(vFlickSpy.size(), verticalEnabled ? 2 : 0); + QCOMPARE(hFlickSpy.size(), horizontalEnabled ? 2 : 0); - QCOMPARE(moveStartSpy.count(), 1); - QCOMPARE(moveEndSpy.count(), 1); - QCOMPARE(flickStartSpy.count(), 1); - QCOMPARE(flickEndSpy.count(), 1); + QCOMPARE(moveStartSpy.size(), 1); + QCOMPARE(moveEndSpy.size(), 1); + QCOMPARE(flickStartSpy.size(), 1); + QCOMPARE(flickEndSpy.size(), 1); // Stop on a full pixel after user interaction if (verticalEnabled) @@ -1170,17 +1170,17 @@ void tst_qquickflickable::movingAndFlicking() QCOMPARE(flickable->isFlickingHorizontally(), horizontalEnabled); QCOMPARE(flickable->isFlickingVertically(), verticalEnabled); - QCOMPARE(moveSpy.count(), 1); - QCOMPARE(vMoveSpy.count(), verticalEnabled ? 1 : 0); - QCOMPARE(hMoveSpy.count(), horizontalEnabled ? 1 : 0); - QCOMPARE(flickSpy.count(), 1); - QCOMPARE(vFlickSpy.count(), verticalEnabled ? 1 : 0); - QCOMPARE(hFlickSpy.count(), horizontalEnabled ? 1 : 0); + QCOMPARE(moveSpy.size(), 1); + QCOMPARE(vMoveSpy.size(), verticalEnabled ? 1 : 0); + QCOMPARE(hMoveSpy.size(), horizontalEnabled ? 1 : 0); + QCOMPARE(flickSpy.size(), 1); + QCOMPARE(vFlickSpy.size(), verticalEnabled ? 1 : 0); + QCOMPARE(hFlickSpy.size(), horizontalEnabled ? 1 : 0); - QCOMPARE(moveStartSpy.count(), 1); - QCOMPARE(moveEndSpy.count(), 0); - QCOMPARE(flickStartSpy.count(), 1); - QCOMPARE(flickEndSpy.count(), 0); + QCOMPARE(moveStartSpy.size(), 1); + QCOMPARE(moveEndSpy.size(), 0); + QCOMPARE(flickStartSpy.size(), 1); + QCOMPARE(flickEndSpy.size(), 0); // wait for any motion to end QTRY_VERIFY(!flickable->isMoving()); @@ -1191,17 +1191,17 @@ void tst_qquickflickable::movingAndFlicking() QVERIFY(!flickable->isFlickingHorizontally()); QVERIFY(!flickable->isFlickingVertically()); - QCOMPARE(moveSpy.count(), 2); - QCOMPARE(vMoveSpy.count(), verticalEnabled ? 2 : 0); - QCOMPARE(hMoveSpy.count(), horizontalEnabled ? 2 : 0); - QCOMPARE(flickSpy.count(), 2); - QCOMPARE(vFlickSpy.count(), verticalEnabled ? 2 : 0); - QCOMPARE(hFlickSpy.count(), horizontalEnabled ? 2 : 0); + QCOMPARE(moveSpy.size(), 2); + QCOMPARE(vMoveSpy.size(), verticalEnabled ? 2 : 0); + QCOMPARE(hMoveSpy.size(), horizontalEnabled ? 2 : 0); + QCOMPARE(flickSpy.size(), 2); + QCOMPARE(vFlickSpy.size(), verticalEnabled ? 2 : 0); + QCOMPARE(hFlickSpy.size(), horizontalEnabled ? 2 : 0); - QCOMPARE(moveStartSpy.count(), 1); - QCOMPARE(moveEndSpy.count(), 1); - QCOMPARE(flickStartSpy.count(), 1); - QCOMPARE(flickEndSpy.count(), 1); + QCOMPARE(moveStartSpy.size(), 1); + QCOMPARE(moveEndSpy.size(), 1); + QCOMPARE(flickStartSpy.size(), 1); + QCOMPARE(flickEndSpy.size(), 1); QCOMPARE(flickable->contentX(), 0.0); QCOMPARE(flickable->contentY(), 0.0); @@ -1282,26 +1282,26 @@ void tst_qquickflickable::movingAndDragging() QCOMPARE(flickable->property("draggingInContentX").value<bool>(), true); QCOMPARE(flickable->property("draggingInContentY").value<bool>(), true); - QCOMPARE(moveSpy.count(), 1); - QCOMPARE(vMoveSpy.count(), verticalEnabled ? 1 : 0); - QCOMPARE(hMoveSpy.count(), horizontalEnabled ? 1 : 0); - QCOMPARE(dragSpy.count(), 1); - QCOMPARE(vDragSpy.count(), verticalEnabled ? 1 : 0); - QCOMPARE(hDragSpy.count(), horizontalEnabled ? 1 : 0); + QCOMPARE(moveSpy.size(), 1); + QCOMPARE(vMoveSpy.size(), verticalEnabled ? 1 : 0); + QCOMPARE(hMoveSpy.size(), horizontalEnabled ? 1 : 0); + QCOMPARE(dragSpy.size(), 1); + QCOMPARE(vDragSpy.size(), verticalEnabled ? 1 : 0); + QCOMPARE(hDragSpy.size(), horizontalEnabled ? 1 : 0); - QCOMPARE(moveStartSpy.count(), 1); - QCOMPARE(dragStartSpy.count(), 1); + QCOMPARE(moveStartSpy.size(), 1); + QCOMPARE(dragStartSpy.size(), 1); QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, moveFrom + moveByWithoutSnapBack*3); QVERIFY(!flickable->isDragging()); QVERIFY(!flickable->isDraggingHorizontally()); QVERIFY(!flickable->isDraggingVertically()); - QCOMPARE(dragSpy.count(), 2); - QCOMPARE(vDragSpy.count(), verticalEnabled ? 2 : 0); - QCOMPARE(hDragSpy.count(), horizontalEnabled ? 2 : 0); - QCOMPARE(dragStartSpy.count(), 1); - QCOMPARE(dragEndSpy.count(), 1); + QCOMPARE(dragSpy.size(), 2); + QCOMPARE(vDragSpy.size(), verticalEnabled ? 2 : 0); + QCOMPARE(hDragSpy.size(), horizontalEnabled ? 2 : 0); + QCOMPARE(dragStartSpy.size(), 1); + QCOMPARE(dragEndSpy.size(), 1); // Don't test whether moving finished because a flick could occur // wait for any motion to end @@ -1313,17 +1313,17 @@ void tst_qquickflickable::movingAndDragging() QVERIFY(!flickable->isDraggingHorizontally()); QVERIFY(!flickable->isDraggingVertically()); - QCOMPARE(dragSpy.count(), 2); - QCOMPARE(vDragSpy.count(), verticalEnabled ? 2 : 0); - QCOMPARE(hDragSpy.count(), horizontalEnabled ? 2 : 0); - QCOMPARE(moveSpy.count(), 2); - QCOMPARE(vMoveSpy.count(), verticalEnabled ? 2 : 0); - QCOMPARE(hMoveSpy.count(), horizontalEnabled ? 2 : 0); + QCOMPARE(dragSpy.size(), 2); + QCOMPARE(vDragSpy.size(), verticalEnabled ? 2 : 0); + QCOMPARE(hDragSpy.size(), horizontalEnabled ? 2 : 0); + QCOMPARE(moveSpy.size(), 2); + QCOMPARE(vMoveSpy.size(), verticalEnabled ? 2 : 0); + QCOMPARE(hMoveSpy.size(), horizontalEnabled ? 2 : 0); - QCOMPARE(dragStartSpy.count(), 1); - QCOMPARE(dragEndSpy.count(), 1); - QCOMPARE(moveStartSpy.count(), 1); - QCOMPARE(moveEndSpy.count(), 1); + QCOMPARE(dragStartSpy.size(), 1); + QCOMPARE(dragEndSpy.size(), 1); + QCOMPARE(moveStartSpy.size(), 1); + QCOMPARE(moveEndSpy.size(), 1); // Stop on a full pixel after user interaction if (verticalEnabled) @@ -1353,17 +1353,17 @@ void tst_qquickflickable::movingAndDragging() QCOMPARE(flickable->isDraggingHorizontally(), horizontalEnabled); QCOMPARE(flickable->isDraggingVertically(), verticalEnabled); - QCOMPARE(moveSpy.count(), 1); - QCOMPARE(vMoveSpy.count(), verticalEnabled ? 1 : 0); - QCOMPARE(hMoveSpy.count(), horizontalEnabled ? 1 : 0); - QCOMPARE(dragSpy.count(), 1); - QCOMPARE(vDragSpy.count(), verticalEnabled ? 1 : 0); - QCOMPARE(hDragSpy.count(), horizontalEnabled ? 1 : 0); + QCOMPARE(moveSpy.size(), 1); + QCOMPARE(vMoveSpy.size(), verticalEnabled ? 1 : 0); + QCOMPARE(hMoveSpy.size(), horizontalEnabled ? 1 : 0); + QCOMPARE(dragSpy.size(), 1); + QCOMPARE(vDragSpy.size(), verticalEnabled ? 1 : 0); + QCOMPARE(hDragSpy.size(), horizontalEnabled ? 1 : 0); - QCOMPARE(moveStartSpy.count(), 1); - QCOMPARE(moveEndSpy.count(), 0); - QCOMPARE(dragStartSpy.count(), 1); - QCOMPARE(dragEndSpy.count(), 0); + QCOMPARE(moveStartSpy.size(), 1); + QCOMPARE(moveEndSpy.size(), 0); + QCOMPARE(dragStartSpy.size(), 1); + QCOMPARE(dragEndSpy.size(), 0); QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, moveFrom + moveByWithSnapBack*3); @@ -1375,15 +1375,15 @@ void tst_qquickflickable::movingAndDragging() QVERIFY(!flickable->isDraggingHorizontally()); QVERIFY(!flickable->isDraggingVertically()); - QCOMPARE(moveSpy.count(), 1); - QCOMPARE(vMoveSpy.count(), verticalEnabled ? 1 : 0); - QCOMPARE(hMoveSpy.count(), horizontalEnabled ? 1 : 0); - QCOMPARE(dragSpy.count(), 2); - QCOMPARE(vDragSpy.count(), verticalEnabled ? 2 : 0); - QCOMPARE(hDragSpy.count(), horizontalEnabled ? 2 : 0); + QCOMPARE(moveSpy.size(), 1); + QCOMPARE(vMoveSpy.size(), verticalEnabled ? 1 : 0); + QCOMPARE(hMoveSpy.size(), horizontalEnabled ? 1 : 0); + QCOMPARE(dragSpy.size(), 2); + QCOMPARE(vDragSpy.size(), verticalEnabled ? 2 : 0); + QCOMPARE(hDragSpy.size(), horizontalEnabled ? 2 : 0); - QCOMPARE(moveStartSpy.count(), 1); - QCOMPARE(moveEndSpy.count(), 0); + QCOMPARE(moveStartSpy.size(), 1); + QCOMPARE(moveEndSpy.size(), 0); // wait for any motion to end QTRY_VERIFY(!flickable->isMoving()); @@ -1394,17 +1394,17 @@ void tst_qquickflickable::movingAndDragging() QVERIFY(!flickable->isDraggingHorizontally()); QVERIFY(!flickable->isDraggingVertically()); - QCOMPARE(moveSpy.count(), 2); - QCOMPARE(vMoveSpy.count(), verticalEnabled ? 2 : 0); - QCOMPARE(hMoveSpy.count(), horizontalEnabled ? 2 : 0); - QCOMPARE(dragSpy.count(), 2); - QCOMPARE(vDragSpy.count(), verticalEnabled ? 2 : 0); - QCOMPARE(hDragSpy.count(), horizontalEnabled ? 2 : 0); + QCOMPARE(moveSpy.size(), 2); + QCOMPARE(vMoveSpy.size(), verticalEnabled ? 2 : 0); + QCOMPARE(hMoveSpy.size(), horizontalEnabled ? 2 : 0); + QCOMPARE(dragSpy.size(), 2); + QCOMPARE(vDragSpy.size(), verticalEnabled ? 2 : 0); + QCOMPARE(hDragSpy.size(), horizontalEnabled ? 2 : 0); - QCOMPARE(moveStartSpy.count(), 1); - QCOMPARE(moveEndSpy.count(), 1); - QCOMPARE(dragStartSpy.count(), 1); - QCOMPARE(dragEndSpy.count(), 1); + QCOMPARE(moveStartSpy.size(), 1); + QCOMPARE(moveEndSpy.size(), 1); + QCOMPARE(dragStartSpy.size(), 1); + QCOMPARE(dragEndSpy.size(), 1); QCOMPARE(flickable->contentX(), 0.0); QCOMPARE(flickable->contentY(), 0.0); @@ -1432,7 +1432,7 @@ void tst_qquickflickable::flickOnRelease() QTest::mouseMove(window.data(), QPoint(50, 10), 10); QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(50, 10), 10); - QCOMPARE(vFlickSpy.count(), 1); + QCOMPARE(vFlickSpy.size(), 1); // wait for any motion to end QTRY_VERIFY(!flickable->isMoving()); @@ -1472,12 +1472,12 @@ void tst_qquickflickable::pressWhileFlicking() QVERIFY(flickable->isMoving()); QVERIFY(flickable->isMovingVertically()); QVERIFY(!flickable->isMovingHorizontally()); - QCOMPARE(vMoveSpy.count(), 1); - QCOMPARE(hMoveSpy.count(), 0); - QCOMPARE(moveSpy.count(), 1); - QCOMPARE(vFlickSpy.count(), 1); - QCOMPARE(hFlickSpy.count(), 0); - QCOMPARE(flickSpy.count(), 1); + QCOMPARE(vMoveSpy.size(), 1); + QCOMPARE(hMoveSpy.size(), 0); + QCOMPARE(moveSpy.size(), 1); + QCOMPARE(vFlickSpy.size(), 1); + QCOMPARE(hFlickSpy.size(), 0); + QCOMPARE(flickSpy.size(), 1); QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(20, 50)); QTRY_VERIFY(!flickable->isFlicking()); @@ -2033,10 +2033,10 @@ void tst_qquickflickable::stopAtBounds() else QCOMPARE(transpose ? flickable->isAtYBeginning() : flickable->isAtXBeginning(), false); - QCOMPARE(atXBeginningChangedSpy.count(), (!transpose && !invert) ? 1 : 0); - QCOMPARE(atYBeginningChangedSpy.count(), ( transpose && !invert) ? 1 : 0); - QCOMPARE(atXEndChangedSpy.count(), (!transpose && invert) ? 1 : 0); - QCOMPARE(atYEndChangedSpy.count(), ( transpose && invert) ? 1 : 0); + QCOMPARE(atXBeginningChangedSpy.size(), (!transpose && !invert) ? 1 : 0); + QCOMPARE(atYBeginningChangedSpy.size(), ( transpose && !invert) ? 1 : 0); + QCOMPARE(atXEndChangedSpy.size(), (!transpose && invert) ? 1 : 0); + QCOMPARE(atYEndChangedSpy.size(), ( transpose && invert) ? 1 : 0); // Drag away from the aligned boundary again. // None of the mouse movements will position the view at the boundary exactly, @@ -2070,7 +2070,7 @@ void tst_qquickflickable::stopAtBounds() else flick(&view, QPoint(120,120), QPoint(20,20), 100); - QVERIFY(flickSignal.count() > 0); + QVERIFY(flickSignal.size() > 0); if (transpose) { if (invert) QTRY_COMPARE(flickable->isAtYBeginning(), true); @@ -2241,22 +2241,22 @@ void tst_qquickflickable::contentSize() flickable.setWidth(100); QCOMPARE(flickable.width(), qreal(100)); QCOMPARE(flickable.contentWidth(), qreal(-1.0)); - QCOMPARE(cwspy.count(), 0); + QCOMPARE(cwspy.size(), 0); flickable.setContentWidth(10); QCOMPARE(flickable.width(), qreal(100)); QCOMPARE(flickable.contentWidth(), qreal(10)); - QCOMPARE(cwspy.count(), 1); + QCOMPARE(cwspy.size(), 1); flickable.setHeight(100); QCOMPARE(flickable.height(), qreal(100)); QCOMPARE(flickable.contentHeight(), qreal(-1.0)); - QCOMPARE(chspy.count(), 0); + QCOMPARE(chspy.size(), 0); flickable.setContentHeight(10); QCOMPARE(flickable.height(), qreal(100)); QCOMPARE(flickable.contentHeight(), qreal(10)); - QCOMPARE(chspy.count(), 1); + QCOMPARE(chspy.size(), 1); } // QTBUG-53726 @@ -2750,13 +2750,13 @@ void tst_qquickflickable::ignoreNonLeftMouseButtons() // QTBUG-96909 QTest::mouseMove(&view, p1, 50); } QVERIFY(flickable->isDragging()); - QCOMPARE(dragSpy.count(), 1); + QCOMPARE(dragSpy.size(), 1); // Press other button too, then release left button: dragging changes to false QTest::mousePress(&view, otherButton); QTest::mouseRelease(&view, Qt::LeftButton); QTRY_COMPARE(flickable->isDragging(), false); - QCOMPARE(dragSpy.count(), 2); + QCOMPARE(dragSpy.size(), 2); // Drag further with the other button held: Flickable ignores it for (int i = 0; i < 8; ++i) { @@ -2764,11 +2764,11 @@ void tst_qquickflickable::ignoreNonLeftMouseButtons() // QTBUG-96909 QTest::mouseMove(&view, p1, 50); } QCOMPARE(flickable->isDragging(), false); - QCOMPARE(dragSpy.count(), 2); + QCOMPARE(dragSpy.size(), 2); // Release other button: nothing happens QTest::mouseRelease(&view, otherButton); - QCOMPARE(dragSpy.count(), 2); + QCOMPARE(dragSpy.size(), 2); } void tst_qquickflickable::ignoreNonLeftMouseButtons_data() @@ -2801,12 +2801,12 @@ void tst_qquickflickable::receiveTapOutsideContentItem() // Tap outside the content item in the top-left corner QTest::mouseClick(&window, Qt::LeftButton, {}, QPoint(5, 5)); - QCOMPARE(clickedSpy.count(), 1); + QCOMPARE(clickedSpy.size(), 1); // Tap outside the content item in the bottom-right corner const QPoint bottomRight(flickable.contentItem()->width() + 5, flickable.contentItem()->height() + 5); QTest::mouseClick(&window, Qt::LeftButton, {}, bottomRight); - QCOMPARE(clickedSpy.count(), 2); + QCOMPARE(clickedSpy.size(), 2); } void tst_qquickflickable::flickWhenRotated_data() diff --git a/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp b/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp index 3c9417fb1d..4dcbcc4884 100644 --- a/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp +++ b/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp @@ -379,78 +379,78 @@ void tst_qquickfocusscope::forceActiveFocus() itemA1->forceActiveFocus(); QVERIFY(itemA1->hasActiveFocus()); QVERIFY(!rootObject->hasActiveFocus()); - QCOMPARE(rootSpy.count(), 0); - QCOMPARE(scopeSpy.count(), 1); + QCOMPARE(rootSpy.size(), 0); + QCOMPARE(scopeSpy.size(), 1); scopeA->forceActiveFocus(); QVERIFY(!itemA1->hasActiveFocus()); QVERIFY(scopeA->hasActiveFocus()); - QCOMPARE(scopeASpy.count(), 1); - QCOMPARE(rootSpy.count(), 0); - QCOMPARE(scopeSpy.count(), 1); + QCOMPARE(scopeASpy.size(), 1); + QCOMPARE(rootSpy.size(), 0); + QCOMPARE(scopeSpy.size(), 1); itemA2->forceActiveFocus(); QVERIFY(!itemA1->hasActiveFocus()); QVERIFY(itemA2->hasActiveFocus()); QVERIFY(scopeA->hasActiveFocus()); - QCOMPARE(scopeASpy.count(), 1); - QCOMPARE(rootSpy.count(), 0); - QCOMPARE(scopeSpy.count(), 1); + QCOMPARE(scopeASpy.size(), 1); + QCOMPARE(rootSpy.size(), 0); + QCOMPARE(scopeSpy.size(), 1); scopeA->forceActiveFocus(); QVERIFY(!itemA1->hasActiveFocus()); QVERIFY(itemA2->hasActiveFocus()); QVERIFY(scopeA->hasActiveFocus()); - QCOMPARE(scopeASpy.count(), 1); - QCOMPARE(rootSpy.count(), 0); - QCOMPARE(scopeSpy.count(), 1); + QCOMPARE(scopeASpy.size(), 1); + QCOMPARE(rootSpy.size(), 0); + QCOMPARE(scopeSpy.size(), 1); itemA1->forceActiveFocus(); QVERIFY(itemA1->hasActiveFocus()); QVERIFY(!scopeA->hasActiveFocus()); QVERIFY(!itemA2->hasActiveFocus()); - QCOMPARE(scopeASpy.count(), 2); - QCOMPARE(rootSpy.count(), 0); - QCOMPARE(scopeSpy.count(), 1); + QCOMPARE(scopeASpy.size(), 2); + QCOMPARE(rootSpy.size(), 0); + QCOMPARE(scopeSpy.size(), 1); // Then jump back and forth between branch 'a' and 'b' itemB1->forceActiveFocus(); QVERIFY(itemB1->hasActiveFocus()); - QCOMPARE(rootSpy.count(), 0); - QCOMPARE(scopeSpy.count(), 1); + QCOMPARE(rootSpy.size(), 0); + QCOMPARE(scopeSpy.size(), 1); scopeA->forceActiveFocus(); QVERIFY(!itemA1->hasActiveFocus()); QVERIFY(!itemB1->hasActiveFocus()); QVERIFY(scopeA->hasActiveFocus()); - QCOMPARE(scopeASpy.count(), 3); - QCOMPARE(rootSpy.count(), 0); - QCOMPARE(scopeSpy.count(), 1); + QCOMPARE(scopeASpy.size(), 3); + QCOMPARE(rootSpy.size(), 0); + QCOMPARE(scopeSpy.size(), 1); scopeB->forceActiveFocus(); QVERIFY(!scopeA->hasActiveFocus()); QVERIFY(!itemB1->hasActiveFocus()); QVERIFY(scopeB->hasActiveFocus()); - QCOMPARE(scopeASpy.count(), 4); - QCOMPARE(scopeBSpy.count(), 1); - QCOMPARE(rootSpy.count(), 0); - QCOMPARE(scopeSpy.count(), 1); + QCOMPARE(scopeASpy.size(), 4); + QCOMPARE(scopeBSpy.size(), 1); + QCOMPARE(rootSpy.size(), 0); + QCOMPARE(scopeSpy.size(), 1); itemA2->forceActiveFocus(); QVERIFY(!scopeB->hasActiveFocus()); QVERIFY(itemA2->hasActiveFocus()); - QCOMPARE(scopeASpy.count(), 5); - QCOMPARE(scopeBSpy.count(), 2); - QCOMPARE(rootSpy.count(), 0); - QCOMPARE(scopeSpy.count(), 1); + QCOMPARE(scopeASpy.size(), 5); + QCOMPARE(scopeBSpy.size(), 2); + QCOMPARE(rootSpy.size(), 0); + QCOMPARE(scopeSpy.size(), 1); itemB2->forceActiveFocus(); QVERIFY(!itemA2->hasActiveFocus()); QVERIFY(itemB2->hasActiveFocus()); - QCOMPARE(scopeASpy.count(), 6); - QCOMPARE(scopeBSpy.count(), 3); - QCOMPARE(rootSpy.count(), 0); - QCOMPARE(scopeSpy.count(), 1); + QCOMPARE(scopeASpy.size(), 6); + QCOMPARE(scopeBSpy.size(), 3); + QCOMPARE(rootSpy.size(), 0); + QCOMPARE(scopeSpy.size(), 1); delete view; } @@ -516,12 +516,12 @@ void tst_qquickfocusscope::canvasFocus() QCOMPARE(item2->hasFocus(), false); QCOMPARE(item2->hasActiveFocus(), false); - QCOMPARE(rootFocusSpy.count(), 1); - QCOMPARE(rootActiveFocusSpy.count(), 1); - QCOMPARE(scope1FocusSpy.count(), 0); - QCOMPARE(scope1ActiveFocusSpy.count(), 1); - QCOMPARE(item1FocusSpy.count(), 0); - QCOMPARE(item1ActiveFocusSpy.count(), 1); + QCOMPARE(rootFocusSpy.size(), 1); + QCOMPARE(rootActiveFocusSpy.size(), 1); + QCOMPARE(scope1FocusSpy.size(), 0); + QCOMPARE(scope1ActiveFocusSpy.size(), 1); + QCOMPARE(item1FocusSpy.size(), 0); + QCOMPARE(item1ActiveFocusSpy.size(), 1); // view->hide(); // seemingly doesn't remove focus, so have an another view steal it. @@ -537,12 +537,12 @@ void tst_qquickfocusscope::canvasFocus() QCOMPARE(item1->hasFocus(), true); QCOMPARE(item1->hasActiveFocus(), false); - QCOMPARE(rootFocusSpy.count(), 2); - QCOMPARE(rootActiveFocusSpy.count(), 2); - QCOMPARE(scope1FocusSpy.count(), 0); - QCOMPARE(scope1ActiveFocusSpy.count(), 2); - QCOMPARE(item1FocusSpy.count(), 0); - QCOMPARE(item1ActiveFocusSpy.count(), 2); + QCOMPARE(rootFocusSpy.size(), 2); + QCOMPARE(rootActiveFocusSpy.size(), 2); + QCOMPARE(scope1FocusSpy.size(), 0); + QCOMPARE(scope1ActiveFocusSpy.size(), 2); + QCOMPARE(item1FocusSpy.size(), 0); + QCOMPARE(item1ActiveFocusSpy.size(), 2); // window does not have focus, so item2 will not get active focus @@ -559,16 +559,16 @@ void tst_qquickfocusscope::canvasFocus() QCOMPARE(item2->hasFocus(), true); QCOMPARE(item2->hasActiveFocus(), false); - QCOMPARE(rootFocusSpy.count(), 2); - QCOMPARE(rootActiveFocusSpy.count(), 2); - QCOMPARE(scope1FocusSpy.count(), 1); - QCOMPARE(scope1ActiveFocusSpy.count(), 2); - QCOMPARE(item1FocusSpy.count(), 0); - QCOMPARE(item1ActiveFocusSpy.count(), 2); - QCOMPARE(scope2FocusSpy.count(), 1); - QCOMPARE(scope2ActiveFocusSpy.count(), 0); - QCOMPARE(item2FocusSpy.count(), 1); - QCOMPARE(item2ActiveFocusSpy.count(), 0); + QCOMPARE(rootFocusSpy.size(), 2); + QCOMPARE(rootActiveFocusSpy.size(), 2); + QCOMPARE(scope1FocusSpy.size(), 1); + QCOMPARE(scope1ActiveFocusSpy.size(), 2); + QCOMPARE(item1FocusSpy.size(), 0); + QCOMPARE(item1ActiveFocusSpy.size(), 2); + QCOMPARE(scope2FocusSpy.size(), 1); + QCOMPARE(scope2ActiveFocusSpy.size(), 0); + QCOMPARE(item2FocusSpy.size(), 1); + QCOMPARE(item2ActiveFocusSpy.size(), 0); // give the window focus, and item2 will get active focus view->show(); @@ -582,12 +582,12 @@ void tst_qquickfocusscope::canvasFocus() QCOMPARE(scope2->hasActiveFocus(), true); QCOMPARE(item2->hasFocus(), true); QCOMPARE(item2->hasActiveFocus(), true); - QCOMPARE(rootFocusSpy.count(), 3); - QCOMPARE(rootActiveFocusSpy.count(), 3); - QCOMPARE(scope2FocusSpy.count(), 1); - QCOMPARE(scope2ActiveFocusSpy.count(), 1); - QCOMPARE(item2FocusSpy.count(), 1); - QCOMPARE(item2ActiveFocusSpy.count(), 1); + QCOMPARE(rootFocusSpy.size(), 3); + QCOMPARE(rootActiveFocusSpy.size(), 3); + QCOMPARE(scope2FocusSpy.size(), 1); + QCOMPARE(scope2ActiveFocusSpy.size(), 1); + QCOMPARE(item2FocusSpy.size(), 1); + QCOMPARE(item2ActiveFocusSpy.size(), 1); delete view; } diff --git a/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp b/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp index 0efe3a2c24..c34edbcdde 100644 --- a/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp +++ b/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp @@ -147,27 +147,27 @@ void tst_qquickfontloader::changeFont() QSignalSpy statusSpy(fontObject, SIGNAL(statusChanged())); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Ready); - QCOMPARE(nameSpy.count(), 0); - QCOMPARE(statusSpy.count(), 0); + QCOMPARE(nameSpy.size(), 0); + QCOMPARE(statusSpy.size(), 0); QTRY_COMPARE(fontObject->name(), QString("OCRA")); ctxt->setContextProperty("fnt", server.urlString("/daniel.ttf")); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Loading); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Ready); - QCOMPARE(nameSpy.count(), 1); - QCOMPARE(statusSpy.count(), 2); + QCOMPARE(nameSpy.size(), 1); + QCOMPARE(statusSpy.size(), 2); QTRY_COMPARE(fontObject->name(), QString("Daniel")); ctxt->setContextProperty("fnt", testFileUrl("tarzeau_ocr_a.ttf")); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Ready); - QCOMPARE(nameSpy.count(), 2); - QCOMPARE(statusSpy.count(), 2); + QCOMPARE(nameSpy.size(), 2); + QCOMPARE(statusSpy.size(), 2); QTRY_COMPARE(fontObject->name(), QString("OCRA")); ctxt->setContextProperty("fnt", server.urlString("/daniel.ttf")); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Ready); - QCOMPARE(nameSpy.count(), 3); - QCOMPARE(statusSpy.count(), 2); + QCOMPARE(nameSpy.size(), 3); + QCOMPARE(statusSpy.size(), 2); QTRY_COMPARE(fontObject->name(), QString("Daniel")); } diff --git a/tests/auto/quick/qquickfontmetrics/tst_quickfontmetrics.cpp b/tests/auto/quick/qquickfontmetrics/tst_quickfontmetrics.cpp index 6d98b62696..f34bdc2059 100644 --- a/tests/auto/quick/qquickfontmetrics/tst_quickfontmetrics.cpp +++ b/tests/auto/quick/qquickfontmetrics/tst_quickfontmetrics.cpp @@ -39,7 +39,7 @@ void tst_QuickFontMetrics::properties() QSignalSpy spy(&metrics, SIGNAL(fontChanged(QFont))); metrics.setFont(font); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(metrics.ascent(), expected.ascent()); QCOMPARE(metrics.descent(), expected.descent()); diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp index 182458bb10..e7a2cb2c27 100644 --- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp +++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp @@ -350,7 +350,7 @@ void tst_QQuickGridView::items() QTRY_COMPARE(gridview->count(), model.count()); QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count()); - QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + QTRY_COMPARE(contentItem->childItems().size(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item for (int i = 0; i < model.count(); ++i) { QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); @@ -365,7 +365,7 @@ void tst_QQuickGridView::items() QaimModel model2; ctxt->setContextProperty("testModel", &model2); - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); QTRY_COMPARE(itemCount, 0); delete window; @@ -430,7 +430,7 @@ void tst_QQuickGridView::inserted_basic() model.insertItem(1, "Will", "9876"); QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count()); - QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + QTRY_COMPARE(contentItem->childItems().size(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item QQuickText *name = findItem<QQuickText>(contentItem, "textName", 1); QTRY_VERIFY(name != nullptr); @@ -452,7 +452,7 @@ void tst_QQuickGridView::inserted_basic() model.insertItem(0, "Foo", "1111"); // zero index, and current item - QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + QTRY_COMPARE(contentItem->childItems().size(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item name = findItem<QQuickText>(contentItem, "textName", 0); QTRY_VERIFY(name != nullptr); @@ -539,7 +539,7 @@ void tst_QQuickGridView::inserted_defaultLayout(QQuickGridView::Flow flow, QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); int firstVisibleIndex = -1; - for (int i=0; i<items.count(); i++) { + for (int i=0; i<items.size(); i++) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (item && delegateVisible(item)) { firstVisibleIndex = i; @@ -549,7 +549,7 @@ void tst_QQuickGridView::inserted_defaultLayout(QQuickGridView::Flow flow, QVERIFY2(firstVisibleIndex >= 0, QTest::toString(firstVisibleIndex)); // Confirm items positioned correctly and indexes correct - for (int i = firstVisibleIndex; i < model.count() && i < items.count(); ++i) { + for (int i = firstVisibleIndex; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QCOMPARE(item->position(), expectedItemPos(gridview, i, rowOffsetAfterMove)); @@ -732,7 +732,7 @@ void tst_QQuickGridView::insertBeforeVisible() QTRY_COMPARE(gridview->contentY(), 0.0 + itemsOffsetAfterMove); // Confirm items positioned correctly and indexes correct - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); @@ -804,7 +804,7 @@ void tst_QQuickGridView::removed_basic() QTRY_COMPARE(removed, QString("Item1")); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -825,7 +825,7 @@ void tst_QQuickGridView::removed_basic() // Confirm items positioned correctly - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -838,7 +838,7 @@ void tst_QQuickGridView::removed_basic() QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count()); // Confirm items positioned correctly - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -876,7 +876,7 @@ void tst_QQuickGridView::removed_basic() QVERIFY(QQuickTest::qWaitForPolish(gridview)); // Confirm items positioned correctly - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QTRY_COMPARE(item->x(), qreal((i%3)*80)); @@ -959,7 +959,7 @@ void tst_QQuickGridView::removed_defaultLayout(QQuickGridView::Flow flow, int firstVisibleIndex = -1; QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); QRectF viewRect(gridview->contentX(), gridview->contentY(), gridview->width(), gridview->height()); - for (int i=0; i<items.count(); i++) { + for (int i=0; i<items.size(); i++) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (item) { QRectF itemRect(item->x(), item->y(), item->width(), item->height()); @@ -975,7 +975,7 @@ void tst_QQuickGridView::removed_defaultLayout(QQuickGridView::Flow flow, QCOMPARE(firstName, firstVisible); // Confirm items positioned correctly and indexes correct - for (int i = firstVisibleIndex; i < model.count() && i < items.count(); ++i) { + for (int i = firstVisibleIndex; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QCOMPARE(item->position(), expectedItemPos(gridview, i, rowOffsetAfterMove)); @@ -1200,7 +1200,7 @@ void tst_QQuickGridView::addOrRemoveBeforeVisible() QCOMPARE(name->text(), QString("Item1")); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QTRY_VERIFY(findItem<QQuickItem>(contentItem, "wrapper", i)); QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); @@ -1309,7 +1309,7 @@ void tst_QQuickGridView::moved_defaultLayout(QQuickGridView::Flow flow, // Confirm items positioned correctly and indexes correct QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); int firstVisibleIndex = -1; - for (int i=0; i<items.count(); i++) { + for (int i=0; i<items.size(); i++) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (item && delegateVisible(item)) { firstVisibleIndex = i; @@ -1318,7 +1318,7 @@ void tst_QQuickGridView::moved_defaultLayout(QQuickGridView::Flow flow, } QVERIFY2(firstVisibleIndex >= 0, QTest::toString(firstVisibleIndex)); - for (int i = firstVisibleIndex; i < model.count() && i < items.count(); ++i) { + for (int i = firstVisibleIndex; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item && ( (flow == QQuickGridView::FlowLeftToRight && i >= firstVisibleIndex + (3*6)) @@ -1545,7 +1545,7 @@ void tst_QQuickGridView::multipleChanges(bool condensed) QTRY_VERIFY(gridview != nullptr); QVERIFY(QQuickTest::qWaitForPolish(gridview)); - for (int i=0; i<changes.count(); i++) { + for (int i=0; i<changes.size(); i++) { switch (changes[i].type) { case ListChange::Inserted: { @@ -1584,7 +1584,7 @@ void tst_QQuickGridView::multipleChanges(bool condensed) QQuickText *number; QQuickItem *contentItem = gridview->contentItem(); QTRY_VERIFY(contentItem != nullptr); - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i=0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); @@ -2172,7 +2172,7 @@ void tst_QQuickGridView::changeFlow() QTRY_VERIFY(contentItem != nullptr); // Confirm items positioned correctly and indexes correct - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -2190,7 +2190,7 @@ void tst_QQuickGridView::changeFlow() ctxt->setContextProperty("testTopToBottom", QVariant(true)); // Confirm items positioned correctly and indexes correct - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -2208,7 +2208,7 @@ void tst_QQuickGridView::changeFlow() ctxt->setContextProperty("testRightToLeft", QVariant(true)); // Confirm items positioned correctly and indexes correct - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -2228,7 +2228,7 @@ void tst_QQuickGridView::changeFlow() QTRY_COMPARE(gridview->contentX(), 0.); // Confirm items positioned correctly and indexes correct - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -2322,17 +2322,17 @@ void tst_QQuickGridView::propertyChanges() QTRY_COMPARE(gridView->cacheBuffer(), 3); QTRY_COMPARE(gridView->flow(), QQuickGridView::FlowTopToBottom); - QTRY_COMPARE(keyNavigationWrapsSpy.count(),1); - QTRY_COMPARE(cacheBufferSpy.count(),1); - QTRY_COMPARE(flowSpy.count(),1); + QTRY_COMPARE(keyNavigationWrapsSpy.size(),1); + QTRY_COMPARE(cacheBufferSpy.size(),1); + QTRY_COMPARE(flowSpy.size(),1); gridView->setWrapEnabled(false); gridView->setCacheBuffer(3); gridView->setFlow(QQuickGridView::FlowTopToBottom); - QTRY_COMPARE(keyNavigationWrapsSpy.count(),1); - QTRY_COMPARE(cacheBufferSpy.count(),1); - QTRY_COMPARE(flowSpy.count(),1); + QTRY_COMPARE(keyNavigationWrapsSpy.size(),1); + QTRY_COMPARE(cacheBufferSpy.size(),1); + QTRY_COMPARE(flowSpy.size(),1); gridView->setFlow(QQuickGridView::FlowLeftToRight); QTRY_COMPARE(gridView->flow(), QQuickGridView::FlowLeftToRight); @@ -2345,26 +2345,26 @@ void tst_QQuickGridView::propertyChanges() QTRY_COMPARE(gridView->cacheBuffer(), 5); QTRY_COMPARE(gridView->layoutDirection(), Qt::RightToLeft); - QTRY_COMPARE(keyNavigationWrapsSpy.count(),2); - QTRY_COMPARE(cacheBufferSpy.count(),2); - QTRY_COMPARE(layoutSpy.count(),1); - QTRY_COMPARE(flowSpy.count(),2); + QTRY_COMPARE(keyNavigationWrapsSpy.size(),2); + QTRY_COMPARE(cacheBufferSpy.size(),2); + QTRY_COMPARE(layoutSpy.size(),1); + QTRY_COMPARE(flowSpy.size(),2); gridView->setWrapEnabled(true); gridView->setCacheBuffer(5); gridView->setLayoutDirection(Qt::RightToLeft); - QTRY_COMPARE(keyNavigationWrapsSpy.count(),2); - QTRY_COMPARE(cacheBufferSpy.count(),2); - QTRY_COMPARE(layoutSpy.count(),1); - QTRY_COMPARE(flowSpy.count(),2); + QTRY_COMPARE(keyNavigationWrapsSpy.size(),2); + QTRY_COMPARE(cacheBufferSpy.size(),2); + QTRY_COMPARE(layoutSpy.size(),1); + QTRY_COMPARE(flowSpy.size(),2); gridView->setFlow(QQuickGridView::FlowTopToBottom); QTRY_COMPARE(gridView->flow(), QQuickGridView::FlowTopToBottom); - QTRY_COMPARE(flowSpy.count(),3); + QTRY_COMPARE(flowSpy.size(),3); gridView->setFlow(QQuickGridView::FlowTopToBottom); - QTRY_COMPARE(flowSpy.count(),3); + QTRY_COMPARE(flowSpy.size(),3); delete window; } @@ -2404,24 +2404,24 @@ void tst_QQuickGridView::componentChanges() QVERIFY(gridView->headerItem()); QVERIFY(gridView->footerItem()); - QTRY_COMPARE(highlightSpy.count(),1); - QTRY_COMPARE(delegateSpy.count(),1); - QTRY_COMPARE(headerSpy.count(),1); - QTRY_COMPARE(footerSpy.count(),1); - QTRY_COMPARE(headerItemSpy.count(),1); - QTRY_COMPARE(footerItemSpy.count(),1); + QTRY_COMPARE(highlightSpy.size(),1); + QTRY_COMPARE(delegateSpy.size(),1); + QTRY_COMPARE(headerSpy.size(),1); + QTRY_COMPARE(footerSpy.size(),1); + QTRY_COMPARE(headerItemSpy.size(),1); + QTRY_COMPARE(footerItemSpy.size(),1); gridView->setHighlight(&component); gridView->setDelegate(&delegateComponent); gridView->setHeader(&component); gridView->setFooter(&component); - QTRY_COMPARE(highlightSpy.count(),1); - QTRY_COMPARE(delegateSpy.count(),1); - QTRY_COMPARE(headerSpy.count(),1); - QTRY_COMPARE(footerSpy.count(),1); - QTRY_COMPARE(headerItemSpy.count(),1); - QTRY_COMPARE(footerItemSpy.count(),1); + QTRY_COMPARE(highlightSpy.size(),1); + QTRY_COMPARE(delegateSpy.size(),1); + QTRY_COMPARE(headerSpy.size(),1); + QTRY_COMPARE(footerSpy.size(),1); + QTRY_COMPARE(headerItemSpy.size(),1); + QTRY_COMPARE(footerItemSpy.size(),1); delete window; } @@ -2442,13 +2442,13 @@ void tst_QQuickGridView::modelChanges() gridView->setModel(modelVariant); QTRY_COMPARE(gridView->model(), modelVariant); - QTRY_COMPARE(modelSpy.count(),1); + QTRY_COMPARE(modelSpy.size(),1); gridView->setModel(modelVariant); - QTRY_COMPARE(modelSpy.count(),1); + QTRY_COMPARE(modelSpy.size(),1); gridView->setModel(QVariant()); - QTRY_COMPARE(modelSpy.count(),2); + QTRY_COMPARE(modelSpy.size(),2); delete window; } @@ -2578,7 +2578,7 @@ void tst_QQuickGridView::positionViewAtIndex() QTRY_COMPARE(gridview->contentY(), contentPos); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = index; i < model.count() && i < itemCount-index-1; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -3073,7 +3073,7 @@ void tst_QQuickGridView::footer() QSignalSpy footerItemSpy(gridview, SIGNAL(footerItemChanged())); QMetaObject::invokeMethod(window->rootObject(), "changeFooter"); - QCOMPARE(footerItemSpy.count(), 1); + QCOMPARE(footerItemSpy.size(), 1); footer = findItem<QQuickText>(contentItem, "footer"); QVERIFY(!footer); @@ -3292,7 +3292,7 @@ void tst_QQuickGridView::header() QSignalSpy headerItemSpy(gridview, SIGNAL(headerItemChanged())); QMetaObject::invokeMethod(window->rootObject(), "changeHeader"); - QCOMPARE(headerItemSpy.count(), 1); + QCOMPARE(headerItemSpy.size(), 1); header = findItem<QQuickText>(contentItem, "header"); QVERIFY(!header); @@ -3651,16 +3651,16 @@ void tst_QQuickGridView::resizeViewAndRepaint() // Ensure we handle -ve sizes gridview->setHeight(-100); - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 3); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).size(), 3); gridview->setCacheBuffer(120); - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 9); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).size(), 9); // ensure items in cache become visible gridview->setHeight(120); - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 15); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).size(), 15); - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -3672,9 +3672,9 @@ void tst_QQuickGridView::resizeViewAndRepaint() // ensure items outside view become invisible gridview->setHeight(60); - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 12); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).size(), 12); - itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -3730,8 +3730,8 @@ void tst_QQuickGridView::resizeGrid() // Confirm items positioned correctly and indexes correct QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); - QVERIFY(items.count() >= 18 && items.count() <= 21); - for (int i = 0; i < model.count() && i < items.count(); ++i) { + QVERIFY(items.size() >= 18 && items.size() <= 21); + for (int i = 0; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QCOMPARE(item->position(), expectedItemPos(gridview, i, 0)); @@ -3762,8 +3762,8 @@ void tst_QQuickGridView::resizeGrid() // Confirm items positioned correctly and indexes correct items = findItems<QQuickItem>(contentItem, "wrapper"); - QVERIFY(items.count() >= 28); - for (int i = 0; i < model.count() && i < items.count(); ++i) { + QVERIFY(items.size() >= 28); + for (int i = 0; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QCOMPARE(item->position(), expectedItemPos(gridview, i, 0)); @@ -3851,7 +3851,7 @@ void tst_QQuickGridView::changeColumnCount() QVERIFY(QQuickTest::qWaitForPolish(gridview)); // a single column of 6 items are visible - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); QCOMPARE(itemCount, 6); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); @@ -3863,7 +3863,7 @@ void tst_QQuickGridView::changeColumnCount() // now 6x3 grid is visible, plus 1 extra below for refill gridview->setWidth(240); QVERIFY(QQuickTest::qWaitForPolish(gridview)); - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); QCOMPARE(itemCount, 6*3 + 1); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); @@ -3875,7 +3875,7 @@ void tst_QQuickGridView::changeColumnCount() // back to single column gridview->setWidth(100); QVERIFY(QQuickTest::qWaitForPolish(gridview)); - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); QCOMPARE(itemCount, 6); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); @@ -3976,8 +3976,8 @@ void tst_QQuickGridView::onAdd() qApp->processEvents(); QVariantList result = gridview->property("addedDelegates").toList(); - QTRY_COMPARE(result.count(), items.count()); - for (int i=0; i<items.count(); i++) + QTRY_COMPARE(result.count(), items.size()); + for (int i=0; i<items.size(); i++) QCOMPARE(result[i].toString(), items[i].first); releaseView(window); @@ -4461,7 +4461,7 @@ void tst_QQuickGridView::snapOneRow() if (QQuickItemView::HighlightRangeMode(highlightRangeMode) == QQuickItemView::StrictlyEnforceRange) { QCOMPARE(gridview->currentIndex(), 2); - QCOMPARE(currentIndexSpy.count(), 1); + QCOMPARE(currentIndexSpy.size(), 1); } // flick to end @@ -4474,7 +4474,7 @@ void tst_QQuickGridView::snapOneRow() if (QQuickItemView::HighlightRangeMode(highlightRangeMode) == QQuickItemView::StrictlyEnforceRange) { QCOMPARE(gridview->currentIndex(), 6); - QCOMPARE(currentIndexSpy.count(), 3); + QCOMPARE(currentIndexSpy.size(), 3); } if (flow == QQuickGridView::FlowLeftToRight) @@ -4497,7 +4497,7 @@ void tst_QQuickGridView::snapOneRow() if (QQuickItemView::HighlightRangeMode(highlightRangeMode) == QQuickItemView::StrictlyEnforceRange) { QCOMPARE(gridview->currentIndex(), 0); - QCOMPARE(currentIndexSpy.count(), 6); + QCOMPARE(currentIndexSpy.size(), 6); } releaseView(window); @@ -4611,7 +4611,7 @@ void tst_QQuickGridView::populateTransitions() QCOMPARE(gridview->property("countAddTransitions").toInt(), 0); } - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i=0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); @@ -4633,7 +4633,7 @@ void tst_QQuickGridView::populateTransitions() // clear the model window->rootContext()->setContextProperty("testModel", QVariant()); QTRY_COMPARE(gridview->count(), 0); - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").count(), 0); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").size(), 0); gridview->setProperty("countPopulateTransitions", 0); gridview->setProperty("countAddTransitions", 0); @@ -4647,7 +4647,7 @@ void tst_QQuickGridView::populateTransitions() QTRY_COMPARE(gridview->property("countPopulateTransitions").toInt(), usePopulateTransition ? 18 : 0); QTRY_COMPARE(gridview->property("countAddTransitions").toInt(), 0); - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i=0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); @@ -4665,7 +4665,7 @@ void tst_QQuickGridView::populateTransitions() QTRY_COMPARE(gridview->property("countPopulateTransitions").toInt(), usePopulateTransition ? 18 : 0); QTRY_COMPARE(gridview->property("countAddTransitions").toInt(), 0); - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i=0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); @@ -4753,7 +4753,7 @@ void tst_QQuickGridView::addTransitions() targetIndexes << i; } } - QVERIFY(expectedTargetData.count() > 0); + QVERIFY(expectedTargetData.size() > 0); } // start animation @@ -4766,7 +4766,7 @@ void tst_QQuickGridView::addTransitions() QList<QQuickItem *> targetItems = findItems<QQuickItem>(contentItem, "wrapper", targetIndexes); if (shouldAnimateTargets) { - QTRY_COMPARE(gridview->property("targetTransitionsDone").toInt(), expectedTargetData.count()); + QTRY_COMPARE(gridview->property("targetTransitionsDone").toInt(), expectedTargetData.size()); QTRY_COMPARE(gridview->property("displaceTransitionsDone").toInt(), expectedDisplacedIndexes.isValid() ? expectedDisplacedIndexes.count() : 0); @@ -4792,7 +4792,7 @@ void tst_QQuickGridView::addTransitions() QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); int firstVisibleIndex = -1; - for (int i=0; i<items.count(); i++) { + for (int i=0; i<items.size(); i++) { if (items[i]->y() >= gridview->contentY()) { QQmlExpression e(qmlContext(items[i]), items[i], "index"); firstVisibleIndex = e.evaluate().toInt(); @@ -4802,7 +4802,7 @@ void tst_QQuickGridView::addTransitions() QVERIFY2(firstVisibleIndex >= 0, QTest::toString(firstVisibleIndex)); // verify all items moved to the correct final positions - for (int i = firstVisibleIndex; i < model.count() && i < items.count(); ++i) { + for (int i = firstVisibleIndex; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QCOMPARE(item->x(), (i%3)*80.0); @@ -4965,7 +4965,7 @@ void tst_QQuickGridView::moveTransitions() model.moveItems(moveFrom, moveTo, moveCount); gridview->forceLayout(); - QTRY_COMPARE(gridview->property("targetTransitionsDone").toInt(), expectedTargetData.count()); + QTRY_COMPARE(gridview->property("targetTransitionsDone").toInt(), expectedTargetData.size()); QTRY_COMPARE(gridview->property("displaceTransitionsDone").toInt(), expectedDisplacedIndexes.isValid() ? expectedDisplacedIndexes.count() : 0); @@ -4989,7 +4989,7 @@ void tst_QQuickGridView::moveTransitions() QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); int firstVisibleIndex = -1; - for (int i=0; i<items.count(); i++) { + for (int i=0; i<items.size(); i++) { if (items[i]->y() >= gridview->contentY()) { QQmlExpression e(qmlContext(items[i]), items[i], "index"); firstVisibleIndex = e.evaluate().toInt(); @@ -5000,7 +5000,7 @@ void tst_QQuickGridView::moveTransitions() // verify all items moved to the correct final positions qreal pixelOffset = 60 * rowOffsetAfterMove; - for (int i=firstVisibleIndex; i < model.count() && i < items.count(); ++i) { + for (int i=firstVisibleIndex; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QCOMPARE(item->x(), (i%3)*80.0); @@ -5201,13 +5201,13 @@ void tst_QQuickGridView::removeTransitions() targetIndexes << i; } } - QVERIFY(expectedTargetData.count() > 0); + QVERIFY(expectedTargetData.size() > 0); } // calculate targetItems and expectedTargets before model changes QList<QQuickItem *> targetItems = findItems<QQuickItem>(contentItem, "wrapper", targetIndexes); QVariantMap expectedTargets; - for (int i=0; i<targetIndexes.count(); i++) + for (int i=0; i<targetIndexes.size(); i++) expectedTargets[model.name(targetIndexes[i])] = targetIndexes[i]; // start animation @@ -5216,7 +5216,7 @@ void tst_QQuickGridView::removeTransitions() QTRY_COMPARE(model.count(), gridview->count()); if (shouldAnimateTargets || expectedDisplacedIndexes.isValid()) { - QTRY_COMPARE(gridview->property("targetTransitionsDone").toInt(), expectedTargetData.count()); + QTRY_COMPARE(gridview->property("targetTransitionsDone").toInt(), expectedTargetData.size()); QTRY_COMPARE(gridview->property("displaceTransitionsDone").toInt(), expectedDisplacedIndexes.isValid() ? expectedDisplacedIndexes.count() : 0); @@ -5241,9 +5241,9 @@ void tst_QQuickGridView::removeTransitions() } QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); - int itemCount = items.count(); + int itemCount = items.size(); int firstVisibleIndex = -1; - for (int i=0; i<items.count(); i++) { + for (int i=0; i<items.size(); i++) { QQmlExpression e(qmlContext(items[i]), items[i], "index"); int index = e.evaluate().toInt(); if (firstVisibleIndex < 0 && items[i]->y() >= gridview->contentY()) @@ -5440,10 +5440,10 @@ void tst_QQuickGridView::displacedTransitions() // check the correct number of target items and indexes were received QCOMPARE(resultTargetIndexes.count(), expectedDisplacedIndexes.count()); for (int i=0; i<resultTargetIndexes.count(); i++) - QCOMPARE(resultTargetIndexes[i].value<QList<int> >().count(), change.count); + QCOMPARE(resultTargetIndexes[i].value<QList<int> >().size(), change.count); QCOMPARE(resultTargetItems.count(), expectedDisplacedIndexes.count()); for (int i=0; i<resultTargetItems.count(); i++) - QCOMPARE(resultTargetItems[i].toList().count(), change.count); + QCOMPARE(resultTargetItems[i].toList().size(), change.count); } else { QCOMPARE(resultTargetIndexes.count(), 0); QCOMPARE(resultTargetItems.count(), 0); @@ -5473,7 +5473,7 @@ void tst_QQuickGridView::displacedTransitions() // verify all items moved to the correct final positions QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); - for (int i=0; i < model.count() && i < items.count(); ++i) { + for (int i=0; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QCOMPARE(item->x(), (i%3)*80.0); @@ -5626,7 +5626,7 @@ void tst_QQuickGridView::multipleTransitions() int timeBetweenActions = window->rootObject()->property("timeBetweenActions").toInt(); - for (int i=0; i<changes.count(); i++) { + for (int i=0; i<changes.size(); i++) { switch (changes[i].type) { case ListChange::Inserted: { @@ -5636,7 +5636,7 @@ void tst_QQuickGridView::multipleTransitions() model.insertItems(changes[i].index, targetItems); gridview->forceLayout(); QTRY_COMPARE(model.count(), gridview->count()); - if (i == changes.count() - 1) { + if (i == changes.size() - 1) { QTRY_VERIFY(!gridview->property("runningAddTargets").toBool()); QTRY_VERIFY(!gridview->property("runningAddDisplaced").toBool()); } else { @@ -5648,7 +5648,7 @@ void tst_QQuickGridView::multipleTransitions() model.removeItems(changes[i].index, changes[i].count); gridview->forceLayout(); QTRY_COMPARE(model.count(), gridview->count()); - if (i == changes.count() - 1) { + if (i == changes.size() - 1) { QTRY_VERIFY(!gridview->property("runningRemoveTargets").toBool()); QTRY_VERIFY(!gridview->property("runningRemoveDisplaced").toBool()); } else { @@ -5659,7 +5659,7 @@ void tst_QQuickGridView::multipleTransitions() model.moveItems(changes[i].index, changes[i].to, changes[i].count); gridview->forceLayout(); QVERIFY(QQuickTest::qWaitForPolish(gridview)); - if (i == changes.count() - 1) { + if (i == changes.size() - 1) { QTRY_VERIFY(!gridview->property("runningMoveTargets").toBool()); QTRY_VERIFY(!gridview->property("runningMoveDisplaced").toBool()); } else { @@ -5683,7 +5683,7 @@ void tst_QQuickGridView::multipleTransitions() QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); int firstVisibleIndex = -1; - for (int i=0; i<items.count(); i++) { + for (int i=0; i<items.size(); i++) { if (items[i]->y() >= contentY) { QQmlExpression e(qmlContext(items[i]), items[i], "index"); firstVisibleIndex = e.evaluate().toInt(); @@ -5694,7 +5694,7 @@ void tst_QQuickGridView::multipleTransitions() QVERIFY2(firstVisibleIndex >= 0, QTest::toString(firstVisibleIndex)); // verify all items moved to the correct final positions - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i=firstVisibleIndex; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); @@ -5802,7 +5802,7 @@ void tst_QQuickGridView::multipleDisplaced() // verify all items moved to the correct final positions QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); - for (int i=0; i < model.count() && i < items.count(); ++i) { + for (int i=0; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QTRY_COMPARE(item->x(), (i%3)*80.0); @@ -5896,7 +5896,7 @@ void tst_QQuickGridView::cacheBuffer() QVERIFY(gridview->model() != 0); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QTRY_COMPARE(item->x(), (i%3)*80.0); @@ -5926,7 +5926,7 @@ void tst_QQuickGridView::cacheBuffer() } int newItemCount = 0; - newItemCount = findItems<QQuickItem>(contentItem, "wrapper", false).count(); + newItemCount = findItems<QQuickItem>(contentItem, "wrapper", false).size(); // Confirm items positioned correctly for (int i = 0; i < model.count() && i < newItemCount; ++i) { @@ -6436,7 +6436,7 @@ void tst_QQuickGridView::matchItemsAndIndexes(const QVariantMap &items, const Qa qDebug() << itemIndex; QCOMPARE(model.name(itemIndex), name); } - QCOMPARE(items.count(), expectedIndexes.count()); + QCOMPARE(items.count(), expectedIndexes.size()); } void tst_QQuickGridView::matchItemLists(const QVariantList &itemLists, const QList<QQuickItem *> &expectedItems) @@ -6448,7 +6448,7 @@ void tst_QQuickGridView::matchItemLists(const QVariantList &itemLists, const QLi QVERIFY2(o, QTest::toString(QString("Invalid actual item at %1").arg(j))); QVERIFY2(expectedItems.contains(o), QTest::toString(QString("Cannot match item %1").arg(j))); } - QCOMPARE(current.count(), expectedItems.count()); + QCOMPARE(current.count(), expectedItems.size()); } } @@ -6552,11 +6552,11 @@ void tst_QQuickGridView::jsArrayChange() } view->setModel(QVariant::fromValue(array1)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // no change view->setModel(QVariant::fromValue(array2)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_QQuickGridView::contentHeightWithDelayRemove_data() @@ -6725,7 +6725,7 @@ void tst_QQuickGridView::keyNavigationEnabled() // of disabling both mouse and keyboard interaction. QSignalSpy enabledSpy(gridView, SIGNAL(keyNavigationEnabledChanged())); gridView->setInteractive(false); - QCOMPARE(enabledSpy.count(), 1); + QCOMPARE(enabledSpy.size(), 1); QCOMPARE(gridView->isKeyNavigationEnabled(), false); flick(window.data(), QPoint(200, 175), QPoint(200, 50), 100); @@ -6738,17 +6738,17 @@ void tst_QQuickGridView::keyNavigationEnabled() // Check that isKeyNavigationEnabled implicitly follows the value of interactive. gridView->setInteractive(true); - QCOMPARE(enabledSpy.count(), 2); + QCOMPARE(enabledSpy.size(), 2); QCOMPARE(gridView->isKeyNavigationEnabled(), true); // Change it back again for the next check. gridView->setInteractive(false); - QCOMPARE(enabledSpy.count(), 3); + QCOMPARE(enabledSpy.size(), 3); QCOMPARE(gridView->isKeyNavigationEnabled(), false); // Setting keyNavigationEnabled to true shouldn't enable mouse interaction. gridView->setKeyNavigationEnabled(true); - QCOMPARE(enabledSpy.count(), 4); + QCOMPARE(enabledSpy.size(), 4); flick(window.data(), QPoint(200, 175), QPoint(200, 50), 100); QVERIFY(!gridView->isMoving()); QCOMPARE(gridView->contentY(), 0.0); @@ -6761,7 +6761,7 @@ void tst_QQuickGridView::keyNavigationEnabled() // Changing interactive now shouldn't result in keyNavigationEnabled changing, // since we broke the "binding". gridView->setInteractive(true); - QCOMPARE(enabledSpy.count(), 4); + QCOMPARE(enabledSpy.size(), 4); // Keyboard interaction shouldn't work now. gridView->setKeyNavigationEnabled(false); diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp index d255bcd5b5..89b20c3131 100644 --- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp +++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp @@ -571,9 +571,9 @@ void tst_qquickimage::noLoading() ctxt->setContextProperty("srcImage", testFileUrl("green.png")); QTRY_COMPARE(obj->status(), QQuickImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); - QTRY_COMPARE(sourceSpy.count(), 1); - QTRY_COMPARE(progressSpy.count(), 0); - QTRY_COMPARE(statusSpy.count(), 1); + QTRY_COMPARE(sourceSpy.size(), 1); + QTRY_COMPARE(progressSpy.size(), 0); + QTRY_COMPARE(statusSpy.size(), 1); // Loading remote file ctxt->setContextProperty("srcImage", server.url("/rect.png")); @@ -581,9 +581,9 @@ void tst_qquickimage::noLoading() QTRY_COMPARE(obj->progress(), 0.0); QTRY_COMPARE(obj->status(), QQuickImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); - QTRY_COMPARE(sourceSpy.count(), 2); - QTRY_VERIFY(progressSpy.count() >= 2); - QTRY_COMPARE(statusSpy.count(), 3); + QTRY_COMPARE(sourceSpy.size(), 2); + QTRY_VERIFY(progressSpy.size() >= 2); + QTRY_COMPARE(statusSpy.size(), 3); // Loading remote file again - should not go through 'Loading' state. progressSpy.clear(); @@ -591,9 +591,9 @@ void tst_qquickimage::noLoading() ctxt->setContextProperty("srcImage", server.url("/rect.png")); QTRY_COMPARE(obj->status(), QQuickImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); - QTRY_COMPARE(sourceSpy.count(), 4); - QTRY_COMPARE(progressSpy.count(), 0); - QTRY_COMPARE(statusSpy.count(), 5); + QTRY_COMPARE(sourceSpy.size(), 4); + QTRY_COMPARE(progressSpy.size(), 0); + QTRY_COMPARE(statusSpy.size(), 5); delete obj; } @@ -648,17 +648,17 @@ void tst_qquickimage::sourceSize_QTBUG_14303() QTRY_COMPARE(obj->sourceSize().width(), 200); QTRY_COMPARE(obj->sourceSize().height(), 200); - QTRY_COMPARE(sourceSizeSpy.count(), 0); + QTRY_COMPARE(sourceSizeSpy.size(), 0); ctxt->setContextProperty("srcImage", testFileUrl("colors.png")); QTRY_COMPARE(obj->sourceSize().width(), 120); QTRY_COMPARE(obj->sourceSize().height(), 120); - QTRY_COMPARE(sourceSizeSpy.count(), 1); + QTRY_COMPARE(sourceSizeSpy.size(), 1); ctxt->setContextProperty("srcImage", testFileUrl("heart200.png")); QTRY_COMPARE(obj->sourceSize().width(), 200); QTRY_COMPARE(obj->sourceSize().height(), 200); - QTRY_COMPARE(sourceSizeSpy.count(), 2); + QTRY_COMPARE(sourceSizeSpy.size(), 2); delete obj; } @@ -800,48 +800,48 @@ void tst_qquickimage::sourceSizeChanges() // Local ctxt->setContextProperty("srcImage", QUrl("")); QTRY_COMPARE(img->status(), QQuickImage::Null); - QTRY_COMPARE(sourceSizeSpy.count(), 0); + QTRY_COMPARE(sourceSizeSpy.size(), 0); ctxt->setContextProperty("srcImage", testFileUrl("heart.png")); QTRY_COMPARE(img->status(), QQuickImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 1); + QTRY_COMPARE(sourceSizeSpy.size(), 1); ctxt->setContextProperty("srcImage", testFileUrl("heart.png")); QTRY_COMPARE(img->status(), QQuickImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 1); + QTRY_COMPARE(sourceSizeSpy.size(), 1); ctxt->setContextProperty("srcImage", testFileUrl("heart_copy.png")); QTRY_COMPARE(img->status(), QQuickImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 1); + QTRY_COMPARE(sourceSizeSpy.size(), 1); ctxt->setContextProperty("srcImage", testFileUrl("colors.png")); QTRY_COMPARE(img->status(), QQuickImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 2); + QTRY_COMPARE(sourceSizeSpy.size(), 2); ctxt->setContextProperty("srcImage", QUrl("")); QTRY_COMPARE(img->status(), QQuickImage::Null); - QTRY_COMPARE(sourceSizeSpy.count(), 3); + QTRY_COMPARE(sourceSizeSpy.size(), 3); // Remote ctxt->setContextProperty("srcImage", server.url("/heart.png")); QTRY_COMPARE(img->status(), QQuickImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 4); + QTRY_COMPARE(sourceSizeSpy.size(), 4); ctxt->setContextProperty("srcImage", server.url("/heart.png")); QTRY_COMPARE(img->status(), QQuickImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 4); + QTRY_COMPARE(sourceSizeSpy.size(), 4); ctxt->setContextProperty("srcImage", server.url("/heart_copy.png")); QTRY_COMPARE(img->status(), QQuickImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 4); + QTRY_COMPARE(sourceSizeSpy.size(), 4); ctxt->setContextProperty("srcImage", server.url("/colors.png")); QTRY_COMPARE(img->status(), QQuickImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 5); + QTRY_COMPARE(sourceSizeSpy.size(), 5); ctxt->setContextProperty("srcImage", QUrl("")); QTRY_COMPARE(img->status(), QQuickImage::Null); - QTRY_COMPARE(sourceSizeSpy.count(), 6); + QTRY_COMPARE(sourceSizeSpy.size(), 6); delete img; } @@ -943,17 +943,17 @@ void tst_qquickimage::progressAndStatusChanges() ctxt->setContextProperty("srcImage", testFileUrl("heart.png")); QTRY_COMPARE(obj->status(), QQuickImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); - QTRY_COMPARE(sourceSpy.count(), 0); - QTRY_COMPARE(progressSpy.count(), 0); - QTRY_COMPARE(statusSpy.count(), 0); + QTRY_COMPARE(sourceSpy.size(), 0); + QTRY_COMPARE(progressSpy.size(), 0); + QTRY_COMPARE(statusSpy.size(), 0); // Loading local file ctxt->setContextProperty("srcImage", testFileUrl("colors.png")); QTRY_COMPARE(obj->status(), QQuickImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); - QTRY_COMPARE(sourceSpy.count(), 1); - QTRY_COMPARE(progressSpy.count(), 0); - QTRY_COMPARE(statusSpy.count(), 1); + QTRY_COMPARE(sourceSpy.size(), 1); + QTRY_COMPARE(progressSpy.size(), 0); + QTRY_COMPARE(statusSpy.size(), 1); // Loading remote file ctxt->setContextProperty("srcImage", server.url("/heart.png")); @@ -961,16 +961,16 @@ void tst_qquickimage::progressAndStatusChanges() QTRY_COMPARE(obj->progress(), 0.0); QTRY_COMPARE(obj->status(), QQuickImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); - QTRY_COMPARE(sourceSpy.count(), 2); - QTRY_VERIFY(progressSpy.count() > 1); - QTRY_COMPARE(statusSpy.count(), 3); + QTRY_COMPARE(sourceSpy.size(), 2); + QTRY_VERIFY(progressSpy.size() > 1); + QTRY_COMPARE(statusSpy.size(), 3); ctxt->setContextProperty("srcImage", ""); QTRY_COMPARE(obj->status(), QQuickImage::Null); QTRY_COMPARE(obj->progress(), 0.0); - QTRY_COMPARE(sourceSpy.count(), 3); - QTRY_VERIFY(progressSpy.count() > 2); - QTRY_COMPARE(statusSpy.count(), 4); + QTRY_COMPARE(sourceSpy.size(), 3); + QTRY_VERIFY(progressSpy.size() > 2); + QTRY_COMPARE(statusSpy.size(), 4); delete obj; } @@ -1198,7 +1198,7 @@ void tst_qquickimage::multiFrame() if (asynchronous) { QCOMPARE(image->frameCount(), 0); QTRY_COMPARE(image->frameCount(), 4); - QCOMPARE(countSpy.count(), 1); + QCOMPARE(countSpy.size(), 1); } else { QCOMPARE(image->frameCount(), 4); } @@ -1217,7 +1217,7 @@ void tst_qquickimage::multiFrame() image->setCurrentFrame(1); QTRY_COMPARE(image->status(), QQuickImageBase::Ready); - QCOMPARE(currentSpy.count(), 1); + QCOMPARE(currentSpy.size(), 1); QCOMPARE(image->currentFrame(), 1); contents = toUnscaledImage(view.grabWindow()); // The second frame is a green ball, approximately qRgba(0x27, 0xc8, 0x22, 0xff) diff --git a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp index aa44e9ad61..78727d32a0 100644 --- a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp +++ b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp @@ -423,7 +423,7 @@ void tst_qquickimageprovider::threadTest() //MUST not deadlock QVERIFY(obj != nullptr); QList<QQuickImage *> images = obj->findChildren<QQuickImage *>(); - QCOMPARE(images.count(), 4); + QCOMPARE(images.size(), 4); QTest::qWait(100); foreach (QQuickImage *img, images) { QCOMPARE(img->status(), QQuickImage::Loading); @@ -542,7 +542,7 @@ void tst_qquickimageprovider::asyncTextureTest() //MUST not deadlock QVERIFY(obj != nullptr); QList<QQuickImage *> images = obj->findChildren<QQuickImage *>(); - QCOMPARE(images.count(), 4); + QCOMPARE(images.size(), 4); QTRY_COMPARE(provider->pool.activeThreadCount(), 4); foreach (QQuickImage *img, images) { @@ -615,7 +615,7 @@ void tst_qquickimageprovider::instantAsyncTextureTest() QVERIFY(!obj.isNull()); const QList<QQuickImage *> images = obj->findChildren<QQuickImage *>(); - QCOMPARE(images.count(), 4); + QCOMPARE(images.size(), 4); for (QQuickImage *img: images) { QTRY_COMPARE(img->status(), QQuickImage::Ready); diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp index c74134c113..2736d6d9bb 100644 --- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp @@ -1035,13 +1035,13 @@ void tst_qquickitem::constructor() QQuickItem *child1 = new QQuickItem(root.data()); QCOMPARE(child1->parent(), root.data()); QCOMPARE(child1->parentItem(), root.data()); - QCOMPARE(root->childItems().count(), 1); + QCOMPARE(root->childItems().size(), 1); QCOMPARE(root->childItems().at(0), child1); QQuickItem *child2 = new QQuickItem(root.data()); QCOMPARE(child2->parent(), root.data()); QCOMPARE(child2->parentItem(), root.data()); - QCOMPARE(root->childItems().count(), 2); + QCOMPARE(root->childItems().size(), 2); QCOMPARE(root->childItems().at(0), child1); QCOMPARE(root->childItems().at(1), child2); } @@ -1059,7 +1059,7 @@ void tst_qquickitem::setParentItem() child1->setParentItem(root); QVERIFY(!child1->parent()); QCOMPARE(child1->parentItem(), root); - QCOMPARE(root->childItems().count(), 1); + QCOMPARE(root->childItems().size(), 1); QCOMPARE(root->childItems().at(0), child1); QQuickItem *child2 = new QQuickItem; @@ -1068,14 +1068,14 @@ void tst_qquickitem::setParentItem() child2->setParentItem(root); QVERIFY(!child2->parent()); QCOMPARE(child2->parentItem(), root); - QCOMPARE(root->childItems().count(), 2); + QCOMPARE(root->childItems().size(), 2); QCOMPARE(root->childItems().at(0), child1); QCOMPARE(root->childItems().at(1), child2); child1->setParentItem(nullptr); QVERIFY(!child1->parent()); QVERIFY(!child1->parentItem()); - QCOMPARE(root->childItems().count(), 1); + QCOMPARE(root->childItems().size(), 1); QCOMPARE(root->childItems().at(0), child2); delete root; @@ -1565,7 +1565,7 @@ void tst_qquickitem::polishLoopDetection() } QList<QQuickItem*> items = window.contentItem()->childItems(); - for (int i = 0; i < items.count(); ++i) { + for (int i = 0; i < items.size(); ++i) { static_cast<TestPolishItem*>(items.at(i))->doPolish(); } item = static_cast<TestPolishItem*>(items.first()); @@ -1921,7 +1921,7 @@ void tst_qquickitem::paintOrder() QList<QQuickItem*> list = QQuickItemPrivate::get(root)->paintOrderChildItems(); QStringList items; - for (int i = 0; i < list.count(); ++i) + for (int i = 0; i < list.size(); ++i) items << list.at(i)->objectName(); QCOMPARE(items, expected); diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp index 6baaf72d5b..db20f464f7 100644 --- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp @@ -2548,19 +2548,19 @@ void tst_QQuickItem::smooth() item->setSmooth(true); QVERIFY(item->smooth()); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); QList<QVariant> arguments = spy.first(); - QCOMPARE(arguments.count(), 1); + QCOMPARE(arguments.size(), 1); QVERIFY(arguments.at(0).toBool()); item->setSmooth(true); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); item->setSmooth(false); QVERIFY(!item->smooth()); - QCOMPARE(spy.count(),2); + QCOMPARE(spy.size(),2); item->setSmooth(false); - QCOMPARE(spy.count(),2); + QCOMPARE(spy.size(),2); delete item; } @@ -2577,19 +2577,19 @@ void tst_QQuickItem::antialiasing() item->setAntialiasing(true); QVERIFY(item->antialiasing()); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); QList<QVariant> arguments = spy.first(); - QCOMPARE(arguments.count(), 1); + QCOMPARE(arguments.size(), 1); QVERIFY(arguments.at(0).toBool()); item->setAntialiasing(true); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); item->setAntialiasing(false); QVERIFY(!item->antialiasing()); - QCOMPARE(spy.count(),2); + QCOMPARE(spy.size(),2); item->setAntialiasing(false); - QCOMPARE(spy.count(),2); + QCOMPARE(spy.size(),2); delete item; } @@ -2608,18 +2608,18 @@ void tst_QQuickItem::clip() QVERIFY(item->clip()); QList<QVariant> arguments = spy.first(); - QCOMPARE(arguments.count(), 1); + QCOMPARE(arguments.size(), 1); QVERIFY(arguments.at(0).toBool()); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); item->setClip(true); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); item->setClip(false); QVERIFY(!item->clip()); - QCOMPARE(spy.count(),2); + QCOMPARE(spy.size(),2); item->setClip(false); - QCOMPARE(spy.count(),2); + QCOMPARE(spy.size(),2); delete item; } @@ -2929,50 +2929,50 @@ void tst_QQuickItem::propertyChanges() item->setBaselineOffset(10.0); QCOMPARE(item->parentItem(), parentItem); - QCOMPARE(parentSpy.count(),1); + QCOMPARE(parentSpy.size(),1); QList<QVariant> parentArguments = parentSpy.first(); - QCOMPARE(parentArguments.count(), 1); + QCOMPARE(parentArguments.size(), 1); QCOMPARE(item->parentItem(), qvariant_cast<QQuickItem *>(parentArguments.at(0))); - QCOMPARE(childrenChangedSpy.count(),1); + QCOMPARE(childrenChangedSpy.size(),1); item->setParentItem(parentItem); - QCOMPARE(childrenChangedSpy.count(),1); + QCOMPARE(childrenChangedSpy.size(),1); QCOMPARE(item->width(), 100.0); - QCOMPARE(widthSpy.count(),1); + QCOMPARE(widthSpy.size(),1); QCOMPARE(item->height(), 200.0); - QCOMPARE(heightSpy.count(),1); + QCOMPARE(heightSpy.size(),1); QCOMPARE(item->baselineOffset(), 10.0); - QCOMPARE(baselineOffsetSpy.count(),1); + QCOMPARE(baselineOffsetSpy.size(),1); QList<QVariant> baselineOffsetArguments = baselineOffsetSpy.first(); - QCOMPARE(baselineOffsetArguments.count(), 1); + QCOMPARE(baselineOffsetArguments.size(), 1); QCOMPARE(item->baselineOffset(), baselineOffsetArguments.at(0).toReal()); QCOMPARE(parentItem->childrenRect(), QRectF(0.0,0.0,100.0,200.0)); - QCOMPARE(childrenRectSpy.count(),1); + QCOMPARE(childrenRectSpy.size(),1); QList<QVariant> childrenRectArguments = childrenRectSpy.at(0); - QCOMPARE(childrenRectArguments.count(), 1); + QCOMPARE(childrenRectArguments.size(), 1); QCOMPARE(parentItem->childrenRect(), childrenRectArguments.at(0).toRectF()); QCOMPARE(item->hasActiveFocus(), true); - QCOMPARE(focusSpy.count(),1); + QCOMPARE(focusSpy.size(),1); QList<QVariant> focusArguments = focusSpy.first(); - QCOMPARE(focusArguments.count(), 1); + QCOMPARE(focusArguments.size(), 1); QCOMPARE(focusArguments.at(0).toBool(), true); QCOMPARE(parentItem->hasActiveFocus(), false); QCOMPARE(parentItem->hasFocus(), false); - QCOMPARE(wantsFocusSpy.count(),0); + QCOMPARE(wantsFocusSpy.size(),0); item->setX(10.0); QCOMPARE(item->x(), 10.0); - QCOMPARE(xSpy.count(), 1); + QCOMPARE(xSpy.size(), 1); item->setY(10.0); QCOMPARE(item->y(), 10.0); - QCOMPARE(ySpy.count(), 1); + QCOMPARE(ySpy.size(), 1); delete window; } @@ -3257,7 +3257,7 @@ void tst_QQuickItem::changeListener() QCOMPARE(child2Listener.count(QQuickItemPrivate::Destroyed), 1); QQuickItemPrivate::get(parent)->removeItemChangeListener(&parentListener, QQuickItemPrivate::Children); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), 0); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), 0); // QTBUG-54732: all listeners should get invoked even if they remove themselves while iterating the listeners QList<TestListener *> listeners; @@ -3267,89 +3267,89 @@ void tst_QQuickItem::changeListener() // itemVisibilityChanged x 5 foreach (TestListener *listener, listeners) QQuickItemPrivate::get(parent)->addItemChangeListener(listener, QQuickItemPrivate::Visibility); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), listeners.count()); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), listeners.size()); parent->setVisible(false); foreach (TestListener *listener, listeners) QCOMPARE(listener->count(QQuickItemPrivate::Visibility), 1); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), 0); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), 0); // itemRotationChanged x 5 foreach (TestListener *listener, listeners) QQuickItemPrivate::get(parent)->addItemChangeListener(listener, QQuickItemPrivate::Rotation); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), listeners.count()); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), listeners.size()); parent->setRotation(90); foreach (TestListener *listener, listeners) QCOMPARE(listener->count(QQuickItemPrivate::Rotation), 1); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), 0); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), 0); // itemOpacityChanged x 5 foreach (TestListener *listener, listeners) QQuickItemPrivate::get(parent)->addItemChangeListener(listener, QQuickItemPrivate::Opacity); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), listeners.count()); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), listeners.size()); parent->setOpacity(0.5); foreach (TestListener *listener, listeners) QCOMPARE(listener->count(QQuickItemPrivate::Opacity), 1); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), 0); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), 0); // itemChildAdded() x 5 foreach (TestListener *listener, listeners) QQuickItemPrivate::get(parent)->addItemChangeListener(listener, QQuickItemPrivate::Children); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), listeners.count()); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), listeners.size()); child1 = new QQuickItem(parent); foreach (TestListener *listener, listeners) QCOMPARE(listener->count(QQuickItemPrivate::Children), 1); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), 0); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), 0); // itemParentChanged() x 5 foreach (TestListener *listener, listeners) QQuickItemPrivate::get(child1)->addItemChangeListener(listener, QQuickItemPrivate::Parent); - QCOMPARE(QQuickItemPrivate::get(child1)->changeListeners.count(), listeners.count()); + QCOMPARE(QQuickItemPrivate::get(child1)->changeListeners.size(), listeners.size()); child1->setParentItem(nullptr); foreach (TestListener *listener, listeners) QCOMPARE(listener->count(QQuickItemPrivate::Parent), 1); - QCOMPARE(QQuickItemPrivate::get(child1)->changeListeners.count(), 0); + QCOMPARE(QQuickItemPrivate::get(child1)->changeListeners.size(), 0); // itemImplicitWidthChanged() x 5 foreach (TestListener *listener, listeners) QQuickItemPrivate::get(parent)->addItemChangeListener(listener, QQuickItemPrivate::ImplicitWidth); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), listeners.count()); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), listeners.size()); parent->setImplicitWidth(parent->implicitWidth() + 1); foreach (TestListener *listener, listeners) QCOMPARE(listener->count(QQuickItemPrivate::ImplicitWidth), 1); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), 0); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), 0); // itemImplicitHeightChanged() x 5 foreach (TestListener *listener, listeners) QQuickItemPrivate::get(parent)->addItemChangeListener(listener, QQuickItemPrivate::ImplicitHeight); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), listeners.count()); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), listeners.size()); parent->setImplicitHeight(parent->implicitHeight() + 1); foreach (TestListener *listener, listeners) QCOMPARE(listener->count(QQuickItemPrivate::ImplicitHeight), 1); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), 0); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), 0); // itemGeometryChanged() x 5 foreach (TestListener *listener, listeners) QQuickItemPrivate::get(parent)->addItemChangeListener(listener, QQuickItemPrivate::Geometry); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), listeners.count()); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), listeners.size()); parent->setWidth(parent->width() + 1); foreach (TestListener *listener, listeners) QCOMPARE(listener->count(QQuickItemPrivate::Geometry), 1); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), 0); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), 0); // itemChildRemoved() x 5 child1->setParentItem(parent); foreach (TestListener *listener, listeners) QQuickItemPrivate::get(parent)->addItemChangeListener(listener, QQuickItemPrivate::Children); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), listeners.count()); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), listeners.size()); delete child1; foreach (TestListener *listener, listeners) QCOMPARE(listener->count(QQuickItemPrivate::Children), 2); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), 0); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), 0); // itemDestroyed() x 5 foreach (TestListener *listener, listeners) QQuickItemPrivate::get(parent)->addItemChangeListener(listener, QQuickItemPrivate::Destroyed); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), listeners.count()); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), listeners.size()); delete parent; foreach (TestListener *listener, listeners) QCOMPARE(listener->count(QQuickItemPrivate::Destroyed), 1); diff --git a/tests/auto/quick/qquicklistview/proxytestinnermodel.cpp b/tests/auto/quick/qquicklistview/proxytestinnermodel.cpp index c0dbb641fb..d00b417429 100644 --- a/tests/auto/quick/qquicklistview/proxytestinnermodel.cpp +++ b/tests/auto/quick/qquicklistview/proxytestinnermodel.cpp @@ -28,7 +28,7 @@ int ProxyTestInnerModel::rowCount(const QModelIndex &parent) const if (parent.isValid()) return 0; - return m_values.count(); + return m_values.size(); } int ProxyTestInnerModel::columnCount(const QModelIndex &parent) const @@ -49,7 +49,7 @@ QVariant ProxyTestInnerModel::data(const QModelIndex &index, int role) const void ProxyTestInnerModel::append(const QString &s) { - beginInsertRows(QModelIndex(), m_values.count(), m_values.count()); + beginInsertRows(QModelIndex(), m_values.size(), m_values.size()); m_values << s; endInsertRows(); } diff --git a/tests/auto/quick/qquicklistview/randomsortmodel.cpp b/tests/auto/quick/qquicklistview/randomsortmodel.cpp index 764dc81fb7..3e0c45bb1a 100644 --- a/tests/auto/quick/qquicklistview/randomsortmodel.cpp +++ b/tests/auto/quick/qquicklistview/randomsortmodel.cpp @@ -23,7 +23,7 @@ QHash<int, QByteArray> RandomSortModel::roleNames() const int RandomSortModel::rowCount(const QModelIndex& parent) const { if (!parent.isValid()) - return mData.count(); + return mData.size(); return 0; } @@ -34,7 +34,7 @@ QVariant RandomSortModel::data(const QModelIndex& index, int role) const return QVariant(); } - if (index.row() >= mData.count()) { + if (index.row() >= mData.size()) { return QVariant(); } @@ -49,14 +49,14 @@ QVariant RandomSortModel::data(const QModelIndex& index, int role) const void RandomSortModel::randomize() { - const int row = QRandomGenerator::global()->bounded(mData.count()); + const int row = QRandomGenerator::global()->bounded(mData.size()); int random; bool exists = false; // Make sure we won't end up with two items with the same weight, as that // would make unit-testing much harder do { exists = false; - random = QRandomGenerator::global()->bounded(mData.count() * 10); + random = QRandomGenerator::global()->bounded(mData.size() * 10); QList<QPair<QString, int> >::ConstIterator iter, end; for (iter = mData.constBegin(), end = mData.constEnd(); iter != end; ++iter) { if ((*iter).second == random) { diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 828eaeacb4..79dcc5a076 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -445,7 +445,7 @@ void tst_QQuickListView::items(const QUrl &source) QTRY_COMPARE(listview->count(), model.count()); QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count()); listview->forceLayout(); - QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + QTRY_COMPARE(contentItem->childItems().size(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item // current item should be first item QTRY_COMPARE(listview->currentItem(), findItem<QQuickItem>(contentItem, "wrapper", 0)); @@ -563,7 +563,7 @@ void tst_QQuickListView::inserted(const QUrl &source) model.insertItem(1, "Will", "9876"); QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count()); - QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + QTRY_COMPARE(contentItem->childItems().size(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item QQuickText *name = findItem<QQuickText>(contentItem, "textName", 1); QTRY_VERIFY(name != nullptr); @@ -581,7 +581,7 @@ void tst_QQuickListView::inserted(const QUrl &source) model.insertItem(0, "Foo", "1111"); // zero index, and current item QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count()); - QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + QTRY_COMPARE(contentItem->childItems().size(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item name = findItem<QQuickText>(contentItem, "textName", 0); QTRY_VERIFY(name != nullptr); @@ -697,7 +697,7 @@ void tst_QQuickListView::inserted_more(QQuickItemView::VerticalLayoutDirection v QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); int firstVisibleIndex = -1; - for (int i=0; i<items.count(); i++) { + for (int i=0; i<items.size(); i++) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (item && !QQuickItemPrivate::get(item)->culled) { firstVisibleIndex = i; @@ -711,7 +711,7 @@ void tst_QQuickListView::inserted_more(QQuickItemView::VerticalLayoutDirection v QQuickText *number; const qreal visibleFromPos = listview->contentY() - listview->displayMarginBeginning() - listview->cacheBuffer(); const qreal visibleToPos = listview->contentY() + listview->height() + listview->displayMarginEnd() + listview->cacheBuffer(); - for (int i = firstVisibleIndex; i < model.count() && i < items.count(); ++i) { + for (int i = firstVisibleIndex; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, qPrintable(QString("Item %1 not found").arg(i))); qreal pos = i*20.0 + itemsOffsetAfterMove; @@ -885,7 +885,7 @@ void tst_QQuickListView::insertBeforeVisible() QTRY_COMPARE(listview->contentY(), 0.0 + itemsOffsetAfterMove); // Confirm items positioned correctly and indexes correct - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, qPrintable(QString("Item %1 not found").arg(i))); @@ -976,7 +976,7 @@ void tst_QQuickListView::removed(const QUrl &source, bool /* animated */) QTRY_COMPARE(number->text(), model.number(1)); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -996,7 +996,7 @@ void tst_QQuickListView::removed(const QUrl &source, bool /* animated */) QTRY_COMPARE(number->text(), model.number(0)); // Confirm items positioned correctly - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -1009,7 +1009,7 @@ void tst_QQuickListView::removed(const QUrl &source, bool /* animated */) QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count()); // Confirm items positioned correctly - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -1045,7 +1045,7 @@ void tst_QQuickListView::removed(const QUrl &source, bool /* animated */) QVERIFY(QQuickTest::qWaitForPolish(listview)); // Confirm items positioned correctly - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -1079,7 +1079,7 @@ void tst_QQuickListView::removed(const QUrl &source, bool /* animated */) QTRY_COMPARE(listview->count() , model.count()); // Confirm items positioned correctly - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount-1; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i+1); if (!item) qWarning() << "Item" << i+1 << "not found"; @@ -1114,7 +1114,7 @@ void tst_QQuickListView::removed(const QUrl &source, bool /* animated */) listview->positionViewAtEnd(); for (int i = 0; i < 18; ++i) model.removeItems(model.count() - 1, 1); - QTRY_VERIFY(findItems<QQuickItem>(contentItem, "wrapper").count() > 16); + QTRY_VERIFY(findItems<QQuickItem>(contentItem, "wrapper").size() > 16); } template <class T> @@ -1170,7 +1170,7 @@ void tst_QQuickListView::removed_more(const QUrl &source, QQuickItemView::Vertic QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); int firstVisibleIndex = -1; - for (int i=0; i<items.count(); i++) { + for (int i=0; i<items.size(); i++) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (item && delegateVisible(item)) { firstVisibleIndex = i; @@ -1182,7 +1182,7 @@ void tst_QQuickListView::removed_more(const QUrl &source, QQuickItemView::Vertic // Confirm items positioned correctly and indexes correct QQuickText *name; QQuickText *number; - for (int i = firstVisibleIndex; i < model.count() && i < items.count(); ++i) { + for (int i = firstVisibleIndex; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, qPrintable(QString("Item %1 not found").arg(i))); qreal pos = i*20.0 + itemsOffsetAfterMove; @@ -1333,7 +1333,7 @@ void tst_QQuickListView::clear(const QUrl &source, QQuickItemView::VerticalLayou model.clear(); - QTRY_COMPARE(findItems<QQuickListView>(contentItem, "wrapper").count(), 0); + QTRY_COMPARE(findItems<QQuickListView>(contentItem, "wrapper").size(), 0); QTRY_COMPARE(listview->count(), 0); QTRY_VERIFY(!listview->currentItem()); if (verticalLayoutDirection == QQuickItemView::TopToBottom) @@ -1402,7 +1402,7 @@ void tst_QQuickListView::moved(const QUrl &source, QQuickItemView::VerticalLayou QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); int firstVisibleIndex = -1; - for (int i=0; i<items.count(); i++) { + for (int i=0; i<items.size(); i++) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (item && delegateVisible(item)) { firstVisibleIndex = i; @@ -1412,7 +1412,7 @@ void tst_QQuickListView::moved(const QUrl &source, QQuickItemView::VerticalLayou QVERIFY2(firstVisibleIndex >= 0, QByteArray::number(firstVisibleIndex)); // Confirm items positioned correctly and indexes correct - for (int i = firstVisibleIndex; i < model.count() && i < items.count(); ++i) { + for (int i = firstVisibleIndex; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, qPrintable(QString("Item %1 not found").arg(i))); qreal pos = i*20.0 + itemsOffsetAfterMove; @@ -1612,7 +1612,7 @@ void tst_QQuickListView::multipleChanges(bool condensed) QTRY_VERIFY(listview != nullptr); QVERIFY(QQuickTest::qWaitForPolish(listview)); - for (int i=0; i<changes.count(); i++) { + for (int i=0; i<changes.size(); i++) { switch (changes[i].type) { case ListChange::Inserted: { @@ -1651,7 +1651,7 @@ void tst_QQuickListView::multipleChanges(bool condensed) QQuickText *number; QQuickItem *contentItem = listview->contentItem(); QTRY_VERIFY(contentItem != nullptr); - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i=0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, qPrintable(QString("Item %1 not found").arg(i))); @@ -2048,7 +2048,7 @@ void tst_QQuickListView::spacing() QVERIFY(QQuickTest::qWaitForPolish(listview)); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -2060,7 +2060,7 @@ void tst_QQuickListView::spacing() QTRY_COMPARE(listview->spacing(), qreal(10)); // Confirm items positioned correctly - QTRY_VERIFY(findItems<QQuickItem>(contentItem, "wrapper").count() == 11); + QTRY_VERIFY(findItems<QQuickItem>(contentItem, "wrapper").size() == 11); for (int i = 0; i < 11; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -2071,7 +2071,7 @@ void tst_QQuickListView::spacing() listview->setSpacing(0); // Confirm items positioned correctly - QTRY_VERIFY(findItems<QQuickItem>(contentItem, "wrapper").count() >= 16); + QTRY_VERIFY(findItems<QQuickItem>(contentItem, "wrapper").size() >= 16); for (int i = 0; i < 16; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -2105,7 +2105,7 @@ void tst_QQuickListView::sections(const QUrl &source) QVERIFY(QQuickTest::qWaitForPolish(listview)); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY(item); @@ -2159,12 +2159,12 @@ void tst_QQuickListView::sections(const QUrl &source) listview->setContentY(140); QTRY_COMPARE(listview->currentSection(), QString("1")); - QTRY_COMPARE(currentSectionChangedSpy.count(), 1); + QTRY_COMPARE(currentSectionChangedSpy.size(), 1); listview->setContentY(20); QTRY_COMPARE(listview->currentSection(), QString("0")); - QTRY_COMPARE(currentSectionChangedSpy.count(), 2); + QTRY_COMPARE(currentSectionChangedSpy.size(), 2); item = findItem<QQuickItem>(contentItem, "wrapper", 1); QTRY_VERIFY(item); @@ -2214,7 +2214,7 @@ void tst_QQuickListView::sectionsDelegate() QVERIFY(QQuickTest::qWaitForPolish(listview)); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QTRY_VERIFY(item); @@ -2256,7 +2256,7 @@ void tst_QQuickListView::sectionsDelegate() // QTBUG-17606 QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "sect_1"); - QCOMPARE(items.count(), 1); + QCOMPARE(items.size(), 1); // QTBUG-17759 model.modifyItem(0, "One", "aaa"); @@ -2272,10 +2272,10 @@ void tst_QQuickListView::sectionsDelegate() model.modifyItem(10, "Two", "aaa"); model.modifyItem(11, "Two", "aaa"); QVERIFY(QQuickTest::qWaitForPolish(listview)); - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "sect_aaa").count(), 1); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "sect_aaa").size(), 1); window->rootObject()->setProperty("sectionProperty", "name"); // ensure view has settled. - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "sect_Four").count(), 1); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "sect_Four").size(), 1); for (int i = 0; i < 4; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "sect_" + model.name(i*3)); @@ -2631,8 +2631,8 @@ void tst_QQuickListView::sectionDelegateChange() QQuickTest::qWaitForPolish(listview); - QVERIFY(findItems<QQuickItem>(contentItem, "section1").count() > 0); - QCOMPARE(findItems<QQuickItem>(contentItem, "section2").count(), 0); + QVERIFY(findItems<QQuickItem>(contentItem, "section1").size() > 0); + QCOMPARE(findItems<QQuickItem>(contentItem, "section2").size(), 0); for (int i = 0; i < 3; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "item", i); @@ -2643,8 +2643,8 @@ void tst_QQuickListView::sectionDelegateChange() QMetaObject::invokeMethod(window->rootObject(), "switchDelegates"); QQuickTest::qWaitForPolish(listview); - QCOMPARE(findItems<QQuickItem>(contentItem, "section1").count(), 0); - QVERIFY(findItems<QQuickItem>(contentItem, "section2").count() > 0); + QCOMPARE(findItems<QQuickItem>(contentItem, "section1").size(), 0); + QVERIFY(findItems<QQuickItem>(contentItem, "section2").size() > 0); for (int i = 0; i < 3; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "item", i); @@ -2691,7 +2691,7 @@ void tst_QQuickListView::sectionsItemInsertion() QVERIFY(QQuickTest::qWaitForPolish(listview)); - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); QVERIFY(itemCount > 10); // Verify that the new items are postioned correctly, and have the correct attached section properties @@ -2791,7 +2791,7 @@ void tst_QQuickListView::currentIndex_delayedItemCreation() QSignalSpy spy(listview, SIGNAL(currentItemChanged())); //QCOMPARE(listview->currentIndex(), 0); listview->forceLayout(); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); releaseView(window); } @@ -3193,7 +3193,7 @@ void tst_QQuickListView::cacheBuffer() QTRY_VERIFY(listview->highlight() != nullptr); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -3224,7 +3224,7 @@ void tst_QQuickListView::cacheBuffer() } int newItemCount = 0; - newItemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + newItemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); // Confirm items positioned correctly for (int i = 0; i < model.count() && i < newItemCount; ++i) { @@ -3360,7 +3360,7 @@ void tst_QQuickListView::positionViewAtIndex() QTRY_COMPARE(listview->contentY(), contentY); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = index; i < model.count() && i < itemCount-index-1; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -3493,13 +3493,13 @@ void tst_QQuickListView::propertyChanges() QTRY_COMPARE(listView->cacheBuffer(), 3); QTRY_COMPARE(listView->snapMode(), QQuickListView::SnapOneItem); - QTRY_COMPARE(highlightFollowsCurrentItemSpy.count(),1); - QTRY_COMPARE(preferredHighlightBeginSpy.count(),1); - QTRY_COMPARE(preferredHighlightEndSpy.count(),1); - QTRY_COMPARE(highlightRangeModeSpy.count(),1); - QTRY_COMPARE(keyNavigationWrapsSpy.count(),1); - QTRY_COMPARE(cacheBufferSpy.count(),1); - QTRY_COMPARE(snapModeSpy.count(),1); + QTRY_COMPARE(highlightFollowsCurrentItemSpy.size(),1); + QTRY_COMPARE(preferredHighlightBeginSpy.size(),1); + QTRY_COMPARE(preferredHighlightEndSpy.size(),1); + QTRY_COMPARE(highlightRangeModeSpy.size(),1); + QTRY_COMPARE(keyNavigationWrapsSpy.size(),1); + QTRY_COMPARE(cacheBufferSpy.size(),1); + QTRY_COMPARE(snapModeSpy.size(),1); listView->setHighlightFollowsCurrentItem(false); listView->setPreferredHighlightBegin(1.0); @@ -3509,13 +3509,13 @@ void tst_QQuickListView::propertyChanges() listView->setCacheBuffer(3); listView->setSnapMode(QQuickListView::SnapOneItem); - QTRY_COMPARE(highlightFollowsCurrentItemSpy.count(),1); - QTRY_COMPARE(preferredHighlightBeginSpy.count(),1); - QTRY_COMPARE(preferredHighlightEndSpy.count(),1); - QTRY_COMPARE(highlightRangeModeSpy.count(),1); - QTRY_COMPARE(keyNavigationWrapsSpy.count(),1); - QTRY_COMPARE(cacheBufferSpy.count(),1); - QTRY_COMPARE(snapModeSpy.count(),1); + QTRY_COMPARE(highlightFollowsCurrentItemSpy.size(),1); + QTRY_COMPARE(preferredHighlightBeginSpy.size(),1); + QTRY_COMPARE(preferredHighlightEndSpy.size(),1); + QTRY_COMPARE(highlightRangeModeSpy.size(),1); + QTRY_COMPARE(keyNavigationWrapsSpy.size(),1); + QTRY_COMPARE(cacheBufferSpy.size(),1); + QTRY_COMPARE(snapModeSpy.size(),1); } void tst_QQuickListView::componentChanges() @@ -3547,20 +3547,20 @@ void tst_QQuickListView::componentChanges() QTRY_COMPARE(listView->footer(), &component); QTRY_COMPARE(listView->delegate(), &delegateComponent); - QTRY_COMPARE(highlightSpy.count(),1); - QTRY_COMPARE(delegateSpy.count(),1); - QTRY_COMPARE(headerSpy.count(),1); - QTRY_COMPARE(footerSpy.count(),1); + QTRY_COMPARE(highlightSpy.size(),1); + QTRY_COMPARE(delegateSpy.size(),1); + QTRY_COMPARE(headerSpy.size(),1); + QTRY_COMPARE(footerSpy.size(),1); listView->setHighlight(&component); listView->setHeader(&component); listView->setFooter(&component); listView->setDelegate(&delegateComponent); - QTRY_COMPARE(highlightSpy.count(),1); - QTRY_COMPARE(delegateSpy.count(),1); - QTRY_COMPARE(headerSpy.count(),1); - QTRY_COMPARE(footerSpy.count(),1); + QTRY_COMPARE(highlightSpy.size(),1); + QTRY_COMPARE(delegateSpy.size(),1); + QTRY_COMPARE(headerSpy.size(),1); + QTRY_COMPARE(footerSpy.size(),1); } void tst_QQuickListView::modelChanges() @@ -3578,13 +3578,13 @@ void tst_QQuickListView::modelChanges() listView->setModel(modelVariant); QTRY_COMPARE(listView->model(), modelVariant); - QTRY_COMPARE(modelSpy.count(),1); + QTRY_COMPARE(modelSpy.size(),1); listView->setModel(modelVariant); - QTRY_COMPARE(modelSpy.count(),1); + QTRY_COMPARE(modelSpy.size(),1); listView->setModel(QVariant()); - QTRY_COMPARE(modelSpy.count(),2); + QTRY_COMPARE(modelSpy.size(),2); } void tst_QQuickListView::QTBUG_9791() @@ -3606,7 +3606,7 @@ void tst_QQuickListView::QTBUG_9791() qApp->processEvents(); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).size(); QCOMPARE(itemCount, 3); for (int i = 0; i < itemCount; ++i) { @@ -3635,12 +3635,12 @@ void tst_QQuickListView::QTBUG_33568() listview->incrementCurrentIndex(); QTRY_COMPARE(listview->contentY(), -100.0); - QVERIFY(spy.count() > 1); + QVERIFY(spy.size() > 1); spy.clear(); listview->incrementCurrentIndex(); QTRY_COMPARE(listview->contentY(), -50.0); - QVERIFY(spy.count() > 1); + QVERIFY(spy.size() > 1); } void tst_QQuickListView::manualHighlight() @@ -3702,7 +3702,7 @@ void tst_QQuickListView::QTBUG_11105() QVERIFY(QQuickTest::qWaitForPolish(listview)); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -3719,7 +3719,7 @@ void tst_QQuickListView::QTBUG_11105() ctxt->setContextProperty("testModel", &model2); - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); QCOMPARE(itemCount, 5); } @@ -3827,7 +3827,7 @@ void tst_QQuickListView::header() QSignalSpy headerItemSpy(listview, SIGNAL(headerItemChanged())); QMetaObject::invokeMethod(window->rootObject(), "changeHeader"); - QCOMPARE(headerItemSpy.count(), 1); + QCOMPARE(headerItemSpy.size(), 1); header = findItem<QQuickText>(contentItem, "header"); QVERIFY(!header); @@ -4086,7 +4086,7 @@ void tst_QQuickListView::footer() QSignalSpy footerItemSpy(listview, SIGNAL(footerItemChanged())); QMetaObject::invokeMethod(window->rootObject(), "changeFooter"); - QCOMPARE(footerItemSpy.count(), 1); + QCOMPARE(footerItemSpy.size(), 1); footer = findItem<QQuickText>(contentItem, "footer"); QVERIFY(!footer); @@ -4373,7 +4373,7 @@ void tst_QQuickListView::resizeView() QVERIFY(QQuickTest::qWaitForPolish(listview)); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -4393,16 +4393,16 @@ void tst_QQuickListView::resizeView() // Ensure we handle -ve sizes listview->setHeight(-100); - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 1); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).size(), 1); listview->setCacheBuffer(200); - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 11); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).size(), 11); // ensure items in cache become visible listview->setHeight(200); - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 21); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).size(), 21); - itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -4413,9 +4413,9 @@ void tst_QQuickListView::resizeView() // ensure items outside view become invisible listview->setHeight(100); - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 16); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).size(), 16); - itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -4484,7 +4484,7 @@ void tst_QQuickListView::sizeLessThan1() QVERIFY(QQuickTest::qWaitForPolish(listview)); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -4629,7 +4629,7 @@ void tst_QQuickListView::resizeFirstDelegate() QCOMPARE(listview->contentY(), 0.0); QSignalSpy spy(listview, SIGNAL(contentYChanged())); QTest::qWait(100); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); for (int i = 1; i < model.count(); ++i) { item = findItem<QQuickItem>(contentItem, "wrapper", i); @@ -4697,13 +4697,13 @@ void tst_QQuickListView::repositionResizedDelegate() listview->setContentX(contentPos_itemFirstHalfVisible.x()); listview->setContentY(contentPos_itemFirstHalfVisible.y()); QVERIFY(QQuickTest::qWaitForPolish(listview)); - prevSpyCount = spy.count(); + prevSpyCount = spy.size(); QVERIFY(QMetaObject::invokeMethod(window->rootObject(), "incrementRepeater")); QTRY_COMPARE(positioner->boundingRect().size(), resizedPositionerRect.size()); QTRY_COMPARE(positioner->position(), resizedPositionerRect.topLeft()); QCOMPARE(listview->contentX(), contentPos_itemFirstHalfVisible.x()); QCOMPARE(listview->contentY(), contentPos_itemFirstHalfVisible.y()); - QCOMPARE(spy.count(), prevSpyCount); + QCOMPARE(spy.size(), prevSpyCount); QVERIFY(QMetaObject::invokeMethod(window->rootObject(), "decrementRepeater")); QTRY_COMPARE(positioner->boundingRect().size(), origPositionerRect.size()); @@ -4714,7 +4714,7 @@ void tst_QQuickListView::repositionResizedDelegate() listview->setContentX(contentPos_itemSecondHalfVisible.x()); listview->setContentY(contentPos_itemSecondHalfVisible.y()); QVERIFY(QQuickTest::qWaitForPolish(listview)); - prevSpyCount = spy.count(); + prevSpyCount = spy.size(); QVERIFY(QMetaObject::invokeMethod(window->rootObject(), "incrementRepeater")); positioner = findItem<QQuickItem>(window->rootObject(), "positioner"); @@ -4723,7 +4723,7 @@ void tst_QQuickListView::repositionResizedDelegate() QCOMPARE(listview->contentX(), contentPos_itemSecondHalfVisible.x()); QCOMPARE(listview->contentY(), contentPos_itemSecondHalfVisible.y()); qApp->processEvents(); - QCOMPARE(spy.count(), prevSpyCount); + QCOMPARE(spy.size(), prevSpyCount); releaseView(window); } @@ -4913,8 +4913,8 @@ void tst_QQuickListView::onAdd() QTRY_COMPARE(listview->property("count").toInt(), model.count()); QVariantList result = listview->property("addedDelegates").toList(); - QCOMPARE(result.count(), items.count()); - for (int i=0; i<items.count(); i++) + QCOMPARE(result.count(), items.size()); + for (int i=0; i<items.size(); i++) QCOMPARE(result[i].toString(), items[i].first); } @@ -6021,7 +6021,7 @@ void tst_QQuickListView::snapOneItemResize_QTBUG_43555() QVERIFY(QQuickTest::qWaitForPolish(listview)); QTRY_COMPARE(listview->currentIndex(), 5); - QCOMPARE(currentIndexSpy.count(), 0); + QCOMPARE(currentIndexSpy.size(), 0); } void tst_QQuickListView::qAbstractItemModel_package_items() @@ -6345,7 +6345,7 @@ void tst_QQuickListView::snapOneItem() if (QQuickItemView::HighlightRangeMode(highlightRangeMode) == QQuickItemView::StrictlyEnforceRange) { QCOMPARE(listview->currentIndex(), 1); - QCOMPARE(currentIndexSpy.count(), 1); + QCOMPARE(currentIndexSpy.size(), 1); } // flick to end @@ -6363,7 +6363,7 @@ void tst_QQuickListView::snapOneItem() if (QQuickItemView::HighlightRangeMode(highlightRangeMode) == QQuickItemView::StrictlyEnforceRange) { QCOMPARE(listview->currentIndex(), 3); - QCOMPARE(currentIndexSpy.count(), 3); + QCOMPARE(currentIndexSpy.size(), 3); } // flick to start @@ -6381,7 +6381,7 @@ void tst_QQuickListView::snapOneItem() if (QQuickItemView::HighlightRangeMode(highlightRangeMode) == QQuickItemView::StrictlyEnforceRange) { QCOMPARE(listview->currentIndex(), 0); - QCOMPARE(currentIndexSpy.count(), 6); + QCOMPARE(currentIndexSpy.size(), 6); } releaseView(window); @@ -6407,7 +6407,7 @@ void tst_QQuickListView::snapOneItemCurrentIndexRemoveAnimation() QVERIFY(QQuickTest::qWaitForPolish(listview)); QCOMPARE(listview->currentIndex(), 0); - QCOMPARE(currentIndexSpy.count(), 0); + QCOMPARE(currentIndexSpy.size(), 0); } void tst_QQuickListView::snapOneItemWrongDirection() @@ -6711,7 +6711,7 @@ void tst_QQuickListView::populateTransitions() QCOMPARE(listview->property("countAddTransitions").toInt(), 0); } - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i=0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, qPrintable(QString("Item %1 not found").arg(i))); @@ -6734,7 +6734,7 @@ void tst_QQuickListView::populateTransitions() window->rootContext()->setContextProperty("testModel", QVariant()); listview->forceLayout(); QTRY_COMPARE(listview->count(), 0); - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").count(), 0); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").size(), 0); listview->setProperty("countPopulateTransitions", 0); listview->setProperty("countAddTransitions", 0); @@ -6746,7 +6746,7 @@ void tst_QQuickListView::populateTransitions() QTRY_COMPARE(listview->property("countPopulateTransitions").toInt(), usePopulateTransition ? 16 : 0); QTRY_COMPARE(listview->property("countAddTransitions").toInt(), 0); - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i=0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, qPrintable(QString("Item %1 not found").arg(i))); @@ -6764,7 +6764,7 @@ void tst_QQuickListView::populateTransitions() QTRY_COMPARE(listview->property("countPopulateTransitions").toInt(), usePopulateTransition ? 16 : 0); QTRY_COMPARE(listview->property("countAddTransitions").toInt(), 0); - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i=0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, qPrintable(QString("Item %1 not found").arg(i))); @@ -6903,7 +6903,7 @@ void tst_QQuickListView::addTransitions() targetIndexes << i; } } - QVERIFY(expectedTargetData.count() > 0); + QVERIFY(expectedTargetData.size() > 0); } // start animation @@ -6916,7 +6916,7 @@ void tst_QQuickListView::addTransitions() QList<QQuickItem *> targetItems = findItems<QQuickItem>(contentItem, "wrapper", targetIndexes); if (shouldAnimateTargets) { - QTRY_COMPARE(listview->property("targetTransitionsDone").toInt(), expectedTargetData.count()); + QTRY_COMPARE(listview->property("targetTransitionsDone").toInt(), expectedTargetData.size()); QTRY_COMPARE(listview->property("displaceTransitionsDone").toInt(), expectedDisplacedIndexes.isValid() ? expectedDisplacedIndexes.count() : 0); @@ -6943,8 +6943,8 @@ void tst_QQuickListView::addTransitions() QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); int firstVisibleIndex = -1; - int itemCount = items.count(); - for (int i=0; i<items.count(); i++) { + int itemCount = items.size(); + for (int i=0; i<items.size(); i++) { if (items[i]->y() >= contentY) { QQmlExpression e(qmlContext(items[i]), items[i], "index"); firstVisibleIndex = e.evaluate().toInt(); @@ -7103,7 +7103,7 @@ void tst_QQuickListView::moveTransitions() // start animation model.moveItems(moveFrom, moveTo, moveCount); - QTRY_COMPARE(listview->property("targetTransitionsDone").toInt(), expectedTargetData.count()); + QTRY_COMPARE(listview->property("targetTransitionsDone").toInt(), expectedTargetData.size()); QTRY_COMPARE(listview->property("displaceTransitionsDone").toInt(), expectedDisplacedIndexes.isValid() ? expectedDisplacedIndexes.count() : 0); @@ -7127,7 +7127,7 @@ void tst_QQuickListView::moveTransitions() QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); int firstVisibleIndex = -1; - for (int i=0; i<items.count(); i++) { + for (int i=0; i<items.size(); i++) { if (items[i]->y() >= contentY) { QQmlExpression e(qmlContext(items[i]), items[i], "index"); firstVisibleIndex = e.evaluate().toInt(); @@ -7137,7 +7137,7 @@ void tst_QQuickListView::moveTransitions() QVERIFY2(firstVisibleIndex >= 0, QByteArray::number(firstVisibleIndex)); // verify all items moved to the correct final positions - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i=firstVisibleIndex; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, qPrintable(QString("Item %1 not found").arg(i))); @@ -7297,13 +7297,13 @@ void tst_QQuickListView::removeTransitions() targetIndexes << i; } } - QVERIFY(expectedTargetData.count() > 0); + QVERIFY(expectedTargetData.size() > 0); } // calculate targetItems and expectedTargets before model changes QList<QQuickItem *> targetItems = findItems<QQuickItem>(contentItem, "wrapper", targetIndexes); QVariantMap expectedTargets; - for (int i=0; i<targetIndexes.count(); i++) + for (int i=0; i<targetIndexes.size(); i++) expectedTargets[model.name(targetIndexes[i])] = targetIndexes[i]; // start animation @@ -7311,7 +7311,7 @@ void tst_QQuickListView::removeTransitions() QTRY_COMPARE(model.count(), listview->count()); if (shouldAnimateTargets) { - QTRY_COMPARE(listview->property("targetTransitionsDone").toInt(), expectedTargetData.count()); + QTRY_COMPARE(listview->property("targetTransitionsDone").toInt(), expectedTargetData.size()); QTRY_COMPARE(listview->property("displaceTransitionsDone").toInt(), expectedDisplacedIndexes.isValid() ? expectedDisplacedIndexes.count() : 0); @@ -7337,9 +7337,9 @@ void tst_QQuickListView::removeTransitions() QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); int firstVisibleIndex = -1; - int itemCount = items.count(); + int itemCount = items.size(); - for (int i=0; i<items.count(); i++) { + for (int i=0; i<items.size(); i++) { QQmlExpression e(qmlContext(items[i]), items[i], "index"); int index = e.evaluate().toInt(); if (firstVisibleIndex < 0 && items[i]->y() >= contentY) @@ -7530,10 +7530,10 @@ void tst_QQuickListView::displacedTransitions() // check the correct number of target items and indexes were received QCOMPARE(resultTargetIndexes.count(), expectedDisplacedIndexes.count()); for (int i=0; i<resultTargetIndexes.count(); i++) - QCOMPARE(resultTargetIndexes[i].value<QList<int> >().count(), change.count); + QCOMPARE(resultTargetIndexes[i].value<QList<int> >().size(), change.count); QCOMPARE(resultTargetItems.count(), expectedDisplacedIndexes.count()); for (int i=0; i<resultTargetItems.count(); i++) - QCOMPARE(resultTargetItems[i].toList().count(), change.count); + QCOMPARE(resultTargetItems[i].toList().size(), change.count); } else { QCOMPARE(resultTargetIndexes.count(), 0); QCOMPARE(resultTargetItems.count(), 0); @@ -7563,7 +7563,7 @@ void tst_QQuickListView::displacedTransitions() // verify all items moved to the correct final positions QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); - for (int i=0; i < model.count() && i < items.count(); ++i) { + for (int i=0; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, qPrintable(QString("Item %1 not found").arg(i))); QCOMPARE(item->x(), 0.0); @@ -7717,7 +7717,7 @@ void tst_QQuickListView::multipleTransitions() int timeBetweenActions = window->rootObject()->property("timeBetweenActions").toInt(); - for (int i=0; i<changes.count(); i++) { + for (int i=0; i<changes.size(); i++) { switch (changes[i].type) { case ListChange::Inserted: { @@ -7726,7 +7726,7 @@ void tst_QQuickListView::multipleTransitions() targetItems << qMakePair(QString("new item %1").arg(j), QString::number(j)); model.insertItems(changes[i].index, targetItems); QTRY_COMPARE(model.count(), listview->count()); - if (i == changes.count() - 1) { + if (i == changes.size() - 1) { QTRY_VERIFY(!listview->property("runningAddTargets").toBool()); QTRY_VERIFY(!listview->property("runningAddDisplaced").toBool()); } else { @@ -7737,7 +7737,7 @@ void tst_QQuickListView::multipleTransitions() case ListChange::Removed: model.removeItems(changes[i].index, changes[i].count); QTRY_COMPARE(model.count(), listview->count()); - if (i == changes.count() - 1) { + if (i == changes.size() - 1) { QTRY_VERIFY(!listview->property("runningRemoveTargets").toBool()); QTRY_VERIFY(!listview->property("runningRemoveDisplaced").toBool()); } else { @@ -7747,7 +7747,7 @@ void tst_QQuickListView::multipleTransitions() case ListChange::Moved: model.moveItems(changes[i].index, changes[i].to, changes[i].count); QVERIFY(QQuickTest::qWaitForPolish(listview)); - if (i == changes.count() - 1) { + if (i == changes.size() - 1) { QTRY_VERIFY(!listview->property("runningMoveTargets").toBool()); QTRY_VERIFY(!listview->property("runningMoveDisplaced").toBool()); } else { @@ -7771,7 +7771,7 @@ void tst_QQuickListView::multipleTransitions() // verify all items moved to the correct final positions QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); - for (int i=0; i < model.count() && i < items.count(); ++i) { + for (int i=0; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, qPrintable(QString("Item %1 not found").arg(i))); QTRY_COMPARE(item->x(), 0.0); @@ -7880,7 +7880,7 @@ void tst_QQuickListView::multipleDisplaced() // verify all items moved to the correct final positions QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); - for (int i=0; i < model.count() && i < items.count(); ++i) { + for (int i=0; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, qPrintable(QString("Item %1 not found").arg(i))); QTRY_COMPARE(item->x(), 0.0); @@ -7929,7 +7929,7 @@ void tst_QQuickListView::matchItemsAndIndexes(const QVariantMap &items, const Qa qDebug() << itemIndex; QCOMPARE(model.name(itemIndex), name); } - QCOMPARE(items.count(), expectedIndexes.count()); + QCOMPARE(items.count(), expectedIndexes.size()); } void tst_QQuickListView::matchItemLists(const QVariantList &itemLists, const QList<QQuickItem *> &expectedItems) @@ -7942,7 +7942,7 @@ void tst_QQuickListView::matchItemLists(const QVariantList &itemLists, const QLi QVERIFY2(o, qPrintable(QString("Invalid actual item at %1").arg(j))); QVERIFY2(expectedItems.contains(o), qPrintable(QString("Cannot match item %1").arg(j))); } - QCOMPARE(current.count(), expectedItems.count()); + QCOMPARE(current.count(), expectedItems.size()); } } @@ -7972,7 +7972,7 @@ void tst_QQuickListView::flickBeyondBounds() // We're really testing that we don't get stuck in a loop, // but also confirm items positioned correctly. - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").count(), 2); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").size(), 2); for (int i = 0; i < 2; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -8079,7 +8079,7 @@ void tst_QQuickListView::destroyItemOnCreation() model.addItem("new item", ""); QTRY_COMPARE(window->rootObject()->property("createdIndex").toInt(), 0); - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").count(), 0); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").size(), 0); QCOMPARE(model.count(), 0); } @@ -9070,11 +9070,11 @@ void tst_QQuickListView::jsArrayChange() } view->setModel(QVariant::fromValue(array1)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // no change view->setModel(QVariant::fromValue(array2)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } static bool compareObjectModel(QQuickListView *listview, QQmlObjectModel *model) @@ -9259,7 +9259,7 @@ void tst_QQuickListView::keyNavigationEnabled() // of disabling both mouse and keyboard interaction. QSignalSpy enabledSpy(listView, SIGNAL(keyNavigationEnabledChanged())); listView->setInteractive(false); - QCOMPARE(enabledSpy.count(), 1); + QCOMPARE(enabledSpy.size(), 1); QCOMPARE(listView->isKeyNavigationEnabled(), false); flick(window.data(), QPoint(200, 200), QPoint(200, 50), 100); @@ -9272,17 +9272,17 @@ void tst_QQuickListView::keyNavigationEnabled() // Check that isKeyNavigationEnabled implicitly follows the value of interactive. listView->setInteractive(true); - QCOMPARE(enabledSpy.count(), 2); + QCOMPARE(enabledSpy.size(), 2); QCOMPARE(listView->isKeyNavigationEnabled(), true); // Change it back again for the next check. listView->setInteractive(false); - QCOMPARE(enabledSpy.count(), 3); + QCOMPARE(enabledSpy.size(), 3); QCOMPARE(listView->isKeyNavigationEnabled(), false); // Setting keyNavigationEnabled to true shouldn't enable mouse interaction. listView->setKeyNavigationEnabled(true); - QCOMPARE(enabledSpy.count(), 4); + QCOMPARE(enabledSpy.size(), 4); flick(window.data(), QPoint(200, 200), QPoint(200, 50), 100); QVERIFY(!listView->isMoving()); QCOMPARE(listView->contentY(), 0.0); @@ -9296,7 +9296,7 @@ void tst_QQuickListView::keyNavigationEnabled() // Changing interactive now shouldn't result in keyNavigationEnabled changing, // since we broke the "binding". listView->setInteractive(true); - QCOMPARE(enabledSpy.count(), 4); + QCOMPARE(enabledSpy.size(), 4); // Keyboard interaction shouldn't work now. listView->setKeyNavigationEnabled(false); @@ -9504,7 +9504,7 @@ void tst_QQuickListView::QTBUG_66163_setModelViewPortSizeChange() QTest::qWait(1100); // animation takes 1000ms, + 10% extra delay /* the viewport should not have changed, thus there should not have been any contentYChanged signal*/ - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } void tst_QQuickListView::itemFiltered() @@ -9575,7 +9575,7 @@ void tst_QQuickListView::QTBUG_34576_velocityZero() window->rootObject()->setProperty("horizontalVelocityZeroCount", QVariant(0)); listview->setCurrentIndex(2); QTRY_COMPARE(window->rootObject()->property("current").toInt(), 2); - QCOMPARE(horizontalVelocitySpy.count(), 0); + QCOMPARE(horizontalVelocitySpy.size(), 0); QCOMPARE(window->rootObject()->property("horizontalVelocityZeroCount").toInt(), 0); QSignalSpy currentIndexChangedSpy(listview, SIGNAL(currentIndexChanged())); @@ -9585,11 +9585,11 @@ void tst_QQuickListView::QTBUG_34576_velocityZero() QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(295,215)); // verify that currentIndexChanged is triggered - QTRY_VERIFY(currentIndexChangedSpy.count() > 0); + QTRY_VERIFY(currentIndexChangedSpy.size() > 0); // since we have set currentIndex to an item out of view, the listview will scroll QTRY_COMPARE(window->rootObject()->property("current").toInt(), 3); - QTRY_VERIFY(horizontalVelocitySpy.count() > 0); + QTRY_VERIFY(horizontalVelocitySpy.size() > 0); // velocity should be always > 0.0 QTRY_COMPARE(window->rootObject()->property("horizontalVelocityZeroCount").toInt(), 0); @@ -9618,7 +9618,7 @@ void tst_QQuickListView::QTBUG_61537_modelChangesAsync() // Check that the number of delegates we expect to be visible in // the listview matches the number of items we find if we count. int reportedCount = listView->count(); - int actualCount = findItems<QQuickItem>(listView, "delegate").count(); + int actualCount = findItems<QQuickItem>(listView, "delegate").size(); QCOMPARE(reportedCount, actualCount); } @@ -9749,7 +9749,7 @@ public: m_animals.push_back(Animal {5, QLatin1String("Cherry")}); } - int rowCount(const QModelIndex & = QModelIndex()) const override {return m_animals.count();} + int rowCount(const QModelIndex & = QModelIndex()) const override {return m_animals.size();} QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const override { if (!checkIndex(index)) @@ -9865,7 +9865,7 @@ void tst_QQuickListView::reuse_checkThatItemsAreReused() QVERIFY(listView->reuseItems()); auto items = findItems<QQuickItem>(listView, "delegate"); - const int initialItemCount = items.count(); + const int initialItemCount = items.size(); QVERIFY(initialItemCount > 0); // Sanity check that the size of the initial list of items match the count we tracked from QML @@ -10090,9 +10090,9 @@ void tst_QQuickListView::requiredObjectListModel() const auto *root = qobject_cast<QQuickListView *>(view.rootObject()); QVERIFY(root); - QCOMPARE(root->count(), dataList.count()); + QCOMPARE(root->count(), dataList.size()); - for (int i = 0, end = dataList.count(); i != end; ++i) { + for (int i = 0, end = dataList.size(); i != end; ++i) { const auto *rect = qobject_cast<QQuickRectangle *>(root->itemAtIndex(i)); QVERIFY(rect); const auto *data = qobject_cast<DataObject *>(dataList.at(i)); diff --git a/tests/auto/quick/qquicklistview2/tst_qquicklistview2.cpp b/tests/auto/quick/qquicklistview2/tst_qquicklistview2.cpp index 8684439d24..aad13f67e9 100644 --- a/tests/auto/quick/qquicklistview2/tst_qquicklistview2.cpp +++ b/tests/auto/quick/qquicklistview2/tst_qquicklistview2.cpp @@ -273,7 +273,7 @@ void tst_QQuickListView2::metaSequenceAsModel() QScopedPointer<QObject> o(c.create()); QVERIFY(!o.isNull()); QStringList strings = qvariant_cast<QStringList>(o->property("texts")); - QCOMPARE(strings.length(), 2); + QCOMPARE(strings.size(), 2); QCOMPARE(strings[0], QStringLiteral("1/2")); QCOMPARE(strings[1], QStringLiteral("5/6")); } diff --git a/tests/auto/quick/qquickloader/tst_qquickloader.cpp b/tests/auto/quick/qquickloader/tst_qquickloader.cpp index ad88fd6172..4a8db5fd94 100644 --- a/tests/auto/quick/qquickloader/tst_qquickloader.cpp +++ b/tests/auto/quick/qquickloader/tst_qquickloader.cpp @@ -161,7 +161,7 @@ void tst_QQuickLoader::sourceOrComponent() QCOMPARE(loader->progress(), 1.0); QCOMPARE(loader->status(), error ? QQuickLoader::Error : QQuickLoader::Ready); - QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().count(), error ? 0: 1); + QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().size(), error ? 0: 1); if (!error) { bool sourceComponentIsChildOfLoader = false; @@ -222,12 +222,12 @@ void tst_QQuickLoader::clear() QVERIFY(loader != nullptr); QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); - QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().count(), 1); + QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().size(), 1); QTRY_VERIFY(!loader->item()); QCOMPARE(loader->progress(), 0.0); QCOMPARE(loader->status(), QQuickLoader::Null); - QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().count(), 0); + QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().size(), 0); } { QQmlComponent component(&engine, testFileUrl("/SetSourceComponent.qml")); @@ -238,14 +238,14 @@ void tst_QQuickLoader::clear() QVERIFY(loader); QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); - QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1); + QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().size(), 1); loader->setSourceComponent(nullptr); QVERIFY(!loader->item()); QCOMPARE(loader->progress(), 0.0); QCOMPARE(loader->status(), QQuickLoader::Null); - QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 0); + QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().size(), 0); } { QQmlComponent component(&engine, testFileUrl("/SetSourceComponent.qml")); @@ -256,14 +256,14 @@ void tst_QQuickLoader::clear() QVERIFY(loader); QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); - QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1); + QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().size(), 1); QMetaObject::invokeMethod(item.data(), "clear"); QVERIFY(!loader->item()); QCOMPARE(loader->progress(), 0.0); QCOMPARE(loader->status(), QQuickLoader::Null); - QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 0); + QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().size(), 0); } } @@ -284,7 +284,7 @@ void tst_QQuickLoader::urlToComponent() QTRY_VERIFY(loader != nullptr); QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); - QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().count(), 1); + QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().size(), 1); QCOMPARE(loader->width(), 10.0); QCOMPARE(loader->height(), 10.0); } @@ -300,12 +300,12 @@ void tst_QQuickLoader::componentToUrl() QVERIFY(loader); QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); - QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1); + QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().size(), 1); loader->setSourceWithoutResolve(testFileUrl("/Rect120x60.qml")); QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); - QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1); + QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().size(), 1); QCOMPARE(loader->width(), 120.0); QCOMPARE(loader->height(), 60.0); } @@ -435,7 +435,7 @@ void tst_QQuickLoader::networkRequestUrl() QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); QCOMPARE(loader->property("signalCount").toInt(), 1); - QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().count(), 1); + QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().size(), 1); } /* XXX Component waits until all dependencies are loaded. Is this actually possible? */ @@ -489,7 +489,7 @@ void tst_QQuickLoader::failNetworkRequest() QVERIFY(!loader->item()); QCOMPARE(loader->progress(), 1.0); QCOMPARE(loader->property("did_load").toInt(), 123); - QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().count(), 0); + QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().size(), 0); } void tst_QQuickLoader::active() @@ -789,7 +789,7 @@ void tst_QQuickLoader::deleteComponentCrash() QCOMPARE(loader->status(), QQuickLoader::Ready); QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); - QTRY_COMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1); + QTRY_COMPARE(static_cast<QQuickItem*>(loader)->childItems().size(), 1); QCOMPARE(loader->source(), QUrl("BlueRect.qml")); } @@ -866,8 +866,8 @@ void tst_QQuickLoader::implicitSize() QCOMPARE(loader->property("implicitWidth").toReal(), 200.); QCOMPARE(loader->property("implicitHeight").toReal(), 300.); - QCOMPARE(implWidthSpy.count(), 1); - QCOMPARE(implHeightSpy.count(), 1); + QCOMPARE(implWidthSpy.size(), 1); + QCOMPARE(implHeightSpy.size(), 1); } void tst_QQuickLoader::QTBUG_17114() @@ -970,7 +970,7 @@ void tst_QQuickLoader::asynchronous_clear() QCOMPARE(loader->progress(), 0.0); QCOMPARE(loader->status(), QQuickLoader::Null); - QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 0); + QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().size(), 0); // check loading component root->setProperty("comp", "BigComponent.qml"); @@ -983,7 +983,7 @@ void tst_QQuickLoader::asynchronous_clear() QTRY_VERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); QCOMPARE(loader->status(), QQuickLoader::Ready); - QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1); + QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().size(), 1); } void tst_QQuickLoader::simultaneousSyncAsync() @@ -1047,7 +1047,7 @@ void tst_QQuickLoader::asyncToSync1() QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); QCOMPARE(loader->status(), QQuickLoader::Ready); - QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1); + QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().size(), 1); } void tst_QQuickLoader::asyncToSync2() @@ -1079,7 +1079,7 @@ void tst_QQuickLoader::asyncToSync2() QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); QCOMPARE(loader->status(), QQuickLoader::Ready); - QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1); + QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().size(), 1); } void tst_QQuickLoader::loadedSignal() @@ -1287,7 +1287,7 @@ void tst_QQuickLoader::sourceComponentGarbageCollection() if (spy.isEmpty()) QVERIFY(spy.wait()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } // QTBUG-51995 diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp index 7da0913e0c..755dad6312 100644 --- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp +++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp @@ -196,18 +196,18 @@ void tst_QQuickMouseArea::dragProperties() QVERIFY(rootItem != nullptr); QSignalSpy targetSpy(drag, SIGNAL(targetChanged())); drag->setTarget(rootItem); - QCOMPARE(targetSpy.count(),1); + QCOMPARE(targetSpy.size(),1); drag->setTarget(rootItem); - QCOMPARE(targetSpy.count(),1); + QCOMPARE(targetSpy.size(),1); // axis QCOMPARE(drag->axis(), QQuickDrag::XAndYAxis); QSignalSpy axisSpy(drag, SIGNAL(axisChanged())); drag->setAxis(QQuickDrag::XAxis); QCOMPARE(drag->axis(), QQuickDrag::XAxis); - QCOMPARE(axisSpy.count(),1); + QCOMPARE(axisSpy.size(),1); drag->setAxis(QQuickDrag::XAxis); - QCOMPARE(axisSpy.count(),1); + QCOMPARE(axisSpy.size(),1); // minimum and maximum properties QSignalSpy xminSpy(drag, SIGNAL(minimumXChanged())); @@ -230,20 +230,20 @@ void tst_QQuickMouseArea::dragProperties() QCOMPARE(drag->ymin(), 10.0); QCOMPARE(drag->ymax(), 10.0); - QCOMPARE(xminSpy.count(),1); - QCOMPARE(xmaxSpy.count(),1); - QCOMPARE(yminSpy.count(),1); - QCOMPARE(ymaxSpy.count(),1); + QCOMPARE(xminSpy.size(),1); + QCOMPARE(xmaxSpy.size(),1); + QCOMPARE(yminSpy.size(),1); + QCOMPARE(ymaxSpy.size(),1); drag->setXmin(10); drag->setXmax(10); drag->setYmin(10); drag->setYmax(10); - QCOMPARE(xminSpy.count(),1); - QCOMPARE(xmaxSpy.count(),1); - QCOMPARE(yminSpy.count(),1); - QCOMPARE(ymaxSpy.count(),1); + QCOMPARE(xminSpy.size(),1); + QCOMPARE(xmaxSpy.size(),1); + QCOMPARE(yminSpy.size(),1); + QCOMPARE(ymaxSpy.size(),1); // filterChildren QSignalSpy filterChildrenSpy(drag, SIGNAL(filterChildrenChanged())); @@ -251,24 +251,24 @@ void tst_QQuickMouseArea::dragProperties() drag->setFilterChildren(true); QVERIFY(drag->filterChildren()); - QCOMPARE(filterChildrenSpy.count(), 1); + QCOMPARE(filterChildrenSpy.size(), 1); drag->setFilterChildren(true); - QCOMPARE(filterChildrenSpy.count(), 1); + QCOMPARE(filterChildrenSpy.size(), 1); // threshold QCOMPARE(int(drag->threshold()), qApp->styleHints()->startDragDistance()); QSignalSpy thresholdSpy(drag, SIGNAL(thresholdChanged())); drag->setThreshold(0.0); QCOMPARE(drag->threshold(), 0.0); - QCOMPARE(thresholdSpy.count(), 1); + QCOMPARE(thresholdSpy.size(), 1); drag->setThreshold(99); - QCOMPARE(thresholdSpy.count(), 2); + QCOMPARE(thresholdSpy.size(), 2); drag->setThreshold(99); - QCOMPARE(thresholdSpy.count(), 2); + QCOMPARE(thresholdSpy.size(), 2); drag->resetThreshold(); QCOMPARE(int(drag->threshold()), qApp->styleHints()->startDragDistance()); - QCOMPARE(thresholdSpy.count(), 3); + QCOMPARE(thresholdSpy.size(), 3); } void tst_QQuickMouseArea::resetDrag() @@ -293,7 +293,7 @@ void tst_QQuickMouseArea::resetDrag() auto root = window.rootObject(); QQmlProperty haveTarget {root, "haveTarget"}; haveTarget.write(false); - QCOMPARE(targetSpy.count(),1); + QCOMPARE(targetSpy.size(),1); QVERIFY(!drag->target()); } @@ -1050,7 +1050,7 @@ void tst_QQuickMouseArea::preventStealing() QTest::mouseMove(&window, p); // We should have received all four move events - QTRY_COMPARE(mousePositionSpy.count(), 4); + QTRY_COMPARE(mousePositionSpy.size(), 4); mousePositionSpy.clear(); QVERIFY(mouseArea->pressed()); @@ -1079,7 +1079,7 @@ void tst_QQuickMouseArea::preventStealing() QTest::mouseMove(&window, p); // We should only have received the first move event - QTRY_COMPARE(mousePositionSpy.count(), 1); + QTRY_COMPARE(mousePositionSpy.size(), 1); // Our press should be taken away QVERIFY(!mouseArea->pressed()); @@ -1320,12 +1320,12 @@ void tst_QQuickMouseArea::hoverVisible() QTest::mouseMove(&window,QPoint(11,33)); QCOMPARE(mouseTracker->hovered(), false); - QCOMPARE(enteredSpy.count(), 0); + QCOMPARE(enteredSpy.size(), 0); mouseTracker->setVisible(true); QCOMPARE(mouseTracker->hovered(), true); - QCOMPARE(enteredSpy.count(), 1); + QCOMPARE(enteredSpy.size(), 1); QCOMPARE(QPointF(mouseTracker->mouseX(), mouseTracker->mouseY()), QPointF(11,33)); @@ -1455,7 +1455,7 @@ void tst_QQuickMouseArea::disableAfterPress() QVERIFY(!drag->active()); QPoint p = QPoint(100,100); QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, p); - QTRY_COMPARE(mousePressSpy.count(), 1); + QTRY_COMPARE(mousePressSpy.size(), 1); QVERIFY(!drag->active()); QCOMPARE(blackRect->x(), 50.0); @@ -1469,7 +1469,7 @@ void tst_QQuickMouseArea::disableAfterPress() p += QPoint(11, 11); QTest::mouseMove(&window, p); - QTRY_COMPARE(mousePositionSpy.count(), 2); + QTRY_COMPARE(mousePositionSpy.size(), 2); QTRY_VERIFY(drag->active()); QTRY_COMPARE(blackRect->x(), 61.0); @@ -1483,7 +1483,7 @@ void tst_QQuickMouseArea::disableAfterPress() p += QPoint(11, 11); QTest::mouseMove(&window, p); - QTRY_COMPARE(mousePositionSpy.count(), 4); + QTRY_COMPARE(mousePositionSpy.size(), 4); QVERIFY(drag->active()); QCOMPARE(blackRect->x(), 83.0); @@ -1494,7 +1494,7 @@ void tst_QQuickMouseArea::disableAfterPress() QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p); - QTRY_COMPARE(mouseReleaseSpy.count(), 1); + QTRY_COMPARE(mouseReleaseSpy.size(), 1); QVERIFY(!drag->active()); QCOMPARE(blackRect->x(), 83.0); @@ -1513,14 +1513,14 @@ void tst_QQuickMouseArea::disableAfterPress() QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QTest::qWait(50); - QCOMPARE(mousePressSpy.count(), 0); + QCOMPARE(mousePressSpy.size(), 0); QTest::mouseMove(&window, QPoint(111,111)); QTest::qWait(50); QTest::mouseMove(&window, QPoint(122,122)); QTest::qWait(50); - QCOMPARE(mousePositionSpy.count(), 0); + QCOMPARE(mousePositionSpy.size(), 0); QVERIFY(!drag->active()); QCOMPARE(blackRect->x(), 50.0); @@ -1529,7 +1529,7 @@ void tst_QQuickMouseArea::disableAfterPress() QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(122,122)); QTest::qWait(50); - QCOMPARE(mouseReleaseSpy.count(), 0); + QCOMPARE(mouseReleaseSpy.size(), 0); } void tst_QQuickMouseArea::onWheel() @@ -1692,7 +1692,7 @@ void tst_QQuickMouseArea::pressedMultipleButtons() mouseArea->setAcceptedMouseButtons(accepted); QPoint point(10, 10); - for (int i = 0; i < mouseEvents.count(); ++i) { + for (int i = 0; i < mouseEvents.size(); ++i) { const MouseEvent mouseEvent = mouseEvents.at(i); if (mouseEvent.type == QEvent::MouseButtonPress) QTest::mousePress(&window, mouseEvent.button, Qt::NoModifier, point); @@ -1702,8 +1702,8 @@ void tst_QQuickMouseArea::pressedMultipleButtons() QCOMPARE(mouseArea->pressedButtons(), pressedButtons.at(i)); } - QCOMPARE(pressedSpy.count(), 2); - QCOMPARE(pressedButtonsSpy.count(), changeCount); + QCOMPARE(pressedSpy.size(), 2); + QCOMPARE(pressedButtonsSpy.size(), changeCount); } void tst_QQuickMouseArea::changeAxis() @@ -1783,15 +1783,15 @@ void tst_QQuickMouseArea::cursorShape() mouseArea->setCursorShape(Qt::IBeamCursor); QCOMPARE(mouseArea->cursorShape(), Qt::IBeamCursor); QCOMPARE(mouseArea->cursor().shape(), Qt::IBeamCursor); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); mouseArea->setCursorShape(Qt::IBeamCursor); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); mouseArea->setCursorShape(Qt::WaitCursor); QCOMPARE(mouseArea->cursorShape(), Qt::WaitCursor); QCOMPARE(mouseArea->cursor().shape(), Qt::WaitCursor); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } #endif @@ -2004,25 +2004,25 @@ void tst_QQuickMouseArea::containsPress() QCOMPARE(mouseArea->hovered(), true); QTRY_COMPARE(mouseArea->pressed(), true); QCOMPARE(mouseArea->containsPress(), true); - QCOMPARE(containsPressSpy.count(), 1); + QCOMPARE(containsPressSpy.size(), 1); QTest::mouseMove(&window, QPoint(22,33)); QCOMPARE(mouseArea->hovered(), false); QCOMPARE(mouseArea->pressed(), true); QCOMPARE(mouseArea->containsPress(), false); - QCOMPARE(containsPressSpy.count(), 2); + QCOMPARE(containsPressSpy.size(), 2); QTest::mouseMove(&window, QPoint(200,200)); QCOMPARE(mouseArea->hovered(), true); QCOMPARE(mouseArea->pressed(), true); QCOMPARE(mouseArea->containsPress(), true); - QCOMPARE(containsPressSpy.count(), 3); + QCOMPARE(containsPressSpy.size(), 3); QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(200,200)); QCOMPARE(mouseArea->hovered(), hoverEnabled); QCOMPARE(mouseArea->pressed(), false); QCOMPARE(mouseArea->containsPress(), false); - QCOMPARE(containsPressSpy.count(), 4); + QCOMPARE(containsPressSpy.size(), 4); } void tst_QQuickMouseArea::ignoreBySource() @@ -2344,8 +2344,8 @@ void tst_QQuickMouseArea::negativeZStackingOrder() // QTBUG-83114 QSignalSpy clickSpyChild(childMouseArea, &QQuickMouseArea::clicked); QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, QPoint(150, 100)); - QCOMPARE(clickSpyChild.count(), 1); - QCOMPARE(clickSpyParent.count(), 0); + QCOMPARE(clickSpyChild.size(), 1); + QCOMPARE(clickSpyParent.size(), 0); auto order = root->property("clicks").toList(); QVERIFY(order.at(0) == "childMouseArea"); @@ -2353,8 +2353,8 @@ void tst_QQuickMouseArea::negativeZStackingOrder() // QTBUG-83114 childMouseArea->parentItem()->setZ(-1); root->setProperty("clicks", QVariantList()); QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, QPoint(150, 100)); - QCOMPARE(clickSpyChild.count(), 1); - QCOMPARE(clickSpyParent.count(), 1); + QCOMPARE(clickSpyChild.size(), 1); + QCOMPARE(clickSpyParent.size(), 1); order = root->property("clicks").toList(); QVERIFY(order.at(0) == "parentMouseArea"); } @@ -2437,13 +2437,13 @@ void tst_QQuickMouseArea::releaseFirstTouchAfterSecond() // QTBUG-103766 QSignalSpy releaseSpy(mouseArea, &QQuickMouseArea::released); QTest::touchEvent(&window, device).press(0, {20, 20}); - QTRY_COMPARE(pressSpy.count(), 1); + QTRY_COMPARE(pressSpy.size(), 1); QTest::touchEvent(&window, device).stationary(0).press(1, {100, 20}); - QCOMPARE(pressSpy.count(), 1); // touchpoint 0 is the touchmouse, touchpoint 1 is ignored + QCOMPARE(pressSpy.size(), 1); // touchpoint 0 is the touchmouse, touchpoint 1 is ignored QTest::touchEvent(&window, device).stationary(0).release(1, {100, 20}); - QCOMPARE(releaseSpy.count(), 0); // touchpoint 0 is the touchmouse, and remains pressed + QCOMPARE(releaseSpy.size(), 0); // touchpoint 0 is the touchmouse, and remains pressed QTest::touchEvent(&window, device).release(0, {20, 20}); - QTRY_COMPARE(releaseSpy.count(), 1); + QTRY_COMPARE(releaseSpy.size(), 1); } #if QT_CONFIG(tabletevent) @@ -2465,15 +2465,15 @@ void tst_QQuickMouseArea::tabletStylusTap() Qt::LeftButton, 0.5, 0, 0, 0, 0, 0, stylusId, Qt::NoModifier); if (QWindowSystemInterfacePrivate::TabletEvent::platformSynthesizesMouse) QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, point); // simulate what the platform does - QTRY_COMPARE(pressSpy.count(), 1); + QTRY_COMPARE(pressSpy.size(), 1); QWindowSystemInterface::handleTabletEvent(&window, point, window.mapToGlobal(point), int(QInputDevice::DeviceType::Stylus), int(QPointingDevice::PointerType::Pen), Qt::NoButton, 0.5, 0, 0, 0, 0, 0, stylusId, Qt::NoModifier); if (QWindowSystemInterfacePrivate::TabletEvent::platformSynthesizesMouse) QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, point); - QTRY_COMPARE(releaseSpy.count(), 1); - QCOMPARE(clickSpy.count(), 1); - QCOMPARE(pressSpy.count(), 1); + QTRY_COMPARE(releaseSpy.size(), 1); + QCOMPARE(clickSpy.size(), 1); + QCOMPARE(pressSpy.size(), 1); } #endif diff --git a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp index 5da20ce9a2..509465b174 100644 --- a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp +++ b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp @@ -1243,22 +1243,22 @@ void tst_QQuickMultiPointTouchArea::mouseGestureStarted() // QTBUG-70258 QPoint p1 = QPoint(distanceFromOrigin, distanceFromOrigin); QTest::mousePress(view.data(), Qt::LeftButton, Qt::NoModifier, p1); - QCOMPARE(gestureStartedSpy.count(), 0); + QCOMPARE(gestureStartedSpy.size(), 0); p1 += QPoint(dragThreshold, dragThreshold); QTest::mouseMove(view.data(), p1); - QCOMPARE(gestureStartedSpy.count(), 0); + QCOMPARE(gestureStartedSpy.size(), 0); p1 += QPoint(1, 1); QTest::mouseMove(view.data(), p1); - QTRY_COMPARE(gestureStartedSpy.count(), 1); + QTRY_COMPARE(gestureStartedSpy.size(), 1); QTRY_COMPARE(area->property("gestureStartedX").toInt(), distanceFromOrigin); QCOMPARE(area->property("gestureStartedY").toInt(), distanceFromOrigin); p1 += QPoint(10, 10); QTest::mouseMove(view.data(), p1); // if nobody called gesteure->grab(), gestureStarted will keep happening - QTRY_COMPARE(gestureStartedSpy.count(), grabGesture ? 1 : 2); + QTRY_COMPARE(gestureStartedSpy.size(), grabGesture ? 1 : 2); QCOMPARE(area->property("gestureStartedX").toInt(), distanceFromOrigin); QCOMPARE(area->property("gestureStartedY").toInt(), distanceFromOrigin); @@ -1370,7 +1370,7 @@ void tst_QQuickMultiPointTouchArea::touchFiltering() // QTBUG-74028 QQuickTouchUtils::flush(window.data()); QTRY_COMPARE(mpta->parentItem()->property("mptaPoint").toPoint(), pt); QCOMPARE(mpta->parentItem()->property("maPoint").toPoint(), ma->boundingRect().center().toPoint()); - QCOMPARE(mptaSpy.count(), 1); + QCOMPARE(mptaSpy.size(), 1); } void tst_QQuickMultiPointTouchArea::nestedPinchAreaMouse() // QTBUG-83662 @@ -1391,32 +1391,32 @@ void tst_QQuickMultiPointTouchArea::nestedPinchAreaMouse() // QTBUG-83662 QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, p1); QCOMPARE(point1->pressed(), true); QCOMPARE(point2->pressed(), false); - QCOMPARE(pressedSpy.count(), 1); + QCOMPARE(pressedSpy.size(), 1); QCOMPARE(mpta->property("pressedCount").toInt(), 1); - QCOMPARE(updatedSpy.count(), 0); + QCOMPARE(updatedSpy.size(), 0); QCOMPARE(mpta->property("updatedCount").toInt(), 0); - QCOMPARE(releasedSpy.count(), 0); + QCOMPARE(releasedSpy.size(), 0); QCOMPARE(mpta->property("releasedCount").toInt(), 0); p1 += QPoint(0, 15); QTest::mouseMove(window.data(), p1); QCOMPARE(point1->pressed(), true); QCOMPARE(point2->pressed(), false); - QCOMPARE(pressedSpy.count(), 1); + QCOMPARE(pressedSpy.size(), 1); QCOMPARE(mpta->property("pressedCount").toInt(), 1); - QCOMPARE(updatedSpy.count(), 1); + QCOMPARE(updatedSpy.size(), 1); QCOMPARE(mpta->property("updatedCount").toInt(), 1); - QCOMPARE(releasedSpy.count(), 0); + QCOMPARE(releasedSpy.size(), 0); QCOMPARE(mpta->property("releasedCount").toInt(), 0); QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, p1); QCOMPARE(point1->pressed(), false); QCOMPARE(point2->pressed(), false); - QCOMPARE(pressedSpy.count(), 1); + QCOMPARE(pressedSpy.size(), 1); QCOMPARE(mpta->property("pressedCount").toInt(), 1); - QCOMPARE(updatedSpy.count(), 1); + QCOMPARE(updatedSpy.size(), 1); QCOMPARE(mpta->property("updatedCount").toInt(), 1); - QCOMPARE(releasedSpy.count(), 1); + QCOMPARE(releasedSpy.size(), 1); QCOMPARE(mpta->property("releasedCount").toInt(), 1); } diff --git a/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp b/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp index f002de0e3d..56ebfdbd48 100644 --- a/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp +++ b/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp @@ -282,24 +282,24 @@ void tst_QQuickPaintedItem::contentsSize() item.setContentsSize(QSize()); QCOMPARE(item.contentsSize(), QSize()); QCOMPARE(hasDirtyContentFlag(&item), false); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); item.setContentsSize(QSize(320, 240)); QCOMPARE(item.contentsSize(), QSize(320, 240)); QCOMPARE(hasDirtyContentFlag(&item), true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); clearDirtyContentFlag(&item); item.setContentsSize(QSize(320, 240)); QCOMPARE(item.contentsSize(), QSize(320, 240)); QCOMPARE(hasDirtyContentFlag(&item), false); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); item.resetContentsSize(); QCOMPARE(item.contentsSize(), QSize()); QCOMPARE(hasDirtyContentFlag(&item), true); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_QQuickPaintedItem::contentScale() @@ -315,7 +315,7 @@ void tst_QQuickPaintedItem::contentScale() item.setContentsScale(1.); QCOMPARE(item.contentsScale(), 1.); QCOMPARE(hasDirtyContentFlag(&item), false); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); item.update(); QTRY_COMPARE(hasDirtyContentFlag(&item), false); @@ -325,7 +325,7 @@ void tst_QQuickPaintedItem::contentScale() item.setContentsScale(0.4); QCOMPARE(item.contentsScale(), 0.4); QCOMPARE(hasDirtyContentFlag(&item), true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QTRY_COMPARE(hasDirtyContentFlag(&item), false); QVERIFY(item.paintNode); @@ -334,12 +334,12 @@ void tst_QQuickPaintedItem::contentScale() item.setContentsScale(0.4); QCOMPARE(item.contentsScale(), 0.4); QCOMPARE(hasDirtyContentFlag(&item), false); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); item.setContentsScale(2.5); QCOMPARE(item.contentsScale(), 2.5); QCOMPARE(hasDirtyContentFlag(&item), true); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QTRY_COMPARE(hasDirtyContentFlag(&item), false); QVERIFY(item.paintNode); @@ -397,7 +397,7 @@ void tst_QQuickPaintedItem::fillColor() item.setFillColor(QColor(Qt::transparent)); QCOMPARE(item.fillColor(), QColor(Qt::transparent)); QCOMPARE(hasDirtyContentFlag(&item), false); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); item.update(); QTRY_COMPARE(hasDirtyContentFlag(&item), false); @@ -407,7 +407,7 @@ void tst_QQuickPaintedItem::fillColor() item.setFillColor(QColor(Qt::green)); QCOMPARE(item.fillColor(), QColor(Qt::green)); QCOMPARE(hasDirtyContentFlag(&item), true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QTRY_COMPARE(hasDirtyContentFlag(&item), false); QVERIFY(item.paintNode); @@ -416,12 +416,12 @@ void tst_QQuickPaintedItem::fillColor() item.setFillColor(QColor(Qt::green)); QCOMPARE(item.fillColor(), QColor(Qt::green)); QCOMPARE(hasDirtyContentFlag(&item), false); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); item.setFillColor(QColor(Qt::blue)); QCOMPARE(item.fillColor(), QColor(Qt::blue)); QCOMPARE(hasDirtyContentFlag(&item), true); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QTRY_COMPARE(hasDirtyContentFlag(&item), false); QVERIFY(item.paintNode); @@ -440,24 +440,24 @@ void tst_QQuickPaintedItem::renderTarget() item.setRenderTarget(QQuickPaintedItem::Image); QCOMPARE(item.renderTarget(), QQuickPaintedItem::Image); QCOMPARE(hasDirtyContentFlag(&item), false); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); item.setRenderTarget(QQuickPaintedItem::FramebufferObject); QCOMPARE(item.renderTarget(), QQuickPaintedItem::FramebufferObject); QCOMPARE(hasDirtyContentFlag(&item), true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); clearDirtyContentFlag(&item); item.setRenderTarget(QQuickPaintedItem::FramebufferObject); QCOMPARE(item.renderTarget(), QQuickPaintedItem::FramebufferObject); QCOMPARE(hasDirtyContentFlag(&item), false); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); item.setRenderTarget(QQuickPaintedItem::InvertedYFramebufferObject); QCOMPARE(item.renderTarget(), QQuickPaintedItem::InvertedYFramebufferObject); QCOMPARE(hasDirtyContentFlag(&item), true); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } QTEST_MAIN(tst_QQuickPaintedItem) diff --git a/tests/auto/quick/qquickpalette/tst_qquickpalette.cpp b/tests/auto/quick/qquickpalette/tst_qquickpalette.cpp index 90d850ce8a..53fa22dba5 100644 --- a/tests/auto/quick/qquickpalette/tst_qquickpalette.cpp +++ b/tests/auto/quick/qquickpalette/tst_qquickpalette.cpp @@ -117,8 +117,8 @@ void tst_QQuickPalette::newColorSubgroup() anotherPalette.fromQPalette(Qt::red); (p.*setter)((anotherPalette.*getter)()); - QCOMPARE(subgroupChanged.count(), 1); - QCOMPARE(paletteChanged.count(), 1); + QCOMPARE(subgroupChanged.size(), 1); + QCOMPARE(paletteChanged.size(), 1); } } @@ -161,7 +161,7 @@ void tst_QQuickPalette::paletteChangedWhenColorGroupChanged() p.inactive()->setMid(Qt::green); p.disabled()->setMid(Qt::blue); - QCOMPARE(sp.count(), 3); + QCOMPARE(sp.size(), 3); } void tst_QQuickPalette::createDefault() @@ -182,7 +182,7 @@ void tst_QQuickPalette::changeCurrentColorGroup() palette.setCurrentGroup(QPalette::Disabled); QCOMPARE(palette.currentColorGroup(), QPalette::Disabled); - QCOMPARE(ss.count(), 1); + QCOMPARE(ss.size(), 1); } void tst_QQuickPalette::inheritColor() @@ -266,10 +266,10 @@ void tst_QQuickPalette::createFromQtPalette() QSignalSpy sp(&palette, &QQuickColorGroup::changed); palette.fromQPalette(QPalette()); - QCOMPARE(sp.count(), 0); + QCOMPARE(sp.size(), 0); palette.fromQPalette(somePalette); - QCOMPARE(sp.count(), 1); + QCOMPARE(sp.size(), 1); } void tst_QQuickPalette::convertToQtPalette() diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp index cc134dce5a..122ac3e029 100644 --- a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp +++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp @@ -211,7 +211,7 @@ void tst_QQuickPathView::items() QCOMPARE(pathview->count(), model.count()); QCOMPARE(window->rootObject()->property("count").toInt(), model.count()); - QCOMPARE(pathview->childItems().count(), model.count()+1); // assumes all are visible, including highlight + QCOMPARE(pathview->childItems().size(), model.count()+1); // assumes all are visible, including highlight for (int i = 0; i < model.count(); ++i) { QQuickText *name = findItem<QQuickText>(pathview, "textName", i); @@ -681,7 +681,7 @@ void tst_QQuickPathView::consecutiveModelChanges() else pathview->setOffset(4); - for (int i=0; i<changes.count(); i++) { + for (int i=0; i<changes.size(); i++) { switch (changes[i].type) { case ListChange::Inserted: { @@ -709,7 +709,7 @@ void tst_QQuickPathView::consecutiveModelChanges() } QQuickTest::qWaitForPolish(pathview); - QCOMPARE(findItems<QQuickItem>(pathview, "wrapper").count(), count); + QCOMPARE(findItems<QQuickItem>(pathview, "wrapper").size(), count); QCOMPARE(pathview->count(), count); QTRY_COMPARE(pathview->offset(), offset); @@ -812,7 +812,7 @@ void tst_QQuickPathView::dataModel() QTest::qWait(100); QCOMPARE(window->rootObject()->property("viewCount").toInt(), model.count()); - QTRY_COMPARE(findItems<QQuickItem>(pathview, "wrapper").count(), 14); + QTRY_COMPARE(findItems<QQuickItem>(pathview, "wrapper").size(), 14); QCOMPARE(pathview->currentIndex(), 0); QCOMPARE(pathview->currentItem(), findItem<QQuickItem>(pathview, "wrapper", 0)); @@ -832,7 +832,7 @@ void tst_QQuickPathView::dataModel() QMetaObject::invokeMethod(window->rootObject(), "checkProperties"); QVERIFY(!testObject->error()); - QTRY_COMPARE(findItems<QQuickItem>(pathview, "wrapper").count(), 5); + QTRY_COMPARE(findItems<QQuickItem>(pathview, "wrapper").size(), 5); QQuickRectangle *testItem = findItem<QQuickRectangle>(pathview, "wrapper", 4); QVERIFY(testItem != nullptr); @@ -845,7 +845,7 @@ void tst_QQuickPathView::dataModel() model.insertItem(2, "pink", "2"); - QTRY_COMPARE(findItems<QQuickItem>(pathview, "wrapper").count(), 5); + QTRY_COMPARE(findItems<QQuickItem>(pathview, "wrapper").size(), 5); QCOMPARE(pathview->currentIndex(), 1); QCOMPARE(pathview->currentItem(), findItem<QQuickItem>(pathview, "wrapper", 1)); @@ -853,14 +853,14 @@ void tst_QQuickPathView::dataModel() QCOMPARE(text->text(), model.name(2)); model.removeItem(3); - QTRY_COMPARE(findItems<QQuickItem>(pathview, "wrapper").count(), 5); + QTRY_COMPARE(findItems<QQuickItem>(pathview, "wrapper").size(), 5); text = findItem<QQuickText>(pathview, "myText", 3); QVERIFY(text); QCOMPARE(text->text(), model.name(3)); QCOMPARE(pathview->currentItem(), findItem<QQuickItem>(pathview, "wrapper", 1)); model.moveItem(3, 5); - QTRY_COMPARE(findItems<QQuickItem>(pathview, "wrapper").count(), 5); + QTRY_COMPARE(findItems<QQuickItem>(pathview, "wrapper").size(), 5); QList<QQuickItem*> items = findItems<QQuickItem>(pathview, "wrapper"); foreach (QQuickItem *item, items) { QVERIFY(item->property("onPath").toBool()); @@ -870,7 +870,7 @@ void tst_QQuickPathView::dataModel() // QTBUG-14199 pathview->setOffset(7); pathview->setOffset(0); - QCOMPARE(findItems<QQuickItem>(pathview, "wrapper").count(), 5); + QCOMPARE(findItems<QQuickItem>(pathview, "wrapper").size(), 5); pathview->setCurrentIndex(model.count()-1); QTRY_COMPARE(pathview->offset(), 1.0); @@ -1121,7 +1121,7 @@ void tst_QQuickPathView::setCurrentIndex() pathview->setSnapMode(QQuickPathView::SnapToItem); pathview->setCurrentIndex(3); QTRY_COMPARE(pathview->currentIndex(), 3); - QCOMPARE(currentIndexSpy.count(), 1); + QCOMPARE(currentIndexSpy.size(), 1); } void tst_QQuickPathView::setCurrentIndexWrap() @@ -1142,8 +1142,8 @@ void tst_QQuickPathView::setCurrentIndexWrap() pathview->setCurrentIndex(0); pathview->setCurrentIndex(4); QCOMPARE(pathview->currentIndex(), 4); - QCOMPARE(currentIndexSpy.count(), 2); - QCOMPARE(movementStartedSpy.count(), 0); + QCOMPARE(currentIndexSpy.size(), 2); + QCOMPARE(movementStartedSpy.size(), 0); } void tst_QQuickPathView::resetModel() @@ -1208,21 +1208,21 @@ void tst_QQuickPathView::propertyChanges() QCOMPARE(pathView->preferredHighlightEnd(), 0.4); QCOMPARE(pathView->dragMargin(), 20.0); - QCOMPARE(snapPositionSpy.count(), 1); - QCOMPARE(dragMarginSpy.count(), 1); + QCOMPARE(snapPositionSpy.size(), 1); + QCOMPARE(dragMarginSpy.size(), 1); pathView->setPreferredHighlightBegin(0.4); pathView->setPreferredHighlightEnd(0.4); pathView->setDragMargin(20.0); - QCOMPARE(snapPositionSpy.count(), 1); - QCOMPARE(dragMarginSpy.count(), 1); + QCOMPARE(snapPositionSpy.size(), 1); + QCOMPARE(dragMarginSpy.size(), 1); QSignalSpy maximumFlickVelocitySpy(pathView, SIGNAL(maximumFlickVelocityChanged())); pathView->setMaximumFlickVelocity(1000); - QCOMPARE(maximumFlickVelocitySpy.count(), 1); + QCOMPARE(maximumFlickVelocitySpy.size(), 1); pathView->setMaximumFlickVelocity(1000); - QCOMPARE(maximumFlickVelocitySpy.count(), 1); + QCOMPARE(maximumFlickVelocitySpy.size(), 1); } @@ -1250,14 +1250,14 @@ void tst_QQuickPathView::pathChanges() QCOMPARE(path->startX(), 240.0); QCOMPARE(path->startY(), 220.0); - QCOMPARE(startXSpy.count(),1); - QCOMPARE(startYSpy.count(),1); + QCOMPARE(startXSpy.size(),1); + QCOMPARE(startYSpy.size(),1); path->setStartX(240); path->setStartY(220); - QCOMPARE(startXSpy.count(),1); - QCOMPARE(startYSpy.count(),1); + QCOMPARE(startXSpy.size(),1); + QCOMPARE(startYSpy.size(),1); QQuickPath *alternatePath = window->rootObject()->findChild<QQuickPath*>("alternatePath"); QVERIFY(alternatePath); @@ -1268,10 +1268,10 @@ void tst_QQuickPathView::pathChanges() pathView->setPath(alternatePath); QCOMPARE(pathView->path(), alternatePath); - QCOMPARE(pathSpy.count(),1); + QCOMPARE(pathSpy.size(),1); pathView->setPath(alternatePath); - QCOMPARE(pathSpy.count(),1); + QCOMPARE(pathSpy.size(),1); QQuickPathAttribute *pathAttribute = window->rootObject()->findChild<QQuickPathAttribute*>("pathAttribute"); QVERIFY(pathAttribute); @@ -1281,10 +1281,10 @@ void tst_QQuickPathView::pathChanges() pathAttribute->setName("scale"); QCOMPARE(pathAttribute->name(), QString("scale")); - QCOMPARE(nameSpy.count(),1); + QCOMPARE(nameSpy.size(),1); pathAttribute->setName("scale"); - QCOMPARE(nameSpy.count(),1); + QCOMPARE(nameSpy.size(),1); } void tst_QQuickPathView::componentChanges() @@ -1303,10 +1303,10 @@ void tst_QQuickPathView::componentChanges() pathView->setDelegate(&delegateComponent); QCOMPARE(pathView->delegate(), &delegateComponent); - QCOMPARE(delegateSpy.count(),1); + QCOMPARE(delegateSpy.size(),1); pathView->setDelegate(&delegateComponent); - QCOMPARE(delegateSpy.count(),1); + QCOMPARE(delegateSpy.size(),1); } void tst_QQuickPathView::modelChanges() @@ -1329,17 +1329,17 @@ void tst_QQuickPathView::modelChanges() QCOMPARE(pathView->currentIndex(), 3); pathView->setModel(modelVariant); QCOMPARE(pathView->model(), modelVariant); - QCOMPARE(modelSpy.count(),1); + QCOMPARE(modelSpy.size(),1); QCOMPARE(pathView->currentIndex(), 0); - QCOMPARE(currentIndexSpy.count(), 1); + QCOMPARE(currentIndexSpy.size(), 1); pathView->setModel(modelVariant); - QCOMPARE(modelSpy.count(),1); + QCOMPARE(modelSpy.size(),1); pathView->setModel(QVariant()); - QCOMPARE(modelSpy.count(),2); + QCOMPARE(modelSpy.size(),2); QCOMPARE(pathView->currentIndex(), 0); - QCOMPARE(currentIndexSpy.count(), 1); + QCOMPARE(currentIndexSpy.size(), 1); } @@ -1523,12 +1523,12 @@ void tst_QQuickPathView::mouseDrag() // first move beyond threshold does not trigger drag QVERIFY(!pathview->isMoving()); QVERIFY(!pathview->isDragging()); - QCOMPARE(movingSpy.count(), 0); - QCOMPARE(moveStartedSpy.count(), 0); - QCOMPARE(moveEndedSpy.count(), 0); - QCOMPARE(draggingSpy.count(), 0); - QCOMPARE(dragStartedSpy.count(), 0); - QCOMPARE(dragEndedSpy.count(), 0); + QCOMPARE(movingSpy.size(), 0); + QCOMPARE(moveStartedSpy.size(), 0); + QCOMPARE(moveEndedSpy.size(), 0); + QCOMPARE(draggingSpy.size(), 0); + QCOMPARE(dragStartedSpy.size(), 0); + QCOMPARE(dragEndedSpy.size(), 0); { QMouseEvent mv(QEvent::MouseMove, QPoint(90,100), window->mapToGlobal(QPoint(90,100)), @@ -1542,23 +1542,23 @@ void tst_QQuickPathView::mouseDrag() #endif // Q_OS_WIN QVERIFY(pathview->isMoving()); QVERIFY(pathview->isDragging()); - QCOMPARE(movingSpy.count(), 1); - QCOMPARE(moveStartedSpy.count(), 1); - QCOMPARE(moveEndedSpy.count(), 0); - QCOMPARE(draggingSpy.count(), 1); - QCOMPARE(dragStartedSpy.count(), 1); - QCOMPARE(dragEndedSpy.count(), 0); + QCOMPARE(movingSpy.size(), 1); + QCOMPARE(moveStartedSpy.size(), 1); + QCOMPARE(moveEndedSpy.size(), 0); + QCOMPARE(draggingSpy.size(), 1); + QCOMPARE(dragStartedSpy.size(), 1); + QCOMPARE(dragEndedSpy.size(), 0); QVERIFY(pathview->currentIndex() != current); QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(40,100)); QVERIFY(!pathview->isDragging()); - QCOMPARE(draggingSpy.count(), 2); - QCOMPARE(dragStartedSpy.count(), 1); - QCOMPARE(dragEndedSpy.count(), 1); - QTRY_COMPARE(movingSpy.count(), 2); - QTRY_COMPARE(moveEndedSpy.count(), 1); - QCOMPARE(moveStartedSpy.count(), 1); + QCOMPARE(draggingSpy.size(), 2); + QCOMPARE(dragStartedSpy.size(), 1); + QCOMPARE(dragEndedSpy.size(), 1); + QTRY_COMPARE(movingSpy.size(), 2); + QTRY_COMPARE(moveEndedSpy.size(), 1); + QCOMPARE(moveStartedSpy.size(), 1); } @@ -1617,30 +1617,30 @@ void tst_QQuickPathView::flickNClick() // QTBUG-77173 // Dragging the child mouse area should animate the PathView (MA has no drag target) flick(window.data(), QPoint(199,199), QPoint(399,199), duration); QVERIFY(pathview->isMoving()); - QCOMPARE(movingChangedSpy.count(), 1); - QCOMPARE(draggingSpy.count(), 2); - QCOMPARE(dragStartedSpy.count(), 1); - QCOMPARE(dragEndedSpy.count(), 1); - QVERIFY(currentIndexSpy.count() > 0); - QCOMPARE(moveStartedSpy.count(), 1); - QCOMPARE(moveEndedSpy.count(), 0); - QCOMPARE(flickingSpy.count(), 1); - QCOMPARE(flickStartedSpy.count(), 1); - QCOMPARE(flickEndedSpy.count(), 0); + QCOMPARE(movingChangedSpy.size(), 1); + QCOMPARE(draggingSpy.size(), 2); + QCOMPARE(dragStartedSpy.size(), 1); + QCOMPARE(dragEndedSpy.size(), 1); + QVERIFY(currentIndexSpy.size() > 0); + QCOMPARE(moveStartedSpy.size(), 1); + QCOMPARE(moveEndedSpy.size(), 0); + QCOMPARE(flickingSpy.size(), 1); + QCOMPARE(flickStartedSpy.size(), 1); + QCOMPARE(flickEndedSpy.size(), 0); // Now while it's still moving, click it. // The PathView should stop at a position such that offset is a whole number. QTest::mouseClick(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(200, 200)); QTRY_VERIFY(!pathview->isMoving()); - QCOMPARE(movingChangedSpy.count(), 2); // QTBUG-78926 - QCOMPARE(draggingSpy.count(), 2); - QCOMPARE(dragStartedSpy.count(), 1); - QCOMPARE(dragEndedSpy.count(), 1); - QCOMPARE(moveStartedSpy.count(), 1); - QCOMPARE(moveEndedSpy.count(), 1); - QCOMPARE(flickingSpy.count(), 2); - QCOMPARE(flickStartedSpy.count(), 1); - QCOMPARE(flickEndedSpy.count(), 1); + QCOMPARE(movingChangedSpy.size(), 2); // QTBUG-78926 + QCOMPARE(draggingSpy.size(), 2); + QCOMPARE(dragStartedSpy.size(), 1); + QCOMPARE(dragEndedSpy.size(), 1); + QCOMPARE(moveStartedSpy.size(), 1); + QCOMPARE(moveEndedSpy.size(), 1); + QCOMPARE(flickingSpy.size(), 2); + QCOMPARE(flickStartedSpy.size(), 1); + QCOMPARE(flickEndedSpy.size(), 1); QVERIFY(qFuzzyIsNull(pathview->offset() - int(pathview->offset()))); } } @@ -1762,7 +1762,7 @@ void tst_QQuickPathView::currentOffsetOnInsertion() model.insertItem(0, "item1", "1"); qApp->processEvents(); - QCOMPARE(currentIndexSpy.count(), 1); + QCOMPARE(currentIndexSpy.size(), 1); // currentIndex is now 1 item = findItem<QQuickRectangle>(pathview, "wrapper", 1); @@ -1775,7 +1775,7 @@ void tst_QQuickPathView::currentOffsetOnInsertion() model.insertItem(0, "item2", "2"); qApp->processEvents(); - QCOMPARE(currentIndexSpy.count(), 2); + QCOMPARE(currentIndexSpy.size(), 2); // currentIndex is now 2 item = findItem<QQuickRectangle>(pathview, "wrapper", 2); @@ -1788,7 +1788,7 @@ void tst_QQuickPathView::currentOffsetOnInsertion() model.removeItem(0); qApp->processEvents(); - QCOMPARE(currentIndexSpy.count(), 3); + QCOMPARE(currentIndexSpy.size(), 3); // currentIndex is now 1 item = findItem<QQuickRectangle>(pathview, "wrapper", 1); @@ -1896,9 +1896,9 @@ void tst_QQuickPathView::cancelDrag() QTRY_VERIFY(hasFraction(pathview->offset())); QTRY_VERIFY(pathview->isMoving()); QVERIFY(pathview->isDragging()); - QCOMPARE(draggingSpy.count(), 1); - QCOMPARE(dragStartedSpy.count(), 1); - QCOMPARE(dragEndedSpy.count(), 0); + QCOMPARE(draggingSpy.size(), 1); + QCOMPARE(dragStartedSpy.size(), 1); + QCOMPARE(dragEndedSpy.size(), 0); // steal mouse grab - cancels PathView dragging auto mouse = QPointingDevice::primaryPointingDevice(); @@ -1911,9 +1911,9 @@ void tst_QQuickPathView::cancelDrag() QTRY_COMPARE(pathview->offset(), qreal(qFloor(pathview->offset()))); QTRY_VERIFY(!pathview->isMoving()); QVERIFY(!pathview->isDragging()); - QCOMPARE(draggingSpy.count(), 2); - QCOMPARE(dragStartedSpy.count(), 1); - QCOMPARE(dragEndedSpy.count(), 1); + QCOMPARE(draggingSpy.size(), 2); + QCOMPARE(dragStartedSpy.size(), 1); + QCOMPARE(dragEndedSpy.size(), 1); QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(40,100)); } @@ -2021,7 +2021,7 @@ void tst_QQuickPathView::snapOneItem() QSignalSpy snapModeSpy(pathview, SIGNAL(snapModeChanged())); window->rootObject()->setProperty("snapOne", true); - QCOMPARE(snapModeSpy.count(), 1); + QCOMPARE(snapModeSpy.size(), 1); QTRY_VERIFY(!pathview->isMoving()); // ensure stable int currentIndex = pathview->currentIndex(); @@ -2302,22 +2302,22 @@ void tst_QQuickPathView::nestedinFlickable() // first move beyond threshold does not trigger drag QVERIFY(!pathview->isMoving()); QVERIFY(!pathview->isDragging()); - QCOMPARE(movingSpy.count(), 0); - QCOMPARE(moveStartedSpy.count(), 0); - QCOMPARE(moveEndedSpy.count(), 0); - QCOMPARE(fflickingSpy.count(), 0); - QCOMPARE(fflickStartedSpy.count(), 0); - QCOMPARE(fflickEndedSpy.count(), 0); + QCOMPARE(movingSpy.size(), 0); + QCOMPARE(moveStartedSpy.size(), 0); + QCOMPARE(moveEndedSpy.size(), 0); + QCOMPARE(fflickingSpy.size(), 0); + QCOMPARE(fflickStartedSpy.size(), 0); + QCOMPARE(fflickEndedSpy.size(), 0); // no further moves after the initial move beyond threshold QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(73,219)); - QTRY_COMPARE(movingSpy.count(), 2); - QTRY_COMPARE(moveEndedSpy.count(), 1); - QCOMPARE(moveStartedSpy.count(), 1); + QTRY_COMPARE(movingSpy.size(), 2); + QTRY_COMPARE(moveEndedSpy.size(), 1); + QCOMPARE(moveStartedSpy.size(), 1); // Flickable should not handle this - QCOMPARE(fflickingSpy.count(), 0); - QCOMPARE(fflickStartedSpy.count(), 0); - QCOMPARE(fflickEndedSpy.count(), 0); + QCOMPARE(fflickingSpy.size(), 0); + QCOMPARE(fflickStartedSpy.size(), 0); + QCOMPARE(fflickEndedSpy.size(), 0); // now test that two quick flicks are both handled by the pathview movingSpy.clear(); @@ -2351,25 +2351,25 @@ void tst_QQuickPathView::nestedinFlickable() // we allow the multiple signal count case, rather than simply: // QTRY_COMPARE(moveEndedSpy.count(), 1); // QCOMPARE(moveStartedSpy.count(), 1); - QTRY_VERIFY(moveEndedSpy.count() > 0); + QTRY_VERIFY(moveEndedSpy.size() > 0); qCDebug(lcTests) << "After receiving moveEnded signal:" - << "moveEndedSpy.count():" << moveEndedSpy.count() - << "moveStartedSpy.count():" << moveStartedSpy.count() - << "fflickingSpy.count():" << fflickingSpy.count() - << "fflickStartedSpy.count():" << fflickStartedSpy.count() - << "fflickEndedSpy.count():" << fflickEndedSpy.count(); - QTRY_COMPARE(moveStartedSpy.count(), moveEndedSpy.count()); + << "moveEndedSpy.count():" << moveEndedSpy.size() + << "moveStartedSpy.count():" << moveStartedSpy.size() + << "fflickingSpy.count():" << fflickingSpy.size() + << "fflickStartedSpy.count():" << fflickStartedSpy.size() + << "fflickEndedSpy.count():" << fflickEndedSpy.size(); + QTRY_COMPARE(moveStartedSpy.size(), moveEndedSpy.size()); qCDebug(lcTests) << "After receiving matched moveEnded signal(s):" - << "moveEndedSpy.count():" << moveEndedSpy.count() - << "moveStartedSpy.count():" << moveStartedSpy.count() - << "fflickingSpy.count():" << fflickingSpy.count() - << "fflickStartedSpy.count():" << fflickStartedSpy.count() - << "fflickEndedSpy.count():" << fflickEndedSpy.count(); - QVERIFY(moveStartedSpy.count() <= 2); + << "moveEndedSpy.count():" << moveEndedSpy.size() + << "moveStartedSpy.count():" << moveStartedSpy.size() + << "fflickingSpy.count():" << fflickingSpy.size() + << "fflickStartedSpy.count():" << fflickStartedSpy.size() + << "fflickEndedSpy.count():" << fflickEndedSpy.size(); + QVERIFY(moveStartedSpy.size() <= 2); // Flickable should not handle this - QCOMPARE(fflickingSpy.count(), 0); - QCOMPARE(fflickStartedSpy.count(), 0); - QCOMPARE(fflickEndedSpy.count(), 0); + QCOMPARE(fflickingSpy.size(), 0); + QCOMPARE(fflickStartedSpy.size(), 0); + QCOMPARE(fflickEndedSpy.size(), 0); } @@ -2440,22 +2440,22 @@ void tst_QQuickPathView::flickableDelegate() // first move beyond threshold does not trigger drag QVERIFY(!flickable->isMoving()); QVERIFY(!flickable->isDragging()); - QCOMPARE(movingSpy.count(), 0); - QCOMPARE(moveStartedSpy.count(), 0); - QCOMPARE(moveEndedSpy.count(), 0); - QCOMPARE(fflickingSpy.count(), 0); - QCOMPARE(fflickStartedSpy.count(), 0); - QCOMPARE(fflickEndedSpy.count(), 0); + QCOMPARE(movingSpy.size(), 0); + QCOMPARE(moveStartedSpy.size(), 0); + QCOMPARE(moveEndedSpy.size(), 0); + QCOMPARE(fflickingSpy.size(), 0); + QCOMPARE(fflickStartedSpy.size(), 0); + QCOMPARE(fflickEndedSpy.size(), 0); // no further moves after the initial move beyond threshold QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(53,100)); - QTRY_COMPARE(fflickingSpy.count(), 2); - QTRY_COMPARE(fflickStartedSpy.count(), 1); - QCOMPARE(fflickEndedSpy.count(), 1); + QTRY_COMPARE(fflickingSpy.size(), 2); + QTRY_COMPARE(fflickStartedSpy.size(), 1); + QCOMPARE(fflickEndedSpy.size(), 1); // PathView should not handle this - QTRY_COMPARE(movingSpy.count(), 0); - QTRY_COMPARE(moveEndedSpy.count(), 0); - QCOMPARE(moveStartedSpy.count(), 0); + QTRY_COMPARE(movingSpy.size(), 0); + QTRY_COMPARE(moveEndedSpy.size(), 0); + QCOMPARE(moveStartedSpy.size(), 0); } void tst_QQuickPathView::jsArrayChange() @@ -2478,11 +2478,11 @@ void tst_QQuickPathView::jsArrayChange() } view->setModel(QVariant::fromValue(array1)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // no change view->setModel(QVariant::fromValue(array2)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_QQuickPathView::qtbug37815() @@ -2776,14 +2776,14 @@ void tst_QQuickPathView::touchMove() QVERIFY(!pathview->isMoving()); QVERIFY(!pathview->isDragging()); - QCOMPARE(movingSpy.count(), 0); - QCOMPARE(moveStartedSpy.count(), 0); - QCOMPARE(moveEndedSpy.count(), 0); - QCOMPARE(draggingSpy.count(), 0); - QCOMPARE(dragStartedSpy.count(), 0); - QCOMPARE(dragEndedSpy.count(), 0); - QCOMPARE(flickStartedSpy.count(), 0); - QCOMPARE(flickEndedSpy.count(), 0); + QCOMPARE(movingSpy.size(), 0); + QCOMPARE(moveStartedSpy.size(), 0); + QCOMPARE(moveEndedSpy.size(), 0); + QCOMPARE(draggingSpy.size(), 0); + QCOMPARE(dragStartedSpy.size(), 0); + QCOMPARE(dragEndedSpy.size(), 0); + QCOMPARE(flickStartedSpy.size(), 0); + QCOMPARE(flickEndedSpy.size(), 0); from -= QPoint(QGuiApplication::styleHints()->startDragDistance() + 1, 0); QTest::touchEvent(window.data(), touchDevice.data()).move(0, from, window.data()); @@ -2792,14 +2792,14 @@ void tst_QQuickPathView::touchMove() // first move does not trigger move/drag QVERIFY(!pathview->isMoving()); QVERIFY(!pathview->isDragging()); - QCOMPARE(movingSpy.count(), 0); - QCOMPARE(moveStartedSpy.count(), 0); - QCOMPARE(moveEndedSpy.count(), 0); - QCOMPARE(draggingSpy.count(), 0); - QCOMPARE(dragStartedSpy.count(), 0); - QCOMPARE(dragEndedSpy.count(), 0); - QCOMPARE(flickStartedSpy.count(), 0); - QCOMPARE(flickEndedSpy.count(), 0); + QCOMPARE(movingSpy.size(), 0); + QCOMPARE(moveStartedSpy.size(), 0); + QCOMPARE(moveEndedSpy.size(), 0); + QCOMPARE(draggingSpy.size(), 0); + QCOMPARE(dragStartedSpy.size(), 0); + QCOMPARE(dragEndedSpy.size(), 0); + QCOMPARE(flickStartedSpy.size(), 0); + QCOMPARE(flickEndedSpy.size(), 0); QPoint diff = from - to; int moveCount = 4; @@ -2809,14 +2809,14 @@ void tst_QQuickPathView::touchMove() QVERIFY(pathview->isMoving()); QVERIFY(pathview->isDragging()); - QCOMPARE(movingSpy.count(), 1); - QCOMPARE(moveStartedSpy.count(), 1); - QCOMPARE(moveEndedSpy.count(), 0); - QCOMPARE(draggingSpy.count(), 1); - QCOMPARE(dragStartedSpy.count(), 1); - QCOMPARE(dragEndedSpy.count(), 0); - QCOMPARE(flickStartedSpy.count(), 0); - QCOMPARE(flickEndedSpy.count(), 0); + QCOMPARE(movingSpy.size(), 1); + QCOMPARE(moveStartedSpy.size(), 1); + QCOMPARE(moveEndedSpy.size(), 0); + QCOMPARE(draggingSpy.size(), 1); + QCOMPARE(dragStartedSpy.size(), 1); + QCOMPARE(dragEndedSpy.size(), 0); + QCOMPARE(flickStartedSpy.size(), 0); + QCOMPARE(flickEndedSpy.size(), 0); } QVERIFY(pathview->currentIndex() != current); @@ -2825,14 +2825,14 @@ void tst_QQuickPathView::touchMove() QVERIFY(pathview->isMoving()); QVERIFY(!pathview->isDragging()); - QCOMPARE(movingSpy.count(), 1); - QCOMPARE(moveStartedSpy.count(), 1); - QCOMPARE(moveEndedSpy.count(), 0); - QCOMPARE(draggingSpy.count(), 2); - QCOMPARE(dragStartedSpy.count(), 1); - QCOMPARE(dragEndedSpy.count(), 1); - QCOMPARE(flickStartedSpy.count(), 1); - QCOMPARE(flickEndedSpy.count(), 0); + QCOMPARE(movingSpy.size(), 1); + QCOMPARE(moveStartedSpy.size(), 1); + QCOMPARE(moveEndedSpy.size(), 0); + QCOMPARE(draggingSpy.size(), 2); + QCOMPARE(dragStartedSpy.size(), 1); + QCOMPARE(dragEndedSpy.size(), 1); + QCOMPARE(flickStartedSpy.size(), 1); + QCOMPARE(flickEndedSpy.size(), 0); // Wait for the flick to finish QVERIFY(QTest::qWaitFor([&]() @@ -2840,14 +2840,14 @@ void tst_QQuickPathView::touchMove() )); QVERIFY(!pathview->isMoving()); QVERIFY(!pathview->isDragging()); - QCOMPARE(movingSpy.count(), 2); - QCOMPARE(moveStartedSpy.count(), 1); - QCOMPARE(moveEndedSpy.count(), 1); - QCOMPARE(draggingSpy.count(), 2); - QCOMPARE(dragStartedSpy.count(), 1); - QCOMPARE(dragEndedSpy.count(), 1); - QCOMPARE(flickStartedSpy.count(), 1); - QCOMPARE(flickEndedSpy.count(), 1); + QCOMPARE(movingSpy.size(), 2); + QCOMPARE(moveStartedSpy.size(), 1); + QCOMPARE(moveEndedSpy.size(), 1); + QCOMPARE(draggingSpy.size(), 2); + QCOMPARE(dragStartedSpy.size(), 1); + QCOMPARE(dragEndedSpy.size(), 1); + QCOMPARE(flickStartedSpy.size(), 1); + QCOMPARE(flickEndedSpy.size(), 1); } diff --git a/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp index 1ab1429692..800d7211fb 100644 --- a/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp +++ b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp @@ -64,18 +64,18 @@ void tst_QQuickPinchArea::pinchProperties() QVERIFY(rootItem != nullptr); QSignalSpy targetSpy(pinch, SIGNAL(targetChanged())); pinch->setTarget(rootItem); - QCOMPARE(targetSpy.count(),1); + QCOMPARE(targetSpy.size(),1); pinch->setTarget(rootItem); - QCOMPARE(targetSpy.count(),1); + QCOMPARE(targetSpy.size(),1); // axis QCOMPARE(pinch->axis(), QQuickPinch::XAndYAxis); QSignalSpy axisSpy(pinch, SIGNAL(dragAxisChanged())); pinch->setAxis(QQuickPinch::XAxis); QCOMPARE(pinch->axis(), QQuickPinch::XAxis); - QCOMPARE(axisSpy.count(),1); + QCOMPARE(axisSpy.size(),1); pinch->setAxis(QQuickPinch::XAxis); - QCOMPARE(axisSpy.count(),1); + QCOMPARE(axisSpy.size(),1); // minimum and maximum drag properties QSignalSpy xminSpy(pinch, SIGNAL(minimumXChanged())); @@ -98,20 +98,20 @@ void tst_QQuickPinchArea::pinchProperties() QCOMPARE(pinch->ymin(), 10.0); QCOMPARE(pinch->ymax(), 10.0); - QCOMPARE(xminSpy.count(),1); - QCOMPARE(xmaxSpy.count(),1); - QCOMPARE(yminSpy.count(),1); - QCOMPARE(ymaxSpy.count(),1); + QCOMPARE(xminSpy.size(),1); + QCOMPARE(xmaxSpy.size(),1); + QCOMPARE(yminSpy.size(),1); + QCOMPARE(ymaxSpy.size(),1); pinch->setXmin(10); pinch->setXmax(10); pinch->setYmin(10); pinch->setYmax(10); - QCOMPARE(xminSpy.count(),1); - QCOMPARE(xmaxSpy.count(),1); - QCOMPARE(yminSpy.count(),1); - QCOMPARE(ymaxSpy.count(),1); + QCOMPARE(xminSpy.size(),1); + QCOMPARE(xmaxSpy.size(),1); + QCOMPARE(yminSpy.size(),1); + QCOMPARE(ymaxSpy.size(),1); // minimum and maximum scale properties QSignalSpy scaleMinSpy(pinch, SIGNAL(minimumScaleChanged())); @@ -126,14 +126,14 @@ void tst_QQuickPinchArea::pinchProperties() QCOMPARE(pinch->minimumScale(), 0.5); QCOMPARE(pinch->maximumScale(), 1.5); - QCOMPARE(scaleMinSpy.count(),1); - QCOMPARE(scaleMaxSpy.count(),1); + QCOMPARE(scaleMinSpy.size(),1); + QCOMPARE(scaleMaxSpy.size(),1); pinch->setMinimumScale(0.5); pinch->setMaximumScale(1.5); - QCOMPARE(scaleMinSpy.count(),1); - QCOMPARE(scaleMaxSpy.count(),1); + QCOMPARE(scaleMinSpy.size(),1); + QCOMPARE(scaleMaxSpy.size(),1); // minimum and maximum rotation properties QSignalSpy rotMinSpy(pinch, SIGNAL(minimumRotationChanged())); @@ -148,14 +148,14 @@ void tst_QQuickPinchArea::pinchProperties() QCOMPARE(pinch->minimumRotation(), -90.0); QCOMPARE(pinch->maximumRotation(), 45.0); - QCOMPARE(rotMinSpy.count(),1); - QCOMPARE(rotMaxSpy.count(),1); + QCOMPARE(rotMinSpy.size(),1); + QCOMPARE(rotMaxSpy.size(),1); pinch->setMinimumRotation(-90.0); pinch->setMaximumRotation(45.0); - QCOMPARE(rotMinSpy.count(),1); - QCOMPARE(rotMaxSpy.count(),1); + QCOMPARE(rotMinSpy.size(),1); + QCOMPARE(rotMaxSpy.size(),1); } QEventPoint makeTouchPoint(int id, QPoint p, QQuickView *v, QQuickItem *i) @@ -388,7 +388,7 @@ void tst_QQuickPinchArea::retouch() pinchSequence.move(0, p1,window).move(1, p2,window).commit(); QQuickTouchUtils::flush(window); - QCOMPARE(startedSpy.count(), 1); + QCOMPARE(startedSpy.size(), 1); QCOMPARE(root->property("scale").toReal(), 1.5); QCOMPARE(root->property("center").toPointF(), QPointF(40, 40)); // blackrect is at 50,50 @@ -396,15 +396,15 @@ void tst_QQuickPinchArea::retouch() QCOMPARE(window->rootObject()->property("pointCount").toInt(), 2); - QCOMPARE(startedSpy.count(), 1); - QCOMPARE(finishedSpy.count(), 0); + QCOMPARE(startedSpy.size(), 1); + QCOMPARE(finishedSpy.size(), 0); // Hold down the first finger but release the second one pinchSequence.stationary(0).release(1, p2, window).commit(); QQuickTouchUtils::flush(window); - QCOMPARE(startedSpy.count(), 1); - QCOMPARE(finishedSpy.count(), 0); + QCOMPARE(startedSpy.size(), 1); + QCOMPARE(finishedSpy.size(), 0); QCOMPARE(window->rootObject()->property("pointCount").toInt(), 1); @@ -417,8 +417,8 @@ void tst_QQuickPinchArea::retouch() QQuickTouchUtils::flush(window); // Lifting and retouching results in onPinchStarted being called again - QCOMPARE(startedSpy.count(), 2); - QCOMPARE(finishedSpy.count(), 0); + QCOMPARE(startedSpy.size(), 2); + QCOMPARE(finishedSpy.size(), 0); QCOMPARE(window->rootObject()->property("pointCount").toInt(), 2); @@ -426,8 +426,8 @@ void tst_QQuickPinchArea::retouch() QQuickTouchUtils::flush(window); QVERIFY(!root->property("pinchActive").toBool()); - QCOMPARE(startedSpy.count(), 2); - QCOMPARE(finishedSpy.count(), 1); + QCOMPARE(startedSpy.size(), 2); + QCOMPARE(finishedSpy.size(), 1); } } diff --git a/tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp b/tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp index dbcb502653..590f022e4e 100644 --- a/tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp +++ b/tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp @@ -203,7 +203,7 @@ void tst_qquickpixmapcache::parallel() QList<bool> pending; QList<Slotter*> getters; - for (int i=0; i<targets.count(); ++i) { + for (int i=0; i<targets.size(); ++i) { QUrl target = targets.at(i); QQuickPixmap *pixmap = new QQuickPixmap; @@ -223,9 +223,9 @@ void tst_qquickpixmapcache::parallel() } } - if (incache + slotters != targets.count()) + if (incache + slotters != targets.size()) QFAIL(QString::fromLatin1("pixmap counts don't add up: %1 incache, %2 slotters, %3 total") - .arg(incache).arg(slotters).arg(targets.count()).toLatin1().constData()); + .arg(incache).arg(slotters).arg(targets.size()).toLatin1().constData()); if (cancel >= 0) { pixmaps.at(cancel)->clear(getters[cancel]); @@ -237,7 +237,7 @@ void tst_qquickpixmapcache::parallel() QVERIFY(!QTestEventLoop::instance().timeout()); } - for (int i=0; i<targets.count(); ++i) { + for (int i=0; i<targets.size(); ++i) { QQuickPixmap *pixmap = pixmaps[i]; if (i == cancel) { diff --git a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp index ab8e83b488..f7db547393 100644 --- a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp +++ b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp @@ -1149,7 +1149,7 @@ void tst_qquickpositioners::addTransitions(const QString &positionerObjectName) targetItems = findItems<QQuickItem>(positioner, "wrapper", targetIndexes); - QTRY_COMPARE(window->rootObject()->property("addTransitionsDone").toInt(), targetData.count()); + QTRY_COMPARE(window->rootObject()->property("addTransitionsDone").toInt(), targetData.size()); QTRY_COMPARE(window->rootObject()->property("displaceTransitionsDone").toInt(), expectedDisplacedIndexes.count()); // check the target and displaced items were animated @@ -1262,9 +1262,9 @@ void tst_qquickpositioners::moveTransitions(const QString &positionerObjectName) model_displacedItems_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with displaced anim", "shouldn't have been animated with displaced anim"); // check attached properties - QCOMPARE(window->rootObject()->property("targetTrans_items").toMap().count(), 0); - QCOMPARE(window->rootObject()->property("targetTrans_targetIndexes").toList().count(), 0); - QCOMPARE(window->rootObject()->property("targetTrans_targetItems").toList().count(), 0); + QCOMPARE(window->rootObject()->property("targetTrans_items").toMap().size(), 0); + QCOMPARE(window->rootObject()->property("targetTrans_targetIndexes").toList().size(), 0); + QCOMPARE(window->rootObject()->property("targetTrans_targetItems").toList().size(), 0); if (expectedDisplacedIndexes.isValid()) { // adjust expectedDisplacedIndexes to their final values after the move QList<int> displacedIndexes; @@ -1279,11 +1279,11 @@ void tst_qquickpositioners::moveTransitions(const QString &positionerObjectName) matchItemsAndIndexes(window->rootObject()->property("displacedTrans_items").toMap(), model, displacedIndexes); QVariantList listOfEmptyIntLists; - for (int i=0; i<displacedIndexes.count(); i++) + for (int i=0; i<displacedIndexes.size(); i++) listOfEmptyIntLists << QVariant::fromValue(QList<int>()); QCOMPARE(window->rootObject()->property("displacedTrans_targetIndexes").toList(), listOfEmptyIntLists); QVariantList listOfEmptyObjectLists; - for (int i=0; i<displacedIndexes.count(); i++) + for (int i=0; i<displacedIndexes.size(); i++) listOfEmptyObjectLists.insert(listOfEmptyObjectLists.count(), QVariantList()); QCOMPARE(window->rootObject()->property("displacedTrans_targetItems").toList(), listOfEmptyObjectLists); } @@ -2938,37 +2938,37 @@ void tst_qquickpositioners::test_propertychanges() grid->setMove(rowTransition); QCOMPARE(grid->add(), rowTransition); QCOMPARE(grid->move(), rowTransition); - QCOMPARE(addSpy.count(),1); - QCOMPARE(moveSpy.count(),1); + QCOMPARE(addSpy.size(),1); + QCOMPARE(moveSpy.size(),1); grid->setAdd(rowTransition); grid->setMove(rowTransition); - QCOMPARE(addSpy.count(),1); - QCOMPARE(moveSpy.count(),1); + QCOMPARE(addSpy.size(),1); + QCOMPARE(moveSpy.size(),1); grid->setAdd(nullptr); grid->setMove(nullptr); - QCOMPARE(addSpy.count(),2); - QCOMPARE(moveSpy.count(),2); + QCOMPARE(addSpy.size(),2); + QCOMPARE(moveSpy.size(),2); grid->setColumns(-1); grid->setRows(3); QCOMPARE(grid->columns(), -1); QCOMPARE(grid->rows(), 3); - QCOMPARE(columnsSpy.count(),1); - QCOMPARE(rowsSpy.count(),1); + QCOMPARE(columnsSpy.size(),1); + QCOMPARE(rowsSpy.size(),1); grid->setColumns(-1); grid->setRows(3); - QCOMPARE(columnsSpy.count(),1); - QCOMPARE(rowsSpy.count(),1); + QCOMPARE(columnsSpy.size(),1); + QCOMPARE(rowsSpy.size(),1); QTest::ignoreMessage(QtWarningMsg, QRegularExpression(".*QML Grid: Grid contains more visible items \\(20\\) than rows\\*columns \\(6\\)")); grid->setColumns(2); QTest::ignoreMessage(QtWarningMsg, QRegularExpression(".*QML Grid: Grid contains more visible items \\(20\\) than rows\\*columns \\(4\\)")); grid->setRows(2); - QCOMPARE(columnsSpy.count(),2); - QCOMPARE(rowsSpy.count(),2); + QCOMPARE(columnsSpy.size(),2); + QCOMPARE(rowsSpy.size(),2); } @@ -4032,7 +4032,7 @@ void tst_qquickpositioners::matchItemsAndIndexes(const QVariantMap &items, const qDebug() << itemIndex; QCOMPARE(model.name(itemIndex), name); } - QCOMPARE(items.count(), expectedIndexes.count()); + QCOMPARE(items.count(), expectedIndexes.size()); } void tst_qquickpositioners::matchItemLists(const QVariantList &itemLists, const QList<QQuickItem *> &expectedItems) @@ -4045,7 +4045,7 @@ void tst_qquickpositioners::matchItemLists(const QVariantList &itemLists, const QVERIFY2(o, QTest::toString(QString("Invalid actual item at %1").arg(j))); QVERIFY2(expectedItems.contains(o), QTest::toString(QString("Cannot match item %1").arg(j))); } - QCOMPARE(current.count(), expectedItems.count()); + QCOMPARE(current.count(), expectedItems.size()); } } diff --git a/tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp b/tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp index 644e698647..36cd23a545 100644 --- a/tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp +++ b/tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp @@ -189,46 +189,46 @@ void tst_qquickrectangle::antialiasing() rect->setAntialiasing(true); QCOMPARE(rect->antialiasing(), true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); rect->setAntialiasing(true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); rect->resetAntialiasing(); QCOMPARE(rect->antialiasing(), false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); rect->setRadius(5); QCOMPARE(rect->antialiasing(), true); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); rect->resetAntialiasing(); QCOMPARE(rect->antialiasing(), true); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); rect->setRadius(0); QCOMPARE(rect->antialiasing(), false); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); rect->resetAntialiasing(); QCOMPARE(rect->antialiasing(), false); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); rect->setRadius(5); QCOMPARE(rect->antialiasing(), true); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); rect->resetAntialiasing(); QCOMPARE(rect->antialiasing(), true); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); rect->setAntialiasing(false); QCOMPARE(rect->antialiasing(), false); - QCOMPARE(spy.count(), 6); + QCOMPARE(spy.size(), 6); rect->resetAntialiasing(); QCOMPARE(rect->antialiasing(), true); - QCOMPARE(spy.count(), 7); + QCOMPARE(spy.size(), 7); } QTEST_MAIN(tst_qquickrectangle) diff --git a/tests/auto/quick/qquickrendercontrol/tst_qquickrendercontrol.cpp b/tests/auto/quick/qquickrendercontrol/tst_qquickrendercontrol.cpp index b1cc9563eb..2d56312f9d 100644 --- a/tests/auto/quick/qquickrendercontrol/tst_qquickrendercontrol.cpp +++ b/tests/auto/quick/qquickrendercontrol/tst_qquickrendercontrol.cpp @@ -388,7 +388,7 @@ void tst_RenderControl::renderAndReadBackWithVulkanNative() f->vkGetPhysicalDeviceQueueFamilyProperties(physDev, &queueCount, queueFamilyProps.data()); int gfxQueueFamilyIdx = -1; - for (int i = 0; i < queueFamilyProps.count(); ++i) { + for (int i = 0; i < queueFamilyProps.size(); ++i) { if (queueFamilyProps[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) { gfxQueueFamilyIdx = i; break; diff --git a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp index befa16b632..8c5959d618 100644 --- a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp +++ b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp @@ -106,7 +106,7 @@ void tst_QQuickRepeater::numberModel() QQuickRepeater *repeater = findItem<QQuickRepeater>(window->rootObject(), "repeater"); QVERIFY(repeater != nullptr); - QCOMPARE(repeater->parentItem()->childItems().count(), 5+1); + QCOMPARE(repeater->parentItem()->childItems().size(), 5+1); QVERIFY(!repeater->itemAt(-1)); for (int i=0; i<repeater->count(); i++) @@ -117,10 +117,10 @@ void tst_QQuickRepeater::numberModel() QVERIFY(!testObject->error()); ctxt->setContextProperty("testData", std::numeric_limits<int>::max()); - QCOMPARE(repeater->parentItem()->childItems().count(), 1); + QCOMPARE(repeater->parentItem()->childItems().size(), 1); ctxt->setContextProperty("testData", -1234); - QCOMPARE(repeater->parentItem()->childItems().count(), 1); + QCOMPARE(repeater->parentItem()->childItems().size(), 1); delete testObject; delete window; @@ -173,8 +173,8 @@ void tst_QQuickRepeater::objectList() QSignalSpy addedSpy(repeater, SIGNAL(itemAdded(int,QQuickItem*))); QSignalSpy removedSpy(repeater, SIGNAL(itemRemoved(int,QQuickItem*))); ctxt->setContextProperty("testData", QVariant::fromValue(data)); - QCOMPARE(addedSpy.count(), data.count()); - QCOMPARE(removedSpy.count(), data.count()); + QCOMPARE(addedSpy.size(), data.count()); + QCOMPARE(removedSpy.size(), data.count()); qDeleteAll(data); delete window; @@ -207,22 +207,22 @@ void tst_QQuickRepeater::stringList() QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container"); QVERIFY(container != nullptr); - QCOMPARE(container->childItems().count(), data.count() + 3); + QCOMPARE(container->childItems().size(), data.size() + 3); bool saw_repeater = false; - for (int i = 0; i < container->childItems().count(); ++i) { + for (int i = 0; i < container->childItems().size(); ++i) { if (i == 0) { QQuickText *name = qobject_cast<QQuickText*>(container->childItems().at(i)); QVERIFY(name != nullptr); QCOMPARE(name->text(), QLatin1String("Zero")); - } else if (i == container->childItems().count() - 2) { + } else if (i == container->childItems().size() - 2) { // The repeater itself QQuickRepeater *rep = qobject_cast<QQuickRepeater*>(container->childItems().at(i)); QCOMPARE(rep, repeater); saw_repeater = true; continue; - } else if (i == container->childItems().count() - 1) { + } else if (i == container->childItems().size() - 1) { QQuickText *name = qobject_cast<QQuickText*>(container->childItems().at(i)); QVERIFY(name != nullptr); QCOMPARE(name->text(), QLatin1String("Last")); @@ -262,8 +262,8 @@ void tst_QQuickRepeater::dataModel_adding() // add to empty model testModel.addItem("two", "2"); QCOMPARE(repeater->itemAt(0), container->childItems().at(0)); - QCOMPARE(countSpy.count(), 1); countSpy.clear(); - QCOMPARE(addedSpy.count(), 1); + QCOMPARE(countSpy.size(), 1); countSpy.clear(); + QCOMPARE(addedSpy.size(), 1); QCOMPARE(addedSpy.at(0).at(0).toInt(), 0); QCOMPARE(addedSpy.at(0).at(1).value<QQuickItem*>(), container->childItems().at(0)); addedSpy.clear(); @@ -271,8 +271,8 @@ void tst_QQuickRepeater::dataModel_adding() // insert at start testModel.insertItem(0, "one", "1"); QCOMPARE(repeater->itemAt(0), container->childItems().at(0)); - QCOMPARE(countSpy.count(), 1); countSpy.clear(); - QCOMPARE(addedSpy.count(), 1); + QCOMPARE(countSpy.size(), 1); countSpy.clear(); + QCOMPARE(addedSpy.size(), 1); QCOMPARE(addedSpy.at(0).at(0).toInt(), 0); QCOMPARE(addedSpy.at(0).at(1).value<QQuickItem*>(), container->childItems().at(0)); addedSpy.clear(); @@ -280,8 +280,8 @@ void tst_QQuickRepeater::dataModel_adding() // insert at end testModel.insertItem(2, "four", "4"); QCOMPARE(repeater->itemAt(2), container->childItems().at(2)); - QCOMPARE(countSpy.count(), 1); countSpy.clear(); - QCOMPARE(addedSpy.count(), 1); + QCOMPARE(countSpy.size(), 1); countSpy.clear(); + QCOMPARE(addedSpy.size(), 1); QCOMPARE(addedSpy.at(0).at(0).toInt(), 2); QCOMPARE(addedSpy.at(0).at(1).value<QQuickItem*>(), container->childItems().at(2)); addedSpy.clear(); @@ -289,8 +289,8 @@ void tst_QQuickRepeater::dataModel_adding() // insert in middle testModel.insertItem(2, "three", "3"); QCOMPARE(repeater->itemAt(2), container->childItems().at(2)); - QCOMPARE(countSpy.count(), 1); countSpy.clear(); - QCOMPARE(addedSpy.count(), 1); + QCOMPARE(countSpy.size(), 1); countSpy.clear(); + QCOMPARE(addedSpy.size(), 1); QCOMPARE(addedSpy.at(0).at(0).toInt(), 2); QCOMPARE(addedSpy.at(0).at(1).value<QQuickItem*>(), container->childItems().at(2)); addedSpy.clear(); @@ -300,8 +300,8 @@ void tst_QQuickRepeater::dataModel_adding() QList<QPair<QString, QString> > multiData; multiData << qMakePair(QStringLiteral("five"), QStringLiteral("5")) << qMakePair(QStringLiteral("six"), QStringLiteral("6")) << qMakePair(QStringLiteral("seven"), QStringLiteral("7")); testModel.insertItems(1, multiData); - QCOMPARE(countSpy.count(), 1); - QCOMPARE(addedSpy.count(), 3); + QCOMPARE(countSpy.size(), 1); + QCOMPARE(addedSpy.size(), 3); QCOMPARE(container->childItems().size(), childItemsSize + 3); QCOMPARE(repeater->itemAt(2), container->childItems().at(2)); addedSpy.clear(); @@ -335,7 +335,7 @@ void tst_QQuickRepeater::dataModel_removing() QVERIFY(repeater != nullptr); QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container"); QVERIFY(container != nullptr); - QCOMPARE(container->childItems().count(), repeater->count()+1); + QCOMPARE(container->childItems().size(), repeater->count()+1); QSignalSpy countSpy(repeater, SIGNAL(countChanged())); QSignalSpy removedSpy(repeater, SIGNAL(itemRemoved(int,QQuickItem*))); @@ -346,8 +346,8 @@ void tst_QQuickRepeater::dataModel_removing() testModel.removeItem(0); QVERIFY(repeater->itemAt(0) != item); - QCOMPARE(countSpy.count(), 1); countSpy.clear(); - QCOMPARE(removedSpy.count(), 1); + QCOMPARE(countSpy.size(), 1); countSpy.clear(); + QCOMPARE(removedSpy.size(), 1); QCOMPARE(removedSpy.at(0).at(0).toInt(), 0); QCOMPARE(removedSpy.at(0).at(1).value<QQuickItem*>(), item); removedSpy.clear(); @@ -359,8 +359,8 @@ void tst_QQuickRepeater::dataModel_removing() testModel.removeItem(lastIndex); QVERIFY(repeater->itemAt(lastIndex) != item); - QCOMPARE(countSpy.count(), 1); countSpy.clear(); - QCOMPARE(removedSpy.count(), 1); + QCOMPARE(countSpy.size(), 1); countSpy.clear(); + QCOMPARE(removedSpy.size(), 1); QCOMPARE(removedSpy.at(0).at(0).toInt(), lastIndex); QCOMPARE(removedSpy.at(0).at(1).value<QQuickItem*>(), item); removedSpy.clear(); @@ -371,8 +371,8 @@ void tst_QQuickRepeater::dataModel_removing() testModel.removeItem(1); QVERIFY(repeater->itemAt(lastIndex) != item); - QCOMPARE(countSpy.count(), 1); countSpy.clear(); - QCOMPARE(removedSpy.count(), 1); + QCOMPARE(countSpy.size(), 1); countSpy.clear(); + QCOMPARE(removedSpy.size(), 1); QCOMPARE(removedSpy.at(0).at(0).toInt(), 1); QCOMPARE(removedSpy.at(0).at(1).value<QQuickItem*>(), item); removedSpy.clear(); @@ -401,7 +401,7 @@ void tst_QQuickRepeater::dataModel_changes() QVERIFY(repeater != nullptr); QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container"); QVERIFY(container != nullptr); - QCOMPARE(container->childItems().count(), repeater->count()+1); + QCOMPARE(container->childItems().size(), repeater->count()+1); // Check that model changes are propagated QQuickText *text = findItem<QQuickText>(window->rootObject(), "myName", 1); @@ -437,7 +437,7 @@ void tst_QQuickRepeater::itemModel() QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container"); QVERIFY(container != nullptr); - QCOMPARE(container->childItems().count(), 1); + QCOMPARE(container->childItems().size(), 1); testObject->setUseModel(true); QMetaObject::invokeMethod(window->rootObject(), "checkProperties"); @@ -450,20 +450,20 @@ void tst_QQuickRepeater::itemModel() window->dumpObjectTree(); } - QCOMPARE(container->childItems().count(), 4); + QCOMPARE(container->childItems().size(), 4); QCOMPARE(qobject_cast<QObject*>(container->childItems().at(0))->objectName(), QLatin1String("item1")); QCOMPARE(qobject_cast<QObject*>(container->childItems().at(1))->objectName(), QLatin1String("item2")); QCOMPARE(qobject_cast<QObject*>(container->childItems().at(2))->objectName(), QLatin1String("item3")); QCOMPARE(container->childItems().at(3), repeater); QMetaObject::invokeMethod(window->rootObject(), "switchModel"); - QCOMPARE(container->childItems().count(), 3); + QCOMPARE(container->childItems().size(), 3); QCOMPARE(qobject_cast<QObject*>(container->childItems().at(0))->objectName(), QLatin1String("item4")); QCOMPARE(qobject_cast<QObject*>(container->childItems().at(1))->objectName(), QLatin1String("item5")); QCOMPARE(container->childItems().at(2), repeater); testObject->setUseModel(false); - QCOMPARE(container->childItems().count(), 1); + QCOMPARE(container->childItems().size(), 1); delete testObject; delete window; @@ -486,7 +486,7 @@ void tst_QQuickRepeater::resetModel() QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container"); QVERIFY(container != nullptr); - QCOMPARE(repeater->count(), dataA.count()); + QCOMPARE(repeater->count(), dataA.size()); for (int i=0; i<repeater->count(); i++) QCOMPARE(repeater->itemAt(i), container->childItems().at(i+1)); // +1 to skip first Text object @@ -501,13 +501,13 @@ void tst_QQuickRepeater::resetModel() // reset context property ctxt->setContextProperty("testData", dataB); - QCOMPARE(repeater->count(), dataB.count()); + QCOMPARE(repeater->count(), dataB.size()); - QCOMPARE(modelChangedSpy.count(), 1); - QCOMPARE(countSpy.count(), 1); - QCOMPARE(removedSpy.count(), dataA.count()); - QCOMPARE(addedSpy.count(), dataB.count()); - for (int i=0; i<dataB.count(); i++) { + QCOMPARE(modelChangedSpy.size(), 1); + QCOMPARE(countSpy.size(), 1); + QCOMPARE(removedSpy.size(), dataA.size()); + QCOMPARE(addedSpy.size(), dataB.size()); + for (int i=0; i<dataB.size(); i++) { QCOMPARE(addedSpy.at(i).at(0).toInt(), i); QCOMPARE(addedSpy.at(i).at(1).value<QQuickItem*>(), repeater->itemAt(i)); } @@ -518,13 +518,13 @@ void tst_QQuickRepeater::resetModel() // reset via setModel() repeater->setModel(dataA); - QCOMPARE(repeater->count(), dataA.count()); + QCOMPARE(repeater->count(), dataA.size()); - QCOMPARE(modelChangedSpy.count(), 1); - QCOMPARE(countSpy.count(), 1); - QCOMPARE(removedSpy.count(), dataB.count()); - QCOMPARE(addedSpy.count(), dataA.count()); - for (int i=0; i<dataA.count(); i++) { + QCOMPARE(modelChangedSpy.size(), 1); + QCOMPARE(countSpy.size(), 1); + QCOMPARE(removedSpy.size(), dataB.size()); + QCOMPARE(addedSpy.size(), dataA.size()); + for (int i=0; i<dataA.size(); i++) { QCOMPARE(addedSpy.at(i).at(0).toInt(), i); QCOMPARE(addedSpy.at(i).at(1).value<QQuickItem*>(), repeater->itemAt(i)); } @@ -551,12 +551,12 @@ void tst_QQuickRepeater::modelChanged() repeater->setModel(4); QCOMPARE(repeater->count(), 4); QCOMPARE(repeater->property("itemsCount").toInt(), 4); - QCOMPARE(repeater->property("itemsFound").toList().count(), 4); + QCOMPARE(repeater->property("itemsFound").toList().size(), 4); repeater->setModel(10); QCOMPARE(repeater->count(), 10); QCOMPARE(repeater->property("itemsCount").toInt(), 10); - QCOMPARE(repeater->property("itemsFound").toList().count(), 10); + QCOMPARE(repeater->property("itemsFound").toList().size(), 10); delete rootObject; } @@ -593,10 +593,10 @@ void tst_QQuickRepeater::modelReset() model.resetItems(items); - QCOMPARE(countSpy.count(), 1); - QCOMPARE(removedSpy.count(), 0); - QCOMPARE(addedSpy.count(), items.count()); - for (int i = 0; i< items.count(); i++) { + QCOMPARE(countSpy.size(), 1); + QCOMPARE(removedSpy.size(), 0); + QCOMPARE(addedSpy.size(), items.size()); + for (int i = 0; i< items.size(); i++) { QCOMPARE(addedSpy.at(i).at(0).toInt(), i); QCOMPARE(addedSpy.at(i).at(1).value<QQuickItem*>(), repeater->itemAt(i)); } @@ -605,10 +605,10 @@ void tst_QQuickRepeater::modelReset() addedSpy.clear(); model.reset(); - QCOMPARE(countSpy.count(), 0); - QCOMPARE(removedSpy.count(), 3); - QCOMPARE(addedSpy.count(), 3); - for (int i = 0; i< items.count(); i++) { + QCOMPARE(countSpy.size(), 0); + QCOMPARE(removedSpy.size(), 3); + QCOMPARE(addedSpy.size(), 3); + for (int i = 0; i< items.size(); i++) { QCOMPARE(addedSpy.at(i).at(0).toInt(), i); QCOMPARE(addedSpy.at(i).at(1).value<QQuickItem*>(), repeater->itemAt(i)); } @@ -620,10 +620,10 @@ void tst_QQuickRepeater::modelReset() items.append(qMakePair(QString::fromLatin1("five"), QString::fromLatin1("5"))); model.resetItems(items); - QCOMPARE(countSpy.count(), 1); - QCOMPARE(removedSpy.count(), 3); - QCOMPARE(addedSpy.count(), 5); - for (int i = 0; i< items.count(); i++) { + QCOMPARE(countSpy.size(), 1); + QCOMPARE(removedSpy.size(), 3); + QCOMPARE(addedSpy.size(), 5); + for (int i = 0; i< items.size(); i++) { QCOMPARE(addedSpy.at(i).at(0).toInt(), i); QCOMPARE(addedSpy.at(i).at(1).value<QQuickItem*>(), repeater->itemAt(i)); } @@ -634,9 +634,9 @@ void tst_QQuickRepeater::modelReset() items.clear(); model.resetItems(items); - QCOMPARE(countSpy.count(), 1); - QCOMPARE(removedSpy.count(), 5); - QCOMPARE(addedSpy.count(), 0); + QCOMPARE(countSpy.size(), 1); + QCOMPARE(removedSpy.size(), 5); + QCOMPARE(addedSpy.size(), 0); } // QTBUG-46828 @@ -672,9 +672,9 @@ void tst_QQuickRepeater::properties() QSignalSpy modelSpy(repeater, SIGNAL(modelChanged())); repeater->setModel(3); - QCOMPARE(modelSpy.count(),1); + QCOMPARE(modelSpy.size(),1); repeater->setModel(3); - QCOMPARE(modelSpy.count(),1); + QCOMPARE(modelSpy.size(),1); QSignalSpy delegateSpy(repeater, SIGNAL(delegateChanged())); @@ -682,9 +682,9 @@ void tst_QQuickRepeater::properties() rectComponent.setData("import QtQuick 2.0; Rectangle {}", QUrl::fromLocalFile("")); repeater->setDelegate(&rectComponent); - QCOMPARE(delegateSpy.count(),1); + QCOMPARE(delegateSpy.size(),1); repeater->setDelegate(&rectComponent); - QCOMPARE(delegateSpy.count(),1); + QCOMPARE(delegateSpy.size(),1); delete rootObject; } @@ -844,11 +844,11 @@ void tst_QQuickRepeater::jsArrayChange() } repeater->setModel(QVariant::fromValue(array1)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // no change repeater->setModel(QVariant::fromValue(array2)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_QQuickRepeater::clearRemovalOrder() @@ -876,7 +876,7 @@ void tst_QQuickRepeater::clearRemovalOrder() // we should have 0 items, and 3 removal signals. QCOMPARE(repeater->count(), 0); - QCOMPARE(removedSpy.count(), 3); + QCOMPARE(removedSpy.size(), 3); // column 1 is for the items, we won't bother verifying these. just look at // the indices and make sure they're sane. diff --git a/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp b/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp index 64547108b8..ccdf69facf 100644 --- a/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp +++ b/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp @@ -50,7 +50,7 @@ void tst_qquickscreen::basicProperties() QCOMPARE(screen->geometry().x(), root->property("vx").toInt()); QCOMPARE(screen->geometry().y(), root->property("vy").toInt()); - QVERIFY(root->property("screenCount").toInt() == QGuiApplication::screens().count()); + QVERIFY(root->property("screenCount").toInt() == QGuiApplication::screens().size()); } void tst_qquickscreen::screenOnStartup() @@ -89,7 +89,7 @@ void tst_qquickscreen::fullScreenList() QVERIFY(screensArray.isArray()); int length = screensArray.property("length").toInt(); const QList<QScreen *> screenList = QGuiApplication::screens(); - QVERIFY(length == screenList.count()); + QVERIFY(length == screenList.size()); for (int i = 0; i < length; ++i) { QQuickScreenInfo *info = qobject_cast<QQuickScreenInfo *>(screensArray.property(i).toQObject()); diff --git a/tests/auto/quick/qquickshape/tst_qquickshape.cpp b/tests/auto/quick/qquickshape/tst_qquickshape.cpp index 4da77cd35b..a9e15939d3 100644 --- a/tests/auto/quick/qquickshape/tst_qquickshape.cpp +++ b/tests/auto/quick/qquickshape/tst_qquickshape.cpp @@ -204,7 +204,7 @@ void tst_QQuickShape::changeSignals() QSignalSpy asyncPropSpy(obj, SIGNAL(asynchronousChanged())); obj->setAsynchronous(true); obj->setAsynchronous(false); - QCOMPARE(asyncPropSpy.count(), 2); + QCOMPARE(asyncPropSpy.size(), 2); QQmlListReference list(obj, "data"); QQuickShapePath *vp = qobject_cast<QQuickShapePath *>(list.at(0)); @@ -224,29 +224,29 @@ void tst_QQuickShape::changeSignals() vp->setCapStyle(QQuickShapePath::RoundCap); vp->setDashOffset(10); vp->setDashPattern(QVector<qreal>() << 1 << 2 << 3 << 4); - QCOMPARE(strokeColorPropSpy.count(), 1); - QCOMPARE(vpChangeSpy.count(), 10); + QCOMPARE(strokeColorPropSpy.size(), 1); + QCOMPARE(vpChangeSpy.size(), 10); // Verify that property changes from Path and its elements bubble up and result in shapePathChanged(). QQuickPath *path = vp; path->setStartX(30); - QCOMPARE(vpChangeSpy.count(), 11); + QCOMPARE(vpChangeSpy.size(), 11); QQmlListReference pathList(path, "pathElements"); qobject_cast<QQuickPathLine *>(pathList.at(1))->setY(200); - QCOMPARE(vpChangeSpy.count(), 12); + QCOMPARE(vpChangeSpy.size(), 12); // Verify that property changes from the gradient bubble up and result in shapePathChanged(). vp->setFillGradient(g); - QCOMPARE(vpChangeSpy.count(), 13); + QCOMPARE(vpChangeSpy.size(), 13); QQuickShapeLinearGradient *lgrad = qobject_cast<QQuickShapeLinearGradient *>(g); lgrad->setX2(200); - QCOMPARE(vpChangeSpy.count(), 14); + QCOMPARE(vpChangeSpy.size(), 14); QQmlListReference stopList(lgrad, "stops"); QCOMPARE(stopList.count(), 5); qobject_cast<QQuickGradientStop *>(stopList.at(1))->setPosition(0.3); - QCOMPARE(vpChangeSpy.count(), 15); + QCOMPARE(vpChangeSpy.size(), 15); qobject_cast<QQuickGradientStop *>(stopList.at(1))->setColor(Qt::black); - QCOMPARE(vpChangeSpy.count(), 16); + QCOMPARE(vpChangeSpy.size(), 16); } void tst_QQuickShape::render() diff --git a/tests/auto/quick/qquickstates/tst_qquickstates.cpp b/tests/auto/quick/qquickstates/tst_qquickstates.cpp index 6aceaf9827..8cd306fc98 100644 --- a/tests/auto/quick/qquickstates/tst_qquickstates.cpp +++ b/tests/auto/quick/qquickstates/tst_qquickstates.cpp @@ -1328,7 +1328,7 @@ void tst_qquickstates::illegalObjectCreation() QQmlComponent component(&engine, testFileUrl("illegalObj.qml")); QList<QQmlError> errors = component.errors(); - QCOMPARE(errors.count(), 1); + QCOMPARE(errors.size(), 1); const QQmlError &error = errors.at(0); QCOMPARE(error.line(), 9); QCOMPARE(error.column(), 23); @@ -1884,10 +1884,10 @@ void tst_qquickstates::parentChangeInvolvingBindings() QCOMPARE(root->property("childRotation").toInt(), 100); // First change to 40 via reverse(), then to 20 via binding. - QCOMPARE(xSpy.count(), 2); + QCOMPARE(xSpy.size(), 2); // First change to 400 via reverse(), then to 200 via binding. - QCOMPARE(widthSpy.count(), 2); + QCOMPARE(widthSpy.size(), 2); QCOMPARE(root->property("childX").toInt(), 20); QCOMPARE(root->property("childWidth").toInt(), 200); diff --git a/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp b/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp index 28249afb08..c9dd75e5c3 100644 --- a/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp +++ b/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp @@ -152,7 +152,7 @@ void tst_qquickstyledtext::textOutput() const QVector<QTextLayout::FormatRange> layoutFormats = layout.formats(); - QCOMPARE(layoutFormats.count(), formats.count()); + QCOMPARE(layoutFormats.size(), formats.count()); for (int i = 0; i < formats.count(); ++i) { QCOMPARE(layoutFormats.at(i).start, formats.at(i).start); QCOMPARE(layoutFormats.at(i).length, formats.at(i).length); @@ -182,7 +182,7 @@ void tst_qquickstyledtext::anchors() const QVector<QTextLayout::FormatRange> layoutFormats = layout.formats(); - QCOMPARE(layoutFormats.count(), formats.count()); + QCOMPARE(layoutFormats.size(), formats.count()); for (int i = 0; i < formats.count(); ++i) { QCOMPARE(layoutFormats.at(i).start, formats.at(i).start); QCOMPARE(layoutFormats.at(i).length, formats.at(i).length); diff --git a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp index 6c41f00c7d..67a77fd621 100644 --- a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp +++ b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp @@ -297,7 +297,7 @@ void tst_QQuickTableView::emptyModel() tableView->setModel(model); WAIT_UNTIL_POLISHED; - QCOMPARE(tableViewPrivate->loadedItems.count(), 0); + QCOMPARE(tableViewPrivate->loadedItems.size(), 0); } void tst_QQuickTableView::checkPreload_data() @@ -739,7 +739,7 @@ void tst_QQuickTableView::checkForceLayoutWhenAllItemsAreHidden() // Check that the we have no items loaded QCOMPARE(tableViewPrivate->loadedColumns.count(), 0); QCOMPARE(tableViewPrivate->loadedRows.count(), 0); - QCOMPARE(tableViewPrivate->loadedItems.count(), 0); + QCOMPARE(tableViewPrivate->loadedItems.size(), 0); // Tell all columns to be visible view->rootObject()->setProperty(propertyName, 10); @@ -747,7 +747,7 @@ void tst_QQuickTableView::checkForceLayoutWhenAllItemsAreHidden() QCOMPARE(tableViewPrivate->loadedRows.count(), rows); QCOMPARE(tableViewPrivate->loadedColumns.count(), columns); - QCOMPARE(tableViewPrivate->loadedItems.count(), rows * columns); + QCOMPARE(tableViewPrivate->loadedItems.size(), rows * columns); } void tst_QQuickTableView::checkContentWidthAndHeight() @@ -1131,7 +1131,7 @@ void tst_QQuickTableView::noDelegate() WAIT_UNTIL_POLISHED; items = tableViewPrivate->loadedItems; - QCOMPARE(items.count(), rows * columns); + QCOMPARE(items.size(), rows * columns); // And then unset the delegate again, and check // that we end up with no items. @@ -1220,11 +1220,11 @@ void tst_QQuickTableView::countDelegateItems() // Check that tableview internals contain the expected number of items auto const items = tableViewPrivate->loadedItems; - QCOMPARE(items.count(), count); + QCOMPARE(items.size(), count); // Check that this also matches the items found in the view auto foundItems = findItems<QQuickItem>(tableView, kDelegateObjectName); - QCOMPARE(foundItems.count(), count); + QCOMPARE(foundItems.size(), count); } void tst_QQuickTableView::checkLayoutOfEqualSizedDelegateItems_data() @@ -2337,7 +2337,7 @@ void tst_QQuickTableView::checkRebuildViewportOnly() // Set reuse items to false, just to make it easier to // check the number of items created during a rebuild. tableView->setReuseItems(false); - const int itemCountBeforeRebuild = tableViewPrivate->loadedItems.count(); + const int itemCountBeforeRebuild = tableViewPrivate->loadedItems.size(); // Since all cells have the same size, we expect that we end up creating // the same amount of items that were already showing before, even after @@ -2492,8 +2492,8 @@ void tst_QQuickTableView::hideRowsAndColumns() WAIT_UNTIL_POLISHED; - const int expectedRowCount = modelSize - rowsToHideList.count(); - const int expectedColumnCount = modelSize - columnsToHideList.count(); + const int expectedRowCount = modelSize - rowsToHideList.size(); + const int expectedColumnCount = modelSize - columnsToHideList.size(); QCOMPARE(tableViewPrivate->loadedRows.count(), expectedRowCount); QCOMPARE(tableViewPrivate->loadedColumns.count(), expectedColumnCount); @@ -2523,7 +2523,7 @@ void tst_QQuickTableView::hideAndShowFirstColumn() WAIT_UNTIL_POLISHED; - const int expectedColumnCount = modelSize - columnsToHideList.count(); + const int expectedColumnCount = modelSize - columnsToHideList.size(); QCOMPARE(tableViewPrivate->loadedColumns.count(), expectedColumnCount); QCOMPARE(tableViewPrivate->leftColumn(), 1); QCOMPARE(tableView->contentX(), 0); @@ -2561,7 +2561,7 @@ void tst_QQuickTableView::hideAndShowFirstRow() WAIT_UNTIL_POLISHED; - const int expectedRowsCount = modelSize - rowsToHideList.count(); + const int expectedRowsCount = modelSize - rowsToHideList.size(); QCOMPARE(tableViewPrivate->loadedRows.count(), expectedRowsCount); QCOMPARE(tableViewPrivate->topRow(), 1); QCOMPARE(tableView->contentY(), 0); @@ -3886,10 +3886,10 @@ void tst_QQuickTableView::leftRightTopBottomProperties() QCOMPARE(tableView->rightColumn(), expectedTable.right()); QCOMPARE(tableView->bottomRow(), expectedTable.bottom()); - QCOMPARE(leftSpy.count(), expectedSignalCount.left()); - QCOMPARE(rightSpy.count(), expectedSignalCount.right()); - QCOMPARE(topSpy.count(), expectedSignalCount.top()); - QCOMPARE(bottomSpy.count(), expectedSignalCount.bottom()); + QCOMPARE(leftSpy.size(), expectedSignalCount.left()); + QCOMPARE(rightSpy.size(), expectedSignalCount.right()); + QCOMPARE(topSpy.size(), expectedSignalCount.top()); + QCOMPARE(bottomSpy.size(), expectedSignalCount.bottom()); } void tst_QQuickTableView::checkContentSize_data() diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp index 63b6df5605..475ae92f48 100644 --- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp @@ -488,14 +488,14 @@ void tst_qquicktext::wrap() textObject->setWrapMode(QQuickText::Wrap); QCOMPARE(textObject->wrapMode(), QQuickText::Wrap); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); textObject->setWrapMode(QQuickText::Wrap); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); textObject->setWrapMode(QQuickText::NoWrap); QCOMPARE(textObject->wrapMode(), QQuickText::NoWrap); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } } @@ -760,14 +760,14 @@ void tst_qquicktext::textFormat() text->setTextFormat(QQuickText::StyledText); QCOMPARE(text->textFormat(), QQuickText::StyledText); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); text->setTextFormat(QQuickText::StyledText); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); text->setTextFormat(QQuickText::AutoText); QCOMPARE(text->textFormat(), QQuickText::AutoText); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } { @@ -1244,25 +1244,25 @@ void tst_qquicktext::color() textObject->setColor(QColor("white")); QCOMPARE(textObject->color(), QColor("white")); - QCOMPARE(colorSpy.count(), 1); + QCOMPARE(colorSpy.size(), 1); textObject->setLinkColor(QColor("black")); QCOMPARE(textObject->linkColor(), QColor("black")); - QCOMPARE(linkColorSpy.count(), 1); + QCOMPARE(linkColorSpy.size(), 1); textObject->setColor(QColor("white")); - QCOMPARE(colorSpy.count(), 1); + QCOMPARE(colorSpy.size(), 1); textObject->setLinkColor(QColor("black")); - QCOMPARE(linkColorSpy.count(), 1); + QCOMPARE(linkColorSpy.size(), 1); textObject->setColor(QColor("black")); QCOMPARE(textObject->color(), QColor("black")); - QCOMPARE(colorSpy.count(), 2); + QCOMPARE(colorSpy.size(), 2); textObject->setLinkColor(QColor("blue")); QCOMPARE(textObject->linkColor(), QColor("blue")); - QCOMPARE(linkColorSpy.count(), 2); + QCOMPARE(linkColorSpy.size(), 2); delete textObject; } @@ -1329,12 +1329,12 @@ void tst_qquicktext::color() QCOMPARE(textObject->color(), testColor); textObject->setColor(testColor); QCOMPARE(textObject->color(), testColor); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); testColor = QColor("black"); textObject->setColor(testColor); QCOMPARE(textObject->color(), testColor); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } { QString colorStr = "#001234"; QColor testColor(colorStr); @@ -1350,12 +1350,12 @@ void tst_qquicktext::color() QCOMPARE(textObject->styleColor(), testColor); textObject->setStyleColor(testColor); QCOMPARE(textObject->styleColor(), testColor); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); testColor = QColor("black"); textObject->setStyleColor(testColor); QCOMPARE(textObject->styleColor(), testColor); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } { QString colorStr = "#001234"; QColor testColor(colorStr); @@ -1371,12 +1371,12 @@ void tst_qquicktext::color() QCOMPARE(textObject->linkColor(), testColor); textObject->setLinkColor(testColor); QCOMPARE(textObject->linkColor(), testColor); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); testColor = QColor("black"); textObject->setLinkColor(testColor); QCOMPARE(textObject->linkColor(), testColor); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } } @@ -1440,14 +1440,14 @@ void tst_qquicktext::renderType() text->setRenderType(QQuickText::NativeRendering); QCOMPARE(text->renderType(), QQuickText::NativeRendering); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); text->setRenderType(QQuickText::NativeRendering); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); text->setRenderType(QQuickText::QtRendering); QCOMPARE(text->renderType(), QQuickText::QtRendering); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_qquicktext::antialiasing() @@ -1464,14 +1464,14 @@ void tst_qquicktext::antialiasing() text->setAntialiasing(false); QCOMPARE(text->antialiasing(), false); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); text->setAntialiasing(false); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); text->resetAntialiasing(); QCOMPARE(text->antialiasing(), true); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); // QTBUG-39047 component.setData("import QtQuick 2.0\n Text { antialiasing: true }", QUrl()); @@ -2137,15 +2137,15 @@ void tst_qquicktext::baseUrl() textObject->setBaseUrl(localUrl); QCOMPARE(textObject->baseUrl(), localUrl); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); textObject->setBaseUrl(remoteUrl); QCOMPARE(textObject->baseUrl(), remoteUrl); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); textObject->resetBaseUrl(); QCOMPARE(textObject->baseUrl(), localUrl); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_qquicktext::embeddedImages_data() @@ -2449,23 +2449,23 @@ void tst_qquicktext::contentSize() QVERIFY(textObject->contentWidth() > textObject->width()); QVERIFY(textObject->contentHeight() < textObject->height()); - QCOMPARE(spySize.count(), 1); - QCOMPARE(spyWidth.count(), 1); - QCOMPARE(spyHeight.count(), 0); + QCOMPARE(spySize.size(), 1); + QCOMPARE(spyWidth.size(), 1); + QCOMPARE(spyHeight.size(), 0); textObject->setWrapMode(QQuickText::WordWrap); QVERIFY(textObject->contentWidth() <= textObject->width()); QVERIFY(textObject->contentHeight() > textObject->height()); - QCOMPARE(spySize.count(), 2); - QCOMPARE(spyWidth.count(), 2); - QCOMPARE(spyHeight.count(), 1); + QCOMPARE(spySize.size(), 2); + QCOMPARE(spyWidth.size(), 2); + QCOMPARE(spyHeight.size(), 1); textObject->setElideMode(QQuickText::ElideRight); QVERIFY(textObject->contentWidth() <= textObject->width()); QVERIFY(textObject->contentHeight() < textObject->height()); - QCOMPARE(spySize.count(), 3); - QCOMPARE(spyWidth.count(), 3); - QCOMPARE(spyHeight.count(), 2); + QCOMPARE(spySize.size(), 3); + QCOMPARE(spyWidth.size(), 3); + QCOMPARE(spyHeight.size(), 2); int spyCount = 3; qreal elidedWidth = textObject->contentWidth(); @@ -2474,16 +2474,16 @@ void tst_qquicktext::contentSize() QVERIFY(textObject->contentHeight() < textObject->height()); // this text probably won't have the same elided width, but it's not guaranteed. if (textObject->contentWidth() != elidedWidth) - QCOMPARE(spySize.count(), ++spyCount); + QCOMPARE(spySize.size(), ++spyCount); else - QCOMPARE(spySize.count(), spyCount); + QCOMPARE(spySize.size(), spyCount); textObject->setElideMode(QQuickText::ElideNone); QVERIFY(textObject->contentWidth() > textObject->width()); QVERIFY(textObject->contentHeight() > textObject->height()); - QCOMPARE(spySize.count(), ++spyCount); - QCOMPARE(spyWidth.count(), spyCount); - QCOMPARE(spyHeight.count(), 3); + QCOMPARE(spySize.size(), ++spyCount); + QCOMPARE(spyWidth.size(), spyCount); + QCOMPARE(spyHeight.size(), 3); } void tst_qquicktext::geometryChanged() @@ -3297,7 +3297,7 @@ void tst_qquicktext::imgTagsMultipleImages() QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(textObject); QVERIFY(textPrivate != nullptr); - QCOMPARE(textPrivate->extra->visibleImgTags.count(), 2); + QCOMPARE(textPrivate->extra->visibleImgTags.size(), 2); delete textObject; } @@ -3310,9 +3310,9 @@ void tst_qquicktext::imgTagsElide() QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(myText); QVERIFY(textPrivate != nullptr); - QCOMPARE(textPrivate->extra->visibleImgTags.count(), 0); + QCOMPARE(textPrivate->extra->visibleImgTags.size(), 0); myText->setMaximumLineCount(20); - QTRY_COMPARE(textPrivate->extra->visibleImgTags.count(), 1); + QTRY_COMPARE(textPrivate->extra->visibleImgTags.size(), 1); delete myText; } @@ -3329,16 +3329,16 @@ void tst_qquicktext::imgTagsUpdates() QVERIFY(textPrivate != nullptr); myText->setText("This is a heart<img src=\"images/heart200.png\">."); - QCOMPARE(textPrivate->extra->visibleImgTags.count(), 1); - QCOMPARE(spy.count(), 1); + QCOMPARE(textPrivate->extra->visibleImgTags.size(), 1); + QCOMPARE(spy.size(), 1); myText->setMaximumLineCount(2); myText->setText("This is another heart<img src=\"images/heart200.png\">."); - QTRY_COMPARE(textPrivate->extra->visibleImgTags.count(), 1); + QTRY_COMPARE(textPrivate->extra->visibleImgTags.size(), 1); // if maximumLineCount is set and the img tag doesn't have an explicit size // we relayout twice. - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); delete myText; } @@ -3635,11 +3635,11 @@ void tst_qquicktext::fontSizeMode() const qreal oldBaselineOffset = myText->baselineOffset(); myText->setHeight(myText->height() + 42); QVERIFY(QQuickTest::qWaitForPolish(myText)); - QCOMPARE(baselineOffsetSpy.count(), 1); + QCOMPARE(baselineOffsetSpy.size(), 1); QCOMPARE(myText->baselineOffset(), oldBaselineOffset + 42); myText->setHeight(myText->height() - 42); QVERIFY(QQuickTest::qWaitForPolish(myText)); - QCOMPARE(baselineOffsetSpy.count(), 2); + QCOMPARE(baselineOffsetSpy.size(), 2); QCOMPARE(myText->baselineOffset(), oldBaselineOffset); } diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp index 7445f72783..36543357a2 100644 --- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp +++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp @@ -244,7 +244,7 @@ Q_DECLARE_METATYPE(QQuickTextEdit::TextFormat) void tst_qquicktextedit::simulateKeys(QWindow *window, const QList<Key> &keys) { - for (int i = 0; i < keys.count(); ++i) { + for (int i = 0; i < keys.size(); ++i) { const int key = keys.at(i).first; const int modifiers = key & Qt::KeyboardModifierMask; const QString text = !keys.at(i).second.isNull() ? QString(keys.at(i).second) : QString(); @@ -417,7 +417,7 @@ void tst_qquicktextedit::text() QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->text(), standard.at(i)); - QCOMPARE(textEditObject->length(), standard.at(i).length()); + QCOMPARE(textEditObject->length(), standard.at(i).size()); } for (int i = 0; i < richText.size(); i++) @@ -433,7 +433,7 @@ void tst_qquicktextedit::text() QString expected = richText.at(i); expected.replace(QRegularExpression("\\\\(.)"),"\\1"); QCOMPARE(textEditObject->text(), expected); - QCOMPARE(textEditObject->length(), expected.length()); + QCOMPARE(textEditObject->length(), expected.size()); } for (int i = 0; i < standard.size(); i++) @@ -452,7 +452,7 @@ void tst_qquicktextedit::text() actual.remove(QRegularExpression("(<[^>]*>)+")); expected.remove("\n"); QCOMPARE(actual.simplified(), expected); - QCOMPARE(textEditObject->length(), expected.length()); + QCOMPARE(textEditObject->length(), expected.size()); } for (int i = 0; i < richText.size(); i++) @@ -472,7 +472,7 @@ void tst_qquicktextedit::text() QCOMPARE(actual.simplified(),expected.simplified()); expected.replace("<>", " "); - QCOMPARE(textEditObject->length(), expected.simplified().length()); + QCOMPARE(textEditObject->length(), expected.simplified().size()); } for (int i = 0; i < standard.size(); i++) @@ -484,7 +484,7 @@ void tst_qquicktextedit::text() QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->text(), standard.at(i)); - QCOMPARE(textEditObject->length(), standard.at(i).length()); + QCOMPARE(textEditObject->length(), standard.at(i).size()); } for (int i = 0; i < richText.size(); i++) @@ -504,7 +504,7 @@ void tst_qquicktextedit::text() QCOMPARE(actual.simplified(),expected.simplified()); expected.replace("<>", " "); - QCOMPARE(textEditObject->length(), expected.simplified().length()); + QCOMPARE(textEditObject->length(), expected.simplified().size()); } } @@ -622,14 +622,14 @@ void tst_qquicktextedit::wrap() edit->setWrapMode(QQuickTextEdit::Wrap); QCOMPARE(edit->wrapMode(), QQuickTextEdit::Wrap); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); edit->setWrapMode(QQuickTextEdit::Wrap); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); edit->setWrapMode(QQuickTextEdit::NoWrap); QCOMPARE(edit->wrapMode(), QQuickTextEdit::NoWrap); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } } @@ -678,18 +678,18 @@ void tst_qquicktextedit::textFormat() edit->setTextFormat(QQuickTextEdit::RichText); QCOMPARE(edit->textFormat(), QQuickTextEdit::RichText); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); edit->setTextFormat(QQuickTextEdit::RichText); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); edit->setTextFormat(QQuickTextEdit::PlainText); QCOMPARE(edit->textFormat(), QQuickTextEdit::PlainText); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); edit->setTextFormat(QQuickTextEdit::MarkdownText); QCOMPARE(edit->textFormat(), QQuickTextEdit::MarkdownText); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); } } @@ -891,7 +891,7 @@ void tst_qquicktextedit::hAlign_RightToLeft() QSignalSpy cursorRectangleSpy(textEdit, SIGNAL(cursorRectangleChanged())); platformInputContext.setInputDirection(Qt::RightToLeft); - QCOMPARE(cursorRectangleSpy.count(), 1); + QCOMPARE(cursorRectangleSpy.size(), 1); QCOMPARE(qApp->inputMethod()->inputDirection(), Qt::RightToLeft); QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignRight); QVERIFY(textEdit->positionToRectangle(0).x() > window.width()/2); @@ -1202,36 +1202,36 @@ void tst_qquicktextedit::color() textEditObject->setColor(QColor("white")); QCOMPARE(textEditObject->color(), QColor("white")); - QCOMPARE(colorSpy.count(), 1); + QCOMPARE(colorSpy.size(), 1); textEditObject->setSelectionColor(QColor("black")); QCOMPARE(textEditObject->selectionColor(), QColor("black")); - QCOMPARE(selectionColorSpy.count(), 1); + QCOMPARE(selectionColorSpy.size(), 1); textEditObject->setSelectedTextColor(QColor("blue")); QCOMPARE(textEditObject->selectedTextColor(), QColor("blue")); - QCOMPARE(selectedTextColorSpy.count(), 1); + QCOMPARE(selectedTextColorSpy.size(), 1); textEditObject->setColor(QColor("white")); - QCOMPARE(colorSpy.count(), 1); + QCOMPARE(colorSpy.size(), 1); textEditObject->setSelectionColor(QColor("black")); - QCOMPARE(selectionColorSpy.count(), 1); + QCOMPARE(selectionColorSpy.size(), 1); textEditObject->setSelectedTextColor(QColor("blue")); - QCOMPARE(selectedTextColorSpy.count(), 1); + QCOMPARE(selectedTextColorSpy.size(), 1); textEditObject->setColor(QColor("black")); QCOMPARE(textEditObject->color(), QColor("black")); - QCOMPARE(colorSpy.count(), 2); + QCOMPARE(colorSpy.size(), 2); textEditObject->setSelectionColor(QColor("blue")); QCOMPARE(textEditObject->selectionColor(), QColor("blue")); - QCOMPARE(selectionColorSpy.count(), 2); + QCOMPARE(selectionColorSpy.size(), 2); textEditObject->setSelectedTextColor(QColor("white")); QCOMPARE(textEditObject->selectedTextColor(), QColor("white")); - QCOMPARE(selectedTextColorSpy.count(), 2); + QCOMPARE(selectedTextColorSpy.size(), 2); } //test normal @@ -1312,7 +1312,7 @@ void tst_qquicktextedit::persistentSelection() edit->setPersistentSelection(false); QCOMPARE(edit->persistentSelection(), false); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); edit->select(1, 4); QCOMPARE(edit->property("selected").toString(), QLatin1String("ell")); @@ -1325,7 +1325,7 @@ void tst_qquicktextedit::persistentSelection() edit->setPersistentSelection(true); QCOMPARE(edit->persistentSelection(), true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); edit->select(1, 4); QCOMPARE(edit->property("selected").toString(), QLatin1String("ell")); @@ -1341,7 +1341,7 @@ void tst_qquicktextedit::persistentSelection() edit->setPersistentSelection(false); QCOMPARE(edit->persistentSelection(), false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); edit->select(1, 4); QCOMPARE(edit->property("selected").toString(), QLatin1String("ell")); @@ -1354,7 +1354,7 @@ void tst_qquicktextedit::persistentSelection() edit->setPersistentSelection(true); QCOMPARE(edit->persistentSelection(), true); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); edit->select(1, 4); QCOMPARE(edit->property("selected").toString(), QLatin1String("ell")); @@ -1432,7 +1432,7 @@ void tst_qquicktextedit::focusOnPress() textEditObject->setFocusOnPress(true); QCOMPARE(textEditObject->focusOnPress(), true); - QCOMPARE(activeFocusOnPressSpy.count(), 0); + QCOMPARE(activeFocusOnPressSpy.size(), 0); QQuickWindow window; window.resize(100, 50); @@ -1450,20 +1450,20 @@ void tst_qquicktextedit::focusOnPress() QGuiApplication::processEvents(); QCOMPARE(textEditObject->hasFocus(), true); QCOMPARE(textEditObject->hasActiveFocus(), true); - QCOMPARE(focusSpy.count(), 1); - QCOMPARE(activeFocusSpy.count(), 1); + QCOMPARE(focusSpy.size(), 1); + QCOMPARE(activeFocusSpy.size(), 1); QCOMPARE(textEditObject->selectedText(), QString()); QTest::mouseRelease(&window, Qt::LeftButton, noModifiers, centerPoint); textEditObject->setFocusOnPress(false); QCOMPARE(textEditObject->focusOnPress(), false); - QCOMPARE(activeFocusOnPressSpy.count(), 1); + QCOMPARE(activeFocusOnPressSpy.size(), 1); textEditObject->setFocus(false); QCOMPARE(textEditObject->hasFocus(), false); QCOMPARE(textEditObject->hasActiveFocus(), false); - QCOMPARE(focusSpy.count(), 2); - QCOMPARE(activeFocusSpy.count(), 2); + QCOMPARE(focusSpy.size(), 2); + QCOMPARE(activeFocusSpy.size(), 2); // Wait for double click timeout to expire before clicking again. QTest::qWait(400); @@ -1471,13 +1471,13 @@ void tst_qquicktextedit::focusOnPress() QGuiApplication::processEvents(); QCOMPARE(textEditObject->hasFocus(), false); QCOMPARE(textEditObject->hasActiveFocus(), false); - QCOMPARE(focusSpy.count(), 2); - QCOMPARE(activeFocusSpy.count(), 2); + QCOMPARE(focusSpy.size(), 2); + QCOMPARE(activeFocusSpy.size(), 2); QTest::mouseRelease(&window, Qt::LeftButton, noModifiers, centerPoint); textEditObject->setFocusOnPress(true); QCOMPARE(textEditObject->focusOnPress(), true); - QCOMPARE(activeFocusOnPressSpy.count(), 2); + QCOMPARE(activeFocusOnPressSpy.size(), 2); // Test a selection made in the on(Active)FocusChanged handler isn't overwritten. textEditObject->setProperty("selectOnFocus", true); @@ -1487,8 +1487,8 @@ void tst_qquicktextedit::focusOnPress() QGuiApplication::processEvents(); QCOMPARE(textEditObject->hasFocus(), true); QCOMPARE(textEditObject->hasActiveFocus(), true); - QCOMPARE(focusSpy.count(), 3); - QCOMPARE(activeFocusSpy.count(), 3); + QCOMPARE(focusSpy.size(), 3); + QCOMPARE(activeFocusSpy.size(), 3); QCOMPARE(textEditObject->selectedText(), textEditObject->text()); QTest::mouseRelease(&window, Qt::LeftButton, noModifiers, centerPoint); } @@ -1525,7 +1525,7 @@ void tst_qquicktextedit::selection() QCOMPARE(textEditObject->selectionEnd(), 0); QVERIFY(textEditObject->selectedText().isNull()); - textEditObject->setCursorPosition(textEditObject->text().length()+1); + textEditObject->setCursorPosition(textEditObject->text().size()+1); QCOMPARE(textEditObject->cursorPosition(), 0); QCOMPARE(textEditObject->selectionStart(), 0); QCOMPARE(textEditObject->selectionEnd(), 0); @@ -1596,37 +1596,37 @@ void tst_qquicktextedit::overwriteMode() QVERIFY(textEdit->hasActiveFocus()); textEdit->setOverwriteMode(true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(true, textEdit->overwriteMode()); textEdit->setOverwriteMode(false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QCOMPARE(false, textEdit->overwriteMode()); QVERIFY(!textEdit->overwriteMode()); QString insertString = "Some first text"; - for (int j = 0; j < insertString.length(); j++) + for (int j = 0; j < insertString.size(); j++) QTest::keyClick(&window, insertString.at(j).toLatin1()); QCOMPARE(textEdit->text(), QString("Some first text")); textEdit->setOverwriteMode(true); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); textEdit->setCursorPosition(5); insertString = "shiny"; - for (int j = 0; j < insertString.length(); j++) + for (int j = 0; j < insertString.size(); j++) QTest::keyClick(&window, insertString.at(j).toLatin1()); QCOMPARE(textEdit->text(), QString("Some shiny text")); - textEdit->setCursorPosition(textEdit->text().length()); + textEdit->setCursorPosition(textEdit->text().size()); QTest::keyClick(&window, Qt::Key_Enter); textEdit->setOverwriteMode(false); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); insertString = "Second paragraph"; - for (int j = 0; j < insertString.length(); j++) + for (int j = 0; j < insertString.size(); j++) QTest::keyClick(&window, insertString.at(j).toLatin1()); QCOMPARE(textEdit->lineCount(), 2); @@ -1635,10 +1635,10 @@ void tst_qquicktextedit::overwriteMode() QCOMPARE(textEdit->cursorPosition(), 15); textEdit->setOverwriteMode(true); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); insertString = " blah"; - for (int j = 0; j < insertString.length(); j++) + for (int j = 0; j < insertString.size(); j++) QTest::keyClick(&window, insertString.at(j).toLatin1()); QCOMPARE(textEdit->lineCount(), 2); @@ -1682,24 +1682,24 @@ void tst_qquicktextedit::isRightToLeft() // first test that the right string is delivered to the QString::isRightToLeft() QCOMPARE(textEdit.isRightToLeft(0,0), text.mid(0,0).isRightToLeft()); QCOMPARE(textEdit.isRightToLeft(0,1), text.mid(0,1).isRightToLeft()); - QCOMPARE(textEdit.isRightToLeft(text.length()-2, text.length()-1), text.mid(text.length()-2, text.length()-1).isRightToLeft()); - QCOMPARE(textEdit.isRightToLeft(text.length()/2, text.length()/2 + 1), text.mid(text.length()/2, text.length()/2 + 1).isRightToLeft()); - QCOMPARE(textEdit.isRightToLeft(0,text.length()/4), text.mid(0,text.length()/4).isRightToLeft()); - QCOMPARE(textEdit.isRightToLeft(text.length()/4,3*text.length()/4), text.mid(text.length()/4,3*text.length()/4).isRightToLeft()); + QCOMPARE(textEdit.isRightToLeft(text.size()-2, text.size()-1), text.mid(text.size()-2, text.size()-1).isRightToLeft()); + QCOMPARE(textEdit.isRightToLeft(text.size()/2, text.size()/2 + 1), text.mid(text.size()/2, text.size()/2 + 1).isRightToLeft()); + QCOMPARE(textEdit.isRightToLeft(0,text.size()/4), text.mid(0,text.size()/4).isRightToLeft()); + QCOMPARE(textEdit.isRightToLeft(text.size()/4,3*text.size()/4), text.mid(text.size()/4,3*text.size()/4).isRightToLeft()); if (text.isEmpty()) QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML TextEdit: isRightToLeft(start, end) called with the end property being smaller than the start."); - QCOMPARE(textEdit.isRightToLeft(3*text.length()/4,text.length()-1), text.mid(3*text.length()/4,text.length()-1).isRightToLeft()); + QCOMPARE(textEdit.isRightToLeft(3*text.size()/4,text.size()-1), text.mid(3*text.size()/4,text.size()-1).isRightToLeft()); // then test that the feature actually works QCOMPARE(textEdit.isRightToLeft(0,0), emptyString); QCOMPARE(textEdit.isRightToLeft(0,1), firstCharacter); - QCOMPARE(textEdit.isRightToLeft(text.length()-2, text.length()-1), lastCharacter); - QCOMPARE(textEdit.isRightToLeft(text.length()/2, text.length()/2 + 1), middleCharacter); - QCOMPARE(textEdit.isRightToLeft(0,text.length()/4), startString); - QCOMPARE(textEdit.isRightToLeft(text.length()/4,3*text.length()/4), midString); + QCOMPARE(textEdit.isRightToLeft(text.size()-2, text.size()-1), lastCharacter); + QCOMPARE(textEdit.isRightToLeft(text.size()/2, text.size()/2 + 1), middleCharacter); + QCOMPARE(textEdit.isRightToLeft(0,text.size()/4), startString); + QCOMPARE(textEdit.isRightToLeft(text.size()/4,3*text.size()/4), midString); if (text.isEmpty()) QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML TextEdit: isRightToLeft(start, end) called with the end property being smaller than the start."); - QCOMPARE(textEdit.isRightToLeft(3*text.length()/4,text.length()-1), endString); + QCOMPARE(textEdit.isRightToLeft(3*text.size()/4,text.size()-1), endString); } void tst_qquicktextedit::keySelection() @@ -1721,31 +1721,31 @@ void tst_qquicktextedit::keySelection() simulateKey(&window, Qt::Key_Right, Qt::ShiftModifier); QVERIFY(input->hasActiveFocus()); QCOMPARE(input->selectedText(), QString("a")); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); simulateKey(&window, Qt::Key_Right); QVERIFY(input->hasActiveFocus()); QCOMPARE(input->selectedText(), QString()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); simulateKey(&window, Qt::Key_Right); QVERIFY(!input->hasActiveFocus()); QCOMPARE(input->selectedText(), QString()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); simulateKey(&window, Qt::Key_Left); QVERIFY(input->hasActiveFocus()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); simulateKey(&window, Qt::Key_Left, Qt::ShiftModifier); QVERIFY(input->hasActiveFocus()); QCOMPARE(input->selectedText(), QString("a")); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); simulateKey(&window, Qt::Key_Left); QVERIFY(input->hasActiveFocus()); QCOMPARE(input->selectedText(), QString()); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); simulateKey(&window, Qt::Key_Left); QVERIFY(!input->hasActiveFocus()); QCOMPARE(input->selectedText(), QString()); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); } void tst_qquicktextedit::moveCursorSelection_data() @@ -2227,7 +2227,7 @@ void tst_qquicktextedit::dragMouseSelection() QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x2,y)); QTest::qWait(300); QString str1; - QTRY_VERIFY((str1 = textEditObject->selectedText()).length() > 3); + QTRY_VERIFY((str1 = textEditObject->selectedText()).size() > 3); // press and drag the current selection. x1 = 40; @@ -2237,7 +2237,7 @@ void tst_qquicktextedit::dragMouseSelection() QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x2,y)); QTest::qWait(300); QString str2; - QTRY_VERIFY((str2 = textEditObject->selectedText()).length() > 3); + QTRY_VERIFY((str2 = textEditObject->selectedText()).size() > 3); QVERIFY(str1 != str2); // Verify the second press and drag is a new selection and not the first moved. @@ -2283,7 +2283,7 @@ void tst_qquicktextedit::mouseSelectionMode() if (selectWords) { QTRY_COMPARE(textEditObject->selectedText(), text); } else { - QTRY_VERIFY(textEditObject->selectedText().length() > 3); + QTRY_VERIFY(textEditObject->selectedText().size() > 3); QVERIFY(str != text); } } @@ -2302,14 +2302,14 @@ void tst_qquicktextedit::mouseSelectionMode_accessors() edit->setMouseSelectionMode(QQuickTextEdit::SelectWords); QCOMPARE(edit->mouseSelectionMode(), QQuickTextEdit::SelectWords); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); edit->setMouseSelectionMode(QQuickTextEdit::SelectWords); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); edit->setMouseSelectionMode(QQuickTextEdit::SelectCharacters); QCOMPARE(edit->mouseSelectionMode(), QQuickTextEdit::SelectCharacters); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_qquicktextedit::selectByMouse() @@ -2326,15 +2326,15 @@ void tst_qquicktextedit::selectByMouse() edit->setSelectByMouse(true); QCOMPARE(edit->selectByMouse(), true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).toBool(), true); edit->setSelectByMouse(true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); edit->setSelectByMouse(false); QCOMPARE(edit->selectByMouse(), false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QCOMPARE(spy.at(1).at(0).toBool(), false); } @@ -2357,21 +2357,21 @@ void tst_qquicktextedit::selectByKeyboard() edit->setReadOnly(true); QCOMPARE(edit->selectByKeyboard(), false); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).toBool(), false); edit->setSelectByKeyboard(true); QCOMPARE(edit->selectByKeyboard(), true); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QCOMPARE(spy.at(1).at(0).toBool(), true); edit->setReadOnly(false); QCOMPARE(edit->selectByKeyboard(), true); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); edit->setSelectByKeyboard(false); QCOMPARE(edit->selectByKeyboard(), false); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); QCOMPARE(spy.at(2).at(0).toBool(), false); } @@ -2477,14 +2477,14 @@ void tst_qquicktextedit::renderType() edit->setRenderType(QQuickTextEdit::NativeRendering); QCOMPARE(edit->renderType(), QQuickTextEdit::NativeRendering); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); edit->setRenderType(QQuickTextEdit::NativeRendering); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); edit->setRenderType(QQuickTextEdit::QtRendering); QCOMPARE(edit->renderType(), QQuickTextEdit::QtRendering); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_qquicktextedit::inputMethodHints() @@ -2500,9 +2500,9 @@ void tst_qquicktextedit::inputMethodHints() QSignalSpy inputMethodHintSpy(textEditObject, SIGNAL(inputMethodHintsChanged())); textEditObject->setInputMethodHints(Qt::ImhUppercaseOnly); QVERIFY(textEditObject->inputMethodHints() & Qt::ImhUppercaseOnly); - QCOMPARE(inputMethodHintSpy.count(), 1); + QCOMPARE(inputMethodHintSpy.size(), 1); textEditObject->setInputMethodHints(Qt::ImhUppercaseOnly); - QCOMPARE(inputMethodHintSpy.count(), 1); + QCOMPARE(inputMethodHintSpy.size(), 1); QQuickTextEdit plainTextEdit; QCOMPARE(plainTextEdit.inputMethodHints(), Qt::ImhNone); @@ -2640,22 +2640,22 @@ void tst_qquicktextedit::linkHover() const QPoint textPos = window.mapToGlobal(texteditObject->positionToRectangle(2).center().toPoint()); QCursor::setPos(linkPos); - QTRY_COMPARE(hover.count(), 1); + QTRY_COMPARE(hover.size(), 1); QCOMPARE(window.cursor().shape(), Qt::PointingHandCursor); QCOMPARE(hover.last()[0].toString(), link); QCursor::setPos(textPos); - QTRY_COMPARE(hover.count(), 2); + QTRY_COMPARE(hover.size(), 2); QCOMPARE(window.cursor().shape(), Qt::IBeamCursor); QCOMPARE(hover.last()[0].toString(), QString()); QCursor::setPos(linkPos); - QTRY_COMPARE(hover.count(), 3); + QTRY_COMPARE(hover.size(), 3); QCOMPARE(window.cursor().shape(), Qt::PointingHandCursor); QCOMPARE(hover.last()[0].toString(), link); QCursor::setPos(textPos); - QTRY_COMPARE(hover.count(), 4); + QTRY_COMPARE(hover.size(), 4); QCOMPARE(window.cursor().shape(), Qt::IBeamCursor); QCOMPARE(hover.last()[0].toString(), QString()); } @@ -2683,16 +2683,16 @@ void tst_qquicktextedit::linkInteraction() const QPointF textPos = texteditObject->positionToRectangle(2).center(); QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, linkPos.toPoint()); - QTRY_COMPARE(spy.count(), 1); - QTRY_COMPARE(hover.count(), 1); + QTRY_COMPARE(spy.size(), 1); + QTRY_COMPARE(hover.size(), 1); QCOMPARE(spy.last()[0].toString(), link); QCOMPARE(hover.last()[0].toString(), link); QCOMPARE(texteditObject->hoveredLink(), link); QCOMPARE(texteditObject->linkAt(linkPos.x(), linkPos.y()), link); QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, textPos.toPoint()); - QTRY_COMPARE(spy.count(), 1); - QTRY_COMPARE(hover.count(), 2); + QTRY_COMPARE(spy.size(), 1); + QTRY_COMPARE(hover.size(), 2); QCOMPARE(hover.last()[0].toString(), QString()); QCOMPARE(texteditObject->hoveredLink(), QString()); QCOMPARE(texteditObject->linkAt(textPos.x(), textPos.y()), QString()); @@ -2700,16 +2700,16 @@ void tst_qquicktextedit::linkInteraction() texteditObject->setReadOnly(true); QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, linkPos.toPoint()); - QTRY_COMPARE(spy.count(), 2); - QTRY_COMPARE(hover.count(), 3); + QTRY_COMPARE(spy.size(), 2); + QTRY_COMPARE(hover.size(), 3); QCOMPARE(spy.last()[0].toString(), link); QCOMPARE(hover.last()[0].toString(), link); QCOMPARE(texteditObject->hoveredLink(), link); QCOMPARE(texteditObject->linkAt(linkPos.x(), linkPos.y()), link); QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, textPos.toPoint()); - QTRY_COMPARE(spy.count(), 2); - QTRY_COMPARE(hover.count(), 4); + QTRY_COMPARE(spy.size(), 2); + QTRY_COMPARE(hover.size(), 4); QCOMPARE(hover.last()[0].toString(), QString()); QCOMPARE(texteditObject->hoveredLink(), QString()); QCOMPARE(texteditObject->linkAt(textPos.x(), textPos.y()), QString()); @@ -2742,7 +2742,7 @@ void tst_qquicktextedit::cursorDelegate() QVERIFY(delegateObject); QCOMPARE(delegateObject->property("localProperty").toString(), QString("Hello")); //Test Delegate gets moved - for (int i=0; i<= textEditObject->text().length(); i++) { + for (int i=0; i<= textEditObject->text().size(); i++) { textEditObject->setCursorPosition(i); QCOMPARE(textEditObject->cursorRectangle().x(), delegateObject->x()); QCOMPARE(textEditObject->cursorRectangle().y(), delegateObject->y()); @@ -2878,27 +2878,27 @@ void tst_qquicktextedit::cursorVisible() edit.setCursorVisible(true); QCOMPARE(edit.isCursorVisible(), true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); edit.setCursorVisible(false); QCOMPARE(edit.isCursorVisible(), false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); edit.setFocus(true); QCOMPARE(edit.isCursorVisible(), false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); edit.setParentItem(view.rootObject()); QCOMPARE(edit.isCursorVisible(), true); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); edit.setFocus(false); QCOMPARE(edit.isCursorVisible(), false); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); edit.setFocus(true); QCOMPARE(edit.isCursorVisible(), true); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); QWindow alternateView; alternateView.show(); @@ -2906,12 +2906,12 @@ void tst_qquicktextedit::cursorVisible() QVERIFY(QTest::qWaitForWindowActive(&alternateView)); QCOMPARE(edit.isCursorVisible(), false); - QCOMPARE(spy.count(), 6); + QCOMPARE(spy.size(), 6); view.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&view)); QCOMPARE(edit.isCursorVisible(), true); - QCOMPARE(spy.count(), 7); + QCOMPARE(spy.size(), 7); { // Cursor attribute with 0 length hides cursor. QInputMethodEvent ev(QString(), QList<QInputMethodEvent::Attribute>() @@ -2919,7 +2919,7 @@ void tst_qquicktextedit::cursorVisible() QCoreApplication::sendEvent(&edit, &ev); } QCOMPARE(edit.isCursorVisible(), false); - QCOMPARE(spy.count(), 8); + QCOMPARE(spy.size(), 8); { // Cursor attribute with non zero length shows cursor. QInputMethodEvent ev(QString(), QList<QInputMethodEvent::Attribute>() @@ -2927,7 +2927,7 @@ void tst_qquicktextedit::cursorVisible() QCoreApplication::sendEvent(&edit, &ev); } QCOMPARE(edit.isCursorVisible(), true); - QCOMPARE(spy.count(), 9); + QCOMPARE(spy.size(), 9); { // If the cursor is hidden by the input method and the text is changed it should be visible again. @@ -2936,11 +2936,11 @@ void tst_qquicktextedit::cursorVisible() QCoreApplication::sendEvent(&edit, &ev); } QCOMPARE(edit.isCursorVisible(), false); - QCOMPARE(spy.count(), 10); + QCOMPARE(spy.size(), 10); edit.setText("something"); QCOMPARE(edit.isCursorVisible(), true); - QCOMPARE(spy.count(), 11); + QCOMPARE(spy.size(), 11); { // If the cursor is hidden by the input method and the cursor position is changed it should be visible again. QInputMethodEvent ev(QString(), QList<QInputMethodEvent::Attribute>() @@ -2948,11 +2948,11 @@ void tst_qquicktextedit::cursorVisible() QCoreApplication::sendEvent(&edit, &ev); } QCOMPARE(edit.isCursorVisible(), false); - QCOMPARE(spy.count(), 12); + QCOMPARE(spy.size(), 12); edit.setCursorPosition(5); QCOMPARE(edit.isCursorVisible(), true); - QCOMPARE(spy.count(), 13); + QCOMPARE(spy.size(), 13); } void tst_qquicktextedit::delegateLoading_data() @@ -3099,16 +3099,16 @@ void tst_qquicktextedit::copyAndPaste() QVERIFY(textEdit != nullptr); // copy and paste - QCOMPARE(textEdit->text().length(), 12); - textEdit->select(0, textEdit->text().length());; + QCOMPARE(textEdit->text().size(), 12); + textEdit->select(0, textEdit->text().size());; textEdit->copy(); QCOMPARE(textEdit->selectedText(), QString("Hello world!")); - QCOMPARE(textEdit->selectedText().length(), 12); + QCOMPARE(textEdit->selectedText().size(), 12); textEdit->setCursorPosition(0); QVERIFY(textEdit->canPaste()); textEdit->paste(); QCOMPARE(textEdit->text(), QString("Hello world!Hello world!")); - QCOMPARE(textEdit->text().length(), 24); + QCOMPARE(textEdit->text().size(), 24); // canPaste QVERIFY(textEdit->canPaste()); @@ -3116,7 +3116,7 @@ void tst_qquicktextedit::copyAndPaste() QVERIFY(!textEdit->canPaste()); textEdit->paste(); QCOMPARE(textEdit->text(), QString("Hello world!Hello world!")); - QCOMPARE(textEdit->text().length(), 24); + QCOMPARE(textEdit->text().size(), 24); textEdit->setReadOnly(false); QVERIFY(textEdit->canPaste()); @@ -3144,10 +3144,10 @@ void tst_qquicktextedit::copyAndPaste() // select all and cut textEdit->selectAll(); textEdit->cut(); - QCOMPARE(textEdit->text().length(), 0); + QCOMPARE(textEdit->text().size(), 0); textEdit->paste(); QCOMPARE(textEdit->text(), QString("Hello world!Hello world!")); - QCOMPARE(textEdit->text().length(), 24); + QCOMPARE(textEdit->text().size(), 24); // Copy first word. textEdit->setCursorPosition(0); @@ -3233,7 +3233,7 @@ void tst_qquicktextedit::middleClickPaste() QTest::mouseClick(&window, Qt::MiddleButton, Qt::NoModifier, p3); if (QGuiApplication::clipboard()->supportsSelection()) - QCOMPARE(textEditObject->text().mid(1, selectedText.length()), selectedText); + QCOMPARE(textEditObject->text().mid(1, selectedText.size()), selectedText); else QCOMPARE(textEditObject->text(), originalText); } @@ -3263,7 +3263,7 @@ void tst_qquicktextedit::readOnly() edit->setCursorPosition(3); edit->setReadOnly(false); QCOMPARE(edit->isReadOnly(), false); - QCOMPARE(edit->cursorPosition(), edit->text().length()); + QCOMPARE(edit->cursorPosition(), edit->text().size()); } void tst_qquicktextedit::inFlickableMouse_data() @@ -3410,7 +3410,7 @@ void tst_qquicktextedit::textInput() event.setCommitString( "Hello world!", 0, 0); QGuiApplication::sendEvent(edit, &event); QCOMPARE(edit->text(), QString("Hello world!")); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // QTBUG-12339 // test that document and internal text attribute are in sync @@ -3580,7 +3580,7 @@ void tst_qquicktextedit::openInputPanel() anotherEdit.setFocus(true); QCOMPARE(qApp->inputMethod()->isVisible(), true); QCOMPARE(qApp->focusObject(), qobject_cast<QObject*>(&anotherEdit)); - QCOMPARE(inputPanelVisibilitySpy.count(), 0); + QCOMPARE(inputPanelVisibilitySpy.size(), 0); anotherEdit.setFocus(false); QVERIFY(qApp->focusObject() != &anotherEdit); @@ -3696,18 +3696,18 @@ void tst_qquicktextedit::contentSize() QVERIFY(textObject->contentWidth() > textObject->width()); QVERIFY(textObject->contentHeight() < textObject->height()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); textObject->setWrapMode(QQuickTextEdit::WordWrap); QVERIFY(textObject->contentWidth() <= textObject->width()); QVERIFY(textObject->contentHeight() > textObject->height()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); textObject->setText("The quickredfoxjumpedoverthe lazy brown dog"); QVERIFY(textObject->contentWidth() > textObject->width()); QVERIFY(textObject->contentHeight() > textObject->height()); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); } void tst_qquicktextedit::implicitSizeBinding_data() @@ -3882,7 +3882,7 @@ void tst_qquicktextedit::renderingAroundSelection() QVERIFY(QQuickTest::showView(window, testFileUrl("threeLines.qml"))); NodeCheckerTextEdit *textItem = qmlobject_cast<NodeCheckerTextEdit*>(window.rootObject()); QVERIFY(textItem); - QTRY_VERIFY(textItem->linePositions.count() > 0); + QTRY_VERIFY(textItem->linePositions.size() > 0); const auto linePositions = textItem->linePositions; const int lastLinePosition = textItem->lastLinePosition; QQuickTextEditPrivate *textPriv = QQuickTextEditPrivate::get(textItem); @@ -3891,7 +3891,7 @@ void tst_qquicktextedit::renderingAroundSelection() if (lcTests().isDebugEnabled()) QTest::qWait(500); // for visual check; not needed in CI - const int renderCount = renderSpy.count(); + const int renderCount = renderSpy.size(); QPoint p1 = textItem->mapToScene(textItem->positionToRectangle(8).center()).toPoint(); QPoint p2 = textItem->mapToScene(textItem->positionToRectangle(10).center()).toPoint(); qCDebug(lcTests) << "drag from" << p1 << "to" << p2; @@ -3899,7 +3899,7 @@ void tst_qquicktextedit::renderingAroundSelection() QTest::mouseMove(&window, p2); QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p2); // ensure that QQuickTextEdit::updatePaintNode() has a chance to run - QTRY_COMPARE_GT(renderSpy.count(), renderCount); + QTRY_COMPARE_GT(renderSpy.size(), renderCount); if (lcTests().isDebugEnabled()) QTest::qWait(500); // for visual check; not needed in CI @@ -3938,7 +3938,7 @@ void tst_qquicktextedit::signal_editingfinished() QKeyEvent key(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1); QGuiApplication::sendEvent(window, &key); QVERIFY(key.isAccepted()); - QTRY_COMPARE(editingFinished1Spy.count(), 1); + QTRY_COMPARE(editingFinished1Spy.size(), 1); QTRY_VERIFY(!input1->hasActiveFocus()); QTRY_VERIFY(input2->hasActiveFocus()); @@ -3954,7 +3954,7 @@ void tst_qquicktextedit::signal_editingfinished() QKeyEvent key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1); QGuiApplication::sendEvent(window, &key); QVERIFY(key.isAccepted()); - QTRY_COMPARE(editingFinished2Spy.count(), 1); + QTRY_COMPARE(editingFinished2Spy.size(), 1); QTRY_VERIFY(input1->hasActiveFocus()); QTRY_VERIFY(!input2->hasActiveFocus()); @@ -4158,7 +4158,7 @@ void tst_qquicktextedit::preeditCursorRectangle() // Verify that the micro focus rect is positioned the same for position 0 as // it would be if there was no preedit text. QInputMethodEvent imEvent(preeditText, QList<QInputMethodEvent::Attribute>() - << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, 0, preeditText.length(), QVariant())); + << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, 0, preeditText.size(), QVariant())); QCoreApplication::sendEvent(edit, &imEvent); QCoreApplication::sendEvent(edit, &query); currentRect = query.value(Qt::ImCursorRectangle).toRectF(); @@ -4172,15 +4172,15 @@ void tst_qquicktextedit::preeditCursorRectangle() panelSpy.clear(); for (int i = 1; i <= 5; ++i) { QInputMethodEvent imEvent(preeditText, QList<QInputMethodEvent::Attribute>() - << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, i, preeditText.length(), QVariant())); + << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, i, preeditText.size(), QVariant())); QCoreApplication::sendEvent(edit, &imEvent); QCoreApplication::sendEvent(edit, &query); currentRect = query.value(Qt::ImCursorRectangle).toRectF(); QCOMPARE(edit->cursorRectangle(), currentRect); QCOMPARE(cursor->position(), currentRect.topLeft()); QVERIFY(previousRect.left() < currentRect.left()); - QCOMPARE(editSpy.count(), 1); editSpy.clear(); - QCOMPARE(panelSpy.count(), 1); panelSpy.clear(); + QCOMPARE(editSpy.size(), 1); editSpy.clear(); + QCOMPARE(panelSpy.size(), 1); panelSpy.clear(); previousRect = currentRect; } @@ -4195,8 +4195,8 @@ void tst_qquicktextedit::preeditCursorRectangle() currentRect = query.value(Qt::ImCursorRectangle).toRectF(); QCOMPARE(edit->cursorRectangle(), currentRect); QCOMPARE(cursor->position(), currentRect.topLeft()); - QCOMPARE(editSpy.count(), 1); - QCOMPARE(panelSpy.count(), 1); + QCOMPARE(editSpy.size(), 1); + QCOMPARE(panelSpy.size(), 1); // Verify that if there is no preedit cursor then the micro focus rect is the // same as it would be if it were positioned at the end of the preedit text. @@ -4209,8 +4209,8 @@ void tst_qquicktextedit::preeditCursorRectangle() QCOMPARE(edit->cursorRectangle(), currentRect); QCOMPARE(cursor->position(), currentRect.topLeft()); QCOMPARE(currentRect, previousRect); - QCOMPARE(editSpy.count(), 1); - QCOMPARE(panelSpy.count(), 1); + QCOMPARE(editSpy.size(), 1); + QCOMPARE(panelSpy.size(), 1); } void tst_qquicktextedit::inputMethodComposing() @@ -4237,37 +4237,37 @@ void tst_qquicktextedit::inputMethodComposing() } QCOMPARE(edit->isInputMethodComposing(), true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); { QInputMethodEvent event(text.mid(12), QList<QInputMethodEvent::Attribute>()); QGuiApplication::sendEvent(edit, &event); } - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); { QInputMethodEvent event; QGuiApplication::sendEvent(edit, &event); } QCOMPARE(edit->isInputMethodComposing(), false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); // Changing the text while not composing doesn't alter the composing state. edit->setText(text.mid(0, 16)); QCOMPARE(edit->isInputMethodComposing(), false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); { QInputMethodEvent event(text.mid(16), QList<QInputMethodEvent::Attribute>()); QGuiApplication::sendEvent(edit, &event); } QCOMPARE(edit->isInputMethodComposing(), true); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); // Changing the text while composing cancels composition. edit->setText(text.mid(0, 12)); QCOMPARE(edit->isInputMethodComposing(), false); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); { // Preedit cursor positioned outside (empty) preedit; composing. QInputMethodEvent event(QString(), QList<QInputMethodEvent::Attribute>() @@ -4275,7 +4275,7 @@ void tst_qquicktextedit::inputMethodComposing() QGuiApplication::sendEvent(edit, &event); } QCOMPARE(edit->isInputMethodComposing(), true); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); { // Cursor hidden; composing QInputMethodEvent event(QString(), QList<QInputMethodEvent::Attribute>() @@ -4283,7 +4283,7 @@ void tst_qquicktextedit::inputMethodComposing() QGuiApplication::sendEvent(edit, &event); } QCOMPARE(edit->isInputMethodComposing(), true); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); { // Default cursor attributes; composing. QInputMethodEvent event(QString(), QList<QInputMethodEvent::Attribute>() @@ -4291,7 +4291,7 @@ void tst_qquicktextedit::inputMethodComposing() QGuiApplication::sendEvent(edit, &event); } QCOMPARE(edit->isInputMethodComposing(), true); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); { // Selections are persisted: not composing QInputMethodEvent event(QString(), QList<QInputMethodEvent::Attribute>() @@ -4299,7 +4299,7 @@ void tst_qquicktextedit::inputMethodComposing() QGuiApplication::sendEvent(edit, &event); } QCOMPARE(edit->isInputMethodComposing(), false); - QCOMPARE(spy.count(), 6); + QCOMPARE(spy.size(), 6); edit->setCursorPosition(0); @@ -4311,14 +4311,14 @@ void tst_qquicktextedit::inputMethodComposing() QGuiApplication::sendEvent(edit, &event); } QCOMPARE(edit->isInputMethodComposing(), true); - QCOMPARE(spy.count(), 7); + QCOMPARE(spy.size(), 7); { QInputMethodEvent event; QGuiApplication::sendEvent(edit, &event); } QCOMPARE(edit->isInputMethodComposing(), false); - QCOMPARE(spy.count(), 8); + QCOMPARE(spy.size(), 8); } void tst_qquicktextedit::cursorRectangleSize_data() @@ -4394,7 +4394,7 @@ void tst_qquicktextedit::getText_data() QTest::newRow("all plain text") << standard.at(0) - << 0 << standard.at(0).length() + << 0 << standard.at(0).size() << standard.at(0); QTest::newRow("plain text sub string") @@ -4414,17 +4414,17 @@ void tst_qquicktextedit::getText_data() QTest::newRow("plain text cropped end") << standard.at(0) - << 23 << standard.at(0).length() + 8 + << 23 << standard.at(0).size() + 8 << standard.at(0).mid(23); QTest::newRow("plain text cropped beginning and end") << standard.at(0) - << -9 << standard.at(0).length() + 4 + << -9 << standard.at(0).size() + 4 << standard.at(0); QTest::newRow("all rich text") << richBoldText - << 0 << plainBoldText.length() + << 0 << plainBoldText.size() << plainBoldText; QTest::newRow("rich text sub string") @@ -4435,7 +4435,7 @@ void tst_qquicktextedit::getText_data() // Line break. QTest::newRow("all plain text (line break)") << standard.at(1) - << 0 << standard.at(1).length() + << 0 << standard.at(1).size() << standard.at(1); QTest::newRow("plain text sub string (line break)") @@ -4455,17 +4455,17 @@ void tst_qquicktextedit::getText_data() QTest::newRow("plain text cropped end (line break)") << standard.at(1) - << 23 << standard.at(1).length() + 8 + << 23 << standard.at(1).size() + 8 << standard.at(1).mid(23); QTest::newRow("plain text cropped beginning and end (line break)") << standard.at(1) - << -9 << standard.at(1).length() + 4 + << -9 << standard.at(1).size() + 4 << standard.at(1); QTest::newRow("all rich text (line break)") << richBoldTextLB - << 0 << plainBoldTextLB.length() + << 0 << plainBoldTextLB.size() << plainBoldTextLB; QTest::newRow("rich text sub string (line break)") @@ -4504,7 +4504,7 @@ void tst_qquicktextedit::getFormattedText_data() QTest::newRow("all plain text") << standard.at(0) << QQuickTextEdit::PlainText - << 0 << standard.at(0).length() + << 0 << standard.at(0).size() << standard.at(0); QTest::newRow("plain text sub string") @@ -4528,31 +4528,31 @@ void tst_qquicktextedit::getFormattedText_data() QTest::newRow("plain text cropped end") << standard.at(0) << QQuickTextEdit::PlainText - << 23 << standard.at(0).length() + 8 + << 23 << standard.at(0).size() + 8 << standard.at(0).mid(23); QTest::newRow("plain text cropped beginning and end") << standard.at(0) << QQuickTextEdit::PlainText - << -9 << standard.at(0).length() + 4 + << -9 << standard.at(0).size() + 4 << standard.at(0); QTest::newRow("all rich (Auto) text") << richBoldText << QQuickTextEdit::AutoText - << 0 << plainBoldText.length() + << 0 << plainBoldText.size() << QString("This is some \\<.*\\>bold\\</.*\\> text"); QTest::newRow("all rich (Rich) text") << richBoldText << QQuickTextEdit::RichText - << 0 << plainBoldText.length() + << 0 << plainBoldText.size() << QString("This is some \\<.*\\>bold\\</.*\\> text"); QTest::newRow("all rich (Plain) text") << richBoldText << QQuickTextEdit::PlainText - << 0 << richBoldText.length() + << 0 << richBoldText.size() << richBoldText; QTest::newRow("rich (Auto) text sub string") @@ -4631,10 +4631,10 @@ void tst_qquicktextedit::append_data() QTest::newRow("cursor follows (end)") << standard.at(0) << QQuickTextEdit::PlainText - << standard.at(0).length() << standard.at(0).length() + << standard.at(0).size() << standard.at(0).size() << QString("Hello") << standard.at(0) + QString("\nHello") - << standard.at(0).length() + 6 << standard.at(0).length() + 6 << standard.at(0).length() + 6 + << standard.at(0).size() + 6 << standard.at(0).size() + 6 << standard.at(0).size() + 6 << false << true; QTest::newRow("selection kept intact (beginning)") @@ -4655,10 +4655,10 @@ void tst_qquicktextedit::append_data() QTest::newRow("selection kept intact, cursor follows (end)") << standard.at(0) << QQuickTextEdit::PlainText - << 18 << standard.at(0).length() + << 18 << standard.at(0).size() << QString("Hello") << standard.at(0) + QString("\nHello") - << 18 << standard.at(0).length() + 6 << standard.at(0).length() + 6 + << 18 << standard.at(0).size() + 6 << standard.at(0).size() + 6 << true << true; QTest::newRow("reversed selection kept intact") @@ -4744,12 +4744,12 @@ void tst_qquicktextedit::append() if (textFormat == QQuickTextEdit::RichText || textFormat == QQuickTextEdit::MarkdownText || (textFormat == QQuickTextEdit::AutoText && (Qt::mightBeRichText(text) || Qt::mightBeRichText(appendText)))) { - QCOMPARE(textEdit->getText(0, expectedText.length()), expectedText); + QCOMPARE(textEdit->getText(0, expectedText.size()), expectedText); } else { QCOMPARE(textEdit->text(), expectedText); } - QCOMPARE(textEdit->length(), expectedText.length()); + QCOMPARE(textEdit->length(), expectedText.size()); QCOMPARE(textEdit->selectionStart(), expectedSelectionStart); QCOMPARE(textEdit->selectionEnd(), expectedSelectionEnd); @@ -4758,11 +4758,11 @@ void tst_qquicktextedit::append() if (selectionStart > selectionEnd) qSwap(selectionStart, selectionEnd); - QCOMPARE(selectionSpy.count() > 0, selectionChanged); - QCOMPARE(selectionStartSpy.count() > 0, selectionStart != expectedSelectionStart); - QCOMPARE(selectionEndSpy.count() > 0, selectionEnd != expectedSelectionEnd); - QCOMPARE(textSpy.count() > 0, text != expectedText); - QCOMPARE(cursorPositionSpy.count() > 0, cursorPositionChanged); + QCOMPARE(selectionSpy.size() > 0, selectionChanged); + QCOMPARE(selectionStartSpy.size() > 0, selectionStart != expectedSelectionStart); + QCOMPARE(selectionEndSpy.size() > 0, selectionEnd != expectedSelectionEnd); + QCOMPARE(textSpy.size() > 0, text != expectedText); + QCOMPARE(cursorPositionSpy.size() > 0, cursorPositionChanged); } void tst_qquicktextedit::insert_data() @@ -4790,10 +4790,10 @@ void tst_qquicktextedit::insert_data() QTest::newRow("at cursor position (end)") << standard.at(0) << QQuickTextEdit::PlainText - << standard.at(0).length() << standard.at(0).length() << standard.at(0).length() + << standard.at(0).size() << standard.at(0).size() << standard.at(0).size() << QString("Hello") << standard.at(0) + QString("Hello") - << standard.at(0).length() + 5 << standard.at(0).length() + 5 << standard.at(0).length() + 5 + << standard.at(0).size() + 5 << standard.at(0).size() + 5 << standard.at(0).size() + 5 << false << true; QTest::newRow("at cursor position (middle)") @@ -4814,10 +4814,10 @@ void tst_qquicktextedit::insert_data() QTest::newRow("before cursor position (end)") << standard.at(0) << QQuickTextEdit::PlainText - << standard.at(0).length() << standard.at(0).length() << 18 + << standard.at(0).size() << standard.at(0).size() << 18 << QString("Hello") << standard.at(0).mid(0, 18) + QString("Hello") + standard.at(0).mid(18) - << standard.at(0).length() + 5 << standard.at(0).length() + 5 << standard.at(0).length() + 5 + << standard.at(0).size() + 5 << standard.at(0).size() + 5 << standard.at(0).size() + 5 << false << true; QTest::newRow("before cursor position (middle)") @@ -4830,7 +4830,7 @@ void tst_qquicktextedit::insert_data() QTest::newRow("after cursor position (middle)") << standard.at(0) << QQuickTextEdit::PlainText - << 18 << 18 << standard.at(0).length() + << 18 << 18 << standard.at(0).size() << QString("Hello") << standard.at(0) + QString("Hello") << 18 << 18 << 18 @@ -4854,7 +4854,7 @@ void tst_qquicktextedit::insert_data() QTest::newRow("after selection") << standard.at(0) << QQuickTextEdit::PlainText - << 14 << 19 << standard.at(0).length() + << 14 << 19 << standard.at(0).size() << QString("Hello") << standard.at(0) + QString("Hello") << 14 << 19 << 19 @@ -4862,7 +4862,7 @@ void tst_qquicktextedit::insert_data() QTest::newRow("after reversed selection") << standard.at(0) << QQuickTextEdit::PlainText - << 19 << 14 << standard.at(0).length() + << 19 << 14 << standard.at(0).size() << QString("Hello") << standard.at(0) + QString("Hello") << 14 << 19 << 14 @@ -4918,7 +4918,7 @@ void tst_qquicktextedit::insert_data() QTest::newRow("past end") << standard.at(0) << QQuickTextEdit::PlainText - << 0 << 0 << standard.at(0).length() + 3 + << 0 << 0 << standard.at(0).size() + 3 << QString("Hello") << standard.at(0) << 0 << 0 << 0 @@ -4993,12 +4993,12 @@ void tst_qquicktextedit::insert() if (textFormat == QQuickTextEdit::RichText || textFormat == QQuickTextEdit::MarkdownText || (textFormat == QQuickTextEdit::AutoText && (Qt::mightBeRichText(text) || Qt::mightBeRichText(insertText)))) { - QCOMPARE(textEdit->getText(0, expectedText.length()), expectedText); + QCOMPARE(textEdit->getText(0, expectedText.size()), expectedText); qCDebug(lcTests) << "with formatting:" << textEdit->getFormattedText(0, 100); } else { QCOMPARE(textEdit->text(), expectedText); } - QCOMPARE(textEdit->length(), expectedText.length()); + QCOMPARE(textEdit->length(), expectedText.size()); QCOMPARE(textEdit->selectionStart(), expectedSelectionStart); QCOMPARE(textEdit->selectionEnd(), expectedSelectionEnd); @@ -5007,11 +5007,11 @@ void tst_qquicktextedit::insert() if (selectionStart > selectionEnd) qSwap(selectionStart, selectionEnd); - QCOMPARE(selectionSpy.count() > 0, selectionChanged); - QCOMPARE(selectionStartSpy.count() > 0, selectionStart != expectedSelectionStart); - QCOMPARE(selectionEndSpy.count() > 0, selectionEnd != expectedSelectionEnd); - QCOMPARE(textSpy.count() > 0, text != expectedText); - QCOMPARE(cursorPositionSpy.count() > 0, cursorPositionChanged); + QCOMPARE(selectionSpy.size() > 0, selectionChanged); + QCOMPARE(selectionStartSpy.size() > 0, selectionStart != expectedSelectionStart); + QCOMPARE(selectionEndSpy.size() > 0, selectionEnd != expectedSelectionEnd); + QCOMPARE(textSpy.size() > 0, text != expectedText); + QCOMPARE(cursorPositionSpy.size() > 0, cursorPositionChanged); } void tst_qquicktextedit::remove_data() @@ -5050,18 +5050,18 @@ void tst_qquicktextedit::remove_data() QTest::newRow("to cursor position (end)") << standard.at(0) << QQuickTextEdit::PlainText - << standard.at(0).length() << standard.at(0).length() - << standard.at(0).length() << standard.at(0).length() - 5 - << standard.at(0).mid(0, standard.at(0).length() - 5) - << standard.at(0).length() - 5 << standard.at(0).length() - 5 << standard.at(0).length() - 5 + << standard.at(0).size() << standard.at(0).size() + << standard.at(0).size() << standard.at(0).size() - 5 + << standard.at(0).mid(0, standard.at(0).size() - 5) + << standard.at(0).size() - 5 << standard.at(0).size() - 5 << standard.at(0).size() - 5 << false << true; QTest::newRow("to cursor position (end)") << standard.at(0) << QQuickTextEdit::PlainText - << standard.at(0).length() << standard.at(0).length() - << standard.at(0).length() - 5 << standard.at(0).length() - << standard.at(0).mid(0, standard.at(0).length() - 5) - << standard.at(0).length() - 5 << standard.at(0).length() - 5 << standard.at(0).length() - 5 + << standard.at(0).size() << standard.at(0).size() + << standard.at(0).size() - 5 << standard.at(0).size() + << standard.at(0).mid(0, standard.at(0).size() - 5) + << standard.at(0).size() - 5 << standard.at(0).size() - 5 << standard.at(0).size() - 5 << false << true; QTest::newRow("from cursor position (middle)") @@ -5090,10 +5090,10 @@ void tst_qquicktextedit::remove_data() QTest::newRow("before cursor position (end)") << standard.at(0) << QQuickTextEdit::PlainText - << standard.at(0).length() << standard.at(0).length() + << standard.at(0).size() << standard.at(0).size() << 18 << 23 << standard.at(0).mid(0, 18) + standard.at(0).mid(23) - << standard.at(0).length() - 5 << standard.at(0).length() - 5 << standard.at(0).length() - 5 + << standard.at(0).size() - 5 << standard.at(0).size() - 5 << standard.at(0).size() - 5 << false << true; QTest::newRow("before cursor position (middle)") @@ -5131,16 +5131,16 @@ void tst_qquicktextedit::remove_data() QTest::newRow("after selection") << standard.at(0) << QQuickTextEdit::PlainText << 14 << 19 - << standard.at(0).length() - 5 << standard.at(0).length() - << standard.at(0).mid(0, standard.at(0).length() - 5) + << standard.at(0).size() - 5 << standard.at(0).size() + << standard.at(0).mid(0, standard.at(0).size() - 5) << 14 << 19 << 19 << false << false; QTest::newRow("after reversed selection") << standard.at(0) << QQuickTextEdit::PlainText << 19 << 14 - << standard.at(0).length() - 5 << standard.at(0).length() - << standard.at(0).mid(0, standard.at(0).length() - 5) + << standard.at(0).size() - 5 << standard.at(0).size() + << standard.at(0).mid(0, standard.at(0).size() - 5) << 14 << 19 << 14 << false << false; @@ -5171,7 +5171,7 @@ void tst_qquicktextedit::remove_data() QTest::newRow("plain text cropped end") << standard.at(0) << QQuickTextEdit::PlainText << 0 << 0 - << 23 << standard.at(0).length() + 8 + << 23 << standard.at(0).size() + 8 << standard.at(0).mid(0, 23) << 0 << 0 << 0 << false << false; @@ -5179,7 +5179,7 @@ void tst_qquicktextedit::remove_data() QTest::newRow("plain text cropped beginning and end") << standard.at(0) << QQuickTextEdit::PlainText << 0 << 0 - << -9 << standard.at(0).length() + 4 + << -9 << standard.at(0).size() + 4 << QString() << 0 << 0 << 0 << false << false; @@ -5187,7 +5187,7 @@ void tst_qquicktextedit::remove_data() QTest::newRow("all rich text") << richBoldText << QQuickTextEdit::RichText << 0 << 0 - << 0 << plainBoldText.length() + << 0 << plainBoldText.size() << QString() << 0 << 0 << 0 << false << false; @@ -5235,11 +5235,11 @@ void tst_qquicktextedit::remove() if (textFormat == QQuickTextEdit::RichText || (textFormat == QQuickTextEdit::AutoText && Qt::mightBeRichText(text))) { - QCOMPARE(textEdit->getText(0, expectedText.length()), expectedText); + QCOMPARE(textEdit->getText(0, expectedText.size()), expectedText); } else { QCOMPARE(textEdit->text(), expectedText); } - QCOMPARE(textEdit->length(), expectedText.length()); + QCOMPARE(textEdit->length(), expectedText.size()); if (selectionStart > selectionEnd) // qSwap(selectionStart, selectionEnd); @@ -5248,14 +5248,14 @@ void tst_qquicktextedit::remove() QCOMPARE(textEdit->selectionEnd(), expectedSelectionEnd); QCOMPARE(textEdit->cursorPosition(), expectedCursorPosition); - QCOMPARE(selectionSpy.count() > 0, selectionChanged); - QCOMPARE(selectionStartSpy.count() > 0, selectionStart != expectedSelectionStart); - QCOMPARE(selectionEndSpy.count() > 0, selectionEnd != expectedSelectionEnd); - QCOMPARE(textSpy.count() > 0, text != expectedText); + QCOMPARE(selectionSpy.size() > 0, selectionChanged); + QCOMPARE(selectionStartSpy.size() > 0, selectionStart != expectedSelectionStart); + QCOMPARE(selectionEndSpy.size() > 0, selectionEnd != expectedSelectionEnd); + QCOMPARE(textSpy.size() > 0, text != expectedText); if (cursorPositionChanged) // - QVERIFY(cursorPositionSpy.count() > 0); + QVERIFY(cursorPositionSpy.size() > 0); } #if QT_CONFIG(shortcut) @@ -5594,11 +5594,11 @@ void tst_qquicktextedit::undo() // QTest::keyClick(testWidget, Qt::Key_End, Qt::ShiftModifier); } - for (int j = 0; j < insertString.at(i).length(); j++) + for (int j = 0; j < insertString.at(i).size(); j++) QTest::keyClick(&window, insertString.at(i).at(j).toLatin1()); } - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // STEP 2: Next call undo several times and see if we can restore to the previous state for (i = 0; i < expectedString.size() - 1; ++i) { @@ -5610,7 +5610,7 @@ void tst_qquicktextedit::undo() // STEP 3: Verify that we have undone everything QVERIFY(textEdit->text().isEmpty()); QVERIFY(!textEdit->canUndo()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_qquicktextedit::redo_data() @@ -5671,13 +5671,13 @@ void tst_qquicktextedit::redo() for (i = 0; i < insertString.size(); ++i) { if (insertIndex[i] > -1) textEdit->setCursorPosition(insertIndex[i]); - for (int j = 0; j < insertString.at(i).length(); j++) + for (int j = 0; j < insertString.at(i).size(); j++) QTest::keyClick(&window, insertString.at(i).at(j).toLatin1()); QVERIFY(textEdit->canUndo()); QVERIFY(!textEdit->canRedo()); } - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); // undo everything while (!textEdit->text().isEmpty()) { @@ -5686,7 +5686,7 @@ void tst_qquicktextedit::redo() QVERIFY(textEdit->canRedo()); } - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); for (i = 0; i < expectedString.size(); ++i) { QVERIFY(textEdit->canRedo()); @@ -5695,7 +5695,7 @@ void tst_qquicktextedit::redo() QVERIFY(textEdit->canUndo()); } QVERIFY(!textEdit->canRedo()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } #if QT_CONFIG(shortcut) @@ -5917,12 +5917,12 @@ void tst_qquicktextedit::clear() textEdit->clear(); QVERIFY(textEdit->text().isEmpty()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // checks that clears can be undone textEdit->undo(); QVERIFY(!textEdit->canUndo()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QCOMPARE(textEdit->text(), QString("I am Legend")); textEdit->setCursorPosition(4); @@ -5934,12 +5934,12 @@ void tst_qquicktextedit::clear() textEdit->clear(); QVERIFY(textEdit->text().isEmpty()); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); // checks that clears can be undone textEdit->undo(); QVERIFY(!textEdit->canUndo()); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); QCOMPARE(textEdit->text(), QString("I am Legend")); textEdit->setText(QString("<i>I am Legend</i>")); @@ -5947,11 +5947,11 @@ void tst_qquicktextedit::clear() textEdit->clear(); QVERIFY(textEdit->text().isEmpty()); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); // checks that clears can be undone textEdit->undo(); - QCOMPARE(spy.count(), 6); + QCOMPARE(spy.size(), 6); QCOMPARE(textEdit->text(), QString("<i>I am Legend</i>")); } @@ -5970,15 +5970,15 @@ void tst_qquicktextedit::baseUrl() textObject->setBaseUrl(localUrl); QCOMPARE(textObject->baseUrl(), localUrl); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); textObject->setBaseUrl(remoteUrl); QCOMPARE(textObject->baseUrl(), remoteUrl); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); textObject->resetBaseUrl(); QCOMPARE(textObject->baseUrl(), localUrl); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_qquicktextedit::embeddedImages_data() @@ -6076,7 +6076,7 @@ void tst_qquicktextedit::cursorRectangle_QTBUG_38947() QRectF rect = edit->positionToRectangle(i); QTest::mouseMove(&window, rect.center().toPoint()); QCOMPARE(edit->cursorRectangle(), rect); - QCOMPARE(spy.count(), i); + QCOMPARE(spy.size(), i); } QPoint to = edit->positionToRectangle(edit->length() - 1).center().toPoint(); @@ -6105,13 +6105,13 @@ void tst_qquicktextedit::doubleSelect_QTBUG_38704() QSignalSpy selectionSpy(textEdit, SIGNAL(selectedTextChanged())); textEdit->select(0,1); //Select some text initially - QCOMPARE(selectionSpy.count(), 1); + QCOMPARE(selectionSpy.size(), 1); textEdit->select(0,1); //No change to selection start/end - QCOMPARE(selectionSpy.count(), 1); + QCOMPARE(selectionSpy.size(), 1); textEdit->select(0,2); //Change selection end - QCOMPARE(selectionSpy.count(), 2); + QCOMPARE(selectionSpy.size(), 2); textEdit->select(1,2); //Change selection start - QCOMPARE(selectionSpy.count(), 3); + QCOMPARE(selectionSpy.size(), 3); } void tst_qquicktextedit::padding() @@ -6297,28 +6297,28 @@ void tst_qquicktextedit::keyEventPropagation() QQuickTextEdit *textEdit = root->findChild<QQuickTextEdit *>(); QVERIFY(textEdit->hasActiveFocus()); simulateKey(&view, Qt::Key_Back); - QCOMPARE(downSpy.count(), 1); - QCOMPARE(upSpy.count(), 1); + QCOMPARE(downSpy.size(), 1); + QCOMPARE(upSpy.size(), 1); auto downKey = downSpy.takeFirst(); auto upKey = upSpy.takeFirst(); QCOMPARE(downKey.at(0).toInt(), Qt::Key_Back); QCOMPARE(upKey.at(0).toInt(), Qt::Key_Back); simulateKey(&view, Qt::Key_Shift); - QCOMPARE(downSpy.count(), 1); - QCOMPARE(upSpy.count(), 1); + QCOMPARE(downSpy.size(), 1); + QCOMPARE(upSpy.size(), 1); downKey = downSpy.takeFirst(); upKey = upSpy.takeFirst(); QCOMPARE(downKey.at(0).toInt(), Qt::Key_Shift); QCOMPARE(upKey.at(0).toInt(), Qt::Key_Shift); simulateKey(&view, Qt::Key_A); - QCOMPARE(downSpy.count(), 0); - QCOMPARE(upSpy.count(), 0); + QCOMPARE(downSpy.size(), 0); + QCOMPARE(upSpy.size(), 0); simulateKey(&view, Qt::Key_Right); - QCOMPARE(downSpy.count(), 0); - QCOMPARE(upSpy.count(), 1); + QCOMPARE(downSpy.size(), 0); + QCOMPARE(upSpy.size(), 1); upKey = upSpy.takeFirst(); QCOMPARE(upKey.at(0).toInt(), Qt::Key_Right); } @@ -6453,7 +6453,7 @@ void tst_qquicktextedit::touchscreenSetsFocusAndMovesCursor() QVERIFY(top); QQuickTextEdit *bottom = window.rootObject()->findChild<QQuickTextEdit*>("bottom"); QVERIFY(bottom); - const auto len = bottom->text().length(); + const auto len = bottom->text().size(); // tap the bottom field QPoint p1 = bottom->mapToScene({6, 6}).toPoint(); @@ -6466,7 +6466,7 @@ void tst_qquicktextedit::touchscreenSetsFocusAndMovesCursor() QVERIFY(!bottom->text().startsWith('q')); QTest::keyClick(&window, Qt::Key_Q); QVERIFY(bottom->text().startsWith('q')); - QCOMPARE(bottom->text().length(), len + 1); + QCOMPARE(bottom->text().size(), len + 1); QTest::touchEvent(&window, touchDevice).release(0, p1, &window); QQuickTouchUtils::flush(&window); // the cursor gets moved on release, as long as TextInput's grab wasn't stolen (e.g. by Flickable) diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index 54f650f86e..9475d63930 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -226,7 +226,7 @@ Q_DECLARE_METATYPE(KeyList) void tst_qquicktextinput::simulateKeys(QWindow *window, const QList<Key> &keys) { - for (int i = 0; i < keys.count(); ++i) { + for (int i = 0; i < keys.size(); ++i) { const Qt::KeyboardModifiers modifiers = keys.at(i).keyCombination.keyboardModifiers(); const QChar character = keys.at(i).character; if (!character.isNull()) @@ -318,7 +318,7 @@ void tst_qquicktextinput::text() QVERIFY(textinputObject != nullptr); QCOMPARE(textinputObject->text(), standard.at(i)); - QCOMPARE(textinputObject->length(), standard.at(i).length()); + QCOMPARE(textinputObject->length(), standard.at(i).size()); delete textinputObject; } @@ -470,36 +470,36 @@ void tst_qquicktextinput::color() textInputObject->setColor(QColor("white")); QCOMPARE(textInputObject->color(), QColor("white")); - QCOMPARE(colorSpy.count(), 1); + QCOMPARE(colorSpy.size(), 1); textInputObject->setSelectionColor(QColor("black")); QCOMPARE(textInputObject->selectionColor(), QColor("black")); - QCOMPARE(selectionColorSpy.count(), 1); + QCOMPARE(selectionColorSpy.size(), 1); textInputObject->setSelectedTextColor(QColor("blue")); QCOMPARE(textInputObject->selectedTextColor(), QColor("blue")); - QCOMPARE(selectedTextColorSpy.count(), 1); + QCOMPARE(selectedTextColorSpy.size(), 1); textInputObject->setColor(QColor("white")); - QCOMPARE(colorSpy.count(), 1); + QCOMPARE(colorSpy.size(), 1); textInputObject->setSelectionColor(QColor("black")); - QCOMPARE(selectionColorSpy.count(), 1); + QCOMPARE(selectionColorSpy.size(), 1); textInputObject->setSelectedTextColor(QColor("blue")); - QCOMPARE(selectedTextColorSpy.count(), 1); + QCOMPARE(selectedTextColorSpy.size(), 1); textInputObject->setColor(QColor("black")); QCOMPARE(textInputObject->color(), QColor("black")); - QCOMPARE(colorSpy.count(), 2); + QCOMPARE(colorSpy.size(), 2); textInputObject->setSelectionColor(QColor("blue")); QCOMPARE(textInputObject->selectionColor(), QColor("blue")); - QCOMPARE(selectionColorSpy.count(), 2); + QCOMPARE(selectionColorSpy.size(), 2); textInputObject->setSelectedTextColor(QColor("white")); QCOMPARE(textInputObject->selectedTextColor(), QColor("white")); - QCOMPARE(selectedTextColorSpy.count(), 2); + QCOMPARE(selectedTextColorSpy.size(), 2); } //test color @@ -575,7 +575,7 @@ void tst_qquicktextinput::wrap() delete textObject; } - for (int i = 0; i < standard.count(); i++) { + for (int i = 0; i < standard.size(); i++) { QString componentStr = "import QtQuick 2.0\nTextInput { wrapMode: Text.WrapAnywhere; width: 30; text: \"" + standard.at(i) + "\" }"; QQmlComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -605,14 +605,14 @@ void tst_qquicktextinput::wrap() input->setWrapMode(QQuickTextInput::Wrap); QCOMPARE(input->wrapMode(), QQuickTextInput::Wrap); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); input->setWrapMode(QQuickTextInput::Wrap); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); input->setWrapMode(QQuickTextInput::NoWrap); QCOMPARE(input->wrapMode(), QQuickTextInput::NoWrap); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } } @@ -648,7 +648,7 @@ void tst_qquicktextinput::selection() QCOMPARE(textinputObject->selectionEnd(), 0); QVERIFY(textinputObject->selectedText().isNull()); - textinputObject->setCursorPosition(textinputObject->text().length() + 1); + textinputObject->setCursorPosition(textinputObject->text().size() + 1); QCOMPARE(textinputObject->cursorPosition(), 0); QCOMPARE(textinputObject->selectionStart(), 0); QCOMPARE(textinputObject->selectionEnd(), 0); @@ -708,7 +708,7 @@ void tst_qquicktextinput::selection() QInputMethodEvent event("", attributes); QGuiApplication::sendEvent(textinputObject, &event); } - QCOMPARE(selectionSpy.count(), 1); + QCOMPARE(selectionSpy.size(), 1); QCOMPARE(textinputObject->selectionStart(), 12); QCOMPARE(textinputObject->selectionEnd(), 17); @@ -732,7 +732,7 @@ void tst_qquicktextinput::persistentSelection() input->setPersistentSelection(false); QCOMPARE(input->persistentSelection(), false); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); input->select(1, 4); QCOMPARE(input->property("selected").toString(), QLatin1String("ell")); @@ -745,7 +745,7 @@ void tst_qquicktextinput::persistentSelection() input->setPersistentSelection(true); QCOMPARE(input->persistentSelection(), true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); input->select(1, 4); QCOMPARE(input->property("selected").toString(), QLatin1String("ell")); @@ -776,25 +776,25 @@ void tst_qquicktextinput::overwriteMode() QVERIFY(textInput->hasActiveFocus()); textInput->setOverwriteMode(true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(true, textInput->overwriteMode()); textInput->setOverwriteMode(false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QCOMPARE(false, textInput->overwriteMode()); QVERIFY(!textInput->overwriteMode()); QString insertString = "Some first text"; - for (int j = 0; j < insertString.length(); j++) + for (int j = 0; j < insertString.size(); j++) QTest::keyClick(&window, insertString.at(j).toLatin1()); QCOMPARE(textInput->text(), QString("Some first text")); textInput->setOverwriteMode(true); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); textInput->setCursorPosition(5); insertString = "shiny"; - for (int j = 0; j < insertString.length(); j++) + for (int j = 0; j < insertString.size(); j++) QTest::keyClick(&window, insertString.at(j).toLatin1()); QCOMPARE(textInput->text(), QString("Some shiny text")); } @@ -836,24 +836,24 @@ void tst_qquicktextinput::isRightToLeft() // first test that the right string is delivered to the QString::isRightToLeft() QCOMPARE(textInput.isRightToLeft(0,0), text.mid(0,0).isRightToLeft()); QCOMPARE(textInput.isRightToLeft(0,1), text.mid(0,1).isRightToLeft()); - QCOMPARE(textInput.isRightToLeft(text.length()-2, text.length()-1), text.mid(text.length()-2, text.length()-1).isRightToLeft()); - QCOMPARE(textInput.isRightToLeft(text.length()/2, text.length()/2 + 1), text.mid(text.length()/2, text.length()/2 + 1).isRightToLeft()); - QCOMPARE(textInput.isRightToLeft(0,text.length()/4), text.mid(0,text.length()/4).isRightToLeft()); - QCOMPARE(textInput.isRightToLeft(text.length()/4,3*text.length()/4), text.mid(text.length()/4,3*text.length()/4).isRightToLeft()); + QCOMPARE(textInput.isRightToLeft(text.size()-2, text.size()-1), text.mid(text.size()-2, text.size()-1).isRightToLeft()); + QCOMPARE(textInput.isRightToLeft(text.size()/2, text.size()/2 + 1), text.mid(text.size()/2, text.size()/2 + 1).isRightToLeft()); + QCOMPARE(textInput.isRightToLeft(0,text.size()/4), text.mid(0,text.size()/4).isRightToLeft()); + QCOMPARE(textInput.isRightToLeft(text.size()/4,3*text.size()/4), text.mid(text.size()/4,3*text.size()/4).isRightToLeft()); if (text.isEmpty()) QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML TextInput: isRightToLeft(start, end) called with the end property being smaller than the start."); - QCOMPARE(textInput.isRightToLeft(3*text.length()/4,text.length()-1), text.mid(3*text.length()/4,text.length()-1).isRightToLeft()); + QCOMPARE(textInput.isRightToLeft(3*text.size()/4,text.size()-1), text.mid(3*text.size()/4,text.size()-1).isRightToLeft()); // then test that the feature actually works QCOMPARE(textInput.isRightToLeft(0,0), emptyString); QCOMPARE(textInput.isRightToLeft(0,1), firstCharacter); - QCOMPARE(textInput.isRightToLeft(text.length()-2, text.length()-1), lastCharacter); - QCOMPARE(textInput.isRightToLeft(text.length()/2, text.length()/2 + 1), middleCharacter); - QCOMPARE(textInput.isRightToLeft(0,text.length()/4), startString); - QCOMPARE(textInput.isRightToLeft(text.length()/4,3*text.length()/4), midString); + QCOMPARE(textInput.isRightToLeft(text.size()-2, text.size()-1), lastCharacter); + QCOMPARE(textInput.isRightToLeft(text.size()/2, text.size()/2 + 1), middleCharacter); + QCOMPARE(textInput.isRightToLeft(0,text.size()/4), startString); + QCOMPARE(textInput.isRightToLeft(text.size()/4,3*text.size()/4), midString); if (text.isEmpty()) QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML TextInput: isRightToLeft(start, end) called with the end property being smaller than the start."); - QCOMPARE(textInput.isRightToLeft(3*text.length()/4,text.length()-1), endString); + QCOMPARE(textInput.isRightToLeft(3*text.size()/4,text.size()-1), endString); } void tst_qquicktextinput::moveCursorSelection_data() @@ -1289,8 +1289,8 @@ void tst_qquicktextinput::dragMouseSelection() QTest::mouseMove(&window, QPoint(x2, y)); QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x2,y)); QString str1; - QTRY_VERIFY((str1 = textInputObject->selectedText()).length() > 3); - QTRY_VERIFY(str1.length() > 3); + QTRY_VERIFY((str1 = textInputObject->selectedText()).size() > 3); + QTRY_VERIFY(str1.size() > 3); // press and drag the current selection. x1 = 40; @@ -1299,7 +1299,7 @@ void tst_qquicktextinput::dragMouseSelection() QTest::mouseMove(&window, QPoint(x2, y)); QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x2,y)); QString str2 = textInputObject->selectedText(); - QTRY_VERIFY(str2.length() > 3); + QTRY_VERIFY(str2.size() > 3); QTRY_VERIFY(str1 != str2); } @@ -1355,7 +1355,7 @@ void tst_qquicktextinput::mouseSelectionMode() if (selectWords) { QTRY_COMPARE(textInputObject->selectedText(), text); } else { - QTRY_VERIFY(textInputObject->selectedText().length() > 3); + QTRY_VERIFY(textInputObject->selectedText().size() > 3); QVERIFY(textInputObject->selectedText() != text); } } @@ -1374,14 +1374,14 @@ void tst_qquicktextinput::mouseSelectionMode_accessors() input->setMouseSelectionMode(QQuickTextInput::SelectWords); QCOMPARE(input->mouseSelectionMode(), QQuickTextInput::SelectWords); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); input->setMouseSelectionMode(QQuickTextInput::SelectWords); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); input->setMouseSelectionMode(QQuickTextInput::SelectCharacters); QCOMPARE(input->mouseSelectionMode(), QQuickTextInput::SelectCharacters); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_qquicktextinput::selectByMouse() @@ -1398,15 +1398,15 @@ void tst_qquicktextinput::selectByMouse() input->setSelectByMouse(true); QCOMPARE(input->selectByMouse(), true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).toBool(), true); input->setSelectByMouse(true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); input->setSelectByMouse(false); QCOMPARE(input->selectByMouse(), false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QCOMPARE(spy.at(1).at(0).toBool(), false); } @@ -1424,14 +1424,14 @@ void tst_qquicktextinput::renderType() input->setRenderType(QQuickTextInput::NativeRendering); QCOMPARE(input->renderType(), QQuickTextInput::NativeRendering); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); input->setRenderType(QQuickTextInput::NativeRendering); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); input->setRenderType(QQuickTextInput::QtRendering); QCOMPARE(input->renderType(), QQuickTextInput::QtRendering); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_qquicktextinput::horizontalAlignment_RightToLeft() @@ -1541,7 +1541,7 @@ void tst_qquicktextinput::horizontalAlignment_RightToLeft() QSignalSpy cursorRectangleSpy(textInput, SIGNAL(cursorRectangleChanged())); platformInputContext.setInputDirection(Qt::RightToLeft); QCOMPARE(qApp->inputMethod()->inputDirection(), Qt::RightToLeft); - QCOMPARE(cursorRectangleSpy.count(), 1); + QCOMPARE(cursorRectangleSpy.size(), 1); QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignRight); QVERIFY(textInput->boundingRect().right() >= textInput->width() - 1); QVERIFY(textInput->boundingRect().right() <= textInput->width() + 1); @@ -1876,15 +1876,15 @@ void tst_qquicktextinput::maxLength() QVERIFY(textinputObject->text().isEmpty()); QCOMPARE(textinputObject->maxLength(), 10); foreach (const QString &str, standard) { - QVERIFY(textinputObject->text().length() <= 10); + QVERIFY(textinputObject->text().size() <= 10); textinputObject->setText(str); - QVERIFY(textinputObject->text().length() <= 10); + QVERIFY(textinputObject->text().size() <= 10); } textinputObject->setText(""); QTRY_VERIFY(textinputObject->hasActiveFocus()); for (int i=0; i<20; i++) { - QTRY_COMPARE(textinputObject->text().length(), qMin(i,10)); + QTRY_COMPARE(textinputObject->text().size(), qMin(i,10)); QTest::keyClick(&window, Qt::Key_A); } } @@ -1900,11 +1900,11 @@ void tst_qquicktextinput::masks() QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput *>(window.rootObject()); QVERIFY(textinputObject != nullptr); QTRY_VERIFY(textinputObject->hasActiveFocus()); - QCOMPARE(textinputObject->text().length(), 0); + QCOMPARE(textinputObject->text().size(), 0); QCOMPARE(textinputObject->inputMask(), QString("HHHHhhhh; ")); QCOMPARE(textinputObject->length(), 8); for (int i=0; i<10; i++) { - QTRY_COMPARE(qMin(i,8), textinputObject->text().length()); + QTRY_COMPARE(qMin(i,8), textinputObject->text().size()); QCOMPARE(textinputObject->length(), 8); QCOMPARE(textinputObject->getText(0, qMin(i, 8)), QString(qMin(i, 8), 'a')); QCOMPARE(textinputObject->getText(qMin(i, 8), 8), QString(8 - qMin(i, 8), ' ')); @@ -1956,10 +1956,10 @@ void tst_qquicktextinput::validators() QTRY_COMPARE(intInput->text(), QLatin1String("1")); QCOMPARE(intInput->hasAcceptableInput(), false); QCOMPARE(intInput->property("acceptable").toBool(), false); - QCOMPARE(intSpy.count(), 0); + QCOMPARE(intSpy.size(), 0); QCOMPARE(intInput->hasAcceptableInput(), false); QCOMPARE(intInput->property("acceptable").toBool(), false); - QCOMPARE(intSpy.count(), 0); + QCOMPARE(intSpy.size(), 0); QTest::keyPress(&window, Qt::Key_Period); QTest::keyRelease(&window, Qt::Key_Period, Qt::NoModifier); QTRY_COMPARE(intInput->text(), QLatin1String("1")); @@ -1987,13 +1987,13 @@ void tst_qquicktextinput::validators() QCOMPARE(intInput->text(), QLatin1String("11")); QCOMPARE(intInput->hasAcceptableInput(), true); QCOMPARE(intInput->property("acceptable").toBool(), true); - QCOMPARE(intSpy.count(), 1); + QCOMPARE(intSpy.size(), 1); QTest::keyPress(&window, Qt::Key_0); QTest::keyRelease(&window, Qt::Key_0, Qt::NoModifier); QCOMPARE(intInput->text(), QLatin1String("11")); QCOMPARE(intInput->hasAcceptableInput(), true); QCOMPARE(intInput->property("acceptable").toBool(), true); - QCOMPARE(intSpy.count(), 1); + QCOMPARE(intSpy.size(), 1); QQuickTextInput *dblInput = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("dblInput"))); QVERIFY(dblInput); @@ -2019,13 +2019,13 @@ void tst_qquicktextinput::validators() QTRY_COMPARE(dblInput->text(), QLatin1String("1")); QCOMPARE(dblInput->hasAcceptableInput(), false); QCOMPARE(dblInput->property("acceptable").toBool(), false); - QCOMPARE(dblSpy.count(), 0); + QCOMPARE(dblSpy.size(), 0); QTest::keyPress(&window, Qt::Key_2); QTest::keyRelease(&window, Qt::Key_2, Qt::NoModifier); QTRY_COMPARE(dblInput->text(), QLatin1String("12")); QCOMPARE(dblInput->hasAcceptableInput(), true); QCOMPARE(dblInput->property("acceptable").toBool(), true); - QCOMPARE(dblSpy.count(), 1); + QCOMPARE(dblSpy.size(), 1); QTest::keyPress(&window, Qt::Key_Comma); QTest::keyRelease(&window, Qt::Key_Comma, Qt::NoModifier); QTRY_COMPARE(dblInput->text(), QLatin1String("12,")); @@ -2066,84 +2066,84 @@ void tst_qquicktextinput::validators() QTRY_COMPARE(dblInput->text(), QLatin1String("12.")); QCOMPARE(dblInput->hasAcceptableInput(), true); QCOMPARE(dblInput->property("acceptable").toBool(), true); - QCOMPARE(dblSpy.count(), 1 + extraSignals); + QCOMPARE(dblSpy.size(), 1 + extraSignals); QTest::keyPress(&window, Qt::Key_1); QTest::keyRelease(&window, Qt::Key_1, Qt::NoModifier); QTRY_COMPARE(dblInput->text(), QLatin1String("12.1")); QCOMPARE(dblInput->hasAcceptableInput(), true); QCOMPARE(dblInput->property("acceptable").toBool(), true); - QCOMPARE(dblSpy.count(), 1 + extraSignals); + QCOMPARE(dblSpy.size(), 1 + extraSignals); QTest::keyPress(&window, Qt::Key_1); QTest::keyRelease(&window, Qt::Key_1, Qt::NoModifier); QTRY_COMPARE(dblInput->text(), QLatin1String("12.11")); QCOMPARE(dblInput->hasAcceptableInput(), true); QCOMPARE(dblInput->property("acceptable").toBool(), true); - QCOMPARE(dblSpy.count(), 1 + extraSignals); + QCOMPARE(dblSpy.size(), 1 + extraSignals); QTest::keyPress(&window, Qt::Key_1); QTest::keyRelease(&window, Qt::Key_1, Qt::NoModifier); QTRY_COMPARE(dblInput->text(), QLatin1String("12.11")); QCOMPARE(dblInput->hasAcceptableInput(), true); QCOMPARE(dblInput->property("acceptable").toBool(), true); - QCOMPARE(dblSpy.count(), 1 + extraSignals); + QCOMPARE(dblSpy.size(), 1 + extraSignals); // Ensure the validator doesn't prevent characters being removed. dblInput->setValidator(intInput->validator()); QCOMPARE(dblInput->text(), QLatin1String("12.11")); QCOMPARE(dblInput->hasAcceptableInput(), false); QCOMPARE(dblInput->property("acceptable").toBool(), false); - QCOMPARE(dblSpy.count(), 2 + extraSignals); + QCOMPARE(dblSpy.size(), 2 + extraSignals); QTest::keyPress(&window, Qt::Key_Backspace); QTest::keyRelease(&window, Qt::Key_Backspace, Qt::NoModifier); QTRY_COMPARE(dblInput->text(), QLatin1String("12.1")); QCOMPARE(dblInput->hasAcceptableInput(), false); QCOMPARE(dblInput->property("acceptable").toBool(), false); - QCOMPARE(dblSpy.count(), 2 + extraSignals); + QCOMPARE(dblSpy.size(), 2 + extraSignals); // Once unacceptable input is in anything goes until it reaches an acceptable state again. QTest::keyPress(&window, Qt::Key_1); QTest::keyRelease(&window, Qt::Key_1, Qt::NoModifier); QTRY_COMPARE(dblInput->text(), QLatin1String("12.11")); QCOMPARE(dblInput->hasAcceptableInput(), false); - QCOMPARE(dblSpy.count(), 2 + extraSignals); + QCOMPARE(dblSpy.size(), 2 + extraSignals); QTest::keyPress(&window, Qt::Key_Backspace); QTest::keyRelease(&window, Qt::Key_Backspace, Qt::NoModifier); QTRY_COMPARE(dblInput->text(), QLatin1String("12.1")); QCOMPARE(dblInput->hasAcceptableInput(), false); QCOMPARE(dblInput->property("acceptable").toBool(), false); - QCOMPARE(dblSpy.count(), 2 + extraSignals); + QCOMPARE(dblSpy.size(), 2 + extraSignals); QTest::keyPress(&window, Qt::Key_Backspace); QTest::keyRelease(&window, Qt::Key_Backspace, Qt::NoModifier); QTRY_COMPARE(dblInput->text(), QLatin1String("12.")); QCOMPARE(dblInput->hasAcceptableInput(), false); QCOMPARE(dblInput->property("acceptable").toBool(), false); - QCOMPARE(dblSpy.count(), 2 + extraSignals); + QCOMPARE(dblSpy.size(), 2 + extraSignals); QTest::keyPress(&window, Qt::Key_Backspace); QTest::keyRelease(&window, Qt::Key_Backspace, Qt::NoModifier); QTRY_COMPARE(dblInput->text(), QLatin1String("12")); QCOMPARE(dblInput->hasAcceptableInput(), false); QCOMPARE(dblInput->property("acceptable").toBool(), false); - QCOMPARE(dblSpy.count(), 2 + extraSignals); + QCOMPARE(dblSpy.size(), 2 + extraSignals); QTest::keyPress(&window, Qt::Key_Backspace); QTest::keyRelease(&window, Qt::Key_Backspace, Qt::NoModifier); QTRY_COMPARE(dblInput->text(), QLatin1String("1")); QCOMPARE(dblInput->hasAcceptableInput(), false); QCOMPARE(dblInput->property("acceptable").toBool(), false); - QCOMPARE(dblSpy.count(), 2 + extraSignals); + QCOMPARE(dblSpy.size(), 2 + extraSignals); QTest::keyPress(&window, Qt::Key_1); QTest::keyRelease(&window, Qt::Key_1, Qt::NoModifier); QCOMPARE(dblInput->text(), QLatin1String("11")); QCOMPARE(dblInput->property("acceptable").toBool(), true); QCOMPARE(dblInput->hasAcceptableInput(), true); - QCOMPARE(dblSpy.count(), 3 + extraSignals); + QCOMPARE(dblSpy.size(), 3 + extraSignals); // Changing the validator properties will re-evaluate whether the input is acceptable. intValidator->setTop(10); QCOMPARE(dblInput->property("acceptable").toBool(), false); QCOMPARE(dblInput->hasAcceptableInput(), false); - QCOMPARE(dblSpy.count(), 4 + extraSignals); + QCOMPARE(dblSpy.size(), 4 + extraSignals); intValidator->setTop(12); QCOMPARE(dblInput->property("acceptable").toBool(), true); QCOMPARE(dblInput->hasAcceptableInput(), true); - QCOMPARE(dblSpy.count(), 5 + extraSignals); + QCOMPARE(dblSpy.size(), 5 + extraSignals); QQuickTextInput *strInput = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("strInput"))); QVERIFY(strInput); @@ -2157,37 +2157,37 @@ void tst_qquicktextinput::validators() QTRY_COMPARE(strInput->text(), QLatin1String("")); QCOMPARE(strInput->hasAcceptableInput(), false); QCOMPARE(strInput->property("acceptable").toBool(), false); - QCOMPARE(strSpy.count(), 0); + QCOMPARE(strSpy.size(), 0); QTest::keyPress(&window, Qt::Key_A); QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier); QTRY_COMPARE(strInput->text(), QLatin1String("a")); QCOMPARE(strInput->hasAcceptableInput(), false); QCOMPARE(strInput->property("acceptable").toBool(), false); - QCOMPARE(strSpy.count(), 0); + QCOMPARE(strSpy.size(), 0); QTest::keyPress(&window, Qt::Key_A); QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier); QTRY_COMPARE(strInput->text(), QLatin1String("aa")); QCOMPARE(strInput->hasAcceptableInput(), true); QCOMPARE(strInput->property("acceptable").toBool(), true); - QCOMPARE(strSpy.count(), 1); + QCOMPARE(strSpy.size(), 1); QTest::keyPress(&window, Qt::Key_A); QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier); QTRY_COMPARE(strInput->text(), QLatin1String("aaa")); QCOMPARE(strInput->hasAcceptableInput(), true); QCOMPARE(strInput->property("acceptable").toBool(), true); - QCOMPARE(strSpy.count(), 1); + QCOMPARE(strSpy.size(), 1); QTest::keyPress(&window, Qt::Key_A); QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier); QTRY_COMPARE(strInput->text(), QLatin1String("aaaa")); QCOMPARE(strInput->hasAcceptableInput(), true); QCOMPARE(strInput->property("acceptable").toBool(), true); - QCOMPARE(strSpy.count(), 1); + QCOMPARE(strSpy.size(), 1); QTest::keyPress(&window, Qt::Key_A); QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier); QTRY_COMPARE(strInput->text(), QLatin1String("aaaa")); QCOMPARE(strInput->hasAcceptableInput(), true); QCOMPARE(strInput->property("acceptable").toBool(), true); - QCOMPARE(strSpy.count(), 1); + QCOMPARE(strSpy.size(), 1); QQuickTextInput *unvalidatedInput = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("unvalidatedInput"))); QVERIFY(unvalidatedInput); @@ -2201,13 +2201,13 @@ void tst_qquicktextinput::validators() QTRY_COMPARE(unvalidatedInput->text(), QLatin1String("1")); QCOMPARE(unvalidatedInput->hasAcceptableInput(), true); QCOMPARE(unvalidatedInput->property("acceptable").toBool(), true); - QCOMPARE(unvalidatedSpy.count(), 0); + QCOMPARE(unvalidatedSpy.size(), 0); QTest::keyPress(&window, Qt::Key_A); QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier); QTRY_COMPARE(unvalidatedInput->text(), QLatin1String("1a")); QCOMPARE(unvalidatedInput->hasAcceptableInput(), true); QCOMPARE(unvalidatedInput->property("acceptable").toBool(), true); - QCOMPARE(unvalidatedSpy.count(), 0); + QCOMPARE(unvalidatedSpy.size(), 0); } void tst_qquicktextinput::inputMethods() @@ -2225,9 +2225,9 @@ void tst_qquicktextinput::inputMethods() QSignalSpy inputMethodHintSpy(input, SIGNAL(inputMethodHintsChanged())); input->setInputMethodHints(Qt::ImhUppercaseOnly); QVERIFY(input->inputMethodHints() & Qt::ImhUppercaseOnly); - QCOMPARE(inputMethodHintSpy.count(), 1); + QCOMPARE(inputMethodHintSpy.size(), 1); input->setInputMethodHints(Qt::ImhUppercaseOnly); - QCOMPARE(inputMethodHintSpy.count(), 1); + QCOMPARE(inputMethodHintSpy.size(), 1); // default value QQuickTextInput plainInput; @@ -2286,8 +2286,8 @@ void tst_qquicktextinput::inputMethods() // input should reset selection even if replacement parameters are out of bounds input->setText("text"); input->setCursorPosition(0); - input->moveCursorSelection(input->text().length()); - event.setCommitString("replacement", -input->text().length(), input->text().length()); + input->moveCursorSelection(input->text().size()); + event.setCommitString("replacement", -input->text().size(), input->text().size()); QGuiApplication::sendEvent(input, &event); QCOMPARE(input->selectionStart(), input->selectionEnd()); QCOMPARE(input->text(), QString("replacement")); @@ -2326,22 +2326,22 @@ void tst_qquicktextinput::signal_accepted() QTRY_COMPARE(input->text(), QLatin1String("a")); QCOMPARE(input->hasAcceptableInput(), false); QCOMPARE(input->property("acceptable").toBool(), false); - QTRY_COMPARE(inputSpy.count(), 0); + QTRY_COMPARE(inputSpy.size(), 0); QTest::keyPress(&window, Qt::Key_Enter); QTest::keyRelease(&window, Qt::Key_Enter, Qt::NoModifier); - QTRY_COMPARE(acceptedSpy.count(), 0); + QTRY_COMPARE(acceptedSpy.size(), 0); QTest::keyPress(&window, Qt::Key_A); QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier); QTRY_COMPARE(input->text(), QLatin1String("aa")); QCOMPARE(input->hasAcceptableInput(), true); QCOMPARE(input->property("acceptable").toBool(), true); - QTRY_COMPARE(inputSpy.count(), 1); + QTRY_COMPARE(inputSpy.size(), 1); QTest::keyPress(&window, Qt::Key_Enter); QTest::keyRelease(&window, Qt::Key_Enter, Qt::NoModifier); - QTRY_COMPARE(acceptedSpy.count(), 1); + QTRY_COMPARE(acceptedSpy.size(), 1); } void tst_qquicktextinput::signal_editingfinished() @@ -2369,23 +2369,23 @@ void tst_qquicktextinput::signal_editingfinished() QTRY_COMPARE(input1->text(), QLatin1String("a")); QCOMPARE(input1->hasAcceptableInput(), false); QCOMPARE(input1->property("acceptable").toBool(), false); - QTRY_COMPARE(input1Spy.count(), 0); + QTRY_COMPARE(input1Spy.size(), 0); QTest::keyPress(&window, Qt::Key_Enter); QTest::keyRelease(&window, Qt::Key_Enter, Qt::NoModifier); - QTRY_COMPARE(editingFinished1Spy.count(), 0); + QTRY_COMPARE(editingFinished1Spy.size(), 0); QTest::keyPress(&window, Qt::Key_A); QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier); QTRY_COMPARE(input1->text(), QLatin1String("aa")); QCOMPARE(input1->hasAcceptableInput(), true); QCOMPARE(input1->property("acceptable").toBool(), true); - QTRY_COMPARE(input1Spy.count(), 1); + QTRY_COMPARE(input1Spy.size(), 1); QTest::keyPress(&window, Qt::Key_Enter); QTest::keyRelease(&window, Qt::Key_Enter, Qt::NoModifier); - QTRY_COMPARE(editingFinished1Spy.count(), 1); - QTRY_COMPARE(input1Spy.count(), 1); + QTRY_COMPARE(editingFinished1Spy.size(), 1); + QTRY_COMPARE(input1Spy.size(), 1); QSignalSpy editingFinished2Spy(input2, SIGNAL(editingFinished())); QSignalSpy input2Spy(input2, SIGNAL(acceptableInputChanged())); @@ -2399,19 +2399,19 @@ void tst_qquicktextinput::signal_editingfinished() QTRY_COMPARE(input2->text(), QLatin1String("a")); QCOMPARE(input2->hasAcceptableInput(), false); QCOMPARE(input2->property("acceptable").toBool(), false); - QTRY_COMPARE(input2Spy.count(), 0); + QTRY_COMPARE(input2Spy.size(), 0); QTest::keyPress(&window, Qt::Key_A); QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier); QTRY_COMPARE(input2->text(), QLatin1String("aa")); QCOMPARE(input2->hasAcceptableInput(), true); QCOMPARE(input2->property("acceptable").toBool(), true); - QTRY_COMPARE(input2Spy.count(), 1); + QTRY_COMPARE(input2Spy.size(), 1); input1->setFocus(true); QTRY_VERIFY(input1->hasActiveFocus()); QTRY_VERIFY(!input2->hasActiveFocus()); - QTRY_COMPARE(editingFinished2Spy.count(), 1); + QTRY_COMPARE(editingFinished2Spy.size(), 1); } void tst_qquicktextinput::signal_textEdited() @@ -2437,32 +2437,32 @@ void tst_qquicktextinput::signal_textEdited() int textEdits = 0; QTest::keyClick(&window, Qt::Key_A); - QCOMPARE(textChangedSpy.count(), ++textChanges); - QCOMPARE(textEditedSpy.count(), ++textEdits); + QCOMPARE(textChangedSpy.size(), ++textChanges); + QCOMPARE(textEditedSpy.size(), ++textEdits); QTest::keyClick(&window, Qt::Key_B); - QCOMPARE(textChangedSpy.count(), ++textChanges); - QCOMPARE(textEditedSpy.count(), ++textEdits); + QCOMPARE(textChangedSpy.size(), ++textChanges); + QCOMPARE(textEditedSpy.size(), ++textEdits); QTest::keyClick(&window, Qt::Key_C); - QCOMPARE(textChangedSpy.count(), ++textChanges); - QCOMPARE(textEditedSpy.count(), ++textEdits); + QCOMPARE(textChangedSpy.size(), ++textChanges); + QCOMPARE(textEditedSpy.size(), ++textEdits); QTest::keyClick(&window, Qt::Key_Space); - QCOMPARE(textChangedSpy.count(), ++textChanges); - QCOMPARE(textEditedSpy.count(), ++textEdits); + QCOMPARE(textChangedSpy.size(), ++textChanges); + QCOMPARE(textEditedSpy.size(), ++textEdits); QTest::keyClick(&window, Qt::Key_Backspace); - QCOMPARE(textChangedSpy.count(), ++textChanges); - QCOMPARE(textEditedSpy.count(), ++textEdits); + QCOMPARE(textChangedSpy.size(), ++textChanges); + QCOMPARE(textEditedSpy.size(), ++textEdits); input->clear(); - QCOMPARE(textChangedSpy.count(), ++textChanges); - QCOMPARE(textEditedSpy.count(), textEdits); + QCOMPARE(textChangedSpy.size(), ++textChanges); + QCOMPARE(textEditedSpy.size(), textEdits); input->setText("TextInput"); - QCOMPARE(textChangedSpy.count(), ++textChanges); - QCOMPARE(textEditedSpy.count(), textEdits); + QCOMPARE(textChangedSpy.size(), ++textChanges); + QCOMPARE(textEditedSpy.size(), textEdits); } /* @@ -2488,12 +2488,12 @@ void tst_qquicktextinput::navigation() QTest::keyClick(&window, Qt::Key_Right); QVERIFY(input->hasActiveFocus()); //QT-2944: If text is selected, ensure we deselect upon cursor motion - input->setCursorPosition(input->text().length()); - input->select(0,input->text().length()); + input->setCursorPosition(input->text().size()); + input->select(0,input->text().size()); QVERIFY(input->selectionStart() != input->selectionEnd()); QTest::keyClick(&window, Qt::Key_Right); QCOMPARE(input->selectionStart(), input->selectionEnd()); - QCOMPARE(input->selectionStart(), input->text().length()); + QCOMPARE(input->selectionStart(), input->text().size()); QVERIFY(input->hasActiveFocus()); QTest::keyClick(&window, Qt::Key_Right); QVERIFY(!input->hasActiveFocus()); @@ -2544,7 +2544,7 @@ void tst_qquicktextinput::navigation_RTL() QTest::keyClick(&window, Qt::Key_Left); QVERIFY(input->hasActiveFocus()); - input->setCursorPosition(input->text().length()); + input->setCursorPosition(input->text().size()); QVERIFY(input->hasActiveFocus()); // move off @@ -2569,16 +2569,16 @@ void tst_qquicktextinput::copyAndPaste() QVERIFY(textInput != nullptr); // copy and paste - QCOMPARE(textInput->text().length(), 12); - textInput->select(0, textInput->text().length()); + QCOMPARE(textInput->text().size(), 12); + textInput->select(0, textInput->text().size()); textInput->copy(); QCOMPARE(textInput->selectedText(), QString("Hello world!")); - QCOMPARE(textInput->selectedText().length(), 12); + QCOMPARE(textInput->selectedText().size(), 12); textInput->setCursorPosition(0); QTRY_VERIFY(textInput->canPaste()); textInput->paste(); QCOMPARE(textInput->text(), QString("Hello world!Hello world!")); - QCOMPARE(textInput->text().length(), 24); + QCOMPARE(textInput->text().size(), 24); // can paste QVERIFY(textInput->canPaste()); @@ -2586,7 +2586,7 @@ void tst_qquicktextinput::copyAndPaste() QVERIFY(!textInput->canPaste()); textInput->paste(); QCOMPARE(textInput->text(), QString("Hello world!Hello world!")); - QCOMPARE(textInput->text().length(), 24); + QCOMPARE(textInput->text().size(), 24); textInput->setReadOnly(false); QVERIFY(textInput->canPaste()); @@ -2608,10 +2608,10 @@ void tst_qquicktextinput::copyAndPaste() // select all and cut textInput->selectAll(); textInput->cut(); - QCOMPARE(textInput->text().length(), 0); + QCOMPARE(textInput->text().size(), 0); textInput->paste(); QCOMPARE(textInput->text(), QString("Hello world!Hello world!")); - QCOMPARE(textInput->text().length(), 24); + QCOMPARE(textInput->text().size(), 24); // Copy first word. textInput->setCursorPosition(0); @@ -2638,7 +2638,7 @@ void tst_qquicktextinput::copyAndPaste() QQuickTextInput::EchoMode echoMode = QQuickTextInput::EchoMode(index); textInput->setEchoMode(echoMode); textInput->setText("My password"); - textInput->select(0, textInput->text().length()); + textInput->select(0, textInput->text().size()); textInput->copy(); if (echoMode == QQuickTextInput::Normal) { QVERIFY(!clipboard->text().isEmpty()); @@ -2674,24 +2674,24 @@ void tst_qquicktextinput::copyAndPasteKeySequence() // copy and paste QVERIFY(textInput->hasActiveFocus()); - QCOMPARE(textInput->text().length(), 12); - textInput->select(0, textInput->text().length()); + QCOMPARE(textInput->text().size(), 12); + textInput->select(0, textInput->text().size()); simulateKeys(&window, QKeySequence::Copy); QCOMPARE(textInput->selectedText(), QString("Hello world!")); - QCOMPARE(textInput->selectedText().length(), 12); + QCOMPARE(textInput->selectedText().size(), 12); textInput->setCursorPosition(0); QVERIFY(textInput->canPaste()); simulateKeys(&window, QKeySequence::Paste); QCOMPARE(textInput->text(), QString("Hello world!Hello world!")); - QCOMPARE(textInput->text().length(), 24); + QCOMPARE(textInput->text().size(), 24); // select all and cut simulateKeys(&window, QKeySequence::SelectAll); simulateKeys(&window, QKeySequence::Cut); - QCOMPARE(textInput->text().length(), 0); + QCOMPARE(textInput->text().size(), 0); simulateKeys(&window, QKeySequence::Paste); QCOMPARE(textInput->text(), QString("Hello world!Hello world!")); - QCOMPARE(textInput->text().length(), 24); + QCOMPARE(textInput->text().size(), 24); // clear copy buffer QClipboard *clipboard = QGuiApplication::clipboard(); @@ -2706,7 +2706,7 @@ void tst_qquicktextinput::copyAndPasteKeySequence() QQuickTextInput::EchoMode echoMode = QQuickTextInput::EchoMode(index); textInput->setEchoMode(echoMode); textInput->setText("My password"); - textInput->select(0, textInput->text().length()); + textInput->select(0, textInput->text().size()); simulateKeys(&window, QKeySequence::Copy); if (echoMode == QQuickTextInput::Normal) { QVERIFY(!clipboard->text().isEmpty()); @@ -2733,7 +2733,7 @@ void tst_qquicktextinput::canPasteEmpty() QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); QVERIFY(textInput != nullptr); - bool cp = !textInput->isReadOnly() && QGuiApplication::clipboard()->text().length() != 0; + bool cp = !textInput->isReadOnly() && QGuiApplication::clipboard()->text().size() != 0; QCOMPARE(textInput->canPaste(), cp); } #endif @@ -2749,7 +2749,7 @@ void tst_qquicktextinput::canPaste() QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); QVERIFY(textInput != nullptr); - bool cp = !textInput->isReadOnly() && QGuiApplication::clipboard()->text().length() != 0; + bool cp = !textInput->isReadOnly() && QGuiApplication::clipboard()->text().size() != 0; QCOMPARE(textInput->canPaste(), cp); } #endif @@ -2792,7 +2792,7 @@ void tst_qquicktextinput::middleClickPaste() QTest::qWait(QGuiApplication::styleHints()->mouseDoubleClickInterval() + 10); if (QGuiApplication::clipboard()->supportsSelection()) - QCOMPARE(textInputObject->text().mid(1, selectedText.length()), selectedText); + QCOMPARE(textInputObject->text().mid(1, selectedText.size()), selectedText); else QCOMPARE(textInputObject->text(), originalText); } @@ -2844,7 +2844,7 @@ void tst_qquicktextinput::cursorDelegate() QVERIFY(delegateObject); QCOMPARE(delegateObject->property("localProperty").toString(), QString("Hello")); //Test Delegate gets moved - for (int i=0; i<= textInputObject->text().length(); i++) { + for (int i=0; i<= textInputObject->text().size(); i++) { textInputObject->setCursorPosition(i); QCOMPARE(textInputObject->cursorRectangle().x(), delegateObject->x()); QCOMPARE(textInputObject->cursorRectangle().y(), delegateObject->y()); @@ -2982,27 +2982,27 @@ void tst_qquicktextinput::cursorVisible() input.setCursorVisible(true); QCOMPARE(input.isCursorVisible(), true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); input.setCursorVisible(false); QCOMPARE(input.isCursorVisible(), false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); input.setFocus(true); QCOMPARE(input.isCursorVisible(), false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); input.setParentItem(view.rootObject()); QCOMPARE(input.isCursorVisible(), true); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); input.setFocus(false); QCOMPARE(input.isCursorVisible(), false); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); input.setFocus(true); QCOMPARE(input.isCursorVisible(), true); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); QQuickView alternateView; alternateView.show(); @@ -3010,12 +3010,12 @@ void tst_qquicktextinput::cursorVisible() QVERIFY(QTest::qWaitForWindowActive(&alternateView)); QCOMPARE(input.isCursorVisible(), false); - QCOMPARE(spy.count(), 6); + QCOMPARE(spy.size(), 6); view.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&view)); QCOMPARE(input.isCursorVisible(), true); - QCOMPARE(spy.count(), 7); + QCOMPARE(spy.size(), 7); { // Cursor attribute with 0 length hides cursor. QInputMethodEvent ev(QString(), QList<QInputMethodEvent::Attribute>() @@ -3023,7 +3023,7 @@ void tst_qquicktextinput::cursorVisible() QCoreApplication::sendEvent(&input, &ev); } QCOMPARE(input.isCursorVisible(), false); - QCOMPARE(spy.count(), 8); + QCOMPARE(spy.size(), 8); { // Cursor attribute with non zero length shows cursor. QInputMethodEvent ev(QString(), QList<QInputMethodEvent::Attribute>() @@ -3031,7 +3031,7 @@ void tst_qquicktextinput::cursorVisible() QCoreApplication::sendEvent(&input, &ev); } QCOMPARE(input.isCursorVisible(), true); - QCOMPARE(spy.count(), 9); + QCOMPARE(spy.size(), 9); { // If the cursor is hidden by the input method and the text is changed it should be visible again. QInputMethodEvent ev(QString(), QList<QInputMethodEvent::Attribute>() @@ -3039,11 +3039,11 @@ void tst_qquicktextinput::cursorVisible() QCoreApplication::sendEvent(&input, &ev); } QCOMPARE(input.isCursorVisible(), false); - QCOMPARE(spy.count(), 10); + QCOMPARE(spy.size(), 10); input.setText("something"); QCOMPARE(input.isCursorVisible(), true); - QCOMPARE(spy.count(), 11); + QCOMPARE(spy.size(), 11); { // If the cursor is hidden by the input method and the cursor position is changed it should be visible again. QInputMethodEvent ev(QString(), QList<QInputMethodEvent::Attribute>() @@ -3051,11 +3051,11 @@ void tst_qquicktextinput::cursorVisible() QCoreApplication::sendEvent(&input, &ev); } QCOMPARE(input.isCursorVisible(), false); - QCOMPARE(spy.count(), 12); + QCOMPARE(spy.size(), 12); input.setCursorPosition(5); QCOMPARE(input.isCursorVisible(), true); - QCOMPARE(spy.count(), 13); + QCOMPARE(spy.size(), 13); } void tst_qquicktextinput::cursorRectangle_data() @@ -3132,14 +3132,14 @@ void tst_qquicktextinput::cursorRectangle() // Check the cursor rectangle remains within the input bounding rect when auto scrolling. QCOMPARE(r.left(), leftToRight ? input.width() : 0); - for (int i = positionAtWidth + 1; i < text.length(); ++i) { + for (int i = positionAtWidth + 1; i < text.size(); ++i) { input.setCursorPosition(i); QCOMPARE(r, input.cursorRectangle()); COMPARE_INPUT_METHOD_QUERY(QRectF, (&input), Qt::ImCursorRectangle, toRectF, r); QCOMPARE(input.positionToRectangle(i), r); } - for (int i = text.length() - 2; i >= 0; --i) { + for (int i = text.size() - 2; i >= 0; --i) { input.setCursorPosition(i); r = input.cursorRectangle(); QCOMPARE(r.top(), 0.); @@ -3178,7 +3178,7 @@ void tst_qquicktextinput::cursorRectangle() COMPARE_INPUT_METHOD_QUERY(QRectF, (&input), Qt::ImCursorRectangle, toRectF, r); QCOMPARE(input.positionToRectangle(11), r); - for (int i = wrapPosition + 1; i < text.length(); ++i) { + for (int i = wrapPosition + 1; i < text.size(); ++i) { input.setCursorPosition(i); r = input.cursorRectangle(); QVERIFY(r.top() >= line.height() - 5); @@ -3219,7 +3219,7 @@ void tst_qquicktextinput::cursorRectangle() COMPARE_INPUT_METHOD_QUERY(QRectF, (&input), Qt::ImCursorRectangle, toRectF, r); QCOMPARE(input.positionToRectangle(11), r); - for (int i = wrapPosition + 1; i < text.length(); ++i) { + for (int i = wrapPosition + 1; i < text.size(); ++i) { input.setCursorPosition(i); r = input.cursorRectangle(); QVERIFY(r.bottom() >= input.height()); @@ -3227,7 +3227,7 @@ void tst_qquicktextinput::cursorRectangle() QCOMPARE(input.positionToRectangle(i), r); } - for (int i = text.length() - 2; i >= wrapPosition; --i) { + for (int i = text.size() - 2; i >= wrapPosition; --i) { input.setCursorPosition(i); r = input.cursorRectangle(); QVERIFY(r.bottom() >= input.height()); @@ -3268,7 +3268,7 @@ void tst_qquicktextinput::cursorRectangle() widerText[1] = 'W'; // Assumes shortText is at least two characters long. input.setText(widerText); - QCOMPARE(cursorRectangleSpy.count(), 1); + QCOMPARE(cursorRectangleSpy.size(), 1); } void tst_qquicktextinput::readOnly() @@ -3296,7 +3296,7 @@ void tst_qquicktextinput::readOnly() input->setCursorPosition(3); input->setReadOnly(false); QCOMPARE(input->isReadOnly(), false); - QCOMPARE(input->cursorPosition(), input->text().length()); + QCOMPARE(input->cursorPosition(), input->text().size()); QVERIFY(input->isCursorVisible()); } @@ -3418,7 +3418,7 @@ void tst_qquicktextinput::passwordEchoDelay() QSignalSpy cursorSpy(input, SIGNAL(cursorRectangleChanged())); QTest::qWait(maskDelay); QTRY_COMPARE(input->displayText(), QString(5, fillChar)); - QCOMPARE(cursorSpy.count(), 1); + QCOMPARE(cursorSpy.size(), 1); QCOMPARE(input->cursorRectangle().topLeft(), cursor->position()); QTest::keyPress(&window, '5'); @@ -3469,7 +3469,7 @@ void tst_qquicktextinput::focusOnPress() textInputObject->setFocusOnPress(true); QCOMPARE(textInputObject->focusOnPress(), true); - QCOMPARE(activeFocusOnPressSpy.count(), 0); + QCOMPARE(activeFocusOnPressSpy.size(), 0); QQuickWindow window; window.resize(100, 50); @@ -3486,20 +3486,20 @@ void tst_qquicktextinput::focusOnPress() QGuiApplication::processEvents(); QCOMPARE(textInputObject->hasFocus(), true); QCOMPARE(textInputObject->hasActiveFocus(), true); - QCOMPARE(focusSpy.count(), 1); - QCOMPARE(activeFocusSpy.count(), 1); + QCOMPARE(focusSpy.size(), 1); + QCOMPARE(activeFocusSpy.size(), 1); QCOMPARE(textInputObject->selectedText(), QString()); QTest::mouseRelease(&window, Qt::LeftButton, noModifiers); textInputObject->setFocusOnPress(false); QCOMPARE(textInputObject->focusOnPress(), false); - QCOMPARE(activeFocusOnPressSpy.count(), 1); + QCOMPARE(activeFocusOnPressSpy.size(), 1); textInputObject->setFocus(false); QCOMPARE(textInputObject->hasFocus(), false); QCOMPARE(textInputObject->hasActiveFocus(), false); - QCOMPARE(focusSpy.count(), 2); - QCOMPARE(activeFocusSpy.count(), 2); + QCOMPARE(focusSpy.size(), 2); + QCOMPARE(activeFocusSpy.size(), 2); // Wait for double click timeout to expire before clicking again. QTest::qWait(400); @@ -3507,13 +3507,13 @@ void tst_qquicktextinput::focusOnPress() QGuiApplication::processEvents(); QCOMPARE(textInputObject->hasFocus(), false); QCOMPARE(textInputObject->hasActiveFocus(), false); - QCOMPARE(focusSpy.count(), 2); - QCOMPARE(activeFocusSpy.count(), 2); + QCOMPARE(focusSpy.size(), 2); + QCOMPARE(activeFocusSpy.size(), 2); QTest::mouseRelease(&window, Qt::LeftButton, noModifiers); textInputObject->setFocusOnPress(true); QCOMPARE(textInputObject->focusOnPress(), true); - QCOMPARE(activeFocusOnPressSpy.count(), 2); + QCOMPARE(activeFocusOnPressSpy.size(), 2); // Test a selection made in the on(Active)FocusChanged handler isn't overwritten. textInputObject->setProperty("selectOnFocus", true); @@ -3523,8 +3523,8 @@ void tst_qquicktextinput::focusOnPress() QGuiApplication::processEvents(); QCOMPARE(textInputObject->hasFocus(), true); QCOMPARE(textInputObject->hasActiveFocus(), true); - QCOMPARE(focusSpy.count(), 3); - QCOMPARE(activeFocusSpy.count(), 3); + QCOMPARE(focusSpy.size(), 3); + QCOMPARE(activeFocusSpy.size(), 3); QCOMPARE(textInputObject->selectedText(), textInputObject->text()); QTest::mouseRelease(&window, Qt::LeftButton, noModifiers); } @@ -3615,7 +3615,7 @@ void tst_qquicktextinput::openInputPanel() anotherInput.setFocus(true); QCOMPARE(qApp->inputMethod()->isVisible(), true); QCOMPARE(qApp->focusObject(), qobject_cast<QObject*>(&anotherInput)); - QCOMPARE(inputPanelVisibilitySpy.count(), 0); + QCOMPARE(inputPanelVisibilitySpy.size(), 0); anotherInput.setFocus(false); QVERIFY(qApp->focusObject() != &anotherInput); @@ -3764,18 +3764,18 @@ void tst_qquicktextinput::contentSize() QVERIFY(textObject->contentWidth() > textObject->width()); QVERIFY(textObject->contentHeight() < textObject->height()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); textObject->setWrapMode(QQuickTextInput::WordWrap); QVERIFY(textObject->contentWidth() <= textObject->width()); QVERIFY(textObject->contentHeight() > textObject->height()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); textObject->setText("The quickredfoxjumpedoverthe lazy brown dog"); QVERIFY(textObject->contentWidth() > textObject->width()); QVERIFY(textObject->contentHeight() > textObject->height()); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); textObject->setText("The quick red fox jumped over the lazy brown dog"); for (int w = 60; w < 120; ++w) { @@ -3788,7 +3788,7 @@ void tst_qquicktextinput::contentSize() static void sendPreeditText(QQuickItem *item, const QString &text, int cursor) { QInputMethodEvent event(text, QList<QInputMethodEvent::Attribute>() - << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, cursor, text.length(), QVariant())); + << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, cursor, text.size(), QVariant())); QCoreApplication::sendEvent(item, &event); } @@ -3813,14 +3813,14 @@ void tst_qquicktextinput::preeditAutoScroll() sendPreeditText(input, preeditText.mid(0, 3), 1); QVERIFY(evaluate<int>(input, QString("positionAt(0)")) != 0); QVERIFY(input->cursorRectangle().left() < input->boundingRect().width()); - QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges); + QCOMPARE(cursorRectangleSpy.size(), ++cursorRectangleChanges); // test the text is scrolled back when the preedit is removed. QInputMethodEvent imEvent; QCoreApplication::sendEvent(input, &imEvent); QCOMPARE(evaluate<int>(input, QString("positionAt(%1)").arg(0)), 0); QCOMPARE(evaluate<int>(input, QString("positionAt(%1)").arg(input->width())), 5); - QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges); + QCOMPARE(cursorRectangleSpy.size(), ++cursorRectangleChanges); QTextLayout layout(preeditText); layout.setFont(input->font()); @@ -3841,7 +3841,7 @@ void tst_qquicktextinput::preeditAutoScroll() int width = ceil(line.cursorToX(i, QTextLine::Trailing)) - floor(line.cursorToX(i)); QVERIFY(input->cursorRectangle().right() >= width - 3); QVERIFY(input->positionToRectangle(0).x() < x); - QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges); + QCOMPARE(cursorRectangleSpy.size(), ++cursorRectangleChanges); x = input->positionToRectangle(0).x(); } for (int i = 1; i >= 0; --i) { @@ -3849,24 +3849,24 @@ void tst_qquicktextinput::preeditAutoScroll() int width = ceil(line.cursorToX(i, QTextLine::Trailing)) - floor(line.cursorToX(i)); QVERIFY(input->cursorRectangle().right() >= width - 3); QVERIFY(input->positionToRectangle(0).x() > x); - QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges); + QCOMPARE(cursorRectangleSpy.size(), ++cursorRectangleChanges); x = input->positionToRectangle(0).x(); } // Test incrementing the preedit cursor doesn't cause further // scrolling when right most text is visible. - sendPreeditText(input, preeditText, preeditText.length() - 3); - QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges); + sendPreeditText(input, preeditText, preeditText.size() - 3); + QCOMPARE(cursorRectangleSpy.size(), ++cursorRectangleChanges); x = input->positionToRectangle(0).x(); for (int i = 2; i >= 0; --i) { - sendPreeditText(input, preeditText, preeditText.length() - i); + sendPreeditText(input, preeditText, preeditText.size() - i); QCOMPARE(input->positionToRectangle(0).x(), x); - QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges); + QCOMPARE(cursorRectangleSpy.size(), ++cursorRectangleChanges); } for (int i = 1; i < 3; ++i) { - sendPreeditText(input, preeditText, preeditText.length() - i); + sendPreeditText(input, preeditText, preeditText.size() - i); QCOMPARE(input->positionToRectangle(0).x(), x); - QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges); + QCOMPARE(cursorRectangleSpy.size(), ++cursorRectangleChanges); } // Test disabling auto scroll. @@ -3920,8 +3920,8 @@ void tst_qquicktextinput::preeditCursorRectangle() QVERIFY(previousRect.left() < currentRect.left()); QCOMPARE(input->cursorRectangle(), currentRect); QCOMPARE(cursor->position(), currentRect.topLeft()); - QVERIFY(inputSpy.count() > 0); inputSpy.clear(); - QVERIFY(panelSpy.count() > 0); panelSpy.clear(); + QVERIFY(inputSpy.size() > 0); inputSpy.clear(); + QVERIFY(panelSpy.size() > 0); panelSpy.clear(); previousRect = currentRect; } @@ -3934,8 +3934,8 @@ void tst_qquicktextinput::preeditCursorRectangle() currentRect = query.value(Qt::ImCursorRectangle).toRectF(); QCOMPARE(input->cursorRectangle(), currentRect); QCOMPARE(cursor->position(), currentRect.topLeft()); - QCOMPARE(inputSpy.count(), 1); - QCOMPARE(panelSpy.count(), 1); + QCOMPARE(inputSpy.size(), 1); + QCOMPARE(panelSpy.size(), 1); // Verify that if there is no preedit cursor then the micro focus rect is the // same as it would be if it were positioned at the end of the preedit text. @@ -3948,8 +3948,8 @@ void tst_qquicktextinput::preeditCursorRectangle() QCOMPARE(currentRect, previousRect); QCOMPARE(input->cursorRectangle(), currentRect); QCOMPARE(cursor->position(), currentRect.topLeft()); - QCOMPARE(inputSpy.count(), 1); - QCOMPARE(panelSpy.count(), 1); + QCOMPARE(inputSpy.size(), 1); + QCOMPARE(panelSpy.size(), 1); } void tst_qquicktextinput::inputContextMouseHandler() @@ -4016,37 +4016,37 @@ void tst_qquicktextinput::inputMethodComposing() QGuiApplication::sendEvent(input, &event); } QCOMPARE(input->isInputMethodComposing(), true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); { QInputMethodEvent event(text.mid(12), QList<QInputMethodEvent::Attribute>()); QGuiApplication::sendEvent(input, &event); } - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); { QInputMethodEvent event; QGuiApplication::sendEvent(input, &event); } QCOMPARE(input->isInputMethodComposing(), false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); // Changing the text while not composing doesn't alter the composing state. input->setText(text.mid(0, 16)); QCOMPARE(input->isInputMethodComposing(), false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); { QInputMethodEvent event(text.mid(16), QList<QInputMethodEvent::Attribute>()); QGuiApplication::sendEvent(input, &event); } QCOMPARE(input->isInputMethodComposing(), true); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); // Changing the text while composing cancels composition. input->setText(text.mid(0, 12)); QCOMPARE(input->isInputMethodComposing(), false); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); { // Preedit cursor positioned outside (empty) preedit; composing. QInputMethodEvent event(QString(), QList<QInputMethodEvent::Attribute>() @@ -4054,7 +4054,7 @@ void tst_qquicktextinput::inputMethodComposing() QGuiApplication::sendEvent(input, &event); } QCOMPARE(input->isInputMethodComposing(), true); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); { // Cursor hidden; composing @@ -4063,7 +4063,7 @@ void tst_qquicktextinput::inputMethodComposing() QGuiApplication::sendEvent(input, &event); } QCOMPARE(input->isInputMethodComposing(), true); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); { // Default cursor attributes; composing. QInputMethodEvent event(QString(), QList<QInputMethodEvent::Attribute>() @@ -4071,7 +4071,7 @@ void tst_qquicktextinput::inputMethodComposing() QGuiApplication::sendEvent(input, &event); } QCOMPARE(input->isInputMethodComposing(), true); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); { // Selections are persisted: not composing QInputMethodEvent event(QString(), QList<QInputMethodEvent::Attribute>() @@ -4079,7 +4079,7 @@ void tst_qquicktextinput::inputMethodComposing() QGuiApplication::sendEvent(input, &event); } QCOMPARE(input->isInputMethodComposing(), false); - QCOMPARE(spy.count(), 6); + QCOMPARE(spy.size(), 6); input->setCursorPosition(12); @@ -4091,14 +4091,14 @@ void tst_qquicktextinput::inputMethodComposing() QGuiApplication::sendEvent(input, &event); } QCOMPARE(input->isInputMethodComposing(), true); - QCOMPARE(spy.count(), 7); + QCOMPARE(spy.size(), 7); { QInputMethodEvent event; QGuiApplication::sendEvent(input, &event); } QCOMPARE(input->isInputMethodComposing(), false); - QCOMPARE(spy.count(), 8); + QCOMPARE(spy.size(), 8); } void tst_qquicktextinput::inputMethodUpdate() @@ -4285,7 +4285,7 @@ void tst_qquicktextinput::getText_data() QTest::newRow("all plain text") << standard.at(0) << QString() - << 0 << standard.at(0).length() + << 0 << standard.at(0).size() << standard.at(0); QTest::newRow("plain text sub string") @@ -4309,13 +4309,13 @@ void tst_qquicktextinput::getText_data() QTest::newRow("plain text cropped end") << standard.at(0) << QString() - << 23 << standard.at(0).length() + 8 + << 23 << standard.at(0).size() + 8 << standard.at(0).mid(23); QTest::newRow("plain text cropped beginning and end") << standard.at(0) << QString() - << -9 << standard.at(0).length() + 4 + << -9 << standard.at(0).size() + 4 << standard.at(0); } @@ -4363,10 +4363,10 @@ void tst_qquicktextinput::insert_data() QTest::newRow("at cursor position (end)") << standard.at(0) << QString() - << standard.at(0).length() << standard.at(0).length() << standard.at(0).length() + << standard.at(0).size() << standard.at(0).size() << standard.at(0).size() << QString("Hello") << standard.at(0) + QString("Hello") - << standard.at(0).length() + 5 << standard.at(0).length() + 5 << standard.at(0).length() + 5 + << standard.at(0).size() + 5 << standard.at(0).size() + 5 << standard.at(0).size() + 5 << false << true; QTest::newRow("at cursor position (middle)") @@ -4390,10 +4390,10 @@ void tst_qquicktextinput::insert_data() QTest::newRow("before cursor position (end)") << standard.at(0) << QString() - << standard.at(0).length() << standard.at(0).length() << 18 + << standard.at(0).size() << standard.at(0).size() << 18 << QString("Hello") << standard.at(0).mid(0, 18) + QString("Hello") + standard.at(0).mid(18) - << standard.at(0).length() + 5 << standard.at(0).length() + 5 << standard.at(0).length() + 5 + << standard.at(0).size() + 5 << standard.at(0).size() + 5 << standard.at(0).size() + 5 << false << true; QTest::newRow("before cursor position (middle)") @@ -4408,7 +4408,7 @@ void tst_qquicktextinput::insert_data() QTest::newRow("after cursor position (middle)") << standard.at(0) << QString() - << 18 << 18 << standard.at(0).length() + << 18 << 18 << standard.at(0).size() << QString("Hello") << standard.at(0) + QString("Hello") << 18 << 18 << 18 @@ -4435,7 +4435,7 @@ void tst_qquicktextinput::insert_data() QTest::newRow("after selection") << standard.at(0) << QString() - << 14 << 19 << standard.at(0).length() + << 14 << 19 << standard.at(0).size() << QString("Hello") << standard.at(0) + QString("Hello") << 14 << 19 << 19 @@ -4444,7 +4444,7 @@ void tst_qquicktextinput::insert_data() QTest::newRow("after reversed selection") << standard.at(0) << QString() - << 19 << 14 << standard.at(0).length() + << 19 << 14 << standard.at(0).size() << QString("Hello") << standard.at(0) + QString("Hello") << 14 << 19 << 14 @@ -4489,7 +4489,7 @@ void tst_qquicktextinput::insert_data() QTest::newRow("past end") << standard.at(0) << QString() - << 0 << 0 << standard.at(0).length() + 3 + << 0 << 0 << standard.at(0).size() + 3 << QString("Hello") << standard.at(0) << 0 << 0 << 0 @@ -4510,10 +4510,10 @@ void tst_qquicktextinput::insert_data() QTest::newRow("mask: at cursor position (end)") << ip << inputMask - << inputMask.length() << inputMask.length() << inputMask.length() + << inputMask.size() << inputMask.size() << inputMask.size() << QString("8") << ip - << inputMask.length() << inputMask.length() << inputMask.length() + << inputMask.size() << inputMask.size() << inputMask.size() << false << false; QTest::newRow("mask: at cursor position (middle)") @@ -4537,10 +4537,10 @@ void tst_qquicktextinput::insert_data() QTest::newRow("mask: before cursor position (end)") << ip << inputMask - << inputMask.length() << inputMask.length() << 6 + << inputMask.size() << inputMask.size() << 6 << QString("75.2") << QString("192.167.5.24") - << inputMask.length() << inputMask.length() << inputMask.length() + << inputMask.size() << inputMask.size() << inputMask.size() << false << false; QTest::newRow("mask: before cursor position (middle)") @@ -4627,7 +4627,7 @@ void tst_qquicktextinput::insert_data() QTest::newRow("mask: past end") << ip << inputMask - << 0 << 0 << ip.length() + 3 + << 0 << 0 << ip.size() + 3 << QString("4") << ip << 0 << 0 << 0 @@ -4684,7 +4684,7 @@ void tst_qquicktextinput::insert() textInput->insert(insertPosition, insertText); QCOMPARE(textInput->text(), expectedText); - QCOMPARE(textInput->length(), inputMask.isEmpty() ? expectedText.length() : inputMask.length()); + QCOMPARE(textInput->length(), inputMask.isEmpty() ? expectedText.size() : inputMask.size()); QCOMPARE(textInput->selectionStart(), expectedSelectionStart); QCOMPARE(textInput->selectionEnd(), expectedSelectionEnd); @@ -4693,11 +4693,11 @@ void tst_qquicktextinput::insert() if (selectionStart > selectionEnd) qSwap(selectionStart, selectionEnd); - QCOMPARE(selectionSpy.count() > 0, selectionChanged); - QCOMPARE(selectionStartSpy.count() > 0, selectionStart != expectedSelectionStart); - QCOMPARE(selectionEndSpy.count() > 0, selectionEnd != expectedSelectionEnd); - QCOMPARE(textSpy.count() > 0, text != expectedText); - QCOMPARE(cursorPositionSpy.count() > 0, cursorPositionChanged); + QCOMPARE(selectionSpy.size() > 0, selectionChanged); + QCOMPARE(selectionStartSpy.size() > 0, selectionStart != expectedSelectionStart); + QCOMPARE(selectionEndSpy.size() > 0, selectionEnd != expectedSelectionEnd); + QCOMPARE(textSpy.size() > 0, text != expectedText); + QCOMPARE(cursorPositionSpy.size() > 0, cursorPositionChanged); } void tst_qquicktextinput::remove_data() @@ -4736,19 +4736,19 @@ void tst_qquicktextinput::remove_data() QTest::newRow("to cursor position (end)") << standard.at(0) << QString() - << standard.at(0).length() << standard.at(0).length() - << standard.at(0).length() << standard.at(0).length() - 5 - << standard.at(0).mid(0, standard.at(0).length() - 5) - << standard.at(0).length() - 5 << standard.at(0).length() - 5 << standard.at(0).length() - 5 + << standard.at(0).size() << standard.at(0).size() + << standard.at(0).size() << standard.at(0).size() - 5 + << standard.at(0).mid(0, standard.at(0).size() - 5) + << standard.at(0).size() - 5 << standard.at(0).size() - 5 << standard.at(0).size() - 5 << false << true; QTest::newRow("to cursor position (end)") << standard.at(0) << QString() - << standard.at(0).length() << standard.at(0).length() - << standard.at(0).length() - 5 << standard.at(0).length() - << standard.at(0).mid(0, standard.at(0).length() - 5) - << standard.at(0).length() - 5 << standard.at(0).length() - 5 << standard.at(0).length() - 5 + << standard.at(0).size() << standard.at(0).size() + << standard.at(0).size() - 5 << standard.at(0).size() + << standard.at(0).mid(0, standard.at(0).size() - 5) + << standard.at(0).size() - 5 << standard.at(0).size() - 5 << standard.at(0).size() - 5 << false << true; QTest::newRow("from cursor position (middle)") @@ -4781,10 +4781,10 @@ void tst_qquicktextinput::remove_data() QTest::newRow("before cursor position (end)") << standard.at(0) << QString() - << standard.at(0).length() << standard.at(0).length() + << standard.at(0).size() << standard.at(0).size() << 18 << 23 << standard.at(0).mid(0, 18) + standard.at(0).mid(23) - << standard.at(0).length() - 5 << standard.at(0).length() - 5 << standard.at(0).length() - 5 + << standard.at(0).size() - 5 << standard.at(0).size() - 5 << standard.at(0).size() - 5 << false << true; QTest::newRow("before cursor position (middle)") @@ -4827,8 +4827,8 @@ void tst_qquicktextinput::remove_data() << standard.at(0) << QString() << 14 << 19 - << standard.at(0).length() - 5 << standard.at(0).length() - << standard.at(0).mid(0, standard.at(0).length() - 5) + << standard.at(0).size() - 5 << standard.at(0).size() + << standard.at(0).mid(0, standard.at(0).size() - 5) << 14 << 19 << 19 << false << false; @@ -4836,8 +4836,8 @@ void tst_qquicktextinput::remove_data() << standard.at(0) << QString() << 19 << 14 - << standard.at(0).length() - 5 << standard.at(0).length() - << standard.at(0).mid(0, standard.at(0).length() - 5) + << standard.at(0).size() - 5 << standard.at(0).size() + << standard.at(0).mid(0, standard.at(0).size() - 5) << 14 << 19 << 14 << false << false; @@ -4872,7 +4872,7 @@ void tst_qquicktextinput::remove_data() << standard.at(0) << QString() << 0 << 0 - << 23 << standard.at(0).length() + 8 + << 23 << standard.at(0).size() + 8 << standard.at(0).mid(0, 23) << 0 << 0 << 0 << false << false; @@ -4881,7 +4881,7 @@ void tst_qquicktextinput::remove_data() << standard.at(0) << QString() << 0 << 0 - << -9 << standard.at(0).length() + 4 + << -9 << standard.at(0).size() + 4 << QString() << 0 << 0 << 0 << false << false; @@ -5039,7 +5039,7 @@ void tst_qquicktextinput::remove() textInput->remove(removeStart, removeEnd); QCOMPARE(textInput->text(), expectedText); - QCOMPARE(textInput->length(), inputMask.isEmpty() ? expectedText.length() : inputMask.length()); + QCOMPARE(textInput->length(), inputMask.isEmpty() ? expectedText.size() : inputMask.size()); if (selectionStart > selectionEnd) // qSwap(selectionStart, selectionEnd); @@ -5048,13 +5048,13 @@ void tst_qquicktextinput::remove() QCOMPARE(textInput->selectionEnd(), expectedSelectionEnd); QCOMPARE(textInput->cursorPosition(), expectedCursorPosition); - QCOMPARE(selectionSpy.count() > 0, selectionChanged); - QCOMPARE(selectionStartSpy.count() > 0, selectionStart != expectedSelectionStart); - QCOMPARE(selectionEndSpy.count() > 0, selectionEnd != expectedSelectionEnd); - QCOMPARE(textSpy.count() > 0, text != expectedText); + QCOMPARE(selectionSpy.size() > 0, selectionChanged); + QCOMPARE(selectionStartSpy.size() > 0, selectionStart != expectedSelectionStart); + QCOMPARE(selectionEndSpy.size() > 0, selectionEnd != expectedSelectionEnd); + QCOMPARE(textSpy.size() > 0, text != expectedText); if (cursorPositionChanged) // - QVERIFY(cursorPositionSpy.count() > 0); + QVERIFY(cursorPositionSpy.size() > 0); } #if QT_CONFIG(shortcut) @@ -5414,11 +5414,11 @@ void tst_qquicktextinput::undo() // QTest::keyClick(testWidget, Qt::Key_End, Qt::ShiftModifier); } - for (int j = 0; j < insertString.at(i).length(); j++) + for (int j = 0; j < insertString.at(i).size(); j++) QTest::keyClick(&window, insertString.at(i).at(j).toLatin1()); } - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // STEP 2: Next call undo several times and see if we can restore to the previous state for (i = 0; i < expectedString.size() - 1; ++i) { @@ -5430,7 +5430,7 @@ void tst_qquicktextinput::undo() // STEP 3: Verify that we have undone everything QVERIFY(textInput->text().isEmpty()); QVERIFY(!textInput->canUndo()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_qquicktextinput::redo_data() @@ -5491,13 +5491,13 @@ void tst_qquicktextinput::redo() for (i = 0; i < insertString.size(); ++i) { if (insertIndex[i] > -1) textInput->setCursorPosition(insertIndex[i]); - for (int j = 0; j < insertString.at(i).length(); j++) + for (int j = 0; j < insertString.at(i).size(); j++) QTest::keyClick(&window, insertString.at(i).at(j).toLatin1()); QVERIFY(textInput->canUndo()); QVERIFY(!textInput->canRedo()); } - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); // undo everything while (!textInput->text().isEmpty()) { @@ -5506,7 +5506,7 @@ void tst_qquicktextinput::redo() QVERIFY(textInput->canRedo()); } - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); for (i = 0; i < expectedString.size(); ++i) { QVERIFY(textInput->canRedo()); @@ -5515,7 +5515,7 @@ void tst_qquicktextinput::redo() QVERIFY(textInput->canUndo()); } QVERIFY(!textInput->canRedo()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } #if QT_CONFIG(shortcut) @@ -5849,12 +5849,12 @@ void tst_qquicktextinput::clear() textInput->clear(); QVERIFY(textInput->text().isEmpty()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // checks that clears can be undone textInput->undo(); QVERIFY(!textInput->canUndo()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QCOMPARE(textInput->text(), QString("I am Legend")); textInput->setCursorPosition(4); @@ -5868,12 +5868,12 @@ void tst_qquicktextinput::clear() QVERIFY(textInput->text().isEmpty()); QVERIFY2(textInput->preeditText().isEmpty(), "Pre-edit text must be empty after clear"); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); // checks that clears can be undone textInput->undo(); QVERIFY(!textInput->canUndo()); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); QCOMPARE(textInput->text(), QString("I am Legend")); QVERIFY2(textInput->preeditText().isEmpty(), "Pre-edit text must be empty after undo"); } @@ -5890,7 +5890,7 @@ void tst_qquicktextinput::backspaceSurrogatePairs() QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); QVERIFY(textInput != nullptr); textInput->setText(text); - textInput->setCursorPosition(text.length()); + textInput->setCursorPosition(text.size()); QQuickWindow window; textInput->setParentItem(window.contentItem()); @@ -5899,7 +5899,7 @@ void tst_qquicktextinput::backspaceSurrogatePairs() QVERIFY(QTest::qWaitForWindowActive(&window)); QCOMPARE(QGuiApplication::focusWindow(), &window); - for (int i = text.length(); i >= 0; i -= 2) { + for (int i = text.size(); i >= 0; i -= 2) { QCOMPARE(textInput->text(), text.mid(0, i)); QTest::keyClick(&window, Qt::Key_Backspace, Qt::NoModifier); } @@ -5908,7 +5908,7 @@ void tst_qquicktextinput::backspaceSurrogatePairs() textInput->setText(text); textInput->setCursorPosition(0); - for (int i = 0; i < text.length(); i += 2) { + for (int i = 0; i < text.size(); i += 2) { QCOMPARE(textInput->text(), text.mid(i)); QTest::keyClick(&window, Qt::Key_Delete, Qt::NoModifier); } @@ -6397,7 +6397,7 @@ void tst_qquicktextinput::setInputMask() unescapedMask.replace(QLatin1String("\\\\"), QLatin1String("\\")); // simple unescape QSignalSpy spy(textInput, SIGNAL(inputMaskChanged(const QString &))); textInput->setInputMask(unescapedMask); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); // then either insert using insert() or keyboard if (insert_text) { @@ -6411,7 +6411,7 @@ void tst_qquicktextinput::setInputMask() QVERIFY(textInput->hasActiveFocus()); QTest::keyClick(&window, Qt::Key_Home); - for (int i = 0; i < input.length(); i++) + for (int i = 0; i < input.size(); i++) QTest::keyClick(&window, input.at(i).toLatin1()); } @@ -6891,7 +6891,7 @@ void tst_qquicktextinput::ensureVisible() input->ensureVisible(input->length()); - QCOMPARE(cursorSpy.count(), 1); + QCOMPARE(cursorSpy.size(), 1); QCOMPARE(input->boundingRect().x(), input->width() - line.naturalTextWidth()); QCOMPARE(input->boundingRect().y(), qreal(0)); @@ -7167,13 +7167,13 @@ void tst_qquicktextinput::touchscreenSetsFocusAndMovesCursor() QQuickTouchUtils::flush(&window); QCOMPARE(qApp->focusObject(), bottom); // text cursor is at the end by default, on press - const auto len = bottom->text().length(); + const auto len = bottom->text().size(); QCOMPARE(bottom->cursorPosition(), len); // so typing a character appends it QVERIFY(!bottom->text().endsWith('q')); QTest::keyClick(&window, Qt::Key_Q); QVERIFY(bottom->text().endsWith('q')); - QCOMPARE(bottom->text().length(), len + 1); + QCOMPARE(bottom->text().size(), len + 1); QTest::touchEvent(&window, touchscreen.data()).release(0, QPoint(x1,y), &window); QQuickTouchUtils::flush(&window); // the cursor gets moved on release, as long as TextInput's grab wasn't stolen (e.g. by Flickable) diff --git a/tests/auto/quick/qquicktreeview/testmodel.cpp b/tests/auto/quick/qquicktreeview/testmodel.cpp index 50e326e108..92ad16bd83 100644 --- a/tests/auto/quick/qquicktreeview/testmodel.cpp +++ b/tests/auto/quick/qquicktreeview/testmodel.cpp @@ -54,7 +54,7 @@ int TestModel::rowCount(const QModelIndex &parent) const { if (!parent.isValid()) return 1; // root of the tree - return treeItem(parent)->m_childItems.count(); + return treeItem(parent)->m_childItems.size(); } int TestModel::columnCount(const QModelIndex &) const diff --git a/tests/auto/quick/qquicktreeview/tst_qquicktreeview.cpp b/tests/auto/quick/qquicktreeview/tst_qquicktreeview.cpp index 1a775ed3c7..9b34011c2e 100644 --- a/tests/auto/quick/qquicktreeview/tst_qquicktreeview.cpp +++ b/tests/auto/quick/qquicktreeview/tst_qquicktreeview.cpp @@ -136,7 +136,7 @@ void tst_qquicktreeview::expandAndCollapseRoot() // Expand the root treeView->expand(0); - QCOMPARE(expandedSpy.count(), 1); + QCOMPARE(expandedSpy.size(), 1); auto signalArgs = expandedSpy.takeFirst(); QVERIFY(signalArgs.at(0).toInt() == 0); QVERIFY(signalArgs.at(1).toInt() == 1); @@ -186,7 +186,7 @@ void tst_qquicktreeview::expandAndCollapseChildren() treeView->expand(nodeToExpand); - QCOMPARE(expandedSpy.count(), 1); + QCOMPARE(expandedSpy.size(), 1); auto signalArgs = expandedSpy.takeFirst(); QVERIFY(signalArgs.at(0).toInt() == nodeToExpand); QVERIFY(signalArgs.at(1).toInt() == 1); @@ -310,7 +310,7 @@ void tst_qquicktreeview::emptyModel() treeView->setModel(QVariant()); WAIT_UNTIL_POLISHED; - QCOMPARE(treeViewPrivate->loadedItems.count(), 0); + QCOMPARE(treeViewPrivate->loadedItems.size(), 0); QCOMPARE(treeView->rows(), 0); QCOMPARE(treeView->columns(), 0); @@ -431,10 +431,10 @@ void tst_qquicktreeview::expandRecursivelyRoot() treeView->expandRecursively(rowToExpand, depth); if (depth == 0) { - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } else { - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); const auto signalArgs = spy.takeFirst(); QVERIFY(signalArgs.at(0).toInt() == rowToExpand); QVERIFY(signalArgs.at(1).toInt() == depth); @@ -487,7 +487,7 @@ void tst_qquicktreeview::expandRecursivelyChild() treeView->expand(0); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); auto signalArgs = spy.takeFirst(); QVERIFY(signalArgs.at(0).toInt() == 0); QVERIFY(signalArgs.at(1).toInt() == 1); @@ -495,9 +495,9 @@ void tst_qquicktreeview::expandRecursivelyChild() treeView->expandRecursively(rowToExpand, depth); if (depth == 0) { - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } else { - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); signalArgs = spy.takeFirst(); QVERIFY(signalArgs.at(0).toInt() == rowToExpand); QVERIFY(signalArgs.at(1).toInt() == depth); @@ -538,7 +538,7 @@ void tst_qquicktreeview::expandRecursivelyWholeTree() QSignalSpy spy(treeView, SIGNAL(expanded(int, int))); treeView->expandRecursively(-1, -1); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); auto signalArgs = spy.takeFirst(); QVERIFY(signalArgs.at(0).toInt() == -1); QVERIFY(signalArgs.at(1).toInt() == -1); @@ -570,7 +570,7 @@ void tst_qquicktreeview::collapseRecursivelyRoot() // Collapse the whole tree again. This time, only the root should end up visible treeView->collapseRecursively(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); const auto signalArgs = spy.takeFirst(); QVERIFY(signalArgs.at(0).toInt() == -1); QVERIFY(signalArgs.at(1).toBool() == true); @@ -617,7 +617,7 @@ void tst_qquicktreeview::collapseRecursivelyChild() QCOMPARE(model->data(treeView->modelIndex(0, rowToCollapse), Qt::DisplayRole), QStringLiteral("3, 0")); treeView->collapseRecursively(rowToCollapse); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); const auto signalArgs = spy.takeFirst(); QVERIFY(signalArgs.at(0).toInt() == rowToCollapse); QVERIFY(signalArgs.at(1).toBool() == true); @@ -653,7 +653,7 @@ void tst_qquicktreeview::collapseRecursivelyWholeTree() treeView->expandRecursively(); treeView->collapseRecursively(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); auto signalArgs = spy.takeFirst(); QVERIFY(signalArgs.at(0).toInt() == -1); QVERIFY(signalArgs.at(1).toBool() == true); @@ -689,7 +689,7 @@ void tst_qquicktreeview::expandToIndex() QVERIFY(treeView->isExpanded(treeView->rowAtIndex(child1))); QVERIFY(treeView->isExpanded(treeView->rowAtIndex(child2))); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); auto signalArgs = spy.takeFirst(); QVERIFY(signalArgs.at(0).toInt() == 0); QVERIFY(signalArgs.at(1).toInt() == 3); diff --git a/tests/auto/quick/qquickview/tst_qquickview.cpp b/tests/auto/quick/qquickview/tst_qquickview.cpp index cb7cdb1c5d..e226cfdca7 100644 --- a/tests/auto/quick/qquickview/tst_qquickview.cpp +++ b/tests/auto/quick/qquickview/tst_qquickview.cpp @@ -123,7 +123,7 @@ void tst_QQuickView::resizemodeitem() view->resize(QSize(200,300)); QTRY_COMPARE(item->width(), 200.0); - for (int i = 0; i < sizeListener.count(); ++i) { + for (int i = 0; i < sizeListener.size(); ++i) { // Check that we have the correct geometry on all signals QCOMPARE(sizeListener.at(i), view->size()); } @@ -171,7 +171,7 @@ void tst_QQuickView::errors() QQmlTestMessageHandler messageHandler; view.setSource(testFileUrl("error1.qml")); QCOMPARE(view.status(), QQuickView::Error); - QCOMPARE(view.errors().count(), 1); + QCOMPARE(view.errors().size(), 1); } { @@ -179,7 +179,7 @@ void tst_QQuickView::errors() QQmlTestMessageHandler messageHandler; view.setSource(testFileUrl("error2.qml")); QCOMPARE(view.status(), QQuickView::Error); - QCOMPARE(view.errors().count(), 1); + QCOMPARE(view.errors().size(), 1); view.show(); } } diff --git a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp index 2a567cb307..dd845b37d5 100644 --- a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp +++ b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp @@ -61,7 +61,7 @@ public: Branch(Branch *parent = nullptr) : parent(parent) {} ~Branch() { foreach (const Node &child, children) delete child.branch; } int indexOf(Branch *branch) const { - for (int i = 0; i < children.count(); ++i) { + for (int i = 0; i < children.size(); ++i) { if (children.at(i).branch == branch) return i; } @@ -109,7 +109,7 @@ public: if (row < 0 || column != 0) return QModelIndex(); Branch * const branch = branchForIndex(parent); - return branch && row < branch->children.count() + return branch && row < branch->children.size() ? createIndex(row, column, branch) : QModelIndex(); } @@ -123,7 +123,7 @@ public: int rowCount(const QModelIndex &parent) const override { Branch * const branch = branchForIndex(parent); - return branch ? branch->children.count() : 0; + return branch ? branch->children.size() : 0; } int columnCount(const QModelIndex &parent) const override { @@ -138,9 +138,9 @@ public: } void insert(const QModelIndex &parent, int index, const QStringList &data) { - beginInsertRows(parent, index, index + data.count() - 1); + beginInsertRows(parent, index, index + data.size() - 1); Branch * const branch = createBranchForIndex(parent); - for (int i = 0; i < data.count(); ++i) + for (int i = 0; i < data.size(); ++i) branch->children.insert(index + i, Node(data.at(i))); endInsertRows(); } @@ -188,14 +188,14 @@ public: } void setList(const QStringList &l) { - if (trunk.children.count() > 0) { - beginRemoveRows(QModelIndex(), 0, trunk.children.count() - 1); + if (trunk.children.size() > 0) { + beginRemoveRows(QModelIndex(), 0, trunk.children.size() - 1); foreach (const Node &child, trunk.children) delete child.branch; trunk.children.clear(); endRemoveRows(); } - if (l.count() > 0) { - beginInsertRows(QModelIndex(), 0, l.count() -1); + if (l.size() > 0) { + beginInsertRows(QModelIndex(), 0, l.size() -1); foreach (const QString &string, l) trunk.children.append(Node(string)); endInsertRows(); @@ -1040,14 +1040,14 @@ void tst_qquickvisualdatamodel::qaimRowsMoved() QSignalSpy spy(obj, SIGNAL(modelUpdated(QQmlChangeSet,bool))); model.emitMove(sourceFirst, sourceLast, destinationChild); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); - QCOMPARE(spy[0].count(), 2); + QCOMPARE(spy[0].size(), 2); QQmlChangeSet changeSet = spy[0][0].value<QQmlChangeSet>(); - QCOMPARE(changeSet.removes().count(), 1); + QCOMPARE(changeSet.removes().size(), 1); QCOMPARE(changeSet.removes().at(0).index, expectFrom); QCOMPARE(changeSet.removes().at(0).count, expectCount); - QCOMPARE(changeSet.inserts().count(), 1); + QCOMPARE(changeSet.inserts().size(), 1); QCOMPARE(changeSet.inserts().at(0).index, expectTo); QCOMPARE(changeSet.inserts().at(0).count, expectCount); QCOMPARE(changeSet.removes().at(0).moveId, changeSet.inserts().at(0).moveId); @@ -1109,33 +1109,33 @@ void tst_qquickvisualdatamodel::subtreeRowsMoved() // Move items from the current root index to a sub tree. model.move(QModelIndex(), 1, model.index(0, 0), 3, 2); QCOMPARE(vdm->count(), 2); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); changeSet = spy.last().at(0).value<QQmlChangeSet>(); - QCOMPARE(changeSet.removes().count(), 1); + QCOMPARE(changeSet.removes().size(), 1); QCOMPARE(changeSet.removes().at(0).index, 1); QCOMPARE(changeSet.removes().at(0).count, 2); - QCOMPARE(changeSet.inserts().count(), 0); + QCOMPARE(changeSet.inserts().size(), 0); // Move items from a sub tree to the current root index. model.move(model.index(0, 0), 4, QModelIndex(), 2, 1); QCOMPARE(vdm->count(), 3); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); changeSet = spy.last().at(0).value<QQmlChangeSet>(); - QCOMPARE(changeSet.removes().count(), 0); - QCOMPARE(changeSet.inserts().count(), 1); + QCOMPARE(changeSet.removes().size(), 0); + QCOMPARE(changeSet.inserts().size(), 1); QCOMPARE(changeSet.inserts().at(0).index, 2); QCOMPARE(changeSet.inserts().at(0).count, 1); vdm->setRootIndex(QVariant::fromValue(model.index(2, 0))); QCOMPARE(vdm->rootIndex().value<QModelIndex>(), model.index(2, 0)); QCOMPARE(vdm->count(), 3); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); changeSet = spy.at(2).at(0).value<QQmlChangeSet>(); - QCOMPARE(changeSet.removes().count(), 1); + QCOMPARE(changeSet.removes().size(), 1); QCOMPARE(changeSet.removes().at(0).index, 0); QCOMPARE(changeSet.removes().at(0).count, 3); changeSet = spy.last().at(0).value<QQmlChangeSet>(); - QCOMPARE(changeSet.inserts().count(), 1); + QCOMPARE(changeSet.inserts().size(), 1); QCOMPARE(changeSet.inserts().at(0).index, 0); QCOMPARE(changeSet.inserts().at(0).count, 3); @@ -1143,41 +1143,41 @@ void tst_qquickvisualdatamodel::subtreeRowsMoved() model.move(QModelIndex(), 2, QModelIndex(), 0, 1); QCOMPARE(vdm->rootIndex().value<QModelIndex>(), model.index(0, 0)); QCOMPARE(vdm->count(), 3); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); // Move the current root index, changing its parent. model.move(QModelIndex(), 0, model.index(1, 0), 0, 1); QCOMPARE(vdm->rootIndex().value<QModelIndex>(), model.index(0, 0, model.index(0, 0))); QCOMPARE(vdm->count(), 3); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); model.insert(model.index(0, 0), 0, QStringList() << "new1" << "new2"); QCOMPARE(vdm->rootIndex().value<QModelIndex>(), model.index(2, 0, model.index(0, 0))); QCOMPARE(vdm->count(), 3); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); model.remove(model.index(0, 0), 1, 1); QCOMPARE(vdm->rootIndex().value<QModelIndex>(), model.index(1, 0, model.index(0, 0))); QCOMPARE(vdm->count(), 3); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); model.remove(model.index(0, 0), 1, 1); QCOMPARE(vdm->rootIndex().value<QModelIndex>(), QModelIndex()); QCOMPARE(vdm->count(), 0); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); changeSet = spy.last().at(0).value<QQmlChangeSet>(); - QCOMPARE(changeSet.removes().count(), 1); + QCOMPARE(changeSet.removes().size(), 1); QCOMPARE(changeSet.removes().at(0).index, 0); QCOMPARE(changeSet.removes().at(0).count, 3); - QCOMPARE(changeSet.inserts().count(), 0); + QCOMPARE(changeSet.inserts().size(), 0); vdm->setRootIndex(QVariant::fromValue(QModelIndex())); QCOMPARE(vdm->rootIndex().value<QModelIndex>(), QModelIndex()); QCOMPARE(vdm->count(), 2); - QCOMPARE(spy.count(), 6); + QCOMPARE(spy.size(), 6); changeSet = spy.last().at(0).value<QQmlChangeSet>(); - QCOMPARE(changeSet.removes().count(), 0); - QCOMPARE(changeSet.inserts().count(), 1); + QCOMPARE(changeSet.removes().size(), 0); + QCOMPARE(changeSet.inserts().size(), 1); QCOMPARE(changeSet.inserts().at(0).index, 0); QCOMPARE(changeSet.inserts().at(0).count, 2); } @@ -1209,44 +1209,44 @@ void tst_qquickvisualdatamodel::watchedRoles() QCOMPARE(vdm->count(), 30); emit model.dataChanged(model.index(0), model.index(4)); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); emit model.dataChanged(model.index(0), model.index(4), QVector<int>() << QaimModel::Name); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); emit model.dataChanged(model.index(0), model.index(4), QVector<int>() << QaimModel::Number); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); vdm->setWatchedRoles(QList<QByteArray>() << "name" << "dummy"); emit model.dataChanged(model.index(0), model.index(4)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); changeSet = spy.last().at(0).value<QQmlChangeSet>(); QCOMPARE(changeSet.changes().at(0).index, 0); QCOMPARE(changeSet.changes().at(0).count, 5); emit model.dataChanged(model.index(1), model.index(6), QVector<int>() << QaimModel::Name); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); changeSet = spy.last().at(0).value<QQmlChangeSet>(); QCOMPARE(changeSet.changes().at(0).index, 1); QCOMPARE(changeSet.changes().at(0).count, 6); emit model.dataChanged(model.index(8), model.index(8), QVector<int>() << QaimModel::Number); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); vdm->setWatchedRoles(QList<QByteArray>() << "number" << "dummy"); emit model.dataChanged(model.index(0), model.index(4)); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); changeSet = spy.last().at(0).value<QQmlChangeSet>(); QCOMPARE(changeSet.changes().at(0).index, 0); QCOMPARE(changeSet.changes().at(0).count, 5); emit model.dataChanged(model.index(1), model.index(6), QVector<int>() << QaimModel::Name); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); emit model.dataChanged(model.index(8), model.index(8), QVector<int>() << QaimModel::Number); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); changeSet = spy.last().at(0).value<QQmlChangeSet>(); QCOMPARE(changeSet.changes().at(0).index, 8); QCOMPARE(changeSet.changes().at(0).count, 1); @@ -1254,19 +1254,19 @@ void tst_qquickvisualdatamodel::watchedRoles() vdm->setWatchedRoles(QList<QByteArray>() << "number" << "name"); emit model.dataChanged(model.index(0), model.index(4)); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); changeSet = spy.last().at(0).value<QQmlChangeSet>(); QCOMPARE(changeSet.changes().at(0).index, 0); QCOMPARE(changeSet.changes().at(0).count, 5); emit model.dataChanged(model.index(1), model.index(6), QVector<int>() << QaimModel::Name); - QCOMPARE(spy.count(), 6); + QCOMPARE(spy.size(), 6); changeSet = spy.last().at(0).value<QQmlChangeSet>(); QCOMPARE(changeSet.changes().at(0).index, 1); QCOMPARE(changeSet.changes().at(0).count, 6); emit model.dataChanged(model.index(8), model.index(8), QVector<int>() << QaimModel::Number); - QCOMPARE(spy.count(), 7); + QCOMPARE(spy.size(), 7); changeSet = spy.last().at(0).value<QQmlChangeSet>(); QCOMPARE(changeSet.changes().at(0).index, 8); QCOMPARE(changeSet.changes().at(0).count, 1); @@ -2427,24 +2427,24 @@ void tst_qquickvisualdatamodel::incompleteModel() QSignalSpy persistedItemsSpy(model->items(), SIGNAL(countChanged())); evaluate<void>(model, "items.removeGroups(0, items.count, \"items\")"); - QCOMPARE(itemsSpy.count(), 0); - QCOMPARE(persistedItemsSpy.count(), 0); + QCOMPARE(itemsSpy.size(), 0); + QCOMPARE(persistedItemsSpy.size(), 0); evaluate<void>(model, "items.setGroups(0, items.count, \"persistedItems\")"); - QCOMPARE(itemsSpy.count(), 0); - QCOMPARE(persistedItemsSpy.count(), 0); + QCOMPARE(itemsSpy.size(), 0); + QCOMPARE(persistedItemsSpy.size(), 0); evaluate<void>(model, "items.addGroups(0, items.count, \"persistedItems\")"); - QCOMPARE(itemsSpy.count(), 0); - QCOMPARE(persistedItemsSpy.count(), 0); + QCOMPARE(itemsSpy.size(), 0); + QCOMPARE(persistedItemsSpy.size(), 0); evaluate<void>(model, "items.remove(0, items.count)"); - QCOMPARE(itemsSpy.count(), 0); - QCOMPARE(persistedItemsSpy.count(), 0); + QCOMPARE(itemsSpy.size(), 0); + QCOMPARE(persistedItemsSpy.size(), 0); evaluate<void>(model, "items.insert([ \"color\": \"blue\" ])"); - QCOMPARE(itemsSpy.count(), 0); - QCOMPARE(persistedItemsSpy.count(), 0); + QCOMPARE(itemsSpy.size(), 0); + QCOMPARE(persistedItemsSpy.size(), 0); QTest::ignoreMessage(QtWarningMsg, QRegularExpression(".*get: index out of range")); QVERIFY(evaluate<bool>(model, "items.get(0) === undefined")); @@ -3070,7 +3070,7 @@ void tst_qquickvisualdatamodel::insert() QCOMPARE(evaluate<int>(visualModel, "visibleItems.count"), visible ? visualCount : modelCount); QCOMPARE(evaluate<int>(visualModel, "selectedItems.count"), selected ? 1 : 0); - QCOMPARE(propertyData.count(), visualCount); + QCOMPARE(propertyData.size(), visualCount); for (int i = 0; i < visualCount; ++i) { int modelIndex = i; if (modelIndex > index) @@ -3538,7 +3538,7 @@ void tst_qquickvisualdatamodel::resolve() QCOMPARE(evaluate<int>(visualModel, "visibleItems.count"), visible ? visualCount : modelCount); QCOMPARE(evaluate<int>(visualModel, "selectedItems.count"), selected ? 1 : 0); - QCOMPARE(propertyData.count(), visualCount); + QCOMPARE(propertyData.size(), visualCount); for (int i = 0; i < visualCount; ++i) { int modelIndex = i; @@ -3939,7 +3939,7 @@ void tst_qquickvisualdatamodel::invalidAttachment() QScopedPointer<QObject> object(component.create()); QVERIFY(object); - QCOMPARE(component.errors().count(), 0); + QCOMPARE(component.errors().size(), 0); QVariant property = object->property("invalidVdm"); QCOMPARE(property.userType(), qMetaTypeId<QQmlDelegateModel *>()); @@ -4268,7 +4268,7 @@ public: static qsizetype listLength(QQmlListProperty<QObject> *property) { auto objectsProvider = qobject_cast<ObjectsProvider*>(property->object); - return objectsProvider ? objectsProvider->m_objects.length() : 0; + return objectsProvider ? objectsProvider->m_objects.size() : 0; } static QObject* listAt(QQmlListProperty<QObject> *property, qsizetype index) diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp index 4a720491d6..844979533f 100644 --- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp +++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp @@ -582,7 +582,7 @@ void tst_qquickwindow::aboutToStopSignal() window.hide(); - QTRY_VERIFY(spy.count() > 0); + QTRY_VERIFY(spy.size() > 0); } //If the item calls update inside updatePaintNode, it should schedule another sync pass @@ -598,8 +598,8 @@ void tst_qquickwindow::constantUpdates() QSignalSpy afterSpy(&window, SIGNAL(afterSynchronizing())); QTRY_VERIFY(item.iterations > 10); - QTRY_VERIFY(beforeSpy.count() > 10); - QTRY_VERIFY(afterSpy.count() > 10); + QTRY_VERIFY(beforeSpy.size() > 10); + QTRY_VERIFY(afterSpy.size() > 10); } void tst_qquickwindow::constantUpdatesOnWindow_data() @@ -700,7 +700,7 @@ void tst_qquickwindow::touchEvent_basic() // press single point touchSeq.press(0, topItem->mapToScene(pos).toPoint(),window).commit(); QQuickTouchUtils::flush(window); - QTRY_COMPARE(topItem->lastEvent.touchPoints.count(), 1); + QTRY_COMPARE(topItem->lastEvent.touchPoints.size(), 1); QVERIFY(middleItem->lastEvent.touchPoints.isEmpty()); QVERIFY(bottomItem->lastEvent.touchPoints.isEmpty()); @@ -714,9 +714,9 @@ void tst_qquickwindow::touchEvent_basic() touchSeq.press(0, topItem->mapToScene(pos).toPoint(), window) .press(1, bottomItem->mapToScene(pos).toPoint(), window).commit(); QQuickTouchUtils::flush(window); - QCOMPARE(topItem->lastEvent.touchPoints.count(), 1); + QCOMPARE(topItem->lastEvent.touchPoints.size(), 1); QVERIFY(middleItem->lastEvent.touchPoints.isEmpty()); - QCOMPARE(bottomItem->lastEvent.touchPoints.count(), 1); + QCOMPARE(bottomItem->lastEvent.touchPoints.size(), 1); COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, makeTouchPoint(topItem, pos))); COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, makeTouchPoint(bottomItem, pos))); topItem->reset(); @@ -728,7 +728,7 @@ void tst_qquickwindow::touchEvent_basic() QQuickTouchUtils::flush(window); touchSeq.move(0, bottomItem->mapToScene(pos).toPoint(), window).commit(); QQuickTouchUtils::flush(window); - QCOMPARE(topItem->lastEvent.touchPoints.count(), 1); + QCOMPARE(topItem->lastEvent.touchPoints.size(), 1); COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchUpdate, window, QEventPoint::State::Updated, makeTouchPoint(topItem, topItem->mapFromItem(bottomItem, pos), pos))); topItem->reset(); @@ -739,7 +739,7 @@ void tst_qquickwindow::touchEvent_basic() QQuickTouchUtils::flush(window); touchSeq.move(0, topItem->mapToScene(pos).toPoint(), window).commit(); QQuickTouchUtils::flush(window); - QCOMPARE(bottomItem->lastEvent.touchPoints.count(), 1); + QCOMPARE(bottomItem->lastEvent.touchPoints.size(), 1); COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchUpdate, window, QEventPoint::State::Updated, makeTouchPoint(bottomItem, bottomItem->mapFromItem(topItem, pos), pos))); bottomItem->reset(); @@ -751,9 +751,9 @@ void tst_qquickwindow::touchEvent_basic() touchSeq.stationary(0) .press(1, bottomItem->mapToScene(pos).toPoint(), window).commit(); QQuickTouchUtils::flush(window); - QCOMPARE(topItem->lastEvent.touchPoints.count(), 1); // received press and then stationary + QCOMPARE(topItem->lastEvent.touchPoints.size(), 1); // received press and then stationary QVERIFY(middleItem->lastEvent.touchPoints.isEmpty()); - QCOMPARE(bottomItem->lastEvent.touchPoints.count(), 1); + QCOMPARE(bottomItem->lastEvent.touchPoints.size(), 1); COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchUpdate, window, QEventPoint::State::Stationary, makeTouchPoint(topItem, pos))); COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, makeTouchPoint(bottomItem, pos))); topItem->reset(); @@ -769,7 +769,7 @@ void tst_qquickwindow::touchEvent_basic() QQuickTouchUtils::flush(window); touchSeq.release(0, bottomItem->mapToScene(pos).toPoint(),window).commit(); QQuickTouchUtils::flush(window); - QCOMPARE(topItem->lastEvent.touchPoints.count(), 1); + QCOMPARE(topItem->lastEvent.touchPoints.size(), 1); COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchEnd, window, QEventPoint::State::Released, makeTouchPoint(topItem, topItem->mapFromItem(bottomItem, pos), pos))); topItem->reset(); @@ -783,9 +783,9 @@ void tst_qquickwindow::touchEvent_basic() touchSeq.release(0, bottomItem->mapToScene(pos).toPoint(), window) .stationary(1).commit(); QQuickTouchUtils::flush(window); - QCOMPARE(topItem->lastEvent.touchPoints.count(), 1); + QCOMPARE(topItem->lastEvent.touchPoints.size(), 1); QVERIFY(middleItem->lastEvent.touchPoints.isEmpty()); - QCOMPARE(bottomItem->lastEvent.touchPoints.count(), 1); + QCOMPARE(bottomItem->lastEvent.touchPoints.size(), 1); // Since qtbase 2692237bb1b0c0f50b7cc5d920eb8ab065063d47, if the point didn't have a different position on release, // then lastPosition is not changed. So in this case, it still holds the press position. I.e. on release, // it's the last position that was actually different. @@ -846,7 +846,7 @@ void tst_qquickwindow::touchEvent_propagation() // single touch to top item, should be received by middle item QTest::touchEvent(window, touchDevice).press(0, pointInTopItem, window); - QTRY_COMPARE(middleItem->lastEvent.touchPoints.count(), 1); + QTRY_COMPARE(middleItem->lastEvent.touchPoints.size(), 1); QVERIFY(topItem->lastEvent.touchPoints.isEmpty()); QVERIFY(bottomItem->lastEvent.touchPoints.isEmpty()); COMPARE_TOUCH_DATA(middleItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, @@ -856,7 +856,7 @@ void tst_qquickwindow::touchEvent_propagation() // touch top and middle items, middle item should get both events QTest::touchEvent(window, touchDevice).press(0, pointInTopItem, window) .press(1, pointInMiddleItem, window); - QTRY_COMPARE(middleItem->lastEvent.touchPoints.count(), 2); + QTRY_COMPARE(middleItem->lastEvent.touchPoints.size(), 2); QVERIFY(topItem->lastEvent.touchPoints.isEmpty()); QVERIFY(bottomItem->lastEvent.touchPoints.isEmpty()); COMPARE_TOUCH_DATA(middleItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, @@ -875,7 +875,7 @@ void tst_qquickwindow::touchEvent_propagation() // touch top and middle items, bottom item should get all events QTest::touchEvent(window, touchDevice).press(0, pointInTopItem, window) .press(1, pointInMiddleItem, window); - QTRY_COMPARE(bottomItem->lastEvent.touchPoints.count(), 2); + QTRY_COMPARE(bottomItem->lastEvent.touchPoints.size(), 2); QVERIFY(topItem->lastEvent.touchPoints.isEmpty()); QVERIFY(middleItem->lastEvent.touchPoints.isEmpty()); COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, @@ -915,12 +915,12 @@ void tst_qquickwindow::touchEvent_propagation() // middle item is disabled or has 0 opacity, bottom item receives the event QVERIFY(topItem->lastEvent.touchPoints.isEmpty()); QVERIFY(middleItem->lastEvent.touchPoints.isEmpty()); - QCOMPARE(bottomItem->lastEvent.touchPoints.count(), 1); + QCOMPARE(bottomItem->lastEvent.touchPoints.size(), 1); COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, makeTouchPoint(bottomItem, bottomItem->mapFromItem(topItem, pos)))); } else { // middle item ignores event, sends it to the top item (top-most child) - QCOMPARE(topItem->lastEvent.touchPoints.count(), 1); + QCOMPARE(topItem->lastEvent.touchPoints.size(), 1); QVERIFY(middleItem->lastEvent.touchPoints.isEmpty()); QVERIFY(bottomItem->lastEvent.touchPoints.isEmpty()); COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, @@ -966,7 +966,7 @@ void tst_qquickwindow::touchEvent_cancel() QTest::touchEvent(window, touchDevice).press(0, item->mapToScene(pos).toPoint(), window); QCoreApplication::processEvents(); - QTRY_COMPARE(item->lastEvent.touchPoints.count(), 1); + QTRY_COMPARE(item->lastEvent.touchPoints.size(), 1); TouchEventData d = makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, makeTouchPoint(item, pos)); COMPARE_TOUCH_DATA(item->lastEvent, d); item->reset(); @@ -1091,7 +1091,7 @@ void tst_qquickwindow::touchEvent_velocity() QGuiApplication::processEvents(); QQuickTouchUtils::flush(window); QCOMPARE(item->touchEventCount, 2); - QCOMPARE(item->lastEvent.touchPoints.count(), 1); + QCOMPARE(item->lastEvent.touchPoints.size(), 1); QCOMPARE(item->lastVelocity, velocity); // Now have a transformation on the item and check if position is transformed accordingly. @@ -1306,9 +1306,9 @@ void tst_qquickwindow::synthMouseFromTouch() QTest::touchEvent(window.data(), touchDevice).release(0, p2, window.data()); QQuickTouchUtils::flush(window.data()); - QCOMPARE(item->m_touchEvents.count(), acceptTouch ? 3 : 0); - QCOMPARE(item->m_mouseEvents.count(), (acceptTouch || !synthMouse) ? 0 : 3); - QCOMPARE(window->m_mouseEvents.count(), 0); + QCOMPARE(item->m_touchEvents.size(), acceptTouch ? 3 : 0); + QCOMPARE(item->m_mouseEvents.size(), (acceptTouch || !synthMouse) ? 0 : 3); + QCOMPARE(window->m_mouseEvents.size(), 0); for (const auto &ev : item->m_mouseEvents) QCOMPARE(ev.source, Qt::MouseEventSynthesizedByQt); } @@ -1353,7 +1353,7 @@ void tst_qquickwindow::synthMouseDoubleClickFromTouch() QTest::touchEvent(window.data(), touchDevice).move(1, p2 + movement, window.data()); QTest::touchEvent(window.data(), touchDevice).release(1, p2 + movement, window.data()); - const int eventCount = item->m_mouseEvents.count(); + const int eventCount = item->m_mouseEvents.size(); QVERIFY(eventCount >= 2); const int nDoubleClicks = std::count_if(item->m_mouseEvents.constBegin(), item->m_mouseEvents.constEnd(), @@ -1629,7 +1629,7 @@ void tst_qquickwindow::earlyGrab() Grabber *grabber = qobject_cast<Grabber *>(window->findChild<QObject *>("grabber")); QVERIFY(grabber); - QCOMPARE(grabber->images.count(), 1); + QCOMPARE(grabber->images.size(), 1); QVERIFY(!grabber->images[0].isNull()); QCOMPARE(grabber->images[0].convertToFormat(QImage::Format_RGBX8888).pixel(10, 20), QColor(Qt::red).rgb()); } @@ -1797,19 +1797,19 @@ void tst_qquickwindow::focusObject() QVERIFY(QTest::qWaitForWindowActive(window)); QCOMPARE(window->contentItem(), window->focusObject()); - QCOMPARE(focusObjectSpy.count(), 1); + QCOMPARE(focusObjectSpy.size(), 1); QQuickItem *item1 = window->findChild<QQuickItem*>("item1"); QVERIFY(item1); item1->setFocus(true); QCOMPARE(item1, window->focusObject()); - QCOMPARE(focusObjectSpy.count(), 2); + QCOMPARE(focusObjectSpy.size(), 2); QQuickItem *item2 = window->findChild<QQuickItem*>("item2"); QVERIFY(item2); item2->setFocus(true); QCOMPARE(item2, window->focusObject()); - QCOMPARE(focusObjectSpy.count(), 3); + QCOMPARE(focusObjectSpy.size(), 3); // set focus for item in non-focused focus scope and // ensure focusObject does not change and signal is not emitted @@ -1817,7 +1817,7 @@ void tst_qquickwindow::focusObject() QVERIFY(item3); item3->setFocus(true); QCOMPARE(item2, window->focusObject()); - QCOMPARE(focusObjectSpy.count(), 3); + QCOMPARE(focusObjectSpy.size(), 3); } void tst_qquickwindow::focusReason() @@ -2379,7 +2379,7 @@ void tst_qquickwindow::qobjectEventFilter_touch() // press single point QTest::touchEvent(&window, touchDevice).press(0, item->mapToScene(pos).toPoint(), &window); - QCOMPARE(eventFilter.events.count(), 1); + QCOMPARE(eventFilter.events.size(), 1); QCOMPARE(eventFilter.events.first(), (int)QEvent::TouchBegin); } @@ -2450,7 +2450,7 @@ void tst_qquickwindow::animatingSignal() window.show(); QTRY_VERIFY(window.isExposed()); - QTRY_VERIFY(spy.count() > 1); + QTRY_VERIFY(spy.size() > 1); } void tst_qquickwindow::frameSignals() @@ -2467,9 +2467,9 @@ void tst_qquickwindow::frameSignals() QSGRendererInterface *rif = window.rendererInterface(); QVERIFY(rif); - QTRY_VERIFY(beforeSpy.count() > 1); - QTRY_VERIFY(afterSpy.count() > 1); - QTRY_COMPARE(beforeSpy.count(), afterSpy.count()); + QTRY_VERIFY(beforeSpy.size() > 1); + QTRY_VERIFY(afterSpy.size() > 1); + QTRY_COMPARE(beforeSpy.size(), afterSpy.size()); } // QTBUG-36938 @@ -2928,15 +2928,15 @@ void tst_qquickwindow::test_circleMapItem() QPoint pos(50, 50); QTest::mouseClick(&window, Qt::LeftButton, Qt::KeyboardModifiers(), pos); - QCOMPARE(topSpy.count(), 1); - QCOMPARE(bottomSpy.count(), 0); + QCOMPARE(topSpy.size(), 1); + QCOMPARE(bottomSpy.size(), 0); // Outside the "Circles" "input area", but on top of the bottomItem rectangle pos = QPoint(66, 66); QTest::mouseClick(&window, Qt::LeftButton, Qt::KeyboardModifiers(), pos); - QCOMPARE(bottomSpy.count(), 1); - QCOMPARE(topSpy.count(), 1); + QCOMPARE(bottomSpy.size(), 1); + QCOMPARE(topSpy.size(), 1); } void tst_qquickwindow::grabContentItemToImage() @@ -3652,14 +3652,14 @@ void tst_qquickwindow::subclassWithPointerEventVirtualOverrides() // QTBUG-97859 switch (static_cast<QPointingDevice::DeviceType>(deviceType)) { case QPointingDevice::DeviceType::Mouse: QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, pos); - QTRY_COMPARE(window.m_mouseEvents.count(), 3); // separate move before press - QCOMPARE(window.m_events.count(), 3); + QTRY_COMPARE(window.m_mouseEvents.size(), 3); // separate move before press + QCOMPARE(window.m_events.size(), 3); break; case QPointingDevice::DeviceType::TouchScreen: QTest::touchEvent(&window, touchDevice).press(0, pos, &window); QTest::touchEvent(&window, touchDevice).release(0, pos, &window); - QTRY_COMPARE(window.m_touchEvents.count(), 2); - QCOMPARE(window.m_events.count(), 2); + QTRY_COMPARE(window.m_touchEvents.size(), 2); + QCOMPARE(window.m_events.size(), 2); break; case QPointingDevice::DeviceType::Stylus: // press (pressure is 0.8) @@ -3670,8 +3670,8 @@ void tst_qquickwindow::subclassWithPointerEventVirtualOverrides() // QTBUG-97859 QWindowSystemInterface::handleTabletEvent(&window, pos, window.mapToGlobal(pos), int(QInputDevice::DeviceType::Stylus), int(QPointingDevice::PointerType::Pen), Qt::NoButton, 0, 0, 0, 0, 0, 0, stylusId, Qt::NoModifier); - QTRY_COMPARE(window.m_tabletEvents.count(), 2); - QVERIFY(window.m_events.count() >= window.m_tabletEvents.count()); // tablet + synth-mouse events + QTRY_COMPARE(window.m_tabletEvents.size(), 2); + QVERIFY(window.m_events.size() >= window.m_tabletEvents.size()); // tablet + synth-mouse events break; default: break; diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp index e595175fee..3e3b197e0c 100644 --- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp +++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp @@ -54,7 +54,7 @@ QDebug operator<<(QDebug dbg, const struct Event &event) { if (event.points.isEmpty()) dbg << " @ " << event.mousePos << " global " << event.mousePosGlobal; else - dbg << ", " << event.points.count() << " touchpoints: " << event.points; + dbg << ", " << event.points.size() << " touchpoints: " << event.points; dbg << ')'; return dbg; } @@ -784,7 +784,7 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable() qCDebug(lcTests) << "expected filtered events: actual TouchBegin and replayed TouchBegin" << filteredEventList; QTRY_COMPARE(eventItem1->eventList.size(), 1); QCOMPARE(eventItem1->eventList.at(0).type, QEvent::MouseButtonPress); - QCOMPARE(filteredEventList.count(), 2); // actual touch begin and replayed touch begin + QCOMPARE(filteredEventList.size(), 2); // actual touch begin and replayed touch begin } if (!releaseBeforeDelayIsOver) { @@ -799,7 +799,7 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable() if (scrollBeforeDelayIsOver) { QCOMPARE(eventItem1->eventList.size(), 0); qCDebug(lcTests) << "expected filtered events: 1 TouchBegin and 3 TouchUpdate" << filteredEventList; - QCOMPARE(filteredEventList.count(), 4); + QCOMPARE(filteredEventList.size(), 4); } else { qCDebug(lcTests) << "expected delivered events: press(mouse), move(mouse), move(mouse), ungrab(mouse)" << eventItem1->eventList; QCOMPARE(eventItem1->eventList.size(), 4); @@ -807,7 +807,7 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable() QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseMove); QCOMPARE(eventItem1->eventList.last().type, QEvent::UngrabMouse); qCDebug(lcTests) << "expected filtered events: 2 TouchBegin and 3 TouchUpdate" << filteredEventList; - QCOMPARE(filteredEventList.count(), 5); + QCOMPARE(filteredEventList.size(), 5); } // flickable should have the touchpoint grab: it no longer relies on synth-mouse @@ -828,17 +828,17 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable() QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonRelease); QCOMPARE(eventItem1->eventList.last().type, QEvent::UngrabMouse); // QQuickWindow filters the delayed press and release - QCOMPARE(filteredEventList.count(), 4); - QCOMPARE(filteredEventList.at(filteredEventList.count() - 2).type, QEvent::TouchBegin); + QCOMPARE(filteredEventList.size(), 4); + QCOMPARE(filteredEventList.at(filteredEventList.size() - 2).type, QEvent::TouchBegin); QCOMPARE(filteredEventList.last().type, QEvent::TouchEnd); } else { // QQuickWindow filters the delayed press if there was one if (scrollBeforeDelayIsOver) { qCDebug(lcTests) << "expected filtered events: 1 TouchBegin, 3 TouchUpdate, 1 TouchEnd" << filteredEventList; - QCOMPARE(filteredEventList.count(), 5); + QCOMPARE(filteredEventList.size(), 5); } else { qCDebug(lcTests) << "expected filtered events: 2 TouchBegin, 3 TouchUpdate, 1 TouchEnd" << filteredEventList; - QCOMPARE(filteredEventList.count(), 6); + QCOMPARE(filteredEventList.size(), 6); QCOMPARE(filteredEventList.at(0).type, QEvent::TouchBegin); QCOMPARE(filteredEventList.last().type, QEvent::TouchEnd); } @@ -953,7 +953,7 @@ void tst_TouchMouse::buttonOnTouch() touchSeq.press(0, p1, &window).press(1, p2, &window).commit(); QQuickTouchUtils::flush(&window); QCOMPARE(button1->scale(), 1); - QCOMPARE(eventItem1->eventList.count(), 1); + QCOMPARE(eventItem1->eventList.size(), 1); QCOMPARE(eventItem1->eventList.at(0).type, QEvent::MouseButtonPress); p1 -= QPoint(10, 0); @@ -1265,16 +1265,16 @@ void tst_TouchMouse::tapOnDismissiveTopMouseAreaClicksBottomOne() QTest::touchEvent(&window, device).release(0, p1, &window); QQuickTouchUtils::flush(&window); - QCOMPARE(bottomClickedSpy.count(), 1); - QCOMPARE(bottomDoubleClickedSpy.count(), 0); + QCOMPARE(bottomClickedSpy.size(), 1); + QCOMPARE(bottomDoubleClickedSpy.size(), 0); QTest::touchEvent(&window, device).press(0, p1, &window); QQuickTouchUtils::flush(&window); QTest::touchEvent(&window, device).release(0, p1, &window); QQuickTouchUtils::flush(&window); - QCOMPARE(bottomClickedSpy.count(), 1); - QCOMPARE(bottomDoubleClickedSpy.count(), 1); + QCOMPARE(bottomClickedSpy.size(), 1); + QCOMPARE(bottomDoubleClickedSpy.size(), 1); } /* @@ -1449,21 +1449,21 @@ void tst_TouchMouse::hoverEnabled() // QTBUG-40856 // ------------------------- Mouse move to mouseArea1 QTest::mouseMove(&window, p1); - QVERIFY(enterSpy1.count() == 1); + QVERIFY(enterSpy1.size() == 1); QVERIFY(mouseArea1->hovered()); QVERIFY(!mouseArea2->hovered()); // ------------------------- Touch click on mouseArea1 QTest::touchEvent(&window, device).press(0, p1, &window); - QCOMPARE(enterSpy1.count(), 1); - QCOMPARE(enterSpy2.count(), 0); + QCOMPARE(enterSpy1.size(), 1); + QCOMPARE(enterSpy2.size(), 0); QVERIFY(mouseArea1->pressed()); QVERIFY(mouseArea1->hovered()); QVERIFY(!mouseArea2->hovered()); QTest::touchEvent(&window, device).release(0, p1, &window); - QVERIFY(clickSpy1.count() == 1); + QVERIFY(clickSpy1.size() == 1); QVERIFY(mouseArea1->hovered()); QVERIFY(!mouseArea2->hovered()); @@ -1473,28 +1473,28 @@ void tst_TouchMouse::hoverEnabled() // QTBUG-40856 QVERIFY(mouseArea1->hovered()); QVERIFY(mouseArea2->hovered()); QVERIFY(mouseArea2->pressed()); - QCOMPARE(enterSpy1.count(), 1); - QCOMPARE(enterSpy2.count(), 1); + QCOMPARE(enterSpy1.size(), 1); + QCOMPARE(enterSpy2.size(), 1); QTest::touchEvent(&window, device).release(0, p2, &window); - QVERIFY(clickSpy2.count() == 1); + QVERIFY(clickSpy2.size() == 1); QVERIFY(mouseArea1->hovered()); QVERIFY(!mouseArea2->hovered()); - QCOMPARE(exitSpy1.count(), 0); - QCOMPARE(exitSpy2.count(), 1); + QCOMPARE(exitSpy1.size(), 0); + QCOMPARE(exitSpy2.size(), 1); // ------------------------- Another touch click on mouseArea1 QTest::touchEvent(&window, device).press(0, p1, &window); - QCOMPARE(enterSpy1.count(), 1); - QCOMPARE(enterSpy2.count(), 1); + QCOMPARE(enterSpy1.size(), 1); + QCOMPARE(enterSpy2.size(), 1); QVERIFY(mouseArea1->pressed()); QVERIFY(mouseArea1->hovered()); QVERIFY(!mouseArea2->hovered()); QTest::touchEvent(&window, device).release(0, p1, &window); - QCOMPARE(clickSpy1.count(), 2); + QCOMPARE(clickSpy1.size(), 2); QVERIFY(mouseArea1->hovered()); QVERIFY(!mouseArea1->pressed()); QVERIFY(!mouseArea2->hovered()); @@ -1545,20 +1545,20 @@ void tst_TouchMouse::touchCancelWillCancelMousePress() // Begin a new touch, that gets converted to a mouse press QTest::touchEvent(&window, device).press(0, p1); - QCOMPARE(eventItem->eventList.count(), 1); + QCOMPARE(eventItem->eventList.size(), 1); QCOMPARE(eventItem->eventList.at(0).type, QEvent::MouseButtonPress); // Cancel it... QTouchEvent cancelEvent(QEvent::TouchCancel, device); QCoreApplication::sendEvent(&window, &cancelEvent); - QCOMPARE(eventItem->eventList.count(), 3); + QCOMPARE(eventItem->eventList.size(), 3); QCOMPARE(eventItem->eventList.at(1).type, QEvent::TouchCancel); QCOMPARE(eventItem->eventList.at(2).type, QEvent::UngrabMouse); // Begin a second touch. Since the last one was cancelled, this // should end up as a new mouse press on the target item. QTest::touchEvent(&window, device).press(0, p1); - QVERIFY(eventItem->eventList.count() >= 5); + QVERIFY(eventItem->eventList.size() >= 5); QCOMPARE(eventItem->eventList.at(3).type, QEvent::MouseButtonPress); QTest::touchEvent(&window, device).release(0, p1); // clean up potential state |