From 174061f9f32ac76c6b8a6d155d772e37708d8cfc Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 31 Jul 2019 10:23:39 +0200 Subject: QHighDPI: Fix broken scaling of QPoint(F) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For some reason, the overload resolution of the High DPI scale() functions introduced by b6ded193ee64ffe67df6d22e7a23aa1ea9e02ec7 chose the wrong overloads for QPointF and/or QPoint; it fell back to the generic template intended for qreal, QSize, etc, ignoring the origin. Remove the template and spell out all overloads. Fixes: QTBUG-77255 Change-Id: I5661f16f7326f65156f646f430f5a0c71d5302d2 Reviewed-by: Tor Arne Vestbø --- tests/auto/gui/kernel/kernel.pro | 3 + .../gui/kernel/qhighdpiscaling/qhighdpiscaling.pro | 6 ++ .../kernel/qhighdpiscaling/tst_qhighdpiscaling.cpp | 77 ++++++++++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 tests/auto/gui/kernel/qhighdpiscaling/qhighdpiscaling.pro create mode 100644 tests/auto/gui/kernel/qhighdpiscaling/tst_qhighdpiscaling.cpp (limited to 'tests') diff --git a/tests/auto/gui/kernel/kernel.pro b/tests/auto/gui/kernel/kernel.pro index fbd3b1b371..42135dae24 100644 --- a/tests/auto/gui/kernel/kernel.pro +++ b/tests/auto/gui/kernel/kernel.pro @@ -11,6 +11,7 @@ SUBDIRS=\ qguimetatype \ qguitimer \ qguivariant \ + qhighdpiscaling \ qinputmethod \ qkeyevent \ qkeysequence \ @@ -35,6 +36,8 @@ win32:!winrt:qtHaveModule(network): SUBDIRS += noqteventloop !qtHaveModule(network): SUBDIRS -= \ qguieventloop +!qtConfig(highdpiscaling): SUBDIRS -= qhighdpiscaling + !qtConfig(opengl): SUBDIRS -= qopenglwindow android|uikit: SUBDIRS -= qclipboard diff --git a/tests/auto/gui/kernel/qhighdpiscaling/qhighdpiscaling.pro b/tests/auto/gui/kernel/qhighdpiscaling/qhighdpiscaling.pro new file mode 100644 index 0000000000..6cd7bb01f5 --- /dev/null +++ b/tests/auto/gui/kernel/qhighdpiscaling/qhighdpiscaling.pro @@ -0,0 +1,6 @@ +CONFIG += testcase +TARGET = tst_qhighdpiscaling + +QT += core-private gui-private testlib + +SOURCES += tst_qhighdpiscaling.cpp diff --git a/tests/auto/gui/kernel/qhighdpiscaling/tst_qhighdpiscaling.cpp b/tests/auto/gui/kernel/qhighdpiscaling/tst_qhighdpiscaling.cpp new file mode 100644 index 0000000000..969b2351ec --- /dev/null +++ b/tests/auto/gui/kernel/qhighdpiscaling/tst_qhighdpiscaling.cpp @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#include + +class tst_QHighDpiScaling: public QObject +{ + Q_OBJECT + +private slots: + void scale(); +}; + +// Emulate the case of a High DPI secondary screen +class MyPlatformScreen : public QPlatformScreen +{ +public: + QRect geometry() const override { return QRect(3840, 0, 3840, 1920); } + QRect availableGeometry() const override { return geometry(); } + + int depth() const override { return 32; } + QImage::Format format() const override { return QImage::Format_ARGB32_Premultiplied; } +}; + +// QTBUG-77255: Test some scaling overloads +void tst_QHighDpiScaling::scale() +{ + QHighDpiScaling::setGlobalFactor(2); + QScopedPointer screen(new MyPlatformScreen); + + qreal nativeValue = 10; + const qreal value = QHighDpi::fromNativePixels(nativeValue, screen.data()); + QCOMPARE(value, qreal(5)); + QCOMPARE(QHighDpi::toNativePixels(value, screen.data()), nativeValue); + + // 10, 10 within screen should translate to 5,5 with origin preserved + const QPoint nativePoint = screen->geometry().topLeft() + QPoint(10, 10); + const QPoint point = QHighDpi::fromNativePixels(nativePoint, screen.data()); + QCOMPARE(point, QPoint(3845, 5)); + QCOMPARE(QHighDpi::toNativePixels(point, screen.data()), nativePoint); + + const QPointF nativePointF(nativePoint); + const QPointF pointF = QHighDpi::fromNativePixels(nativePointF, screen.data()); + QCOMPARE(pointF, QPointF(3845, 5)); + QCOMPARE(QHighDpi::toNativePixels(pointF, screen.data()), nativePointF); +} + +#include "tst_qhighdpiscaling.moc" +QTEST_MAIN(tst_QHighDpiScaling); -- cgit v1.2.3 From bd8ef7fe24f80b193a3c47cc77795d766d35d25e Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Thu, 1 Aug 2019 13:58:48 +0200 Subject: Blacklist tst_http2::connectToHost MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test if flakey. Change-Id: I1f956f47ab4cf0602f3631e4f7908df35f5ce83f Reviewed-by: Tor Arne Vestbø --- tests/auto/network/access/http2/BLACKLIST | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 tests/auto/network/access/http2/BLACKLIST (limited to 'tests') diff --git a/tests/auto/network/access/http2/BLACKLIST b/tests/auto/network/access/http2/BLACKLIST new file mode 100644 index 0000000000..8f26c5b89e --- /dev/null +++ b/tests/auto/network/access/http2/BLACKLIST @@ -0,0 +1,3 @@ + See qtbase/src/testlib/qtestblacklist.cpp for format +[connectToHost] +* -- cgit v1.2.3 From ec62033bc25ed60a6bb9286d07e4f4485800b068 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Thu, 1 Aug 2019 15:01:27 +0200 Subject: tst_http2::connectToHost - add a fix for SecureTransport backend One of the tests above was unsetting a variable that enforces the use of a temporary keychain. We have to set it back, otherwise the test is failing. What surprises me though - why I had this problem only locally and not on CI? Apparently, SecureTransport is not covered by our configurations ... Change-Id: I0ff1e3e304632869391ed61213c245b949d8c778 Reviewed-by: Volker Hilsheimer --- tests/auto/network/access/http2/tst_http2.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests') diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp index ce685a1b1c..10dad25337 100644 --- a/tests/auto/network/access/http2/tst_http2.cpp +++ b/tests/auto/network/access/http2/tst_http2.cpp @@ -591,6 +591,19 @@ void tst_Http2::connectToHost() #if QT_CONFIG(ssl) Q_ASSERT(!clearTextHTTP2 || connectionType != H2Type::h2Alpn); + +#if QT_CONFIG(securetransport) + // Normally on macOS we use plain text only for SecureTransport + // does not support ALPN on the server side. With 'direct encrytped' + // we have to use TLS sockets (== private key) and thus suppress a + // keychain UI asking for permission to use a private key. + // Our CI has this, but somebody testing locally - will have a problem. + qputenv("QT_SSL_USE_TEMPORARY_KEYCHAIN", QByteArray("1")); + auto envRollback = qScopeGuard([](){ + qunsetenv("QT_SSL_USE_TEMPORARY_KEYCHAIN"); + }); +#endif // QT_CONFIG(securetransport) + #else Q_ASSERT(connectionType == H2Type::h2c || connectionType == H2Type::h2cDirect); Q_ASSERT(targetServer->isClearText()); -- cgit v1.2.3 From 4f116f00fcd93decbf6fc01b61b0be7c293d3c39 Mon Sep 17 00:00:00 2001 From: Ville Voutilainen Date: Mon, 5 Aug 2019 15:24:16 +0300 Subject: Fix GCC 4.8 build Change-Id: I4994146b359e8e37f6c0fa1b27f03fb9e800fdd5 Fixes: QTBUG-77218 Reviewed-by: Simon Hausmann --- tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index 3b387c9235..7ee085b81c 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -491,7 +491,7 @@ void tst_QApplication::lastWindowClosed() QPointer dialog = new QDialog; dialog->setWindowTitle(QLatin1String(QTest::currentTestFunction()) + QLatin1String("Dialog")); QVERIFY(dialog->testAttribute(Qt::WA_QuitOnClose)); - QTimer::singleShot(1000, dialog, &QDialog::accept); + QTimer::singleShot(1000, dialog.data(), &QDialog::accept); dialog->exec(); QVERIFY(dialog); QCOMPARE(spy.count(), 0); -- cgit v1.2.3 From 36cc171b9314bf77fc84d4273dceb6264aef7134 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Tue, 6 Aug 2019 07:50:14 +0200 Subject: tst_http2::connectToHost - fix flakiness some assumptions were incorrect: our test server immediately sends its SETTINGS frame, as a result we have to reply with client preface + SETTINGS(ACK). So QVERIFY(!prefaceOK) was wrong from the beginning and was only passing by pure luck. Change-Id: Ie43f0d4ac41deb0e5339badaae6149a9b2f9d9b3 Reviewed-by: Timur Pocheptsov Reviewed-by: Volker Hilsheimer --- tests/auto/network/access/http2/BLACKLIST | 3 --- tests/auto/network/access/http2/tst_http2.cpp | 3 --- 2 files changed, 6 deletions(-) delete mode 100644 tests/auto/network/access/http2/BLACKLIST (limited to 'tests') diff --git a/tests/auto/network/access/http2/BLACKLIST b/tests/auto/network/access/http2/BLACKLIST deleted file mode 100644 index 8f26c5b89e..0000000000 --- a/tests/auto/network/access/http2/BLACKLIST +++ /dev/null @@ -1,3 +0,0 @@ - See qtbase/src/testlib/qtestblacklist.cpp for format -[connectToHost] -* diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp index 10dad25337..4b4b8d541a 100644 --- a/tests/auto/network/access/http2/tst_http2.cpp +++ b/tests/auto/network/access/http2/tst_http2.cpp @@ -648,9 +648,6 @@ void tst_Http2::connectToHost() eventLoop.exitLoop(); QCOMPARE(reply->error(), QNetworkReply::NoError); QVERIFY(reply->isFinished()); - // Nothing must be sent yet: - QVERIFY(!prefaceOK); - QVERIFY(!serverGotSettingsACK); // Nothing received back: QVERIFY(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).isNull()); QCOMPARE(reply->readAll().size(), 0); -- cgit v1.2.3 From 79e0effead13f60676bb5170fe92615d981827e7 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 7 Aug 2019 15:25:49 +0200 Subject: Fix crash in QTextDocument::clearUndoRedoStacks() When calling QTextDocument::clearUndoRedoStacks() with UndoStack, there were two bugs: The first was that we were retrieving the item at "undoState" and deleting this. This is actually the upper limit of the for loop. If the stack does not contain any redos, then it would be == undoStack.size() and we would assert. If there were redos, then we would delete the item at undoState multiple times (actually undoState times). In addition, when the loop exited, we first removed the dangling pointers using remove() and then there was a weird resize() to the new size minus the old undoState. This would either assert because we tried to resize to a negative number, or it would arbitrarily remove items from the stack. [ChangeLog][QtGui][Text] Fixed a crash bug in QTextDocument::clearUndoRedoStacks(QTextDocument::UndoStack). Task-number: QTBUG-69546 Change-Id: I8a93e828ec27970763a2756071fa0b01678d2dcd Reviewed-by: Simon Hausmann Reviewed-by: Konstantin Ritt --- tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests') diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp index 32131352c3..c04c841376 100644 --- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp @@ -188,6 +188,8 @@ private slots: void lineHeightType(); void cssLineHeightMultiplier(); + + void clearUndoRedoStacks(); private: void backgroundImage_checkExpectedHtml(const QTextDocument &doc); void buildRegExpData(); @@ -3486,5 +3488,16 @@ void tst_QTextDocument::cssLineHeightMultiplier() } } +void tst_QTextDocument::clearUndoRedoStacks() +{ + QTextDocument doc; + QTextCursor c(&doc); + c.insertText(QStringLiteral("lorem ipsum")); + QVERIFY(doc.isUndoAvailable()); + doc.clearUndoRedoStacks(QTextDocument::UndoStack); // Don't crash + QVERIFY(!doc.isUndoAvailable()); +} + + QTEST_MAIN(tst_QTextDocument) #include "tst_qtextdocument.moc" -- cgit v1.2.3 From ca20b449592ed05eca0c476d2fcf5d0851d92c36 Mon Sep 17 00:00:00 2001 From: Ville Voutilainen Date: Tue, 6 Aug 2019 10:50:52 +0300 Subject: A GCC 4.8 build fix Change-Id: Ic128486711118e1124739e8dca30547ab8ba9816 Reviewed-by: Simon Hausmann --- tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index 5b4a5d30a5..d13c145189 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -486,7 +486,7 @@ void tst_QApplication::lastWindowClosed() QPointer dialog = new QDialog; dialog->setWindowTitle(QLatin1String(QTest::currentTestFunction()) + QLatin1String("Dialog")); QVERIFY(dialog->testAttribute(Qt::WA_QuitOnClose)); - QTimer::singleShot(1000, dialog, &QDialog::accept); + QTimer::singleShot(1000, dialog.data(), &QDialog::accept); dialog->exec(); QVERIFY(dialog); QCOMPARE(spy.count(), 0); -- cgit v1.2.3 From c76b86aec64c4098434340ec17a26d7b2a32338e Mon Sep 17 00:00:00 2001 From: Heikki Halmet Date: Sun, 4 Aug 2019 08:42:26 +0300 Subject: BLACKLIST contains_QPointF for msvc-2019 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-77312 Change-Id: I5197d160d9b3c70b538c2e5a43c31120e1bed5f0 Reviewed-by: Tony Sarajärvi --- tests/auto/gui/painting/qpainterpath/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 tests/auto/gui/painting/qpainterpath/BLACKLIST (limited to 'tests') diff --git a/tests/auto/gui/painting/qpainterpath/BLACKLIST b/tests/auto/gui/painting/qpainterpath/BLACKLIST new file mode 100644 index 0000000000..b3e6d3bfe4 --- /dev/null +++ b/tests/auto/gui/painting/qpainterpath/BLACKLIST @@ -0,0 +1,2 @@ +[contains_QPointF] +msvc-2019 -- cgit v1.2.3 From 6ce9404a6e7ad6ba3ff37f6890fe400c643c3d52 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 1 Aug 2019 22:56:30 -0700 Subject: QBitArray: fix fromBits() and actually test it When I initially added it, it was ony for QCborValue, but I never added the tests. Turns out there were two bugs: [ChangeLog][QtCore][QBitArray] Fixed two bugs that caused QBitArrays created using fromBits() not to compare equal to the equivalent QBitArray created using other methods if the size was zero or not a multiple of 4. If the size modulus 8 was 5, 6, or 7, the data was actually incorrect. Fixes: QTBUG-77285 Change-Id: Ife213d861bb14c1787e1fffd15b70573d162042c Reviewed-by: Lars Knoll --- .../auto/corelib/tools/qbitarray/tst_qbitarray.cpp | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'tests') diff --git a/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp b/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp index d19eac7530..9a7c099228 100644 --- a/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp +++ b/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp @@ -84,6 +84,8 @@ private slots: void operator_noteq(); void resize(); + void fromBits_data(); + void fromBits(); }; void tst_QBitArray::size_data() @@ -610,5 +612,60 @@ void tst_QBitArray::resize() } +void tst_QBitArray::fromBits_data() +{ + QTest::addColumn("data"); + QTest::addColumn("size"); + QTest::addColumn("expected"); + + QTest::newRow("empty") << QByteArray() << 0 << QBitArray(); + + auto add = [](const QByteArray &tag, const char *data) { + QTest::newRow(tag) << QByteArray(data, (tag.size() + 7) / 8) << tag.size() + << QStringToQBitArray(tag); + }; + + // "0" to "0000000000000000" + for (int i = 1; i < 16; ++i) { + char zero[2] = { 0, 0 }; + QByteArray pattern(i, '0'); + add(pattern, zero); + } + + // "1" to "1111111111111111" + for (int i = 1; i < 16; ++i) { + char one[2] = { '\xff', '\xff' }; + QByteArray pattern(i, '1'); + add(pattern, one); + } + + // trailing 0 and 1 + char zero = 1; + char one = 0; + QByteArray pzero = "1"; + QByteArray pone = "0"; + for (int i = 2; i < 8; ++i) { + zero <<= 1; + pzero.prepend('0'); + add(pzero, &zero); + + one = (one << 1) | 1; + pone.prepend('1'); + add(pone, &one); + } +} + +void tst_QBitArray::fromBits() +{ + QFETCH(QByteArray, data); + QFETCH(int, size); + QFETCH(QBitArray, expected); + + QBitArray fromBits = QBitArray::fromBits(data, size); + QCOMPARE(fromBits, expected); + + QCOMPARE(QBitArray::fromBits(fromBits.bits(), fromBits.size()), expected); +} + QTEST_APPLESS_MAIN(tst_QBitArray) #include "tst_qbitarray.moc" -- cgit v1.2.3 From 5d7f1133205d14002463456c26a97f8ba17d69b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Wed, 7 Aug 2019 13:15:51 +0200 Subject: Add nullptr guard to QHighDScaling::scaleAndOrigin(QPlatformScreen *) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit b6ded193 added an unconditional dereference of the platformScreen pointer, for calls where nativePostion is non-nullptr. Change-Id: I4a6fbbd0337f91d4fcb76c17b4dc60e1b9ad10ed Reviewed-by: Tor Arne Vestbø --- .../gui/kernel/qhighdpiscaling/tst_qhighdpiscaling.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests') diff --git a/tests/auto/gui/kernel/qhighdpiscaling/tst_qhighdpiscaling.cpp b/tests/auto/gui/kernel/qhighdpiscaling/tst_qhighdpiscaling.cpp index 969b2351ec..ec80c2d02c 100644 --- a/tests/auto/gui/kernel/qhighdpiscaling/tst_qhighdpiscaling.cpp +++ b/tests/auto/gui/kernel/qhighdpiscaling/tst_qhighdpiscaling.cpp @@ -36,6 +36,7 @@ class tst_QHighDpiScaling: public QObject Q_OBJECT private slots: + void factor(); void scale(); }; @@ -50,6 +51,23 @@ public: QImage::Format format() const override { return QImage::Format_ARGB32_Premultiplied; } }; +void tst_QHighDpiScaling::factor() +{ + QHighDpiScaling::setGlobalFactor(2); + + // Verfy that QHighDpiScaling::factor() does not crash on nullptr contexts. + QPoint fakeNativePosition = QPoint(5, 5); + QPlatformScreen *screenContext = nullptr; + QVERIFY(QHighDpiScaling::factor(screenContext) >= 0); + QVERIFY(QHighDpiScaling::factor(screenContext, &fakeNativePosition) >= 0); + QPlatformScreen *platformScreenContext = nullptr; + QVERIFY(QHighDpiScaling::factor(platformScreenContext) >= 0); + QVERIFY(QHighDpiScaling::factor(platformScreenContext, &fakeNativePosition) >= 0); + QWindow *windowContext = nullptr; + QVERIFY(QHighDpiScaling::factor(windowContext) >= 0); + QVERIFY(QHighDpiScaling::factor(windowContext, &fakeNativePosition) >= 0); +} + // QTBUG-77255: Test some scaling overloads void tst_QHighDpiScaling::scale() { -- cgit v1.2.3 From 9bcbba36c73b8d03e8e58898629259489a24e040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Wed, 12 Jun 2019 15:29:31 +0200 Subject: QWizard: Account for missing background image on macOS 10.14+ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We were loading “Background.png” from the KeyboardSetupAssistant app bundle. As of macOS 10.14 that image is no longer there. Adjust auto tests and document the behavior. Change-Id: Icb4dd73b3fa88927e87bb86db2bc9f7b4a8094f7 Reviewed-by: Tor Arne Vestbø --- tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'tests') diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp index 63f6e67a3e..da75e64d1e 100644 --- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp +++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp @@ -417,20 +417,19 @@ void tst_QWizard::setPixmap() QVERIFY(wizard.pixmap(QWizard::BannerPixmap).isNull()); QVERIFY(wizard.pixmap(QWizard::LogoPixmap).isNull()); QVERIFY(wizard.pixmap(QWizard::WatermarkPixmap).isNull()); -#ifdef Q_OS_OSX - QVERIFY(!wizard.pixmap(QWizard::BackgroundPixmap).isNull()); -#else - QVERIFY(wizard.pixmap(QWizard::BackgroundPixmap).isNull()); -#endif + if (QSysInfo::macVersion() <= Q_MV_OSX(10, 13)) + QVERIFY(!wizard.pixmap(QWizard::BackgroundPixmap).isNull()); + else + QVERIFY(wizard.pixmap(QWizard::BackgroundPixmap).isNull()); QVERIFY(page->pixmap(QWizard::BannerPixmap).isNull()); QVERIFY(page->pixmap(QWizard::LogoPixmap).isNull()); QVERIFY(page->pixmap(QWizard::WatermarkPixmap).isNull()); -#ifdef Q_OS_OSX - QVERIFY(!wizard.pixmap(QWizard::BackgroundPixmap).isNull()); -#else - QVERIFY(page->pixmap(QWizard::BackgroundPixmap).isNull()); -#endif + if (QSysInfo::macVersion() <= Q_MV_OSX(10, 13)) + QVERIFY(!wizard.pixmap(QWizard::BackgroundPixmap).isNull()); + else + QVERIFY(page->pixmap(QWizard::BackgroundPixmap).isNull()); + wizard.setPixmap(QWizard::BannerPixmap, p1); wizard.setPixmap(QWizard::LogoPixmap, p2); wizard.setPixmap(QWizard::WatermarkPixmap, p3); -- cgit v1.2.3 From fcc5323a08f955bcedd8a8a9750173384fa7d71f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 7 Jun 2019 16:04:23 +0200 Subject: Make test less dependent on moving the cursor The sendMouseMove() function calls QTest::mouseMove(), which again calls QCursor::setPos() to move the cursor. It then creates and sends a MouseMove event, using the constructor which picks up the global position by calling QCursor::pos(). On macOS 10.14, QCursor::setPos() may silently fail if the user does not grant the application permission to move the cursor (via a dialog). As result of this the mouse move event gets an incorrect global position. Provide the global position directly when creating the event to make sure it gets the correct value. Task-number: QTBUG-75786 Change-Id: I3e8df450fea802783a3d1dbe471753f502b42de3 Reviewed-by: Richard Moe Gustavsen --- tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index 28df3a3c38..1456b9e35c 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -88,7 +88,7 @@ static void sendMousePress(QWidget *widget, const QPoint &point, Qt::MouseButton static void sendMouseMove(QWidget *widget, const QPoint &point, Qt::MouseButton button = Qt::NoButton, Qt::MouseButtons buttons = 0) { QTest::mouseMove(widget, point); - QMouseEvent event(QEvent::MouseMove, point, button, buttons, 0); + QMouseEvent event(QEvent::MouseMove, point, widget->mapToGlobal(point), button, buttons, 0); QApplication::sendEvent(widget, &event); QApplication::processEvents(); } -- cgit v1.2.3