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.pro6
-rw-r--r--tests/auto/corelib/io/largefile/tst_largefile.cpp4
-rw-r--r--tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp97
-rw-r--r--tests/auto/corelib/io/qbuffer/tst_qbuffer.cpp4
-rw-r--r--tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp66
-rw-r--r--tests/auto/corelib/io/qdebug/tst_qdebug.cpp69
-rw-r--r--tests/auto/corelib/io/qdir/testdir/dir/qrc_qdir.cpp4
-rw-r--r--tests/auto/corelib/io/qdir/testdir/dir/tst_qdir.cpp4
-rw-r--r--tests/auto/corelib/io/qdir/tst_qdir.cpp6
-rw-r--r--tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp4
-rw-r--r--tests/auto/corelib/io/qfile/stdinprocess/main.cpp4
-rw-r--r--tests/auto/corelib/io/qfile/test/test.pro9
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp16
-rw-r--r--tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp36
-rw-r--r--tests/auto/corelib/io/qfilesystementry/tst_qfilesystementry.cpp4
-rw-r--r--tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp4
-rw-r--r--tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp4
-rw-r--r--tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp4
-rw-r--r--tests/auto/corelib/io/qprocess/fileWriterProcess/main.cpp4
-rw-r--r--tests/auto/corelib/io/qprocess/testDetached/main.cpp4
-rw-r--r--tests/auto/corelib/io/qprocess/testExitCodes/main.cpp4
-rw-r--r--tests/auto/corelib/io/qprocess/testGuiProcess/main.cpp4
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessCrash/main.cpp4
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessDeadWhileReading/main.cpp4
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessEOF/main.cpp4
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessEcho/main.cpp4
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessEcho2/main.cpp4
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessEcho3/main.cpp4
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessEchoGui/main_win.cpp4
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessEnvironment/main.cpp4
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessLoopback/main.cpp4
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessNormal/main.cpp4
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessOutput/main.cpp4
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessSpacesArgs/main.cpp4
-rw-r--r--tests/auto/corelib/io/qprocess/testSetWorkingDirectory/main.cpp4
-rw-r--r--tests/auto/corelib/io/qprocess/testSoftExit/main_unix.cpp4
-rw-r--r--tests/auto/corelib/io/qprocess/testSoftExit/main_win.cpp4
-rw-r--r--tests/auto/corelib/io/qprocess/testSpaceInName/main.cpp4
-rw-r--r--tests/auto/corelib/io/qprocess/tst_qprocess.cpp31
-rw-r--r--tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp4
-rw-r--r--tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp4
-rw-r--r--tests/auto/corelib/io/qsettings/tst_qsettings.cpp4
-rw-r--r--tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp5
-rw-r--r--tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp7
-rw-r--r--tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp7
-rw-r--r--tests/auto/corelib/io/qtextstream/readAllStdinProcess/main.cpp4
-rw-r--r--tests/auto/corelib/io/qtextstream/readLineStdinProcess/main.cpp4
-rw-r--r--tests/auto/corelib/io/qtextstream/stdinProcess/main.cpp4
-rw-r--r--tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp19
-rw-r--r--tests/auto/corelib/io/qurl/idna-test.c4
-rw-r--r--tests/auto/corelib/io/qurl/tst_qurl.cpp157
-rw-r--r--tests/auto/corelib/io/qwinoverlappedionotifier/qwinoverlappedionotifier.pro4
-rw-r--r--tests/auto/corelib/io/qwinoverlappedionotifier/tst_qwinoverlappedionotifier.cpp212
53 files changed, 633 insertions, 262 deletions
diff --git a/tests/auto/corelib/io/io.pro b/tests/auto/corelib/io/io.pro
index ae0b4968b8..095aa7a77d 100644
--- a/tests/auto/corelib/io/io.pro
+++ b/tests/auto/corelib/io/io.pro
@@ -22,6 +22,12 @@ SUBDIRS=\
qtemporaryfile \
qtextstream \
qurl \
+ qwinoverlappedionotifier \
+
+!win32|wince* {
+ SUBDIRS -=\
+ qwinoverlappedionotifier
+}
!contains(QT_CONFIG, private_tests): SUBDIRS -= \
qfileinfo
diff --git a/tests/auto/corelib/io/largefile/tst_largefile.cpp b/tests/auto/corelib/io/largefile/tst_largefile.cpp
index ba2eced60a..e72960833f 100644
--- a/tests/auto/corelib/io/largefile/tst_largefile.cpp
+++ b/tests/auto/corelib/io/largefile/tst_largefile.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp b/tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp
index 1bffd63d1b..776ad4d0a7 100644
--- a/tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp
+++ b/tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the FOO module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -47,10 +47,13 @@
#include <QtCore/QSharedPointer>
#include <QtCore/QScopedPointer>
#include <QtCore/QHash>
+#include <QtCore/QDir>
+#include <QtCore/QDirIterator>
#include <QtTest/QTest>
#include <QtCore/QDebug>
+#include "../../../../shared/filesystem.h"
class tst_QAbstractFileEngine
: public QObject
@@ -65,6 +68,8 @@ private slots:
void fileIO_data();
void fileIO();
+ void mounting_data();
+ void mounting();
private:
QStringList filesForRemoval;
};
@@ -74,7 +79,7 @@ class ReferenceFileEngine
{
public:
ReferenceFileEngine(const QString &fileName)
- : fileName_(fileName)
+ : fileName_(QDir::cleanPath(fileName))
, position_(-1)
, openForRead_(false)
, openForWrite_(false)
@@ -491,6 +496,60 @@ private:
mutable QSharedPointer<File> openFile_;
};
+class MountingFileEngine : public QFSFileEngine
+{
+public:
+ class Iterator : public QAbstractFileEngineIterator
+ {
+ public:
+ Iterator(QDir::Filters filters, const QStringList &filterNames)
+ : QAbstractFileEngineIterator(filters, filterNames)
+ {
+ names.append("foo");
+ names.append("bar");
+ index = -1;
+ }
+ QString currentFileName() const
+ {
+ return names.at(index);
+ }
+ bool hasNext() const
+ {
+ return index < names.size() - 1;
+ }
+ QString next()
+ {
+ if (!hasNext())
+ return QString();
+ ++index;
+ return currentFilePath();
+ }
+ QStringList names;
+ int index;
+ };
+ MountingFileEngine(QString fileName)
+ : QFSFileEngine(fileName)
+ {
+ }
+ Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames)
+ {
+ return new Iterator(filters, filterNames);
+ }
+ FileFlags fileFlags(FileFlags type) const
+ {
+ if (fileName(DefaultName).endsWith(".tar")) {
+ FileFlags ret = QFSFileEngine::fileFlags(type);
+ //make this file in file system appear to be a directory
+ ret &= ~FileType;
+ ret |= DirectoryType;
+ return ret;
+ } else {
+ //file inside the archive
+ return ExistsFlag | FileType;
+ }
+ }
+};
+
QMutex ReferenceFileEngine::fileSystemMutex;
QHash<uint, QString> ReferenceFileEngine::fileSystemUsers, ReferenceFileEngine::fileSystemGroups;
QHash<QString, QSharedPointer<ReferenceFileEngine::File> > ReferenceFileEngine::fileSystem;
@@ -500,6 +559,8 @@ class FileEngineHandler
{
QAbstractFileEngine *create(const QString &fileName) const
{
+ if (fileName.endsWith(".tar") || fileName.contains(".tar/"))
+ return new MountingFileEngine(fileName);
if (fileName.startsWith("QFSFileEngine:"))
return new QFSFileEngine(fileName.mid(14));
if (fileName.startsWith("reference-file-engine:"))
@@ -803,6 +864,36 @@ void tst_QAbstractFileEngine::fileIO()
//
}
+void tst_QAbstractFileEngine::mounting_data()
+{
+ QTest::addColumn<QString>("fileName");
+ QTest::newRow("native") << "test.tar";
+ QTest::newRow("Forced QFSFileEngine") << "QFSFileEngine:test.tar";
+}
+
+void tst_QAbstractFileEngine::mounting()
+{
+ FileSystem fs;
+ QVERIFY(fs.createFile("test.tar"));
+ FileEngineHandler handler;
+
+ QFETCH(QString, fileName);
+
+ QVERIFY(QFileInfo(fileName).isDir());
+ QDir dir(fileName);
+ QCOMPARE(dir.entryList(), (QStringList() << "bar" << "foo"));
+ QDir dir2;
+ bool found = false;
+ foreach (QFileInfo info, dir2.entryInfoList()) {
+ if (info.fileName() == QLatin1String("test.tar")) {
+ QVERIFY(!found);
+ found = true;
+ QVERIFY(info.isDir());
+ }
+ }
+ QVERIFY(found);
+}
+
QTEST_APPLESS_MAIN(tst_QAbstractFileEngine)
#include "tst_qabstractfileengine.moc"
diff --git a/tests/auto/corelib/io/qbuffer/tst_qbuffer.cpp b/tests/auto/corelib/io/qbuffer/tst_qbuffer.cpp
index e2890d7891..bf62621bbc 100644
--- a/tests/auto/corelib/io/qbuffer/tst_qbuffer.cpp
+++ b/tests/auto/corelib/io/qbuffer/tst_qbuffer.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp
index d17bab3bc1..eb227625a7 100644
--- a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp
+++ b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -65,11 +65,6 @@ private slots:
void stream_bool_data();
void stream_bool();
- void stream_QBool_data();
- void stream_QBool();
-
- void stream_QBool_in_4_0();
-
void stream_QBitArray_data();
void stream_QBitArray();
@@ -193,7 +188,6 @@ private slots:
private:
void writebool(QDataStream *s);
- void writeQBool(QDataStream *s);
void writeQBitArray(QDataStream *s);
void writeQBrush(QDataStream *s);
void writeQColor(QDataStream *s);
@@ -221,7 +215,6 @@ private:
void writeQEasingCurve(QDataStream *s);
void readbool(QDataStream *s);
- void readQBool(QDataStream *s);
void readQBitArray(QDataStream *s);
void readQBrush(QDataStream *s);
void readQColor(QDataStream *s);
@@ -262,7 +255,8 @@ static int NColorRoles[] = {
QPalette::ToolTipText + 1, // Qt_4_4
QPalette::ToolTipText + 1, // Qt_4_5
QPalette::ToolTipText + 1, // Qt_4_6
- 0 // add the correct value for Qt_4_7 here later
+ QPalette::ToolTipText + 1, // Qt_5_0
+ 0 // add the correct value for Qt_5_1 here later
};
// Testing get/set functions
@@ -292,6 +286,7 @@ void tst_QDataStream::getSetCheck()
void tst_QDataStream::cleanupTestCase()
{
QFile::remove(QLatin1String("qdatastream.out"));
+ QFile::remove(QLatin1String("datastream.tmp"));
}
static int dataIndex(const QString &tag)
@@ -797,57 +792,6 @@ void tst_QDataStream::readbool(QDataStream *s)
// ************************************
-static QBool QBoolData(int index)
-{
- switch (index) {
- case 0: return QBool(true);
- case 1: return QBool(false);
- case 2: return QBool(bool(2));
- case 3: return QBool(bool(-1));
- case 4: return QBool(bool(127));
- }
-
- return QBool(false);
-}
-
-void tst_QDataStream::stream_QBool_data()
-{
- stream_data(5);
-}
-
-void tst_QDataStream::stream_QBool()
-{
- STREAM_IMPL(QBool);
-}
-
-void tst_QDataStream::writeQBool(QDataStream *s)
-{
- QBool d1 = QBoolData(dataIndex(QTest::currentDataTag()));
- *s << d1;
-}
-
-void tst_QDataStream::readQBool(QDataStream *s)
-{
- QBool expected = QBoolData(dataIndex(QTest::currentDataTag()));
-
- bool d1 = true;
- *s >> d1;
- QVERIFY(d1 == expected);
-}
-
-void tst_QDataStream::stream_QBool_in_4_0()
-{
- QByteArray byteArray;
- QDataStream out(&byteArray, QIODevice::WriteOnly);
-
- QString str("ABC");
- out << str.contains('A') << str.contains('Z');
-
- QCOMPARE(byteArray.size(), 2);
-}
-
-// ************************************
-
static void QBitArrayData(QBitArray *b, int index)
{
QString filler = "";
diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
index 535807bfc3..12f7e28a1d 100644
--- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
+++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,9 +51,10 @@ private slots:
void assignment() const;
void warningWithoutDebug() const;
void criticalWithoutDebug() const;
- void debugWithQBool() const;
+ void debugWithBool() const;
void veryLongWarningMessage() const;
void qDebugQStringRef() const;
+ void qDebugQLatin1String() const;
void defaultMessagehandler() const;
};
@@ -74,11 +75,17 @@ void tst_QDebug::assignment() const
static QtMsgType s_msgType;
static QByteArray s_msg;
+static QByteArray s_file;
+static int s_line;
+static QByteArray s_function;
-static void myMessageHandler(QtMsgType type, const char *msg)
+static void myMessageHandler(QtMsgType type, const QMessageLogContext &context, const char *msg)
{
s_msg = msg;
s_msgType = type;
+ s_file = context.file;
+ s_line = context.line;
+ s_function = context.function;
}
// Helper class to ensure that the testlib message handler gets
@@ -87,17 +94,17 @@ static void myMessageHandler(QtMsgType type, const char *msg)
class MessageHandlerSetter
{
public:
- MessageHandlerSetter(QtMsgHandler newMsgHandler)
- : oldMsgHandler(qInstallMsgHandler(newMsgHandler))
+ MessageHandlerSetter(QMessageHandler newMessageHandler)
+ : oldMessageHandler(qInstallMessageHandler(newMessageHandler))
{ }
~MessageHandlerSetter()
{
- qInstallMsgHandler(oldMsgHandler);
+ qInstallMessageHandler(oldMessageHandler);
}
private:
- QtMsgHandler oldMsgHandler;
+ QMessageHandler oldMessageHandler;
};
/*! \internal
@@ -107,8 +114,12 @@ void tst_QDebug::warningWithoutDebug() const
{
MessageHandlerSetter mhs(myMessageHandler);
{ qWarning() << "A qWarning() message"; }
+ QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO;
QCOMPARE(s_msgType, QtWarningMsg);
QCOMPARE(QString::fromLatin1(s_msg.data()), QString::fromLatin1("A qWarning() message "));
+ QCOMPARE(QString::fromLatin1(s_file), file);
+ QCOMPARE(s_line, line);
+ QCOMPARE(QString::fromLatin1(s_function), function);
}
/*! \internal
@@ -118,16 +129,24 @@ void tst_QDebug::criticalWithoutDebug() const
{
MessageHandlerSetter mhs(myMessageHandler);
{ qCritical() << "A qCritical() message"; }
+ QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO;
QCOMPARE(s_msgType, QtCriticalMsg);
QCOMPARE(QString::fromLatin1(s_msg), QString::fromLatin1("A qCritical() message "));
+ QCOMPARE(QString::fromLatin1(s_file), file);
+ QCOMPARE(s_line, line);
+ QCOMPARE(QString::fromLatin1(s_function), function);
}
-void tst_QDebug::debugWithQBool() const
+void tst_QDebug::debugWithBool() const
{
MessageHandlerSetter mhs(myMessageHandler);
- { qDebug() << QBool(false) << QBool(true); }
+ { qDebug() << false << true; }
+ QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO;
QCOMPARE(s_msgType, QtDebugMsg);
QCOMPARE(QString::fromLatin1(s_msg), QString::fromLatin1("false true "));
+ QCOMPARE(QString::fromLatin1(s_file), file);
+ QCOMPARE(s_line, line);
+ QCOMPARE(QString::fromLatin1(s_function), function);
}
void tst_QDebug::veryLongWarningMessage() const
@@ -140,8 +159,12 @@ void tst_QDebug::veryLongWarningMessage() const
test.append(part);
qWarning("Test output:\n%s\nend", qPrintable(test));
}
+ QString file = __FILE__; int line = __LINE__ - 2; QString function = Q_FUNC_INFO;
QCOMPARE(s_msgType, QtWarningMsg);
QCOMPARE(QString::fromLatin1(s_msg), QString::fromLatin1("Test output:\n")+test+QString::fromLatin1("\nend"));
+ QCOMPARE(QString::fromLatin1(s_file), file);
+ QCOMPARE(s_line, line);
+ QCOMPARE(QString::fromLatin1(s_function), function);
}
void tst_QDebug::qDebugQStringRef() const
@@ -153,8 +176,12 @@ void tst_QDebug::qDebugQStringRef() const
MessageHandlerSetter mhs(myMessageHandler);
{ qDebug() << inRef; }
+ QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO;
QCOMPARE(s_msgType, QtDebugMsg);
QCOMPARE(QString::fromLatin1(s_msg), QString::fromLatin1("\"input\" "));
+ QCOMPARE(QString::fromLatin1(s_file), file);
+ QCOMPARE(s_line, line);
+ QCOMPARE(QString::fromLatin1(s_function), function);
}
/* Use a null QStringRef. */
@@ -163,19 +190,35 @@ void tst_QDebug::qDebugQStringRef() const
MessageHandlerSetter mhs(myMessageHandler);
{ qDebug() << inRef; }
+ QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO;
QCOMPARE(s_msgType, QtDebugMsg);
QCOMPARE(QString::fromLatin1(s_msg), QString::fromLatin1("\"\" "));
+ QCOMPARE(QString::fromLatin1(s_file), file);
+ QCOMPARE(s_line, line);
+ QCOMPARE(QString::fromLatin1(s_function), function);
}
}
+void tst_QDebug::qDebugQLatin1String() const
+{
+ MessageHandlerSetter mhs(myMessageHandler);
+ { qDebug() << QLatin1String("foo") << QLatin1String("") << QLatin1String("barbaz", 3); }
+ QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO;
+ QCOMPARE(s_msgType, QtDebugMsg);
+ QCOMPARE(QString::fromLatin1(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::defaultMessagehandler() const
{
MessageHandlerSetter mhs(0);
- QtMsgHandler defaultMessageHandler1 = qInstallMsgHandler(0);
- QtMsgHandler defaultMessageHandler2 = qInstallMsgHandler(myMessageHandler);
+ QMessageHandler defaultMessageHandler1 = qInstallMessageHandler(0);
+ QMessageHandler defaultMessageHandler2 = qInstallMessageHandler(myMessageHandler);
bool same = (*defaultMessageHandler1 == *defaultMessageHandler2);
QVERIFY(same);
- QtMsgHandler messageHandler = qInstallMsgHandler(0);
+ QMessageHandler messageHandler = qInstallMessageHandler(0);
same = (*messageHandler == *myMessageHandler);
QVERIFY(same);
}
diff --git a/tests/auto/corelib/io/qdir/testdir/dir/qrc_qdir.cpp b/tests/auto/corelib/io/qdir/testdir/dir/qrc_qdir.cpp
index 01cbc13d40..4d3d8e6f45 100644
--- a/tests/auto/corelib/io/qdir/testdir/dir/qrc_qdir.cpp
+++ b/tests/auto/corelib/io/qdir/testdir/dir/qrc_qdir.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qdir/testdir/dir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/testdir/dir/tst_qdir.cpp
index 01cbc13d40..4d3d8e6f45 100644
--- a/tests/auto/corelib/io/qdir/testdir/dir/tst_qdir.cpp
+++ b/tests/auto/corelib/io/qdir/testdir/dir/tst_qdir.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp
index 1f4e05d0cd..f1c9015092 100644
--- a/tests/auto/corelib/io/qdir/tst_qdir.cpp
+++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -1848,8 +1848,6 @@ void tst_QDir::equalityOperator_data()
//need a path in the root directory that is unlikely to be a symbolic link.
#if defined (Q_OS_WIN)
QString pathinroot("c:/windows/..");
-#elif defined (Q_OS_SYMBIAN)
- QString pathinroot("c:/data/..");
#else
QString pathinroot("/sbin/..");
#endif
diff --git a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp
index 3b3b2b5a04..ad61db51d6 100644
--- a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp
+++ b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qfile/stdinprocess/main.cpp b/tests/auto/corelib/io/qfile/stdinprocess/main.cpp
index 14cb28af6b..6698440b70 100644
--- a/tests/auto/corelib/io/qfile/stdinprocess/main.cpp
+++ b/tests/auto/corelib/io/qfile/stdinprocess/main.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qfile/test/test.pro b/tests/auto/corelib/io/qfile/test/test.pro
index 2f1e50010c..2611ff39bd 100644
--- a/tests/auto/corelib/io/qfile/test/test.pro
+++ b/tests/auto/corelib/io/qfile/test/test.pro
@@ -9,13 +9,6 @@ TESTDATA += ../dosfile.txt ../noendofline.txt ../testfile.txt \
../Makefile ../forCopying.txt ../forRenaming.txt \
../resources/file1.ext1
-win32 {
- CONFIG(debug, debug|release) {
- TARGET = ../../debug/tst_qfile
- } else {
- TARGET = ../../release/tst_qfile
- }
- LIBS+=-lole32 -luuid
-}
+win32: LIBS+=-lole32 -luuid
mac*:CONFIG+=insignificant_test
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp
index 0549fe32f0..00e45354ba 100644
--- a/tests/auto/corelib/io/qfile/tst_qfile.cpp
+++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -343,9 +343,9 @@ void tst_QFile::cleanup()
void tst_QFile::initTestCase()
{
- // chdir to testdata directory and use relative paths.
- QString testdata_dir = QFileInfo(QFINDTESTDATA("testfile.txt")).absolutePath();
- QVERIFY2(QDir::setCurrent(testdata_dir), qPrintable("Could not chdir to " + testdata_dir));
+ QString workingDir = QFileInfo(QFINDTESTDATA("stdinprocess")).absolutePath();
+ QVERIFY2(!workingDir.isEmpty(), qPrintable("Could not find working directory!"));
+ QVERIFY2(QDir::setCurrent(workingDir), qPrintable("Could not chdir to " + workingDir));
QFile::remove("noreadfile");
@@ -832,7 +832,7 @@ void tst_QFile::readAllStdin()
QByteArray lotsOfData(1024, '@'); // 10 megs
QProcess process;
- process.start(QFINDTESTDATA("stdinprocess/stdinprocess")+" all");
+ process.start("stdinprocess/stdinprocess all");
QVERIFY( process.waitForStarted() );
for (int i = 0; i < 5; ++i) {
QTest::qWait(1000);
@@ -867,7 +867,7 @@ void tst_QFile::readLineStdin()
for (int i = 0; i < 2; ++i) {
QProcess process;
- process.start((QFINDTESTDATA("stdinprocess/stdinprocess")+QString(" line %1").arg(i)), QIODevice::Text | QIODevice::ReadWrite);
+ process.start((QString("stdinprocess/stdinprocess line %1").arg(i)), QIODevice::Text | QIODevice::ReadWrite);
for (int i = 0; i < 5; ++i) {
QTest::qWait(1000);
process.write(lotsOfData);
@@ -901,7 +901,7 @@ void tst_QFile::readLineStdin_lineByLine()
#else
for (int i = 0; i < 2; ++i) {
QProcess process;
- process.start(QFINDTESTDATA("stdinprocess/stdinprocess")+ QString(" line %1").arg(i), QIODevice::Text | QIODevice::ReadWrite);
+ process.start(QString("stdinprocess/stdinprocess line %1").arg(i), QIODevice::Text | QIODevice::ReadWrite);
QVERIFY(process.waitForStarted());
for (int j = 0; j < 3; ++j) {
diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
index 5764cee66d..7b80152b62 100644
--- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -1028,6 +1028,19 @@ 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
+ HKEY key;
+ if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\FileSystem",
+ 0, KEY_READ, &key)) {
+ DWORD disabledAccessTimes = 0;
+ DWORD size = sizeof(DWORD);
+ LONG error = RegQueryValueEx(key, L"NtfsDisableLastAccessUpdate"
+ , NULL, NULL, (LPBYTE)&disabledAccessTimes, &size);
+ if (ERROR_SUCCESS == error && disabledAccessTimes)
+ QEXPECT_FAIL("", "File access times are disabled in windows registry (this is the default setting)", Continue);
+ RegCloseKey(key);
+ }
+#endif
#ifdef Q_OS_WINCE
QEXPECT_FAIL("simple", "WinCE only stores date of access data, not the time", Continue);
#endif
@@ -1362,7 +1375,7 @@ void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data()
QString junction = "junction_pwd";
FileSystem::createNtfsJunction(target, junction);
QFileInfo targetInfo(target);
- QTest::newRow("junction_pwd") << junction << true << targetInfo.absoluteFilePath() << targetInfo.canonicalFilePath();
+ QTest::newRow("junction_pwd") << junction << false << QString() << QString();
QFileInfo fileInJunction(targetInfo.absoluteFilePath().append("/file"));
QFile file(fileInJunction.absoluteFilePath());
@@ -1375,7 +1388,7 @@ void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data()
junction = "junction_root";
FileSystem::createNtfsJunction(target, junction);
targetInfo.setFile(target);
- QTest::newRow("junction_root") << junction << true << targetInfo.absoluteFilePath() << targetInfo.canonicalFilePath();
+ QTest::newRow("junction_root") << junction << false << QString() << QString();
//Mountpoint
typedef BOOLEAN (WINAPI *PtrGetVolumeNameForVolumeMountPointW)(LPCWSTR, LPWSTR, DWORD);
@@ -1390,7 +1403,7 @@ void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data()
junction = "mountpoint";
rootVolume.replace("\\\\?\\","\\??\\");
FileSystem::createNtfsJunction(rootVolume, junction);
- QTest::newRow("mountpoint") << junction << true << QDir::fromNativeSeparators(rootPath) << QDir::rootPath();
+ QTest::newRow("mountpoint") << junction << false << QString() << QString();
}
}
@@ -1403,8 +1416,10 @@ void tst_QFileInfo::ntfsJunctionPointsAndSymlinks()
QFileInfo fi(path);
QCOMPARE(fi.isSymLink(), isSymLink);
- QCOMPARE(fi.symLinkTarget(), linkTarget);
- QCOMPARE(fi.canonicalFilePath(), canonicalFilePath);
+ if (isSymLink) {
+ QCOMPARE(fi.symLinkTarget(), linkTarget);
+ QCOMPARE(fi.canonicalFilePath(), canonicalFilePath);
+ }
}
void tst_QFileInfo::brokenShortcut()
@@ -1632,6 +1647,12 @@ BOOL IsUserAdmin()
}
#endif
+#if defined(Q_OS_WIN)
+QT_BEGIN_NAMESPACE
+extern Q_CORE_EXPORT int qt_ntfs_permission_lookup;
+QT_END_NAMESPACE
+#endif
+
void tst_QFileInfo::owner()
{
QString userName;
@@ -1672,7 +1693,6 @@ void tst_QFileInfo::owner()
NetApiBufferFree(pBuf);
}
}
- extern Q_CORE_EXPORT int qt_ntfs_permission_lookup;
qt_ntfs_permission_lookup = 1;
#endif
if (userName.isEmpty())
diff --git a/tests/auto/corelib/io/qfilesystementry/tst_qfilesystementry.cpp b/tests/auto/corelib/io/qfilesystementry/tst_qfilesystementry.cpp
index cc75801638..fe2e30a95c 100644
--- a/tests/auto/corelib/io/qfilesystementry/tst_qfilesystementry.cpp
+++ b/tests/auto/corelib/io/qfilesystementry/tst_qfilesystementry.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
index 05b2539182..5e5a99f937 100644
--- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
+++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp
index b1c02a6c02..07a1fff993 100644
--- a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp
+++ b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp b/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp
index bca4d55037..0eea94f5d9 100644
--- a/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp
+++ b/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qprocess/fileWriterProcess/main.cpp b/tests/auto/corelib/io/qprocess/fileWriterProcess/main.cpp
index 5851ffe3da..5edb5489f7 100644
--- a/tests/auto/corelib/io/qprocess/fileWriterProcess/main.cpp
+++ b/tests/auto/corelib/io/qprocess/fileWriterProcess/main.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qprocess/testDetached/main.cpp b/tests/auto/corelib/io/qprocess/testDetached/main.cpp
index bcf237f488..c1231d3c71 100644
--- a/tests/auto/corelib/io/qprocess/testDetached/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testDetached/main.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qprocess/testExitCodes/main.cpp b/tests/auto/corelib/io/qprocess/testExitCodes/main.cpp
index 1475b3354d..ad8e69cad9 100644
--- a/tests/auto/corelib/io/qprocess/testExitCodes/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testExitCodes/main.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qprocess/testGuiProcess/main.cpp b/tests/auto/corelib/io/qprocess/testGuiProcess/main.cpp
index c9e5d2e6a5..e4fba49090 100644
--- a/tests/auto/corelib/io/qprocess/testGuiProcess/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testGuiProcess/main.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qprocess/testProcessCrash/main.cpp b/tests/auto/corelib/io/qprocess/testProcessCrash/main.cpp
index b7c0511d77..cb675b7369 100644
--- a/tests/auto/corelib/io/qprocess/testProcessCrash/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessCrash/main.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qprocess/testProcessDeadWhileReading/main.cpp b/tests/auto/corelib/io/qprocess/testProcessDeadWhileReading/main.cpp
index 97d9208e19..cf33f22bc6 100644
--- a/tests/auto/corelib/io/qprocess/testProcessDeadWhileReading/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessDeadWhileReading/main.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qprocess/testProcessEOF/main.cpp b/tests/auto/corelib/io/qprocess/testProcessEOF/main.cpp
index bf3d190630..ad1ebfc5f2 100644
--- a/tests/auto/corelib/io/qprocess/testProcessEOF/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessEOF/main.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qprocess/testProcessEcho/main.cpp b/tests/auto/corelib/io/qprocess/testProcessEcho/main.cpp
index 0c915918e4..872ed4fad4 100644
--- a/tests/auto/corelib/io/qprocess/testProcessEcho/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessEcho/main.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qprocess/testProcessEcho2/main.cpp b/tests/auto/corelib/io/qprocess/testProcessEcho2/main.cpp
index 8f3bd70a3a..0578f4794f 100644
--- a/tests/auto/corelib/io/qprocess/testProcessEcho2/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessEcho2/main.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qprocess/testProcessEcho3/main.cpp b/tests/auto/corelib/io/qprocess/testProcessEcho3/main.cpp
index c5eb4df307..bfcc48832e 100644
--- a/tests/auto/corelib/io/qprocess/testProcessEcho3/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessEcho3/main.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qprocess/testProcessEchoGui/main_win.cpp b/tests/auto/corelib/io/qprocess/testProcessEchoGui/main_win.cpp
index 877b3c6175..a8a17b6951 100644
--- a/tests/auto/corelib/io/qprocess/testProcessEchoGui/main_win.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessEchoGui/main_win.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qprocess/testProcessEnvironment/main.cpp b/tests/auto/corelib/io/qprocess/testProcessEnvironment/main.cpp
index 146b61af0e..eab1ebac17 100644
--- a/tests/auto/corelib/io/qprocess/testProcessEnvironment/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessEnvironment/main.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qprocess/testProcessLoopback/main.cpp b/tests/auto/corelib/io/qprocess/testProcessLoopback/main.cpp
index 78973f9f12..8b886ba5de 100644
--- a/tests/auto/corelib/io/qprocess/testProcessLoopback/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessLoopback/main.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qprocess/testProcessNormal/main.cpp b/tests/auto/corelib/io/qprocess/testProcessNormal/main.cpp
index 4fc8ea197c..b8b85730a8 100644
--- a/tests/auto/corelib/io/qprocess/testProcessNormal/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessNormal/main.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qprocess/testProcessOutput/main.cpp b/tests/auto/corelib/io/qprocess/testProcessOutput/main.cpp
index 5284607e9f..fa2b60d542 100644
--- a/tests/auto/corelib/io/qprocess/testProcessOutput/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessOutput/main.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/main.cpp b/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/main.cpp
index 57fb68e841..d76e3054a3 100644
--- a/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/main.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qprocess/testSetWorkingDirectory/main.cpp b/tests/auto/corelib/io/qprocess/testSetWorkingDirectory/main.cpp
index 6ce8892354..72af4df489 100644
--- a/tests/auto/corelib/io/qprocess/testSetWorkingDirectory/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testSetWorkingDirectory/main.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qprocess/testSoftExit/main_unix.cpp b/tests/auto/corelib/io/qprocess/testSoftExit/main_unix.cpp
index fa368489d6..ef02de269f 100644
--- a/tests/auto/corelib/io/qprocess/testSoftExit/main_unix.cpp
+++ b/tests/auto/corelib/io/qprocess/testSoftExit/main_unix.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qprocess/testSoftExit/main_win.cpp b/tests/auto/corelib/io/qprocess/testSoftExit/main_win.cpp
index 87ba12c008..e37fba6099 100644
--- a/tests/auto/corelib/io/qprocess/testSoftExit/main_win.cpp
+++ b/tests/auto/corelib/io/qprocess/testSoftExit/main_win.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qprocess/testSpaceInName/main.cpp b/tests/auto/corelib/io/qprocess/testSpaceInName/main.cpp
index d42b8ed083..75862c682e 100644
--- a/tests/auto/corelib/io/qprocess/testSpaceInName/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testSpaceInName/main.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
index e16e00de91..c3c4607119 100644
--- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
+++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -1000,9 +1000,21 @@ public:
}
}
+ void writeAfterStart(const char *buf, int count)
+ {
+ dataToWrite = QByteArray(buf, count);
+ }
+
+ void start(const QString &program)
+ {
+ QProcess::start(program);
+ writePendingData();
+ }
+
public slots:
void terminateSlot()
{
+ writePendingData(); // In cases 3 and 4 we haven't written the data yet.
if (killing || (n == 4 && state() != Running)) {
// Don't try to kill the process before it is running - that can
// be hazardous, as the actual child process might not be running
@@ -1025,8 +1037,18 @@ public slots:
}
private:
+ void writePendingData()
+ {
+ if (!dataToWrite.isEmpty()) {
+ write(dataToWrite);
+ dataToWrite.clear();
+ }
+ }
+
+private:
int n;
bool killing;
+ QByteArray dataToWrite;
};
//-----------------------------------------------------------------------------
@@ -1049,11 +1071,10 @@ void tst_QProcess::softExitInSlots()
for (int i = 0; i < 5; ++i) {
SoftExitProcess proc(i);
+ proc.writeAfterStart("OLEBOLE", 8); // include the \0
proc.start(appName);
- proc.write("OLEBOLE", 8); // include the \0
- QTestEventLoop::instance().enterLoop(10);
+ QTRY_VERIFY(proc.waitedForFinished);
QCOMPARE(proc.state(), QProcess::NotRunning);
- QVERIFY(proc.waitedForFinished);
}
}
diff --git a/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp b/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp
index 50579f0712..15eb7d3c48 100644
--- a/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp
+++ b/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp
index 539f49fa97..fa72083dcc 100644
--- a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp
+++ b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
index 87f5b37e14..0d6443c5ac 100644
--- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
+++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
index 1820d66496..1e288e2418 100644
--- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
+++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -142,6 +142,7 @@ void tst_qstandardpaths::testLocateAll()
setCustomLocations();
const QStringList allFiles = QStandardPaths::locateAll(QStandardPaths::ConfigLocation, "qstandardpaths.pro");
+ QVERIFY2(allFiles.count() > 0, "qstandardpaths.pro not found in config locations!");
QCOMPARE(allFiles.first(), QString(m_thisDir + QString::fromLatin1("/qstandardpaths.pro")));
#endif
}
diff --git a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
index 86aa071410..46d2fa2bde 100644
--- a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
+++ b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -228,6 +228,9 @@ void tst_QTemporaryDir::autoRemove()
void tst_QTemporaryDir::nonWritableCurrentDir()
{
#ifdef Q_OS_UNIX
+ if (::geteuid() == 0)
+ QSKIP("not valid running this test as root");
+
struct ChdirOnReturn
{
ChdirOnReturn(const QString& d) : dir(d) {}
diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
index 4c2e3f211b..cda29fdf0b 100644
--- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
+++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -256,6 +256,9 @@ void tst_QTemporaryFile::autoRemove()
void tst_QTemporaryFile::nonWritableCurrentDir()
{
#ifdef Q_OS_UNIX
+ if (::geteuid() == 0)
+ QSKIP("not valid running this test as root");
+
struct ChdirOnReturn
{
ChdirOnReturn(const QString& d) : dir(d) {}
diff --git a/tests/auto/corelib/io/qtextstream/readAllStdinProcess/main.cpp b/tests/auto/corelib/io/qtextstream/readAllStdinProcess/main.cpp
index a33b6759b4..282ec22013 100644
--- a/tests/auto/corelib/io/qtextstream/readAllStdinProcess/main.cpp
+++ b/tests/auto/corelib/io/qtextstream/readAllStdinProcess/main.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qtextstream/readLineStdinProcess/main.cpp b/tests/auto/corelib/io/qtextstream/readLineStdinProcess/main.cpp
index e561fc886f..174a8368fe 100644
--- a/tests/auto/corelib/io/qtextstream/readLineStdinProcess/main.cpp
+++ b/tests/auto/corelib/io/qtextstream/readLineStdinProcess/main.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qtextstream/stdinProcess/main.cpp b/tests/auto/corelib/io/qtextstream/stdinProcess/main.cpp
index 7fcfd6d53b..dfdd431040 100644
--- a/tests/auto/corelib/io/qtextstream/stdinProcess/main.cpp
+++ b/tests/auto/corelib/io/qtextstream/stdinProcess/main.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
index 6b6ac013bd..01aecc2a21 100644
--- a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
+++ b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -170,6 +170,7 @@ private slots:
// text write operators
void string_write_operator_ToDevice_data();
void string_write_operator_ToDevice();
+ void latin1String_write_operator_ToDevice();
// other
void skipWhiteSpace_data();
@@ -2384,6 +2385,20 @@ void tst_QTextStream::string_write_operator_ToDevice()
}
}
+void tst_QTextStream::latin1String_write_operator_ToDevice()
+{
+ QBuffer buf;
+ buf.open(QBuffer::WriteOnly);
+ QTextStream stream(&buf);
+ stream.setCodec(QTextCodec::codecForName("ISO-8859-1"));
+ stream.setAutoDetectUnicode(true);
+
+ stream << QLatin1String("No explicit length");
+ stream << QLatin1String("Explicit length - ignore this part", 15);
+ stream.flush();
+ QCOMPARE(buf.buffer().constData(), "No explicit lengthExplicit length");
+}
+
// ------------------------------------------------------------------------------
void tst_QTextStream::useCase1()
{
diff --git a/tests/auto/corelib/io/qurl/idna-test.c b/tests/auto/corelib/io/qurl/idna-test.c
index 40538dfb65..3aabaad03f 100644
--- a/tests/auto/corelib/io/qurl/idna-test.c
+++ b/tests/auto/corelib/io/qurl/idna-test.c
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp
index f0b6429089..611847852f 100644
--- a/tests/auto/corelib/io/qurl/tst_qurl.cpp
+++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -81,6 +81,8 @@ private slots:
void effectiveTLDs();
void getSetCheck();
void constructing();
+ void hashInPath();
+ void unc();
void assignment();
void comparison();
void copying();
@@ -134,6 +136,7 @@ private slots:
void toPercentEncoding();
void isRelative_data();
void isRelative();
+ void setQueryItems();
void queryItems();
void hasQuery_data();
void hasQuery();
@@ -242,35 +245,6 @@ void tst_QUrl::constructing()
QCOMPARE(url.port(), -1);
QCOMPARE(url.toString(), QString());
- QList<QPair<QString, QString> > query;
- query += qMakePair(QString("type"), QString("login"));
- query += qMakePair(QString("name"), QString("åge nissemannsen"));
- query += qMakePair(QString("ole&du"), QString("anne+jørgen=sant"));
- query += qMakePair(QString("prosent"), QString("%"));
- url.setQueryItems(query);
- QVERIFY(!url.isEmpty());
-
- QCOMPARE(url.encodedQuery().constData(),
- QByteArray("type=login&name=%C3%A5ge%20nissemannsen&ole%26du="
- "anne+j%C3%B8rgen%3Dsant&prosent=%25").constData());
-
- url.setQueryDelimiters('>', '/');
- url.setQueryItems(query);
-
- QCOMPARE(url.encodedQuery(),
- QByteArray("type>login/name>%C3%A5ge%20nissemannsen/ole&du>"
- "anne+j%C3%B8rgen=sant/prosent>%25"));
-
- url.setFragment(QString::fromLatin1("top"));
- QCOMPARE(url.fragment(), QString::fromLatin1("top"));
-
- url.setScheme("http");
- url.setHost("qt.nokia.com");
-
- QCOMPARE(url.toString(),
- QString::fromLatin1("http://qt.nokia.com?type>login/name>åge nissemannsen"
- "/ole&du>anne+jørgen=sant/prosent>%#top"));
-
QUrl justHost("qt.nokia.com");
QVERIFY(!justHost.isEmpty());
QVERIFY(justHost.host().isEmpty());
@@ -279,16 +253,22 @@ void tst_QUrl::constructing()
QUrl hostWithSlashes("//qt.nokia.com");
QVERIFY(hostWithSlashes.path().isEmpty());
QCOMPARE(hostWithSlashes.host(), QString::fromLatin1("qt.nokia.com"));
+}
-
+void tst_QUrl::hashInPath()
+{
QUrl withHashInPath;
withHashInPath.setPath(QString::fromLatin1("hi#mum.txt"));
QCOMPARE(withHashInPath.path(), QString::fromLatin1("hi#mum.txt"));
QCOMPARE(withHashInPath.toEncoded(), QByteArray("hi%23mum.txt"));
+ QCOMPARE(withHashInPath.toString(), QString("hi%23mum.txt"));
+
QUrl fromHashInPath = QUrl::fromEncoded(withHashInPath.toEncoded());
QVERIFY(withHashInPath == fromHashInPath);
+}
-
+void tst_QUrl::unc()
+{
QUrl buildUNC;
buildUNC.setScheme(QString::fromLatin1("file"));
buildUNC.setHost(QString::fromLatin1("somehost"));
@@ -375,7 +355,7 @@ void tst_QUrl::setUrl()
{
QUrl url("hTTp://www.foo.bar:80");
QVERIFY(url.isValid());
- QCOMPARE(url.scheme(), QString::fromLatin1("hTTp"));
+ QCOMPARE(url.scheme(), QString::fromLatin1("http"));
QCOMPARE(url.path(), QString());
QVERIFY(url.encodedQuery().isEmpty());
QVERIFY(url.userInfo().isEmpty());
@@ -385,7 +365,7 @@ void tst_QUrl::setUrl()
QCOMPARE(url.port(), 80);
QUrl url2("//www1.foo.bar");
- QCOMPARE(url.resolved(url2).toString(), QString::fromLatin1("hTTp://www1.foo.bar"));
+ QCOMPARE(url.resolved(url2).toString(), QString::fromLatin1("http://www1.foo.bar"));
}
{
@@ -544,13 +524,11 @@ void tst_QUrl::setUrl()
}
{
- QUrl notPretty;
- notPretty.setEncodedUrl("http://ferret.lmh.ox.ac.uk/%7Ekdecvs/");
+ QUrl notPretty("http://ferret.lmh.ox.ac.uk/%7Ekdecvs/");
QVERIFY(notPretty.isValid());
QCOMPARE(notPretty.toString(), QString::fromLatin1("http://ferret.lmh.ox.ac.uk/~kdecvs/"));
- QUrl notPretty2;
- notPretty2.setEncodedUrl("file:/home/test/directory%20with%20spaces");
+ QUrl notPretty2("file:/home/test/directory%20with%20spaces");
QVERIFY(notPretty2.isValid());
QCOMPARE(notPretty2.toString(), QString::fromLatin1("file:///home/test/directory with spaces"));
@@ -564,7 +542,7 @@ void tst_QUrl::setUrl()
QCOMPARE(url15581.toEncoded().constData(), QByteArray("http://alain.knaff.linux.lu/bug-reports/kde/spaces%20in%20url.html").constData());
QUrl url15582("http://alain.knaff.linux.lu/bug-reports/kde/percentage%in%url.html");
- QCOMPARE(url15582.toString(), QString::fromLatin1("http://alain.knaff.linux.lu/bug-reports/kde/percentage%in%url.html"));
+ QCOMPARE(url15582.toString(), QString::fromLatin1("http://alain.knaff.linux.lu/bug-reports/kde/percentage%25in%25url.html"));
QCOMPARE(url15582.toEncoded(), QByteArray("http://alain.knaff.linux.lu/bug-reports/kde/percentage%25in%25url.html"));
}
@@ -577,8 +555,7 @@ void tst_QUrl::setUrl()
charles.setPath("/home/charles/foo%20moo");
QCOMPARE(charles.path(), QString::fromLatin1("/home/charles/foo%20moo"));
- QUrl charles2;
- charles2.setEncodedUrl("file:/home/charles/foo%20moo");
+ QUrl charles2("file:/home/charles/foo%20moo");
QCOMPARE(charles2.path(), QString::fromLatin1("/home/charles/foo moo"));
}
@@ -642,8 +619,7 @@ void tst_QUrl::setUrl()
}
{
- QUrl url;
- url.setEncodedUrl("data:text/javascript,d5%20%3D%20'five\\u0027s'%3B");
+ QUrl url("data:text/javascript,d5%20%3D%20'five\\u0027s'%3B");
QVERIFY(url.isValid());
QCOMPARE(url.scheme(), QString("data"));
QCOMPARE(url.host(), QString());
@@ -665,11 +641,11 @@ void tst_QUrl::i18n_data()
QTest::addColumn<QString>("input");
QTest::addColumn<QByteArray>("punyOutput");
- QTest::newRow("øl") << QString::fromLatin1("http://ole:passord@www.øl.no/index.html?ole=æsemann&ilder gud=hei#top")
- << QByteArray("http://ole:passord@www.xn--l-4ga.no/index.html?ole=%C3%A6semann&ilder%20gud=hei#top");
- QTest::newRow("räksmörgås") << QString::fromLatin1("http://www.räksmörgås.no/")
+ QTest::newRow("øl") << QString::fromUtf8("http://ole:passord@www.øl.no/index.html?ole=æsemann&ilder gud=hei#top")
+ << QByteArray("http://ole:passord@www.xn--l-4ga.no/index.html?ole=%C3%A6semann&ilder%20gud=hei#top");
+ QTest::newRow("räksmörgås") << QString::fromUtf8("http://www.räksmörgås.no/")
<< QByteArray("http://www.xn--rksmrgs-5wao1o.no/");
- QTest::newRow("bühler") << QString::fromLatin1("http://www.bühler.no/")
+ QTest::newRow("bühler") << QString::fromUtf8("http://www.bühler.no/")
<< QByteArray("http://www.xn--bhler-kva.no/");
QTest::newRow("non-latin1")
<< QString::fromUtf8("http://www.\316\261\316\270\316\256\316\275\316\261.info")
@@ -1338,7 +1314,7 @@ void tst_QUrl::compat_decode_data()
QTest::newRow("HTTPUrl") << QByteArray("http://qt.nokia.com") << QString("http://qt.nokia.com");
QTest::newRow("HTTPUrlEncoded") << QByteArray("http://qt%20nokia%20com") << QString("http://qt nokia com");
QTest::newRow("EmptyString") << QByteArray("") << QString("");
- QTest::newRow("Task27166") << QByteArray("Fran%C3%A7aise") << QString("Française");
+ QTest::newRow("Task27166") << QByteArray("Fran%C3%A7aise") << QString::fromUtf8("Française");
}
void tst_QUrl::compat_decode()
@@ -1360,7 +1336,7 @@ void tst_QUrl::compat_encode_data()
QTest::newRow("HTTPUrl") << QString("http://qt.nokia.com") << QByteArray("http%3A//qt.nokia.com");
QTest::newRow("HTTPUrlEncoded") << QString("http://qt nokia com") << QByteArray("http%3A//qt%20nokia%20com");
QTest::newRow("EmptyString") << QString("") << QByteArray("");
- QTest::newRow("Task27166") << QString::fromLatin1("Française") << QByteArray("Fran%C3%A7aise");
+ QTest::newRow("Task27166") << QString::fromUtf8("Française") << QByteArray("Fran%C3%A7aise");
}
void tst_QUrl::compat_encode()
@@ -1393,7 +1369,7 @@ void tst_QUrl::percentEncoding_data()
QTest::addColumn<QByteArray>("encoded");
QTest::newRow("test_01") << QString::fromLatin1("sdfsdf") << QByteArray("sdfsdf");
- QTest::newRow("test_02") << QString::fromLatin1("æss") << QByteArray("%C3%A6ss");
+ QTest::newRow("test_02") << QString::fromUtf8("æss") << QByteArray("%C3%A6ss");
// not unreserved or reserved
QTest::newRow("test_03") << QString::fromLatin1("{}") << QByteArray("%7B%7D");
}
@@ -1407,6 +1383,7 @@ void tst_QUrl::percentEncoding()
QVERIFY(QUrl::fromEncoded(QUrl(original).toEncoded()) == QUrl(original));
QCOMPARE(QUrl::fromEncoded(QUrl(original).toEncoded()).toString(), original);
QVERIFY(QUrl::fromEncoded(encoded) == QUrl(original));
+ QCOMPARE(QUrl(QUrl(original).toString()).toString(), original);
}
void tst_QUrl::toPercentEncoding_data()
@@ -1460,15 +1437,15 @@ void tst_QUrl::swap()
void tst_QUrl::symmetry()
{
- QUrl url(QString::fromLatin1("http://www.räksmörgås.se/pub?a=b&a=dø&a=f#vræl"));
+ QUrl url(QString::fromUtf8("http://www.räksmörgås.se/pub?a=b&a=dø&a=f#vræl"));
QCOMPARE(url.scheme(), QString::fromLatin1("http"));
- QCOMPARE(url.host(), QString::fromLatin1("www.räksmörgås.se"));
+ QCOMPARE(url.host(), QString::fromUtf8("www.räksmörgås.se"));
QCOMPARE(url.path(), QString::fromLatin1("/pub"));
// this will be encoded ...
QCOMPARE(url.encodedQuery().constData(), QString::fromLatin1("a=b&a=d%C3%B8&a=f").toLatin1().constData());
// unencoded
- QCOMPARE(url.allQueryItemValues("a").join("").toLatin1().constData(), "bdøf");
- QCOMPARE(url.fragment(), QString::fromLatin1("vræl"));
+ QCOMPARE(url.allQueryItemValues("a").join(""), QString::fromUtf8("bdøf"));
+ QCOMPARE(url.fragment(), QString::fromUtf8("vræl"));
QUrl onlyHost("//qt.nokia.com");
QCOMPARE(onlyHost.toString(), QString::fromLatin1("//qt.nokia.com"));
@@ -1480,14 +1457,16 @@ void tst_QUrl::symmetry()
QByteArray b = urlPreviewList.toEncoded();
QCOMPARE(b.constData(), "http://desktop:33326/upnp/%7B32f525a6-6f31-426e-91ca-01c2e6c2c57e%7D");
QCOMPARE(QUrl::fromEncoded(b).toString(), urlString);
-
- }{
+ QCOMPARE(QUrl(b).toString(), urlString);
+ }
+ {
QString urlString = QString::fromLatin1("http://desktop:53423/deviceDescription?uuid={7977c17b-00bf-4af9-894e-fed28573c3a9}");
QUrl urlPreviewList(urlString);
QCOMPARE(urlPreviewList.toString(), urlString);
QByteArray b = urlPreviewList.toEncoded();
QCOMPARE(b.constData(), "http://desktop:53423/deviceDescription?uuid=%7B7977c17b-00bf-4af9-894e-fed28573c3a9%7D");
QCOMPARE(QUrl::fromEncoded(b).toString(), urlString);
+ QCOMPARE(QUrl(b).toString(), urlString);
}
}
@@ -1567,9 +1546,9 @@ void tst_QUrl::punycode_data()
QTest::addColumn<QString>("original");
QTest::addColumn<QByteArray>("encoded");
- QTest::newRow("øl") << QString::fromLatin1("øl") << QByteArray("xn--l-4ga");
- QTest::newRow("Bühler") << QString::fromLatin1("Bühler") << QByteArray("xn--Bhler-kva");
- QTest::newRow("räksmörgås") << QString::fromLatin1("räksmörgås") << QByteArray("xn--rksmrgs-5wao1o");
+ QTest::newRow("øl") << QString::fromUtf8("øl") << QByteArray("xn--l-4ga");
+ QTest::newRow("Bühler") << QString::fromUtf8("Bühler") << QByteArray("xn--Bhler-kva");
+ QTest::newRow("räksmörgås") << QString::fromUtf8("räksmörgås") << QByteArray("xn--rksmrgs-5wao1o");
}
void tst_QUrl::punycode()
@@ -1608,6 +1587,43 @@ void tst_QUrl::isRelative()
QCOMPARE(QUrl(url).isRelative(), trueFalse);
}
+void tst_QUrl::setQueryItems()
+{
+ QUrl url;
+
+ QList<QPair<QString, QString> > query;
+ query += qMakePair(QString("type"), QString("login"));
+ query += qMakePair(QString("name"), QString::fromUtf8("Ã¥ge nissemannsen"));
+ query += qMakePair(QString("ole&du"), QString::fromUtf8("anne+jørgen=sant"));
+ query += qMakePair(QString("prosent"), QString("%"));
+ url.setQueryItems(query);
+ QVERIFY(!url.isEmpty());
+
+ QCOMPARE(url.encodedQuery().constData(),
+ QByteArray("type=login&name=%C3%A5ge%20nissemannsen&ole%26du="
+ "anne+j%C3%B8rgen%3Dsant&prosent=%25").constData());
+
+ url.setQueryDelimiters('>', '/');
+ url.setQueryItems(query);
+
+ QCOMPARE(url.encodedQuery(),
+ QByteArray("type>login/name>%C3%A5ge%20nissemannsen/ole&du>"
+ "anne+j%C3%B8rgen=sant/prosent>%25"));
+
+ url.setFragment(QString::fromLatin1("top"));
+ QCOMPARE(url.fragment(), QString::fromLatin1("top"));
+
+ url.setScheme("http");
+ url.setHost("qt.nokia.com");
+
+ QCOMPARE(url.toEncoded().constData(),
+ "http://qt.nokia.com?type>login/name>%C3%A5ge%20nissemannsen/ole&du>"
+ "anne+j%C3%B8rgen=sant/prosent>%25#top");
+ QCOMPARE(url.toString(),
+ QString::fromUtf8("http://qt.nokia.com?type>login/name>Ã¥ge nissemannsen"
+ "/ole&du>anne+jørgen=sant/prosent>%25#top"));
+}
+
void tst_QUrl::queryItems()
{
QUrl url;
@@ -1844,8 +1860,7 @@ void tst_QUrl::tolerantParser()
QCOMPARE(url.path(), QString("/path with spaces.html"));
QCOMPARE(url.toEncoded(), QByteArray("http://www.example.com/path%20with%20spaces.html"));
url.setUrl("http://www.example.com/path%20with spaces.html", QUrl::StrictMode);
- QVERIFY(url.isValid());
- QCOMPARE(url.toEncoded(), QByteArray("http://www.example.com/path%2520with%20spaces.html"));
+ QVERIFY(!url.isValid());
}
{
QUrl url = QUrl::fromEncoded("http://www.example.com/path%20with spaces.html");
@@ -1940,7 +1955,7 @@ void tst_QUrl::correctEncodedMistakes_data()
{
QTest::addColumn<QByteArray>("encodedUrl");
QTest::addColumn<bool>("result");
- QTest::addColumn<QString>("toString");
+ QTest::addColumn<QString>("toDecoded");
QTest::addColumn<QByteArray>("toEncoded");
QTest::newRow("%") << QByteArray("%") << true << QString("%") << QByteArray("%25");
@@ -1957,13 +1972,14 @@ void tst_QUrl::correctEncodedMistakes()
{
QFETCH(QByteArray, encodedUrl);
QFETCH(bool, result);
- QFETCH(QString, toString);
+ QFETCH(QString, toDecoded);
QFETCH(QByteArray, toEncoded);
QUrl url = QUrl::fromEncoded(encodedUrl);
QCOMPARE(url.isValid(), result);
if (url.isValid()) {
- QCOMPARE(url.toString(), toString);
+ Q_UNUSED(toDecoded); // no full-decoding available at the moment
+ QCOMPARE(url.toString(), QString::fromLatin1(toEncoded));
QCOMPARE(url.toEncoded(), toEncoded);
}
}
@@ -1972,7 +1988,7 @@ void tst_QUrl::correctDecodedMistakes_data()
{
QTest::addColumn<QString>("decodedUrl");
QTest::addColumn<bool>("result");
- QTest::addColumn<QString>("toString");
+ QTest::addColumn<QString>("toDecoded");
QTest::addColumn<QByteArray>("toEncoded");
QTest::newRow("%") << QString("%") << true << QString("%") << QByteArray("%25");
@@ -1982,20 +1998,21 @@ void tst_QUrl::correctDecodedMistakes_data()
QTest::newRow("13%!!") << QString("13%!!") << true << QString("13%!!") << QByteArray("13%25!!");
QTest::newRow("13%a") << QString("13%a") << true << QString("13%a") << QByteArray("13%25a");
QTest::newRow("13%az") << QString("13%az") << true << QString("13%az") << QByteArray("13%25az");
- QTest::newRow("13%25") << QString("13%25") << true << QString("13%25") << QByteArray("13%2525");
+ QTest::newRow("13%25") << QString("13%25") << true << QString("13%25") << QByteArray("13%25");
}
void tst_QUrl::correctDecodedMistakes()
{
QFETCH(QString, decodedUrl);
QFETCH(bool, result);
- QFETCH(QString, toString);
+ QFETCH(QString, toDecoded);
QFETCH(QByteArray, toEncoded);
QUrl url(decodedUrl);
QCOMPARE(url.isValid(), result);
if (url.isValid()) {
- QCOMPARE(url.toString(), toString);
+ Q_UNUSED(toDecoded); // no full-decoding available at the moment
+ QCOMPARE(url.toString(), QString::fromLatin1(toEncoded));
QCOMPARE(url.toEncoded(), toEncoded);
}
}
@@ -2695,7 +2712,7 @@ void tst_QUrl::tldRestrictions()
{
QFETCH(QString, tld);
- // www.brød.tld
+ // www.brød.tld
QByteArray ascii = "www.xn--brd-1na." + tld.toLatin1();
QString unicode = QLatin1String("www.br\370d.") + tld;
QString encoded = QUrl::fromAce(ascii);
diff --git a/tests/auto/corelib/io/qwinoverlappedionotifier/qwinoverlappedionotifier.pro b/tests/auto/corelib/io/qwinoverlappedionotifier/qwinoverlappedionotifier.pro
new file mode 100644
index 0000000000..0b5bf9fd5c
--- /dev/null
+++ b/tests/auto/corelib/io/qwinoverlappedionotifier/qwinoverlappedionotifier.pro
@@ -0,0 +1,4 @@
+CONFIG += testcase parallel_test
+TARGET = tst_qwinoverlappedionotifier
+QT = core-private testlib
+SOURCES = tst_qwinoverlappedionotifier.cpp
diff --git a/tests/auto/corelib/io/qwinoverlappedionotifier/tst_qwinoverlappedionotifier.cpp b/tests/auto/corelib/io/qwinoverlappedionotifier/tst_qwinoverlappedionotifier.cpp
new file mode 100644
index 0000000000..6190b62bbf
--- /dev/null
+++ b/tests/auto/corelib/io/qwinoverlappedionotifier/tst_qwinoverlappedionotifier.cpp
@@ -0,0 +1,212 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <private/qwinoverlappedionotifier_p.h>
+#include <qbytearray.h>
+
+class tst_QWinOverlappedIoNotifier : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void initTestCase();
+ void readFile_data();
+ void readFile();
+ void waitForNotified_data();
+ void waitForNotified();
+ void brokenPipe();
+
+private:
+ QFileInfo sourceFileInfo;
+ DWORD notifiedBytesRead;
+ DWORD notifiedErrorCode;
+};
+
+class NotifierSink : public QObject
+{
+ Q_OBJECT
+public:
+ NotifierSink(QWinOverlappedIoNotifier *notifier)
+ : QObject(notifier),
+ notifications(0),
+ notifiedBytesRead(0),
+ notifiedErrorCode(ERROR_SUCCESS)
+ {
+ connect(notifier, &QWinOverlappedIoNotifier::notified, this, &NotifierSink::notified);
+ }
+
+protected slots:
+ void notified(DWORD bytesRead, DWORD errorCode)
+ {
+ notifications++;
+ notifiedBytesRead = bytesRead;
+ notifiedErrorCode = errorCode;
+ emit notificationReceived();
+ }
+
+signals:
+ void notificationReceived();
+
+public:
+ int notifications;
+ DWORD notifiedBytesRead;
+ DWORD notifiedErrorCode;
+};
+
+void tst_QWinOverlappedIoNotifier::initTestCase()
+{
+ sourceFileInfo.setFile(QFINDTESTDATA("tst_qwinoverlappedionotifier.cpp"));
+ QVERIFY2(sourceFileInfo.exists(), "File tst_qwinoverlappedionotifier.cpp not found.");
+}
+
+void tst_QWinOverlappedIoNotifier::readFile_data()
+{
+ QTest::addColumn<QString>("fileName");
+ QTest::addColumn<int>("readBufferSize");
+ QTest::addColumn<DWORD>("expectedBytesRead");
+
+ QString sourceFileName = QDir::toNativeSeparators(sourceFileInfo.absoluteFilePath());
+ int sourceFileSize = sourceFileInfo.size();
+
+ QTest::newRow("read file, less than available")
+ << sourceFileName << sourceFileSize / 2 << DWORD(sourceFileSize / 2);
+ QTest::newRow("read file, more than available")
+ << sourceFileName << sourceFileSize * 2 << DWORD(sourceFileSize);
+}
+
+void tst_QWinOverlappedIoNotifier::readFile()
+{
+ QFETCH(QString, fileName);
+ QFETCH(int, readBufferSize);
+ QFETCH(DWORD, expectedBytesRead);
+
+ QWinOverlappedIoNotifier notifier;
+ NotifierSink sink(&notifier);
+ connect(&sink, &NotifierSink::notificationReceived, &QTestEventLoop::instance(), &QTestEventLoop::exitLoop);
+
+ HANDLE hFile = CreateFile(reinterpret_cast<const wchar_t*>(fileName.utf16()),
+ GENERIC_READ, FILE_SHARE_READ,
+ NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
+ notifier.setHandle(hFile);
+ notifier.setEnabled(true);
+
+ OVERLAPPED overlapped = {0};
+ QByteArray buffer(readBufferSize, 0);
+ BOOL readSuccess = ReadFile(hFile, buffer.data(), buffer.size(), NULL, &overlapped);
+ QVERIFY(readSuccess || GetLastError() == ERROR_IO_PENDING);
+
+ QTestEventLoop::instance().enterLoop(3);
+ CloseHandle(hFile);
+ QCOMPARE(sink.notifications, 1);
+ QCOMPARE(sink.notifiedBytesRead, expectedBytesRead);
+ QCOMPARE(sink.notifiedErrorCode, DWORD(ERROR_SUCCESS));
+}
+
+void tst_QWinOverlappedIoNotifier::waitForNotified_data()
+{
+ readFile_data();
+}
+
+void tst_QWinOverlappedIoNotifier::waitForNotified()
+{
+ QFETCH(QString, fileName);
+ QFETCH(int, readBufferSize);
+ QFETCH(DWORD, expectedBytesRead);
+
+ QWinOverlappedIoNotifier notifier;
+ NotifierSink sink(&notifier);
+ HANDLE hFile = CreateFile(reinterpret_cast<const wchar_t*>(fileName.utf16()),
+ GENERIC_READ, FILE_SHARE_READ,
+ NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
+ QCOMPARE(notifier.waitForNotified(0), false);
+ notifier.setHandle(hFile);
+ notifier.setEnabled(true);
+ QCOMPARE(notifier.waitForNotified(100), false);
+
+ OVERLAPPED overlapped = {0};
+ QByteArray buffer(readBufferSize, 0);
+ BOOL readSuccess = ReadFile(hFile, buffer.data(), buffer.size(), NULL, &overlapped);
+ QVERIFY(readSuccess || GetLastError() == ERROR_IO_PENDING);
+
+ QCOMPARE(notifier.waitForNotified(3000), true);
+ CloseHandle(hFile);
+ QCOMPARE(sink.notifications, 1);
+ QCOMPARE(sink.notifiedBytesRead, expectedBytesRead);
+ QCOMPARE(sink.notifiedErrorCode, DWORD(ERROR_SUCCESS));
+ QCOMPARE(notifier.waitForNotified(100), false);
+}
+
+void tst_QWinOverlappedIoNotifier::brokenPipe()
+{
+ QWinOverlappedIoNotifier notifier;
+ NotifierSink sink(&notifier);
+ connect(&sink, &NotifierSink::notificationReceived, &QTestEventLoop::instance(), &QTestEventLoop::exitLoop);
+
+ wchar_t pipeName[] = L"\\\\.\\pipe\\tst_QWinOverlappedIoNotifier_brokenPipe";
+ HANDLE hPipe = CreateNamedPipe(pipeName,
+ PIPE_ACCESS_DUPLEX,
+ PIPE_TYPE_BYTE | PIPE_NOWAIT | PIPE_REJECT_REMOTE_CLIENTS,
+ 1, 0, 0, 0, NULL);
+ QVERIFY(hPipe != INVALID_HANDLE_VALUE);
+ HANDLE hReadEnd = CreateFile(pipeName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0);
+ QVERIFY(hReadEnd != INVALID_HANDLE_VALUE);
+ notifier.setHandle(hReadEnd);
+ notifier.setEnabled(true);
+
+ OVERLAPPED overlapped = {0};
+ QByteArray buffer(1024, 0);
+ BOOL readSuccess = ReadFile(hReadEnd, buffer.data(), buffer.size(), NULL, &overlapped);
+ QVERIFY(readSuccess || GetLastError() == ERROR_IO_PENDING);
+
+ // close the write end of the pipe
+ CloseHandle(hPipe);
+
+ QTestEventLoop::instance().enterLoop(3);
+ CloseHandle(hReadEnd);
+ QCOMPARE(sink.notifications, 1);
+ QCOMPARE(sink.notifiedBytesRead, DWORD(0));
+ QCOMPARE(sink.notifiedErrorCode, DWORD(ERROR_BROKEN_PIPE));
+}
+
+QTEST_MAIN(tst_QWinOverlappedIoNotifier)
+
+#include "tst_qwinoverlappedionotifier.moc"