Avoid using QSKIP in lieu of compile-time checks
QSKIP is intended to be used to skip test functions that are found at run-time to be inapplicable or unsafe. If a test function can be determined to be inapplicable at compile-time, the entire test function should be omitted instead of replacing the body of the test function with a QSKIP, which only serves to slow down test runs and to inflate test run-rates with empty, inapplicable tests. Task-number: QTQAINFRA-278 Change-Id: Ib2025339422749cf216e87ac414a3056250bf8f9 Reviewed-on: http://codereview.qt-project.org/5942 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This commit is contained in:
parent
c46f59fadf
commit
7cfad460c5
@ -91,7 +91,7 @@ private slots:
|
||||
void codecForUtfText_data();
|
||||
void codecForUtfText();
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
#if defined(Q_OS_UNIX) && !defined(QT_NO_PROCESS)
|
||||
void toLocal8Bit();
|
||||
#endif
|
||||
|
||||
@ -1934,12 +1934,9 @@ void tst_QTextCodec::codecForUtfText()
|
||||
QVERIFY(codec == 0);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
#if defined(Q_OS_UNIX) && !defined(QT_NO_PROCESS)
|
||||
void tst_QTextCodec::toLocal8Bit()
|
||||
{
|
||||
#ifdef QT_NO_PROCESS
|
||||
QSKIP("This test requires QProcess", SkipAll);
|
||||
#else
|
||||
QProcess process;
|
||||
process.start("echo/echo");
|
||||
QString string(QChar(0x410));
|
||||
@ -1949,7 +1946,6 @@ void tst_QTextCodec::toLocal8Bit()
|
||||
process.waitForFinished();
|
||||
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
|
||||
QCOMPARE(process.exitCode(), 0);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -58,7 +58,9 @@ private slots:
|
||||
void resultAt();
|
||||
void incrementalResults();
|
||||
void noDetatch();
|
||||
#ifndef QT_NO_STL
|
||||
void stlContainers();
|
||||
#endif
|
||||
};
|
||||
|
||||
#if !defined (QT_NO_CONCURRENT_TEST) && !defined(QT_NO_CONCURRENT_FILTER)
|
||||
@ -1497,11 +1499,10 @@ void tst_QtConcurrentFilter::noDetatch()
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef QT_NO_STL
|
||||
void tst_QtConcurrentFilter::stlContainers()
|
||||
{
|
||||
#if defined(QT_NO_STL)
|
||||
QSKIP("Qt compiled without STL support", SkipAll);
|
||||
#elif defined(_MSC_VER) && _MSC_VER >= 1600
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1600
|
||||
QSKIP("Test does not compile with MSVC 2010 (see QTBUG-18996)", SkipAll);
|
||||
#else
|
||||
std::vector<int> vector;
|
||||
@ -1529,6 +1530,7 @@ void tst_QtConcurrentFilter::stlContainers()
|
||||
QCOMPARE(*list2.begin(), 1);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
QTEST_MAIN(tst_QtConcurrentFilter)
|
||||
|
||||
|
@ -100,8 +100,10 @@ private slots:
|
||||
void stresstest();
|
||||
void noIterations();
|
||||
void throttling();
|
||||
#ifndef QT_NO_STL
|
||||
void blockSize();
|
||||
void multipleResults();
|
||||
#endif
|
||||
#if 0
|
||||
//"while" iterations tests:
|
||||
void instantiateWhile();
|
||||
@ -274,17 +276,17 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// Missing stl iterators prevent correct block size calculation.
|
||||
#ifndef QT_NO_STL
|
||||
void tst_QtConcurrentIterateKernel::blockSize()
|
||||
{
|
||||
#ifdef QT_NO_STL
|
||||
QSKIP("Missing stl iterators prevent correct block size calculation", SkipAll);
|
||||
#endif
|
||||
const int expectedMinimumBlockSize = 1024 / QThread::idealThreadCount();
|
||||
BlockSizeRecorder(0, 10000).startBlocking();
|
||||
if (peakBlockSize < expectedMinimumBlockSize)
|
||||
qDebug() << "block size" << peakBlockSize;
|
||||
QVERIFY(peakBlockSize >= expectedMinimumBlockSize);
|
||||
}
|
||||
#endif
|
||||
|
||||
class MultipleResultsFor : public IterateKernel<TestIterator, int>
|
||||
{
|
||||
@ -298,12 +300,10 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Missing stl iterators prevent correct summation.
|
||||
#ifndef QT_NO_STL
|
||||
void tst_QtConcurrentIterateKernel::multipleResults()
|
||||
{
|
||||
#ifdef QT_NO_STL
|
||||
QSKIP("Missing stl iterators prevent correct summation", SkipAll);
|
||||
#endif
|
||||
QFuture<int> f = startThreadEngine(new MultipleResultsFor(0, 10)).startAsynchronously();
|
||||
QCOMPARE(f.results().count() , 10);
|
||||
QCOMPARE(f.resultAt(0), 0);
|
||||
@ -311,6 +311,7 @@ void tst_QtConcurrentIterateKernel::multipleResults()
|
||||
QCOMPARE(f.resultAt(9), 9);
|
||||
f.waitForFinished();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
class PrintWhile : public IterateKernel<TestIterator, void>
|
||||
|
@ -73,7 +73,9 @@ private slots:
|
||||
#endif
|
||||
void incrementalResults();
|
||||
void noDetatch();
|
||||
#ifndef QT_NO_STL
|
||||
void stlContainers();
|
||||
#endif
|
||||
void qFutureAssignmentLeak();
|
||||
void stressTest();
|
||||
public slots:
|
||||
@ -2316,10 +2318,9 @@ void tst_QtConcurrentMap::noDetatch()
|
||||
|
||||
}
|
||||
|
||||
#ifndef QT_NO_STL
|
||||
void tst_QtConcurrentMap::stlContainers()
|
||||
{
|
||||
#ifdef QT_NO_STL
|
||||
QSKIP("Qt compiled without STL support", SkipAll);
|
||||
std::vector<int> vector;
|
||||
vector.push_back(1);
|
||||
vector.push_back(2);
|
||||
@ -2337,8 +2338,8 @@ void tst_QtConcurrentMap::stlContainers()
|
||||
QtConcurrent::mapped(list, mapper).waitForFinished();
|
||||
|
||||
QtConcurrent::blockingMap(list, multiplyBy2Immutable);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
InstanceCounter ic_fn(const InstanceCounter & ic)
|
||||
{
|
||||
|
@ -67,8 +67,12 @@ private slots:
|
||||
#if 0
|
||||
void createFunctor();
|
||||
#endif
|
||||
#ifdef Q_COMPILER_DECLTYPE
|
||||
void functor();
|
||||
#endif
|
||||
#ifdef Q_COMPILER_LAMBDA
|
||||
void lambda();
|
||||
#endif
|
||||
};
|
||||
|
||||
#if 0
|
||||
@ -457,12 +461,10 @@ struct Functor {
|
||||
void operator()(int, int, int, int, int, int) { }
|
||||
};
|
||||
|
||||
// This tests functor without result_type; decltype need to be supported by the compiler.
|
||||
#ifdef Q_COMPILER_DECLTYPE
|
||||
void tst_QtConcurrentRun::functor()
|
||||
{
|
||||
//this test functor without result_type, decltype need to be supported by the compiler
|
||||
#ifndef Q_COMPILER_DECLTYPE
|
||||
QSKIP("Compiler do not suport decltype", SkipAll);
|
||||
#else
|
||||
Functor f;
|
||||
{
|
||||
QFuture<int> fut = QtConcurrent::run(f);
|
||||
@ -483,16 +485,12 @@ void tst_QtConcurrentRun::functor()
|
||||
QtConcurrent::run(f, 1,2,3,4).waitForFinished();
|
||||
QtConcurrent::run(f, 1,2,3,4,5).waitForFinished();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef Q_COMPILER_LAMBDA
|
||||
void tst_QtConcurrentRun::lambda()
|
||||
{
|
||||
#ifndef Q_COMPILER_LAMBDA
|
||||
QSKIP("Compiler do not suport lambda", SkipAll);
|
||||
#else
|
||||
|
||||
QCOMPARE(QtConcurrent::run([](){ return 45; }).result(), 45);
|
||||
QCOMPARE(QtConcurrent::run([](int a){ return a+15; }, 12).result(), 12+15);
|
||||
QCOMPARE(QtConcurrent::run([](int a, double b){ return a + b; }, 12, 15).result(), double(12+15));
|
||||
@ -506,10 +504,8 @@ void tst_QtConcurrentRun::lambda()
|
||||
QCOMPARE(r, QStringList({"Hello", "World", "Foo"}));
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#include "tst_qtconcurrentrun.moc"
|
||||
|
||||
|
@ -74,7 +74,9 @@ private slots:
|
||||
void destruction();
|
||||
void threadRecycling();
|
||||
void expiryTimeout();
|
||||
#ifndef QT_NO_EXCEPTIONS
|
||||
void exceptions();
|
||||
#endif
|
||||
void maxThreadCount();
|
||||
void setMaxThreadCount_data();
|
||||
void setMaxThreadCount();
|
||||
@ -354,21 +356,17 @@ public:
|
||||
throw new int;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
void tst_QThreadPool::exceptions()
|
||||
{
|
||||
#ifndef QT_NO_EXCEPTIONS
|
||||
ExceptionTask task;
|
||||
{
|
||||
QThreadPool threadPool;
|
||||
// Uncomment this for a nice crash.
|
||||
// threadPool.start(&task);
|
||||
}
|
||||
#else
|
||||
QSKIP("No exception support", SkipAll);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QThreadPool::maxThreadCount()
|
||||
{
|
||||
|
@ -106,8 +106,10 @@ private slots:
|
||||
void stream_QPen_data();
|
||||
void stream_QPen();
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
void stream_QPixmap_data();
|
||||
void stream_QPixmap();
|
||||
#endif
|
||||
|
||||
void stream_QPoint_data();
|
||||
void stream_QPoint();
|
||||
@ -139,8 +141,10 @@ private slots:
|
||||
void stream_qint64_data();
|
||||
void stream_qint64();
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
void stream_QIcon_data();
|
||||
void stream_QIcon();
|
||||
#endif
|
||||
|
||||
void stream_QEasingCurve_data();
|
||||
void stream_QEasingCurve();
|
||||
@ -1597,35 +1601,31 @@ void tst_QDataStream::readQPen(QDataStream *s)
|
||||
|
||||
// pixmap testing is currently limited to one pixmap only.
|
||||
//
|
||||
// Test depends on more memory than available on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QDataStream::stream_QPixmap_data()
|
||||
{
|
||||
#ifndef Q_OS_WINCE
|
||||
stream_data(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QDataStream::stream_QPixmap()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Test depends on more memory than available on Qt/CE", SkipAll);
|
||||
#endif
|
||||
STREAM_IMPL(QPixmap);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Test depends on more memory than available on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QDataStream::stream_QIcon_data()
|
||||
{
|
||||
#ifndef Q_OS_WINCE
|
||||
stream_data(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QDataStream::stream_QIcon()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Test depends on more memory than available on Qt/CE", SkipAll);
|
||||
#endif
|
||||
STREAM_IMPL(QIcon);
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QDataStream::writeQPixmap(QDataStream *s)
|
||||
{
|
||||
|
@ -146,7 +146,9 @@ private slots:
|
||||
|
||||
void operator_eq();
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
void dotAndDotDot();
|
||||
#endif
|
||||
void homePath();
|
||||
void tempPath();
|
||||
void rootPath();
|
||||
@ -1241,18 +1243,17 @@ void tst_QDir::operator_eq()
|
||||
dir1.setPath("..");
|
||||
}
|
||||
|
||||
// WinCE does not have . nor ..
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QDir::dotAndDotDot()
|
||||
{
|
||||
#if defined(Q_OS_WINCE)
|
||||
QSKIP("WinCE does not have . nor ..", SkipAll);
|
||||
#else
|
||||
QDir dir(QString(SRCDIR "testdir/"));
|
||||
QStringList entryList = dir.entryList(QDir::Dirs);
|
||||
QCOMPARE(entryList, QStringList() << QString(".") << QString("..") << QString("dir") << QString("spaces"));
|
||||
entryList = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||
QCOMPARE(entryList, QStringList() << QString("dir") << QString("spaces"));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QDir::homePath()
|
||||
{
|
||||
|
@ -121,7 +121,9 @@ private slots:
|
||||
void uncPaths_data();
|
||||
void uncPaths();
|
||||
#endif
|
||||
#if !defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
void qtbug15421_hiddenDirs_hiddenFiles();
|
||||
#endif
|
||||
};
|
||||
|
||||
tst_QDirIterator::tst_QDirIterator()
|
||||
@ -170,6 +172,7 @@ tst_QDirIterator::tst_QDirIterator()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
createDirectory("qtbug15421_hiddenDirs_hiddenFiles");
|
||||
createFile("qtbug15421_hiddenDirs_hiddenFiles/normalFile");
|
||||
createFile("qtbug15421_hiddenDirs_hiddenFiles/.hiddenFile");
|
||||
@ -183,6 +186,7 @@ tst_QDirIterator::tst_QDirIterator()
|
||||
createDirectory("qtbug15421_hiddenDirs_hiddenFiles/normalDirectory/.hiddenDirectory");
|
||||
createDirectory("qtbug15421_hiddenDirs_hiddenFiles/.hiddenDirectory/normalDirectory");
|
||||
createDirectory("qtbug15421_hiddenDirs_hiddenFiles/.hiddenDirectory/.hiddenDirectory");
|
||||
#endif
|
||||
}
|
||||
|
||||
tst_QDirIterator::~tst_QDirIterator()
|
||||
@ -588,15 +592,13 @@ void tst_QDirIterator::uncPaths()
|
||||
}
|
||||
#endif
|
||||
|
||||
// In Unix it is easy to create hidden files, but in Windows it requires
|
||||
// a special call since hidden files need to be "marked" while in Unix
|
||||
// anything starting by a '.' is a hidden file.
|
||||
// For that reason this test is not run in Windows.
|
||||
#if !defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
void tst_QDirIterator::qtbug15421_hiddenDirs_hiddenFiles()
|
||||
{
|
||||
// In Unix it is easy to create hidden files, but in Windows it requires
|
||||
// a special call since hidden files need to be "marked" while in Unix
|
||||
// anything starting by a '.' is a hidden file.
|
||||
// For that reason this test is not run in Windows.
|
||||
#if defined Q_OS_WIN || Q_OS_WINCE
|
||||
QSKIP("To create hidden files a special call is required in Windows.", SkipAll);
|
||||
#else
|
||||
// Only files
|
||||
{
|
||||
int matches = 0;
|
||||
@ -625,8 +627,8 @@ void tst_QDirIterator::qtbug15421_hiddenDirs_hiddenFiles()
|
||||
QCOMPARE(matches, 6);
|
||||
QCOMPARE(failures, 0);
|
||||
}
|
||||
#endif // Q_OS_WIN || Q_OS_WINCE
|
||||
}
|
||||
#endif
|
||||
|
||||
QTEST_MAIN(tst_QDirIterator)
|
||||
|
||||
|
@ -121,7 +121,9 @@ private slots:
|
||||
|
||||
// Map/unmap large file
|
||||
void mapFile();
|
||||
#ifndef Q_OS_MAC
|
||||
void mapOffsetOverflow();
|
||||
#endif
|
||||
|
||||
void closeFile() { largeFile.close(); }
|
||||
|
||||
@ -515,12 +517,10 @@ void tst_LargeFile::mapFile()
|
||||
QVERIFY( largeFile.unmap( baseAddress ) );
|
||||
}
|
||||
|
||||
// mmap'ping beyond EOF may succeed; generate bus error on access.
|
||||
#ifndef Q_OS_MAC
|
||||
void tst_LargeFile::mapOffsetOverflow()
|
||||
{
|
||||
#if defined(Q_OS_MAC)
|
||||
QSKIP("mmap'ping beyond EOF may succeed; generate bus error on access", SkipAll);
|
||||
#endif
|
||||
|
||||
// Out-of-range mappings should fail, and not silently clip the offset
|
||||
for (int i = 50; i < 63; ++i) {
|
||||
uchar *address = 0;
|
||||
@ -532,6 +532,7 @@ void tst_LargeFile::mapOffsetOverflow()
|
||||
QVERIFY( !address );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
QTEST_APPLESS_MAIN(tst_LargeFile)
|
||||
#include "tst_largefile.moc"
|
||||
|
@ -129,9 +129,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();
|
||||
@ -156,14 +158,18 @@ private slots:
|
||||
void readTextFile2();
|
||||
void writeTextFile_data();
|
||||
void writeTextFile();
|
||||
#ifndef Q_OS_SOLARIS
|
||||
/* void largeFileSupport(); */
|
||||
#endif
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
void largeUncFileSupport();
|
||||
#endif
|
||||
void tailFile();
|
||||
void flush();
|
||||
void bufferedRead();
|
||||
#ifdef Q_OS_UNIX
|
||||
void isSequential();
|
||||
#endif
|
||||
void encodeName();
|
||||
void truncate();
|
||||
void seekToPos();
|
||||
@ -236,8 +242,12 @@ private:
|
||||
NumberOfFileTypes
|
||||
};
|
||||
|
||||
#ifndef Q_WS_WINCE
|
||||
void openStandardStreamsFileDescriptors();
|
||||
#endif
|
||||
#ifdef Q_OS_UNIX
|
||||
void openStandardStreamsBufferedStreams();
|
||||
#endif
|
||||
|
||||
bool openFd(QFile &file, QIODevice::OpenMode mode, QFile::FileHandleFlags handleFlags)
|
||||
{
|
||||
@ -842,14 +852,10 @@ void tst_QFile::readAllBuffer()
|
||||
QFile::remove(fileName);
|
||||
}
|
||||
|
||||
// Currently no stdin/out supported for Windows CE.
|
||||
#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", SkipAll);
|
||||
#endif
|
||||
#if defined(QT_NO_PROCESS)
|
||||
QSKIP("Qt was compiled with QT_NO_PROCESS", SkipAll);
|
||||
#else
|
||||
QByteArray lotsOfData(1024, '@'); // 10 megs
|
||||
|
||||
QProcess process;
|
||||
@ -866,18 +872,13 @@ void tst_QFile::readAllStdin()
|
||||
process.closeWriteChannel();
|
||||
process.waitForFinished();
|
||||
QCOMPARE(process.readAll().size(), lotsOfData.size() * 5);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
// Currently no stdin/out supported for Windows CE.
|
||||
#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS)
|
||||
void tst_QFile::readLineStdin()
|
||||
{
|
||||
#if defined(Q_OS_WINCE)
|
||||
QSKIP("Currently no stdin/out supported for Windows CE", SkipAll);
|
||||
#endif
|
||||
#if defined(QT_NO_PROCESS)
|
||||
QSKIP("Qt was compiled with QT_NO_PROCESS", SkipAll);
|
||||
#else
|
||||
|
||||
QByteArray lotsOfData(1024, '@'); // 10 megs
|
||||
for (int i = 0; i < lotsOfData.size(); ++i) {
|
||||
if ((i % 32) == 31)
|
||||
@ -909,17 +910,13 @@ void tst_QFile::readLineStdin()
|
||||
QCOMPARE(char(array[i]), char('0' + i % 32));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
// Currently no stdin/out supported for Windows CE.
|
||||
#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS)
|
||||
void tst_QFile::readLineStdin_lineByLine()
|
||||
{
|
||||
#if defined(Q_OS_WINCE)
|
||||
QSKIP("Currently no stdin/out supported for Windows CE", SkipAll);
|
||||
#endif
|
||||
#if defined(QT_NO_PROCESS)
|
||||
QSKIP("Qt was compiled with QT_NO_PROCESS", SkipAll);
|
||||
#else
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
QProcess process;
|
||||
process.start(QString("stdinprocess/stdinprocess line %1").arg(i), QIODevice::Text | QIODevice::ReadWrite);
|
||||
@ -937,8 +934,8 @@ void tst_QFile::readLineStdin_lineByLine()
|
||||
process.closeWriteChannel();
|
||||
QVERIFY(process.waitForFinished(5000));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QFile::text()
|
||||
{
|
||||
@ -1581,16 +1578,14 @@ void tst_QFile::bufferedRead()
|
||||
fclose(stdFile);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
void tst_QFile::isSequential()
|
||||
{
|
||||
#if defined (Q_OS_WIN)
|
||||
QSKIP("Unix only test.", SkipAll);
|
||||
#endif
|
||||
|
||||
QFile zero("/dev/null");
|
||||
QVERIFY(zero.open(QFile::ReadOnly));
|
||||
QVERIFY(zero.isSequential());
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QFile::encodeName()
|
||||
{
|
||||
@ -1792,11 +1787,11 @@ void tst_QFile::FILEReadWrite()
|
||||
#include <qglobal.h>
|
||||
#define BUFFSIZE 1
|
||||
#define FILESIZE 0x10000000f
|
||||
|
||||
// Solaris does not support statfs.
|
||||
#ifndef Q_OS_SOLARIS
|
||||
void tst_QFile::largeFileSupport()
|
||||
{
|
||||
#ifdef Q_OS_SOLARIS
|
||||
QSKIP("Solaris does not support statfs", SkipAll);
|
||||
#else
|
||||
qlonglong sizeNeeded = 2147483647;
|
||||
sizeNeeded *= 2;
|
||||
sizeNeeded += 1024;
|
||||
@ -1851,8 +1846,8 @@ void tst_QFile::largeFileSupport()
|
||||
} else {
|
||||
QFAIL("Could not determin disk space");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
|
||||
void tst_QFile::i18nFileName_data()
|
||||
@ -2992,14 +2987,12 @@ void tst_QFile::openDirectory()
|
||||
f1.close();
|
||||
}
|
||||
|
||||
// Although 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.
|
||||
#ifndef Q_WS_WINCE
|
||||
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", SkipAll);
|
||||
#endif
|
||||
// Using file descriptors
|
||||
{
|
||||
QFile in;
|
||||
@ -3025,12 +3018,11 @@ void tst_QFile::openStandardStreamsFileDescriptors()
|
||||
QVERIFY( err.isSequential() );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
void tst_QFile::openStandardStreamsBufferedStreams()
|
||||
{
|
||||
#if defined (Q_OS_WIN)
|
||||
QSKIP("Unix only test.", SkipAll);
|
||||
#endif
|
||||
// Using streams
|
||||
{
|
||||
QFile in;
|
||||
@ -3056,11 +3048,16 @@ void tst_QFile::openStandardStreamsBufferedStreams()
|
||||
QVERIFY( err.isSequential() );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QFile::openStandardStreams()
|
||||
{
|
||||
#ifndef Q_WS_WINCE
|
||||
openStandardStreamsFileDescriptors();
|
||||
#endif
|
||||
#ifdef Q_OS_UNIX
|
||||
openStandardStreamsBufferedStreams();
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QFile::writeNothing()
|
||||
|
@ -136,7 +136,9 @@ private slots:
|
||||
void size_data();
|
||||
void size();
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
void systemFiles();
|
||||
#endif
|
||||
|
||||
void compare_data();
|
||||
void compare();
|
||||
@ -148,8 +150,10 @@ private slots:
|
||||
void fileTimes();
|
||||
void fileTimes_oldFile();
|
||||
|
||||
#ifndef Q_NO_SYMLINKS
|
||||
void isSymLink_data();
|
||||
void isSymLink();
|
||||
#endif
|
||||
|
||||
void isHidden_data();
|
||||
void isHidden();
|
||||
@ -173,8 +177,10 @@ private slots:
|
||||
|
||||
void isWritable();
|
||||
void isExecutable();
|
||||
#ifdef Q_OS_MAC
|
||||
void testDecomposedUnicodeNames_data();
|
||||
void testDecomposedUnicodeNames();
|
||||
#endif
|
||||
|
||||
void equalOperator() const;
|
||||
void equalOperatorWithDifferentSlashes() const;
|
||||
@ -874,16 +880,16 @@ void tst_QFileInfo::size()
|
||||
QTEST(int(fi.size()), "size");
|
||||
}
|
||||
|
||||
// This is a Windows only test.
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
void tst_QFileInfo::systemFiles()
|
||||
{
|
||||
#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE)
|
||||
QSKIP("This is a Windows only test", SkipAll);
|
||||
#endif
|
||||
QFileInfo fi("c:\\pagefile.sys");
|
||||
QVERIFY(fi.exists()); // task 167099
|
||||
QVERIFY(fi.size() > 0); // task 189202
|
||||
QVERIFY(fi.lastModified().isValid());
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QFileInfo::compare_data()
|
||||
{
|
||||
@ -1096,9 +1102,9 @@ void tst_QFileInfo::fileTimes_oldFile()
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef Q_NO_SYMLINKS
|
||||
void tst_QFileInfo::isSymLink_data()
|
||||
{
|
||||
#ifndef NO_SYMLINKS
|
||||
QFile::remove("link.lnk");
|
||||
QFile::remove("brokenlink.lnk");
|
||||
QFile::remove("dummyfile");
|
||||
@ -1118,12 +1124,10 @@ void tst_QFileInfo::isSymLink_data()
|
||||
QTest::newRow("existent file") << SRCDIR "tst_qfileinfo.cpp" << false << "";
|
||||
QTest::newRow("link") << "link.lnk" << true << QFileInfo(SRCDIR "tst_qfileinfo.cpp").absoluteFilePath();
|
||||
QTest::newRow("broken link") << "brokenlink.lnk" << true << QFileInfo("dummyfile").absoluteFilePath();
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QFileInfo::isSymLink()
|
||||
{
|
||||
#ifndef NO_SYMLINKS
|
||||
QFETCH(QString, path);
|
||||
QFETCH(bool, isSymLink);
|
||||
QFETCH(QString, linkTarget);
|
||||
@ -1131,10 +1135,8 @@ void tst_QFileInfo::isSymLink()
|
||||
QFileInfo fi(path);
|
||||
QCOMPARE(fi.isSymLink(), isSymLink);
|
||||
QCOMPARE(fi.symLinkTarget(), linkTarget);
|
||||
#else
|
||||
QSKIP("no symbolic link support on this platform", SkipAll);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QFileInfo::isHidden_data()
|
||||
{
|
||||
@ -1475,6 +1477,8 @@ void tst_QFileInfo::isExecutable()
|
||||
}
|
||||
|
||||
|
||||
// This is a OS X only test (unless you know more about filesystems, then maybe you should try it ;)
|
||||
#ifdef Q_OS_MAC
|
||||
void tst_QFileInfo::testDecomposedUnicodeNames_data()
|
||||
{
|
||||
QTest::addColumn<QString>("filePath");
|
||||
@ -1489,32 +1493,21 @@ void tst_QFileInfo::testDecomposedUnicodeNames_data()
|
||||
|
||||
static void createFileNative(const QString &filePath)
|
||||
{
|
||||
#ifdef Q_OS_UNIX
|
||||
int fd = open(filePath.normalized(QString::NormalizationForm_D).toUtf8().constData(), O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);
|
||||
if (fd < 0) {
|
||||
QFAIL("couldn't create file");
|
||||
} else {
|
||||
close(fd);
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(filePath);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void removeFileNative(const QString &filePath)
|
||||
{
|
||||
#ifdef Q_OS_UNIX
|
||||
unlink(filePath.normalized(QString::NormalizationForm_D).toUtf8().constData());
|
||||
#else
|
||||
Q_UNUSED(filePath);
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QFileInfo::testDecomposedUnicodeNames()
|
||||
{
|
||||
#ifndef Q_OS_MAC
|
||||
QSKIP("This is a OS X only test (unless you know more about filesystems, then maybe you should try it ;)", SkipAll);
|
||||
#endif
|
||||
QFETCH(QString, filePath);
|
||||
createFileNative(filePath);
|
||||
|
||||
@ -1523,6 +1516,7 @@ void tst_QFileInfo::testDecomposedUnicodeNames()
|
||||
QTEST(file.exists(), "exists");
|
||||
removeFileNative(filePath);
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QFileInfo::equalOperator() const
|
||||
{
|
||||
|
@ -63,10 +63,14 @@ public slots:
|
||||
void cleanup();
|
||||
private slots:
|
||||
void getSetCheck();
|
||||
#if !defined(Q_OS_WINCE) || !defined(WINCE_EMULATOR_TEST)
|
||||
void constructing_QTcpSocket();
|
||||
#endif
|
||||
void constructing_QFile();
|
||||
void read_QByteArray();
|
||||
#if !defined(Q_OS_WINCE) || !defined(WINCE_EMULATOR_TEST)
|
||||
void unget();
|
||||
#endif
|
||||
void peek();
|
||||
void peekAndRead();
|
||||
|
||||
@ -113,11 +117,11 @@ void tst_QIODevice::cleanup()
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Networking tests in a WinCE emulator are unstable.
|
||||
#if !defined(Q_OS_WINCE) || !defined(WINCE_EMULATOR_TEST)
|
||||
void tst_QIODevice::constructing_QTcpSocket()
|
||||
{
|
||||
#if defined(Q_OS_WINCE) && defined(WINCE_EMULATOR_TEST)
|
||||
QSKIP("Networking tests in a WinCE emulator are unstable", SkipAll);
|
||||
#endif
|
||||
QTcpSocket socket;
|
||||
QIODevice *device = &socket;
|
||||
|
||||
@ -157,6 +161,7 @@ void tst_QIODevice::constructing_QTcpSocket()
|
||||
}
|
||||
QCOMPARE(*c1, *c2);
|
||||
}
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
void tst_QIODevice::constructing_QFile()
|
||||
@ -209,11 +214,11 @@ void tst_QIODevice::read_QByteArray()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
// Networking tests in a WinCE emulator are unstable.
|
||||
#if !defined(Q_OS_WINCE) || !defined(WINCE_EMULATOR_TEST)
|
||||
void tst_QIODevice::unget()
|
||||
{
|
||||
#if defined(Q_OS_WINCE) && defined(WINCE_EMULATOR_TEST)
|
||||
QSKIP("Networking tests in a WinCE emulator are unstable", SkipAll);
|
||||
#endif
|
||||
QBuffer buffer;
|
||||
buffer.open(QBuffer::ReadWrite);
|
||||
buffer.write("ZXCV");
|
||||
@ -310,6 +315,7 @@ void tst_QIODevice::unget()
|
||||
socket.close();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void tst_QIODevice::peek()
|
||||
|
@ -93,55 +93,72 @@ private slots:
|
||||
void simpleStart();
|
||||
void execute();
|
||||
void startDetached();
|
||||
#ifndef Q_OS_WIN
|
||||
void crashTest();
|
||||
void crashTest2();
|
||||
#endif
|
||||
#ifndef Q_OS_WINCE
|
||||
void echoTest_data();
|
||||
void echoTest();
|
||||
void echoTest2();
|
||||
void echoTest_performance();
|
||||
#if defined Q_OS_WIN
|
||||
#endif
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
void echoTestGui();
|
||||
void batFiles_data();
|
||||
void batFiles();
|
||||
#endif
|
||||
void exitStatus_data();
|
||||
void exitStatus();
|
||||
#ifndef Q_OS_WINCE
|
||||
void loopBackTest();
|
||||
void readTimeoutAndThenCrash();
|
||||
#endif
|
||||
void waitForFinished();
|
||||
#ifndef Q_OS_WINCE
|
||||
void deadWhileReading();
|
||||
void restartProcessDeadlock();
|
||||
void closeWriteChannel();
|
||||
void closeReadChannel();
|
||||
void openModes();
|
||||
void emitReadyReadOnlyWhenNewDataArrives();
|
||||
#endif
|
||||
void hardExit();
|
||||
void softExit();
|
||||
#ifndef Q_OS_WINCE
|
||||
void softExitInSlots_data();
|
||||
void softExitInSlots();
|
||||
void mergedChannels();
|
||||
void forwardedChannels();
|
||||
void atEnd();
|
||||
void atEnd2();
|
||||
#endif
|
||||
void processInAThread();
|
||||
void processesInMultipleThreads();
|
||||
#ifndef Q_OS_WINCE
|
||||
void waitForFinishedWithTimeout();
|
||||
void waitForReadyReadInAReadyReadSlot();
|
||||
void waitForBytesWrittenInABytesWrittenSlot();
|
||||
#endif
|
||||
void spaceArgsTest_data();
|
||||
void spaceArgsTest();
|
||||
#if defined(Q_OS_WIN)
|
||||
void nativeArguments();
|
||||
#endif
|
||||
void exitCodeTest();
|
||||
#ifndef Q_OS_WINCE
|
||||
void setEnvironment_data();
|
||||
void setEnvironment();
|
||||
void setProcessEnvironment_data();
|
||||
void setProcessEnvironment();
|
||||
#endif
|
||||
void systemEnvironment();
|
||||
#ifndef Q_OS_WINCE
|
||||
void spaceInName();
|
||||
#endif
|
||||
void lockupsInStartDetached();
|
||||
void waitForReadyReadForNonexistantProcess();
|
||||
#ifndef Q_OS_WINCE
|
||||
void setStandardInputFile();
|
||||
void setStandardOutputFile_data();
|
||||
void setStandardOutputFile();
|
||||
@ -149,9 +166,12 @@ private slots:
|
||||
void setStandardOutputProcess();
|
||||
void removeFileWhileProcessIsRunning();
|
||||
void fileWriterProcess();
|
||||
#endif
|
||||
void detachedWorkingDirectoryAndPid();
|
||||
#ifndef Q_OS_WINCE
|
||||
void switchReadChannels();
|
||||
void setWorkingDirectory();
|
||||
#endif
|
||||
void startFinishStartFinish();
|
||||
void invalidProgramString_data();
|
||||
void invalidProgramString();
|
||||
@ -167,8 +187,10 @@ protected slots:
|
||||
void readFromProcess();
|
||||
void exitLoopSlot();
|
||||
void restartProcess();
|
||||
#ifndef Q_OS_WINCE
|
||||
void waitForReadyReadInAReadyReadSlotSlot();
|
||||
void waitForBytesWrittenInABytesWrittenSlotSlot();
|
||||
#endif
|
||||
|
||||
private:
|
||||
QProcess *process;
|
||||
@ -308,12 +330,12 @@ void tst_QProcess::readFromProcess()
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// This test opens a crash dialog on Windows.
|
||||
#ifndef Q_OS_WIN
|
||||
void tst_QProcess::crashTest()
|
||||
{
|
||||
qRegisterMetaType<QProcess::ProcessState>("QProcess::ProcessState");
|
||||
#ifdef Q_OS_WIN
|
||||
QSKIP("This test opens a crash dialog on Windows", SkipSingle);
|
||||
#endif
|
||||
process = new QProcess;
|
||||
QSignalSpy stateSpy(process, SIGNAL(stateChanged(QProcess::ProcessState)));
|
||||
process->start("testProcessCrash/testProcessCrash");
|
||||
@ -343,13 +365,14 @@ void tst_QProcess::crashTest()
|
||||
QCOMPARE(qVariantValue<QProcess::ProcessState>(stateSpy.at(1).at(0)), QProcess::Running);
|
||||
QCOMPARE(qVariantValue<QProcess::ProcessState>(stateSpy.at(2).at(0)), QProcess::NotRunning);
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// This test opens a crash dialog on Windows.
|
||||
#ifndef Q_OS_WIN
|
||||
void tst_QProcess::crashTest2()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
QSKIP("This test opens a crash dialog on Windows", SkipSingle);
|
||||
#endif
|
||||
process = new QProcess;
|
||||
process->start("testProcessCrash/testProcessCrash");
|
||||
QVERIFY(process->waitForStarted(5000));
|
||||
@ -377,8 +400,12 @@ void tst_QProcess::crashTest2()
|
||||
delete process;
|
||||
process = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::echoTest_data()
|
||||
{
|
||||
QTest::addColumn<QByteArray>("input");
|
||||
@ -394,12 +421,9 @@ void tst_QProcess::echoTest_data()
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void tst_QProcess::echoTest()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
|
||||
QFETCH(QByteArray, input);
|
||||
|
||||
process = new QProcess;
|
||||
@ -444,6 +468,7 @@ void tst_QProcess::echoTest()
|
||||
delete process;
|
||||
process = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void tst_QProcess::exitLoopSlot()
|
||||
@ -452,12 +477,11 @@ void tst_QProcess::exitLoopSlot()
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::echoTest2()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
|
||||
process = new QProcess;
|
||||
connect(process, SIGNAL(readyRead()), this, SLOT(exitLoopSlot()));
|
||||
|
||||
@ -501,14 +525,14 @@ void tst_QProcess::echoTest2()
|
||||
delete process;
|
||||
process = 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void tst_QProcess::echoTest_performance()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::echoTest_performance()
|
||||
{
|
||||
QProcess process;
|
||||
#ifdef Q_OS_MAC
|
||||
process.start("testProcessLoopback/testProcessLoopback.app");
|
||||
@ -554,15 +578,14 @@ void tst_QProcess::echoTest_performance()
|
||||
process.closeWriteChannel();
|
||||
QVERIFY(process.waitForFinished());
|
||||
}
|
||||
|
||||
#if defined Q_OS_WIN
|
||||
//-----------------------------------------------------------------------------
|
||||
void tst_QProcess::echoTestGui()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE, and neither are batch files.
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
void tst_QProcess::echoTestGui()
|
||||
{
|
||||
QProcess process;
|
||||
|
||||
process.start("testProcessEchoGui/testProcessEchoGui");
|
||||
@ -589,9 +612,6 @@ void tst_QProcess::batFiles_data()
|
||||
|
||||
void tst_QProcess::batFiles()
|
||||
{
|
||||
#if defined(Q_OS_WINCE)
|
||||
QSKIP("Batch files are not supported on Windows CE", SkipAll);
|
||||
#endif
|
||||
QFETCH(QString, batFile);
|
||||
QFETCH(QByteArray, output);
|
||||
|
||||
@ -605,7 +625,6 @@ void tst_QProcess::batFiles()
|
||||
|
||||
QVERIFY(proc.readAll().startsWith(output));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -657,12 +676,11 @@ void tst_QProcess::exitStatus()
|
||||
process = 0;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::loopBackTest()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
|
||||
process = new QProcess;
|
||||
#ifdef Q_OS_MAC
|
||||
process->start("testProcessEcho/testProcessEcho.app");
|
||||
@ -685,14 +703,14 @@ void tst_QProcess::loopBackTest()
|
||||
delete process;
|
||||
process = 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void tst_QProcess::readTimeoutAndThenCrash()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::readTimeoutAndThenCrash()
|
||||
{
|
||||
process = new QProcess;
|
||||
#ifdef Q_OS_MAC
|
||||
process->start("testProcessEcho/testProcessEcho.app");
|
||||
@ -722,6 +740,7 @@ void tst_QProcess::readTimeoutAndThenCrash()
|
||||
delete process;
|
||||
process = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QProcess::waitForFinished()
|
||||
{
|
||||
@ -751,13 +770,10 @@ void tst_QProcess::waitForFinished()
|
||||
QCOMPARE(process.error(), QProcess::FailedToStart);
|
||||
}
|
||||
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::deadWhileReading()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
|
||||
QProcess process;
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
@ -775,14 +791,14 @@ void tst_QProcess::deadWhileReading()
|
||||
QCOMPARE(output.count("\n"), 10*1024);
|
||||
process.waitForFinished();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void tst_QProcess::restartProcessDeadlock()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::restartProcessDeadlock()
|
||||
{
|
||||
// The purpose of this test is to detect whether restarting a
|
||||
// process in the finished() connected slot causes a deadlock
|
||||
// because of the way QProcessManager uses its locks.
|
||||
@ -804,6 +820,7 @@ void tst_QProcess::restartProcessDeadlock()
|
||||
QCOMPARE(process->write("", 1), qlonglong(1));
|
||||
QVERIFY(process->waitForFinished(5000));
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QProcess::restartProcess()
|
||||
{
|
||||
@ -815,12 +832,11 @@ void tst_QProcess::restartProcess()
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::closeWriteChannel()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
|
||||
QProcess more;
|
||||
more.start("testProcessEOF/testProcessEOF");
|
||||
|
||||
@ -842,14 +858,14 @@ void tst_QProcess::closeWriteChannel()
|
||||
more.write("q");
|
||||
QVERIFY(more.waitForFinished(5000));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void tst_QProcess::closeReadChannel()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::closeReadChannel()
|
||||
{
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
QProcess::ProcessChannel channel1 = QProcess::StandardOutput;
|
||||
QProcess::ProcessChannel channel2 = QProcess::StandardError;
|
||||
@ -879,14 +895,14 @@ void tst_QProcess::closeReadChannel()
|
||||
QVERIFY(proc.waitForFinished(5000));
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void tst_QProcess::openModes()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::openModes()
|
||||
{
|
||||
QProcess proc;
|
||||
QVERIFY(!proc.isOpen());
|
||||
QVERIFY(proc.openMode() == QProcess::NotOpen);
|
||||
@ -929,14 +945,14 @@ void tst_QProcess::openModes()
|
||||
QVERIFY(!proc.isWritable());
|
||||
QCOMPARE(proc.state(), QProcess::NotRunning);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives()
|
||||
{
|
||||
QProcess proc;
|
||||
connect(&proc, SIGNAL(readyRead()), this, SLOT(exitLoopSlot()));
|
||||
QSignalSpy spy(&proc, SIGNAL(readyRead()));
|
||||
@ -968,6 +984,7 @@ void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives()
|
||||
proc.write("", 1);
|
||||
QVERIFY(proc.waitForFinished(5000));
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void tst_QProcess::hardExit()
|
||||
@ -1014,6 +1031,8 @@ void tst_QProcess::softExit()
|
||||
QCOMPARE(int(proc.error()), int(QProcess::UnknownError));
|
||||
}
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
class SoftExitProcess : public QProcess
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -1080,6 +1099,7 @@ private:
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void tst_QProcess::softExitInSlots_data()
|
||||
{
|
||||
QTest::addColumn<QString>("appName");
|
||||
@ -1097,12 +1117,9 @@ void tst_QProcess::softExitInSlots_data()
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void tst_QProcess::softExitInSlots()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
|
||||
QFETCH(QString, appName);
|
||||
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
@ -1114,14 +1131,14 @@ void tst_QProcess::softExitInSlots()
|
||||
QVERIFY(proc.waitedForFinished);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void tst_QProcess::mergedChannels()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::mergedChannels()
|
||||
{
|
||||
QProcess process;
|
||||
process.setReadChannelMode(QProcess::MergedChannels);
|
||||
QCOMPARE(process.readChannelMode(), QProcess::MergedChannels);
|
||||
@ -1144,14 +1161,14 @@ void tst_QProcess::mergedChannels()
|
||||
process.closeWriteChannel();
|
||||
QVERIFY(process.waitForFinished(5000));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void tst_QProcess::forwardedChannels()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::forwardedChannels()
|
||||
{
|
||||
QProcess process;
|
||||
process.setReadChannelMode(QProcess::ForwardedChannels);
|
||||
QCOMPARE(process.readChannelMode(), QProcess::ForwardedChannels);
|
||||
@ -1170,15 +1187,14 @@ void tst_QProcess::forwardedChannels()
|
||||
process.closeWriteChannel();
|
||||
QVERIFY(process.waitForFinished(5000));
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void tst_QProcess::atEnd()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::atEnd()
|
||||
{
|
||||
QProcess process;
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
@ -1200,6 +1216,7 @@ void tst_QProcess::atEnd()
|
||||
process.write("", 1);
|
||||
QVERIFY(process.waitForFinished(5000));
|
||||
}
|
||||
#endif
|
||||
|
||||
class TestThread : public QThread
|
||||
{
|
||||
@ -1276,12 +1293,11 @@ void tst_QProcess::processesInMultipleThreads()
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::waitForFinishedWithTimeout()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
|
||||
process = new QProcess(this);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
@ -1300,14 +1316,14 @@ void tst_QProcess::waitForFinishedWithTimeout()
|
||||
delete process;
|
||||
process = 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void tst_QProcess::waitForReadyReadInAReadyReadSlot()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::waitForReadyReadInAReadyReadSlot()
|
||||
{
|
||||
process = new QProcess(this);
|
||||
connect(process, SIGNAL(readyRead()), this, SLOT(waitForReadyReadInAReadyReadSlotSlot()));
|
||||
connect(process, SIGNAL(finished(int)), this, SLOT(exitLoopSlot()));
|
||||
@ -1333,27 +1349,27 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlot()
|
||||
delete process;
|
||||
process = 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void tst_QProcess::waitForReadyReadInAReadyReadSlotSlot()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::waitForReadyReadInAReadyReadSlotSlot()
|
||||
{
|
||||
bytesAvailable = process->bytesAvailable();
|
||||
process->write("bar", 4);
|
||||
QVERIFY(process->waitForReadyRead(5000));
|
||||
QTestEventLoop::instance().exitLoop();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void tst_QProcess::waitForBytesWrittenInABytesWrittenSlot()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::waitForBytesWrittenInABytesWrittenSlot()
|
||||
{
|
||||
process = new QProcess(this);
|
||||
connect(process, SIGNAL(bytesWritten(qint64)), this, SLOT(waitForBytesWrittenInABytesWrittenSlotSlot()));
|
||||
bytesAvailable = 0;
|
||||
@ -1378,18 +1394,19 @@ void tst_QProcess::waitForBytesWrittenInABytesWrittenSlot()
|
||||
delete process;
|
||||
process = 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void tst_QProcess::waitForBytesWrittenInABytesWrittenSlotSlot()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::waitForBytesWrittenInABytesWrittenSlotSlot()
|
||||
{
|
||||
process->write("b");
|
||||
QVERIFY(process->waitForBytesWritten(5000));
|
||||
QTestEventLoop::instance().exitLoop();
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void tst_QProcess::spaceArgsTest_data()
|
||||
@ -1670,12 +1687,11 @@ void tst_QProcess::failToStartWithEventLoop()
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::removeFileWhileProcessIsRunning()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
|
||||
QFile file("removeFile.txt");
|
||||
QVERIFY(file.open(QFile::WriteOnly));
|
||||
|
||||
@ -1693,8 +1709,12 @@ void tst_QProcess::removeFileWhileProcessIsRunning()
|
||||
process.write("", 1);
|
||||
QVERIFY(process.waitForFinished(5000));
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// WinCE doesn't support environment variables.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::setEnvironment_data()
|
||||
{
|
||||
QTest::addColumn<QString>("name");
|
||||
@ -1714,10 +1734,6 @@ void tst_QProcess::setEnvironment_data()
|
||||
|
||||
void tst_QProcess::setEnvironment()
|
||||
{
|
||||
#if defined (Q_OS_WINCE)
|
||||
QSKIP("OS doesn't support environment variables", SkipAll);
|
||||
#endif
|
||||
|
||||
// make sure our environment variables are correct
|
||||
QVERIFY(qgetenv("tst_QProcess").isEmpty());
|
||||
QVERIFY(!qgetenv("PATH").isEmpty());
|
||||
@ -1773,8 +1789,12 @@ void tst_QProcess::setEnvironment()
|
||||
QCOMPARE(process.readAll(), value.toLocal8Bit());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// WinCE doesn't support environment variables.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::setProcessEnvironment_data()
|
||||
{
|
||||
setEnvironment_data();
|
||||
@ -1782,10 +1802,6 @@ void tst_QProcess::setProcessEnvironment_data()
|
||||
|
||||
void tst_QProcess::setProcessEnvironment()
|
||||
{
|
||||
#if defined (Q_OS_WINCE)
|
||||
QSKIP("OS doesn't support environment variables", SkipAll);
|
||||
#endif
|
||||
|
||||
// make sure our environment variables are correct
|
||||
QVERIFY(qgetenv("tst_QProcess").isEmpty());
|
||||
QVERIFY(!qgetenv("PATH").isEmpty());
|
||||
@ -1816,6 +1832,8 @@ void tst_QProcess::setProcessEnvironment()
|
||||
QCOMPARE(process.readAll(), value.toLocal8Bit());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void tst_QProcess::systemEnvironment()
|
||||
{
|
||||
@ -1833,17 +1851,18 @@ void tst_QProcess::systemEnvironment()
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::spaceInName()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
QProcess process;
|
||||
process.start("test Space In Name/testSpaceInName", QStringList());
|
||||
QVERIFY(process.waitForStarted());
|
||||
process.write("", 1);
|
||||
QVERIFY(process.waitForFinished());
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void tst_QProcess::lockupsInStartDetached()
|
||||
@ -1859,12 +1878,11 @@ void tst_QProcess::lockupsInStartDetached()
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::atEnd2()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
|
||||
QProcess process;
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
@ -1881,6 +1899,7 @@ void tst_QProcess::atEnd2()
|
||||
}
|
||||
QCOMPARE(lines.size(), 7);
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void tst_QProcess::waitForReadyReadForNonexistantProcess()
|
||||
@ -1904,12 +1923,11 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess()
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::setStandardInputFile()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
|
||||
static const char data[] = "A bunch\1of\2data\3\4\5\6\7...";
|
||||
QProcess process;
|
||||
QFile file("data");
|
||||
@ -1930,8 +1948,12 @@ void tst_QProcess::setStandardInputFile()
|
||||
QCOMPARE(all.size(), int(sizeof data) - 1); // testProcessEcho drops the ending \0
|
||||
QVERIFY(all == data);
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::setStandardOutputFile_data()
|
||||
{
|
||||
QTest::addColumn<int>("channelToTest");
|
||||
@ -1962,10 +1984,6 @@ void tst_QProcess::setStandardOutputFile_data()
|
||||
|
||||
void tst_QProcess::setStandardOutputFile()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
|
||||
static const char data[] = "Original data. ";
|
||||
static const char testdata[] = "Test data.";
|
||||
|
||||
@ -2016,8 +2034,11 @@ void tst_QProcess::setStandardOutputFile()
|
||||
|
||||
QCOMPARE(all.size(), expectedsize);
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::setStandardOutputProcess_data()
|
||||
{
|
||||
QTest::addColumn<bool>("merged");
|
||||
@ -2027,10 +2048,6 @@ void tst_QProcess::setStandardOutputProcess_data()
|
||||
|
||||
void tst_QProcess::setStandardOutputProcess()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
|
||||
QProcess source;
|
||||
QProcess sink;
|
||||
|
||||
@ -2058,14 +2075,14 @@ void tst_QProcess::setStandardOutputProcess()
|
||||
else
|
||||
QCOMPARE(all, QByteArray("HHeelllloo,, WWoorrlldd"));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void tst_QProcess::fileWriterProcess()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::fileWriterProcess()
|
||||
{
|
||||
QString stdinStr;
|
||||
for (int i = 0; i < 5000; ++i)
|
||||
stdinStr += QString::fromLatin1("%1 -- testing testing 1 2 3\n").arg(i);
|
||||
@ -2087,6 +2104,7 @@ void tst_QProcess::fileWriterProcess()
|
||||
QCOMPARE(QFile("fileWriterProcess.txt").size(), qint64(stdinStr.size()));
|
||||
} while (stopWatch.elapsed() < 3000);
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void tst_QProcess::detachedWorkingDirectoryAndPid()
|
||||
@ -2133,11 +2151,11 @@ void tst_QProcess::detachedWorkingDirectoryAndPid()
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Reading and writing to a process is not supported on Qt/CE.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::switchReadChannels()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll);
|
||||
#endif
|
||||
const char data[] = "ABCD";
|
||||
|
||||
QProcess process;
|
||||
@ -2166,13 +2184,14 @@ void tst_QProcess::switchReadChannels()
|
||||
process.setReadChannel(QProcess::StandardOutput);
|
||||
QCOMPARE(process.read(1), QByteArray("D"));
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Windows CE does not support working directory logic.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcess::setWorkingDirectory()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Windows CE does not support working directory logic", SkipAll);
|
||||
#endif
|
||||
process = new QProcess;
|
||||
process->setWorkingDirectory("test");
|
||||
#ifdef Q_OS_MAC
|
||||
@ -2191,6 +2210,7 @@ void tst_QProcess::setWorkingDirectory()
|
||||
delete process;
|
||||
process = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void tst_QProcess::startFinishStartFinish()
|
||||
|
@ -57,7 +57,9 @@ private slots:
|
||||
|
||||
void caseSensitivity();
|
||||
void systemEnvironment();
|
||||
#ifndef Q_OS_WINCE
|
||||
void putenv();
|
||||
#endif
|
||||
};
|
||||
|
||||
void tst_QProcessEnvironment::operator_eq()
|
||||
@ -276,11 +278,10 @@ void tst_QProcessEnvironment::systemEnvironment()
|
||||
#endif
|
||||
}
|
||||
|
||||
// Windows CE has no environment.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QProcessEnvironment::putenv()
|
||||
{
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Windows CE has no environment", SkipAll);
|
||||
#else
|
||||
static const char envname[] = "WE_RE_SETTING_THIS_ENVIRONMENT_VARIABLE";
|
||||
static bool testRan = false;
|
||||
|
||||
@ -312,8 +313,8 @@ void tst_QProcessEnvironment::putenv()
|
||||
QVERIFY(eAfter.contains(lower));
|
||||
QCOMPARE(eAfter.value(lower), QString("Hello, World"));
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
QTEST_MAIN(tst_QProcessEnvironment)
|
||||
|
||||
|
@ -101,8 +101,10 @@ private slots:
|
||||
void testEscapes();
|
||||
void testCaseSensitivity_data();
|
||||
void testCaseSensitivity();
|
||||
#if defined(QT_BUILD_INTERNAL) && !defined(Q_OS_WIN)
|
||||
void testErrorHandling_data();
|
||||
void testErrorHandling();
|
||||
#endif
|
||||
void testIniParsing_data();
|
||||
void testIniParsing();
|
||||
void testChildKeysAndGroups_data();
|
||||
@ -126,7 +128,7 @@ private slots:
|
||||
void setPath();
|
||||
void setDefaultFormat();
|
||||
void dontCreateNeedlessPaths();
|
||||
#if !defined(Q_OS_WIN)
|
||||
#if !defined(Q_OS_WIN) && !defined(QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER)
|
||||
void dontReorderIniKeysNeedlessly();
|
||||
#endif
|
||||
#if defined(Q_OS_WIN)
|
||||
@ -649,6 +651,8 @@ void tst_QSettings::testByteArray()
|
||||
}
|
||||
}
|
||||
|
||||
// Windows doesn't support most file modes, including read-only directories, so this test is moot.
|
||||
#if defined(QT_BUILD_INTERNAL) && !defined(Q_OS_WIN)
|
||||
void tst_QSettings::testErrorHandling_data()
|
||||
{
|
||||
QTest::addColumn<int>("filePerms"); // -1 means file should not exist
|
||||
@ -679,10 +683,7 @@ void tst_QSettings::testErrorHandling_data()
|
||||
|
||||
void tst_QSettings::testErrorHandling()
|
||||
{
|
||||
#ifdef QT_BUILD_INTERNAL
|
||||
#ifdef Q_OS_WIN
|
||||
QSKIP("Windows doesn't support most file modes, including read-only directories, so this test is moot.", SkipAll);
|
||||
#elif defined(Q_OS_UNIX)
|
||||
#if defined(Q_OS_UNIX)
|
||||
if (::getuid() == 0)
|
||||
QSKIP("Running this test as root doesn't work, since file perms do not bother him", SkipAll);
|
||||
#else
|
||||
@ -744,9 +745,9 @@ void tst_QSettings::testErrorHandling()
|
||||
QCOMPARE(settings.value("alpha/beta/geometry").toInt(), 100);
|
||||
QCOMPARE((int)settings.status(), statusAfterSetAndSync);
|
||||
}
|
||||
#endif // !Q_OS_WIN
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
Q_DECLARE_METATYPE(QVariant)
|
||||
Q_DECLARE_METATYPE(QSettings::Status)
|
||||
@ -2999,13 +3000,11 @@ void tst_QSettings::dontCreateNeedlessPaths()
|
||||
QVERIFY(!fileInfo.dir().exists());
|
||||
}
|
||||
|
||||
#if !defined(Q_OS_WIN)
|
||||
// if QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER is defined,
|
||||
// the Qt build does not preserve ordering, as a code size optimization.
|
||||
#if !defined(Q_OS_WIN) && !defined(QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER)
|
||||
void tst_QSettings::dontReorderIniKeysNeedlessly()
|
||||
{
|
||||
#ifdef QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER
|
||||
QSKIP("This Qt build does not preserve ordering, as a code size optimization.", SkipAll);
|
||||
#endif
|
||||
|
||||
/*
|
||||
This is a very strong test. It asserts that modifying
|
||||
resourcefile2.ini will lead to the exact contents of
|
||||
|
@ -198,16 +198,20 @@ private slots:
|
||||
void octTest();
|
||||
void zeroTermination();
|
||||
void ws_manipulator();
|
||||
#ifndef Q_OS_WINCE
|
||||
void stillOpenWhenAtEnd();
|
||||
#endif
|
||||
void readNewlines_data();
|
||||
void readNewlines();
|
||||
void seek();
|
||||
void pos();
|
||||
void pos2();
|
||||
void pos3LargeFile();
|
||||
#ifndef Q_OS_WINCE
|
||||
void readStdin();
|
||||
void readAllFromStdin();
|
||||
void readLineFromStdin();
|
||||
#endif
|
||||
void read();
|
||||
void qbool();
|
||||
void forcePoint();
|
||||
@ -1103,6 +1107,9 @@ void tst_QTextStream::ws_manipulator()
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
// Qt/CE: Cannot test network on emulator.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QTextStream::stillOpenWhenAtEnd()
|
||||
{
|
||||
int argc = 0;
|
||||
@ -1116,9 +1123,6 @@ void tst_QTextStream::stillOpenWhenAtEnd()
|
||||
while (!stream.readLine().isNull()) {}
|
||||
QVERIFY(file.isOpen());
|
||||
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("Qt/CE: Cannot test network on emulator", SkipAll);
|
||||
#endif
|
||||
QTcpSocket socket;
|
||||
socket.connectToHost(QtNetworkSettings::serverName(), 143);
|
||||
QVERIFY(socket.waitForReadyRead(5000));
|
||||
@ -1127,6 +1131,7 @@ void tst_QTextStream::stillOpenWhenAtEnd()
|
||||
while (!stream2.readLine().isNull()) {}
|
||||
QVERIFY(socket.isOpen());
|
||||
}
|
||||
#endif
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
void tst_QTextStream::readNewlines_data()
|
||||
@ -1397,11 +1402,11 @@ void tst_QTextStream::pos3LargeFile()
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
// Qt/CE has no stdin/out support for processes.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QTextStream::readStdin()
|
||||
{
|
||||
#if defined(Q_OS_WINCE)
|
||||
QSKIP("Qt/CE has no stdin/out support for processes", SkipAll);
|
||||
#endif
|
||||
QProcess stdinProcess;
|
||||
stdinProcess.start("stdinProcess/stdinProcess");
|
||||
stdinProcess.setReadChannel(QProcess::StandardError);
|
||||
@ -1421,13 +1426,14 @@ void tst_QTextStream::readStdin()
|
||||
QCOMPARE(b, 2);
|
||||
QCOMPARE(c, 3);
|
||||
}
|
||||
#endif
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
// Qt/CE has no stdin/out support for processes.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QTextStream::readAllFromStdin()
|
||||
{
|
||||
#if defined(Q_OS_WINCE)
|
||||
QSKIP("Qt/CE has no stdin/out support for processes", SkipAll);
|
||||
#endif
|
||||
QProcess stdinProcess;
|
||||
stdinProcess.start("readAllStdinProcess/readAllStdinProcess", QIODevice::ReadWrite | QIODevice::Text);
|
||||
stdinProcess.setReadChannel(QProcess::StandardError);
|
||||
@ -1442,13 +1448,14 @@ void tst_QTextStream::readAllFromStdin()
|
||||
QChar quoteChar('"');
|
||||
QCOMPARE(stream.readAll(), QString::fromLatin1("%1hello world%2 \n").arg(quoteChar).arg(quoteChar));
|
||||
}
|
||||
#endif
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
// Qt/CE has no stdin/out support for processes.
|
||||
#ifndef Q_OS_WINCE
|
||||
void tst_QTextStream::readLineFromStdin()
|
||||
{
|
||||
#if defined(Q_OS_WINCE)
|
||||
QSKIP("Qt/CE has no stdin/out support for processes", SkipAll);
|
||||
#endif
|
||||
QProcess stdinProcess;
|
||||
stdinProcess.start("readLineStdinProcess/readLineStdinProcess", QIODevice::ReadWrite | QIODevice::Text);
|
||||
stdinProcess.setReadChannel(QProcess::StandardError);
|
||||
@ -1465,6 +1472,7 @@ void tst_QTextStream::readLineFromStdin()
|
||||
|
||||
QVERIFY(stdinProcess.waitForFinished(5000));
|
||||
}
|
||||
#endif
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
void tst_QTextStream::read()
|
||||
|
@ -195,7 +195,9 @@ private slots:
|
||||
// This test *must* run first. See the definition for why.
|
||||
void processEvents();
|
||||
void exec();
|
||||
#if !defined(QT_NO_EXCEPTIONS) && !defined(Q_OS_WINCE_WM)
|
||||
void throwInExec();
|
||||
#endif
|
||||
void reexec();
|
||||
void exit();
|
||||
void execAfterExit();
|
||||
@ -339,16 +341,14 @@ void tst_QEventLoop::exec()
|
||||
}
|
||||
}
|
||||
|
||||
// This test needs exceptions to be enabled.
|
||||
// Windows Mobile cannot handle cross library exceptions
|
||||
// qobject.cpp will try to rethrow the exception after handling
|
||||
// which causes gwes.exe to crash
|
||||
#if !defined(QT_NO_EXCEPTIONS) && !defined(Q_OS_WINCE_WM)
|
||||
void tst_QEventLoop::throwInExec()
|
||||
{
|
||||
#if defined(QT_NO_EXCEPTIONS) || defined(NO_EVENTLOOP_EXCEPTIONS)
|
||||
QSKIP("Exceptions are disabled", SkipAll);
|
||||
#elif defined(Q_OS_WINCE_WM)
|
||||
// Windows Mobile cannot handle cross library exceptions
|
||||
// qobject.cpp will try to rethrow the exception after handling
|
||||
// which causes gwes.exe to crash
|
||||
QSKIP("This platform doesn't support propagating exceptions through the event loop", SkipAll);
|
||||
#elif defined(Q_OS_LINUX)
|
||||
#if defined(Q_OS_LINUX)
|
||||
// C++ exceptions can't be passed through glib callbacks. Skip the test if
|
||||
// we're using the glib event loop.
|
||||
QByteArray dispatcher = QAbstractEventDispatcher::instance()->metaObject()->className();
|
||||
@ -385,6 +385,7 @@ void tst_QEventLoop::throwInExec()
|
||||
QCOMPARE(caughtExceptions, 2);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QEventLoop::reexec()
|
||||
{
|
||||
|
@ -110,7 +110,9 @@ private slots:
|
||||
void floatProperty();
|
||||
void qrealProperty();
|
||||
void property();
|
||||
#ifndef QT_NO_PROCESS
|
||||
void recursiveSignalEmission();
|
||||
#endif
|
||||
void blockingQueuedConnection();
|
||||
void compatibilityChildInsertedEvents();
|
||||
void installEventFilter();
|
||||
@ -2804,18 +2806,16 @@ void tst_QObject::dynamicProperties()
|
||||
QVERIFY(obj.dynamicPropertyNames().isEmpty());
|
||||
}
|
||||
|
||||
#ifndef QT_NO_PROCESS
|
||||
void tst_QObject::recursiveSignalEmission()
|
||||
{
|
||||
#if defined(QT_NO_PROCESS)
|
||||
QSKIP("Test requires QProcess", SkipAll);
|
||||
#else
|
||||
QProcess proc;
|
||||
proc.start("./signalbug");
|
||||
QVERIFY(proc.waitForFinished());
|
||||
QVERIFY(proc.exitStatus() == QProcess::NormalExit);
|
||||
QCOMPARE(proc.exitCode(), 0);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QObject::blockingQueuedConnection()
|
||||
{
|
||||
|
@ -72,7 +72,9 @@ public:
|
||||
private slots:
|
||||
void unexpectedDisconnection();
|
||||
void mixingWithTimers();
|
||||
#ifdef Q_OS_UNIX
|
||||
void posixSockets();
|
||||
#endif
|
||||
void bogusFds();
|
||||
};
|
||||
|
||||
@ -257,12 +259,9 @@ void tst_QSocketNotifier::mixingWithTimers()
|
||||
QCOMPARE(helper.socketActivated, true);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
void tst_QSocketNotifier::posixSockets()
|
||||
{
|
||||
#ifndef Q_OS_UNIX
|
||||
QSKIP("test only for posix", SkipAll);
|
||||
#else
|
||||
|
||||
QTcpServer server;
|
||||
QVERIFY(server.listen(QHostAddress::LocalHost, 0));
|
||||
|
||||
@ -310,8 +309,8 @@ void tst_QSocketNotifier::posixSockets()
|
||||
QCOMPARE(passive->readAll(), QByteArray("goodbye",8));
|
||||
}
|
||||
qt_safe_close(posixSocket);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QSocketNotifier::bogusFds()
|
||||
{
|
||||
|
@ -83,14 +83,20 @@ private slots:
|
||||
void lock();
|
||||
|
||||
// custom edge cases
|
||||
#ifndef Q_OS_HPUX
|
||||
void removeWhileAttached();
|
||||
#endif
|
||||
void emptyMemory();
|
||||
#ifndef Q_OS_WIN
|
||||
void readOnly();
|
||||
#endif
|
||||
|
||||
// basics all together
|
||||
#ifndef Q_OS_HPUX
|
||||
void simpleProducerConsumer_data();
|
||||
void simpleProducerConsumer();
|
||||
void simpleDoubleProducerConsumer();
|
||||
#endif
|
||||
|
||||
// with threads
|
||||
void simpleThreadedProducerConsumer_data();
|
||||
@ -102,7 +108,9 @@ private slots:
|
||||
|
||||
// extreme cases
|
||||
void useTooMuchMemory();
|
||||
#if !defined(Q_OS_HPUX) && !defined(Q_OS_WINCE)
|
||||
void attachTooMuch();
|
||||
#endif
|
||||
|
||||
// unique keys
|
||||
void uniqueKey_data();
|
||||
@ -381,11 +389,10 @@ void tst_QSharedMemory::lock()
|
||||
Other shared memory are allowed to be attached after we remove,
|
||||
but new shared memory are not allowed to attach after a remove.
|
||||
*/
|
||||
// HPUX doesn't allow for multiple attaches per process.
|
||||
#ifndef Q_OS_HPUX
|
||||
void tst_QSharedMemory::removeWhileAttached()
|
||||
{
|
||||
#ifdef Q_OS_HPUX
|
||||
QSKIP("HPUX doesn't allow for multiple attaches per process", SkipAll);
|
||||
#endif
|
||||
rememberKey("one");
|
||||
|
||||
// attach 1
|
||||
@ -407,6 +414,7 @@ void tst_QSharedMemory::removeWhileAttached()
|
||||
QVERIFY(!smThree.attach());
|
||||
QCOMPARE(smThree.error(), QSharedMemory::NotFound);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
The memory should be set to 0 after created.
|
||||
@ -426,11 +434,10 @@ void tst_QSharedMemory::emptyMemory()
|
||||
Verify that attach with ReadOnly is actually read only
|
||||
by writing to data and causing a segfault.
|
||||
*/
|
||||
// This test opens a crash dialog on Windows.
|
||||
#ifndef Q_OS_WIN
|
||||
void tst_QSharedMemory::readOnly()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
QSKIP("This test opens a crash dialog on Windows", SkipSingle);
|
||||
#endif
|
||||
QString program = LACKEYDIR "/lackey";
|
||||
QStringList arguments;
|
||||
rememberKey("readonly_segfault");
|
||||
@ -443,6 +450,7 @@ void tst_QSharedMemory::readOnly()
|
||||
p.waitForFinished();
|
||||
QCOMPARE(p.error(), QProcess::Crashed);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
Keep making shared memory until the kernel stops us.
|
||||
@ -490,15 +498,13 @@ void tst_QSharedMemory::useTooMuchMemory()
|
||||
Create one shared memory (government) and see how many other shared memories (wars) we can
|
||||
attach before the system runs out of resources.
|
||||
*/
|
||||
// HPUX doesn't allow for multiple attaches per process.
|
||||
// For WinCE, this test nearly kills the system, so skip it.
|
||||
#if !defined(Q_OS_HPUX) && !defined(Q_OS_WINCE)
|
||||
void tst_QSharedMemory::attachTooMuch()
|
||||
{
|
||||
QSKIP("disabled", SkipAll);
|
||||
#ifdef Q_OS_HPUX
|
||||
QSKIP("HPUX doesn't allow for multiple attaches per process", SkipAll);
|
||||
#endif
|
||||
#ifdef Q_OS_WINCE
|
||||
QSKIP("This nearly kills the system itself, so skip for Qt/WinCE", SkipAll);
|
||||
#endif
|
||||
|
||||
QSharedMemory government(rememberKey("government"));
|
||||
QVERIFY(government.create(1024));
|
||||
while (true) {
|
||||
@ -519,7 +525,10 @@ void tst_QSharedMemory::attachTooMuch()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// HPUX doesn't allow for multiple attaches per process.
|
||||
#ifndef Q_OS_HPUX
|
||||
void tst_QSharedMemory::simpleProducerConsumer_data()
|
||||
{
|
||||
QTest::addColumn<QSharedMemory::AccessMode>("mode");
|
||||
@ -537,9 +546,6 @@ void tst_QSharedMemory::simpleProducerConsumer_data()
|
||||
*/
|
||||
void tst_QSharedMemory::simpleProducerConsumer()
|
||||
{
|
||||
#ifdef Q_OS_HPUX
|
||||
QSKIP("HPUX doesn't allow for multiple attaches per process", SkipAll);
|
||||
#endif
|
||||
QFETCH(QSharedMemory::AccessMode, mode);
|
||||
|
||||
rememberKey(QLatin1String("market"));
|
||||
@ -562,12 +568,12 @@ void tst_QSharedMemory::simpleProducerConsumer()
|
||||
}
|
||||
QVERIFY(consumer.detach());
|
||||
}
|
||||
#endif
|
||||
|
||||
// HPUX doesn't allow for multiple attaches per process.
|
||||
#ifndef Q_OS_HPUX
|
||||
void tst_QSharedMemory::simpleDoubleProducerConsumer()
|
||||
{
|
||||
#ifdef Q_OS_HPUX
|
||||
QSKIP("HPUX doesn't allow for multiple attaches per process", SkipAll);
|
||||
#endif
|
||||
rememberKey(QLatin1String("market"));
|
||||
QSharedMemory producer(QLatin1String("market"));
|
||||
int size = 512;
|
||||
@ -580,6 +586,7 @@ void tst_QSharedMemory::simpleDoubleProducerConsumer()
|
||||
QVERIFY(consumer.attach());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
class Consumer : public QThread
|
||||
{
|
||||
|
@ -77,7 +77,9 @@ private slots:
|
||||
void processes_data();
|
||||
void processes();
|
||||
|
||||
#ifndef Q_OS_WIN
|
||||
void undo();
|
||||
#endif
|
||||
void initialValue();
|
||||
|
||||
private:
|
||||
@ -257,12 +259,10 @@ void tst_QSystemSemaphore::processes()
|
||||
}
|
||||
}
|
||||
|
||||
// This test only checks a unix behavior.
|
||||
#ifndef Q_OS_WIN
|
||||
void tst_QSystemSemaphore::undo()
|
||||
{
|
||||
#if defined(Q_OS_WIN)
|
||||
QSKIP("This test only checks a unix behavior", SkipSingle);
|
||||
#endif
|
||||
|
||||
QSystemSemaphore sem("store", 1, QSystemSemaphore::Create);
|
||||
|
||||
QStringList acquireArguments = QStringList() << acquire_js();
|
||||
@ -278,6 +278,7 @@ void tst_QSystemSemaphore::undo()
|
||||
acquire.waitForFinished(LACKYWAITTIME);
|
||||
QVERIFY(acquire.state()== QProcess::NotRunning);
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QSystemSemaphore::initialValue()
|
||||
{
|
||||
|
@ -62,7 +62,9 @@ private slots:
|
||||
|
||||
void nesting();
|
||||
void reentering();
|
||||
#ifndef QT_NO_EXCEPTIONS
|
||||
void exception();
|
||||
#endif
|
||||
};
|
||||
|
||||
class SingletonObject: public QObject
|
||||
@ -207,11 +209,9 @@ static void exception_helper(int &val)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_EXCEPTIONS
|
||||
void tst_QThreadOnce::exception()
|
||||
{
|
||||
#if defined(QT_NO_EXCEPTIONS)
|
||||
QSKIP("Compiled without exceptions, skipping test", SkipAll);
|
||||
#else
|
||||
int count = 0;
|
||||
|
||||
try {
|
||||
@ -227,8 +227,8 @@ void tst_QThreadOnce::exception()
|
||||
QVERIFY2(false, "Exception shouldn't have been thrown...");
|
||||
}
|
||||
QCOMPARE(count, 2);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
QTEST_MAIN(tst_QThreadOnce)
|
||||
#include "tst_qthreadonce.moc"
|
||||
|
@ -71,8 +71,10 @@ private slots:
|
||||
void qCompress_data();
|
||||
#ifndef QT_NO_COMPRESS
|
||||
void qCompress();
|
||||
#if !(defined Q_OS_HPUX && !defined __ia64 && defined Q_CC_GNU) && !defined Q_OS_SOLARIS && !defined Q_OS_QNX && !defined Q_OS_WIN
|
||||
void qUncompress_data();
|
||||
void qUncompress();
|
||||
#endif
|
||||
void qCompressionZeroTermination();
|
||||
#endif
|
||||
void constByteArray();
|
||||
@ -142,7 +144,9 @@ private slots:
|
||||
|
||||
void reserve();
|
||||
|
||||
#if defined(Q_COMPILER_LAMBDA) || defined(Q_CC_GNU)
|
||||
void literals();
|
||||
#endif
|
||||
};
|
||||
|
||||
tst_QByteArray::tst_QByteArray()
|
||||
@ -214,9 +218,9 @@ void tst_QByteArray::qCompress()
|
||||
QTEST( ::qUncompress( compressed ), "ba" );
|
||||
}
|
||||
|
||||
/*
|
||||
Just making sure it doesn't crash on invalid data.
|
||||
*/
|
||||
// Corrupt data causes this test to lock up on HP-UX / PA-RISC with gcc,
|
||||
// SOLARIS, QNX and Windows.
|
||||
#if !(defined Q_OS_HPUX && !defined __ia64 && defined Q_CC_GNU) && !defined Q_OS_SOLARIS && !defined Q_OS_QNX && !defined Q_OS_WIN
|
||||
void tst_QByteArray::qUncompress_data()
|
||||
{
|
||||
QTest::addColumn<QByteArray>("in");
|
||||
@ -241,16 +245,6 @@ void tst_QByteArray::qUncompress()
|
||||
QFETCH(QByteArray, in);
|
||||
QFETCH(QByteArray, out);
|
||||
|
||||
#if defined Q_OS_HPUX && !defined __ia64 && defined Q_CC_GNU
|
||||
QSKIP("Corrupt data causes this tests to lock up on HP-UX / PA-RISC with gcc", SkipAll);
|
||||
#elif defined Q_OS_SOLARIS
|
||||
QSKIP("Corrupt data causes this tests to lock up on Solaris", SkipAll);
|
||||
#elif defined Q_OS_QNX
|
||||
QSKIP("Corrupt data causes this test to lock up on QNX", SkipAll);
|
||||
#elif defined Q_OS_WIN
|
||||
QSKIP("Corrupt data causes this test to lock up on Windows", SkipAll);
|
||||
#endif
|
||||
|
||||
QByteArray res;
|
||||
res = ::qUncompress(in);
|
||||
QCOMPARE(res, out);
|
||||
@ -258,6 +252,7 @@ void tst_QByteArray::qUncompress()
|
||||
res = ::qUncompress(in + "blah");
|
||||
QCOMPARE(res, out);
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QByteArray::qCompressionZeroTermination()
|
||||
{
|
||||
@ -1540,9 +1535,10 @@ void tst_QByteArray::reserve()
|
||||
nil2.reserve(0);
|
||||
}
|
||||
|
||||
// Only tested on c++0x compliant compiler or gcc.
|
||||
#if defined(Q_COMPILER_LAMBDA) || defined(Q_CC_GNU)
|
||||
void tst_QByteArray::literals()
|
||||
{
|
||||
#if defined(Q_COMPILER_LAMBDA) || defined(Q_CC_GNU)
|
||||
QByteArray str(QByteArrayLiteral("abcd"));
|
||||
|
||||
QVERIFY(str.length() == 4);
|
||||
@ -1559,11 +1555,8 @@ void tst_QByteArray::literals()
|
||||
|
||||
QVERIFY(str2.constData() == s);
|
||||
QVERIFY(str2.data() != s);
|
||||
|
||||
#else
|
||||
QSKIP("Only tested on c++0x compliant compiler or gcc", SkipAll);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
const char globalChar = '1';
|
||||
|
||||
|
@ -124,7 +124,9 @@ private slots:
|
||||
void dateTimeFromStringFormat_data();
|
||||
void dateTimeFromStringFormat();
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
void fromString_LOCALE_ILDATE();
|
||||
#endif
|
||||
|
||||
void fromString();
|
||||
|
||||
@ -1583,19 +1585,17 @@ void tst_QDateTime::fromString()
|
||||
QLocale::setDefault(def);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
void tst_QDateTime::fromString_LOCALE_ILDATE()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
QString date1 = QLatin1String("Sun 1. Dec 13:02:00 1974");
|
||||
QString date2 = QLatin1String("Sun Dec 1 13:02:00 1974");
|
||||
|
||||
QDateTime ref(QDate(1974, 12, 1), QTime(13, 2));
|
||||
QCOMPARE(ref, QDateTime::fromString(date2, Qt::TextDate));
|
||||
QCOMPARE(ref, QDateTime::fromString(date1, Qt::TextDate));
|
||||
#else
|
||||
QSKIP("Windows only", SkipAll);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QDateTime::utcOffset()
|
||||
{
|
||||
|
@ -83,11 +83,17 @@ public:
|
||||
tst_QLocale();
|
||||
|
||||
private slots:
|
||||
#ifdef Q_OS_WIN
|
||||
void windowsDefaultLocale();
|
||||
#endif
|
||||
#ifdef Q_OS_MAC
|
||||
void macDefaultLocale();
|
||||
#endif
|
||||
|
||||
void ctor();
|
||||
#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS)
|
||||
void emptyCtor();
|
||||
#endif
|
||||
void unixLocaleName();
|
||||
void double_conversion_data();
|
||||
void double_conversion();
|
||||
@ -361,14 +367,10 @@ void tst_QLocale::ctor()
|
||||
#undef TEST_CTOR
|
||||
}
|
||||
|
||||
// Uses unsupported Windows CE QProcess functionality (std streams, env).
|
||||
#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS)
|
||||
void tst_QLocale::emptyCtor()
|
||||
{
|
||||
#if defined(Q_OS_WINCE)
|
||||
QSKIP("Uses unsupported Windows CE QProcess functionality (std streams, env)", SkipAll);
|
||||
#endif
|
||||
#if defined(QT_NO_PROCESS)
|
||||
QSKIP("Qt was compiled with QT_NO_PROCESS", SkipAll);
|
||||
#else
|
||||
#define TEST_CTOR(req_lc, exp_str) \
|
||||
{ \
|
||||
/* Test constructor without arguments. Needs separate process */ \
|
||||
@ -439,8 +441,8 @@ void tst_QLocale::emptyCtor()
|
||||
TEST_CTOR("123456", defaultLoc);
|
||||
|
||||
#undef TEST_CTOR
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QLocale::unixLocaleName()
|
||||
{
|
||||
@ -1074,12 +1076,9 @@ void tst_QLocale::toDateTime()
|
||||
QCOMPARE(l.toDateTime(string, QLocale::LongFormat), result);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
void tst_QLocale::macDefaultLocale()
|
||||
{
|
||||
#ifndef Q_OS_MAC
|
||||
QSKIP("This is a Mac OS X-only test", SkipAll);
|
||||
#endif
|
||||
|
||||
QLocale locale = QLocale::system();
|
||||
if (locale.name() != QLatin1String("en_US")) {
|
||||
QSKIP("This test only tests for en_US", SkipAll);
|
||||
@ -1156,8 +1155,8 @@ void tst_QLocale::macDefaultLocale()
|
||||
QList<Qt::DayOfWeek> days;
|
||||
days << Qt::Monday << Qt::Tuesday << Qt::Wednesday << Qt::Thursday << Qt::Friday;
|
||||
QCOMPARE(locale.weekdays(), days);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <qt_windows.h>
|
||||
@ -1212,14 +1211,11 @@ public:
|
||||
QString m_decimal, m_thousand, m_sdate, m_ldate, m_time;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
void tst_QLocale::windowsDefaultLocale()
|
||||
{
|
||||
#ifndef Q_OS_WIN
|
||||
QSKIP("This is a Windows test", SkipAll);
|
||||
#else
|
||||
RestoreLocaleHelper systemLocale;
|
||||
// set weird system defaults and make sure we're using them
|
||||
setWinLocaleInfo(LOCALE_SDECIMAL, QLatin1String("@"));
|
||||
@ -1254,8 +1250,8 @@ void tst_QLocale::windowsDefaultLocale()
|
||||
QCOMPARE(locale.toString(QDateTime(QDate(1974, 12, 1), QTime(1,2,3)), QLocale::LongFormat),
|
||||
QString("1@12@1974 1^2^3"));
|
||||
QCOMPARE(locale.toString(QTime(1,2,3), QLocale::LongFormat), QString("1^2^3"));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QLocale::numberOptions()
|
||||
{
|
||||
|
@ -68,7 +68,9 @@ private slots:
|
||||
void basics();
|
||||
void operators();
|
||||
void swap();
|
||||
#ifndef Q_CC_SUN
|
||||
void forwardDeclaration1();
|
||||
#endif
|
||||
void forwardDeclaration2();
|
||||
void memoryManagement();
|
||||
void downCast();
|
||||
@ -98,8 +100,10 @@ private slots:
|
||||
void map();
|
||||
void hash();
|
||||
void validConstructs();
|
||||
#ifndef QTEST_CROSS_COMPILED
|
||||
void invalidConstructs_data();
|
||||
void invalidConstructs();
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
void cleanup() { check(); }
|
||||
@ -340,11 +344,10 @@ ForwardDeclared *forwardPointer();
|
||||
void externalForwardDeclaration();
|
||||
extern int forwardDeclaredDestructorRunCount;
|
||||
|
||||
// This type of forward declaration is not valid with SunCC.
|
||||
#ifndef Q_CC_SUN
|
||||
void tst_QSharedPointer::forwardDeclaration1()
|
||||
{
|
||||
#if defined(Q_CC_SUN) || defined(Q_CC_WINSCW) || defined(Q_CC_RVCT)
|
||||
QSKIP("This type of forward declaration is not valid with this compiler", SkipAll);
|
||||
#else
|
||||
externalForwardDeclaration();
|
||||
|
||||
struct Wrapper { QSharedPointer<ForwardDeclared> pointer; };
|
||||
@ -356,8 +359,8 @@ void tst_QSharedPointer::forwardDeclaration1()
|
||||
QVERIFY(!w.pointer.isNull());
|
||||
}
|
||||
QCOMPARE(forwardDeclaredDestructorRunCount, 1);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "forwarddeclared.h"
|
||||
|
||||
@ -1657,6 +1660,9 @@ void tst_QSharedPointer::validConstructs()
|
||||
|
||||
typedef bool (QTest::QExternalTest:: * TestFunction)(const QByteArray &body);
|
||||
Q_DECLARE_METATYPE(TestFunction)
|
||||
|
||||
// This test does not work on cross compiled systems.
|
||||
#ifndef QTEST_CROSS_COMPILED
|
||||
void tst_QSharedPointer::invalidConstructs_data()
|
||||
{
|
||||
QTest::addColumn<TestFunction>("testFunction");
|
||||
@ -1801,9 +1807,6 @@ void tst_QSharedPointer::invalidConstructs()
|
||||
#ifdef Q_CC_MINGW
|
||||
QSKIP("The maintainer of QSharedPointer: 'We don't know what the problem is so skip the tests.'", SkipAll);
|
||||
#endif
|
||||
#ifdef QTEST_CROSS_COMPILED
|
||||
QSKIP("This test does not work on cross compiled systems", SkipAll);
|
||||
#endif
|
||||
|
||||
QTest::QExternalTest test;
|
||||
test.setQtModules(QTest::QExternalTest::QtCore);
|
||||
@ -1858,6 +1861,7 @@ void tst_QSharedPointer::invalidConstructs()
|
||||
QFAIL("Fail");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace QTBUG11730 {
|
||||
struct IB
|
||||
|
@ -74,8 +74,10 @@ public slots:
|
||||
void init();
|
||||
void cleanup();
|
||||
private slots:
|
||||
#if !defined(Q_CC_HPACC) && !defined(QT_NO_STL)
|
||||
void fromStdString();
|
||||
void toStdString();
|
||||
#endif
|
||||
void check_QTextIOStream();
|
||||
void check_QTextStream();
|
||||
void check_QDataStream();
|
||||
@ -156,7 +158,9 @@ private slots:
|
||||
void constructor();
|
||||
void constructorQByteArray_data();
|
||||
void constructorQByteArray();
|
||||
#if !defined(Q_CC_HPACC) && !defined(QT_NO_STL)
|
||||
void STL();
|
||||
#endif
|
||||
void isEmpty();
|
||||
void isNull();
|
||||
void acc_01();
|
||||
@ -197,8 +201,10 @@ private slots:
|
||||
void integer_conversion();
|
||||
void tortureSprintfDouble();
|
||||
void toNum();
|
||||
#if !defined(Q_OS_MAC) && (!defined(Q_OS_WIN) || defined(Q_OS_WINCE))
|
||||
void localeAwareCompare_data();
|
||||
void localeAwareCompare();
|
||||
#endif
|
||||
void split_data();
|
||||
void split();
|
||||
void split_regexp();
|
||||
@ -222,8 +228,12 @@ private slots:
|
||||
void QTBUG10404_compareRef();
|
||||
void QTBUG9281_arg_locale();
|
||||
|
||||
#ifdef QT_USE_ICU
|
||||
void toUpperLower_icu();
|
||||
#endif
|
||||
#if defined(QT_UNICODE_LITERAL) && (defined(Q_COMPILER_LAMBDA) || defined(Q_CC_GNU))
|
||||
void literals();
|
||||
#endif
|
||||
|
||||
void reserve();
|
||||
void toHtmlEscaped_data();
|
||||
@ -823,12 +833,10 @@ void tst_QString::constructorQByteArray()
|
||||
QCOMPARE( strBA, expected );
|
||||
}
|
||||
|
||||
// This test crashes on HP-UX with aCC.
|
||||
#if !defined(Q_CC_HPACC) && !defined(QT_NO_STL)
|
||||
void tst_QString::STL()
|
||||
{
|
||||
#ifdef Q_CC_HPACC
|
||||
QSKIP("This test crashes on HP-UX with aCC", SkipSingle);
|
||||
#endif
|
||||
#ifndef QT_NO_STL
|
||||
#ifndef QT_NO_CAST_TO_ASCII
|
||||
QString qt( "QString" );
|
||||
|
||||
@ -877,10 +885,8 @@ void tst_QString::STL()
|
||||
QCOMPARE(s, QString::fromLatin1("hello"));
|
||||
QCOMPARE(stlStr, s.toStdWString());
|
||||
#endif
|
||||
#else
|
||||
QSKIP( "Not tested without STL support", SkipAll);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QString::truncate()
|
||||
{
|
||||
@ -3142,12 +3148,10 @@ void tst_QString::setRawData()
|
||||
QVERIFY(cstr.data_ptr() != csd);
|
||||
}
|
||||
|
||||
// This test crashes on HP-UX with aCC.
|
||||
#if !defined(Q_CC_HPACC) && !defined(QT_NO_STL)
|
||||
void tst_QString::fromStdString()
|
||||
{
|
||||
#ifdef Q_CC_HPACC
|
||||
QSKIP("This test crashes on HP-UX with aCC", SkipSingle);
|
||||
#endif
|
||||
#if !defined(QT_NO_STL)
|
||||
std::string stroustrup = "foo";
|
||||
QString eng = QString::fromStdString( stroustrup );
|
||||
QCOMPARE( eng, QString("foo") );
|
||||
@ -3155,15 +3159,13 @@ void tst_QString::fromStdString()
|
||||
std::string stdnull( cnull, sizeof(cnull)-1 );
|
||||
QString qtnull = QString::fromStdString( stdnull );
|
||||
QCOMPARE( qtnull.size(), int(stdnull.size()) );
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
// This test crashes on HP-UX with aCC.
|
||||
#if !defined(Q_CC_HPACC) && !defined(QT_NO_STL)
|
||||
void tst_QString::toStdString()
|
||||
{
|
||||
#ifdef Q_CC_HPACC
|
||||
QSKIP("This test crashes on HP-UX with aCC", SkipSingle);
|
||||
#endif
|
||||
#if !defined(QT_NO_STL)
|
||||
QString nord = "foo";
|
||||
std::string stroustrup1 = nord.toStdString();
|
||||
QVERIFY( qstrcmp(stroustrup1.c_str(), "foo") == 0 );
|
||||
@ -3177,8 +3179,8 @@ void tst_QString::toStdString()
|
||||
QString qtnull( qcnull, sizeof(qcnull)/sizeof(QChar) );
|
||||
std::string stdnull = qtnull.toStdString();
|
||||
QCOMPARE( int(stdnull.size()), qtnull.size() );
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QString::utf8()
|
||||
{
|
||||
@ -4228,6 +4230,10 @@ void tst_QString::tortureSprintfDouble()
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
// Setting the locale is not supported on OS X (you can set the C locale,
|
||||
// but that won't affect CFStringCompare which is used to compare strings).
|
||||
// On Windows other than Win CE, we cannot set the system or user locale.
|
||||
#if !defined(Q_OS_MAC) && (!defined(Q_OS_WIN) || defined(Q_OS_WINCE))
|
||||
void tst_QString::localeAwareCompare_data()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
@ -4325,9 +4331,6 @@ void tst_QString::localeAwareCompare_data()
|
||||
void tst_QString::localeAwareCompare()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
# ifndef Q_OS_WINCE
|
||||
QSKIP("On others than Win CE, we cannot set the system or user locale.", SkipAll);
|
||||
# endif
|
||||
QFETCH(ulong, locale);
|
||||
#else
|
||||
QFETCH(QString, locale);
|
||||
@ -4352,8 +4355,6 @@ void tst_QString::localeAwareCompare()
|
||||
QCOMPARE(locale, GetThreadLocale());
|
||||
# endif
|
||||
|
||||
#elif defined (Q_OS_MAC)
|
||||
QSKIP("Setting the locale is not supported on OS X (you can set the C locale, but that won't affect CFStringCompare which is used to compare strings)", SkipAll);
|
||||
#elif defined(QT_USE_ICU)
|
||||
QLocale::setDefault(QLocale(locale));
|
||||
#else
|
||||
@ -4429,6 +4430,7 @@ void tst_QString::localeAwareCompare()
|
||||
setlocale(LC_ALL, "");
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QString::split_data()
|
||||
{
|
||||
@ -5073,12 +5075,9 @@ void tst_QString::QTBUG9281_arg_locale()
|
||||
QLocale::setDefault(QLocale::C);
|
||||
}
|
||||
|
||||
#ifdef QT_USE_ICU
|
||||
void tst_QString::toUpperLower_icu()
|
||||
{
|
||||
#ifndef QT_USE_ICU
|
||||
QSKIP("Qt was built without ICU support", SkipAll);
|
||||
#endif
|
||||
|
||||
QString s = QString::fromLatin1("i");
|
||||
|
||||
QCOMPARE(s.toUpper(), QString::fromLatin1("I"));
|
||||
@ -5111,10 +5110,12 @@ void tst_QString::toUpperLower_icu()
|
||||
|
||||
// the cleanup function will restore the default locale
|
||||
}
|
||||
#endif
|
||||
|
||||
// Only tested on c++0x compliant compiler or gcc.
|
||||
#if defined(QT_UNICODE_LITERAL) && (defined(Q_COMPILER_LAMBDA) || defined(Q_CC_GNU))
|
||||
void tst_QString::literals()
|
||||
{
|
||||
#if defined(QT_UNICODE_LITERAL) && (defined(Q_COMPILER_LAMBDA) || defined(Q_CC_GNU))
|
||||
QString str(QStringLiteral("abcd"));
|
||||
|
||||
QVERIFY(str.length() == 4);
|
||||
@ -5131,11 +5132,8 @@ void tst_QString::literals()
|
||||
|
||||
QVERIFY(str2.constData() == s);
|
||||
QVERIFY(str2.data() != s);
|
||||
|
||||
#else
|
||||
QSKIP("Only tested on c++0x compliant compiler or gcc", SkipAll);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QString::reserve()
|
||||
{
|
||||
|
@ -79,7 +79,9 @@ private slots:
|
||||
void join_data() const;
|
||||
void joinEmptiness() const;
|
||||
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
void initializeList() const;
|
||||
#endif
|
||||
};
|
||||
|
||||
extern const char email[];
|
||||
@ -323,16 +325,15 @@ void tst_QStringList::joinEmptiness() const
|
||||
QVERIFY(string.isNull());
|
||||
}
|
||||
|
||||
// this test require C++0x support
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
void tst_QStringList::initializeList() const
|
||||
{
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
QStringList v1{QLatin1String("hello"),"world",QString::fromLatin1("plop")};
|
||||
QCOMPARE(v1, (QStringList() << "hello" << "world" << "plop"));
|
||||
QCOMPARE(v1, (QStringList{"hello","world","plop"}));
|
||||
#else
|
||||
QSKIP("Require C++0x support, pass the right flag to the compiler", SkipAll);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
QTEST_APPLESS_MAIN(tst_QStringList)
|
||||
#include "tst_qstringlist.moc"
|
||||
|
Loading…
Reference in New Issue
Block a user