diff options
author | Liang Qi <liang.qi@qt.io> | 2018-12-04 09:58:43 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-12-04 09:58:43 +0100 |
commit | 5d5c00c67682bce105197b659687fd1fee8f60cf (patch) | |
tree | 686e41dc3ea121235fb73afb9157ed603f1bfeff /tests/auto/widgets | |
parent | f213e818f03d35cb82e3daf187415197fd156f8e (diff) | |
parent | b82559244e2dc03f1ceff66bb67630df4300dc7c (diff) |
Merge remote-tracking branch 'origin/5.12' into dev
Conflicts:
src/gui/painting/qdrawhelper.cpp
Change-Id: I4916e07b635e1d3830e9b46ef7914f99bec3098e
Diffstat (limited to 'tests/auto/widgets')
4 files changed, 53 insertions, 10 deletions
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp index bfef9d2ac4..8f1f8590cb 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(); 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); diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 943fb997cd..5b4761ba87 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())); #ifdef Q_OS_WINRT QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort); @@ -3421,6 +3428,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)); 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 <qcoreapplication.h> #include <qdebug.h> #include <qfocusframe.h> +#include <qtableview.h> +#include <qstandarditemmodel.h> 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<QFocusFrame *>()); + 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" |