From 1b190e7ea60e3752066b8a2fb255481651f8856e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 18 Jul 2017 14:22:35 +0200 Subject: tst_QWidget: Fix to pass with High DPI scaling enabled Scale coordinates in a few places, remove pixmap scaling in grabWindow() (Windows). Change-Id: Iba9e5d3ca55422a14eda09c8d04329a455d3acb3 Reviewed-by: Oliver Wolff Reviewed-by: Joerg Bornemann --- tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 2b6dc5f7e1..bd5d5fac79 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -4952,8 +4952,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__) @@ -4971,7 +4970,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(); @@ -10339,7 +10339,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); -- cgit v1.2.3 From a9dfdbd06acc6a11a03f298a794e290da1028992 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 18 Jul 2017 16:47:16 +0200 Subject: tst_QStyle::drawItemPixmap(): Check on the image color Verify that all pixels of the grabbed image are green instead of comparing an image loaded from file. The test then also passes when High DPI scaling is active in which case a twice as big pixmap with DPR=2 is obtained when grabbing the widget. Change-Id: Ie5244a39a68ea0defd2590cf30f251d660d0869b Reviewed-by: Oliver Wolff Reviewed-by: Joerg Bornemann --- tests/auto/widgets/styles/qstyle/task_25863.png | Bin 910 -> 0 bytes tests/auto/widgets/styles/qstyle/testdata.qrc | 1 - tests/auto/widgets/styles/qstyle/tst_qstyle.cpp | 15 ++++++++------- 3 files changed, 8 insertions(+), 8 deletions(-) delete mode 100644 tests/auto/widgets/styles/qstyle/task_25863.png (limited to 'tests/auto') diff --git a/tests/auto/widgets/styles/qstyle/task_25863.png b/tests/auto/widgets/styles/qstyle/task_25863.png deleted file mode 100644 index a2de8d6f78..0000000000 Binary files a/tests/auto/widgets/styles/qstyle/task_25863.png and /dev/null differ 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 @@ images/vista/radiobutton.png images/vista/slider.png images/vista/spinbox.png - task_25863.png diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp index 5925b764dd..fcb05f6b74 100644 --- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp +++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp @@ -58,6 +58,8 @@ #include #include +#include + // Make a widget frameless to prevent size constraints of title bars // from interfering (Windows). static inline void setFrameless(QWidget *w) @@ -208,13 +210,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(image.constBits()); + const QRgb *end = bits + image.byteCount() / sizeof(QRgb); + QVERIFY(std::all_of(bits, end, [green] (QRgb r) { return r == green; })); testWidget->hide(); } -- cgit v1.2.3 From 4585889467b6124f2e9ccca3d1c0da15e2bf790c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Wed, 19 Jul 2017 14:16:26 +0200 Subject: Fix race condition in the processEvents test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This test verifies processEvents(WaitForMoreEvents) behavior by first processing all pending events (in a loop) and then verifying that a following processEvents call actually waits. But there is no guarantee that the OS won’t introduce more events after the first loop has completed. This does indeed seem to happen on recent versions of macOS. Change the test to not require that the processEvents call blocked and de-blacklist. Task-number: QTBUG-61131 Change-Id: Ic8fa74a6085165442791264f6f137a2fa6083138 Reviewed-by: Tor Arne Vestbø --- tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp | 9 ++++----- tests/auto/gui/kernel/qguieventloop/BLACKLIST | 2 -- 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp index aff04afe08..0b4f76ef70 100644 --- a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp +++ b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp @@ -216,12 +216,11 @@ void tst_QEventLoop::processEvents() awakeSpy.clear(); QVERIFY(eventLoop.processEvents(QEventLoop::WaitForMoreEvents)); - // Verify that the eventloop has blocked and woken up. Some eventloops - // may block and wake up multiple times. - QVERIFY(aboutToBlockSpy.count() > 0); - QVERIFY(awakeSpy.count() > 0); // We should get one awake for each aboutToBlock, plus one awake when - // processEvents is entered. + // processEvents is entered. There is no guarantee that that the + // processEvents call actually blocked, since the OS may introduce + // native events at any time. + QVERIFY(awakeSpy.count() > 0); QVERIFY(awakeSpy.count() >= aboutToBlockSpy.count()); killTimer(timerId); diff --git a/tests/auto/gui/kernel/qguieventloop/BLACKLIST b/tests/auto/gui/kernel/qguieventloop/BLACKLIST index 2303d9380e..03acb2f5b0 100644 --- a/tests/auto/gui/kernel/qguieventloop/BLACKLIST +++ b/tests/auto/gui/kernel/qguieventloop/BLACKLIST @@ -1,4 +1,2 @@ -[processEvents] -osx-10.12 [testQuitLock] osx-10.12 -- cgit v1.2.3 From 94cf203f36deb5b46d47197d31b780de5f464937 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 13 Jul 2017 17:19:49 +0200 Subject: Use QSharedPointer::create() more MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is the result of running the (experimental) clang-tidy check qt-modernize-qsharedpointer-create Discarded changes: - tst_qsharedpointer.cpp: not sure we want these replacements there (→ separate change) - tst_collations.cpp: hit in a template specialization that is instantiated with both QSharedPointer and QSharedDataPointer. Change-Id: I203c2646e91d026735d923473af3d151d19e3820 Reviewed-by: Thiago Macieira --- tests/auto/corelib/io/largefile/tst_largefile.cpp | 2 +- .../io/qabstractfileengine/tst_qabstractfileengine.cpp | 4 ++-- tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp | 2 +- tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp | 2 +- .../qdbusabstractinterface/tst_qdbusabstractinterface.cpp | 4 ++-- tests/auto/network/access/qftp/tst_qftp.cpp | 2 +- tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp | 2 +- tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp | 12 ++++++------ tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 8 ++++---- 9 files changed, 19 insertions(+), 19 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/io/largefile/tst_largefile.cpp b/tests/auto/corelib/io/largefile/tst_largefile.cpp index 99e1d5a32f..5975303ca6 100644 --- a/tests/auto/corelib/io/largefile/tst_largefile.cpp +++ b/tests/auto/corelib/io/largefile/tst_largefile.cpp @@ -228,7 +228,7 @@ QByteArray const &tst_LargeFile::getDataBlock(int index, qint64 position) void tst_LargeFile::initTestCase() { m_previousCurrent = QDir::currentPath(); - m_tempDir = QSharedPointer(new QTemporaryDir); + m_tempDir = QSharedPointer::create(); QVERIFY2(!m_tempDir.isNull(), qPrintable("Could not create temporary directory.")); QVERIFY2(QDir::setCurrent(m_tempDir->path()), qPrintable("Could not switch current directory")); diff --git a/tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp b/tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp index dba920d1f7..ddfd14550b 100644 --- a/tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp +++ b/tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp @@ -466,7 +466,7 @@ protected: if (create) { QSharedPointer &p = fileSystem[fileName_]; if (p.isNull()) - p = QSharedPointer(new File); + p = QSharedPointer::create(); return p; } @@ -564,7 +564,7 @@ class FileEngineHandler void tst_QAbstractFileEngine::initTestCase() { m_previousCurrent = QDir::currentPath(); - m_currentDir = QSharedPointer(new QTemporaryDir()); + m_currentDir = QSharedPointer::create(); QVERIFY2(!m_currentDir.isNull(), qPrintable("Could not create current directory.")); QDir::setCurrent(m_currentDir->path()); } diff --git a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp index 0068411b94..14a2528cc6 100644 --- a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp @@ -300,7 +300,7 @@ void tst_QDataStream::getSetCheck() void tst_QDataStream::initTestCase() { m_previousCurrent = QDir::currentPath(); - m_tempDir = QSharedPointer(new QTemporaryDir); + m_tempDir = QSharedPointer::create(); QVERIFY2(!m_tempDir.isNull(), qPrintable("Could not create temporary directory.")); QVERIFY2(QDir::setCurrent(m_tempDir->path()), qPrintable("Could not switch current directory")); } diff --git a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp index 5cb532f76b..a76fd4703e 100644 --- a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp +++ b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp @@ -71,7 +71,7 @@ void tst_QIODevice::initTestCase() || QFile::copy(QStringLiteral(":/tst_qiodevice.cpp"), QStringLiteral("./tst_qiodevice.cpp"))); #endif m_previousCurrent = QDir::currentPath(); - m_tempDir = QSharedPointer(new QTemporaryDir); + m_tempDir = QSharedPointer::create(); QVERIFY2(!m_tempDir.isNull(), qPrintable("Could not create temporary directory.")); QVERIFY2(QDir::setCurrent(m_tempDir->path()), qPrintable("Could not switch current directory")); } diff --git a/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp b/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp index 9e257267ca..11896d2f15 100644 --- a/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp +++ b/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp @@ -56,7 +56,7 @@ class tst_QDBusAbstractInterface: public QObject return Pinger(); if (service.isEmpty() && !service.isNull()) service = con.baseService(); - return Pinger(new org::qtproject::QtDBus::Pinger(service, path, con)); + return Pinger::create(service, path, con); } Pinger getPingerPeer(const QString &path = "/", const QString &service = "") @@ -64,7 +64,7 @@ class tst_QDBusAbstractInterface: public QObject QDBusConnection con = QDBusConnection("peer"); if (!con.isConnected()) return Pinger(); - return Pinger(new org::qtproject::QtDBus::Pinger(service, path, con)); + return Pinger::create(service, path, con); } void resetServer() diff --git a/tests/auto/network/access/qftp/tst_qftp.cpp b/tests/auto/network/access/qftp/tst_qftp.cpp index a1c8399a26..3711ce431c 100644 --- a/tests/auto/network/access/qftp/tst_qftp.cpp +++ b/tests/auto/network/access/qftp/tst_qftp.cpp @@ -205,7 +205,7 @@ void tst_QFtp::initTestCase() QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); #ifndef QT_NO_BEARERMANAGEMENT QNetworkConfigurationManager manager; - networkSessionImplicit = QSharedPointer(new QNetworkSession(manager.defaultConfiguration())); + networkSessionImplicit = QSharedPointer::create(manager.defaultConfiguration()); networkSessionImplicit->open(); QVERIFY(networkSessionImplicit->waitForOpened(60000)); //there may be user prompt on 1st connect #endif diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index 43d0781083..af7cf24838 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -213,7 +213,7 @@ void tst_QUdpSocket::initTestCase_data() #ifndef QT_NO_BEARERMANAGEMENT netConfMan = new QNetworkConfigurationManager(this); networkConfiguration = netConfMan->defaultConfiguration(); - networkSession = QSharedPointer(new QNetworkSession(networkConfiguration)); + networkSession = QSharedPointer::create(networkConfiguration); if (!networkSession->isOpen()) { networkSession->open(); QVERIFY(networkSession->waitForOpened(30000)); 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::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::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::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::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::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::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/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index bd5d5fac79..918df275e9 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -5753,14 +5753,14 @@ void tst_QWidget::testWindowIconChangeEventPropagation() QList applicationEventSpies; QList widgetEventSpies; foreach (QWidget *widget, widgets) { - applicationEventSpies.append(EventSpyPtr(new EventSpy(widget, QEvent::ApplicationWindowIconChange))); - widgetEventSpies.append(EventSpyPtr(new EventSpy(widget, QEvent::WindowIconChange))); + applicationEventSpies.append(EventSpyPtr::create(widget, QEvent::ApplicationWindowIconChange)); + widgetEventSpies.append(EventSpyPtr::create(widget, QEvent::WindowIconChange)); } QList appWindowEventSpies; QList windowEventSpies; foreach (QWindow *window, windows) { - appWindowEventSpies.append(WindowEventSpyPtr(new EventSpy(window, QEvent::ApplicationWindowIconChange))); - windowEventSpies.append(WindowEventSpyPtr(new EventSpy(window, QEvent::WindowIconChange))); + appWindowEventSpies.append(WindowEventSpyPtr::create(window, QEvent::ApplicationWindowIconChange)); + windowEventSpies.append(WindowEventSpyPtr::create(window, QEvent::WindowIconChange)); } // QApplication::setWindowIcon -- cgit v1.2.3 From 29f6b507325862fe3dd728913b5911f8edde9d35 Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Mon, 21 Nov 2016 19:16:31 +0000 Subject: Windows: Don't raise inactive windows when showing a tooltip The Qt4 Q_WS_WIN ifdef never got ported. Change-Id: Iad1ca1a3e20bd5254895781eee09897520b7d7d1 Task-Id: QTBUG-39147 Reviewed-by: Friedemann Kleint --- tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 918df275e9..63ff8380f8 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -5716,6 +5716,8 @@ void tst_QWidget::setToolTip() QTest::qWait(2200); // delay is 2000 QTest::mouseMove(popupWindow); } + + QTRY_COMPARE(QApplication::topLevelWidgets().size(), 1); } void tst_QWidget::testWindowIconChangeEventPropagation() -- cgit v1.2.3 From fcfee98f62b8a8b8c3b1ac11cbb23620788a586c Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 13 Jul 2017 14:37:00 +0200 Subject: QLineEdit: Don't move the cursor after internalInsert() has done so internalInsert() will set the cursor to the right position which accounts for any input mask set on the control as well. Therefore it will already be placed at the next correct position and should not be changed again after that. Task-number: QTBUG-40943 Change-Id: Ic0f5fad6999ddd367e435ec4409a5db5b9eacb7b Reviewed-by: Daniel Teske Reviewed-by: David Faure --- .../widgets/widgets/qlineedit/tst_qlineedit.cpp | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 3f7fdd6f6f..b434e48500 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 attributes; + QInputMethodEvent event("", attributes); + event.setCommitString("EE"); + QApplication::sendEvent(testWidget, &event); + } + QCOMPARE(testWidget->cursorPosition(), 3); + QCOMPARE(testWidget->text(), QStringLiteral("EE..")); + { + QList attributes; + QInputMethodEvent event("", attributes); + event.setCommitString("EE"); + QApplication::sendEvent(testWidget, &event); + } + QCOMPARE(testWidget->cursorPosition(), 6); + QCOMPARE(testWidget->text(), QStringLiteral("EE.EE.")); + { + QList 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() { -- cgit v1.2.3 From 3ade30a2af5b64cb2437d214f25e4dcbfa00c49d Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Sat, 22 Jul 2017 15:15:12 +0200 Subject: Convert features.calendarwidget to QT_[REQUIRE_]CONFIG Change-Id: I93c2e00828a233f004c599bd0702d0a470ae29ff Reviewed-by: Oswald Buddenhagen --- tests/auto/other/qaccessibility/tst_qaccessibility.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index 4f60fe3d96..4a64f06e81 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -3344,7 +3344,7 @@ void tst_QAccessibility::tableTest() void tst_QAccessibility::calendarWidgetTest() { -#ifndef QT_NO_CALENDARWIDGET +#if QT_CONFIG(calendarwidget) { QCalendarWidget calendarWidget; @@ -3420,7 +3420,7 @@ void tst_QAccessibility::calendarWidgetTest() } QTestAccessibility::clearEvents(); -#endif // QT_NO_CALENDARWIDGET +#endif // QT_CONFIG(calendarwidget) } void tst_QAccessibility::dockWidgetTest() -- cgit v1.2.3 From 2d02c4c799a4c45fe3f096a9bce95bd0b48b2743 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Sun, 23 Jul 2017 11:35:27 +0200 Subject: Convert features.dockwidget to QT_[REQUIRE_]CONFIG Change-Id: I1d4b0268df01f8bc0aec28af52cc4b639a376863 Reviewed-by: Oswald Buddenhagen --- tests/auto/other/qaccessibility/tst_qaccessibility.cpp | 4 ++-- tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index 4a64f06e81..4ffdc4c762 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -3425,7 +3425,7 @@ void tst_QAccessibility::calendarWidgetTest() void tst_QAccessibility::dockWidgetTest() { -#ifndef QT_NO_DOCKWIDGET +#if QT_CONFIG(dockwidget) // Set up a proper main window with two dock widgets QMainWindow *mw = new QMainWindow(); QFrame *central = new QFrame(mw); @@ -3558,7 +3558,7 @@ void tst_QAccessibility::dockWidgetTest() delete mw; QTestAccessibility::clearEvents(); -#endif // QT_NO_DOCKWIDGET +#endif // QT_CONFIG(dockwidget) } void tst_QAccessibility::comboBoxTest() diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp index 680fea27dd..7942109a0a 100644 --- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp @@ -29,8 +29,10 @@ #include - +#include +#if QT_CONFIG(dockwidget) #include +#endif #include #include #include @@ -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) && !defined(QT_NO_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) && !defined(QT_NO_TABBAR) void tst_QMainWindow::QTBUG52175_tabifiedDockWidgetActivated() { QMainWindow w; -- cgit v1.2.3 From 7964b7468de65459f3c0e431549fa93408c19a62 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Sun, 23 Jul 2017 11:37:00 +0200 Subject: Convert features.tabbar to QT_[REQUIRE_]CONFIG Change-Id: Id21a95cbc61b2559a8f517ee60548b61536e3cc4 Reviewed-by: Oswald Buddenhagen --- tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp index 7942109a0a..292080c55f 100644 --- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp @@ -47,7 +47,7 @@ #include #include -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) #include #endif @@ -150,7 +150,7 @@ private slots: void QTBUG21378_animationFinished(); void resizeDocks(); void resizeDocks_data(); -#if QT_CONFIG(dockwidget) && !defined(QT_NO_TABBAR) +#if QT_CONFIG(dockwidget) && QT_CONFIG(tabbar) void QTBUG52175_tabifiedDockWidgetActivated(); #endif }; @@ -2046,7 +2046,7 @@ void tst_QMainWindow::resizeDocks() } } -#if QT_CONFIG(dockwidget) && !defined(QT_NO_TABBAR) +#if QT_CONFIG(dockwidget) && QT_CONFIG(tabbar) void tst_QMainWindow::QTBUG52175_tabifiedDockWidgetActivated() { QMainWindow w; -- cgit v1.2.3 From 2031196ad12ae7a641fc00c0990072f5fb3a7172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Tue, 18 Jul 2017 10:34:02 +0200 Subject: Add test for QLocale::bcp47Name() Task-number: QTBUG-61949 Change-Id: I34fece0441afb1e69ea84ae59b90c5e2b7cf133f Reviewed-by: Edward Welbourne Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index f278a7470b..d08e5dc289 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -137,6 +137,8 @@ private slots: void textDirection_data(); void textDirection(); + void bcp47Name(); + private: QString m_decimal, m_thousand, m_sdate, m_ldate, m_time; QString m_sysapp; @@ -2525,5 +2527,26 @@ void tst_QLocale::textDirection() QCOMPARE(locale.textDirection() == Qt::RightToLeft, rightToLeft); } +void tst_QLocale::bcp47Name() +{ + QCOMPARE(QLocale("C").bcp47Name(), QStringLiteral("C")); + QCOMPARE(QLocale("en").bcp47Name(), QStringLiteral("en")); + QCOMPARE(QLocale("en_US").bcp47Name(), QStringLiteral("en")); + QCOMPARE(QLocale("en_GB").bcp47Name(), QStringLiteral("en-GB")); + QCOMPARE(QLocale("en_DE").bcp47Name(), QStringLiteral("en-DE")); + QCOMPARE(QLocale("de_DE").bcp47Name(), QStringLiteral("de")); + QCOMPARE(QLocale("sr_RS").bcp47Name(), QStringLiteral("sr")); + QCOMPARE(QLocale("sr_Cyrl_RS").bcp47Name(), QStringLiteral("sr")); + QCOMPARE(QLocale("sr_Latn_RS").bcp47Name(), QStringLiteral("sr-Latn")); + QCOMPARE(QLocale("sr_ME").bcp47Name(), QStringLiteral("sr-ME")); + QCOMPARE(QLocale("sr_Cyrl_ME").bcp47Name(), QStringLiteral("sr-Cyrl-ME")); + QCOMPARE(QLocale("sr_Latn_ME").bcp47Name(), QStringLiteral("sr-ME")); + + // Fall back to defaults when country isn't in CLDR for this language: + QCOMPARE(QLocale("sr_HR").bcp47Name(), QStringLiteral("sr")); + QCOMPARE(QLocale("sr_Cyrl_HR").bcp47Name(), QStringLiteral("sr")); + QCOMPARE(QLocale("sr_Latn_HR").bcp47Name(), QStringLiteral("sr-Latn")); +} + QTEST_MAIN(tst_QLocale) #include "tst_qlocale.moc" -- cgit v1.2.3 From af7e756155cf44e05816cf91be04e13d9e7ca084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Tue, 18 Jul 2017 10:41:20 +0200 Subject: Return "en" for QLocale::c().bcp47Name() Currently QLocale::c().bcp47Name() returns "C" which, according to [BCP47], is not a valid language tag. In particular it does not conform to the ABNF grammar in section 2.1 which specifies a minimum length of 2 characters for all language tags. [BCP47]: https://tools.ietf.org/html/bcp47 This patch changes the return value to "en" seeing as the documentation for QLocale::Language states that the C language is identical in behavior to English. Task-number: QTBUG-61949 Change-Id: I2a381def8fb7156467e01d105da92bb1f4821204 Reviewed-by: Edward Welbourne --- tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index d08e5dc289..10d78b1f2f 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -2529,7 +2529,7 @@ void tst_QLocale::textDirection() void tst_QLocale::bcp47Name() { - QCOMPARE(QLocale("C").bcp47Name(), QStringLiteral("C")); + QCOMPARE(QLocale("C").bcp47Name(), QStringLiteral("en")); QCOMPARE(QLocale("en").bcp47Name(), QStringLiteral("en")); QCOMPARE(QLocale("en_US").bcp47Name(), QStringLiteral("en")); QCOMPARE(QLocale("en_GB").bcp47Name(), QStringLiteral("en-GB")); -- cgit v1.2.3 From 7daf0ea58186cf18c550a32181cdef1163b8c401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Thu, 27 Jul 2017 10:58:33 +0200 Subject: Blacklist tst_MacGui::nonModalOrder The test is marked as expected failure for the last 3 years, in CI it is proven to be somehow flaky and it is failing now because of XPASS which is not covered by blacklist feature. This patch extends efforts of 7eba6d039dfbb9377a4358842fcd7210dc1fdd86 and 03b4838cb51513bd5d2edf76dccc4bc4a1181681 by blacklisting the test completely. Change-Id: Ia295d61620fa6bc97b168d4de9456a18ed5c064f Task-number: QTQAINFRA-1333 Reviewed-by: Simon Hausmann --- tests/auto/other/macgui/BLACKLIST | 3 +-- tests/auto/other/macgui/tst_macgui.cpp | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/other/macgui/BLACKLIST b/tests/auto/other/macgui/BLACKLIST index 2b6a0e2fe8..5a5d6a175f 100644 --- a/tests/auto/other/macgui/BLACKLIST +++ b/tests/auto/other/macgui/BLACKLIST @@ -1,3 +1,2 @@ [nonModalOrder] -osx-10.11 ci -osx-10.12 ci +osx diff --git a/tests/auto/other/macgui/tst_macgui.cpp b/tests/auto/other/macgui/tst_macgui.cpp index c6fc67f998..75fa4815c9 100644 --- a/tests/auto/other/macgui/tst_macgui.cpp +++ b/tests/auto/other/macgui/tst_macgui.cpp @@ -190,7 +190,6 @@ void tst_MacGui::nonModalOrder() primary.resize(400, 400); primary.move(100, 100); primary.exec(); - QEXPECT_FAIL("", "Non-modal child windows show behind the modal dialig", Abort); QCOMPARE(primary.frontWidget, primary.secondaryWindow); } -- cgit v1.2.3 From 7c45c6a3c44f73aac5a7422ce66235bf32b510e3 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 26 Jul 2017 10:35:55 -0700 Subject: Revert "Make QFile::open fail when using an invalid file name" This reverts commit 346cd79192ef71afa572812e17f1d422594651a0. The bug report was incorrect, since the suggested file name is actually valid, it just happens to name an Alternate Data Stream (ADS) "20:803Z.txt" in file "testLog-03". [ChangeLog][QtCore][QFile] Reverted an incorrect change from Qt 5.9.0 that forbade the creation and access to Alternate Data Streams on NTFS on Windows. This means that file names containing a colon (':') are allowed again, but note that they are not regular files. Task-number: QTBUG-57023 Change-Id: I81480fdb578d4d43b3fcfffd14d4f2147e8a0ade Reviewed-by: Oswald Buddenhagen Reviewed-by: Kai Koehne Reviewed-by: Jesus Fernandez --- tests/auto/corelib/io/qfile/tst_qfile.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index c7216dc169..32165ad2b8 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -1155,7 +1155,6 @@ void tst_QFile::invalidFile_data() #else #if !defined(Q_OS_WINRT) QTest::newRow( "colon2" ) << invalidDriveLetter() + QString::fromLatin1(":ail:invalid"); - QTest::newRow( "date" ) << QString( "testLog-03:20.803Z.txt" ); #endif QTest::newRow( "colon3" ) << QString( ":failinvalid" ); QTest::newRow( "forwardslash" ) << QString( "fail/invalid" ); -- cgit v1.2.3 From 763b0a68beb3b1502f6f4c1b979f0a576fc9980b Mon Sep 17 00:00:00 2001 From: Jesus Fernandez Date: Tue, 20 Jun 2017 12:51:40 +0200 Subject: Fix QStandardItem::setChild crash when passing a null pointer Passing a null pointer as a parameter to the setChild function no longer crashes when calling the QStandardItemModelPrivate::itemChanged signal. The child is removed from the model. The patch also fixes the behavior of deleting a item. A dataChanged signal is emitted. Change-Id: I027e8b0d84fe33c5fca056df870f0e60a020824b Reviewed-by: David Faure --- .../qstandarditemmodel/tst_qstandarditemmodel.cpp | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp index cff26be7bb..2f5537adfe 100644 --- a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp +++ b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp @@ -117,6 +117,9 @@ private slots: void useCase2(); void useCase3(); + void setNullChild(); + void deleteChild(); + void rootItemFlags(); #ifdef QT_BUILD_INTERNAL void treeDragAndDrop(); @@ -1364,6 +1367,30 @@ void tst_QStandardItemModel::useCase3() delete childItem; } +void tst_QStandardItemModel::setNullChild() +{ + QStandardItemModel model; + model.setColumnCount(2); + createChildren(&model, model.invisibleRootItem(), 0); + QStandardItem *item = model.item(0); + QSignalSpy spy(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector))); + item->setChild(0, nullptr); + QCOMPARE(item->child(0), nullptr); + QCOMPARE(spy.count(), 1); +} + +void tst_QStandardItemModel::deleteChild() +{ + QStandardItemModel model; + model.setColumnCount(2); + createChildren(&model, model.invisibleRootItem(), 0); + QStandardItem *item = model.item(0); + QSignalSpy spy(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector))); + delete item->child(0); + QCOMPARE(item->child(0), nullptr); + QCOMPARE(spy.count(), 1); +} + void tst_QStandardItemModel::rootItemFlags() { QStandardItemModel model(6, 4); -- cgit v1.2.3 From 5bce6aabdcb7e174d3b6ba33c5c4e22ebcf85abf Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 27 Jul 2017 15:47:44 +0200 Subject: Enrich tst_macNativeEvents blacklist MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends 0c7e4b97a7990b29255abaf4568f62b6a6b6c470 Task-number: QTQAINFRA-1292 Change-Id: I599dc1e7d39a96617d48fa32227093c8501b1323 Reviewed-by: Jędrzej Nowacki --- tests/auto/other/macnativeevents/BLACKLIST | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/other/macnativeevents/BLACKLIST b/tests/auto/other/macnativeevents/BLACKLIST index f1eb038201..3998eb616a 100644 --- a/tests/auto/other/macnativeevents/BLACKLIST +++ b/tests/auto/other/macnativeevents/BLACKLIST @@ -24,3 +24,19 @@ osx # QTQAINFRA-1292 [testPushButtonPressRelease] osx-10.11 ci +osx-10.12 ci +# QTQAINFRA-1292 +[testKeyPressOnToplevel] +osx-10.12 ci +# QTQAINFRA-1292 +[testModifierShift] +osx-10.12 ci +# QTQAINFRA-1292 +[testModifierAlt] +osx-10.12 ci +# QTQAINFRA-1292 +[testModifierCtrl] +osx-10.12 ci +# QTQAINFRA-1292 +[testModifierCtrlWithDontSwapCtrlAndMeta] +osx-10.12 ci -- cgit v1.2.3 From 5a9247166c07e8eecee972f78388e22fd156697f Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 28 Jul 2017 12:45:28 +0200 Subject: Ignore failure of qaccessbilitymac on macOS 10.12 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTQAINFRA-1351 Change-Id: I9b41e5664cdb6cedcb68be6197fc21b2cc45963d Reviewed-by: Jędrzej Nowacki --- tests/auto/other/qaccessibilitymac/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 tests/auto/other/qaccessibilitymac/BLACKLIST (limited to 'tests/auto') diff --git a/tests/auto/other/qaccessibilitymac/BLACKLIST b/tests/auto/other/qaccessibilitymac/BLACKLIST new file mode 100644 index 0000000000..f53fa7e853 --- /dev/null +++ b/tests/auto/other/qaccessibilitymac/BLACKLIST @@ -0,0 +1,2 @@ +[hierarchyTest] +osx-10.12 ci -- cgit v1.2.3 From 5881fc0d2d58ae3e46c8fd3567c98ee689f5c900 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 28 Jul 2017 13:43:58 +0200 Subject: Ignore tst_QFocusEvent failures on macOS 10.12 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTQAINFRA-1352 Change-Id: Ia5cad1af74a2ea581d768ce150e480f3a97b6495 Reviewed-by: Jędrzej Nowacki --- tests/auto/other/qfocusevent/BLACKLIST | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 tests/auto/other/qfocusevent/BLACKLIST (limited to 'tests/auto') diff --git a/tests/auto/other/qfocusevent/BLACKLIST b/tests/auto/other/qfocusevent/BLACKLIST new file mode 100644 index 0000000000..502820fa12 --- /dev/null +++ b/tests/auto/other/qfocusevent/BLACKLIST @@ -0,0 +1,5 @@ +[checkReason_Shortcut] +osx-10.12 ci +[checkReason_ActiveWindow] +osx-10.12 ci + -- cgit v1.2.3 From 3760120ab33ea454bed320b10e8afcb29f7869ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Fri, 28 Jul 2017 09:42:03 +0200 Subject: Remove tst_qtconcurrentiteratekernel blockSize test The test is just wrong. It suggests, that it tests minimal block size, but in reality it is checking if a maximal peak of block size is bigger then expected minimum block size. The minimal block size is 1, not 1024 / ideal threads count and it is defined in BlockSizeManagerV2. The maximal block size is defined and it is fixed, but it is an implementation detail, probably not worth testing. The test is based on a race condition as peakBegin and peakBlockSize are modified in parallel from multiple threads, without any synchronization. Change-Id: I430eedcf83b0fa3e2ce2cfd294eaee7b301e48ae Reviewed-by: Simon Hausmann --- .../tst_qtconcurrentiteratekernel.cpp | 45 ---------------------- 1 file changed, 45 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp b/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp index 4bb3fa5b28..2e698e6615 100644 --- a/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp +++ b/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp @@ -81,7 +81,6 @@ private slots: void stresstest(); void noIterations(); void throttling(); - void blockSize(); void multipleResults(); }; @@ -240,50 +239,6 @@ void tst_QtConcurrentIterateKernel::throttling() QCOMPARE(threads.count(), 1); } -class BlockSizeRecorder : public IterateKernel -{ -public: - BlockSizeRecorder(TestIterator begin, TestIterator end) - : IterateKernel(begin, end) - , peakBlockSize(0) - , peakBegin(0) - {} - - inline bool runIterations(TestIterator, int begin, int end, void *) - { - const int blockSize = end - begin; - if (blockSize > peakBlockSize) { - peakBlockSize = blockSize; - peakBegin = begin; - } - return false; - } - int peakBlockSize; - int peakBegin; -}; - -static QByteArray msgBlockSize(const BlockSizeRecorder &recorder, int expectedMinimumBlockSize) -{ - return QByteArrayLiteral("peakBlockSize=") + QByteArray::number(recorder.peakBlockSize) - + QByteArrayLiteral(" is less than expectedMinimumBlockSize=") - + QByteArray::number(expectedMinimumBlockSize) - + QByteArrayLiteral(", reached at: ") + QByteArray::number(recorder.peakBegin) - + QByteArrayLiteral(" (ideal thread count: ") + QByteArray::number(QThread::idealThreadCount()) - + ')'; -} - -void tst_QtConcurrentIterateKernel::blockSize() -{ - const int expectedMinimumBlockSize = 1024 / QThread::idealThreadCount(); - BlockSizeRecorder recorder(0, 10000); - recorder.startBlocking(); -#ifdef Q_OS_WIN - if (recorder.peakBlockSize < expectedMinimumBlockSize) - QEXPECT_FAIL("", msgBlockSize(recorder, expectedMinimumBlockSize).constData(), Abort); -#endif // Q_OS_WIN - QVERIFY2(recorder.peakBlockSize >= expectedMinimumBlockSize, msgBlockSize(recorder, expectedMinimumBlockSize)); -} - class MultipleResultsFor : public IterateKernel { public: -- cgit v1.2.3 From 3bdd59920fab954fd94a7b643042e1aaf7801674 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 29 Jun 2017 08:38:51 +0200 Subject: Refactor tst_qdir::entryList() Split the test in two: one test that requires the symlinks and test files and one that does not need them. In the test with test files, verify each step and the deletion of the files. Task-number: QTBUG-58654 Task-number: QTBUG-50835 Change-Id: I14de57ce7a1df2d834d5a7565c804dead1d89088 Reviewed-by: Oliver Wolff Reviewed-by: Thiago Macieira --- tests/auto/corelib/io/qdir/tst_qdir.cpp | 99 +++++++++++++++++++++++---------- 1 file changed, 69 insertions(+), 30 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index da948849f6..e6bad9a8ef 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -93,6 +93,9 @@ private slots: void entryList_data(); void entryList(); + void entryListWithTestFiles_data(); + void entryListWithTestFiles(); + void entryListTimedSort(); void entryListSimple_data(); @@ -717,6 +720,32 @@ void tst_QDir::entryList_data() QTest::newRow("resources2") << QString(":/tst_qdir/resources/entryList") << QStringList("*.data") << (int)(QDir::Files) << (int)(QDir::NoSort) << QString("file1.data,file2.data,file3.data").split(','); +} + +void tst_QDir::entryList() +{ + QFETCH(QString, dirName); + QFETCH(QStringList, nameFilters); + QFETCH(int, filterspec); + QFETCH(int, sortspec); + QFETCH(QStringList, expected); + + QDir dir(dirName); + QVERIFY2(dir.exists(), msgDoesNotExist(dirName).constData()); + + QStringList actual = dir.entryList(nameFilters, (QDir::Filters)filterspec, + (QDir::SortFlags)sortspec); + + QCOMPARE(actual, expected); +} + +void tst_QDir::entryListWithTestFiles_data() +{ + QTest::addColumn("dirName"); // relative from current path or abs + QTest::addColumn("nameFilters"); + QTest::addColumn("filterspec"); + QTest::addColumn("sortspec"); + QTest::addColumn("expected"); QTest::newRow("nofilter") << (m_dataPath + "/entrylist/") << QStringList("*") << int(QDir::NoFilter) << int(QDir::Name) @@ -823,7 +852,7 @@ void tst_QDir::entryList_data() << QString("c,b,a,a.a,a.b,a.c,b.b,b.c,b.a,c.c,c.b,c.a,f.c,f.b,f.a,f,e.c,e.b,e.a,e,d.c,d.b,d.a,d").split(','); } -void tst_QDir::entryList() +void tst_QDir::entryListWithTestFiles() { QFETCH(QString, dirName); QFETCH(QStringList, nameFilters); @@ -831,28 +860,49 @@ void tst_QDir::entryList() QFETCH(int, sortspec); QFETCH(QStringList, expected); + QStringList testFiles; + QString entrylistPath = (m_dataPath + "/entrylist/"); - QFile(entrylistPath + "writable").open(QIODevice::ReadWrite); - QFile(entrylistPath + "file").setPermissions(QFile::ReadOwner | QFile::ReadUser); - QFile::remove(entrylistPath + "linktofile"); - QFile::remove(entrylistPath + "linktodirectory"); - QFile::remove(entrylistPath + "linktofile.lnk"); - QFile::remove(entrylistPath + "linktodirectory.lnk"); - QFile::remove(entrylistPath + "brokenlink.lnk"); - QFile::remove(entrylistPath + "brokenlink"); + + { + const QString writableFileName = entrylistPath + "writable"; + QFile writableFile(writableFileName); + testFiles.append(writableFileName); + + QVERIFY2(writableFile.open(QIODevice::ReadWrite), + qPrintable(writableFile.errorString())); + } + + { + QFile readOnlyFile(entrylistPath + "file"); + QVERIFY2(readOnlyFile.setPermissions(QFile::ReadOwner | QFile::ReadUser), + qPrintable(readOnlyFile.errorString())); + } + #ifndef Q_NO_SYMLINKS #if defined(Q_OS_WIN) // ### Sadly, this is a platform difference right now. // Note we are using capital L in entryList on one side here, to test case-insensitivity - QFile::link((m_dataPath + "/entryList/") + "file", entrylistPath + "linktofile.lnk"); - QFile::link((m_dataPath + "/entryList/") + "directory", entrylistPath + "linktodirectory.lnk"); - QFile::link((m_dataPath + "/entryList/") + "nothing", entrylistPath + "brokenlink.lnk"); + const QVector > symLinks = + { + {m_dataPath + "/entryList/file", entrylistPath + "linktofile.lnk"}, + {m_dataPath + "/entryList/directory", entrylistPath + "linktodirectory.lnk"}, + {m_dataPath + "/entryList/nothing", entrylistPath + "brokenlink.lnk"} + }; #else - QFile::link("file", entrylistPath + "linktofile.lnk"); - QFile::link("directory", entrylistPath + "linktodirectory.lnk"); - QFile::link("nothing", entrylistPath + "brokenlink.lnk"); + const QVector > symLinks = + { + {"file", entrylistPath + "linktofile.lnk"}, + {"directory", entrylistPath + "linktodirectory.lnk"}, + {"nothing", entrylistPath + "brokenlink.lnk"} + }; #endif + for (const auto &symLink : symLinks) { + QVERIFY2(QFile::link(symLink.first, symLink.second), + qPrintable(symLink.first + "->" + symLink.second)); + testFiles.append(symLink.second); + } #endif //Q_NO_SYMLINKS QDir dir(dirName); @@ -861,8 +911,6 @@ void tst_QDir::entryList() QStringList actual = dir.entryList(nameFilters, (QDir::Filters)filterspec, (QDir::SortFlags)sortspec); - int max = qMin(actual.count(), expected.count()); - bool doContentCheck = true; #if defined(Q_OS_UNIX) if (qstrcmp(QTest::currentDataTag(), "QDir::AllEntries | QDir::Writable") == 0) { @@ -872,20 +920,11 @@ void tst_QDir::entryList() } #endif - if (doContentCheck) { - for (int i=0; i= 0; --i) + QVERIFY2(QFile::remove(testFiles.at(i)), qPrintable(testFiles.at(i))); - QFile::remove(entrylistPath + "writable"); - QFile::remove(entrylistPath + "linktofile"); - QFile::remove(entrylistPath + "linktodirectory"); - QFile::remove(entrylistPath + "linktofile.lnk"); - QFile::remove(entrylistPath + "linktodirectory.lnk"); - QFile::remove(entrylistPath + "brokenlink.lnk"); - QFile::remove(entrylistPath + "brokenlink"); + if (doContentCheck) + QCOMPARE(actual, expected); } void tst_QDir::entryListTimedSort() -- cgit v1.2.3 From 6adff20fe6afe8d17db2d8183506abd2792789bd Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Thu, 15 Jun 2017 20:16:21 +0300 Subject: Fix bytesAvailable() on UDP under Windows When ::WSAIoctl() reports 1 byte available for reading, we are trying to peek an incoming datagram to ensure that the data is actually delivered. But, according to MSDN docs, we are not allowed to pass NULL as 'lpNumberOfBytesRecvd' parameter to ::WSARecvFrom() call, if 'lpOverlapped' parameter is also NULL. The case with an empty datagram is fixed accordingly. Change-Id: Id13038245332d3fb4bc18038d44a7cfd7ce04775 Reviewed-by: Edward Welbourne Reviewed-by: Thiago Macieira --- tests/auto/network/socket/qudpsocket/BLACKLIST | 1 - 1 file changed, 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/network/socket/qudpsocket/BLACKLIST b/tests/auto/network/socket/qudpsocket/BLACKLIST index cf25c96fd8..5adb05d3f2 100644 --- a/tests/auto/network/socket/qudpsocket/BLACKLIST +++ b/tests/auto/network/socket/qudpsocket/BLACKLIST @@ -6,7 +6,6 @@ osx windows osx [asyncReadDatagram] -windows osx [multicastLeaveAfterClose] osx -- cgit v1.2.3 From 0a5f71c6062d575602ff041fb1b88ec2d8ad92bc Mon Sep 17 00:00:00 2001 From: Joni Poikelin Date: Fri, 14 Jul 2017 09:25:54 +0300 Subject: Fix storing of QDateTime timespec for Sqlite Commit 9e64fc9e1cebf1e11694c4f536881128f5aee288 caused a regression which stored all QDateTime entries as if they were in localtime, which causes them to be offset by the amount of local timezone offset. This is fixed by adding "Z" if the time should be in UTC or using "+/-hh:mm" if it should use fixed UTC offset or specific timezone. Task-number: QTBUG-57138 Change-Id: Ie60905dfb3a517db442b636ca41daf8348753d84 Reviewed-by: Edward Welbourne Reviewed-by: Andy Shaw --- tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp | 38 +++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp index 8deb5ddf8f..35f86772e2 100644 --- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp @@ -243,6 +243,9 @@ private slots: void integralTypesMysql_data() { generic_data("QMYSQL"); } void integralTypesMysql(); + void QTBUG_57138_data() { generic_data("QSQLITE"); } + void QTBUG_57138(); + private: // returns all database connections void generic_data(const QString &engine=QString()); @@ -4083,5 +4086,40 @@ void tst_QSqlQuery::integralTypesMysql() } } +void tst_QSqlQuery::QTBUG_57138() +{ + QDateTime utc = QDateTime(QDate(2150, 1, 5), QTime(14, 0, 0, 123), Qt::UTC); + QDateTime localtime = QDateTime(QDate(2150, 1, 5), QTime(14, 0, 0, 123), Qt::LocalTime); + QDateTime tzoffset = QDateTime(QDate(2150, 1, 5), QTime(14, 0, 0, 123), Qt::OffsetFromUTC, 3600); + + QFETCH(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + + QSqlQuery create(db); + QString tableName = qTableName("qtbug57138", __FILE__, db); + + QVERIFY_SQL(create, exec("create table " + tableName + " (id int, dt_utc datetime, dt_lt datetime, dt_tzoffset datetime)")); + QVERIFY_SQL(create, prepare("insert into " + tableName + " (id, dt_utc, dt_lt, dt_tzoffset) values (?, ?, ?, ?)")); + + create.addBindValue(0); + create.addBindValue(utc); + create.addBindValue(localtime); + create.addBindValue(tzoffset); + + QVERIFY_SQL(create, exec()); + + QSqlQuery q(db); + q.prepare("SELECT dt_utc, dt_lt, dt_tzoffset FROM " + tableName + " WHERE id = ?"); + q.addBindValue(0); + + QVERIFY_SQL(q, exec()); + QVERIFY(q.next()); + + QCOMPARE(q.value(0).toDateTime(), utc); + QCOMPARE(q.value(1).toDateTime(), localtime); + QCOMPARE(q.value(2).toDateTime(), tzoffset); +} + QTEST_MAIN( tst_QSqlQuery ) #include "tst_qsqlquery.moc" -- cgit v1.2.3 From 30d32ae72cccca816429d12c371fc23fe46c80c4 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 2 Aug 2017 14:41:26 +0200 Subject: Ignore failures of submenuTearOffDontClose on macOS 10.12 Change-Id: Ie3409da033325aea832907579d4d61dfd3610e7a Task-number: QTQAINFRA-1358 Reviewed-by: Frederik Gladhorn --- tests/auto/widgets/widgets/qmenu/BLACKLIST | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/auto') diff --git a/tests/auto/widgets/widgets/qmenu/BLACKLIST b/tests/auto/widgets/widgets/qmenu/BLACKLIST index ea468b378e..cfd6bb1247 100644 --- a/tests/auto/widgets/widgets/qmenu/BLACKLIST +++ b/tests/auto/widgets/widgets/qmenu/BLACKLIST @@ -2,3 +2,4 @@ osx [submenuTearOffDontClose] osx-10.11 ci +osx-10.12 ci -- cgit v1.2.3 From f3ca13f3d12f52c60f4cd41d0b336c24a8d3359d Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 2 Aug 2017 14:43:16 +0200 Subject: Ignore failures of showMinimizedKeepsFocus/activateWindow on macOS 10.12 Change-Id: I1b5823b48c5dd5bebb8172fd696fc521b7de75b2 Task-number: QTQAINFRA-1359 Reviewed-by: Frederik Gladhorn --- tests/auto/widgets/kernel/qwidget/BLACKLIST | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST index ab45a342e3..0750526464 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-10.9 ubuntu-14.04 [moveChild:right] osx +[activateWindow] +osx-10.12 ci -- cgit v1.2.3 From d1d2ca2b41bcae399ed2ec563933e0725bffc075 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 2 Aug 2017 15:04:02 +0200 Subject: Ignore hanging tst_qinputdialog::getInt/getDouble() test on macOS 10.12 Change-Id: I495cd98144ba9145e44a9ee5cb8748ae97a6166f Task-number: QTQAINFRA-1356 Reviewed-by: Simon Hausmann --- .../widgets/dialogs/qinputdialog/tst_qinputdialog.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp index 4ea0de5ab9..8da6ef0363 100644 --- a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp +++ b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp @@ -257,6 +257,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; @@ -297,6 +305,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; -- cgit v1.2.3