diff options
author | Liang Qi <liang.qi@qt.io> | 2017-05-07 13:07:34 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-05-07 13:08:18 +0200 |
commit | d1ea4813458b383e66ce4df69d1833b8b6a279c4 (patch) | |
tree | 3bdc16da993e5de56b669e6774fb0748075ddd90 /tests/auto/widgets | |
parent | 1c87d4e1a1d0e1972f6dc85e55ea9be8a42797ba (diff) | |
parent | 0b1ec78c2d4871afcc89d5b046926b88f0819a7c (diff) |
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
src/network/access/qnetworkreply.cpp
tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
Change-Id: Iadf766269454087e69fb216fc3857d85b0ddfaad
Diffstat (limited to 'tests/auto/widgets')
7 files changed, 62 insertions, 14 deletions
diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp index 1ff7a0c97b..d48ee03a22 100644 --- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp @@ -676,7 +676,7 @@ void tst_QFileDialog2::completionOnLevelAfterRoot() } if (!invalid) { foreach (const QString &check, entryList) { - if (check.startsWith(entry.left(5)) && check != entry) { + if (check.startsWith(entry.left(5), Qt::CaseInsensitive) && check != entry) { invalid = true; break; } diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST index 9981fd3447..46791ff884 100644 --- a/tests/auto/widgets/kernel/qwidget/BLACKLIST +++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST @@ -5,6 +5,7 @@ ubuntu-16.04 [saveRestoreGeometry] ubuntu-14.04 ubuntu-16.04 +b2qt [restoreVersion1Geometry] ubuntu-14.04 osx diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 5fe0232d90..08f6a8e7e4 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -2181,6 +2181,8 @@ void tst_QWidget::showMinimizedKeepsFocus() QSKIP("QTBUG-26424"); if (m_platform == QStringLiteral("wayland")) QSKIP("Wayland: This fails. Figure out why."); + if (m_platform == QStringLiteral("offscreen")) + QSKIP("Platform offscreen does not support showMinimized()"); //here we test that minimizing a widget and restoring it doesn't change the focus inside of it { @@ -3237,6 +3239,9 @@ void tst_QWidget::widgetAt() if (m_platform == QStringLiteral("wayland")) QSKIP("Wayland: This fails. Figure out why."); + if (m_platform == QStringLiteral("offscreen")) + QSKIP("Platform offscreen does not support lower()/raise() or WindowMasks"); + Q_CHECK_PAINTEVENTS const QPoint referencePos = m_availableTopLeft + QPoint(100, 100); @@ -3653,7 +3658,7 @@ void tst_QWidget::optimizedResize_topLevel() expectedUpdateRegion -= QRect(QPoint(), topLevel.size() - QSize(10, 10)); QTRY_COMPARE(topLevel.gotPaintEvent, true); - if (m_platform == QStringLiteral("xcb")) + if (m_platform == QStringLiteral("xcb") || m_platform == QStringLiteral("offscreen")) QSKIP("QTBUG-26424"); QCOMPARE(topLevel.partial, true); QCOMPARE(topLevel.paintedRegion, expectedUpdateRegion); @@ -6798,6 +6803,9 @@ void tst_QWidget::render_task217815() // Window Opacity is not supported on Windows CE. void tst_QWidget::render_windowOpacity() { + if (m_platform == QStringLiteral("offscreen")) + QSKIP("Platform offscreen does not support setting opacity"); + const qreal opacity = 0.5; { // Check that the painter opacity effects the widget drawing. @@ -7388,6 +7396,9 @@ void tst_QWidget::updateWhileMinimized() { if (m_platform == QStringLiteral("wayland")) QSKIP("Wayland: This fails. Figure out why."); + if (m_platform == QStringLiteral("offscreen")) + QSKIP("Platform offscreen does not support showMinimized()"); + #if defined(Q_OS_QNX) QSKIP("Platform does not support showMinimized()"); #endif diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 139aaa7371..a0ba91ba4a 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -325,6 +325,7 @@ private: // keyClicks(..) is moved to QtTestCase void psKeyClick(QWidget *target, Qt::Key key, Qt::KeyboardModifiers pressState = 0); void psKeyClick(QTestEventList &keys, Qt::Key key, Qt::KeyboardModifiers pressState = 0); + bool unselectingWithLeftOrRightChangesCursorPosition(); QLineEdit *ensureTestWidget(); bool validInput; @@ -1315,9 +1316,10 @@ void tst_QLineEdit::undo_keypressevents_data() // unselect any current selection keys.addKeyClick(Qt::Key_Right); -#if defined Q_OS_WIN || defined Q_OS_QNX //Windows and QNX do not jump to the beginning of the selection - keys.addKeyClick(Qt::Key_Left); -#endif + + // If previous right changed cursor position, go back left + if (unselectingWithLeftOrRightChangesCursorPosition()) + keys.addKeyClick(Qt::Key_Left); // selecting '12' keys.addKeyClick(Qt::Key_Right, Qt::ShiftModifier); @@ -3298,14 +3300,11 @@ void tst_QLineEdit::leftKeyOnSelectedText() QCOMPARE(testWidget->cursorPosition(), 2); QCOMPARE(testWidget->selectedText(), QString("23")); QTest::keyClick(testWidget, Qt::Key_Left); -#if defined Q_OS_WIN || defined Q_OS_QNX - QCOMPARE(testWidget->cursorPosition(), 1); -#else - // Selection is cleared ands cursor remains at position 2. - // X11 used to behave like window prior to 4.2. Changes caused by QKeySequence - // resulted in an inadvertant change in behavior - QCOMPARE(testWidget->cursorPosition(), 2); -#endif + + if (unselectingWithLeftOrRightChangesCursorPosition()) + QCOMPARE(testWidget->cursorPosition(), 1); + else + QCOMPARE(testWidget->cursorPosition(), 2); } void tst_QLineEdit::inlineCompletion() @@ -4639,5 +4638,22 @@ void tst_QLineEdit::QTBUG59957_clearButtonLeftmostAction() #endif // QT_BUILD_INTERNAL } +bool tst_QLineEdit::unselectingWithLeftOrRightChangesCursorPosition() +{ +#if defined Q_OS_WIN || defined Q_OS_QNX //Windows and QNX do not jump to the beginning of the selection + return true; +#endif + // Platforms minimal/offscreen also need left after unselecting with right + if (!QGuiApplication::platformName().compare("minimal", Qt::CaseInsensitive) + || !QGuiApplication::platformName().compare("offscreen", Qt::CaseInsensitive)) { + return true; + } + + // Selection is cleared ands cursor remains at previous position. + // X11 used to behave like window prior to 4.2. Changes caused by QKeySequence + // resulted in an inadvertant change in behavior + return false; +} + QTEST_MAIN(tst_QLineEdit) #include "tst_qlineedit.moc" diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp index ceef88338a..c8a92f3751 100644 --- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp @@ -1507,6 +1507,10 @@ void tst_QMdiArea::setBackground() void tst_QMdiArea::setViewport() { +#ifdef Q_OS_MACOS + QSKIP("Sometimes crashes in the CI, see QTBUG-58520"); +#endif + QMdiArea workspace; workspace.show(); diff --git a/tests/auto/widgets/widgets/qmenu/qmenu.pro b/tests/auto/widgets/widgets/qmenu/qmenu.pro index 7c1315afa8..55fff01138 100644 --- a/tests/auto/widgets/widgets/qmenu/qmenu.pro +++ b/tests/auto/widgets/widgets/qmenu/qmenu.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qmenu -QT += widgets testlib +QT += gui-private widgets testlib SOURCES += tst_qmenu.cpp macx:{ OBJECTIVE_SOURCES += tst_qmenu_mac.mm diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index 35f75dbeab..da37a9a968 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -46,6 +46,8 @@ #include <QTimer> #include <qdebug.h> +#include <qpa/qplatformtheme.h> + Q_DECLARE_METATYPE(Qt::Key); Q_DECLARE_METATYPE(Qt::KeyboardModifiers); @@ -624,6 +626,7 @@ void tst_QMenu::tearOff() QScopedPointer<QMenu> menu(new QMenu(&widget)); QVERIFY(!menu->isTearOffEnabled()); //default value menu->setTearOffEnabled(true); + menu->setTitle(QLatin1String("Same &Menu")); menu->addAction("aaa"); menu->addAction("bbb"); QVERIFY(menu->isTearOffEnabled()); @@ -646,6 +649,19 @@ void tst_QMenu::tearOff() QVERIFY(torn); QVERIFY(torn->isVisible()); + // Check menu title + const QString cleanTitle = QPlatformTheme::removeMnemonics(menu->title()).trimmed(); + QCOMPARE(torn->windowTitle(), cleanTitle); + + // Change menu title and check again + menu->setTitle(QLatin1String("Sample &Menu")); + const QString newCleanTitle = QPlatformTheme::removeMnemonics(menu->title()).trimmed(); + QCOMPARE(torn->windowTitle(), newCleanTitle); + + // Clear menu title and check again + menu->setTitle(QString()); + QCOMPARE(torn->windowTitle(), QString()); + menu->hideTearOffMenu(); QVERIFY(!menu->isTearOffMenuVisible()); QVERIFY(!torn->isVisible()); |