From 718216ee0b571d09702ff50dd108ae92bdc4c220 Mon Sep 17 00:00:00 2001 From: Sami Nurmenniemi Date: Tue, 18 Apr 2017 18:05:32 +0300 Subject: Fix tst_QTcpServer for QEMU QEMU does not support all syscalls needed for tcp socket testing. Skipped tests that can't pass on QEMU. Task-number: QTBUG-59966 Change-Id: Ib6d12d0fc4c913a0222e13db57f0864b7fdf21ba Reviewed-by: Thiago Macieira --- .../network/socket/qtcpserver/tst_qtcpserver.cpp | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp index 3b9ef577bd..cd1de209da 100644 --- a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -63,6 +63,13 @@ #include #include "../../../network-settings.h" +#if defined(Q_OS_LINUX) +#define SHOULD_CHECK_SYSCALL_SUPPORT +#include +#include +#include +#endif + class tst_QTcpServer : public QObject { Q_OBJECT @@ -111,6 +118,11 @@ private slots: void canAccessPendingConnectionsWhileNotListening(); private: + bool shouldSkipIpv6TestsForBrokenGetsockopt(); +#ifdef SHOULD_CHECK_SYSCALL_SUPPORT + bool ipv6GetsockoptionMissing(int level, int optname); +#endif + #ifndef QT_NO_BEARERMANAGEMENT QNetworkSession *networkSession; #endif @@ -180,6 +192,42 @@ void tst_QTcpServer::cleanup() #endif } +#ifdef SHOULD_CHECK_SYSCALL_SUPPORT +bool tst_QTcpServer::ipv6GetsockoptionMissing(int level, int optname) +{ + int testSocket; + + testSocket = socket(PF_INET6, SOCK_STREAM, 0); + + // If we can't test here, assume it's not missing + if (testSocket == -1) + return false; + + bool result = false; + if (getsockopt(testSocket, level, optname, nullptr, 0) == -1) { + if (errno == EOPNOTSUPP) { + result = true; + } + } + + close(testSocket); + return result; +} +#endif //SHOULD_CHECK_SYSCALL_SUPPORT + +bool tst_QTcpServer::shouldSkipIpv6TestsForBrokenGetsockopt() +{ +#ifdef SHOULD_CHECK_SYSCALL_SUPPORT + // Following parameters for setsockopt are not supported by all QEMU versions: + if (ipv6GetsockoptionMissing(SOL_IPV6, IPV6_V6ONLY)) { + return true; + } +#endif //SHOULD_CHECK_SYSCALL_SUPPORT + + return false; +} + + //---------------------------------------------------------------------------------- void tst_QTcpServer::constructing() @@ -848,6 +896,11 @@ void tst_QTcpServer::serverAddress() QFETCH(QHostAddress, serverAddress); QTcpServer server; + if (shouldSkipIpv6TestsForBrokenGetsockopt() + && listenAddress == QHostAddress(QHostAddress::Any)) { + QSKIP("Syscalls needed for ipv6 sockoptions missing functionality"); + } + // TODO: why does this QSKIP? if (!server.listen(listenAddress)) QSKIP(qPrintable(server.errorString())); -- cgit v1.2.3 From eec388865f20dda209e1805f55f4185e8ab07546 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 15 Mar 2017 14:56:03 +0100 Subject: Skip tst_QMdiArea::setViewport on macOS due to flakey failures in CI Task-number: QTBUG-58520 Change-Id: I582c190de45e85e2dfb397289720c655ec8d781c Reviewed-by: Liang Qi --- tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests/auto') 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(); -- cgit v1.2.3 From dfc2a4a537a053b2c9157d48090637a0b77c4485 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 18 Feb 2017 09:41:30 +0100 Subject: QLoggingRegistry: remove rules vector It only contained a concatenation of the individual rule sets, probably to fix their order in a central place, as well as simplifying iteration in defaultCategoryFilter(). Fix these two issues differently, but introducing a RuleSet enum that lists rule sets in the order in which they should be applied by defaultCategoryFilter(), and turn individual rule sets vectors into a C array of vectors. This enables two nested loops in defaultCategoryFilter to replace the one loop over 'rules'. Apart from building up 'rules' in updateRules(), this was the only access to that member. That leaves updateRules() with just the task of running defaultCategoryFilter() on the new rule sets. Consequently, a call to updateRules() can now replace the identical loop in installFilter(). Performance should not suffer. Iterating over a fixed-size array of vectors is hardly any slower than iterating over a single vector, and while the construction of 'rules' was probably a one-off task in most programs, this way of keeping the rules also saves memory because rules are not kept in two different vectors. It is also more maintainable, of course. Change-Id: Ibc132d096c8137dd02b034752646212e51208637 Reviewed-by: Kai Koehne Reviewed-by: Olivier Goffart (Woboq GmbH) --- .../io/qloggingregistry/tst_qloggingregistry.cpp | 26 +++++++++------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp index 0a74dc64c0..1643eed3d2 100644 --- a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp +++ b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp @@ -202,18 +202,15 @@ private slots: QLoggingRegistry registry; registry.init(); - QCOMPARE(registry.apiRules.size(), 0); - QCOMPARE(registry.configRules.size(), 0); - QCOMPARE(registry.envRules.size(), 1); - - QCOMPARE(registry.rules.size(), 1); + QCOMPARE(registry.ruleSets[QLoggingRegistry::ApiRules].size(), 0); + QCOMPARE(registry.ruleSets[QLoggingRegistry::ConfigRules].size(), 0); + QCOMPARE(registry.ruleSets[QLoggingRegistry::EnvironmentRules].size(), 1); // check that QT_LOGGING_RULES take precedence qputenv("QT_LOGGING_RULES", "Digia.*=true"); registry.init(); - QCOMPARE(registry.envRules.size(), 2); - QCOMPARE(registry.envRules.at(1).enabled, true); - QCOMPARE(registry.rules.size(), 2); + QCOMPARE(registry.ruleSets[QLoggingRegistry::EnvironmentRules].size(), 2); + QCOMPARE(registry.ruleSets[QLoggingRegistry::EnvironmentRules].at(1).enabled, true); } void QLoggingRegistry_config() @@ -238,7 +235,7 @@ private slots: QLoggingRegistry registry; registry.init(); - QCOMPARE(registry.configRules.size(), 1); + QCOMPARE(registry.ruleSets[QLoggingRegistry::ConfigRules].size(), 1); // remove file again QVERIFY(file.remove()); @@ -260,10 +257,9 @@ private slots: QLoggingRegistry *registry = QLoggingRegistry::instance(); // empty all rules , check default - registry->rules.clear(); - registry->apiRules.clear(); - registry->configRules.clear(); - registry->envRules.clear(); + registry->ruleSets[QLoggingRegistry::ApiRules].clear(); + registry->ruleSets[QLoggingRegistry::ConfigRules].clear(); + registry->ruleSets[QLoggingRegistry::EnvironmentRules].clear(); registry->updateRules(); QVERIFY(cat.isWarningEnabled()); @@ -271,7 +267,7 @@ private slots: // set Config rule QLoggingSettingsParser parser; parser.setContent("[Rules]\nDigia.*=false"); - registry->configRules=parser.rules(); + registry->ruleSets[QLoggingRegistry::ConfigRules] = parser.rules(); registry->updateRules(); QVERIFY(!cat.isWarningEnabled()); @@ -283,7 +279,7 @@ private slots: // set Env rule, should overwrite Config one parser.setContent("Digia.*=false"); - registry->envRules=parser.rules(); + registry->ruleSets[QLoggingRegistry::EnvironmentRules] = parser.rules(); registry->updateRules(); QVERIFY(!cat.isWarningEnabled()); -- cgit v1.2.3 From d4cdc4542609e61d04802902d73c693faa8d8969 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 18 Apr 2017 12:08:12 +0200 Subject: Fix QMetaMethod::invoke and automatic type registration This was simply not working for two reasons: - The index passed to QMetaObject::metacall was not right (there was an offset because of the return type) - If the registration succeeded, the arguments were not even initialized. The tests in tst_moc always called QMetaMethod::parameterType before calling invoke, which was properly registering the type. So this was not seen in the tests before. [ChangeLog][QtCore][QMetaMethod] Fixed crash in invoke() with QueuedConnection and types whose metatype gets automatically registered. Task-number: QTBUG-60185 Change-Id: I4247628484214fba0a8acc1813ed8f112f59c888 Reviewed-by: Thiago Macieira --- .../corelib/kernel/qmetaobject/tst_qmetaobject.cpp | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp index fd32dc1ef8..e793d71fe2 100644 --- a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp +++ b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp @@ -206,6 +206,7 @@ private slots: void invokeMetaConstructor(); void invokeTypedefTypes(); void invokeException(); + void invokeQueuedAutoRegister(); void qtMetaObjectInheritance(); void normalizedSignature_data(); void normalizedSignature(); @@ -377,6 +378,7 @@ class QtTestObject: public QObject public: QtTestObject(); + QtTestObject(const QString &s) : slotResult(s) {} Q_INVOKABLE QtTestObject(QObject *parent); public slots: @@ -416,6 +418,15 @@ public slots: return s2; } + void slotWithRegistrableArgument(QtTestObject *o1, QPointer o2, + QSharedPointer o3, QWeakPointer o4, + QVector o5, QList o6) + { + slotResult = QLatin1String("slotWithRegistrableArgument:") + o1->slotResult + o2->slotResult + + o3->slotResult + o4.data()->slotResult + QString::number(o5.size()) + + QString::number(o6.size()); + } + signals: void sig0(); QString sig1(QString s1); @@ -944,6 +955,24 @@ void tst_QMetaObject::invokeException() #endif } +void tst_QMetaObject::invokeQueuedAutoRegister() +{ + QtTestObject obj; + + auto shared = QSharedPointer::create(QStringLiteral("myShared-")); + + QVERIFY(QMetaObject::invokeMethod( + &obj, "slotWithRegistrableArgument", Qt::QueuedConnection, + Q_ARG(QtTestObject *, shared.data()), Q_ARG(QPointer, shared.data()), + Q_ARG(QSharedPointer, shared), Q_ARG(QWeakPointer, shared), + Q_ARG(QVector, QVector()), + Q_ARG(QList, QList()))); + QVERIFY(obj.slotResult.isEmpty()); + qApp->processEvents(QEventLoop::AllEvents); + QCOMPARE(obj.slotResult, + QString("slotWithRegistrableArgument:myShared-myShared-myShared-myShared-00")); +} + void tst_QMetaObject::normalizedSignature_data() { QTest::addColumn("signature"); -- cgit v1.2.3 From 485b6c99dbb99916c13376cf27a13094efc137d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tony=20Saraj=C3=A4rvi?= Date: Mon, 24 Apr 2017 09:35:35 +0300 Subject: Blacklist tst_qsemaphore on macOS 10.12 Task-number: QTBUG-58745 Change-Id: I085a2ac60cc24c287140788a88512657238a2c4b Reviewed-by: Liang Qi --- tests/auto/corelib/thread/qsemaphore/BLACKLIST | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/auto') diff --git a/tests/auto/corelib/thread/qsemaphore/BLACKLIST b/tests/auto/corelib/thread/qsemaphore/BLACKLIST index 06ae815f29..c198b90253 100644 --- a/tests/auto/corelib/thread/qsemaphore/BLACKLIST +++ b/tests/auto/corelib/thread/qsemaphore/BLACKLIST @@ -1,4 +1,5 @@ [tryAcquireWithTimeout:0.2s] windows +osx-10.12 [tryAcquireWithTimeout:2s] windows -- cgit v1.2.3 From 148188fef36dc96b9ebc090e3986f7fd203cf834 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tony=20Saraj=C3=A4rvi?= Date: Mon, 24 Apr 2017 10:16:20 +0300 Subject: Rename macos blacklisting to osx Change-Id: I7e370ad8e1e2cb87188e149c96681e4c18abaa4f Reviewed-by: Liang Qi --- tests/auto/corelib/animation/qsequentialanimationgroup/BLACKLIST | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/animation/qsequentialanimationgroup/BLACKLIST b/tests/auto/corelib/animation/qsequentialanimationgroup/BLACKLIST index 36b777de34..391e3f67af 100644 --- a/tests/auto/corelib/animation/qsequentialanimationgroup/BLACKLIST +++ b/tests/auto/corelib/animation/qsequentialanimationgroup/BLACKLIST @@ -2,4 +2,4 @@ windows [finishWithUncontrolledAnimation] windows -macos-10.12 +osx-10.12 -- cgit v1.2.3 From 21dd5d314a75c09250448e5d59dfb9af88c0f7d5 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 23 Apr 2017 22:43:18 -0300 Subject: QUrl: fix IDN whitelist checking when the TLD is in Unicode The whitelist is kept in ACE form, so if the TLD came in Unicode, we need to run ToASCII before we can check the whitelist. This is slightly inefficient because we'll run the same operation later in this domain. Change-Id: Iadfecb6f28984634979dfffd14b831f37b0f4818 Reviewed-by: Lars Knoll Reviewed-by: Florian Bruhin --- tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp index f5835ec5f4..766338e4f8 100644 --- a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp +++ b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp @@ -670,6 +670,14 @@ void tst_QUrlInternal::ace_testsuite() QCOMPARE(QUrl::fromAce(domain.toLatin1()), fromace + suffix); QCOMPARE(QUrl::fromAce(QUrl::toAce(domain)), unicode + suffix); + QUrl u; + u.setHost(domain); + QVERIFY(u.isValid()); + QCOMPARE(u.host(), unicode + suffix); + QCOMPARE(u.host(QUrl::EncodeUnicode), toace + suffix); + QCOMPARE(u.toEncoded(), "//" + toace.toLatin1() + suffix); + QCOMPARE(u.toDisplayString(), "//" + unicode + suffix); + domain = in + (suffix ? ".troll.No" : ""); QCOMPARE(QString::fromLatin1(QUrl::toAce(domain)), toace + suffix); if (fromace != ".") -- cgit v1.2.3 From 2d1a115f9fe40edad2065513d8d839c405ad062d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tony=20Saraj=C3=A4rvi?= Date: Mon, 24 Apr 2017 23:00:53 +0300 Subject: Blacklist tst_MacGui autotest in macOS 10.11 Task-number: QTBUG-60385 Change-Id: I6e692ff55d26b9070343d612e2f872091d5c343d Reviewed-by: Jake Petroules --- tests/auto/other/macgui/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 tests/auto/other/macgui/BLACKLIST (limited to 'tests/auto') diff --git a/tests/auto/other/macgui/BLACKLIST b/tests/auto/other/macgui/BLACKLIST new file mode 100644 index 0000000000..2b4bcafe80 --- /dev/null +++ b/tests/auto/other/macgui/BLACKLIST @@ -0,0 +1,2 @@ +[nonModalOrder] +osx-10.11 -- cgit v1.2.3 From 9e2c6899e0a07edf525945a182d2537086441268 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 23 Apr 2017 23:03:58 -0300 Subject: QUrl: fix IDN conversion when the ACE form is invalid We guarded against the Unicode form being invalid and did not produce an encoded form. But we did not guard against proper Punycode sequences that decode to forms that had not passed the proper Nameprep stage. So check for that and, if it fails, just keep the label in the form we found it in (it's valid STD3 anyway). [ChangeLog][QtCore][QUrl] Fixed a bug that caused certain domain names that look like Internationalized Domain Names to become corrupt in decoded forms of QUrl, notably toString() and toDisplayString(). Task-number: QTBUG-60364 Change-Id: Iadfecb6f28984634979dfffd14b833142cca8d0d Reviewed-by: Lars Knoll --- .../corelib/io/qurlinternal/tst_qurlinternal.cpp | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp index 766338e4f8..bcf6d6c32b 100644 --- a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp +++ b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp @@ -650,6 +650,31 @@ void tst_QUrlInternal::ace_testsuite_data() << "xn--djrptm67aikb.xn--kpry57d" << "." << taiwaneseIDN; + + // violations / invalids + QTest::newRow("invalid-punycode") << "xn--z" << "xn--z" << "xn--z" << "xn--z"; + + // U+00A0 NO-BREAK SPACE encodes to Punycode "6a" + // but it is prohibited and should have caused encoding failure + QTest::newRow("invalid-nameprep-prohibited") << "xn--6a" << "xn--6a" << "xn--6a" << "xn--6a"; + + // U+00AD SOFT HYPHEN between "a" and "b" encodes to Punycode "ab-5da" + // but it should have been removed in the nameprep stage + QTest::newRow("invalid-nameprep-maptonothing") << "xn-ab-5da" << "xn-ab-5da" << "xn-ab-5da" << "xn-ab-5da"; + + // U+00C1 LATIN CAPITAL LETTER A WITH ACUTE encodes to Punycode "4ba" + // but it should have nameprepped to lowercase first + QTest::newRow("invalid-nameprep-uppercase") << "xn--4ba" << "xn--4ba" << "xn--4ba" << "xn--4ba"; + + // U+00B5 MICRO SIGN encodes to Punycode "sba" + // but is should have nameprepped to NFKC U+03BC GREEK SMALL LETTER MU + QTest::newRow("invalid-nameprep-nonnfkc") << "xn--sba" << "xn--sba" << "xn--sba" << "xn--sba"; + + // U+04CF CYRILLIC SMALL LETTER PALOCHKA encodes to "s5a" + // but it's not in RFC 3454's allowed character list (Unicode 3.2) + QTest::newRow("invalid-nameprep-unassigned") << "xn--s5a" << "xn--s5a" << "xn--s5a" << "xn--s5a"; + // same character, see QTBUG-60364 + QTest::newRow("invalid-nameprep-unassigned2") << "xn--80ak6aa92e" << "xn--80ak6aa92e" << "xn--80ak6aa92e" << "xn--80ak6aa92e"; } void tst_QUrlInternal::ace_testsuite() -- cgit v1.2.3 From ba21e424638404ce663966c7f5dff8c405ecd3f2 Mon Sep 17 00:00:00 2001 From: Sami Nurmenniemi Date: Fri, 31 Mar 2017 12:45:29 +0300 Subject: Fix tst_QWidget for platform "offscreen" Some features are not implemented by "offscreen" platform. Skip tests failing because of that. Some failing cases are also already skipped or blacklisted on "xcb" platform. Change-Id: I17269169379c270bd7d6f2ddda03ad9b114a71ce Reviewed-by: Teemu Holappa --- tests/auto/widgets/kernel/qwidget/BLACKLIST | 1 + tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'tests/auto') 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 ace2013740..e68f0f57ef 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -2179,6 +2179,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 { @@ -3235,6 +3237,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); @@ -3651,7 +3656,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); @@ -6796,6 +6801,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. @@ -7386,6 +7394,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 -- cgit v1.2.3 From 9b52cfd64c089901b2e3fa0a19d6f342adad6025 Mon Sep 17 00:00:00 2001 From: Sami Nurmenniemi Date: Wed, 29 Mar 2017 14:19:57 +0300 Subject: Fix tst_QWindow modal dialog tests for offscreen and minimal platforms Changed testing of focus of modal dialogs to match behavior on offscreen and minimal platforms. Change-Id: Ife3ea41b4b78df2e64c8d8e740332914b1e5a67c Reviewed-by: Teemu Holappa --- tests/auto/gui/kernel/qwindow/tst_qwindow.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index 36ec28de8d..0196c7d72c 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -1852,6 +1852,14 @@ void tst_QWindow::modalDialog() QGuiApplication::sync(); QGuiApplication::processEvents(); + + if (!QGuiApplication::platformName().compare(QLatin1String("offscreen"), Qt::CaseInsensitive) + || !QGuiApplication::platformName().compare(QLatin1String("minimal"), Qt::CaseInsensitive)) { + QWARN("Focus stays in normalWindow on offscreen/minimal platforms"); + QTRY_COMPARE(QGuiApplication::focusWindow(), &normalWindow); + return; + } + QTRY_COMPARE(QGuiApplication::focusWindow(), &dialog); } @@ -1890,6 +1898,14 @@ void tst_QWindow::modalDialogClosingOneOfTwoModal() QGuiApplication::sync(); QGuiApplication::processEvents(); + + if (!QGuiApplication::platformName().compare(QLatin1String("offscreen"), Qt::CaseInsensitive) + || !QGuiApplication::platformName().compare(QLatin1String("minimal"), Qt::CaseInsensitive)) { + QWARN("Focus is lost when closing modal dialog on offscreen/minimal platforms"); + QTRY_COMPARE(QGuiApplication::focusWindow(), nullptr); + return; + } + QTRY_COMPARE(QGuiApplication::focusWindow(), &first_dialog); } -- cgit v1.2.3 From a1e94bcfbb7b2814340f481b632ebab224eddda5 Mon Sep 17 00:00:00 2001 From: Sami Nurmenniemi Date: Tue, 18 Apr 2017 13:29:04 +0300 Subject: Fix tests that assume system files are owned by root for qemu If QEMU is provided sysroot with QEMU_LD_PREFIX, it opens files from there. If their owner is the current user, testing their access rights based on assumption that they are root fails. Skip the tests in that case similarly as is already done when the tests are run as root. This fixes following tests: - tst_QTemporaryDir::nonWritableCurrentDir - tst_QNetworkReply::getErrors(file-permissions) - tst_qstandardpaths::testCustomRuntimeDirectory Task-number: QTBUG-59966 Change-Id: I972ce37b4b5a7747cdd732a8e4a737ef09cbc6a5 Reviewed-by: Teemu Holappa Reviewed-by: Thiago Macieira --- .../corelib/io/qstandardpaths/qstandardpaths.pro | 2 ++ .../corelib/io/qstandardpaths/tst_qstandardpaths.cpp | 16 ++++++++++++++-- .../auto/corelib/io/qtemporarydir/qtemporarydir.pro | 2 ++ .../corelib/io/qtemporarydir/tst_qtemporarydir.cpp | 8 ++++++++ .../auto/network/access/qnetworkreply/test/test.pro | 2 ++ .../access/qnetworkreply/tst_qnetworkreply.cpp | 20 ++++++++++++++++++-- 6 files changed, 46 insertions(+), 4 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro b/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro index c72d9e4fad..9fd7047405 100644 --- a/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro +++ b/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro @@ -1,5 +1,7 @@ CONFIG += testcase TARGET = tst_qstandardpaths QT = core testlib +INCLUDEPATH += ../../../../shared/ +HEADERS += ../../../../shared/emulationdetector.h SOURCES = tst_qstandardpaths.cpp TESTDATA += tst_qstandardpaths.cpp qstandardpaths.pro diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp index 0a00e00d83..3de777653e 100644 --- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp +++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp @@ -46,6 +46,8 @@ #define Q_XDG_PLATFORM #endif +#include "emulationdetector.h" + // Update this when adding new enum values; update enumNames too static const int MaxStandardLocation = QStandardPaths::AppConfigLocation; @@ -485,14 +487,24 @@ void tst_qstandardpaths::testCustomRuntimeDirectory() EnvVarRestorer restorer; // When $XDG_RUNTIME_DIR points to a directory with wrong ownership, QStandardPaths should warn - qputenv("XDG_RUNTIME_DIR", QFile::encodeName("/tmp")); + QByteArray rootOwnedFileName = "/tmp"; + if (EmulationDetector::isRunningArmOnX86()) { + // Directory "tmp" under toolchain sysroot is detected by qemu and has same uid as current user. + // Try /opt instead, it might not be located in the sysroot. + QFileInfo rootOwnedFile = QFileInfo(QString::fromLatin1(rootOwnedFileName)); + if (rootOwnedFile.ownerId() == ::geteuid()) { + rootOwnedFileName = "/opt"; + } + } + qputenv("XDG_RUNTIME_DIR", QFile::encodeName(rootOwnedFileName)); + // It's very unlikely that /tmp is 0600 or that we can chmod it // The call below outputs // "QStandardPaths: wrong ownership on runtime directory /tmp, 0 instead of $UID" // but we can't reliably expect that it's owned by uid 0, I think. const uid_t uid = geteuid(); QTest::ignoreMessage(QtWarningMsg, - qPrintable(QString::fromLatin1("QStandardPaths: wrong ownership on runtime directory /tmp, 0 instead of %1").arg(uid))); + qPrintable(QString::fromLatin1("QStandardPaths: wrong ownership on runtime directory " + rootOwnedFileName + ", 0 instead of %1").arg(uid))); const QString runtimeDir = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation); QVERIFY2(runtimeDir.isEmpty(), qPrintable(runtimeDir)); diff --git a/tests/auto/corelib/io/qtemporarydir/qtemporarydir.pro b/tests/auto/corelib/io/qtemporarydir/qtemporarydir.pro index 4a69971f78..351e263093 100644 --- a/tests/auto/corelib/io/qtemporarydir/qtemporarydir.pro +++ b/tests/auto/corelib/io/qtemporarydir/qtemporarydir.pro @@ -1,5 +1,7 @@ CONFIG += testcase TARGET = tst_qtemporarydir SOURCES += tst_qtemporarydir.cpp +INCLUDEPATH += ../../../../shared/ +HEADERS += ../../../../shared/emulationdetector.h QT = core testlib diff --git a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp index 758bbead84..4bed8d0fd6 100644 --- a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp +++ b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp @@ -42,6 +42,7 @@ # include # include #endif +#include "emulationdetector.h" class tst_QTemporaryDir : public QObject { @@ -316,6 +317,13 @@ void tst_QTemporaryDir::nonWritableCurrentDir() const QFileInfo nonWritableDirFi = QFileInfo(QLatin1String(nonWritableDir)); QVERIFY(nonWritableDirFi.isDir()); + + if (EmulationDetector::isRunningArmOnX86()) { + if (nonWritableDirFi.ownerId() == ::geteuid()) { + QSKIP("Sysroot directories are owned by the current user"); + } + } + QVERIFY(!nonWritableDirFi.isWritable()); ChdirOnReturn cor(QDir::currentPath()); diff --git a/tests/auto/network/access/qnetworkreply/test/test.pro b/tests/auto/network/access/qnetworkreply/test/test.pro index 8aeec88fd2..0dcf5a250c 100644 --- a/tests/auto/network/access/qnetworkreply/test/test.pro +++ b/tests/auto/network/access/qnetworkreply/test/test.pro @@ -1,6 +1,8 @@ CONFIG += testcase testcase.timeout = 600 # this test is slow CONFIG -= debug_and_release_target +INCLUDEPATH += ../../../../../shared/ +HEADERS += ../../../../../shared/emulationdetector.h SOURCES += ../tst_qnetworkreply.cpp TARGET = ../tst_qnetworkreply diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index fbd8f5a780..855b1f9041 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -96,6 +96,8 @@ Q_DECLARE_METATYPE(QAuthenticator*) Q_DECLARE_METATYPE(QNetworkProxyQuery) #endif +#include "emulationdetector.h" + typedef QSharedPointer QNetworkReplyPtr; class MyCookieJar; @@ -135,6 +137,7 @@ class tst_QNetworkReply: public QObject } static const QByteArray httpEmpty200Response; + static const QString filePermissionFileName; QEventLoop *loop; enum RunSimpleRequestReturn { Timeout = 0, Success, Failure }; @@ -499,6 +502,8 @@ private: const QByteArray tst_QNetworkReply::httpEmpty200Response = "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"; +const QString tst_QNetworkReply::filePermissionFileName = "/etc/shadow"; + bool tst_QNetworkReply::seedCreated = false; #define RUN_REQUEST(call) \ @@ -1915,8 +1920,10 @@ void tst_QNetworkReply::getErrors_data() QTest::newRow("file-is-wronly") << QUrl::fromLocalFile(wronlyFileName).toString() << int(QNetworkReply::ContentAccessDenied) << 0 << true; #endif - if (QFile::exists("/etc/shadow")) - QTest::newRow("file-permissions") << "file:/etc/shadow" + + + if (QFile::exists(filePermissionFileName)) + QTest::newRow("file-permissions") << "file:" + filePermissionFileName << int(QNetworkReply::ContentAccessDenied) << 0 << true; // ftp: errors @@ -1952,6 +1959,15 @@ void tst_QNetworkReply::getErrors() (qstrcmp(QTest::currentDataTag(), "file-permissions") == 0)) { if (::getuid() == 0) QSKIP("Running this test as root doesn't make sense"); + + } + + if (EmulationDetector::isRunningArmOnX86() + && qstrcmp(QTest::currentDataTag(), "file-permissions") == 0) { + QFileInfo filePermissionFile = QFileInfo(filePermissionFileName.toLatin1()); + if (filePermissionFile.ownerId() == ::geteuid()) { + QSKIP("Sysroot directories are owned by the current user"); + } } #endif -- cgit v1.2.3 From e5a1c7fff7b17a149ad5bea9f7e3694382e7674b Mon Sep 17 00:00:00 2001 From: Sami Nurmenniemi Date: Mon, 3 Apr 2017 15:37:16 +0300 Subject: Fix tst_QLineEdit for offscreen and minimal platforms Unselecting with offscreen and minimal platforms behave similarly as in Windows and QNX. If left or right key is used for unselecting, cursor position is changed. Change-Id: I022cd2fec80ad1875fec983e1e3536a105e18bb2 Reviewed-by: Teemu Holappa --- .../widgets/widgets/qlineedit/tst_qlineedit.cpp | 38 +++++++++++++++------- 1 file changed, 27 insertions(+), 11 deletions(-) (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 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" -- cgit v1.2.3 From 5218a80bd1273d37c251a0f46a9ec711989baa5b Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Fri, 31 Mar 2017 11:45:41 +0000 Subject: Revert "tst_qsslsocket::protocolServeSide - fix for macOS 10.11" The fix is outdated - the tests it was fixing - pass on 10.11. Change-Id: I8b42c1d3d2f1279382b15c20587dcc93cf1b6b40 Reviewed-by: Timur Pocheptsov Reviewed-by: Edward Welbourne --- tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index f9ca119d1b..8a8522760c 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -29,7 +29,6 @@ #include #include -#include #include #include #include @@ -1167,19 +1166,6 @@ void tst_QSslSocket::protocolServerSide_data() QTest::addColumn("clientProtocol"); QTest::addColumn("works"); - // On macOS 10.11 with SecureTransport backend some tests are failing for no - // obvious reason (so no bug in our code): QTBUG-48860 - an error can be - // errSSLInternal or cipher negotiation failure. This problem does not exist - // on macOS before 10.11 and after 10.11, so we adjust these tests only for 10.11. - -#if defined(QT_SECURETRANSPORT) - using OSVersion = QOperatingSystemVersion; - const bool testWorks = OSVersion::current() < OSVersion::OSXElCapitan - || OSVersion::current() > OSVersion::OSXElCapitan; -#else - const bool testWorks = true; -#endif - #if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) QTest::newRow("ssl2-ssl2") << QSsl::SslV2 << QSsl::SslV2 << false; // no idea why it does not work, but we don't care about SSL 2 #endif @@ -1204,14 +1190,14 @@ void tst_QSslSocket::protocolServerSide_data() #endif #if !defined(OPENSSL_NO_SSL3) QTest::newRow("ssl3-tls1.0") << QSsl::SslV3 << QSsl::TlsV1_0 << false; - QTest::newRow("ssl3-tls1ssl3") << QSsl::SslV3 << QSsl::TlsV1SslV3 << testWorks; + QTest::newRow("ssl3-tls1ssl3") << QSsl::SslV3 << QSsl::TlsV1SslV3 << true; QTest::newRow("ssl3-secure") << QSsl::SslV3 << QSsl::SecureProtocols << false; #endif #if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) && !defined(OPENSSL_NO_SSL3) QTest::newRow("ssl3-any") << QSsl::SslV3 << QSsl::AnyProtocol << false; // we won't set a SNI header here because we connect to a // numerical IP, so OpenSSL will send a SSL 2 handshake #elif !defined(OPENSSL_NO_SSL3) - QTest::newRow("ssl3-any") << QSsl::SslV3 << QSsl::AnyProtocol << testWorks; + QTest::newRow("ssl3-any") << QSsl::SslV3 << QSsl::AnyProtocol << true; #endif #if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) -- cgit v1.2.3 From 445191bba8216276e6200157906ca9d138d7be04 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 25 Apr 2017 16:54:29 -0700 Subject: QMenu: Display the menu title on the torn-off menu's title bar Change-Id: If16e262a6c8b39dff517cc105cf55686d4c22582 Task-number: QTBUG-11693 Reviewed-by: Shawn Rutledge --- tests/auto/widgets/widgets/qmenu/qmenu.pro | 2 +- tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'tests/auto') 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 e5e2e157c5..f0fb7bc367 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -46,6 +46,8 @@ #include #include +#include + Q_DECLARE_METATYPE(Qt::Key); Q_DECLARE_METATYPE(Qt::KeyboardModifiers); @@ -622,6 +624,7 @@ void tst_QMenu::tearOff() QScopedPointer 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()); @@ -644,6 +647,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()); -- cgit v1.2.3 From b6968f508c36c650c9965f1747beae8fa6b237c5 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Thu, 27 Apr 2017 11:32:16 +0000 Subject: Revert "Blacklist tst_QSslSocket::protocolServerSide on OS X 10.11" This reverts commit 96c27f0dfa72f7800c85af10c00e0dababdc3fbf. We now use a custom keychain that should fix the original problem with the test. Change-Id: I52e4105f34a46ad7080750d9a62480ebe3a56e68 Reviewed-by: Edward Welbourne --- tests/auto/network/ssl/qsslsocket/BLACKLIST | 2 -- 1 file changed, 2 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/network/ssl/qsslsocket/BLACKLIST b/tests/auto/network/ssl/qsslsocket/BLACKLIST index cfab0b7eb0..52c023b78f 100644 --- a/tests/auto/network/ssl/qsslsocket/BLACKLIST +++ b/tests/auto/network/ssl/qsslsocket/BLACKLIST @@ -5,5 +5,3 @@ windows rhel-7.2 [protocolServerSide:tls1.0-any] rhel-7.2 -[protocolServerSide] -osx-10.11 -- cgit v1.2.3 From 82c06fb0f545f379e088cf24929fcf954686c5c2 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 12 Apr 2017 15:25:40 +0200 Subject: Fix return of empty paths with multiple points on intersections The intersection algorithm for intersection with rects, might return one edge of the rect even if that edge does not intersect with the path. To deal with that we collapse paths with empty bounding rects to the empty path. Task-number: QTBUG-60024 Change-Id: I3e305983c66548e772d7d7ce3de99d715edbdd1b Reviewed-by: Eirik Aavitsland --- .../gui/painting/qpathclipper/tst_qpathclipper.cpp | 255 +++++++++++++++++++++ 1 file changed, 255 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp b/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp index e3f8f0fbac..14ba9c5c84 100644 --- a/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp +++ b/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp @@ -84,6 +84,7 @@ private slots: void task251909(); void qtbug3778(); + void qtbug60024(); }; Q_DECLARE_METATYPE(QPainterPath) @@ -1293,6 +1294,260 @@ void tst_QPathClipper::qtbug3778() QVERIFY(p12.contains(QPointF(100, 100))); } +void tst_QPathClipper::qtbug60024() +{ + QPolygonF poly1, poly2; + poly1 << QPointF(508.331,1010.23) ; + poly1 << QPointF(492.798,1023.11) ; + poly1 << QPointF(491.431,1024.23) ; + poly1 << QPointF(491.928,1022.94) ; + poly1 << QPointF(492.054,1022.15) ; + poly1 << QPointF(492.136,1020.91) ; + poly1 << QPointF(491.638,1019.2) ; + poly1 << QPointF(490.436,1017.12) ; + poly1 << QPointF(489.856,1016.46) ; + poly1 << QPointF(489.276,1016.08) ; + poly1 << QPointF(488.16,1015.54) ; + poly1 << QPointF(487.33,1014.91) ; + poly1 << QPointF(486.914,1014.16) ; + poly1 << QPointF(486.875,1013.54) ; + poly1 << QPointF(487.204,1012.38) ; + poly1 << QPointF(487.412,1011.34) ; + poly1 << QPointF(487.373,1009.92) ; + poly1 << QPointF(487.702,1007.34) ; + poly1 << QPointF(487.909,1006.3) ; + poly1 << QPointF(488.242,1005.55) ; + poly1 << QPointF(488.74,1004.14) ; + poly1 << QPointF(489.445,1003.14) ; + poly1 << QPointF(490.107,1001.56) ; + poly1 << QPointF(490.064,1000.98) ; + poly1 << QPointF(489.566,999.936) ; + poly1 << QPointF(488.489,998.194) ; + poly1 << QPointF(488.117,997.274) ; + poly1 << QPointF(487.909,995.946) ; + poly1 << QPointF(487.909,995.027) ; + poly1 << QPointF(488.117,993.16) ; + poly1 << QPointF(488.658,989.749) ; + poly1 << QPointF(488.861,987.002) ; + poly1 << QPointF(489.359,976.434) ; + poly1 << QPointF(489.484,974.476) ; + poly1 << QPointF(489.484,972.859) ; + poly1 << QPointF(489.359,971.775) ; + poly1 << QPointF(489.151,970.986) ; + poly1 << QPointF(488.948,969.323) ; + poly1 << QPointF(488.74,966.036) ; + poly1 << QPointF(488.74,964.118) ; + poly1 << QPointF(489.03,961.292) ; + poly1 << QPointF(489.237,960.667) ; + poly1 << QPointF(489.648,960.043) ; + poly1 << QPointF(490.452,959.229) ; + poly1 << QPointF(491.528,958.225) ; + poly1 << QPointF(491.731,957.515) ; + poly1 << QPointF(491.32,956.812) ; + poly1 << QPointF(490.45,955.852) ; + poly1 << QPointF(489.412,954.354) ; + poly1 << QPointF(488.68,952.934) ; + poly1 << QPointF(488.625,951.201) ; + poly1 << QPointF(488.954,950.072) ; + poly1 << QPointF(489.237,949.225) ; + poly1 << QPointF(489.256,948.668) ; + poly1 << QPointF(489.402,948.186) ; + poly1 << QPointF(489.566,947.437) ; + poly1 << QPointF(490.025,945.899) ; + poly1 << QPointF(490.687,944.026) ; + poly1 << QPointF(491.059,942.073) ; + poly1 << QPointF(491.31,941.159) ; + poly1 << QPointF(491.846,937.248) ; + poly1 << QPointF(492.054,936.374) ; + poly1 << QPointF(492.594,935.29) ; + poly1 << QPointF(492.594,935.086) ; + poly1 << QPointF(492.261,934.416) ; + poly1 << QPointF(492.054,933.377) ; + poly1 << QPointF(492.054,932.628) ; + poly1 << QPointF(492.798,929.217) ; + poly1 << QPointF(493.174,928.217) ; + poly1 << QPointF(493.005,927.514) ; + poly1 << QPointF(492.923,926.719) ; + poly1 << QPointF(493.295,921.44) ; + poly1 << QPointF(493.421,919.771) ; + poly1 << QPointF(493.628,914.492) ; + poly1 << QPointF(493.71,913.158) ; + poly1 << QPointF(493.961,910.831) ; + poly1 << QPointF(494.623,909.247) ; + poly1 << QPointF(495.41,906.085) ; + poly1 << QPointF(495.203,905.421) ; + poly1 << QPointF(494.788,904.632) ; + poly1 << QPointF(494.705,904.297) ; + poly1 << QPointF(494.788,903.797) ; + poly1 << QPointF(495.121,902.844) ; + poly1 << QPointF(495.493,902.055) ; + poly1 << QPointF(496.033,900.556) ; + poly1 << QPointF(496.28,900.096) ; + poly1 << QPointF(496.488,899.222) ; + poly1 << QPointF(496.28,898.723) ; + poly1 << QPointF(495.41,898.098) ; + poly1 << QPointF(494.326,898.084) ; + poly1 << QPointF(493.993,897.42) ; + poly1 << QPointF(493.829,896.67) ; + poly1 << QPointF(493.621,894.962) ; + poly1 << QPointF(493.565,893.93) ; + poly1 << QPointF(494.416,893.358) ; + poly1 << QPointF(501.666,887.435) ; + poly1 << QPointF(513.305,877.908) ; + poly1 << QPointF(523.795,869.356) ; + poly1 << QPointF(603.378,804.221) ; + poly1 << QPointF(618.764,791.762) ; + poly1 << QPointF(618.981,791.584) ; + poly1 << QPointF(634.696,778.743) ; + poly1 << QPointF(673.531,747.007) ; + poly1 << QPointF(726.115,704.031) ; + poly1 << QPointF(759.04,677.12) ; + poly1 << QPointF(759.672,676.62) ; + poly1 << QPointF(778.846,660.773) ; + poly1 << QPointF(789.919,651.709) ; + poly1 << QPointF(810.528,634.696) ; + poly1 << QPointF(810.804,634.468) ; + poly1 << QPointF(818.197,628.365) ; + poly1 << QPointF(826.44,621.505) ; + poly1 << QPointF(832.634,616.351) ; + poly1 << QPointF(835.337,614.05) ; + poly1 << QPointF(835.492,613.931) ; + poly1 << QPointF(852.079,600.176) ; + poly1 << QPointF(860.469,593.219) ; + poly1 << QPointF(869.883,585.411) ; + poly1 << QPointF(896.749,563.131) ; + poly1 << QPointF(922.094,542.111) ; + poly1 << QPointF(936.469,530.189) ; + poly1 << QPointF(990.034,485.759) ; + poly1 << QPointF(1001.65,476.123) ; + poly1 << QPointF(1010.87,468.472) ; + poly1 << QPointF(1028.6,453.769) ; + poly1 << QPointF(1095.89,397.341) ; + poly1 << QPointF(1130.52,368.297) ; + poly1 << QPointF(1135.05,364.497) ; + poly1 << QPointF(1123.55,337.582) ; + poly1 << QPointF(1103.42,290.476) ; + poly1 << QPointF(1095.21,271.259) ; + poly1 << QPointF(1068.04,207.66) ; + poly1 << QPointF(1051.62,169.118) ; + poly1 << QPointF(1038.65,138.708) ; + poly1 << QPointF(1027.81,113.269) ; + poly1 << QPointF(1020.97,97.2145) ; + poly1 << QPointF(1010.84,73.4644) ; + poly1 << QPointF(988.424,20.9198) ; + poly1 << QPointF(968.442,-25.9307) ; + poly1 << QPointF(964.63,-34.8693) ; + poly1 << QPointF(961.883,-41.3111) ; + poly1 << QPointF(953.157,-61.929) ; + poly1 << QPointF(949.712,-70.0717) ; + poly1 << QPointF(946.048,-78.7331) ; + poly1 << QPointF(945.789,-79.3443) ; + poly1 << QPointF(945.548,-79.9146) ; + poly1 << QPointF(941.671,-89.0782) ; + poly1 << QPointF(940.408,-92.0616) ; + poly1 << QPointF(940.095,-92.8021) ; + poly1 << QPointF(938.65,-97.1094) ; + poly1 << QPointF(934.565,-106.581) ; + poly1 << QPointF(928.429,-121.542) ; + poly1 << QPointF(928.24,-122.003) ; + poly1 << QPointF(920.902,-139.241) ; + poly1 << QPointF(910.85,-162.115) ; + poly1 << QPointF(910.744,-162.357) ; + poly1 << QPointF(900.875,-186.271) ; + poly1 << QPointF(889.416,-213.089) ; + poly1 << QPointF(883.705,-226.225) ; + poly1 << QPointF(882.788,-228.422) ; + poly1 << QPointF(881.399,-231.753) ; + poly1 << QPointF(880.373,-234.213) ; + poly1 << QPointF(875.788,-245.204) ; + poly1 << QPointF(872.772,-252.085) ; + poly1 << QPointF(869.686,-259.126) ; + poly1 << QPointF(865.607,-268.43) ; + poly1 << QPointF(868.74,-269.605) ; + poly1 << QPointF(869.315,-269.834) ; + poly1 << QPointF(879.443,-273.853) ; + poly1 << QPointF(880.259,-274.217) ; + poly1 << QPointF(888.958,-278.09) ; + poly1 << QPointF(894.204,-280.426) ; + poly1 << QPointF(902.866,-284.423) ; + poly1 << QPointF(913.804,-289.072) ; + poly1 << QPointF(917.975,-290.846) ; + poly1 << QPointF(921.854,-292.375) ; + poly1 << QPointF(930.52,-295.793) ; + poly1 << QPointF(939.972,-299.79) ; + poly1 << QPointF(940.899,-300.183) ; + poly1 << QPointF(943.262,-294.709) ; + poly1 << QPointF(946.922,-286.233) ; + poly1 << QPointF(952.358,-273.643) ; + poly1 << QPointF(959.976,-256) ; + poly1 << QPointF(975.219,-220.296) ; + poly1 << QPointF(988.991,-188.494) ; + poly1 << QPointF(990.089,-185.959) ; + poly1 << QPointF(1001.86,-158.88) ; + poly1 << QPointF(1003.8,-154.245) ; + poly1 << QPointF(1011.55,-135.749) ; + poly1 << QPointF(1012.2,-134.199) ; + poly1 << QPointF(1012.77,-132.837) ; + poly1 << QPointF(1015.9,-125.529) ; + poly1 << QPointF(1015.99,-125.305) ; + poly1 << QPointF(1016.42,-124.299) ; + poly1 << QPointF(1018.02,-120.569) ; + poly1 << QPointF(1018.47,-119.395) ; + poly1 << QPointF(1028.09,-97.0593) ; + poly1 << QPointF(1028.89,-95.1902) ; + poly1 << QPointF(1032.85,-85.957) ; + poly1 << QPointF(1044.48,-58.8103) ; + poly1 << QPointF(1047.23,-52.3933) ; + poly1 << QPointF(1076.35,15.5527) ; + poly1 << QPointF(1089.43,46.0648) ; + poly1 << QPointF(1105.35,83.1913) ; + poly1 << QPointF(1120.01,117.391) ; + poly1 << QPointF(1131.66,144.66) ; + poly1 << QPointF(1142.1,169.072) ; + poly1 << QPointF(1183.42,265.698) ; + poly1 << QPointF(1200.9,306.583) ; + poly1 << QPointF(1208.48,324.306) ; + poly1 << QPointF(1231.19,377.389) ; + poly1 << QPointF(1241.55,400.064) ; + poly1 << QPointF(1139.56,485.759) ; + poly1 << QPointF(1104.96,514.822) ; + poly1 << QPointF(1044.32,565.761) ; + poly1 << QPointF(1020.92,585.411) ; + poly1 << QPointF(1013.72,591.462) ; + poly1 << QPointF(1012.73,592.285) ; + poly1 << QPointF(926.449,663.776) ; + poly1 << QPointF(843.981,732.099) ; + poly1 << QPointF(826.923,746.23) ; + poly1 << QPointF(810.856,759.539) ; + poly1 << QPointF(736.788,820.887) ; + poly1 << QPointF(709.695,843.348) ; + poly1 << QPointF(693.265,856.967) ; + poly1 << QPointF(690.228,859.484) ; + poly1 << QPointF(673.813,873.091) ; + poly1 << QPointF(672.34,874.317) ; + poly1 << QPointF(618.453,919.164) ; + poly1 << QPointF(607.821,928.011) ; + poly1 << QPointF(596.057,937.538) ; + poly1 << QPointF(580.774,950.204) ; + poly1 << QPointF(573.229,956.457) ; + poly1 << QPointF(533.091,989.719) ; + poly1 << QPointF(513.657,1005.86) ; + poly1 << QPointF(508.331,1010.23) ; + + poly2 << QPointF(941.306,435.236) ; + poly2 << QPointF(983.306,435.236) ; + poly2 << QPointF(983.306,473.236) ; + poly2 << QPointF(941.306,473.236) ; + poly2 << QPointF(941.306,435.236) ; + + QPainterPath path1, path2; + path1.addPolygon(poly1); + path2.addPolygon(poly2); + + QVERIFY(!path1.intersects(path2)); + QVERIFY(path1.intersected(path2).isEmpty()); +} + QTEST_MAIN(tst_QPathClipper) -- cgit v1.2.3 From cf0c44fe832c4222d9917c382831c7b8d6c00b69 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 27 Apr 2017 16:33:54 -0300 Subject: Fix test build with ICC: QFlags does not auto cast to uint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I don't know why. tst_qflags.cpp(114): error: no instance of function template "verifyConstExpr" matches the argument list argument types are: (Qt::MouseButton) tst_qflags.cpp(91): note: this candidate was rejected because there is a type mismatch after argument substitution Change-Id: I84e363d735b443cb9beefffd14b9581d77933cb8 Reviewed-by: Tony Sarajärvi --- tests/auto/corelib/global/qflags/tst_qflags.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/global/qflags/tst_qflags.cpp b/tests/auto/corelib/global/qflags/tst_qflags.cpp index d70b099fe3..7dd1a1be01 100644 --- a/tests/auto/corelib/global/qflags/tst_qflags.cpp +++ b/tests/auto/corelib/global/qflags/tst_qflags.cpp @@ -111,19 +111,19 @@ void tst_QFlags::constExpr() default: QVERIFY(false); } - QVERIFY(verifyConstExpr<(Qt::LeftButton | Qt::RightButton) & Qt::LeftButton>(Qt::LeftButton)); - QVERIFY(verifyConstExpr<(Qt::LeftButton | Qt::RightButton) & Qt::MiddleButton>(0)); - QVERIFY(verifyConstExpr<(Qt::LeftButton | Qt::RightButton) | Qt::MiddleButton>(Qt::LeftButton | Qt::RightButton | Qt::MiddleButton)); - QVERIFY(verifyConstExpr<~(Qt::LeftButton | Qt::RightButton)>(~(Qt::LeftButton | Qt::RightButton))); - QVERIFY(verifyConstExpr(Qt::LeftButton ^ Qt::RightButton)); - QVERIFY(verifyConstExpr(0)); - QVERIFY(verifyConstExpr(Qt::RightButton)); - QVERIFY(verifyConstExpr(0xff)); + QVERIFY(verifyConstExpr(Qt::LeftButton)); + QVERIFY(verifyConstExpr(0)); + QVERIFY(verifyConstExpr(Qt::LeftButton | Qt::RightButton | Qt::MiddleButton)); + QVERIFY(verifyConstExpr(~(Qt::LeftButton | Qt::RightButton))); + QVERIFY(verifyConstExpr(Qt::LeftButton ^ Qt::RightButton)); + QVERIFY(verifyConstExpr(0)); + QVERIFY(verifyConstExpr(Qt::RightButton)); + QVERIFY(verifyConstExpr(0xff)); QVERIFY(!verifyConstExpr(!Qt::MouseButtons(Qt::LeftButton))); #if defined(__cpp_constexpr) && __cpp_constexpr-0 >= 201304 - QVERIFY(verifyConstExpr(Qt::MiddleButton)); + QVERIFY(verifyConstExpr(Qt::MiddleButton)); #endif #endif } -- cgit v1.2.3 From 425986acf32a60288a8a2ed9b3b2b180f60b5514 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 28 Apr 2017 23:24:57 +0200 Subject: Windows: Fix tst_QFileDialog2::completionOnLevelAfterRoot() Change the check for the unambiguous match to be case insensitive. Task-number: QTBUG-60466 Change-Id: Iaa019cc803a56b015f45309fb1b3a7a8a3d82ee4 Reviewed-by: Simon Hausmann --- tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto') 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; } -- cgit v1.2.3 From 91c1b5490e63705b5418ffbae539ff70dbdfe334 Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Fri, 28 Apr 2017 18:36:04 +0300 Subject: QWindowsPipeReader: fix possible invalid invocation of ReadFileEx() If the user calls QLocalSocket::setReadBufferSize() with a value less than the current size of the pipe buffer, startAsyncRead() would call ReadFileEx() with invalid parameters: ReadFileEx(handle, nullptr, some_big_value, ...); Change-Id: I3d153e3ec34f8038dc001c1c896aeceb666a8979 Reviewed-by: Thiago Macieira --- tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index a74a056d91..60ee4eb471 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -625,6 +625,18 @@ void tst_QLocalSocket::readBufferOverflow() QCOMPARE(client.read(buffer, readBufferSize), qint64(readBufferSize)); // no more bytes available QCOMPARE(client.bytesAvailable(), 0); + +#ifdef Q_OS_WIN + // Test overflow caused by an asynchronous pipe operation. + client.setReadBufferSize(1); + serverSocket->write(buffer, 2); + + QVERIFY(client.waitForReadyRead()); + // socket disconnects, if there any error on pipe + QCOMPARE(client.state(), QLocalSocket::ConnectedState); + QCOMPARE(client.bytesAvailable(), qint64(2)); + QCOMPARE(client.read(buffer, 2), qint64(2)); +#endif } static qint64 writeCommand(const QVariant &command, QIODevice *device, int commandCounter) -- cgit v1.2.3 From 124b9a6ff89da8be83a256135ec6c4d0603e9a6f Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Sat, 21 Jan 2017 18:09:11 +0200 Subject: Improve suppression of spurious socket notifications under Windows There were still two cases where spurious notifications would be possible: - user calls hasPendingDatagrams()/pendingDatagramSize() on UDP socket somewhere outside the slot connected to readyRead() signal (::WSARecvFrom posts FD_READ notification, even if a notification for incoming datagram already exists in the message queue); - a socket was registered to receive several types of event and WM_QT_ACTIVATENOTIFIERS message is located between the different events for this socket in the queue. Provided patch ensures that the message queue is synchronized with the Qt event processing mechanism and adds a way to detect spurious notifications inside the window procedure. Task-number: QTBUG-58214 Change-Id: I49609dace601f300de09875ff1653617efabd72f Reviewed-by: Oswald Buddenhagen Reviewed-by: Lars Knoll Reviewed-by: Oliver Wolff Reviewed-by: Edward Welbourne Reviewed-by: Peter Seiderer --- tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp b/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp index 1598382959..a52b80170f 100644 --- a/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp +++ b/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp @@ -360,11 +360,16 @@ void tst_QSocketNotifier::asyncMultipleDatagram() QSignalSpy spy(m_asyncReceiver, &QIODevice::readyRead); connect(m_asyncReceiver, &QIODevice::readyRead, this, &tst_QSocketNotifier::async_readDatagramSlot); + + // activate socket notifiers + QTestEventLoop::instance().enterLoopMSecs(100); + m_asyncSender->writeDatagram("1", makeNonAny(m_asyncReceiver->localAddress()), port); m_asyncSender->writeDatagram("2", makeNonAny(m_asyncReceiver->localAddress()), port); // wait a little to ensure that the datagrams we've just sent // will be delivered on receiver side. QTest::qSleep(100); + QVERIFY(m_asyncReceiver->hasPendingDatagrams()); QTimer::singleShot(500, this, &tst_QSocketNotifier::async_writeDatagramSlot); -- cgit v1.2.3 From 46aecbd72b2e0630cc03bd51edf64179968902df Mon Sep 17 00:00:00 2001 From: Palo Kisa Date: Thu, 27 Apr 2017 10:03:53 +0200 Subject: QIconLoaderEngine: Fix actualSize() for no-entry Return an empty size if no suitable entry found to avoid mismatch with the returned pixmap()'s size (the QIconEngine::actualSize() returns the originally requested size). Change-Id: Ia278719a54392b62c5f9fc0529476baba5cd7df0 Reviewed-by: Olivier Goffart (Woboq GmbH) --- tests/auto/gui/image/qicon/tst_qicon.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/auto') diff --git a/tests/auto/gui/image/qicon/tst_qicon.cpp b/tests/auto/gui/image/qicon/tst_qicon.cpp index d628fad705..e031ffec71 100644 --- a/tests/auto/gui/image/qicon/tst_qicon.cpp +++ b/tests/auto/gui/image/qicon/tst_qicon.cpp @@ -594,6 +594,7 @@ void tst_QIcon::fromTheme() QIcon noIcon = QIcon::fromTheme("broken-icon"); QVERIFY(noIcon.isNull()); QVERIFY(!QIcon::hasThemeIcon("broken-icon")); + QCOMPARE(noIcon.actualSize(QSize(32, 32), QIcon::Normal, QIcon::On), QSize(0, 0)); // Test non existing icon with fallback noIcon = QIcon::fromTheme("broken-icon", abIcon); -- cgit v1.2.3 From d517c386b295cc81e9af1c9768c50bb7251a8cd6 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Mon, 6 Feb 2017 15:36:54 +0100 Subject: Enable tst_qaccessibilitymac The test was disabled because it was checking if we had the right permissions. It does seem as if the permissions do not matter as long as everything is in process though. As seen by the regression in fafdb171e0c317ee8f871dc7b504d3713d5860eb it's important to run the test. This regression would have been caught. Change-Id: Ia1938e683badd1de2657aa6dc8a3b3bbe430e8c8 Reviewed-by: Qt CI Bot Reviewed-by: Frederik Gladhorn --- .../other/qaccessibilitymac/tst_qaccessibilitymac.cpp | 15 --------------- .../qaccessibilitymac/tst_qaccessibilitymac_helpers.h | 2 -- .../tst_qaccessibilitymac_helpers.mm | 19 ------------------- 3 files changed, 36 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp index efa724b730..13c933aa14 100644 --- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp +++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp @@ -94,9 +94,6 @@ void tst_QAccessibilityMac::cleanup() void tst_QAccessibilityMac::singleWidgetTest() { - if (!macNativeAccessibilityEnabled()) - return; - delete m_window; m_window = 0; @@ -105,9 +102,6 @@ void tst_QAccessibilityMac::singleWidgetTest() void tst_QAccessibilityMac::lineEditTest() { - if (!macNativeAccessibilityEnabled()) - return; - QLineEdit *lineEdit = new QLineEdit(m_window); lineEdit->setText("a11y test QLineEdit"); m_window->addWidget(lineEdit); @@ -119,9 +113,6 @@ void tst_QAccessibilityMac::lineEditTest() void tst_QAccessibilityMac::hierarchyTest() { - if (!macNativeAccessibilityEnabled()) - return; - QWidget *w = new QWidget(m_window); m_window->addWidget(w); @@ -141,17 +132,11 @@ void tst_QAccessibilityMac::hierarchyTest() void tst_QAccessibilityMac::notificationsTest() { - if (!macNativeAccessibilityEnabled()) - return; - QVERIFY(notifications(m_window)); } void tst_QAccessibilityMac::checkBoxTest() { - if (!macNativeAccessibilityEnabled()) - return; - QCheckBox *cb = new QCheckBox(m_window); cb->setText("Great option"); m_window->addWidget(cb); diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h index 5f10513bb5..75b2d39a00 100644 --- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h +++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h @@ -33,8 +33,6 @@ QT_USE_NAMESPACE -bool macNativeAccessibilityEnabled(); -bool trusted(); bool testLineEdit(); bool testHierarchy(QWidget *w); bool singleWidget(); diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm index fb030aa4be..e9407fd903 100644 --- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm +++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm @@ -42,19 +42,6 @@ QT_USE_NAMESPACE -bool macNativeAccessibilityEnabled() -{ - bool enabled = AXAPIEnabled(); - if (!enabled) - qWarning() << "Accessibility is disabled (check System Preferences) skipping test."; - return enabled; -} - -bool trusted() -{ - return AXIsProcessTrusted(); -} - struct AXErrorTag { AXError err; explicit AXErrorTag(AXError theErr) : err(theErr) {} @@ -413,12 +400,6 @@ bool singleWidget() bool testLineEdit() { -// not sure if this is needed. on my machine the calls succeed. -// NSString *path = @"/Users/frederik/qt5/qtbase/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.app/Contents/MacOS/tst_qaccessibilitymac"; -// NSString *path = @"/Users/frederik/qt5/qtbase/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.app"; -// AXError e = AXMakeProcessTrusted((CFStringRef) path); -// NSLog(@"error: %i", e); - TestAXObject *appObject = [TestAXObject getApplicationAXObject]; EXPECT(appObject); -- cgit v1.2.3 From dbd55cdaf367bdc9d6774bcb9927cbe19f18065f Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Tue, 25 Apr 2017 15:58:57 +0100 Subject: QHash/QMultiHash: fix operator== The existing QHash::operator== does not work when the same keys appear in different order between the two hashes being compared. However, relying on iteration order on a QHash is (as usual) a bad idea and one should never do it. Task-number: QTBUG-60395 Change-Id: Ifb39a6779230e26bbd6fdba82ccc0247b9cdc6ed Reviewed-by: Lars Knoll --- tests/auto/corelib/tools/qhash/tst_qhash.cpp | 69 +++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 2 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp index 0c5f1a7afb..943b4316ff 100644 --- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp +++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp @@ -51,7 +51,7 @@ private slots: void contains(); // copied from tst_QMap void qhash(); void take(); // copied from tst_QMap - void operator_eq(); // copied from tst_QMap + void operator_eq(); // slightly modified from tst_QMap void rehash_isnt_quadratic(); void dont_need_default_constructor(); void qmultihash_specific(); @@ -771,7 +771,7 @@ void tst_QHash::take() QVERIFY(!map.contains(3)); } -//copied from tst_QMap +// slightly modified from tst_QMap void tst_QHash::operator_eq() { { @@ -848,6 +848,71 @@ void tst_QHash::operator_eq() QVERIFY(a != b); QVERIFY(!(a == b)); } + + // unlike multi-maps, multi-hashes should be equal iff their contents are equal, + // regardless of insertion or iteration order + + { + QHash a; + QHash b; + + a.insertMulti(0, 0); + a.insertMulti(0, 1); + + b.insertMulti(0, 1); + b.insertMulti(0, 0); + + QVERIFY(a == b); + QVERIFY(!(a != b)); + } + + { + QHash a; + QHash b; + + enum { Count = 100 }; + + for (int key = 0; key < Count; ++key) { + for (int value = 0; value < Count; ++value) + a.insertMulti(key, value); + } + + for (int key = Count - 1; key >= 0; --key) { + for (int value = 0; value < Count; ++value) + b.insertMulti(key, value); + } + + QVERIFY(a == b); + QVERIFY(!(a != b)); + } + + { + QHash a; + QHash b; + + enum { + Count = 100, + KeyStep = 17, // coprime with Count + ValueStep = 23, // coprime with Count + }; + + for (int key = 0; key < Count; ++key) { + for (int value = 0; value < Count; ++value) + a.insertMulti(key, value); + } + + // Generates two permutations of [0, Count) for the keys and values, + // so that b will be identical to a, just built in a very different order. + + for (int k = 0; k < Count; ++k) { + const int key = (k * KeyStep) % Count; + for (int v = 0; v < Count; ++v) + b.insertMulti(key, (v * ValueStep) % Count); + } + + QVERIFY(a == b); + QVERIFY(!(a != b)); + } } void tst_QHash::compare() -- cgit v1.2.3