From 71bd06d516a2410ae0ea698e79dcb94aba9bc5b4 Mon Sep 17 00:00:00 2001 From: Sami Nurmenniemi Date: Wed, 13 Jun 2018 16:35:40 +0300 Subject: Make developer build tests pass for boot2qt Some tests were fixed and others were skipped/blacklisted. Task-number: QTBUG-63152 Change-Id: Ica7df555f8d152ee589865911130525101d4b941 Reviewed-by: Liang Qi --- tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/auto/widgets') diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 7c1deb8fff..d5eef521ed 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -1671,6 +1671,13 @@ void tst_QComboBox::setCustomModelAndView() QTRY_VERIFY(combo.view()->isVisible()); const QRect subItemRect = view->visualRect(model->indexFromItem(subItem)); QWidget *window = view->window(); + + // QComboBox sometimes ignores the mouse click event for doubleClickInterval + // depending on which tests have been run previously. On arm this happens + // more often than on x86. Search for maybeIgnoreMouseButtonRelease to see + // why this happens. + QTest::qWait(QApplication::doubleClickInterval()); + QTest::mouseClick(window->windowHandle(), Qt::LeftButton, 0, view->mapTo(window, subItemRect.center())); QTRY_COMPARE(combo.currentText(), subItem21Text); } @@ -3436,6 +3443,11 @@ void tst_QComboBox::task_QTBUG_52027_mapCompleterIndex() model->setFilterFixedString("foobar1"); completer->setModel(model); + if (QGuiApplication::platformName() == "offscreen") { + QWARN("Offscreen platform requires explicit activateWindow()"); + cbox.activateWindow(); + } + QApplication::setActiveWindow(&cbox); QVERIFY(QTest::qWaitForWindowActive(&cbox)); -- cgit v1.2.3 From d1f924bbce4e0057bdfe3cf3c10140895bec7510 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 23 Nov 2018 17:59:49 +0100 Subject: Fix tst_QStyleSheetStyle crash on uncommon multi-screen setup It would crash if there is no screen at 0,0. Change-Id: Ic84d75b3d8b917fe3696530cbe843e82923ba676 Reviewed-by: Friedemann Kleint --- tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/auto/widgets') diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp index f5d9433f70..03f24ba151 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -2085,7 +2085,8 @@ void tst_QStyleSheetStyle::highdpiImages() QFETCH(QColor, color); QWidget w; - QScreen *screen = QGuiApplication::screenAt(w.pos()); + QScreen *screen = QGuiApplication::primaryScreen(); + w.move(screen->availableGeometry().topLeft()); QHighDpiScaling::setScreenFactor(screen, screenFactor); w.setStyleSheet("QWidget { background-image: url(\":/images/testimage.png\"); }"); w.show(); -- cgit v1.2.3 From a5e32f93759db5aff30994546cd1cc172e6a57dc Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 27 Nov 2018 14:34:26 +0100 Subject: Re-enable the QScroller tests on macOS Maybe they aren't flaky anymore... let's find out. Task-number: QTBUG-29950 Task-number: QTBUG-30133 Change-Id: I1a2a3ef7facac5b6e59588d7c6b1b28b40a788ea Reviewed-by: Friedemann Kleint --- tests/auto/widgets/util/qscroller/tst_qscroller.cpp | 9 --------- 1 file changed, 9 deletions(-) (limited to 'tests/auto/widgets') diff --git a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp b/tests/auto/widgets/util/qscroller/tst_qscroller.cpp index 43063881b2..fac13c7074 100644 --- a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp +++ b/tests/auto/widgets/util/qscroller/tst_qscroller.cpp @@ -347,9 +347,6 @@ void tst_QScroller::scrollerProperties() void tst_QScroller::scrollTo() { -#ifdef Q_OS_MAC - QSKIP("Flakey test - QTBUG-29950"); -#endif { tst_QScrollerWidget *sw = new tst_QScrollerWidget(); sw->scrollArea = QRectF( 0, 0, 1000, 1000 ); @@ -376,9 +373,6 @@ void tst_QScroller::scrollTo() void tst_QScroller::scroll() { -#ifdef Q_OS_MAC - QSKIP("Flakey test - QTBUG-30133"); -#endif #ifndef QT_NO_GESTURES // -- good case. normal scroll tst_QScrollerWidget *sw = new tst_QScrollerWidget(); @@ -419,9 +413,6 @@ void tst_QScroller::scroll() void tst_QScroller::overshoot() { -#ifdef Q_OS_MAC - QSKIP("Flakey test - QTBUG-29950"); -#endif #ifndef QT_NO_GESTURES tst_QScrollerWidget *sw = new tst_QScrollerWidget(); sw->scrollArea = QRectF(0, 0, 1000, 1000); -- cgit v1.2.3 From f1812aad895ed2b8337a6d98d05623714680aba9 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Thu, 8 Nov 2018 14:11:11 +0100 Subject: QFocusFrame: protect it from being moved around by accident If a focus frame is set around a widget that exist inside a QAbstractItemView, both the focus frame and the widget will be scrolled when the table is scrolled (since the focus frame is a child of the view). The result is that after the widget has been scrolled (which will move the focus frame to the correct position as well), the focus frame will be scrolled next, and therefore away from the widget. This patch will catch this case by always adjusting the focus frame position when someone tries to move it. Trying to move the focus frame away from the widget it tracks will anyway be flaky. Fixes: QTBUG-63877 Change-Id: Ic2aacc4fafc219280e32092c258a7539d0db9cd0 Reviewed-by: Timur Pocheptsov --- .../widgets/qfocusframe/tst_qfocusframe.cpp | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'tests/auto/widgets') diff --git a/tests/auto/widgets/widgets/qfocusframe/tst_qfocusframe.cpp b/tests/auto/widgets/widgets/qfocusframe/tst_qfocusframe.cpp index e6e689336a..657a1ea55c 100644 --- a/tests/auto/widgets/widgets/qfocusframe/tst_qfocusframe.cpp +++ b/tests/auto/widgets/widgets/qfocusframe/tst_qfocusframe.cpp @@ -32,6 +32,8 @@ #include #include #include +#include +#include class tst_QFocusFrame : public QObject { @@ -43,6 +45,7 @@ public: private slots: void getSetCheck(); + void focusFrameInsideScrollview(); }; tst_QFocusFrame::tst_QFocusFrame() @@ -68,5 +71,41 @@ void tst_QFocusFrame::getSetCheck() delete obj1; } +void tst_QFocusFrame::focusFrameInsideScrollview() +{ + // Make sure that the focus frame follows the widget, even + // if the widget is inside a QAbstractItemView. A QAbstractItemView will scroll + // all the children, including the focus frame, when it scrolls, which + // is why special considerations are taken inside the focus frame to + // prevent the frame to scroll away from the widget it tracks. + + if (qApp->style()->objectName() != QLatin1String("macintosh")) + QSKIP("This test is only valid when using a style that has a focus frame"); + + QWidget window; + window.setGeometry(100, 100, 500, 500); + + QTableView tableView(&window); + tableView.resize(window.size()); + QStandardItemModel *itemModel = new QStandardItemModel(); + for (int i = 0; i < 50; ++i) + itemModel->appendRow(new QStandardItem("Value")); + tableView.setModel(itemModel); + tableView.edit(itemModel->index(8, 0)); + + window.show(); + QFocusFrame *focusFrame = nullptr; + QTRY_VERIFY(focusFrame = window.findChild()); + const QPoint initialOffset = focusFrame->widget()->mapToGlobal(QPoint()) - focusFrame->mapToGlobal(QPoint()); + + tableView.scrollTo(itemModel->index(40, 0)); + QPoint offsetAfterScroll = focusFrame->widget()->mapToGlobal(QPoint()) - focusFrame->mapToGlobal(QPoint()); + QCOMPARE(offsetAfterScroll, initialOffset); + + tableView.scrollTo(itemModel->index(0, 0)); + offsetAfterScroll = focusFrame->widget()->mapToGlobal(QPoint()) - focusFrame->mapToGlobal(QPoint()); + QCOMPARE(offsetAfterScroll, initialOffset); +} + QTEST_MAIN(tst_QFocusFrame) #include "tst_qfocusframe.moc" -- cgit v1.2.3