diff options
author | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-08-02 22:49:38 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-08-02 22:52:32 +0200 |
commit | ee07b912a1768ea0b103544f9eeac41f3cf50cf6 (patch) | |
tree | 15bfa7e4a9c098511c1fc89e2b2c240520b85e2d /tests/auto/widgets | |
parent | 4bfff6a98b59b32605d881a463ad3edc221a7dc8 (diff) | |
parent | a96656a8fb6a3c1fc7765659efff28f807fd0deb (diff) |
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
src/plugins/platforms/xcb/qxcbconnection.h
src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
src/plugins/styles/mac/qmacstyle_mac.mm
src/widgets/widgets/qdockarealayout.cpp
src/widgets/widgets/qmainwindow.cpp
src/widgets/widgets/qmainwindowlayout.cpp
src/widgets/widgets/qmainwindowlayout_p.h
tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
tests/auto/other/macnativeevents/BLACKLIST
tests/auto/widgets/widgets/qmenu/BLACKLIST
Change-Id: Ic8e724b80a65e7b1af25511b0e674d209265e567
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r-- | tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp | 16 | ||||
-rw-r--r-- | tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp | 12 | ||||
-rw-r--r-- | tests/auto/widgets/kernel/qwidget/BLACKLIST | 3 | ||||
-rw-r--r-- | tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 19 | ||||
-rw-r--r-- | tests/auto/widgets/styles/qstyle/task_25863.png | bin | 910 -> 0 bytes | |||
-rw-r--r-- | tests/auto/widgets/styles/qstyle/testdata.qrc | 1 | ||||
-rw-r--r-- | tests/auto/widgets/styles/qstyle/tst_qstyle.cpp | 15 | ||||
-rw-r--r-- | tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp | 32 | ||||
-rw-r--r-- | tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp | 10 | ||||
-rw-r--r-- | tests/auto/widgets/widgets/qmenu/BLACKLIST | 1 |
10 files changed, 83 insertions, 26 deletions
diff --git a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp index a0273513f7..62286d703f 100644 --- a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp +++ b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp @@ -260,6 +260,14 @@ void tst_QInputDialog::getInt() QFETCH(int, min); QFETCH(int, max); QVERIFY(min < max); + +#if defined(Q_OS_MACOS) + if (QSysInfo::productVersion() == QLatin1String("10.12")) { + QSKIP("Test hangs on macOS 10.12 -- QTQAINFRA-1356"); + return; + } +#endif + parent = new QWidget; doneCode = QDialog::Accepted; testFunc = &tst_QInputDialog::testFuncGetInt; @@ -300,6 +308,14 @@ void tst_QInputDialog::getDouble() QFETCH(double, max); QFETCH(int, decimals); QVERIFY(min < max && decimals >= 0 && decimals <= 13); + +#if defined(Q_OS_MACOS) + if (QSysInfo::productVersion() == QLatin1String("10.12")) { + QSKIP("Test hangs on macOS 10.12 -- QTQAINFRA-1356"); + return; + } +#endif + parent = new QWidget; doneCode = QDialog::Accepted; testFunc = &tst_QInputDialog::testFuncGetDouble; diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp index c75c1dc87e..a27e0b6048 100644 --- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp +++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp @@ -3442,7 +3442,7 @@ void tst_QTableView::editSpanFromDirections_data() +---+---+ */ keyPresses.clear(); keyPresses << Qt::Key_Right << Qt::Key_Down; - model.reset(new QStandardItemModel(4, 2)); + model = QSharedPointer<QStandardItemModel>::create(4, 2); QTest::newRow("row span, top down") << keyPresses << model << 1 << 1 << 2 << 1 << model->index(1, 1) << model->index(1, 1); @@ -3455,7 +3455,7 @@ void tst_QTableView::editSpanFromDirections_data() +---+---+---+ */ keyPresses.clear(); keyPresses << Qt::Key_End << Qt::Key_Down << Qt::Key_Left; - model.reset(new QStandardItemModel(3, 3)); + model = QSharedPointer<QStandardItemModel>::create(3, 3); QTest::newRow("row span, right to left") << keyPresses << model << 1 << 1 << 2 << 1 << model->index(1, 1) << model->index(1, 1); @@ -3468,7 +3468,7 @@ void tst_QTableView::editSpanFromDirections_data() +---+---+---+ */ keyPresses.clear(); keyPresses << Qt::Key_PageDown << Qt::Key_Right; - model.reset(new QStandardItemModel(3, 3)); + model = QSharedPointer<QStandardItemModel>::create(3, 3); QTest::newRow("row span, left to right") << keyPresses << model << 1 << 1 << 2 << 1 << model->index(2, 1) << model->index(1, 1); @@ -3481,7 +3481,7 @@ void tst_QTableView::editSpanFromDirections_data() +---+---+---+ */ keyPresses.clear(); keyPresses << Qt::Key_PageDown << Qt::Key_Up; - model.reset(new QStandardItemModel(3, 3)); + model = QSharedPointer<QStandardItemModel>::create(3, 3); QTest::newRow("col span, bottom up") << keyPresses << model << 1 << 0 << 1 << 3 << model->index(1, 0) << model->index(1, 0); @@ -3494,7 +3494,7 @@ void tst_QTableView::editSpanFromDirections_data() +---+---+---+ */ keyPresses.clear(); keyPresses << Qt::Key_PageDown << Qt::Key_Right << Qt::Key_Up; - model.reset(new QStandardItemModel(3, 3)); + model = QSharedPointer<QStandardItemModel>::create(3, 3); QTest::newRow("col span, bottom up #2") << keyPresses << model << 1 << 0 << 1 << 3 << model->index(1, 1) << model->index(1, 0); @@ -3507,7 +3507,7 @@ void tst_QTableView::editSpanFromDirections_data() +---+---+---+ */ keyPresses.clear(); keyPresses << Qt::Key_End << Qt::Key_Down; - model.reset(new QStandardItemModel(3, 3)); + model = QSharedPointer<QStandardItemModel>::create(3, 3); QTest::newRow("col span, top down") << keyPresses << model << 1 << 0 << 1 << 3 << model->index(1, 2) << model->index(1, 0); } diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST index 21575fbaf9..5648218d04 100644 --- a/tests/auto/widgets/kernel/qwidget/BLACKLIST +++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST @@ -48,6 +48,7 @@ osx [showMinimizedKeepsFocus] osx-10.10 osx-10.11 ci +osx-10.12 ci [moveWindowInShowEvent:1] osx [moveWindowInShowEvent:2] @@ -75,3 +76,5 @@ osx ubuntu-14.04 [moveChild:right] osx +[activateWindow] +osx-10.12 ci diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 3da26613bb..096beedf63 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -4954,8 +4954,7 @@ static QPixmap grabWindow(QWindow *window, int x, int y, int width, int height) { QScreen *screen = window->screen(); Q_ASSERT(screen); - QPixmap result = screen->grabWindow(window->winId(), x, y, width, height); - return result.devicePixelRatio() > 1 ? result.scaled(width, height) : result; + return screen->grabWindow(window->winId(), x, y, width, height); } #define VERIFY_COLOR(child, region, color) verifyColor(child, region, color, __LINE__) @@ -4973,7 +4972,8 @@ bool verifyColor(QWidget &child, const QRegion ®ion, const QColor &color, uns const QPixmap pixmap = grabBackingStore ? child.grab(rect) : grabWindow(window, rect.left(), rect.top(), rect.width(), rect.height()); - if (!QTest::qCompare(pixmap.size(), rect.size(), "pixmap.size()", "rect.size()", __FILE__, callerLine)) + const QSize actualSize = pixmap.size() / pixmap.devicePixelRatioF(); + if (!QTest::qCompare(actualSize, rect.size(), "pixmap.size()", "rect.size()", __FILE__, callerLine)) return false; QPixmap expectedPixmap(pixmap); /* ensure equal formats */ expectedPixmap.detach(); @@ -5718,6 +5718,8 @@ void tst_QWidget::setToolTip() QTest::qWait(2200); // delay is 2000 QTest::mouseMove(popupWindow); } + + QTRY_COMPARE(QApplication::topLevelWidgets().size(), 1); } void tst_QWidget::testWindowIconChangeEventPropagation() @@ -5755,14 +5757,14 @@ void tst_QWidget::testWindowIconChangeEventPropagation() QList <EventSpyPtr> applicationEventSpies; QList <EventSpyPtr> widgetEventSpies; foreach (QWidget *widget, widgets) { - applicationEventSpies.append(EventSpyPtr(new EventSpy<QWidget>(widget, QEvent::ApplicationWindowIconChange))); - widgetEventSpies.append(EventSpyPtr(new EventSpy<QWidget>(widget, QEvent::WindowIconChange))); + applicationEventSpies.append(EventSpyPtr::create(widget, QEvent::ApplicationWindowIconChange)); + widgetEventSpies.append(EventSpyPtr::create(widget, QEvent::WindowIconChange)); } QList <WindowEventSpyPtr> appWindowEventSpies; QList <WindowEventSpyPtr> windowEventSpies; foreach (QWindow *window, windows) { - appWindowEventSpies.append(WindowEventSpyPtr(new EventSpy<QWindow>(window, QEvent::ApplicationWindowIconChange))); - windowEventSpies.append(WindowEventSpyPtr(new EventSpy<QWindow>(window, QEvent::WindowIconChange))); + appWindowEventSpies.append(WindowEventSpyPtr::create(window, QEvent::ApplicationWindowIconChange)); + windowEventSpies.append(WindowEventSpyPtr::create(window, QEvent::WindowIconChange)); } // QApplication::setWindowIcon @@ -10341,7 +10343,8 @@ public slots: QPoint point2(15, 20); QPoint point3(20, 20); QWindow *window = modal->windowHandle(); - QWindowSystemInterface::handleEnterEvent(window, point1, window->mapToGlobal(point1)); + const QPoint nativePoint1 = QHighDpi::toNativePixels(point1, window->screen()); + QWindowSystemInterface::handleEnterEvent(window, nativePoint1); QTest::mouseMove(window, point1); QTest::mouseMove(window, point2); QTest::mouseMove(window, point3); diff --git a/tests/auto/widgets/styles/qstyle/task_25863.png b/tests/auto/widgets/styles/qstyle/task_25863.png Binary files differdeleted file mode 100644 index a2de8d6f78..0000000000 --- a/tests/auto/widgets/styles/qstyle/task_25863.png +++ /dev/null diff --git a/tests/auto/widgets/styles/qstyle/testdata.qrc b/tests/auto/widgets/styles/qstyle/testdata.qrc index c16b9be775..29bb46726e 100644 --- a/tests/auto/widgets/styles/qstyle/testdata.qrc +++ b/tests/auto/widgets/styles/qstyle/testdata.qrc @@ -15,6 +15,5 @@ <file>images/vista/radiobutton.png</file> <file>images/vista/slider.png</file> <file>images/vista/spinbox.png</file> - <file>task_25863.png</file> </qresource> </RCC> diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp index 3607f1ba92..d5ef2fe94b 100644 --- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp +++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp @@ -58,6 +58,8 @@ #include <qscrollarea.h> #include <qwidget.h> +#include <algorithm> + // Make a widget frameless to prevent size constraints of title bars // from interfering (Windows). static inline void setFrameless(QWidget *w) @@ -197,13 +199,12 @@ void tst_QStyle::drawItemPixmap() testWidget->resize(300, 300); testWidget->showNormal(); - const QString imageFileName = QFINDTESTDATA("task_25863.png"); - QVERIFY(!imageFileName.isEmpty()); - - QPixmap p(imageFileName, "PNG"); - const QPixmap actualPix = testWidget->grab(); - - QCOMPARE(actualPix, p); + QImage image = testWidget->grab().toImage(); + const QRgb green = QColor(Qt::green).rgb(); + QVERIFY(image.reinterpretAsFormat(QImage::Format_RGB32)); + const QRgb *bits = reinterpret_cast<const QRgb *>(image.constBits()); + const QRgb *end = bits + image.byteCount() / sizeof(QRgb); + QVERIFY(std::all_of(bits, end, [green] (QRgb r) { return r == green; })); testWidget->hide(); } diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 3e21c4ecab..8f0dd10940 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -147,6 +147,7 @@ private slots: void keypress_inputMask_data(); void keypress_inputMask(); + void keypress_inputMethod_inputMask(); void inputMaskAndValidator_data(); void inputMaskAndValidator(); @@ -803,6 +804,37 @@ void tst_QLineEdit::keypress_inputMask() QCOMPARE(testWidget->displayText(), expectedDisplayText); } +void tst_QLineEdit::keypress_inputMethod_inputMask() +{ + // Similar to the keypress_inputMask test, but this is done solely via + // input methods + QLineEdit *testWidget = ensureTestWidget(); + testWidget->setInputMask("AA.AA.AA"); + { + QList<QInputMethodEvent::Attribute> attributes; + QInputMethodEvent event("", attributes); + event.setCommitString("EE"); + QApplication::sendEvent(testWidget, &event); + } + QCOMPARE(testWidget->cursorPosition(), 3); + QCOMPARE(testWidget->text(), QStringLiteral("EE..")); + { + QList<QInputMethodEvent::Attribute> attributes; + QInputMethodEvent event("", attributes); + event.setCommitString("EE"); + QApplication::sendEvent(testWidget, &event); + } + QCOMPARE(testWidget->cursorPosition(), 6); + QCOMPARE(testWidget->text(), QStringLiteral("EE.EE.")); + { + QList<QInputMethodEvent::Attribute> attributes; + QInputMethodEvent event("", attributes); + event.setCommitString("EE"); + QApplication::sendEvent(testWidget, &event); + } + QCOMPARE(testWidget->cursorPosition(), 8); + QCOMPARE(testWidget->text(), QStringLiteral("EE.EE.EE")); +} void tst_QLineEdit::hasAcceptableInputMask_data() { diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp index 680fea27dd..292080c55f 100644 --- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp @@ -29,8 +29,10 @@ #include <QtTest/QtTest> - +#include <QtWidgets/qtwidgetsglobal.h> +#if QT_CONFIG(dockwidget) #include <qdockwidget.h> +#endif #include <qlayout.h> #include <qmainwindow.h> #include <qmenubar.h> @@ -45,7 +47,7 @@ #include <private/qmainwindowlayout_p.h> #include <private/qdockarealayout_p.h> -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) #include <qtabbar.h> #endif @@ -148,7 +150,7 @@ private slots: void QTBUG21378_animationFinished(); void resizeDocks(); void resizeDocks_data(); -#if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_TABBAR) +#if QT_CONFIG(dockwidget) && QT_CONFIG(tabbar) void QTBUG52175_tabifiedDockWidgetActivated(); #endif }; @@ -2044,7 +2046,7 @@ void tst_QMainWindow::resizeDocks() } } -#if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_TABBAR) +#if QT_CONFIG(dockwidget) && QT_CONFIG(tabbar) void tst_QMainWindow::QTBUG52175_tabifiedDockWidgetActivated() { QMainWindow w; diff --git a/tests/auto/widgets/widgets/qmenu/BLACKLIST b/tests/auto/widgets/widgets/qmenu/BLACKLIST index 92a810bc84..1c970c43b3 100644 --- a/tests/auto/widgets/widgets/qmenu/BLACKLIST +++ b/tests/auto/widgets/widgets/qmenu/BLACKLIST @@ -2,6 +2,7 @@ osx [submenuTearOffDontClose] osx-10.11 ci +osx-10.12 ci [layoutDirection] # Fails when enabling synchronous expose events QTBUG-62092 osx ci |