diff options
Diffstat (limited to 'tests/auto/quickcontrols2')
14 files changed, 234 insertions, 234 deletions
diff --git a/tests/auto/quickcontrols2/focus/tst_focus.cpp b/tests/auto/quickcontrols2/focus/tst_focus.cpp index fc38865921..98b2f3bd24 100644 --- a/tests/auto/quickcontrols2/focus/tst_focus.cpp +++ b/tests/auto/quickcontrols2/focus/tst_focus.cpp @@ -421,7 +421,7 @@ void tst_focus::visualFocus() QQuickItem *column = view.rootObject(); QVERIFY(column); - QCOMPARE(column->childItems().count(), 2); + QCOMPARE(column->childItems().size(), 2); QQuickControl *button = qobject_cast<QQuickControl *>(column->childItems().first()); QVERIFY(button); diff --git a/tests/auto/quickcontrols2/pressandhold/tst_pressandhold.cpp b/tests/auto/quickcontrols2/pressandhold/tst_pressandhold.cpp index 170e61cafa..98013a1d0c 100644 --- a/tests/auto/quickcontrols2/pressandhold/tst_pressandhold.cpp +++ b/tests/auto/quickcontrols2/pressandhold/tst_pressandhold.cpp @@ -79,16 +79,16 @@ void tst_PressAndHold::pressAndHold() // pressAndHold() emitted QGuiApplication::sendEvent(control.data(), &press); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); QGuiApplication::sendEvent(control.data(), &release); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); // pressAndHold() canceled by release QGuiApplication::sendEvent(control.data(), &press); QGuiApplication::processEvents(); QGuiApplication::sendEvent(control.data(), &release); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); // pressAndHold() canceled by move QGuiApplication::sendEvent(control.data(), &press); @@ -97,12 +97,12 @@ void tst_PressAndHold::pressAndHold() // by the time the second control emits pressAndHold(), we can reliably // assume that the first control would have emitted pressAndHold() if it // wasn't canceled as appropriate by the move event above - QTRY_COMPARE(waitSpy.count(), 1); - QCOMPARE(spy.count(), 0); + QTRY_COMPARE(waitSpy.size(), 1); + QCOMPARE(spy.size(), 0); QGuiApplication::sendEvent(control.data(), &release); QGuiApplication::sendEvent(waitControl.data(), &release); - QCOMPARE(waitSpy.count(), 1); - QCOMPARE(spy.count(), 0); + QCOMPARE(waitSpy.size(), 1); + QCOMPARE(spy.size(), 0); waitSpy.clear(); // pressAndHold() canceled by 2nd press @@ -112,12 +112,12 @@ void tst_PressAndHold::pressAndHold() // by the time the second control emits pressAndHold(), we can reliably // assume that the first control would have emitted pressAndHold() if it // wasn't canceled as appropriate by the 2nd press event above - QTRY_COMPARE(waitSpy.count(), 1); - QCOMPARE(spy.count(), 0); + QTRY_COMPARE(waitSpy.size(), 1); + QCOMPARE(spy.size(), 0); QGuiApplication::sendEvent(control.data(), &release); QGuiApplication::sendEvent(waitControl.data(), &release); - QCOMPARE(waitSpy.count(), 1); - QCOMPARE(spy.count(), 0); + QCOMPARE(waitSpy.size(), 1); + QCOMPARE(spy.size(), 0); waitSpy.clear(); } @@ -158,9 +158,9 @@ void tst_PressAndHold::keepSelection() // pressAndHold() emitted => selection remains QGuiApplication::sendEvent(control.data(), &press); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); QGuiApplication::sendEvent(control.data(), &release); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(control->property("selectedText"), control->property("text")); spy.clear(); @@ -168,7 +168,7 @@ void tst_PressAndHold::keepSelection() QGuiApplication::sendEvent(control.data(), &press); QGuiApplication::processEvents(); QGuiApplication::sendEvent(control.data(), &release); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QVERIFY(control->property("selectedText").toString().isEmpty()); QVERIFY(QMetaObject::invokeMethod(control.data(), "selectAll")); @@ -181,12 +181,12 @@ void tst_PressAndHold::keepSelection() // by the time the second control emits pressAndHold(), we can reliably // assume that the first control would have emitted pressAndHold() if it // wasn't canceled as appropriate by the move event above - QTRY_COMPARE(waitSpy.count(), 1); - QCOMPARE(spy.count(), 0); + QTRY_COMPARE(waitSpy.size(), 1); + QCOMPARE(spy.size(), 0); QGuiApplication::sendEvent(control.data(), &release); QGuiApplication::sendEvent(waitControl.data(), &release); - QCOMPARE(waitSpy.count(), 1); - QCOMPARE(spy.count(), 0); + QCOMPARE(waitSpy.size(), 1); + QCOMPARE(spy.size(), 0); QVERIFY(control->property("selectedText").toString().isEmpty()); waitSpy.clear(); } diff --git a/tests/auto/quickcontrols2/qquickapplicationwindow/tst_qquickapplicationwindow.cpp b/tests/auto/quickcontrols2/qquickapplicationwindow/tst_qquickapplicationwindow.cpp index 000b4e22af..e055340dde 100644 --- a/tests/auto/quickcontrols2/qquickapplicationwindow/tst_qquickapplicationwindow.cpp +++ b/tests/auto/quickcontrols2/qquickapplicationwindow/tst_qquickapplicationwindow.cpp @@ -700,7 +700,7 @@ void tst_QQuickApplicationWindow::focusAfterPopupClosed() QSignalSpy focusScopeSpy(window.data(), SIGNAL(focusScopeKeyPressed())); QTest::keyClick(window.data(), Qt::Key_Space); - QCOMPARE(focusScopeSpy.count(), 1); + QCOMPARE(focusScopeSpy.size(), 1); // Open the menu. QQuickItem* toolButton = window->property("toolButton").value<QQuickItem*>(); @@ -711,14 +711,14 @@ void tst_QQuickApplicationWindow::focusAfterPopupClosed() // The FocusScope shouldn't receive any key events while the menu is open. QTest::keyClick(window.data(), Qt::Key_Space); - QCOMPARE(focusScopeSpy.count(), 1); + QCOMPARE(focusScopeSpy.size(), 1); // Close the menu. The FocusScope should regain focus. QTest::keyClick(window.data(), Qt::Key_Escape); QVERIFY(focusScope->hasActiveFocus()); QTest::keyClick(window.data(), Qt::Key_Space); - QCOMPARE(focusScopeSpy.count(), 2); + QCOMPARE(focusScopeSpy.size(), 2); QQuickPopup *focusPopup = window->property("focusPopup").value<QQuickPopup*>(); QVERIFY(focusPopup); @@ -729,7 +729,7 @@ void tst_QQuickApplicationWindow::focusAfterPopupClosed() QSignalSpy focusPopupSpy(window.data(), SIGNAL(focusPopupKeyPressed())); QTest::keyClick(window.data(), Qt::Key_Space); - QCOMPARE(focusPopupSpy.count(), 1); + QCOMPARE(focusPopupSpy.size(), 1); QQuickMenu *fileMenu = window->property("fileMenu").value<QQuickMenu*>(); QVERIFY(fileMenu); @@ -738,21 +738,21 @@ void tst_QQuickApplicationWindow::focusAfterPopupClosed() // The Popup shouldn't receive any key events while the menu is open. QTest::keyClick(window.data(), Qt::Key_Space); - QCOMPARE(focusPopupSpy.count(), 1); + QCOMPARE(focusPopupSpy.size(), 1); // Close the menu. The Popup should regain focus. QTest::keyClick(window.data(), Qt::Key_Escape); QVERIFY(focusPopup->hasActiveFocus()); QTest::keyClick(window.data(), Qt::Key_Space); - QCOMPARE(focusPopupSpy.count(), 2); + QCOMPARE(focusPopupSpy.size(), 2); // Close the popup. The FocusScope should regain focus. QTest::keyClick(window.data(), Qt::Key_Escape); QVERIFY(focusScope->hasActiveFocus()); QTest::keyClick(window.data(), Qt::Key_Space); - QCOMPARE(focusScopeSpy.count(), 3); + QCOMPARE(focusScopeSpy.size(), 3); } void tst_QQuickApplicationWindow::clearFocusOnDestruction() @@ -796,7 +796,7 @@ void tst_QQuickApplicationWindow::clearFocusOnDestruction() Therefore, if you have good reasons to change the behavior (and not emit it) take the test below with a grain of salt. */ - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_QQuickApplicationWindow::layout() diff --git a/tests/auto/quickcontrols2/qquickcontrol/tst_qquickcontrol.cpp b/tests/auto/quickcontrols2/qquickcontrol/tst_qquickcontrol.cpp index ca6183e41d..ddb4b7ff8b 100644 --- a/tests/auto/quickcontrols2/qquickcontrol/tst_qquickcontrol.cpp +++ b/tests/auto/quickcontrols2/qquickcontrol/tst_qquickcontrol.cpp @@ -66,12 +66,12 @@ void tst_QQuickControl::flickable() QPoint p(button->width() / 2, button->height() / 2); QTest::touchEvent(window, touchDevice.data()).press(0, p); - QTRY_COMPARE(buttonPressedSpy.count(), 1); + QTRY_COMPARE(buttonPressedSpy.size(), 1); p += QPoint(1, 1); // less than the drag threshold QTest::touchEvent(window, touchDevice.data()).move(0, p); QTest::touchEvent(window, touchDevice.data()).release(0, p); - QTRY_COMPARE(buttonReleasedSpy.count(), 1); - QTRY_COMPARE(buttonClickedSpy.count(), 1); + QTRY_COMPARE(buttonReleasedSpy.size(), 1); + QTRY_COMPARE(buttonClickedSpy.size(), 1); } void tst_QQuickControl::fractionalFontSize() diff --git a/tests/auto/quickcontrols2/qquickdrawer/tst_qquickdrawer.cpp b/tests/auto/quickcontrols2/qquickdrawer/tst_qquickdrawer.cpp index 48e1a541be..344d96b6fb 100644 --- a/tests/auto/quickcontrols2/qquickdrawer/tst_qquickdrawer.cpp +++ b/tests/auto/quickcontrols2/qquickdrawer/tst_qquickdrawer.cpp @@ -225,71 +225,71 @@ void tst_QQuickDrawer::state() // open programmatically... drawer->open(); - QCOMPARE(visibleChangedSpy.count(), ++visibleChangedCount); - QCOMPARE(aboutToShowSpy.count(), ++aboutToShowCount); - QCOMPARE(aboutToHideSpy.count(), aboutToHideCount); - QCOMPARE(openedSpy.count(), openedCount); - QCOMPARE(closedSpy.count(), closedCount); + QCOMPARE(visibleChangedSpy.size(), ++visibleChangedCount); + QCOMPARE(aboutToShowSpy.size(), ++aboutToShowCount); + QCOMPARE(aboutToHideSpy.size(), aboutToHideCount); + QCOMPARE(openedSpy.size(), openedCount); + QCOMPARE(closedSpy.size(), closedCount); // ...and wait until fully open QVERIFY(openedSpy.wait()); - QCOMPARE(visibleChangedSpy.count(), visibleChangedCount); - QCOMPARE(aboutToShowSpy.count(), aboutToShowCount); - QCOMPARE(aboutToHideSpy.count(), aboutToHideCount); - QCOMPARE(openedSpy.count(), ++openedCount); - QCOMPARE(closedSpy.count(), closedCount); + QCOMPARE(visibleChangedSpy.size(), visibleChangedCount); + QCOMPARE(aboutToShowSpy.size(), aboutToShowCount); + QCOMPARE(aboutToHideSpy.size(), aboutToHideCount); + QCOMPARE(openedSpy.size(), ++openedCount); + QCOMPARE(closedSpy.size(), closedCount); // close programmatically... drawer->close(); - QCOMPARE(visibleChangedSpy.count(), visibleChangedCount); - QCOMPARE(aboutToShowSpy.count(), aboutToShowCount); - QCOMPARE(aboutToHideSpy.count(), ++aboutToHideCount); - QCOMPARE(openedSpy.count(), openedCount); - QCOMPARE(closedSpy.count(), closedCount); + QCOMPARE(visibleChangedSpy.size(), visibleChangedCount); + QCOMPARE(aboutToShowSpy.size(), aboutToShowCount); + QCOMPARE(aboutToHideSpy.size(), ++aboutToHideCount); + QCOMPARE(openedSpy.size(), openedCount); + QCOMPARE(closedSpy.size(), closedCount); // ...and wait until fully closed QVERIFY(closedSpy.wait()); - QCOMPARE(visibleChangedSpy.count(), ++visibleChangedCount); - QCOMPARE(aboutToShowSpy.count(), aboutToShowCount); - QCOMPARE(aboutToHideSpy.count(), aboutToHideCount); - QCOMPARE(openedSpy.count(), openedCount); - QCOMPARE(closedSpy.count(), ++closedCount); + QCOMPARE(visibleChangedSpy.size(), ++visibleChangedCount); + QCOMPARE(aboutToShowSpy.size(), aboutToShowCount); + QCOMPARE(aboutToHideSpy.size(), aboutToHideCount); + QCOMPARE(openedSpy.size(), openedCount); + QCOMPARE(closedSpy.size(), ++closedCount); // open interactively... QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(0, drawer->height() / 2)); QTest::mouseMove(window, QPoint(drawer->width() * 0.2, drawer->height() / 2), 16); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, QPoint(drawer->width() * 0.8, drawer->height() / 2), 16); - QCOMPARE(visibleChangedSpy.count(), ++visibleChangedCount); - QCOMPARE(aboutToShowSpy.count(), ++aboutToShowCount); - QCOMPARE(aboutToHideSpy.count(), aboutToHideCount); - QCOMPARE(openedSpy.count(), openedCount); - QCOMPARE(closedSpy.count(), closedCount); + QCOMPARE(visibleChangedSpy.size(), ++visibleChangedCount); + QCOMPARE(aboutToShowSpy.size(), ++aboutToShowCount); + QCOMPARE(aboutToHideSpy.size(), aboutToHideCount); + QCOMPARE(openedSpy.size(), openedCount); + QCOMPARE(closedSpy.size(), closedCount); // ...and wait until fully open QVERIFY(openedSpy.wait()); - QCOMPARE(visibleChangedSpy.count(), visibleChangedCount); - QCOMPARE(aboutToShowSpy.count(), aboutToShowCount); - QCOMPARE(aboutToHideSpy.count(), aboutToHideCount); - QCOMPARE(openedSpy.count(), ++openedCount); - QCOMPARE(closedSpy.count(), closedCount); + QCOMPARE(visibleChangedSpy.size(), visibleChangedCount); + QCOMPARE(aboutToShowSpy.size(), aboutToShowCount); + QCOMPARE(aboutToHideSpy.size(), aboutToHideCount); + QCOMPARE(openedSpy.size(), ++openedCount); + QCOMPARE(closedSpy.size(), closedCount); // close interactively... QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(drawer->width(), drawer->height() / 2)); QTest::mouseMove(window, QPoint(drawer->width() * 0.8, drawer->height() / 2), 16); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, QPoint(drawer->width() * 0.2, drawer->height() / 2), 16); - QCOMPARE(visibleChangedSpy.count(), visibleChangedCount); - QCOMPARE(aboutToShowSpy.count(), aboutToShowCount); - QCOMPARE(aboutToHideSpy.count(), ++aboutToHideCount); - QCOMPARE(openedSpy.count(), openedCount); - QCOMPARE(closedSpy.count(), closedCount); + QCOMPARE(visibleChangedSpy.size(), visibleChangedCount); + QCOMPARE(aboutToShowSpy.size(), aboutToShowCount); + QCOMPARE(aboutToHideSpy.size(), ++aboutToHideCount); + QCOMPARE(openedSpy.size(), openedCount); + QCOMPARE(closedSpy.size(), closedCount); // ...and wait until fully closed QVERIFY(closedSpy.wait()); - QCOMPARE(visibleChangedSpy.count(), ++visibleChangedCount); - QCOMPARE(aboutToShowSpy.count(), aboutToShowCount); - QCOMPARE(aboutToHideSpy.count(), aboutToHideCount); - QCOMPARE(openedSpy.count(), openedCount); - QCOMPARE(closedSpy.count(), ++closedCount); + QCOMPARE(visibleChangedSpy.size(), ++visibleChangedCount); + QCOMPARE(aboutToShowSpy.size(), aboutToShowCount); + QCOMPARE(aboutToHideSpy.size(), aboutToHideCount); + QCOMPARE(openedSpy.size(), openedCount); + QCOMPARE(closedSpy.size(), ++closedCount); } void tst_QQuickDrawer::position_data() @@ -518,7 +518,7 @@ void tst_QQuickDrawer::header() QSignalSpy clickSpy(button, SIGNAL(clicked())); QVERIFY(clickSpy.isValid()); QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, QPoint(button->x() + button->width() / 2, button->y() + button->height() / 2)); - QCOMPARE(clickSpy.count(), 1); + QCOMPARE(clickSpy.size(), 1); } void tst_QQuickDrawer::dragHandlerInteraction() @@ -577,7 +577,7 @@ void tst_QQuickDrawer::hover() QSignalSpy openedSpy(drawer, SIGNAL(opened())); QVERIFY(openedSpy.isValid()); drawer->open(); - QVERIFY(openedSpy.count() == 1 || openedSpy.wait()); + QVERIFY(openedSpy.size() == 1 || openedSpy.wait()); // hover the background button outside the drawer QTest::mouseMove(window, QPoint(window->width() - 1, window->height() - 1)); @@ -600,7 +600,7 @@ void tst_QQuickDrawer::hover() QSignalSpy closedSpy(drawer, SIGNAL(closed())); QVERIFY(closedSpy.isValid()); drawer->close(); - QVERIFY(closedSpy.count() == 1 || closedSpy.wait()); + QVERIFY(closedSpy.size() == 1 || closedSpy.wait()); // hover the background button after closing the drawer QTest::mouseMove(window, QPoint(window->width() / 2, window->height() / 2)); @@ -665,7 +665,7 @@ void tst_QQuickDrawer::wheel() QSignalSpy openedSpy(drawer, SIGNAL(opened())); QVERIFY(openedSpy.isValid()); drawer->open(); - QVERIFY(openedSpy.count() == 1 || openedSpy.wait()); + QVERIFY(openedSpy.size() == 1 || openedSpy.wait()); { // wheel over the drawer content @@ -725,9 +725,9 @@ void tst_QQuickDrawer::multiple() // no drawers open, click the content QTest::mouseClick(window, Qt::LeftButton); - QCOMPARE(contentClickSpy.count(), 1); - QCOMPARE(leftClickSpy.count(), 0); - QCOMPARE(rightClickSpy.count(), 0); + QCOMPARE(contentClickSpy.size(), 1); + QCOMPARE(leftClickSpy.size(), 0); + QCOMPARE(rightClickSpy.size(), 0); // drag the left drawer open QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(0, window->height() / 2)); @@ -754,30 +754,30 @@ void tst_QQuickDrawer::multiple() // click the left drawer's button QTest::mouseClick(window, Qt::LeftButton); - QCOMPARE(contentClickSpy.count(), 1); - QCOMPARE(leftClickSpy.count(), 1); - QCOMPARE(rightClickSpy.count(), 0); + QCOMPARE(contentClickSpy.size(), 1); + QCOMPARE(leftClickSpy.size(), 1); + QCOMPARE(rightClickSpy.size(), 0); // click the left drawer's background (button disabled, don't leak through to the right drawer below) leftButton->setEnabled(false); QTest::mouseClick(window, Qt::LeftButton); - QCOMPARE(contentClickSpy.count(), 1); - QCOMPARE(leftClickSpy.count(), 1); - QCOMPARE(rightClickSpy.count(), 0); + QCOMPARE(contentClickSpy.size(), 1); + QCOMPARE(leftClickSpy.size(), 1); + QCOMPARE(rightClickSpy.size(), 0); leftButton->setEnabled(true); // click the overlay of the left drawer (don't leak through to right drawer below) QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, QPoint(window->width() - (window->width() - leftDrawer->width()) / 2, window->height() / 2)); - QCOMPARE(contentClickSpy.count(), 1); - QCOMPARE(leftClickSpy.count(), 1); - QCOMPARE(rightClickSpy.count(), 0); + QCOMPARE(contentClickSpy.size(), 1); + QCOMPARE(leftClickSpy.size(), 1); + QCOMPARE(rightClickSpy.size(), 0); QTRY_VERIFY(!leftDrawer->isVisible()); // click the right drawer's button QTest::mouseClick(window, Qt::LeftButton); - QCOMPARE(contentClickSpy.count(), 1); - QCOMPARE(leftClickSpy.count(), 1); - QCOMPARE(rightClickSpy.count(), 1); + QCOMPARE(contentClickSpy.size(), 1); + QCOMPARE(leftClickSpy.size(), 1); + QCOMPARE(rightClickSpy.size(), 1); // cannot drag the left drawer while the right drawer is open QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(0, window->height() / 2)); @@ -791,23 +791,23 @@ void tst_QQuickDrawer::multiple() // click the right drawer's background (button disabled, don't leak through to the content below) rightButton->setEnabled(false); QTest::mouseClick(window, Qt::LeftButton); - QCOMPARE(contentClickSpy.count(), 1); - QCOMPARE(leftClickSpy.count(), 1); - QCOMPARE(rightClickSpy.count(), 1); + QCOMPARE(contentClickSpy.size(), 1); + QCOMPARE(leftClickSpy.size(), 1); + QCOMPARE(rightClickSpy.size(), 1); rightButton->setEnabled(true); // click the overlay of the right drawer (don't leak through to the content below) QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, QPoint((window->width() - rightDrawer->width()) / 2, window->height() / 2)); - QCOMPARE(contentClickSpy.count(), 1); - QCOMPARE(leftClickSpy.count(), 1); - QCOMPARE(rightClickSpy.count(), 1); + QCOMPARE(contentClickSpy.size(), 1); + QCOMPARE(leftClickSpy.size(), 1); + QCOMPARE(rightClickSpy.size(), 1); QTRY_VERIFY(!rightDrawer->isVisible()); // no drawers open, click the content QTest::mouseClick(window, Qt::LeftButton); - QCOMPARE(contentClickSpy.count(), 2); - QCOMPARE(leftClickSpy.count(), 1); - QCOMPARE(rightClickSpy.count(), 1); + QCOMPARE(contentClickSpy.size(), 2); + QCOMPARE(leftClickSpy.size(), 1); + QCOMPARE(rightClickSpy.size(), 1); // drag the right drawer open QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(window->width() - 1, window->height() / 2)); @@ -920,33 +920,33 @@ void tst_QQuickDrawer::multiTouch() QTest::touchEvent(window, touchDevice.data()).press(0, QPoint(300, 100)); QVERIFY(popup->isVisible()); QVERIFY(drawer->isVisible()); - QCOMPARE(buttonPressedSpy.count(), 0); - QCOMPARE(overlayPressedSpy.count(), 1); + QCOMPARE(buttonPressedSpy.size(), 0); + QCOMPARE(overlayPressedSpy.size(), 1); // 2nd press (blocked & ignored) QTest::touchEvent(window, touchDevice.data()).stationary(0).press(1, QPoint(300, 200)); QVERIFY(popup->isVisible()); QVERIFY(drawer->isVisible()); - QCOMPARE(buttonPressedSpy.count(), 0); - QCOMPARE(overlayPressedSpy.count(), 2); + QCOMPARE(buttonPressedSpy.size(), 0); + QCOMPARE(overlayPressedSpy.size(), 2); // 2nd release (blocked & ignored) QTest::touchEvent(window, touchDevice.data()).stationary(0).release(1, QPoint(300, 200)); QVERIFY(popup->isVisible()); QVERIFY(drawer->isVisible()); - QCOMPARE(buttonPressedSpy.count(), 0); - QCOMPARE(buttonReleasedSpy.count(), 0); - QCOMPARE(overlayPressedSpy.count(), 2); - QCOMPARE(overlayReleasedSpy.count(), 1); + QCOMPARE(buttonPressedSpy.size(), 0); + QCOMPARE(buttonReleasedSpy.size(), 0); + QCOMPARE(overlayPressedSpy.size(), 2); + QCOMPARE(overlayReleasedSpy.size(), 1); // 1st release QTest::touchEvent(window, touchDevice.data()).release(0, QPoint(300, 100)); QVERIFY(popup->isVisible()); QTRY_VERIFY(!drawer->isVisible()); - QCOMPARE(buttonPressedSpy.count(), 0); - QCOMPARE(buttonReleasedSpy.count(), 0); - QCOMPARE(overlayPressedSpy.count(), 2); - QCOMPARE(overlayReleasedSpy.count(), 2); + QCOMPARE(buttonPressedSpy.size(), 0); + QCOMPARE(buttonReleasedSpy.size(), 0); + QCOMPARE(overlayPressedSpy.size(), 2); + QCOMPARE(overlayReleasedSpy.size(), 2); drawer->open(); QVERIFY(drawer->isVisible()); @@ -954,8 +954,8 @@ void tst_QQuickDrawer::multiTouch() // 1st drag QTest::touchEvent(window, touchDevice.data()).press(0, QPoint(300, 100)); - QCOMPARE(buttonPressedSpy.count(), 0); - QCOMPARE(overlayPressedSpy.count(), 3); + QCOMPARE(buttonPressedSpy.size(), 0); + QCOMPARE(overlayPressedSpy.size(), 3); for (int x = 300; x >= 100; x -= 10) { QTest::touchEvent(window, touchDevice.data()).move(0, QPoint(x, 100)); QVERIFY(popup->isVisible()); @@ -965,8 +965,8 @@ void tst_QQuickDrawer::multiTouch() // 2nd drag (blocked & ignored) QTest::touchEvent(window, touchDevice.data()).stationary(0).press(1, QPoint(300, 200)); - QCOMPARE(buttonPressedSpy.count(), 0); - QCOMPARE(overlayPressedSpy.count(), 4); + QCOMPARE(buttonPressedSpy.size(), 0); + QCOMPARE(overlayPressedSpy.size(), 4); for (int x = 300; x >= 0; x -= 10) { QTest::touchEvent(window, touchDevice.data()).stationary(0).move(1, QPoint(x, 200)); QVERIFY(popup->isVisible()); @@ -979,15 +979,15 @@ void tst_QQuickDrawer::multiTouch() QVERIFY(popup->isVisible()); QVERIFY(drawer->isVisible()); QCOMPARE(drawer->position(), 0.5); - QCOMPARE(buttonReleasedSpy.count(), 0); - QCOMPARE(overlayReleasedSpy.count(), 3); + QCOMPARE(buttonReleasedSpy.size(), 0); + QCOMPARE(overlayReleasedSpy.size(), 3); // 1st release QTest::touchEvent(window, touchDevice.data()).release(0, QPoint(300, 100)); QVERIFY(popup->isVisible()); QTRY_VERIFY(!drawer->isVisible()); - QCOMPARE(buttonReleasedSpy.count(), 0); - QCOMPARE(overlayReleasedSpy.count(), 4); + QCOMPARE(buttonReleasedSpy.size(), 0); + QCOMPARE(overlayReleasedSpy.size(), 4); } void tst_QQuickDrawer::grabber() @@ -1021,10 +1021,10 @@ void tst_QQuickDrawer::grabber() QVERIFY(popupClosedSpy.isValid()); popup->open(); - QTRY_COMPARE(popupOpenedSpy.count(), 1); + QTRY_COMPARE(popupOpenedSpy.size(), 1); QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, QPoint(100, 300)); - QTRY_COMPARE(popupClosedSpy.count(), 1); + QTRY_COMPARE(popupClosedSpy.size(), 1); } void tst_QQuickDrawer::interactive_data() @@ -1062,7 +1062,7 @@ void tst_QQuickDrawer::interactive() // click outside QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, QPoint(300, 100)); - QCOMPARE(aboutToHideSpy.count(), 0); + QCOMPARE(aboutToHideSpy.size(), 0); // drag inside QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(drawer->width(), 0)); @@ -1070,7 +1070,7 @@ void tst_QQuickDrawer::interactive() QCOMPARE(drawer->position(), 1.0); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, QPoint(0, 0)); QCOMPARE(drawer->position(), 1.0); - QCOMPARE(aboutToHideSpy.count(), 0); + QCOMPARE(aboutToHideSpy.size(), 0); // drag outside QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(window->width() - 1, 0)); @@ -1078,11 +1078,11 @@ void tst_QQuickDrawer::interactive() QCOMPARE(drawer->position(), 1.0); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, QPoint(0, 0)); QCOMPARE(drawer->position(), 1.0); - QCOMPARE(aboutToHideSpy.count(), 0); + QCOMPARE(aboutToHideSpy.size(), 0); // close on escape QTest::keyClick(window, Qt::Key_Escape); - QCOMPARE(aboutToHideSpy.count(), 0); + QCOMPARE(aboutToHideSpy.size(), 0); } void tst_QQuickDrawer::flickable_data() diff --git a/tests/auto/quickcontrols2/qquickheaderview/tst_qquickheaderview.cpp b/tests/auto/quickcontrols2/qquickheaderview/tst_qquickheaderview.cpp index d9d2ab5691..28b92fef71 100644 --- a/tests/auto/quickcontrols2/qquickheaderview/tst_qquickheaderview.cpp +++ b/tests/auto/quickcontrols2/qquickheaderview/tst_qquickheaderview.cpp @@ -329,16 +329,16 @@ void tst_QQuickHeaderView::testModel() QVERIFY(modelChangedSpy.isValid()); hhv->setModel(QVariant::fromValue(thm)); - QCOMPARE(modelChangedSpy.count(), 0); + QCOMPARE(modelChangedSpy.size(), 0); hhv->setModel(QVariant::fromValue(pm)); - QCOMPARE(modelChangedSpy.count(), 1); + QCOMPARE(modelChangedSpy.size(), 1); TestTableModel ttm2; ttm2.setRowCount(100); ttm2.setColumnCount(30); hhv->setModel(QVariant::fromValue(&ttm2)); - QCOMPARE(modelChangedSpy.count(), 2); + QCOMPARE(modelChangedSpy.size(), 2); } void tst_QQuickHeaderView::listModel() diff --git a/tests/auto/quickcontrols2/qquickmenu/tst_qquickmenu.cpp b/tests/auto/quickcontrols2/qquickmenu/tst_qquickmenu.cpp index e3e58b62eb..6a1d1ab803 100644 --- a/tests/auto/quickcontrols2/qquickmenu/tst_qquickmenu.cpp +++ b/tests/auto/quickcontrols2/qquickmenu/tst_qquickmenu.cpp @@ -127,20 +127,20 @@ void tst_QQuickMenu::count() menu->addItem(new QQuickItem); QCOMPARE(menu->count(), 1); - QCOMPARE(countSpy.count(), 1); + QCOMPARE(countSpy.size(), 1); menu->insertItem(0, new QQuickItem); QCOMPARE(menu->count(), 2); - QCOMPARE(countSpy.count(), 2); + QCOMPARE(countSpy.size(), 2); menu->removeItem(menu->itemAt(1)); QCOMPARE(menu->count(), 1); - QCOMPARE(countSpy.count(), 3); + QCOMPARE(countSpy.size(), 3); QScopedPointer<QQuickItem> item(menu->takeItem(0)); QVERIFY(item); QCOMPARE(menu->count(), 0); - QCOMPARE(countSpy.count(), 4); + QCOMPARE(countSpy.size(), 4); } void tst_QQuickMenu::mouse() @@ -186,16 +186,16 @@ void tst_QQuickMenu::mouse() QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, QPoint(menu->x() + menu->leftPadding() + firstItem->width() / 2, menu->y() + menu->topPadding() + firstItem->height() / 2)); - QCOMPARE(clickedSpy.count(), 1); - QCOMPARE(triggeredSpy.count(), 1); - QTRY_COMPARE(visibleSpy.count(), 1); + QCOMPARE(clickedSpy.size(), 1); + QCOMPARE(triggeredSpy.size(), 1); + QTRY_COMPARE(visibleSpy.size(), 1); QVERIFY(!menu->isVisible()); QVERIFY(!overlay->childItems().contains(menu->contentItem())); QCOMPARE(menu->currentIndex(), -1); QCOMPARE(menu->contentItem()->property("currentIndex"), QVariant(-1)); menu->open(); - QCOMPARE(visibleSpy.count(), 2); + QCOMPARE(visibleSpy.size(), 2); QVERIFY(menu->isVisible()); QVERIFY(overlay->childItems().contains(menu->contentItem()->parentItem())); QTRY_VERIFY(menu->isOpened()); @@ -206,12 +206,12 @@ void tst_QQuickMenu::mouse() QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, QPoint(menu->contentItem()->x() + menu->contentItem()->width() + 1, menu->contentItem()->y() + menu->contentItem()->height() + 1)); - QTRY_COMPARE(visibleSpy.count(), 3); + QTRY_COMPARE(visibleSpy.size(), 3); QVERIFY(!menu->isVisible()); QVERIFY(!overlay->childItems().contains(menu->contentItem()->parentItem())); menu->open(); - QCOMPARE(visibleSpy.count(), 4); + QCOMPARE(visibleSpy.size(), 4); QVERIFY(menu->isVisible()); QVERIFY(overlay->childItems().contains(menu->contentItem()->parentItem())); QTRY_VERIFY(menu->isOpened()); @@ -304,7 +304,7 @@ void tst_QQuickMenu::contextMenuKeyboard() QVERIFY(menu->hasFocus()); menu->open(); - QCOMPARE(visibleSpy.count(), 1); + QCOMPARE(visibleSpy.size(), 1); QVERIFY(menu->isVisible()); QVERIFY(menu->hasActiveFocus()); QQuickOverlay *overlay = window->property("overlay").value<QQuickOverlay*>(); @@ -339,8 +339,8 @@ void tst_QQuickMenu::contextMenuKeyboard() QSignalSpy secondTriggeredSpy(secondItem, SIGNAL(triggered())); QTest::keyClick(window, Qt::Key_Space); - QCOMPARE(secondTriggeredSpy.count(), 1); - QTRY_COMPARE(visibleSpy.count(), 2); + QCOMPARE(secondTriggeredSpy.size(), 1); + QTRY_COMPARE(visibleSpy.size(), 2); QVERIFY(!menu->isVisible()); QVERIFY(!overlay->childItems().contains(menu->contentItem())); QVERIFY(!firstItem->hasActiveFocus()); @@ -355,7 +355,7 @@ void tst_QQuickMenu::contextMenuKeyboard() // Enter/return should also work. // Open the menu. menu->open(); - QCOMPARE(visibleSpy.count(), 3); + QCOMPARE(visibleSpy.size(), 3); QVERIFY(menu->isVisible()); QTRY_VERIFY(menu->isOpened()); // Give the first item focus. @@ -369,8 +369,8 @@ void tst_QQuickMenu::contextMenuKeyboard() // Press enter. QSignalSpy firstTriggeredSpy(firstItem, SIGNAL(triggered())); QTest::keyClick(window, Qt::Key_Return); - QCOMPARE(firstTriggeredSpy.count(), 1); - QTRY_COMPARE(visibleSpy.count(), 4); + QCOMPARE(firstTriggeredSpy.size(), 1); + QTRY_COMPARE(visibleSpy.size(), 4); QVERIFY(!menu->isVisible()); QVERIFY(!overlay->childItems().contains(menu->contentItem())); QVERIFY(!firstItem->hasActiveFocus()); @@ -383,7 +383,7 @@ void tst_QQuickMenu::contextMenuKeyboard() QCOMPARE(menu->contentItem()->property("currentIndex"), QVariant(-1)); menu->open(); - QCOMPARE(visibleSpy.count(), 5); + QCOMPARE(visibleSpy.size(), 5); QVERIFY(menu->isVisible()); QVERIFY(overlay->childItems().contains(menu->contentItem()->parentItem())); QTRY_VERIFY(menu->isOpened()); @@ -460,7 +460,7 @@ void tst_QQuickMenu::contextMenuKeyboard() QVERIFY(!thirdItem->isHighlighted()); QTest::keyClick(window, Qt::Key_Escape); - QTRY_COMPARE(visibleSpy.count(), 6); + QTRY_COMPARE(visibleSpy.size(), 6); QVERIFY(!menu->isVisible()); } @@ -565,7 +565,7 @@ void tst_QQuickMenu::mnemonics() QSignalSpy actionSpy(action, &QQuickAction::triggered); QVERIFY(actionSpy.isValid()); keySim.click(Qt::Key_A); // "&Action" - QCOMPARE(actionSpy.count(), 1); + QCOMPARE(actionSpy.size(), 1); menu->open(); QTRY_VERIFY(menu->isOpened()); @@ -574,7 +574,7 @@ void tst_QQuickMenu::mnemonics() QVERIFY(menuItemSpy.isValid()); keySim.click(Qt::Key_I); // "Menu &Item" keySim.release(Qt::Key_Alt); - QCOMPARE(menuItemSpy.count(), 1); + QCOMPARE(menuItemSpy.size(), 1); keySim.press(Qt::Key_Alt); menu->open(); @@ -587,7 +587,7 @@ void tst_QQuickMenu::mnemonics() QVERIFY(subMenuItemSpy.isValid()); keySim.click(Qt::Key_S); // "&Sub Menu Item" keySim.release(Qt::Key_Alt); - QCOMPARE(subMenuItemSpy.count(), 1); + QCOMPARE(subMenuItemSpy.size(), 1); } void tst_QQuickMenu::menuButton() @@ -614,7 +614,7 @@ void tst_QQuickMenu::menuButton() menuButton->setVisible(true); QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, menuButton->mapToScene(QPointF(menuButton->width() / 2, menuButton->height() / 2)).toPoint()); - QCOMPARE(visibleSpy.count(), 1); + QCOMPARE(visibleSpy.size(), 1); QVERIFY(menu->isVisible()); QTRY_VERIFY(menu->isOpened()); @@ -787,7 +787,7 @@ void tst_QQuickMenu::order() const QStringList texts = {"dynamic_0", "static_1", "repeated_2", "repeated_3", "static_4", "dynamic_5", "dynamic_6"}; - for (int i = 0; i < texts.count(); ++i) { + for (int i = 0; i < texts.size(); ++i) { QQuickItem *item = menu->itemAt(i); QVERIFY(item); QCOMPARE(item->property("text").toString(), texts.at(i)); @@ -1056,7 +1056,7 @@ void tst_QQuickMenu::actionShortcuts() QVERIFY(action1TriggeredSpy.isValid()); QTest::keyClick(window, Qt::Key_A); - QCOMPARE(action1TriggeredSpy.count(), 1); + QCOMPARE(action1TriggeredSpy.size(), 1); // Try the sub-menu. QQuickMenu *subMenu = window->property("subMenu").value<QQuickMenu *>(); @@ -1069,7 +1069,7 @@ void tst_QQuickMenu::actionShortcuts() QVERIFY(subMenuAction1TriggeredSpy.isValid()); QTest::keyClick(window, Qt::Key_B); - QCOMPARE(subMenuAction1TriggeredSpy.count(), 1); + QCOMPARE(subMenuAction1TriggeredSpy.size(), 1); // Try the button menu. QQuickMenu *buttonMenu = window->property("buttonMenu").value<QQuickMenu *>(); @@ -1082,7 +1082,7 @@ void tst_QQuickMenu::actionShortcuts() QVERIFY(buttonMenuAction1TriggeredSpy.isValid()); QTest::keyClick(window, Qt::Key_C); - QCOMPARE(buttonMenuAction1TriggeredSpy.count(), 1); + QCOMPARE(buttonMenuAction1TriggeredSpy.size(), 1); } #endif @@ -2067,7 +2067,7 @@ void tst_QQuickMenu::giveMenuItemFocusOnButtonPress() QVERIFY(clickedSpy.isValid()); QTest::keyClick(window, Qt::Key_Return); - QCOMPARE(clickedSpy.count(), 1); + QCOMPARE(clickedSpy.size(), 1); // The menu should still be open. QQuickMenu *menu = window->property("menu").value<QQuickMenu*>(); diff --git a/tests/auto/quickcontrols2/qquickmenubar/tst_qquickmenubar.cpp b/tests/auto/quickcontrols2/qquickmenubar/tst_qquickmenubar.cpp index 2544aa4d79..f4b3aaf210 100644 --- a/tests/auto/quickcontrols2/qquickmenubar/tst_qquickmenubar.cpp +++ b/tests/auto/quickcontrols2/qquickmenubar/tst_qquickmenubar.cpp @@ -568,19 +568,19 @@ void tst_qquickmenubar::mnemonics() // trigger a menu item to close the menu, which shouldn't trigger a button // action behind the menu (QTBUG-86276) - QCOMPARE(oopsButtonSpy.count(), 0); + QCOMPARE(oopsButtonSpy.size(), 0); keySim.click(Qt::Key_O); // "&Open..." keySim.release(Qt::Key_Alt); QVERIFY(!fileMenuBarItem->isHighlighted()); QVERIFY(!fileMenuBarMenu->isOpened()); QTRY_VERIFY(!fileMenuBarMenu->isVisible()); - QCOMPARE(oopsButtonSpy.count(), 0); + QCOMPARE(oopsButtonSpy.size(), 0); // trigger a button action while menu is closed keySim.press(Qt::Key_Alt); keySim.click(Qt::Key_O); // "&Oops" keySim.release(Qt::Key_Alt); - QCOMPARE(oopsButtonSpy.count(), 1); + QCOMPARE(oopsButtonSpy.size(), 1); } void tst_qquickmenubar::addRemove() diff --git a/tests/auto/quickcontrols2/qquickninepatchimage/tst_qquickninepatchimage.cpp b/tests/auto/quickcontrols2/qquickninepatchimage/tst_qquickninepatchimage.cpp index d11e5c8536..c1fb1f7264 100644 --- a/tests/auto/quickcontrols2/qquickninepatchimage/tst_qquickninepatchimage.cpp +++ b/tests/auto/quickcontrols2/qquickninepatchimage/tst_qquickninepatchimage.cpp @@ -152,7 +152,7 @@ void tst_qquickninepatchimage::inset_data() const QStringList files = QStringList() << "inset-all.9.png" << "inset-topleft.9.png" << "inset-bottomright.9.png"; const QList<QMarginsF> insets = QList<QMarginsF>() << QMarginsF(2, 1, 3, 4) << QMarginsF(2, 1, 0, 0) << QMarginsF(0, 0, 3, 4); - for (int i = 0; i < files.count(); ++i) { + for (int i = 0; i < files.size(); ++i) { QString file = files.at(i); for (int dpr = 1; dpr <= 4; ++dpr) QTest::newRow(qPrintable(QString::fromLatin1("%1 DPR=%2").arg(file).arg(dpr))) << dpr << file << insets.at(i); diff --git a/tests/auto/quickcontrols2/qquickpopup/tst_qquickpopup.cpp b/tests/auto/quickcontrols2/qquickpopup/tst_qquickpopup.cpp index 5b14c6b867..c2afc97fa9 100644 --- a/tests/auto/quickcontrols2/qquickpopup/tst_qquickpopup.cpp +++ b/tests/auto/quickcontrols2/qquickpopup/tst_qquickpopup.cpp @@ -176,18 +176,18 @@ void tst_QQuickPopup::state() QVERIFY(closedSpy.isValid()); popup->open(); - QCOMPARE(visibleChangedSpy.count(), 1); - QCOMPARE(aboutToShowSpy.count(), 1); - QCOMPARE(aboutToHideSpy.count(), 0); - QTRY_COMPARE(openedSpy.count(), 1); - QCOMPARE(closedSpy.count(), 0); + QCOMPARE(visibleChangedSpy.size(), 1); + QCOMPARE(aboutToShowSpy.size(), 1); + QCOMPARE(aboutToHideSpy.size(), 0); + QTRY_COMPARE(openedSpy.size(), 1); + QCOMPARE(closedSpy.size(), 0); popup->close(); - QTRY_COMPARE(visibleChangedSpy.count(), 2); - QCOMPARE(aboutToShowSpy.count(), 1); - QCOMPARE(aboutToHideSpy.count(), 1); - QCOMPARE(openedSpy.count(), 1); - QTRY_COMPARE(closedSpy.count(), 1); + QTRY_COMPARE(visibleChangedSpy.size(), 2); + QCOMPARE(aboutToShowSpy.size(), 1); + QCOMPARE(aboutToHideSpy.size(), 1); + QCOMPARE(openedSpy.size(), 1); + QTRY_COMPARE(closedSpy.size(), 1); } void tst_QQuickPopup::overlay_data() @@ -232,8 +232,8 @@ void tst_QQuickPopup::overlay() QVERIFY(!overlay->isVisible()); // no popups open QTest::mouseClick(window, Qt::LeftButton); - QCOMPARE(overlayPressedSignal.count(), 0); - QCOMPARE(overlayReleasedSignal.count(), 0); + QCOMPARE(overlayPressedSignal.size(), 0); + QCOMPARE(overlayReleasedSignal.size(), 0); QQuickPopup *popup = window->property("popup").value<QQuickPopup*>(); QVERIFY(popup); @@ -259,19 +259,19 @@ void tst_QQuickPopup::overlay() QTRY_VERIFY(popup->isOpened()); QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(1, 1)); - QCOMPARE(overlayPressedSignal.count(), ++overlayPressCount); - QCOMPARE(overlayReleasedSignal.count(), overlayReleaseCount); - QCOMPARE(overlayAttachedPressedSignal.count(), overlayPressCount); - QCOMPARE(overlayAttachedReleasedSignal.count(), overlayReleaseCount); + QCOMPARE(overlayPressedSignal.size(), ++overlayPressCount); + QCOMPARE(overlayReleasedSignal.size(), overlayReleaseCount); + QCOMPARE(overlayAttachedPressedSignal.size(), overlayPressCount); + QCOMPARE(overlayAttachedReleasedSignal.size(), overlayReleaseCount); QTRY_VERIFY(!popup->isVisible()); QVERIFY(!overlay->isVisible()); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, QPoint(1, 1)); - QCOMPARE(overlayPressedSignal.count(), overlayPressCount); - QCOMPARE(overlayReleasedSignal.count(), overlayReleaseCount); // no modal-popups open - QCOMPARE(overlayAttachedPressedSignal.count(), overlayPressCount); - QCOMPARE(overlayAttachedReleasedSignal.count(), overlayReleaseCount); + QCOMPARE(overlayPressedSignal.size(), overlayPressCount); + QCOMPARE(overlayReleasedSignal.size(), overlayReleaseCount); // no modal-popups open + QCOMPARE(overlayAttachedPressedSignal.size(), overlayPressCount); + QCOMPARE(overlayAttachedReleasedSignal.size(), overlayReleaseCount); popup->setDim(dim); popup->setModal(modal); @@ -284,16 +284,16 @@ void tst_QQuickPopup::overlay() QTRY_VERIFY(popup->isOpened()); QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(1, 1)); - QCOMPARE(overlayPressedSignal.count(), ++overlayPressCount); - QCOMPARE(overlayReleasedSignal.count(), overlayReleaseCount); - QCOMPARE(overlayAttachedPressedSignal.count(), overlayPressCount); - QCOMPARE(overlayAttachedReleasedSignal.count(), overlayReleaseCount); + QCOMPARE(overlayPressedSignal.size(), ++overlayPressCount); + QCOMPARE(overlayReleasedSignal.size(), overlayReleaseCount); + QCOMPARE(overlayAttachedPressedSignal.size(), overlayPressCount); + QCOMPARE(overlayAttachedReleasedSignal.size(), overlayReleaseCount); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, QPoint(1, 1)); - QCOMPARE(overlayPressedSignal.count(), overlayPressCount); - QCOMPARE(overlayReleasedSignal.count(), ++overlayReleaseCount); - QCOMPARE(overlayAttachedPressedSignal.count(), overlayPressCount); - QCOMPARE(overlayAttachedReleasedSignal.count(), overlayReleaseCount); + QCOMPARE(overlayPressedSignal.size(), overlayPressCount); + QCOMPARE(overlayReleasedSignal.size(), ++overlayReleaseCount); + QCOMPARE(overlayAttachedPressedSignal.size(), overlayPressCount); + QCOMPARE(overlayAttachedReleasedSignal.size(), overlayReleaseCount); QTRY_VERIFY(!popup->isVisible()); QVERIFY(!overlay->isVisible()); @@ -305,16 +305,16 @@ void tst_QQuickPopup::overlay() QTRY_VERIFY(popup->isOpened()); QTest::touchEvent(window, device.data()).press(0, QPoint(1, 1)); - QCOMPARE(overlayPressedSignal.count(), ++overlayPressCount); - QCOMPARE(overlayReleasedSignal.count(), overlayReleaseCount); - QCOMPARE(overlayAttachedPressedSignal.count(), overlayPressCount); - QCOMPARE(overlayAttachedReleasedSignal.count(), overlayReleaseCount); + QCOMPARE(overlayPressedSignal.size(), ++overlayPressCount); + QCOMPARE(overlayReleasedSignal.size(), overlayReleaseCount); + QCOMPARE(overlayAttachedPressedSignal.size(), overlayPressCount); + QCOMPARE(overlayAttachedReleasedSignal.size(), overlayReleaseCount); QTest::touchEvent(window, device.data()).release(0, QPoint(1, 1)); - QCOMPARE(overlayPressedSignal.count(), overlayPressCount); - QCOMPARE(overlayReleasedSignal.count(), ++overlayReleaseCount); - QCOMPARE(overlayAttachedPressedSignal.count(), overlayPressCount); - QCOMPARE(overlayAttachedReleasedSignal.count(), overlayReleaseCount); + QCOMPARE(overlayPressedSignal.size(), overlayPressCount); + QCOMPARE(overlayReleasedSignal.size(), ++overlayReleaseCount); + QCOMPARE(overlayAttachedPressedSignal.size(), overlayPressCount); + QCOMPARE(overlayAttachedReleasedSignal.size(), overlayReleaseCount); QTRY_VERIFY(!popup->isVisible()); QVERIFY(!overlay->isVisible()); @@ -330,29 +330,29 @@ void tst_QQuickPopup::overlay() QVERIFY(popup->isVisible()); QVERIFY(overlay->isVisible()); QCOMPARE(button->isPressed(), !modal); - QCOMPARE(overlayPressedSignal.count(), ++overlayPressCount); - QCOMPARE(overlayReleasedSignal.count(), overlayReleaseCount); + QCOMPARE(overlayPressedSignal.size(), ++overlayPressCount); + QCOMPARE(overlayReleasedSignal.size(), overlayReleaseCount); QTest::touchEvent(window, device.data()).stationary(0).press(1, button->mapToScene(QPointF(button->width() / 2, button->height() / 2)).toPoint()); QVERIFY(popup->isVisible()); QVERIFY(overlay->isVisible()); QCOMPARE(button->isPressed(), !modal); - QCOMPARE(overlayPressedSignal.count(), ++overlayPressCount); - QCOMPARE(overlayReleasedSignal.count(), overlayReleaseCount); + QCOMPARE(overlayPressedSignal.size(), ++overlayPressCount); + QCOMPARE(overlayReleasedSignal.size(), overlayReleaseCount); QTest::touchEvent(window, device.data()).release(0, button->mapToScene(QPointF(1, 1)).toPoint()).stationary(1); QTRY_VERIFY(!popup->isVisible()); QVERIFY(!overlay->isVisible()); QVERIFY(!button->isPressed()); - QCOMPARE(overlayPressedSignal.count(), overlayPressCount); - QCOMPARE(overlayReleasedSignal.count(), ++overlayReleaseCount); + QCOMPARE(overlayPressedSignal.size(), overlayPressCount); + QCOMPARE(overlayReleasedSignal.size(), ++overlayReleaseCount); QTest::touchEvent(window, device.data()).release(1, button->mapToScene(QPointF(button->width() / 2, button->height() / 2)).toPoint()); QVERIFY(!popup->isVisible()); QVERIFY(!overlay->isVisible()); QVERIFY(!button->isPressed()); - QCOMPARE(overlayPressedSignal.count(), overlayPressCount); - QCOMPARE(overlayReleasedSignal.count(), overlayReleaseCount); + QCOMPARE(overlayPressedSignal.size(), overlayPressCount); + QCOMPARE(overlayReleasedSignal.size(), overlayReleaseCount); } void tst_QQuickPopup::zOrder_data() @@ -405,40 +405,40 @@ void tst_QQuickPopup::windowChange() QQuickItem item; popup.setParentItem(&item); QVERIFY(!popup.window()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QQuickWindow window; item.setParentItem(window.contentItem()); QCOMPARE(popup.window(), &window); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); item.setParentItem(nullptr); QVERIFY(!popup.window()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); popup.setParentItem(window.contentItem()); QCOMPARE(popup.window(), &window); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); popup.resetParentItem(); QVERIFY(!popup.window()); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); popup.setParent(&window); popup.resetParentItem(); QCOMPARE(popup.window(), &window); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); popup.setParent(this); popup.resetParentItem(); QVERIFY(!popup.window()); - QCOMPARE(spy.count(), 6); + QCOMPARE(spy.size(), 6); item.setParentItem(window.contentItem()); popup.setParent(&item); popup.resetParentItem(); QCOMPARE(popup.window(), &window); - QCOMPARE(spy.count(), 7); + QCOMPARE(spy.size(), 7); popup.setParent(nullptr); } @@ -945,7 +945,7 @@ void tst_QQuickPopup::hover() QSignalSpy openedSpy(popup, SIGNAL(opened())); QVERIFY(openedSpy.isValid()); popup->open(); - QVERIFY(openedSpy.count() == 1 || openedSpy.wait()); + QVERIFY(openedSpy.size() == 1 || openedSpy.wait()); QTRY_VERIFY(popup->width() > 10); // somehow this can take a short time with macOS style // hover the parent button outside the popup @@ -966,7 +966,7 @@ void tst_QQuickPopup::hover() QSignalSpy closedSpy(popup, SIGNAL(closed())); QVERIFY(closedSpy.isValid()); popup->close(); - QVERIFY(closedSpy.count() == 1 || closedSpy.wait()); + QVERIFY(closedSpy.size() == 1 || closedSpy.wait()); // hover the parent button after closing the popup QTest::mouseMove(window, QPoint(window->width() / 2, window->height() / 2)); @@ -1029,7 +1029,7 @@ void tst_QQuickPopup::wheel() QSignalSpy openedSpy(popup, SIGNAL(opened())); QVERIFY(openedSpy.isValid()); popup->open(); - QVERIFY(openedSpy.count() == 1 || openedSpy.wait()); + QVERIFY(openedSpy.size() == 1 || openedSpy.wait()); { // wheel over the popup content @@ -1353,12 +1353,12 @@ void tst_QQuickPopup::enabled() popup.setEnabled(false); QVERIFY(!popup.isEnabled()); QVERIFY(!popup.popupItem()->isEnabled()); - QCOMPARE(enabledSpy.count(), 1); + QCOMPARE(enabledSpy.size(), 1); popup.popupItem()->setEnabled(true); QVERIFY(popup.isEnabled()); QVERIFY(popup.popupItem()->isEnabled()); - QCOMPARE(enabledSpy.count(), 2); + QCOMPARE(enabledSpy.size(), 2); } void tst_QQuickPopup::orientation_data() @@ -1477,15 +1477,15 @@ void tst_QQuickPopup::disabledPalette() auto palette = QQuickPopupPrivate::get(popup)->palette(); palette->setBase(Qt::green); palette->disabled()->setBase(Qt::red); - QCOMPARE(popupPaletteSpy.count(), 2); - QCOMPARE(popupItemPaletteSpy.count(), 2); + QCOMPARE(popupPaletteSpy.size(), 2); + QCOMPARE(popupItemPaletteSpy.size(), 2); QCOMPARE(popup->background()->property("color").value<QColor>(), Qt::green); popup->setEnabled(false); - QCOMPARE(popupEnabledSpy.count(), 1); - QCOMPARE(popupItemEnabledSpy.count(), 1); - QCOMPARE(popupPaletteSpy.count(), 3); - QCOMPARE(popupItemPaletteSpy.count(), 3); + QCOMPARE(popupEnabledSpy.size(), 1); + QCOMPARE(popupItemEnabledSpy.size(), 1); + QCOMPARE(popupPaletteSpy.size(), 3); + QCOMPARE(popupItemPaletteSpy.size(), 3); QCOMPARE(popup->background()->property("color").value<QColor>(), Qt::red); } @@ -1517,8 +1517,8 @@ void tst_QQuickPopup::disabledParentPalette() auto palette = QQuickPopupPrivate::get(popup)->palette(); palette->setBase(Qt::green); palette->disabled()->setBase(Qt::red); - QCOMPARE(popupPaletteSpy.count(), 2); - QCOMPARE(popupItemPaletteSpy.count(), 2); + QCOMPARE(popupPaletteSpy.size(), 2); + QCOMPARE(popupItemPaletteSpy.size(), 2); QCOMPARE(popup->background()->property("color").value<QColor>(), Qt::green); // Disable the overlay (which is QQuickPopupItem's parent) to ensure that @@ -1529,10 +1529,10 @@ void tst_QQuickPopup::disabledParentPalette() QVERIFY(!popup->isEnabled()); QVERIFY(!popup->popupItem()->isEnabled()); QCOMPARE(popup->background()->property("color").value<QColor>(), Qt::red); - QCOMPARE(popupEnabledSpy.count(), 1); - QCOMPARE(popupItemEnabledSpy.count(), 1); - QCOMPARE(popupPaletteSpy.count(), 3); - QCOMPARE(popupItemPaletteSpy.count(), 3); + QCOMPARE(popupEnabledSpy.size(), 1); + QCOMPARE(popupItemEnabledSpy.size(), 1); + QCOMPARE(popupPaletteSpy.size(), 3); + QCOMPARE(popupItemPaletteSpy.size(), 3); popup->close(); QTRY_VERIFY(!popup->isVisible()); @@ -1690,7 +1690,7 @@ void tst_QQuickPopup::invisibleToolTipOpen() QVERIFY(componentLoadedSpy.isValid()); loader->setProperty("active", true); - QTRY_COMPARE(componentLoadedSpy.count(), 1); + QTRY_COMPARE(componentLoadedSpy.size(), 1); QTRY_VERIFY(toolTip->isVisible()); } diff --git a/tests/auto/quickcontrols2/qquicktextarea/tst_qquicktextarea.cpp b/tests/auto/quickcontrols2/qquicktextarea/tst_qquicktextarea.cpp index 1d80287324..1c40b078f7 100644 --- a/tests/auto/quickcontrols2/qquicktextarea/tst_qquicktextarea.cpp +++ b/tests/auto/quickcontrols2/qquicktextarea/tst_qquicktextarea.cpp @@ -113,7 +113,7 @@ void tst_QQuickTextArea::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 const qreal yOffset = bottom->topPadding() + 6; // where to tap or drag to hit the text @@ -131,7 +131,7 @@ void tst_QQuickTextArea::touchscreenSetsFocusAndMovesCursor() // typing a character inserts it at the cursor position QVERIFY(!bottom->text().contains('q')); QTest::keyClick(&window, Qt::Key_Q); - QCOMPARE(bottom->text().length(), len + 1); + QCOMPARE(bottom->text().size(), len + 1); QCOMPARE_GT(bottom->text().indexOf('q'), 0); // press-drag-and-release from p1 to p2 on the top field diff --git a/tests/auto/quickcontrols2/qquicktreeviewdelegate/testmodel.cpp b/tests/auto/quickcontrols2/qquicktreeviewdelegate/testmodel.cpp index 22e45f62cb..6c6da8452b 100644 --- a/tests/auto/quickcontrols2/qquicktreeviewdelegate/testmodel.cpp +++ b/tests/auto/quickcontrols2/qquicktreeviewdelegate/testmodel.cpp @@ -51,7 +51,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/quickcontrols2/qquicktreeviewdelegate/tst_qquicktreeviewdelegate.cpp b/tests/auto/quickcontrols2/qquicktreeviewdelegate/tst_qquicktreeviewdelegate.cpp index eaa9bac2ea..1420a0e6a8 100644 --- a/tests/auto/quickcontrols2/qquicktreeviewdelegate/tst_qquicktreeviewdelegate.cpp +++ b/tests/auto/quickcontrols2/qquicktreeviewdelegate/tst_qquicktreeviewdelegate.cpp @@ -297,7 +297,7 @@ void tst_qquicktreeviewdelegate::checkClickedSignal() QPoint localPos = QPoint(item->width() / 2, item->height() / 2); QPoint pos = item->window()->contentItem()->mapFromItem(item, localPos).toPoint(); QTest::mouseClick(item->window(), Qt::LeftButton, Qt::NoModifier, pos); - QCOMPARE(clickedSpy.count(), 1); + QCOMPARE(clickedSpy.size(), 1); clickedSpy.clear(); // Click on the indicator @@ -306,7 +306,7 @@ void tst_qquicktreeviewdelegate::checkClickedSignal() localPos = QPoint(indicator->x() + indicator->width() / 2, indicator->y() + indicator->height() / 2); pos = item->window()->contentItem()->mapFromItem(item, localPos).toPoint(); QTest::mouseClick(item->window(), Qt::LeftButton, Qt::NoModifier, pos); - QCOMPARE(clickedSpy.count(), 0); + QCOMPARE(clickedSpy.size(), 0); } void tst_qquicktreeviewdelegate::clearSelectionOnClick() diff --git a/tests/auto/quickcontrols2/translation/tst_translation.cpp b/tests/auto/quickcontrols2/translation/tst_translation.cpp index 76e3244cbd..f0798d0367 100644 --- a/tests/auto/quickcontrols2/translation/tst_translation.cpp +++ b/tests/auto/quickcontrols2/translation/tst_translation.cpp @@ -157,7 +157,7 @@ void tst_translation::stackView() QVERIFY(button); // Shouldn't crash when calling retranslate. QVERIFY(clickButton(button)); - QTRY_COMPARE(calledTranslateSpy.count(), 1); + QTRY_COMPARE(calledTranslateSpy.size(), 1); } QTEST_MAIN(tst_translation) |