summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2012-10-16 10:43:36 +0200
committerTor Arne Vestbø <tor.arne.vestbo@digia.com>2012-10-16 10:46:48 +0200
commit8fc4f99e468a279e6bb8442adad6b6a46d1be1c3 (patch)
treedfd0540ecac0bc86594e9e997d7e979e40dacc6d /tests/auto/corelib/io
parentd3921cce47f834dd37cf0bb4085ba242dbbe2412 (diff)
parentf7241e8cb949ecf2d86fae2a759a8e1fdb148a26 (diff)
Merge remote-tracking branch 'gerrit/master' into newdocs
Diffstat (limited to 'tests/auto/corelib/io')
-rw-r--r--tests/auto/corelib/io/io.pro1
-rw-r--r--tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp26
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp46
-rw-r--r--tests/auto/corelib/io/qprocess-noapplication/qprocess-noapplication.pro5
-rw-r--r--tests/auto/corelib/io/qprocess-noapplication/tst_qprocessnoapplication.cpp84
5 files changed, 121 insertions, 41 deletions
diff --git a/tests/auto/corelib/io/io.pro b/tests/auto/corelib/io/io.pro
index f6542d9fd3..03b42a2cbb 100644
--- a/tests/auto/corelib/io/io.pro
+++ b/tests/auto/corelib/io/io.pro
@@ -16,6 +16,7 @@ SUBDIRS=\
qipaddress \
qnodebug \
qprocess \
+ qprocess-noapplication \
qprocessenvironment \
qresourceengine \
qsettings \
diff --git a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp
index 19ce2f2c7a..e0f479524f 100644
--- a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp
+++ b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp
@@ -48,6 +48,8 @@
#include <QtGui/QPainter>
#include <QtGui/QPen>
+#include "../../../qtest-config.h"
+
Q_DECLARE_METATYPE(QBitArray)
Q_DECLARE_METATYPE(qint64)
@@ -78,8 +80,10 @@ private slots:
void stream_QByteArray_data();
void stream_QByteArray();
+#ifndef QTEST_NO_CURSOR
void stream_QCursor_data();
void stream_QCursor();
+#endif
void stream_QDate_data();
void stream_QDate();
@@ -193,7 +197,9 @@ private:
void writeQBrush(QDataStream *s);
void writeQColor(QDataStream *s);
void writeQByteArray(QDataStream *s);
+#ifndef QTEST_NO_CURSOR
void writeQCursor(QDataStream *s);
+#endif
void writeQWaitCursor(QDataStream *s);
void writeQDate(QDataStream *s);
void writeQTime(QDataStream *s);
@@ -220,7 +226,9 @@ private:
void readQBrush(QDataStream *s);
void readQColor(QDataStream *s);
void readQByteArray(QDataStream *s);
+#ifndef QTEST_NO_CURSOR
void readQCursor(QDataStream *s);
+#endif
void readQDate(QDataStream *s);
void readQTime(QDataStream *s);
void readQDateTime(QDataStream *s);
@@ -999,7 +1007,7 @@ void tst_QDataStream::readQByteArray(QDataStream *s)
}
// ************************************
-#ifndef QT_NO_CURSOR
+#ifndef QTEST_NO_CURSOR
static QCursor qCursorData(int index)
{
switch (index) {
@@ -1018,31 +1026,31 @@ static QCursor qCursorData(int index)
}
#endif
+#ifndef QTEST_NO_CURSOR
void tst_QDataStream::stream_QCursor_data()
{
-#ifndef QT_NO_CURSOR
stream_data(9);
-#endif
}
+#endif
+#ifndef QTEST_NO_CURSOR
void tst_QDataStream::stream_QCursor()
{
-#ifndef QT_NO_CURSOR
STREAM_IMPL(QCursor);
-#endif
}
+#endif
+#ifndef QTEST_NO_CURSOR
void tst_QDataStream::writeQCursor(QDataStream *s)
{
-#ifndef QT_NO_CURSOR
QCursor d5(qCursorData(dataIndex(QTest::currentDataTag())));
*s << d5;
-#endif
}
+#endif
+#ifndef QTEST_NO_CURSOR
void tst_QDataStream::readQCursor(QDataStream *s)
{
-#ifndef QT_NO_CURSOR
QCursor test(qCursorData(dataIndex(QTest::currentDataTag())));
QCursor d5;
*s >> d5;
@@ -1061,8 +1069,8 @@ void tst_QDataStream::readQCursor(QDataStream *s)
QPixmap expected = *(test.mask());
QCOMPARE(actual, expected);
}
-#endif
}
+#endif
// ************************************
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp
index fb2a223559..0dddf6ca03 100644
--- a/tests/auto/corelib/io/qfile/tst_qfile.cpp
+++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp
@@ -131,9 +131,11 @@ private slots:
void readAll_data();
void readAll();
void readAllBuffer();
+#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS)
void readAllStdin();
void readLineStdin();
void readLineStdin_lineByLine();
+#endif
void text();
void missingEndOfLine();
void readBlock();
@@ -166,7 +168,9 @@ private slots:
#endif
void flush();
void bufferedRead();
+#ifdef Q_OS_UNIX
void isSequential();
+#endif
void encodeName();
void truncate();
void seekToPos();
@@ -211,8 +215,10 @@ private slots:
void mapOpenMode_data();
void mapOpenMode();
+#ifndef Q_OS_WINCE
void openStandardStreamsFileDescriptors();
void openStandardStreamsBufferedStreams();
+#endif
void resize_data();
void resize();
@@ -839,14 +845,9 @@ void tst_QFile::readAllBuffer()
QFile::remove(fileName);
}
+#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS)
void tst_QFile::readAllStdin()
{
-#if defined(Q_OS_WINCE)
- QSKIP("Currently no stdin/out supported for Windows CE");
-#endif
-#if defined(QT_NO_PROCESS)
- QSKIP("Qt was compiled with QT_NO_PROCESS");
-#else
QByteArray lotsOfData(1024, '@'); // 10 megs
QProcess process;
@@ -863,17 +864,10 @@ void tst_QFile::readAllStdin()
process.closeWriteChannel();
process.waitForFinished();
QCOMPARE(process.readAll().size(), lotsOfData.size() * 5);
-#endif
}
void tst_QFile::readLineStdin()
{
-#if defined(Q_OS_WINCE)
- QSKIP("Currently no stdin/out supported for Windows CE");
-#endif
-#if defined(QT_NO_PROCESS)
- QSKIP("Qt was compiled with QT_NO_PROCESS");
-#else
QByteArray lotsOfData(1024, '@'); // 10 megs
for (int i = 0; i < lotsOfData.size(); ++i) {
@@ -906,17 +900,10 @@ void tst_QFile::readLineStdin()
QCOMPARE(char(array[i]), char('0' + i % 32));
}
}
-#endif
}
void tst_QFile::readLineStdin_lineByLine()
{
-#if defined(Q_OS_WINCE)
- QSKIP("Currently no stdin/out supported for Windows CE");
-#endif
-#if defined(QT_NO_PROCESS)
- QSKIP("Qt was compiled with QT_NO_PROCESS");
-#else
for (int i = 0; i < 2; ++i) {
QProcess process;
process.start(QString("stdinprocess/stdinprocess line %1").arg(i), QIODevice::Text | QIODevice::ReadWrite);
@@ -934,8 +921,8 @@ void tst_QFile::readLineStdin_lineByLine()
process.closeWriteChannel();
QVERIFY(process.waitForFinished(5000));
}
-#endif
}
+#endif
void tst_QFile::text()
{
@@ -1596,15 +1583,14 @@ void tst_QFile::bufferedRead()
fclose(stdFile);
}
+#ifdef Q_OS_UNIX
void tst_QFile::isSequential()
{
-#ifndef Q_OS_UNIX
- QSKIP("Unix only test.");
-#endif
QFile zero("/dev/null");
QVERIFY(zero.open(QFile::ReadOnly));
QVERIFY(zero.isSequential());
}
+#endif
void tst_QFile::encodeName()
{
@@ -3093,14 +3079,12 @@ protected:
bool MessageHandler::ok = true;
QtMessageHandler MessageHandler::oldMessageHandler = 0;
-void tst_QFile::openStandardStreamsFileDescriptors()
-{
-#ifdef Q_OS_WINCE
//allthough Windows CE (not mobile!) has functions that allow redirecting
//the standard file descriptors to a file (see SetStdioPathW/GetStdioPathW)
//it does not have functions to simply open them like below .
- QSKIP("Opening standard streams on Windows CE via descriptor not implemented");
-#endif
+#ifndef Q_OS_WINCE
+void tst_QFile::openStandardStreamsFileDescriptors()
+{
// Check that QIODevice::seek() isn't called when opening a sequential device (QFile).
MessageHandler msgHandler;
@@ -3131,9 +3115,6 @@ void tst_QFile::openStandardStreamsFileDescriptors()
void tst_QFile::openStandardStreamsBufferedStreams()
{
-#ifdef Q_OS_WINCE
- QSKIP("Not tested on Windows CE.");
-#endif
// Check that QIODevice::seek() isn't called when opening a sequential device (QFile).
MessageHandler msgHandler;
@@ -3161,6 +3142,7 @@ void tst_QFile::openStandardStreamsBufferedStreams()
QVERIFY(msgHandler.testPassed());
}
+#endif
void tst_QFile::writeNothing()
{
diff --git a/tests/auto/corelib/io/qprocess-noapplication/qprocess-noapplication.pro b/tests/auto/corelib/io/qprocess-noapplication/qprocess-noapplication.pro
new file mode 100644
index 0000000000..2f409ebdbc
--- /dev/null
+++ b/tests/auto/corelib/io/qprocess-noapplication/qprocess-noapplication.pro
@@ -0,0 +1,5 @@
+CONFIG += testcase
+CONFIG += parallel_test
+CONFIG -= app_bundle debug_and_release_target
+QT = core testlib
+SOURCES = tst_qprocessnoapplication.cpp
diff --git a/tests/auto/corelib/io/qprocess-noapplication/tst_qprocessnoapplication.cpp b/tests/auto/corelib/io/qprocess-noapplication/tst_qprocessnoapplication.cpp
new file mode 100644
index 0000000000..33146cafd1
--- /dev/null
+++ b/tests/auto/corelib/io/qprocess-noapplication/tst_qprocessnoapplication.cpp
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Intel Corporation.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtCore module 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 <QtCore/QCoreApplication>
+#include <QtCore/QProcess>
+#include <QtCore/QThread>
+#include <QtTest>
+
+class tst_QProcessNoApplication : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void initializationDeadlock();
+};
+
+void tst_QProcessNoApplication::initializationDeadlock()
+{
+ // see QTBUG-27260
+ // QProcess on Unix uses (or used to, at the time of the writing of this test)
+ // a global class called QProcessManager.
+ // This class is instantiated (or was) only in the main thread, which meant that
+ // blocking the main thread while waiting for QProcess could mean a deadlock.
+
+ struct MyThread : public QThread
+ {
+ void run()
+ {
+ // what we execute does not matter, as long as we try to
+ // and that the process exits
+ QProcess::execute("true");
+ }
+ };
+
+ static char argv0[] = "tst_QProcessNoApplication";
+ char *argv[] = { argv0, 0 };
+ int argc = 1;
+ QCoreApplication app(argc, argv);
+ MyThread thread;
+ thread.start();
+ QVERIFY(thread.wait(10000));
+}
+
+QTEST_APPLESS_MAIN(tst_QProcessNoApplication)
+
+#include "tst_qprocessnoapplication.moc"