summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/io')
-rw-r--r--tests/auto/corelib/io/io.pro11
-rw-r--r--tests/auto/corelib/io/qdebug/tst_qdebug.cpp31
-rw-r--r--tests/auto/corelib/io/qfile/test/test.pro7
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp34
-rw-r--r--tests/auto/corelib/io/qfileinfo/qfileinfo.pro2
-rw-r--r--tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp22
-rw-r--r--tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp6
-rw-r--r--tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp54
-rw-r--r--tests/auto/corelib/io/qloggingregistry/qloggingregistry.pro8
-rw-r--r--tests/auto/corelib/io/qloggingregistry/qtlogging.ini2
-rw-r--r--tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp309
-rw-r--r--tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp6
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro2
-rw-r--r--tests/auto/corelib/io/qprocess/tst_qprocess.cpp4
-rw-r--r--tests/auto/corelib/io/qresourceengine/qresourceengine.pro9
-rw-r--r--tests/auto/corelib/io/qsettings/tst_qsettings.cpp8
-rw-r--r--tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp6
-rw-r--r--tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp4
-rw-r--r--tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp4
-rw-r--r--tests/auto/corelib/io/qurl/tst_qurl.cpp52
-rw-r--r--tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp2
-rw-r--r--tests/auto/corelib/io/qwinoverlappedionotifier/tst_qwinoverlappedionotifier.cpp1
22 files changed, 501 insertions, 83 deletions
diff --git a/tests/auto/corelib/io/io.pro b/tests/auto/corelib/io/io.pro
index ab66323d3b..ba055a4f3f 100644
--- a/tests/auto/corelib/io/io.pro
+++ b/tests/auto/corelib/io/io.pro
@@ -17,6 +17,7 @@ SUBDIRS=\
qipaddress \
qlockfile \
qloggingcategory \
+ qloggingregistry \
qnodebug \
qprocess \
qprocess-noapplication \
@@ -43,7 +44,6 @@ SUBDIRS=\
qsettings
!qtHaveModule(network): SUBDIRS -= \
- qfile \
qiodevice \
qprocess \
qtextstream
@@ -52,7 +52,14 @@ SUBDIRS=\
qabstractfileengine \
qfileinfo \
qipaddress \
- qurlinternal
+ qurlinternal \
+ qloggingregistry
win32:!contains(QT_CONFIG, private_tests): SUBDIRS -= \
qfilesystementry
+
+winrt: SUBDIRS -= \
+ qprocess \
+ qprocess-noapplication \
+ qprocessenvironment \
+ qwinoverlappedionotifier
diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
index f452efc1b3..80144dba20 100644
--- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
+++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
@@ -57,6 +57,7 @@ private slots:
void veryLongWarningMessage() const;
void qDebugQStringRef() const;
void qDebugQLatin1String() const;
+ void textStreamModifiers() const;
void defaultMessagehandler() const;
};
@@ -65,8 +66,8 @@ void tst_QDebug::assignment() const
QDebug debug1(QtDebugMsg);
QDebug debug2(QtWarningMsg);
- QTest::ignoreMessage(QtDebugMsg, "foo ");
- QTest::ignoreMessage(QtWarningMsg, "bar 1 2 ");
+ QTest::ignoreMessage(QtDebugMsg, "foo");
+ QTest::ignoreMessage(QtWarningMsg, "bar 1 2");
debug1 << "foo";
debug2 << "bar";
@@ -118,7 +119,7 @@ void tst_QDebug::warningWithoutDebug() const
{ qWarning() << "A qWarning() message"; }
QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO;
QCOMPARE(s_msgType, QtWarningMsg);
- QCOMPARE(s_msg, QString::fromLatin1("A qWarning() message "));
+ QCOMPARE(s_msg, QString::fromLatin1("A qWarning() message"));
QCOMPARE(QString::fromLatin1(s_file), file);
QCOMPARE(s_line, line);
QCOMPARE(QString::fromLatin1(s_function), function);
@@ -133,7 +134,7 @@ void tst_QDebug::criticalWithoutDebug() const
{ qCritical() << "A qCritical() message"; }
QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO;
QCOMPARE(s_msgType, QtCriticalMsg);
- QCOMPARE(s_msg, QString::fromLatin1("A qCritical() message "));
+ QCOMPARE(s_msg, QString::fromLatin1("A qCritical() message"));
QCOMPARE(QString::fromLatin1(s_file), file);
QCOMPARE(s_line, line);
QCOMPARE(QString::fromLatin1(s_function), function);
@@ -145,7 +146,7 @@ void tst_QDebug::debugWithBool() const
{ qDebug() << false << true; }
QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO;
QCOMPARE(s_msgType, QtDebugMsg);
- QCOMPARE(s_msg, QString::fromLatin1("false true "));
+ QCOMPARE(s_msg, QString::fromLatin1("false true"));
QCOMPARE(QString::fromLatin1(s_file), file);
QCOMPARE(s_line, line);
QCOMPARE(QString::fromLatin1(s_function), function);
@@ -215,7 +216,7 @@ void tst_QDebug::stateSaver() const
}
d.space() << 42;
}
- QCOMPARE(s_msg, QString::fromLatin1("02a 42 "));
+ QCOMPARE(s_msg, QString::fromLatin1("02a 42"));
}
void tst_QDebug::veryLongWarningMessage() const
@@ -247,7 +248,7 @@ void tst_QDebug::qDebugQStringRef() const
{ qDebug() << inRef; }
QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO;
QCOMPARE(s_msgType, QtDebugMsg);
- QCOMPARE(s_msg, QString::fromLatin1("\"input\" "));
+ QCOMPARE(s_msg, QString::fromLatin1("\"input\""));
QCOMPARE(QString::fromLatin1(s_file), file);
QCOMPARE(s_line, line);
QCOMPARE(QString::fromLatin1(s_function), function);
@@ -261,7 +262,7 @@ void tst_QDebug::qDebugQStringRef() const
{ qDebug() << inRef; }
QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO;
QCOMPARE(s_msgType, QtDebugMsg);
- QCOMPARE(s_msg, QString::fromLatin1("\"\" "));
+ QCOMPARE(s_msg, QString::fromLatin1("\"\""));
QCOMPARE(QString::fromLatin1(s_file), file);
QCOMPARE(s_line, line);
QCOMPARE(QString::fromLatin1(s_function), function);
@@ -274,7 +275,19 @@ void tst_QDebug::qDebugQLatin1String() const
{ qDebug() << QLatin1String("foo") << QLatin1String("") << QLatin1String("barbaz", 3); }
QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO;
QCOMPARE(s_msgType, QtDebugMsg);
- QCOMPARE(s_msg, QString::fromLatin1("\"foo\" \"\" \"bar\" "));
+ QCOMPARE(s_msg, QString::fromLatin1("\"foo\" \"\" \"bar\""));
+ QCOMPARE(QString::fromLatin1(s_file), file);
+ QCOMPARE(s_line, line);
+ QCOMPARE(QString::fromLatin1(s_function), function);
+}
+
+void tst_QDebug::textStreamModifiers() const
+{
+ MessageHandlerSetter mhs(myMessageHandler);
+ { qDebug() << hex << short(0xf) << int(0xf) << unsigned(0xf) << long(0xf) << qint64(0xf) << quint64(0xf); }
+ QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO;
+ QCOMPARE(s_msgType, QtDebugMsg);
+ QCOMPARE(s_msg, QString::fromLatin1("f f f f f f"));
QCOMPARE(QString::fromLatin1(s_file), file);
QCOMPARE(s_line, line);
QCOMPARE(QString::fromLatin1(s_function), function);
diff --git a/tests/auto/corelib/io/qfile/test/test.pro b/tests/auto/corelib/io/qfile/test/test.pro
index bc6922b4e9..03863e9943 100644
--- a/tests/auto/corelib/io/qfile/test/test.pro
+++ b/tests/auto/corelib/io/qfile/test/test.pro
@@ -1,7 +1,10 @@
CONFIG += testcase
CONFIG += parallel_test
CONFIG -= app_bundle debug_and_release_target
-QT = core-private core network testlib
+QT = core-private core testlib
+qtHaveModule(network): QT += network
+else: DEFINES += QT_NO_NETWORK
+
TARGET = ../tst_qfile
SOURCES = ../tst_qfile.cpp
wince*: SOURCES += $$QT_SOURCE_TREE/src/corelib/kernel/qfunctions_wince.cpp
@@ -13,5 +16,5 @@ TESTDATA += ../dosfile.txt ../noendofline.txt ../testfile.txt \
../Makefile ../forCopying.txt ../forRenaming.txt \
../resources/file1.ext1
-win32: LIBS+=-lole32 -luuid
+win32:!winrt: LIBS+=-lole32 -luuid
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp
index 2b029203e9..60d1517ed3 100644
--- a/tests/auto/corelib/io/qfile/tst_qfile.cpp
+++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp
@@ -59,7 +59,7 @@ extern Q_CORE_EXPORT int qt_ntfs_permission_lookup;
QT_END_NAMESPACE
#endif
-#if !defined(Q_OS_WINCE)
+#if !defined(Q_OS_WINCE) && !defined(QT_NO_NETWORK)
#include <QHostInfo>
#endif
#include <QProcess>
@@ -181,7 +181,7 @@ private slots:
void writeTextFile_data();
void writeTextFile();
/* void largeFileSupport(); */
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
void largeUncFileSupport();
#endif
void flush();
@@ -480,7 +480,7 @@ void tst_QFile::exists()
file.remove();
QVERIFY(!file.exists());
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
QFile unc("//" + QtNetworkSettings::winServerName() + "/testshare/readme.txt");
QVERIFY(unc.exists());
#endif
@@ -527,7 +527,7 @@ void tst_QFile::open_data()
<< false << QFile::OpenError;
QTest::newRow("noreadfile") << QString::fromLatin1(noReadFile) << int(QIODevice::ReadOnly)
<< false << QFile::OpenError;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
//opening devices requires administrative privileges (and elevation).
HANDLE hTest = CreateFile(_T("\\\\.\\PhysicalDrive0"), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (hTest != INVALID_HANDLE_VALUE) {
@@ -605,7 +605,7 @@ void tst_QFile::size_data()
QTest::addColumn<qint64>("size");
QTest::newRow( "exist01" ) << m_testFile << (qint64)245;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
// Only test UNC on Windows./
QTest::newRow("unc") << "//" + QString(QtNetworkSettings::winServerName() + "/testshare/test.pri") << (qint64)34;
#endif
@@ -1057,7 +1057,7 @@ void tst_QFile::ungetChar()
QCOMPARE(buf[2], '4');
}
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
QString driveLetters()
{
wchar_t volumeName[MAX_PATH];
@@ -1094,7 +1094,7 @@ void tst_QFile::invalidFile_data()
#if !defined(Q_OS_WIN)
QTest::newRow( "x11" ) << QString( "qwe//" );
#else
-#if !defined(Q_OS_WINCE)
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
QTest::newRow( "colon2" ) << invalidDriveLetter() + QString::fromLatin1(":ail:invalid");
#endif
QTest::newRow( "colon3" ) << QString( ":failinvalid" );
@@ -1338,10 +1338,12 @@ void tst_QFile::copyFallback()
#ifdef Q_OS_WIN
#include <objbase.h>
+#ifndef Q_OS_WINPHONE
#include <shlobj.h>
#endif
+#endif
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
static QString getWorkingDirectoryForLink(const QString &linkFileName)
{
bool neededCoInit = false;
@@ -1400,7 +1402,7 @@ void tst_QFile::link()
QCOMPARE(QFile::symLinkTarget("myLink.lnk"), referenceTarget);
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
QString wd = getWorkingDirectoryForLink(info2.absoluteFilePath());
QCOMPARE(QDir::fromNativeSeparators(wd), QDir::cleanPath(info1.absolutePath()));
#endif
@@ -1537,7 +1539,7 @@ void tst_QFile::writeTextFile()
QCOMPARE(file.readAll(), out);
}
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
void tst_QFile::largeUncFileSupport()
{
qint64 size = Q_INT64_C(8589934592);
@@ -2243,7 +2245,7 @@ void tst_QFile::writeLargeDataBlock_data()
QTest::newRow("localfile-Fd") << "./largeblockfile.txt" << (int)OpenFd;
QTest::newRow("localfile-Stream") << "./largeblockfile.txt" << (int)OpenStream;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) && !defined(QT_NO_NETWORK)
// Some semi-randomness to avoid collisions.
QTest::newRow("unc file")
<< QString("//" + QtNetworkSettings::winServerName() + "/TESTSHAREWRITABLE/largefile-%1-%2.txt")
@@ -2603,7 +2605,7 @@ void tst_QFile::appendAndRead()
void tst_QFile::miscWithUncPathAsCurrentDir()
{
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
QString current = QDir::currentPath();
QVERIFY(QDir::setCurrent("//" + QtNetworkSettings::winServerName() + "/testshare"));
QFile file("test.pri");
@@ -2690,8 +2692,12 @@ void tst_QFile::nativeHandleLeaks()
}
#ifdef Q_OS_WIN
+# ifndef Q_OS_WINRT
handle1 = ::CreateFileA("qt_file.tmp", GENERIC_READ, 0, NULL,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+# else
+ handle1 = ::CreateFile2(L"qt_file.tmp", GENERIC_READ, 0, OPEN_ALWAYS, NULL);
+# endif
QVERIFY( INVALID_HANDLE_VALUE != handle1 );
QVERIFY( ::CloseHandle(handle1) );
#endif
@@ -2705,8 +2711,12 @@ void tst_QFile::nativeHandleLeaks()
}
#ifdef Q_OS_WIN
+# ifndef Q_OS_WINRT
handle2 = ::CreateFileA("qt_file.tmp", GENERIC_READ, 0, NULL,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+# else
+ handle2 = ::CreateFile2(L"qt_file.tmp", GENERIC_READ, 0, OPEN_ALWAYS, NULL);
+# endif
QVERIFY( INVALID_HANDLE_VALUE != handle2 );
QVERIFY( ::CloseHandle(handle2) );
#endif
diff --git a/tests/auto/corelib/io/qfileinfo/qfileinfo.pro b/tests/auto/corelib/io/qfileinfo/qfileinfo.pro
index c4b37a8847..64d289bc3c 100644
--- a/tests/auto/corelib/io/qfileinfo/qfileinfo.pro
+++ b/tests/auto/corelib/io/qfileinfo/qfileinfo.pro
@@ -6,5 +6,5 @@ RESOURCES += qfileinfo.qrc
TESTDATA += qfileinfo.qrc qfileinfo.pro tst_qfileinfo.cpp resources/file1 resources/file1.ext1 resources/file1.ext1.ext2
-win32*:!wince*:LIBS += -ladvapi32 -lnetapi32
+win32*:!wince*:!winrt:LIBS += -ladvapi32 -lnetapi32
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
index d2171cc64a..6c147d68c8 100644
--- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
@@ -62,7 +62,7 @@
#ifdef Q_OS_WIN
#include <qt_windows.h>
#include <qlibrary.h>
-#if !defined(Q_OS_WINCE)
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
#include <lm.h>
#endif
#endif
@@ -176,7 +176,7 @@ private slots:
void refresh();
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
void ntfsJunctionPointsAndSymlinks_data();
void ntfsJunctionPointsAndSymlinks();
void brokenShortcut();
@@ -193,7 +193,7 @@ private slots:
void detachingOperations();
-#if !defined(Q_OS_WINCE)
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
void owner();
#endif
void group();
@@ -378,7 +378,7 @@ void tst_QFileInfo::isRoot_data()
QTest::newRow("drive 3") << "p:/" << false;
#endif
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
QTest::newRow("unc 1") << "//" + QtNetworkSettings::winServerName() << true;
QTest::newRow("unc 2") << "//" + QtNetworkSettings::winServerName() + "/" << true;
QTest::newRow("unc 3") << "//" + QtNetworkSettings::winServerName() + "/testshare" << false;
@@ -418,7 +418,7 @@ void tst_QFileInfo::exists_data()
QTest::newRow("simple dir") << m_resourcesDir << true;
QTest::newRow("simple dir with slash") << (m_resourcesDir + QLatin1Char('/')) << true;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
QTest::newRow("unc 1") << "//" + QtNetworkSettings::winServerName() << true;
QTest::newRow("unc 2") << "//" + QtNetworkSettings::winServerName() + "/" << true;
QTest::newRow("unc 3") << "//" + QtNetworkSettings::winServerName() + "/testshare" << true;
@@ -713,7 +713,7 @@ void tst_QFileInfo::dir_data()
QTest::newRow("resource1") << ":/tst_qfileinfo/resources/file1.ext1" << true << ":/tst_qfileinfo/resources";
#ifdef Q_OS_WIN
QTest::newRow("driveWithSlash") << "C:/file1.ext1.ext2" << true << "C:/";
- QTest::newRow("driveWithoutSlash") << QDir::currentPath().left(2) + "file1.ext1.ext2" << false << QDir::currentPath();
+ QTest::newRow("driveWithoutSlash") << QDir::currentPath().left(2) + "file1.ext1.ext2" << false << QDir::currentPath().left(2);
#endif
}
@@ -1058,7 +1058,7 @@ void tst_QFileInfo::fileTimes()
//In Vista the last-access timestamp is not updated when the file is accessed/touched (by default).
//To enable this the HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\NtfsDisableLastAccessUpdate
//is set to 0, in the test machine.
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
HKEY key;
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\FileSystem",
0, KEY_READ, &key)) {
@@ -1085,8 +1085,8 @@ void tst_QFileInfo::fileTimes()
void tst_QFileInfo::fileTimes_oldFile()
{
- // This is not supported on WinCE
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+ // This is not supported on WinCE or WinRT
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
// All files are opened in share mode (both read and write).
DWORD shareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
@@ -1329,7 +1329,7 @@ void tst_QFileInfo::refresh()
QCOMPARE(info2.size(), info.size());
}
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data()
{
QTest::addColumn<QString>("path");
@@ -1680,7 +1680,7 @@ void tst_QFileInfo::detachingOperations()
QVERIFY(!info1.caching());
}
-#if !defined(Q_OS_WINCE)
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
#if defined (Q_OS_WIN)
BOOL IsUserAdmin()
{
diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
index fda6519d82..b681cec802 100644
--- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
+++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
@@ -55,6 +55,7 @@ class tst_QFileSystemWatcher : public QObject
public:
tst_QFileSystemWatcher();
+#ifndef QT_NO_FILESYSTEMWATCHER
private slots:
void basicTest_data();
void basicTest();
@@ -83,16 +84,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
}
+#ifndef QT_NO_FILESYSTEMWATCHER
void tst_QFileSystemWatcher::basicTest_data()
{
QTest::addColumn<QString>("backend");
@@ -676,6 +681,7 @@ void tst_QFileSystemWatcher::signalsEmittedAfterFileMoved()
QTRY_COMPARE(changedSpy.count(), 10);
}
+#endif // QT_NO_FILESYSTEMWATCHER
QTEST_MAIN(tst_QFileSystemWatcher)
#include "tst_qfilesystemwatcher.moc"
diff --git a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp
index 50268f20a4..b0d7a76f0f 100644
--- a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp
+++ b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp
@@ -271,8 +271,8 @@ private slots:
QCOMPARE(defaultCategory.isEnabled(QtCriticalMsg), true);
QLoggingCategory customCategory("custom");
- QCOMPARE(customCategory.isDebugEnabled(), false);
- QCOMPARE(customCategory.isEnabled(QtDebugMsg), false);
+ QCOMPARE(customCategory.isDebugEnabled(), true);
+ QCOMPARE(customCategory.isEnabled(QtDebugMsg), true);
QCOMPARE(customCategory.isWarningEnabled(), true);
QCOMPARE(customCategory.isEnabled(QtWarningMsg), true);
QCOMPARE(customCategory.isCriticalEnabled(), true);
@@ -309,7 +309,7 @@ private slots:
QLoggingCategory cat("custom");
QCOMPARE(customCategoryFilterArgs, QStringList() << "custom");
- QVERIFY(cat.isDebugEnabled());
+ QVERIFY(!cat.isDebugEnabled());
customCategoryFilterArgs.clear();
// install default filter
@@ -319,7 +319,7 @@ private slots:
QCOMPARE(customCategoryFilterArgs.size(), 0);
QVERIFY(QLoggingCategory::defaultCategory()->isDebugEnabled());
- QVERIFY(!cat.isDebugEnabled());
+ QVERIFY(cat.isDebugEnabled());
// install default filter
currentFilter =
@@ -328,7 +328,7 @@ private slots:
QCOMPARE(customCategoryFilterArgs.size(), 0);
QVERIFY(QLoggingCategory::defaultCategory()->isDebugEnabled());
- QVERIFY(!cat.isDebugEnabled());
+ QVERIFY(cat.isDebugEnabled());
}
void qDebugMacros()
@@ -376,23 +376,33 @@ private slots:
buf = QStringLiteral("default.debug: Check debug with no filter active");
qCDebug(defaultCategory) << "Check debug with no filter active";
QCOMPARE(logMessage, buf);
+ qCDebug(defaultCategory, "Check debug with no filter active");
+ QCOMPARE(logMessage, buf);
// Check default warning
buf = QStringLiteral("default.warning: Check warning with no filter active");
qCWarning(defaultCategory) << "Check warning with no filter active";
QCOMPARE(logMessage, buf);
+ qCWarning(defaultCategory, "Check warning with no filter active");
+ QCOMPARE(logMessage, buf);
// Check default critical
buf = QStringLiteral("default.critical: Check critical with no filter active");
qCCritical(defaultCategory) << "Check critical with no filter active";
QCOMPARE(logMessage, buf);
+ qCCritical(defaultCategory, "Check critical with no filter active");
+ QCOMPARE(logMessage, buf);
QLoggingCategory customCategory("custom");
// Check custom debug
logMessage.clear();
+ buf = QStringLiteral("custom.debug: Check debug with no filter active");
+ qCDebug(customCategory, "Check debug with no filter active");
+ QCOMPARE(logMessage, buf);
+
qCDebug(customCategory) << "Check debug with no filter active";
- QCOMPARE(logMessage, QString());
+ QCOMPARE(logMessage, buf);
// Check custom warning
buf = QStringLiteral("custom.warning: Check warning with no filter active");
@@ -408,17 +418,38 @@ private slots:
QLoggingCategory::installFilter(customCategoryFilter);
// Check custom debug
- buf = QStringLiteral("custom.debug: Check debug with filter active");
+ logMessage.clear();
qCDebug(customCategory) << "Check debug with filter active";
+ QCOMPARE(logMessage, QString());
+
+ // Check different macro/category variants
+ buf = QStringLiteral("tst.log.debug: Check debug with no filter active");
+ qCDebug(TST_LOG) << "Check debug with no filter active";
+ QCOMPARE(logMessage, QString());
+ qCDebug(TST_LOG, "Check debug with no filter active");
+ QCOMPARE(logMessage, QString());
+ qCDebug(TST_LOG(), "Check debug with no filter active");
+ QCOMPARE(logMessage, QString());
+ buf = QStringLiteral("tst.log.warning: Check warning with no filter active");
+ qCWarning(TST_LOG) << "Check warning with no filter active";
+ QCOMPARE(logMessage, buf);
+ qCWarning(TST_LOG, "Check warning with no filter active");
+ QCOMPARE(logMessage, buf);
+ buf = QStringLiteral("tst.log.critical: Check critical with no filter active");
+ qCCritical(TST_LOG) << "Check critical with no filter active";
QCOMPARE(logMessage, buf);
+ qCCritical(TST_LOG, "Check critical with no filter active");
+ QCOMPARE(logMessage, buf);
+
// reset to default filter
QLoggingCategory::installFilter(0);
// Check custom debug
logMessage.clear();
+ buf = QStringLiteral("custom.debug: Check debug with no filter active");
qCDebug(customCategory) << "Check debug with no filter active";
- QCOMPARE(logMessage, QString());
+ QCOMPARE(logMessage, buf);
}
void checkLegacyMessageLogger()
@@ -453,11 +484,11 @@ private slots:
QCOMPARE(cleanLogLine(logMessage), cleanLogLine(buf));
// Check category debug
- logMessage = "should not change";
- buf = logMessage;
+ buf = QStringLiteral("tst.log.debug: Check category Debug with no log active");
qCDebug(TST_LOG) << "Check category Debug with no log active";
QCOMPARE(logMessage, buf);
+
// Check default warning
buf = QStringLiteral("tst.log.warning: Check category Warning with no log active");
qCWarning(TST_LOG) << "Check category Warning with no log active";
@@ -739,8 +770,7 @@ private slots:
{
// "" -> custom category
QLoggingCategory mycategoryobject1("");
- logMessage = "no change";
- QString buf = QStringLiteral("no change");
+ QString buf = QStringLiteral(".debug: My Category Object");
qCDebug(mycategoryobject1) << "My Category Object";
QCOMPARE(cleanLogLine(logMessage), cleanLogLine(buf));
diff --git a/tests/auto/corelib/io/qloggingregistry/qloggingregistry.pro b/tests/auto/corelib/io/qloggingregistry/qloggingregistry.pro
new file mode 100644
index 0000000000..c6c4caace3
--- /dev/null
+++ b/tests/auto/corelib/io/qloggingregistry/qloggingregistry.pro
@@ -0,0 +1,8 @@
+TEMPLATE = app
+TARGET = tst_qloggingregistry
+
+CONFIG += testcase
+QT = core core-private testlib
+
+SOURCES += tst_qloggingregistry.cpp
+OTHER_FILES += qtlogging.ini
diff --git a/tests/auto/corelib/io/qloggingregistry/qtlogging.ini b/tests/auto/corelib/io/qloggingregistry/qtlogging.ini
new file mode 100644
index 0000000000..fd7a4f8c54
--- /dev/null
+++ b/tests/auto/corelib/io/qloggingregistry/qtlogging.ini
@@ -0,0 +1,2 @@
+[Rules]
+*=true
diff --git a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp
new file mode 100644
index 0000000000..4318396bd4
--- /dev/null
+++ b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp
@@ -0,0 +1,309 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest>
+#include <QLoggingCategory>
+
+#include <QtCore/private/qloggingregistry_p.h>
+
+QT_USE_NAMESPACE
+enum LoggingRuleState {
+ Invalid,
+ Match,
+ NoMatch
+};
+Q_DECLARE_METATYPE(LoggingRuleState);
+Q_DECLARE_METATYPE(QtMsgType);
+
+class tst_QLoggingRegistry : public QObject
+{
+ Q_OBJECT
+
+private slots:
+
+ void initTestCase()
+ {
+ // ensure a clean environment
+ QStandardPaths::setTestModeEnabled(true);
+ qunsetenv("QT_LOGGING_CONF");
+ qunsetenv("QT_LOGGING_RULES");
+ }
+
+ void QLoggingRule_parse_data()
+ {
+ QTest::addColumn<QString>("pattern");
+ QTest::addColumn<QString>("category");
+ QTest::addColumn<QtMsgType>("msgType");
+ QTest::addColumn<LoggingRuleState>("result");
+
+ // _empty_ should match (only) _empty_
+ QTest::newRow("_empty_-_empty_")
+ << QString("") << QString("") << QtDebugMsg << Match;
+ QTest::newRow("_empty_-default")
+ << QString("") << QString("default") << QtDebugMsg << NoMatch;
+ QTest::newRow(".debug-_empty_")
+ << QString(".debug") << QString("") << QtDebugMsg << Match;
+ QTest::newRow(".warning-default")
+ << QString(".warning") << QString("default") << QtDebugMsg << NoMatch;
+
+ // literal should match only literal
+ QTest::newRow("qt-qt")
+ << QString("qt") << QString("qt") << QtDebugMsg << Match;
+ QTest::newRow("qt-_empty_")
+ << QString("qt") << QString("") << QtDebugMsg << NoMatch;
+ QTest::newRow("qt-qtx")
+ << QString("qt") << QString("qtx") << QtDebugMsg << NoMatch;
+ QTest::newRow("qt-qt.io")
+ << QString("qt") << QString("qt.io") << QtDebugMsg << NoMatch;
+ QTest::newRow("qt.debug-qt")
+ << QString("qt.debug") << QString("qt") << QtDebugMsg << Match;
+ QTest::newRow("qt.critical-qt")
+ << QString("qt.critical") << QString("qt") << QtDebugMsg << NoMatch;
+
+ // * should match everything
+ QTest::newRow("_star_-qt.io.debug")
+ << QString("*") << QString("qt.io") << QtDebugMsg << Match;
+ QTest::newRow("_star_-qt.io.warning")
+ << QString("*") << QString("qt.io") << QtWarningMsg << Match;
+ QTest::newRow("_star_-qt.io.critical")
+ << QString("*") << QString("qt.io") << QtCriticalMsg << Match;
+ QTest::newRow("_star_-_empty_")
+ << QString("*") << QString("") << QtDebugMsg << Match;
+ QTest::newRow("_star_.debug-qt.io")
+ << QString("*.debug") << QString("qt.io") << QtDebugMsg << Match;
+ QTest::newRow("_star_.warning-qt.io")
+ << QString("*.warning") << QString("qt.io") << QtDebugMsg << NoMatch;
+
+ // qt.* should match everything starting with 'qt.'
+ QTest::newRow("qt._star_-qt.io")
+ << QString("qt.*") << QString("qt.io") << QtDebugMsg << Match;
+ QTest::newRow("qt._star_-qt")
+ << QString("qt.*") << QString("qt") << QtDebugMsg << NoMatch;
+ QTest::newRow("qt__star_-qt")
+ << QString("qt*") << QString("qt") << QtDebugMsg << Match;
+ QTest::newRow("qt._star_-qt.io.fs")
+ << QString("qt.*") << QString("qt.io.fs") << QtDebugMsg << Match;
+ QTest::newRow("qt._star_.debug-qt.io.fs")
+ << QString("qt.*.debug") << QString("qt.io.fs") << QtDebugMsg << Match;
+ QTest::newRow("qt._star_.warning-qt.io.fs")
+ << QString("qt.*.warning") << QString("qt.io.fs") << QtDebugMsg << NoMatch;
+
+ // *.io should match everything ending with .io
+ QTest::newRow("_star_.io-qt.io")
+ << QString("*.io") << QString("qt.io") << QtDebugMsg << Match;
+ QTest::newRow("_star_io-qt.io")
+ << QString("*io") << QString("qt.io") << QtDebugMsg << Match;
+ QTest::newRow("_star_.io-io")
+ << QString("*.io") << QString("io") << QtDebugMsg << NoMatch;
+ QTest::newRow("_star_io-io")
+ << QString("*io") << QString("io") << QtDebugMsg << Match;
+ QTest::newRow("_star_.io-qt.ios")
+ << QString("*.io") << QString("qt.ios") << QtDebugMsg << NoMatch;
+ QTest::newRow("_star_.io-qt.io.x")
+ << QString("*.io") << QString("qt.io.x") << QtDebugMsg << NoMatch;
+ QTest::newRow("_star_.io.debug-qt.io")
+ << QString("*.io.debug") << QString("qt.io") << QtDebugMsg << Match;
+ QTest::newRow("_star_.io.warning-qt.io")
+ << QString("*.io.warning") << QString("qt.io") << QtDebugMsg << NoMatch;
+
+ // *qt* should match everything that contains 'qt'
+ QTest::newRow("_star_qt_star_-qt.core.io")
+ << QString("*qt*") << QString("qt.core.io") << QtDebugMsg << Match;
+ QTest::newRow("_star_qt_star_-default")
+ << QString("*qt*") << QString("default") << QtDebugMsg << NoMatch;
+ QTest::newRow("_star_qt._star_.debug-qt.io")
+ << QString("*qt.*.debug") << QString("qt.io") << QtDebugMsg << Match;
+ QTest::newRow("_star_.qt._star_.warning-qt.io")
+ << QString("*.qt.*.warning") << QString("qt.io") << QtDebugMsg << NoMatch;
+ QTest::newRow("**")
+ << QString("**") << QString("qt.core.io") << QtDebugMsg << Match;
+
+ // * outside of start/end
+ QTest::newRow("qt.*.io")
+ << QString("qt.*.io") << QString("qt.core.io") << QtDebugMsg << Invalid;
+ QTest::newRow("***")
+ << QString("***") << QString("qt.core.io") << QtDebugMsg << Invalid;
+ }
+
+ void QLoggingRule_parse()
+ {
+ QFETCH(QString, pattern);
+ QFETCH(QString, category);
+ QFETCH(QtMsgType, msgType);
+ QFETCH(LoggingRuleState, result);
+
+ QLoggingRule rule(QStringRef(&pattern), true);
+ LoggingRuleState state = Invalid;
+ if (rule.flags != QLoggingRule::Invalid) {
+ switch (rule.pass(category, msgType)) {
+ case -1: QFAIL("Shoudn't happen, we set pattern to true"); break;
+ case 0: state = NoMatch; break;
+ case 1: state = Match; break;
+ }
+ }
+ QCOMPARE(state, result);
+ }
+
+ void QLoggingSettingsParser_iniStyle()
+ {
+ //
+ // Logging configuration can be described
+ // in an .ini file. [Rules] is the
+ // default category, and optional ...
+ //
+ QLoggingSettingsParser parser;
+ parser.setContent("[Rules]\n"
+ "default=false\n"
+ "default=true");
+ QCOMPARE(parser.rules().size(), 2);
+
+ parser.setContent("[Rules]\n"
+ "default=false");
+ QCOMPARE(parser.rules().size(), 1);
+
+ parser.setContent("[OtherSection]\n"
+ "default=false");
+ QCOMPARE(parser.rules().size(), 0);
+ }
+
+ void QLoggingRegistry_environment()
+ {
+ //
+ // Check whether QT_LOGGING_CONF is picked up from environment
+ //
+
+ qputenv("QT_LOGGING_CONF", QFINDTESTDATA("qtlogging.ini").toLocal8Bit());
+
+ QLoggingRegistry registry;
+ registry.init();
+
+ QCOMPARE(registry.apiRules.size(), 0);
+ QCOMPARE(registry.configRules.size(), 0);
+ QCOMPARE(registry.envRules.size(), 1);
+
+ QCOMPARE(registry.rules.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);
+ }
+
+ void QLoggingRegistry_config()
+ {
+ //
+ // Check whether QtProject/qtlogging.ini is loaded automatically
+ //
+
+ // first try to create a test file..
+ QString path = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
+ QVERIFY(!path.isEmpty());
+ QDir dir(path + "/QtProject");
+ if (!dir.exists())
+ QVERIFY(dir.mkpath(path + "/QtProject"));
+
+ QFile file(dir.absoluteFilePath("qtlogging.ini"));
+ QVERIFY(file.open(QFile::WriteOnly | QFile::Text));
+ QTextStream out(&file);
+ out << "[Rules]\n";
+ out << "Digia.*=false\n";
+ file.close();
+
+ QLoggingRegistry registry;
+ registry.init();
+ QCOMPARE(registry.configRules.size(), 1);
+
+ // remove file again
+ QVERIFY(file.remove());
+ }
+
+ void QLoggingRegistry_rulePriorities()
+ {
+ //
+ // Rules can stem from 3 sources:
+ // via QLoggingCategory::setFilterRules (API)
+ // via qtlogging.ini file in settings (Config)
+ // via QT_LOGGING_CONF environment variable (Env)
+ //
+ // Rules set by environment should get higher precedence than qtlogging.conf,
+ // than QLoggingCategory::setFilterRules
+ //
+
+ QLoggingCategory cat("Digia.Berlin");
+ QLoggingRegistry *registry = QLoggingRegistry::instance();
+
+ // empty all rules , check default
+ registry->rules.clear();
+ registry->apiRules.clear();
+ registry->configRules.clear();
+ registry->envRules.clear();
+ registry->updateRules();
+
+ QVERIFY(cat.isWarningEnabled());
+
+ // set Config rule
+ QLoggingSettingsParser parser;
+ parser.setContent("[Rules]\nDigia.*=false");
+ registry->configRules=parser.rules();
+ registry->updateRules();
+
+ QVERIFY(!cat.isWarningEnabled());
+
+ // set API rule, should overwrite API one
+ QLoggingCategory::setFilterRules("Digia.*=true");
+
+ QVERIFY(cat.isWarningEnabled());
+
+ // set Env rule, should overwrite Config one
+ parser.setContent("Digia.*=false");
+ registry->envRules=parser.rules();
+ registry->updateRules();
+
+ QVERIFY(!cat.isWarningEnabled());
+ }
+
+};
+
+QTEST_MAIN(tst_QLoggingRegistry)
+
+#include "tst_qloggingregistry.moc"
diff --git a/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp b/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp
index 157e42b447..a516b762f7 100644
--- a/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp
+++ b/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp
@@ -68,8 +68,8 @@ void tst_QNoDebug::noDebugOutput() const
qCDebug(cat) << "foo";
// qWarning still works, though
- QTest::ignoreMessage(QtWarningMsg, "bar ");
- QTest::ignoreMessage(QtWarningMsg, "custom-bar ");
+ QTest::ignoreMessage(QtWarningMsg, "bar");
+ QTest::ignoreMessage(QtWarningMsg, "custom-bar");
qWarning() << "bar";
qCWarning(cat) << "custom-bar";
}
@@ -79,7 +79,7 @@ void tst_QNoDebug::streaming() const
QDateTime dt(QDate(1,2,3),QTime(4,5,6));
QString debugString = dt.toString(QStringLiteral("yyyy-MM-dd HH:mm:ss.zzz t"))
+ QStringLiteral(" Qt::LocalTime");
- QTest::ignoreMessage(QtWarningMsg, qPrintable(QString::fromLatin1("QDateTime(\"%1\") ").arg(debugString)));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(QString::fromLatin1("QDateTime(\"%1\")").arg(debugString)));
qWarning() << dt;
}
diff --git a/tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro b/tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro
index 48fd2d0b69..8f77e46f74 100644
--- a/tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro
+++ b/tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro
@@ -2,6 +2,6 @@ SOURCES = main.cpp
CONFIG -= qt app_bundle
CONFIG += console
-win32:!win32-g++*:!equals(TEMPLATE_PREFIX, "vc"):QMAKE_CXXFLAGS += /GS-
+win32:!mingw:!equals(TEMPLATE_PREFIX, "vc"):QMAKE_CXXFLAGS += /GS-
DESTDIR = ./
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
index 37f224ff28..f5aa2c2412 100644
--- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
+++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
@@ -943,7 +943,7 @@ void tst_QProcess::hardExit()
void tst_QProcess::softExit()
{
QProcess proc;
-
+ QCOMPARE(proc.processId(), 0);
proc.start("testSoftExit/testSoftExit");
QVERIFY(proc.waitForStarted(10000));
@@ -951,6 +951,8 @@ void tst_QProcess::softExit()
QVERIFY(proc.waitForReadyRead(10000));
#endif
+ QVERIFY(proc.processId() > 0);
+
proc.terminate();
QVERIFY(proc.waitForFinished(10000));
diff --git a/tests/auto/corelib/io/qresourceengine/qresourceengine.pro b/tests/auto/corelib/io/qresourceengine/qresourceengine.pro
index b9e17f7418..b7606eb3fc 100644
--- a/tests/auto/corelib/io/qresourceengine/qresourceengine.pro
+++ b/tests/auto/corelib/io/qresourceengine/qresourceengine.pro
@@ -14,12 +14,5 @@ PRE_TARGETDEPS += $${runtime_resource.target}
TESTDATA += \
parentdir.txt \
testqrc/*
-
-# Special case needed for runtime_resource.rcc installation,
-# since it does not exist at qmake runtime.
-load(testcase) # to get value of target.path
-runtime_resource_install.CONFIG = no_check_exist
-runtime_resource_install.files = $$OUT_PWD/$${runtime_resource.target}
-runtime_resource_install.path = $${target.path}
-INSTALLS += runtime_resource_install
+GENERATED_TESTDATA = $${runtime_resource.target}
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
index c5a9b421ee..42c360f2d8 100644
--- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
+++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
@@ -119,7 +119,7 @@ private slots:
#if !defined(Q_OS_WIN) && !defined(QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER)
void dontReorderIniKeysNeedlessly();
#endif
-#if defined(Q_OS_WIN)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
void consistentRegistryStorage();
#endif
@@ -274,7 +274,7 @@ void tst_QSettings::init()
QSettings::setSystemIniPath(settingsPath("__system__"));
QSettings::setUserIniPath(settingsPath("__user__"));
-#if defined(Q_OS_WIN)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
QSettings("HKEY_CURRENT_USER\\Software\\software.org", QSettings::NativeFormat).clear();
QSettings("HKEY_LOCAL_MACHINE\\Software\\software.org", QSettings::NativeFormat).clear();
QSettings("HKEY_CURRENT_USER\\Software\\other.software.org", QSettings::NativeFormat).clear();
@@ -1496,7 +1496,7 @@ void tst_QSettings::sync()
// Now "some other app" will change other.software.org.ini
QString userConfDir = settingsPath("__user__") + QDir::separator();
-#if !defined(Q_OS_WINCE)
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
unlink((userConfDir + "other.software.org.ini").toLatin1());
rename((userConfDir + "software.org.ini").toLatin1(),
(userConfDir + "other.software.org.ini").toLatin1());
@@ -3197,7 +3197,7 @@ void tst_QSettings::recursionBug()
}
}
-#if defined(Q_OS_WIN)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
static DWORD readKeyType(HKEY handle, const QString &rSubKey)
{
diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
index 4503f6fcbc..7247b02498 100644
--- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
+++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
@@ -290,9 +290,9 @@ void tst_qstandardpaths::testDataLocation()
{
// On all platforms, DataLocation should be GenericDataLocation / organization name / app name
// This allows one app to access the data of another app.
- // Blackberry OS and Android are exceptions to this case, owing to the fact that
+ // Blackberry OS, Android and WinRT are an exception to this case, owing to the fact that
// applications are sandboxed.
-#if !defined(Q_OS_BLACKBERRY) && !defined(Q_OS_ANDROID)
+#if !defined(Q_OS_BLACKBERRY) && !defined(Q_OS_ANDROID) && !defined(Q_OS_WINRT)
const QString base = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::DataLocation), base + "/tst_qstandardpaths");
QCoreApplication::instance()->setOrganizationName("Qt");
@@ -336,6 +336,7 @@ void tst_qstandardpaths::testFindExecutable_data()
QTest::addColumn<QString>("needle");
QTest::addColumn<QString>("expected");
#ifdef Q_OS_WIN
+# ifndef Q_OS_WINRT
const QFileInfo cmdFi = QFileInfo(QDir::cleanPath(QString::fromLocal8Bit(qgetenv("COMSPEC"))));
const QString cmdPath = cmdFi.absoluteFilePath();
@@ -359,6 +360,7 @@ void tst_qstandardpaths::testFindExecutable_data()
QTest::newRow("win8-logo-nosuffix")
<< QString() << logo << logoPath;
}
+# endif // Q_OS_WINRT
#else
const QFileInfo shFi = findSh();
Q_ASSERT(shFi.exists());
diff --git a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
index 713d0c5c17..a6cc083d9c 100644
--- a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
+++ b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
@@ -257,7 +257,7 @@ void tst_QTemporaryDir::nonWritableCurrentDir()
void tst_QTemporaryDir::openOnRootDrives()
{
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
unsigned int lastErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS);
#endif
// If it's possible to create a file in the root directory, it
@@ -271,7 +271,7 @@ void tst_QTemporaryDir::openOnRootDrives()
QVERIFY(dir.isValid());
}
}
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
SetErrorMode(lastErrorMode);
#endif
}
diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
index 6eb6f83d2a..5ad798ae1f 100644
--- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
+++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
@@ -371,7 +371,7 @@ void tst_QTemporaryFile::resize()
void tst_QTemporaryFile::openOnRootDrives()
{
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
unsigned int lastErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS);
#endif
// If it's possible to create a file in the root directory, it
@@ -385,7 +385,7 @@ void tst_QTemporaryFile::openOnRootDrives()
QVERIFY(file.open());
}
}
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
SetErrorMode(lastErrorMode);
#endif
}
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp
index 12b9159bf2..92dbb96817 100644
--- a/tests/auto/corelib/io/qurl/tst_qurl.cpp
+++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp
@@ -169,6 +169,7 @@ private slots:
void fileName();
void isEmptyForEncodedUrl();
void toEncodedNotUsingUninitializedPath();
+ void emptyAuthorityRemovesExistingAuthority_data();
void emptyAuthorityRemovesExistingAuthority();
void acceptEmptyAuthoritySegments();
void lowercasesScheme();
@@ -3033,31 +3034,56 @@ void tst_QUrl::resolvedWithAbsoluteSchemes_data() const
<< QUrl::fromEncoded("http://andreas:hemmelig@www.vg.no/?my=query&your=query#yougotfragged");
}
+void tst_QUrl::emptyAuthorityRemovesExistingAuthority_data()
+{
+ QTest::addColumn<QString>("input");
+ QTest::addColumn<QString>("expected");
+ QTest::newRow("regular") << "foo://example.com/something" << "foo:/something";
+ QTest::newRow("empty") << "foo:///something" << "foo:/something";
+}
+
void tst_QUrl::emptyAuthorityRemovesExistingAuthority()
{
- QUrl url("http://example.com/something");
+ QFETCH(QString, input);
+ QFETCH(QString, expected);
+ QUrl url(input);
+ QUrl orig = url;
+
url.setAuthority(QString());
QCOMPARE(url.authority(), QString());
+ QVERIFY(url != orig);
+ QCOMPARE(url.toString(), expected);
+ QCOMPARE(url, QUrl(expected));
}
void tst_QUrl::acceptEmptyAuthoritySegments()
{
QCOMPARE(QUrl("remote://").toString(), QString::fromLatin1("remote://"));
- // Verify that foo:///bar is not mangled to foo:/bar
+ // Verify that foo:///bar is not mangled to foo:/bar nor vice-versa
QString foo_triple_bar("foo:///bar"), foo_uni_bar("foo:/bar");
- QCOMPARE(foo_triple_bar, QUrl(foo_triple_bar).toString());
- QCOMPARE(foo_triple_bar, QString::fromUtf8(QUrl(foo_triple_bar).toEncoded()));
+ QVERIFY(QUrl(foo_triple_bar) != QUrl(foo_uni_bar));
+
+ QCOMPARE(QUrl(foo_triple_bar).toString(), foo_triple_bar);
+ QCOMPARE(QUrl(foo_triple_bar).toEncoded(), foo_triple_bar.toLatin1());
+
+ QCOMPARE(QUrl(foo_uni_bar).toString(), foo_uni_bar);
+ QCOMPARE(QUrl(foo_uni_bar).toEncoded(), foo_uni_bar.toLatin1());
+
+ QCOMPARE(QUrl(foo_triple_bar, QUrl::StrictMode).toString(), foo_triple_bar);
+ QCOMPARE(QUrl(foo_triple_bar, QUrl::StrictMode).toEncoded(), foo_triple_bar.toLatin1());
+
+ QCOMPARE(QUrl(foo_uni_bar, QUrl::StrictMode).toString(), foo_uni_bar);
+ QCOMPARE(QUrl(foo_uni_bar, QUrl::StrictMode).toEncoded(), foo_uni_bar.toLatin1());
- QCOMPARE(foo_uni_bar, QUrl(foo_uni_bar).toString());
- QCOMPARE(foo_uni_bar, QString::fromUtf8(QUrl(foo_uni_bar).toEncoded()));
+ // However, file:/bar is the same as file:///bar
+ QString file_triple_bar("file:///bar"), file_uni_bar("file:/bar");
- QCOMPARE(foo_triple_bar, QUrl(foo_triple_bar, QUrl::StrictMode).toString());
- QCOMPARE(foo_triple_bar, QString::fromUtf8(QUrl(foo_triple_bar, QUrl::StrictMode).toEncoded()));
+ QVERIFY(QUrl(file_triple_bar) == QUrl(file_uni_bar));
- QCOMPARE(foo_uni_bar, QUrl(foo_uni_bar, QUrl::StrictMode).toString());
- QCOMPARE(foo_uni_bar, QString::fromUtf8(QUrl(foo_uni_bar, QUrl::StrictMode).toEncoded()));
+ QCOMPARE(QUrl(file_uni_bar).toString(), file_triple_bar);
+ QCOMPARE(QUrl(file_uni_bar, QUrl::StrictMode).toString(), file_triple_bar);
}
void tst_QUrl::effectiveTLDs_data()
@@ -3434,6 +3460,12 @@ void tst_QUrl::setComponents_data()
QTest::newRow("host-empty") << QUrl("foo://example.com/path")
<< int(Host) << "" << Tolerant << true
<< PrettyDecoded << QString() << "foo:///path";
+ QTest::newRow("authority-null") << QUrl("foo://example.com/path")
+ << int(Authority) << QString() << Tolerant << true
+ << PrettyDecoded << QString() << "foo:/path";
+ QTest::newRow("authority-empty") << QUrl("foo://example.com/path")
+ << int(Authority) << "" << Tolerant << true
+ << PrettyDecoded << QString() << "foo:///path";
QTest::newRow("query-null") << QUrl("http://example.com/?q=foo")
<< int(Query) << QString() << Tolerant << true
<< PrettyDecoded << QString() << "http://example.com/";
diff --git a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
index d3a8bcfd13..28519e1161 100644
--- a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
+++ b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
@@ -1040,7 +1040,7 @@ void tst_QUrlInternal::encodingRecodeInvalidUtf8()
output = QTest::currentDataTag();
if (!qt_urlRecode(output, input.constData(), input.constData() + input.length(), QUrl::FullyEncoded))
output += input;
- for (int i = strlen(QTest::currentDataTag()); i < output.length(); ++i) {
+ for (int i = int(strlen(QTest::currentDataTag())); i < output.length(); ++i) {
QVERIFY2(output.at(i).unicode() < 0x80 || output.at(i) == QChar::ReplacementCharacter,
qPrintable(QString("Character at i == %1 was U+%2").arg(i).arg(output.at(i).unicode(), 4, 16, QLatin1Char('0'))));
}
diff --git a/tests/auto/corelib/io/qwinoverlappedionotifier/tst_qwinoverlappedionotifier.cpp b/tests/auto/corelib/io/qwinoverlappedionotifier/tst_qwinoverlappedionotifier.cpp
index 0944f32443..8321f76bec 100644
--- a/tests/auto/corelib/io/qwinoverlappedionotifier/tst_qwinoverlappedionotifier.cpp
+++ b/tests/auto/corelib/io/qwinoverlappedionotifier/tst_qwinoverlappedionotifier.cpp
@@ -42,6 +42,7 @@
#include <QtTest/QtTest>
#include <private/qwinoverlappedionotifier_p.h>
#include <qbytearray.h>
+#include <qt_windows.h>
#ifndef PIPE_REJECT_REMOTE_CLIENTS
#define PIPE_REJECT_REMOTE_CLIENTS 0x08