diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2016-03-22 07:24:57 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2016-03-22 07:28:42 +0100 |
commit | a02863234d76abb6c9f289026ae4ea3145924f30 (patch) | |
tree | aef6381d0000a78ba69ac80eb03739b1c8ca5fc3 /tests/auto/corelib | |
parent | e77b13621f0057374d83a2b884f03dd2e5b7b88c (diff) | |
parent | e4d79e1fdeb6b26ba0b12b578daacf7cd672b960 (diff) |
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
configure
mkspecs/common/wince/qplatformdefs.h
src/plugins/platforms/directfb/qdirectfbbackingstore.cpp
src/plugins/platforms/xcb/qxcbbackingstore.cpp
Change-Id: Ied4d31264a9afca9514b51a7eb1494c28712793c
Diffstat (limited to 'tests/auto/corelib')
15 files changed, 224 insertions, 47 deletions
diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp index 152906287c..bb4d1f4bf2 100644 --- a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp +++ b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp @@ -732,8 +732,8 @@ void tst_QGlobal::testqOverload() QVERIFY(qOverload<QByteArray>(&freeOverloaded) == static_cast<void (*)(QByteArray)>(&freeOverloaded)); - QVERIFY((qOverload<QByteArray, const QString &>(&freeOverloaded)), - static_cast<void (*)(QByteArray, const QString &)>(&freeOverloaded)); + QVERIFY((qOverload<QByteArray, const QString &>(&freeOverloaded) == + static_cast<void (*)(QByteArray, const QString &)>(&freeOverloaded))); // value returning free overloaded functions QVERIFY(qOverload<>(&freeOverloadedGet) == diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index e5195000aa..c47e88b0e6 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -141,6 +141,8 @@ private slots: void startStopStartStop(); void startStopStartStopBuffers_data(); void startStopStartStopBuffers(); + void processEventsInAReadyReadSlot_data(); + void processEventsInAReadyReadSlot(); // keep these at the end, since they use lots of processes and sometimes // caused obscure failures to occur in tests that followed them (esp. on the Mac) @@ -153,6 +155,7 @@ private slots: protected slots: void readFromProcess(); void exitLoopSlot(); + void processApplicationEvents(); #ifndef Q_OS_WINCE void restartProcess(); void waitForReadyReadInAReadyReadSlotSlot(); @@ -471,6 +474,11 @@ void tst_QProcess::exitLoopSlot() QTestEventLoop::instance().exitLoop(); } +void tst_QProcess::processApplicationEvents() +{ + QCoreApplication::processEvents(); +} + #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE void tst_QProcess::echoTest2() @@ -688,11 +696,7 @@ void tst_QProcess::waitForFinished() process.start("testProcessOutput/testProcessOutput"); -#if !defined(Q_OS_WINCE) - QVERIFY(process.waitForFinished(5000)); -#else - QVERIFY(process.waitForFinished(30000)); -#endif + QVERIFY(process.waitForFinished()); QCOMPARE(process.exitStatus(), QProcess::NormalExit); #if defined (Q_OS_WINCE) @@ -916,12 +920,7 @@ void tst_QProcess::hardExit() proc.start("testProcessEcho/testProcessEcho"); #endif -#ifndef Q_OS_WINCE - QVERIFY(proc.waitForStarted(5000)); -#else - QVERIFY(proc.waitForStarted(10000)); -#endif - + QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString())); proc.kill(); QVERIFY(proc.waitForFinished(5000)); @@ -1417,24 +1416,17 @@ void tst_QProcess::spaceArgsTest() QString program = programs.at(i); process.start(program, args); -#if defined(Q_OS_WINCE) - const int timeOutMS = 10000; -#else - const int timeOutMS = 5000; -#endif QByteArray errorMessage; - bool started = process.waitForStarted(timeOutMS); + bool started = process.waitForStarted(); if (!started) errorMessage = startFailMessage(program, process); QVERIFY2(started, errorMessage.constData()); - QVERIFY(process.waitForFinished(timeOutMS)); + QVERIFY(process.waitForFinished()); QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); #if !defined(Q_OS_WINCE) QStringList actual = QString::fromLatin1(process.readAll()).split("|"); -#endif -#if !defined(Q_OS_WINCE) QVERIFY(!actual.isEmpty()); // not interested in the program name, it might be different. actual.removeFirst(); @@ -1459,8 +1451,6 @@ void tst_QProcess::spaceArgsTest() #if !defined(Q_OS_WINCE) actual = QString::fromLatin1(process.readAll()).split("|"); -#endif -#if !defined(Q_OS_WINCE) QVERIFY(!actual.isEmpty()); // not interested in the program name, it might be different. actual.removeFirst(); @@ -1482,13 +1472,8 @@ void tst_QProcess::nativeArguments() proc.start(QString::fromLatin1("testProcessSpacesArgs/nospace"), QStringList()); -#if !defined(Q_OS_WINCE) - QVERIFY(proc.waitForStarted(5000)); - QVERIFY(proc.waitForFinished(5000)); -#else - QVERIFY(proc.waitForStarted(10000)); - QVERIFY(proc.waitForFinished(10000)); -#endif + QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString())); + QVERIFY(proc.waitForFinished()); QCOMPARE(proc.exitStatus(), QProcess::NormalExit); QCOMPARE(proc.exitCode(), 0); @@ -2550,6 +2535,31 @@ void tst_QProcess::startStopStartStopBuffers() } } +void tst_QProcess::processEventsInAReadyReadSlot_data() +{ + QTest::addColumn<bool>("callWaitForReadyRead"); + + QTest::newRow("no waitForReadyRead") << false; + QTest::newRow("waitForReadyRead") << true; +} + +void tst_QProcess::processEventsInAReadyReadSlot() +{ + // Test whether processing events in a readyReadXXX slot crashes. (QTBUG-48697) + QFETCH(bool, callWaitForReadyRead); + QProcess process; + QObject::connect(&process, &QProcess::readyReadStandardOutput, + this, &tst_QProcess::processApplicationEvents); + process.start("testProcessEcho/testProcessEcho"); + QVERIFY(process.waitForStarted()); + const QByteArray data(156, 'x'); + process.write(data.constData(), data.size() + 1); + if (callWaitForReadyRead) + QVERIFY(process.waitForReadyRead()); + if (process.state() == QProcess::Running) + QVERIFY(process.waitForFinished()); +} + #endif //QT_NO_PROCESS QTEST_MAIN(tst_QProcess) diff --git a/tests/auto/corelib/io/qtextstream/test/test.pro b/tests/auto/corelib/io/qtextstream/test/test.pro index 93fb6d232f..50335524d3 100644 --- a/tests/auto/corelib/io/qtextstream/test/test.pro +++ b/tests/auto/corelib/io/qtextstream/test/test.pro @@ -19,3 +19,7 @@ TESTDATA += \ ../qtextstream.qrc \ ../tst_qtextstream.cpp \ ../resources + +builtin_testdata { + DEFINES += BUILTIN_TESTDATA +} diff --git a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp index 439da8b1a3..104873b85e 100644 --- a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp +++ b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp @@ -60,6 +60,7 @@ public: public slots: void initTestCase(); void cleanup(); + void cleanupTestCase(); private slots: void getSetCheck(); @@ -223,6 +224,8 @@ private slots: void alignAccountingStyle(); void setCodec(); + void textModeOnEmptyRead(); + private: void generateLineData(bool for_QString); void generateAllData(bool for_QString); @@ -234,6 +237,9 @@ private: QTemporaryDir tempDir; QString testFileName; +#ifdef BUILTIN_TESTDATA + QSharedPointer<QTemporaryDir> m_dataDir; +#endif const QString m_rfc3261FilePath; const QString m_shiftJisFilePath; }; @@ -260,9 +266,14 @@ void tst_QTextStream::initTestCase() testFileName = tempDir.path() + "/testfile"; +#ifdef BUILTIN_TESTDATA + m_dataDir = QEXTRACTTESTDATA("/"); + QVERIFY2(QDir::setCurrent(m_dataDir->path()), qPrintable("Could not chdir to " + m_dataDir->path())); +#else // chdir into the testdata dir and refer to our helper apps with relative paths QString testdata_dir = QFileInfo(QFINDTESTDATA("stdinProcess")).absolutePath(); QVERIFY2(QDir::setCurrent(testdata_dir), qPrintable("Could not chdir to " + testdata_dir)); +#endif } // Testing get/set functions @@ -385,6 +396,13 @@ void tst_QTextStream::cleanup() QCoreApplication::instance()->processEvents(); } +void tst_QTextStream::cleanupTestCase() +{ +#ifdef BUILTIN_TESTDATA + QDir::setCurrent(QCoreApplication::applicationDirPath()); +#endif +} + // ------------------------------------------------------------------------------ void tst_QTextStream::construction() { @@ -3040,6 +3058,19 @@ void tst_QTextStream::int_write_with_locale() QCOMPARE(result, output); } +void tst_QTextStream::textModeOnEmptyRead() +{ + const QString filename(tempDir.path() + QLatin1String("/textmodetest.txt")); + + QFile file(filename); + QVERIFY2(file.open(QIODevice::ReadWrite | QIODevice::Text), qPrintable(file.errorString())); + QTextStream stream(&file); + QVERIFY(file.isTextModeEnabled()); + QString emptyLine = stream.readLine(); // Text mode flag cleared here + QVERIFY(file.isTextModeEnabled()); +} + + // ------------------------------------------------------------------------------ QTEST_MAIN(tst_QTextStream) diff --git a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp index 2f954e16cf..fd32dc1ef8 100644 --- a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp +++ b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp @@ -131,6 +131,22 @@ namespace MyNamespace { MyEnum m_enum; MyFlags m_flags; }; + + // Test inherits + class MyClassSubclass : public MyClass + { + Q_OBJECT + }; + + class MyClassSubclass2 : public MyClass2 + { + Q_OBJECT + }; + + class MyClass2Subclass : public MyClass + { + Q_OBJECT + }; } @@ -222,6 +238,9 @@ private slots: void signalIndex(); void enumDebugStream(); + void inherits_data(); + void inherits(); + signals: void value6Changed(); void value7Changed(const QString &); @@ -1425,5 +1444,34 @@ void tst_QMetaObject::enumDebugStream() qDebug() << f1 << f2; } +void tst_QMetaObject::inherits_data() +{ + QTest::addColumn<const QMetaObject *>("derivedMetaObject"); + QTest::addColumn<const QMetaObject *>("baseMetaObject"); + QTest::addColumn<bool>("inheritsResult"); + + QTest::newRow("MyClass inherits QObject") + << &MyNamespace::MyClass::staticMetaObject << &QObject::staticMetaObject << true; + QTest::newRow("QObject inherits MyClass") + << &QObject::staticMetaObject << &MyNamespace::MyClass::staticMetaObject << false; + QTest::newRow("MyClass inherits MyClass") + << &MyNamespace::MyClass::staticMetaObject << &MyNamespace::MyClass::staticMetaObject << true; + QTest::newRow("MyClassSubclass inherits QObject") + << &MyNamespace::MyClassSubclass::staticMetaObject << &QObject::staticMetaObject << true; + QTest::newRow("MyClassSubclass2 inherits QObject") + << &MyNamespace::MyClassSubclass2::staticMetaObject << &QObject::staticMetaObject << true; + QTest::newRow("MyClassSubclass2 inherits MyClass2") + << &MyNamespace::MyClassSubclass2::staticMetaObject << &MyNamespace::MyClass2Subclass::staticMetaObject << false; +} + +void tst_QMetaObject::inherits() +{ + QFETCH(const QMetaObject *, derivedMetaObject); + QFETCH(const QMetaObject *, baseMetaObject); + QFETCH(bool, inheritsResult); + + QCOMPARE(derivedMetaObject->inherits(baseMetaObject), inheritsResult); +} + QTEST_MAIN(tst_QMetaObject) #include "tst_qmetaobject.moc" diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index b1ae4292d0..fbb6a30917 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -1473,7 +1473,7 @@ static QByteArray createTypeName(const char *begin, const char *va) } if (tn.endsWith('>')) tn += ' '; - tn += ">"; + tn += '>'; return tn; } #endif diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 540cd66715..23f8ff5857 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -275,8 +275,10 @@ static void playWithObjects() void tst_QObject::initTestCase() { +#ifndef QT_NO_PROCESS const QString testDataDir = QFileInfo(QFINDTESTDATA("signalbug")).absolutePath(); QVERIFY2(QDir::setCurrent(testDataDir), qPrintable("Could not chdir to " + testDataDir)); +#endif } void tst_QObject::disconnect() diff --git a/tests/auto/corelib/kernel/qsharedmemory/qsharedmemory.pro b/tests/auto/corelib/kernel/qsharedmemory/qsharedmemory.pro index a36b15c906..69062a9741 100644 --- a/tests/auto/corelib/kernel/qsharedmemory/qsharedmemory.pro +++ b/tests/auto/corelib/kernel/qsharedmemory/qsharedmemory.pro @@ -1,3 +1,5 @@ TEMPLATE = subdirs -SUBDIRS = sharedmemoryhelper test +!winrt: SUBDIRS = sharedmemoryhelper + +SUBDIRS += test diff --git a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp index a4c918ed23..b6f6d2a7f3 100644 --- a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp +++ b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp @@ -133,7 +133,9 @@ tst_QSharedMemory::~tst_QSharedMemory() void tst_QSharedMemory::initTestCase() { +#ifndef QT_NO_PROCESS QVERIFY2(!m_helperBinary.isEmpty(), "Could not find helper binary"); +#endif } void tst_QSharedMemory::init() diff --git a/tests/auto/corelib/plugin/plugin.pro b/tests/auto/corelib/plugin/plugin.pro index e6b748e4f4..777e920995 100644 --- a/tests/auto/corelib/plugin/plugin.pro +++ b/tests/auto/corelib/plugin/plugin.pro @@ -8,3 +8,9 @@ load(qfeatures) qpluginloader \ qplugin \ qlibrary + +contains(CONFIG, static) { + message(Disabling tests requiring shared build of Qt) + SUBDIRS -= qfactoryloader \ + qpluginloader +} diff --git a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp index 3bed64a76a..fe465df395 100644 --- a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp +++ b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp @@ -357,28 +357,46 @@ void tst_QAtomicIntegerXX::loadAcquireStoreRelease() void tst_QAtomicIntegerXX::refDeref() { QFETCH(LargeInt, value); - T nextValue = T(value + 1); - T prevValue = T(value - 1); + const bool needToPreventOverflow = TypeIsSigned && value == std::numeric_limits<T>::max(); + const bool needToPreventUnderflow = TypeIsSigned && value == std::numeric_limits<T>::min(); + T nextValue = T(value); + if (!needToPreventOverflow) + ++nextValue; + T prevValue = T(value); + if (!needToPreventUnderflow) + --prevValue; QAtomicInteger<T> atomic(value); + if (!needToPreventOverflow) { QCOMPARE(atomic.ref(), (nextValue != 0)); QCOMPARE(atomic.load(), nextValue); QCOMPARE(atomic.deref(), (value != 0)); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventUnderflow) { QCOMPARE(atomic.deref(), (prevValue != 0)); QCOMPARE(atomic.load(), prevValue); QCOMPARE(atomic.ref(), (value != 0)); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventOverflow) { QCOMPARE(++atomic, nextValue); QCOMPARE(--atomic, T(value)); + } + if (!needToPreventUnderflow) { QCOMPARE(--atomic, prevValue); QCOMPARE(++atomic, T(value)); + } + if (!needToPreventOverflow) { QCOMPARE(atomic++, T(value)); QCOMPARE(atomic--, nextValue); + } + if (!needToPreventUnderflow) { QCOMPARE(atomic--, T(value)); QCOMPARE(atomic++, prevValue); + } QCOMPARE(atomic.load(), T(value)); } @@ -481,53 +499,80 @@ void tst_QAtomicIntegerXX::fetchAndAdd() QFETCH(LargeInt, value); QAtomicInteger<T> atomic(value); - // note: this test has undefined behavior for signed max and min T parcel1 = 42; T parcel2 = T(0-parcel1); - T newValue1 = T(value) + parcel1; - T newValue2 = T(value) + parcel2; + const bool needToPreventOverflow = TypeIsSigned && value > std::numeric_limits<T>::max() + parcel2; + const bool needToPreventUnderflow = TypeIsSigned && value < std::numeric_limits<T>::min() + parcel1; + + T newValue1 = T(value); + if (!needToPreventOverflow) + newValue1 += parcel1; + T newValue2 = T(value); + if (!needToPreventUnderflow) + newValue2 += parcel2; + + if (!needToPreventOverflow) { QCOMPARE(atomic.fetchAndAddRelaxed(parcel1), T(value)); QCOMPARE(atomic.load(), newValue1); QCOMPARE(atomic.fetchAndAddRelaxed(parcel2), newValue1); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventUnderflow) { QCOMPARE(atomic.fetchAndAddRelaxed(parcel2), T(value)); QCOMPARE(atomic.load(), newValue2); QCOMPARE(atomic.fetchAndAddRelaxed(parcel1), newValue2); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventOverflow) { QCOMPARE(atomic.fetchAndAddAcquire(parcel1), T(value)); QCOMPARE(atomic.load(), newValue1); QCOMPARE(atomic.fetchAndAddAcquire(parcel2), newValue1); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventUnderflow) { QCOMPARE(atomic.fetchAndAddAcquire(parcel2), T(value)); QCOMPARE(atomic.load(), newValue2); QCOMPARE(atomic.fetchAndAddAcquire(parcel1), newValue2); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventOverflow) { QCOMPARE(atomic.fetchAndAddRelease(parcel1), T(value)); QCOMPARE(atomic.loadAcquire(), newValue1); QCOMPARE(atomic.fetchAndAddRelease(parcel2), newValue1); + } QCOMPARE(atomic.loadAcquire(), T(value)); + if (!needToPreventUnderflow) { QCOMPARE(atomic.fetchAndAddRelease(parcel2), T(value)); QCOMPARE(atomic.loadAcquire(), newValue2); QCOMPARE(atomic.fetchAndAddRelease(parcel1), newValue2); + } QCOMPARE(atomic.loadAcquire(), T(value)); + if (!needToPreventOverflow) { QCOMPARE(atomic.fetchAndAddOrdered(parcel1), T(value)); QCOMPARE(atomic.loadAcquire(), newValue1); QCOMPARE(atomic.fetchAndAddOrdered(parcel2), newValue1); + } QCOMPARE(atomic.loadAcquire(), T(value)); + if (!needToPreventUnderflow) { QCOMPARE(atomic.fetchAndAddOrdered(parcel2), T(value)); QCOMPARE(atomic.loadAcquire(), newValue2); QCOMPARE(atomic.fetchAndAddOrdered(parcel1), newValue2); + } QCOMPARE(atomic.loadAcquire(), T(value)); // operator+= + if (!needToPreventOverflow) { QCOMPARE(atomic += parcel1, newValue1); QCOMPARE(atomic += parcel2, T(value)); + } + if (!needToPreventUnderflow) { QCOMPARE(atomic += parcel2, newValue2); QCOMPARE(atomic += parcel1, T(value)); + } } void tst_QAtomicIntegerXX::fetchAndSub() @@ -535,53 +580,80 @@ void tst_QAtomicIntegerXX::fetchAndSub() QFETCH(LargeInt, value); QAtomicInteger<T> atomic(value); - // note: this test has undefined behavior for signed max and min T parcel1 = 42; T parcel2 = T(0-parcel1); - T newValue1 = T(value) - parcel1; - T newValue2 = T(value) - parcel2; + const bool needToPreventOverflow = TypeIsSigned && value > std::numeric_limits<T>::max() - parcel1; + const bool needToPreventUnderflow = TypeIsSigned && value < std::numeric_limits<T>::min() - parcel2; + + T newValue1 = T(value); + if (!needToPreventUnderflow) + newValue1 -= parcel1; + T newValue2 = T(value); + if (!needToPreventOverflow) + newValue2 -= parcel2; + + if (!needToPreventUnderflow) { QCOMPARE(atomic.fetchAndSubRelaxed(parcel1), T(value)); QCOMPARE(atomic.load(), newValue1); QCOMPARE(atomic.fetchAndSubRelaxed(parcel2), newValue1); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventOverflow) { QCOMPARE(atomic.fetchAndSubRelaxed(parcel2), T(value)); QCOMPARE(atomic.load(), newValue2); QCOMPARE(atomic.fetchAndSubRelaxed(parcel1), newValue2); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventUnderflow) { QCOMPARE(atomic.fetchAndSubAcquire(parcel1), T(value)); QCOMPARE(atomic.load(), newValue1); QCOMPARE(atomic.fetchAndSubAcquire(parcel2), newValue1); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventOverflow) { QCOMPARE(atomic.fetchAndSubAcquire(parcel2), T(value)); QCOMPARE(atomic.load(), newValue2); QCOMPARE(atomic.fetchAndSubAcquire(parcel1), newValue2); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventUnderflow) { QCOMPARE(atomic.fetchAndSubRelease(parcel1), T(value)); QCOMPARE(atomic.loadAcquire(), newValue1); QCOMPARE(atomic.fetchAndSubRelease(parcel2), newValue1); + } QCOMPARE(atomic.loadAcquire(), T(value)); + if (!needToPreventOverflow) { QCOMPARE(atomic.fetchAndSubRelease(parcel2), T(value)); QCOMPARE(atomic.loadAcquire(), newValue2); QCOMPARE(atomic.fetchAndSubRelease(parcel1), newValue2); + } QCOMPARE(atomic.loadAcquire(), T(value)); + if (!needToPreventUnderflow) { QCOMPARE(atomic.fetchAndSubOrdered(parcel1), T(value)); QCOMPARE(atomic.loadAcquire(), newValue1); QCOMPARE(atomic.fetchAndSubOrdered(parcel2), newValue1); + } QCOMPARE(atomic.loadAcquire(), T(value)); + if (!needToPreventOverflow) { QCOMPARE(atomic.fetchAndSubOrdered(parcel2), T(value)); QCOMPARE(atomic.loadAcquire(), newValue2); QCOMPARE(atomic.fetchAndSubOrdered(parcel1), newValue2); + } QCOMPARE(atomic.loadAcquire(), T(value)); // operator-= + if (!needToPreventUnderflow) { QCOMPARE(atomic -= parcel1, newValue1); QCOMPARE(atomic -= parcel2, T(value)); + } + if (!needToPreventOverflow) { QCOMPARE(atomic -= parcel2, newValue2); QCOMPARE(atomic -= parcel1, T(value)); + } } void tst_QAtomicIntegerXX::addSub() diff --git a/tests/auto/corelib/tools/qline/qline.pro b/tests/auto/corelib/tools/qline/qline.pro index c66df2cd68..81e2f17118 100644 --- a/tests/auto/corelib/tools/qline/qline.pro +++ b/tests/auto/corelib/tools/qline/qline.pro @@ -2,4 +2,4 @@ CONFIG += testcase TARGET = tst_qline QT = core testlib SOURCES = tst_qline.cpp -unix:!mac:!vxworks:!haiku:LIBS+=-lm +unix:!darwin:!vxworks:!haiku:!integrity: LIBS+=-lm diff --git a/tests/auto/corelib/tools/qrect/tst_qrect.cpp b/tests/auto/corelib/tools/qrect/tst_qrect.cpp index 9b35cdec30..d3c6412b0d 100644 --- a/tests/auto/corelib/tools/qrect/tst_qrect.cpp +++ b/tests/auto/corelib/tools/qrect/tst_qrect.cpp @@ -2347,7 +2347,7 @@ void tst_QRect::center_data() QTest::newRow( "SmallestQRect" ) << getQRectCase( SmallestQRect ) << QPoint(1,1); QTest::newRow( "MiddleQRect" ) << getQRectCase( MiddleQRect ) << QPoint(0,0); QTest::newRow( "LargestQRect" ) << getQRectCase( LargestQRect ) << QPoint(INT_MAX/2,INT_MAX/2); - QTest::newRow( "SmallestCoordQRect" ) << getQRectCase( SmallestCoordQRect ) << QPoint(0,0); + QTest::newRow( "SmallestCoordQRect" ) << getQRectCase( SmallestCoordQRect ) << QPoint(INT_MIN, INT_MIN); QTest::newRow( "LargestCoordQRect" ) << getQRectCase( LargestCoordQRect ) << QPoint(0,0); QTest::newRow( "RandomQRect" ) << getQRectCase( RandomQRect ) << QPoint(105,207); QTest::newRow( "NegativeSizeQRect" ) << getQRectCase( NegativeSizeQRect ) << QPoint(-4,-4); @@ -3169,8 +3169,7 @@ void tst_QRect::newMoveTopLeft_data() } { - QTest::newRow("LargestCoordQRect_NullQPoint") << getQRectCase(LargestCoordQRect) << getQPointCase(NullQPoint) - << QRect(QPoint(0,0), QPoint(INT_MAX+(0-INT_MIN),INT_MAX+(0-INT_MIN))); + // QTest::newRow("LargestCoordQRect_NullQPoint") -- Not tested as it would cause an overflow QTest::newRow("LargestCoordQRect_SmallestCoordQPoint") << getQRectCase(LargestCoordQRect) << getQPointCase(SmallestCoordQPoint) << QRect(QPoint(INT_MIN,INT_MIN), QPoint(INT_MAX,INT_MAX)); // QTest::newRow("LargestCoordQRect_MiddleNegCoordQPoint") -- Not tested as it would cause an overflow diff --git a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp index 1879543581..077a6a20f1 100644 --- a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp +++ b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp @@ -893,7 +893,7 @@ void tst_QTimeZone::macTest() void tst_QTimeZone::winTest() { -#if defined(QT_BUILD_INTERNAL) && defined(Q_OS_WIN) && !defined(Q_OS_WINRT) +#if defined(QT_BUILD_INTERNAL) && defined(Q_OS_WIN) // Known datetimes qint64 std = QDateTime(QDate(2012, 1, 1), QTime(0, 0, 0), Qt::UTC).toMSecsSinceEpoch(); qint64 dst = QDateTime(QDate(2012, 6, 1), QTime(0, 0, 0), Qt::UTC).toMSecsSinceEpoch(); diff --git a/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp b/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp index b889bcc6a9..8a153a4599 100644 --- a/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp +++ b/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp @@ -902,7 +902,8 @@ void tst_QXmlStream::testFalsePrematureError() const // Regression test for crash due to using empty QStack. void tst_QXmlStream::writerHangs() const { - QFile file("test.xml"); + QTemporaryDir dir(QDir::tempPath() + QLatin1String("/tst_qxmlstream.XXXXXX")); + QFile file(dir.path() + "/test.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); |