summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-11-24 09:09:01 +0100
committerLiang Qi <liang.qi@qt.io>2016-11-24 10:31:21 +0100
commit4783de0473a288fdff7e5354c12315ba025ec7e0 (patch)
tree1dbd12129b4677c5a02307c1046fdb8cff056324 /tests/auto/corelib
parent60054b5940b19f4dd9780e63da1e2dce45baf131 (diff)
parent38c1057f696c4e3f168305091413428d99007c43 (diff)
Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts: src/network/socket/qnativesocketengine_winrt.cpp tools/configure/configureapp.cpp tools/configure/environment.cpp Change-Id: Ieae6f2ee004a87f041751852b687484f91ee4480
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp14
-rw-r--r--tests/auto/corelib/io/qurl/tst_qurl.cpp50
-rw-r--r--tests/auto/corelib/thread/qthread/tst_qthread.cpp4
3 files changed, 66 insertions, 2 deletions
diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
index 5b18ab9d68..a7a761a2da 100644
--- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
+++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
@@ -33,6 +33,9 @@
#include <qfileinfo.h>
#include <qsysinfo.h>
#include <qregexp.h>
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) && !defined(Q_OS_WINCE)
+# include <qt_windows.h>
+#endif
#ifdef Q_OS_UNIX
#include <unistd.h>
@@ -126,6 +129,16 @@ static const char * const enumNames[MaxStandardLocation + 1 - int(QStandardPaths
void tst_qstandardpaths::initTestCase()
{
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) && !defined(Q_OS_WINCE)
+ // Disable WOW64 redirection, see testFindExecutable()
+ if (QSysInfo::buildCpuArchitecture() != QSysInfo::currentCpuArchitecture()) {
+ void *oldMode;
+ const bool disabledDisableWow64FsRedirection = Wow64DisableWow64FsRedirection(&oldMode) == TRUE;
+ if (!disabledDisableWow64FsRedirection)
+ qErrnoWarning("Wow64DisableWow64FsRedirection() failed");
+ QVERIFY(disabledDisableWow64FsRedirection);
+ }
+#endif // Q_OS_WIN && !Q_OS_WINRT && !Q_OS_WINCE
QVERIFY2(m_localConfigTempDir.isValid(), qPrintable(m_localConfigTempDir.errorString()));
QVERIFY2(m_globalConfigTempDir.isValid(), qPrintable(m_globalConfigTempDir.errorString()));
QVERIFY2(m_localAppTempDir.isValid(), qPrintable(m_localAppTempDir.errorString()));
@@ -375,6 +388,7 @@ void tst_qstandardpaths::testFindExecutable_data()
if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS8) {
// The logo executable on Windows 8 is perfectly suited for testing that the
// suffix mechanism is not thrown off by dots in the name.
+ // Note: Requires disabling WOW64 redirection, see initTestCase()
const QString logo = QLatin1String("microsoft.windows.softwarelogo.showdesktop");
const QString logoPath = cmdFi.absolutePath() + QLatin1Char('/') + logo + QLatin1String(".exe");
QTest::newRow("win8-logo")
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp
index f589fe1d6d..a4461a12d3 100644
--- a/tests/auto/corelib/io/qurl/tst_qurl.cpp
+++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp
@@ -177,6 +177,8 @@ private slots:
void streaming();
void detach();
void testThreading();
+ void matches_data();
+ void matches();
private:
void testThreadingHelper();
@@ -4020,6 +4022,54 @@ void tst_QUrl::testThreading()
delete s_urlStorage;
}
+void tst_QUrl::matches_data()
+{
+ QTest::addColumn<QString>("urlStrOne");
+ QTest::addColumn<QString>("urlStrTwo");
+ QTest::addColumn<uint>("options");
+ QTest::addColumn<bool>("matches");
+
+ QTest::newRow("matchingString-none") << "http://www.website.com/directory/?#ref"
+ << "http://www.website.com/directory/?#ref"
+ << uint(QUrl::None) << true;
+ QTest::newRow("nonMatchingString-none") << "http://www.website.com/directory/?#ref"
+ << "http://www.nomatch.com/directory/?#ref"
+ << uint(QUrl::None) << false;
+ QTest::newRow("matchingHost-removePath") << "http://www.website.com/directory"
+ << "http://www.website.com/differentdir"
+ << uint(QUrl::RemovePath) << true;
+ QTest::newRow("nonMatchingHost-removePath") << "http://www.website.com/directory"
+ << "http://www.different.com/differentdir"
+ << uint(QUrl::RemovePath) << false;
+ QTest::newRow("matchingHost-removePathAuthority") << "http://user:pass@www.website.com/directory"
+ << "http://www.website.com/differentdir"
+ << uint(QUrl::RemovePath | QUrl::RemoveAuthority)
+ << true;
+ QTest::newRow("nonMatchingHost-removePathAuthority") << "http://user:pass@www.website.com/directory"
+ << "http://user:pass@www.different.com/differentdir"
+ << uint(QUrl::RemovePath | QUrl::RemoveAuthority)
+ << true;
+ QTest::newRow("matchingHostAuthority-removePathAuthority")
+ << "http://user:pass@www.website.com/directory" << "http://www.website.com/differentdir"
+ << uint(QUrl::RemovePath | QUrl::RemoveAuthority) << true;
+ QTest::newRow("nonMatchingAuthority-removePathAuthority")
+ << "http://user:pass@www.website.com/directory"
+ << "http://otheruser:otherpass@www.website.com/directory"
+ << uint(QUrl::RemovePath | QUrl::RemoveAuthority) << true;
+}
+
+void tst_QUrl::matches()
+{
+ QFETCH(QString, urlStrOne);
+ QFETCH(QString, urlStrTwo);
+ QFETCH(uint, options);
+ QFETCH(bool, matches);
+
+ QUrl urlOne(urlStrOne);
+ QUrl urlTwo(urlStrTwo);
+ QCOMPARE(urlOne.matches(urlTwo, QUrl::FormattingOptions(options)), matches);
+}
+
QTEST_MAIN(tst_QUrl)
#include "tst_qurl.moc"
diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp
index 06b27f79cd..0efbc5d01e 100644
--- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp
+++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp
@@ -1059,8 +1059,8 @@ void tst_QThread::wait2()
thread.start();
timer.start();
QVERIFY(!thread.wait(Waiting_Thread::WaitTime));
- qint64 elapsed = timer.elapsed(); // On Windows, we sometimes get (WaitTime - 1).
- QVERIFY2(elapsed >= Waiting_Thread::WaitTime - 1, qPrintable(QString::fromLatin1("elapsed: %1").arg(elapsed)));
+ qint64 elapsed = timer.elapsed(); // On Windows, we sometimes get (WaitTime - 9).
+ QVERIFY2(elapsed >= Waiting_Thread::WaitTime - 10, qPrintable(QString::fromLatin1("elapsed: %1").arg(elapsed)));
timer.start();
thread.cond1.wakeOne();