From 555a6b5d5d2dd91a0dcf9e3d5fbadd1b31bf80f3 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 26 Sep 2018 08:56:36 +0200 Subject: Modernize the "filesystemwatcher" feature Change-Id: If030b56ad97e047d89d442629262b4839df306d4 Reviewed-by: Edward Welbourne Reviewed-by: Ulf Hermann --- tests/auto/corelib/io/io.pro | 3 +++ tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp | 6 ------ 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'tests/auto/corelib/io') diff --git a/tests/auto/corelib/io/io.pro b/tests/auto/corelib/io/io.pro index 5eab944fe4..3c93fd5e1f 100644 --- a/tests/auto/corelib/io/io.pro +++ b/tests/auto/corelib/io/io.pro @@ -55,6 +55,9 @@ SUBDIRS=\ win32:!qtConfig(private_tests): SUBDIRS -= \ qfilesystementry +!qtConfig(filesystemwatcher): SUBDIRS -= \ + qfilesystemwatcher + !qtConfig(processenvironment): SUBDIRS -= \ qprocessenvironment diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index 72cad92edb..67ffa91e57 100644 --- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -45,7 +45,6 @@ class tst_QFileSystemWatcher : public QObject public: tst_QFileSystemWatcher(); -#ifndef QT_NO_FILESYSTEMWATCHER private slots: void basicTest_data(); void basicTest(); @@ -77,24 +76,20 @@ private slots: private: QString m_tempDirPattern; -#endif // QT_NO_FILESYSTEMWATCHER }; tst_QFileSystemWatcher::tst_QFileSystemWatcher() { -#ifndef QT_NO_FILESYSTEMWATCHER m_tempDirPattern = QDir::tempPath(); if (!m_tempDirPattern.endsWith(QLatin1Char('/'))) m_tempDirPattern += QLatin1Char('/'); m_tempDirPattern += QStringLiteral("tst_qfilesystemwatcherXXXXXX"); -#endif // QT_NO_FILESYSTEMWATCHER #if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QDir::setCurrent(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)); #endif } -#ifndef QT_NO_FILESYSTEMWATCHER void tst_QFileSystemWatcher::basicTest_data() { QTest::addColumn("backend"); @@ -805,7 +800,6 @@ void tst_QFileSystemWatcher::watchUnicodeCharacters() QVERIFY(testDir.mkdir("creme")); QTRY_COMPARE(changedSpy.count(), 1); } -#endif // QT_NO_FILESYSTEMWATCHER QTEST_MAIN(tst_QFileSystemWatcher) #include "tst_qfilesystemwatcher.moc" -- cgit v1.2.3 From caa598c843eb27fd0c645e62723fd2d4e3e12f60 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 27 Sep 2018 11:56:07 -0700 Subject: Fix QUrl::matches for when removing authority parts (other than host) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QUrl::RemoveAuthority is RemoveUserInfo | RemovePort | 0x10, so the condition if (options & QUrl::RemoveAuthority) would match if any of the other bits for the username, password or port were set, which meant we would skip the host comparison. Ditto for username and RemovePassword. [ChangeLog][QtCore][QUrl] Fixed a bug that caused QUrl::matches to incorrectly compare two URLs with different hostnames or different usernames as equal, if certain QUrl::RemoveXxx options were passed. Change-Id: I015970a03b874898bba7fffd155856ab9d6cb1be Fixes: QTBUG-70774 Reviewed-by: MÃ¥rten Nordheim --- tests/auto/corelib/io/qurl/tst_qurl.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/auto/corelib/io') diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index 09aefcee91..62af907037 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -4123,6 +4123,18 @@ void tst_QUrl::matches_data() << "http://user:pass@www.website.com/directory" << "http://otheruser:otherpass@www.website.com/directory" << uint(QUrl::RemovePath | QUrl::RemoveAuthority) << true; + QTest::newRow("matchingHost-removePort") << "http://example.com" << "http://example.com" + << uint(QUrl::RemovePort) << true; + QTest::newRow("nonMatchingHost-removePort") << "http://example.com" << "http://example.net" + << uint(QUrl::RemovePort) << false; + QTest::newRow("matchingHost-removePassword") << "http://example.com" << "http://example.com" + << uint(QUrl::RemovePassword) << true; + QTest::newRow("nonMatchingHost-removePassword") << "http://example.com" << "http://example.net" + << uint(QUrl::RemovePassword) << false; + QTest::newRow("matchingUserName-removePassword") << "http://user@example.com" << "http://user@example.com" + << uint(QUrl::RemovePassword) << true; + QTest::newRow("nonMatchingUserName-removePassword") << "http://user@example.com" << "http://user2@example.com" + << uint(QUrl::RemovePassword) << false; } void tst_QUrl::matches() -- cgit v1.2.3