summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/global/qglobalstatic/qglobalstatic.pro12
-rw-r--r--tests/auto/corelib/global/qglobalstatic/tst_qglobalstatic.cpp214
-rw-r--r--tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp5
-rw-r--r--tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp8
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp10
-rw-r--r--tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp8
-rw-r--r--tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp4
-rw-r--r--tests/auto/corelib/plugin/quuid/tst_quuid.cpp4
-rw-r--r--tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp4
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp4
-rw-r--r--tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp13
-rw-r--r--tests/auto/gui/image/qimagereader/tst_qimagereader.cpp21
-rw-r--r--tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp21
-rw-r--r--tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp4
-rw-r--r--tests/auto/other/networkselftest/tst_networkselftest.cpp4
-rw-r--r--tests/auto/testlib/selftests/tst_selftests.cpp7
-rw-r--r--tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp8
-rw-r--r--tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp4
-rw-r--r--tests/auto/widgets/util/qundostack/tst_qundostack.cpp4
-rw-r--r--tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp8
20 files changed, 352 insertions, 15 deletions
diff --git a/tests/auto/corelib/global/qglobalstatic/qglobalstatic.pro b/tests/auto/corelib/global/qglobalstatic/qglobalstatic.pro
new file mode 100644
index 0000000000..21cab8f67d
--- /dev/null
+++ b/tests/auto/corelib/global/qglobalstatic/qglobalstatic.pro
@@ -0,0 +1,12 @@
+QT += testlib core-private
+
+QT -= gui
+
+TARGET = tst_qglobalstatic
+CONFIG += console
+CONFIG -= app_bundle
+CONFIG += exceptions
+
+SOURCES += tst_qglobalstatic.cpp
+DEFINES += SRCDIR=\\\"$$PWD/\\\"
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/global/qglobalstatic/tst_qglobalstatic.cpp b/tests/auto/corelib/global/qglobalstatic/tst_qglobalstatic.cpp
new file mode 100644
index 0000000000..b9aa70fe80
--- /dev/null
+++ b/tests/auto/corelib/global/qglobalstatic/tst_qglobalstatic.cpp
@@ -0,0 +1,214 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Thiago Macieira <thiago@kde.org>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QThread>
+#include <QtTest/QtTest>
+
+class tst_QGlobalStatic : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void beforeInitialization();
+ void api();
+ void constVolatile();
+ void exception();
+ void threadStressTest();
+ void afterDestruction();
+};
+
+Q_GLOBAL_STATIC_WITH_ARGS(const int, constInt, (42))
+Q_GLOBAL_STATIC_WITH_ARGS(volatile int, volatileInt, (-47))
+
+void otherFunction()
+{
+ // never called
+ constInt();
+ volatileInt();
+}
+
+// do not initialize the following Q_GLOBAL_STATIC
+Q_GLOBAL_STATIC(int, checkedBeforeInitialization)
+void tst_QGlobalStatic::beforeInitialization()
+{
+ QVERIFY(!checkedBeforeInitialization.exists());
+ QVERIFY(!checkedBeforeInitialization.isDestroyed());
+}
+
+struct Type {
+ int i;
+};
+
+Q_GLOBAL_STATIC(Type, checkedAfterInitialization)
+void tst_QGlobalStatic::api()
+{
+ // check the API
+ QVERIFY((Type *)checkedAfterInitialization);
+ QVERIFY(checkedAfterInitialization());
+ *checkedAfterInitialization = Type();
+ *checkedAfterInitialization() = Type();
+
+ checkedAfterInitialization()->i = 47;
+ checkedAfterInitialization->i = 42;
+ QCOMPARE(checkedAfterInitialization()->i, 42);
+ checkedAfterInitialization()->i = 47;
+ QCOMPARE(checkedAfterInitialization->i, 47);
+
+ QVERIFY(checkedAfterInitialization.exists());
+ QVERIFY(!checkedAfterInitialization.isDestroyed());
+}
+
+void tst_QGlobalStatic::constVolatile()
+{
+ QCOMPARE(*constInt(), 42);
+ QCOMPARE((int)*volatileInt(), -47);
+ QCOMPARE(*constInt(), 42);
+ QCOMPARE((int)*volatileInt(), -47);
+}
+
+struct ThrowingType
+{
+ static QBasicAtomicInt constructedCount;
+ static QBasicAtomicInt destructedCount;
+ ThrowingType(QBasicAtomicInt &throwControl)
+ {
+ constructedCount.ref();
+ if (throwControl.fetchAndAddRelaxed(-1) != 0)
+ throw 0;
+ }
+ ~ThrowingType() { destructedCount.ref(); }
+};
+QBasicAtomicInt ThrowingType::constructedCount = Q_BASIC_ATOMIC_INITIALIZER(0);
+QBasicAtomicInt ThrowingType::destructedCount = Q_BASIC_ATOMIC_INITIALIZER(0);
+
+QBasicAtomicInt exceptionControlVar = Q_BASIC_ATOMIC_INITIALIZER(1);
+Q_GLOBAL_STATIC_WITH_ARGS(ThrowingType, exceptionGS, (exceptionControlVar))
+void tst_QGlobalStatic::exception()
+{
+ if (exceptionControlVar.load() != 1)
+ QSKIP("This test cannot be run more than once");
+ ThrowingType::constructedCount.store(0);
+ ThrowingType::destructedCount.store(0);
+
+ bool exceptionCaught = false;
+ try {
+ exceptionGS();
+ } catch (int) {
+ exceptionCaught = true;
+ }
+ QCOMPARE(ThrowingType::constructedCount.load(), 1);
+ QVERIFY(exceptionCaught);
+
+ exceptionGS();
+ QCOMPARE(ThrowingType::constructedCount.load(), 2);
+}
+
+QBasicAtomicInt threadStressTestControlVar = Q_BASIC_ATOMIC_INITIALIZER(5);
+Q_GLOBAL_STATIC_WITH_ARGS(ThrowingType, threadStressTestGS, (threadStressTestControlVar))
+
+
+void tst_QGlobalStatic::threadStressTest()
+{
+ class ThreadStressTestThread: public QThread
+ {
+ public:
+ QReadWriteLock *lock;
+ void run()
+ {
+ QReadLocker l(lock);
+ //usleep(qrand() * 200 / RAND_MAX);
+ // thundering herd
+ try {
+ threadStressTestGS();
+ } catch (int) {
+ }
+ }
+ };
+
+ ThrowingType::constructedCount.store(0);
+ ThrowingType::destructedCount.store(0);
+ int expectedConstructionCount = threadStressTestControlVar.load() + 1;
+ if (expectedConstructionCount <= 0)
+ QSKIP("This test cannot be run more than once");
+
+ const int numThreads = 200;
+ ThreadStressTestThread threads[numThreads];
+ QReadWriteLock lock;
+ lock.lockForWrite();
+ for (int i = 0; i < numThreads; ++i) {
+ threads[i].lock = &lock;
+ threads[i].start();
+ }
+
+ // wait for all threads
+ // release the herd
+ lock.unlock();
+
+ for (int i = 0; i < numThreads; ++i)
+ threads[i].wait();
+
+ QCOMPARE(ThrowingType::constructedCount.loadAcquire(), expectedConstructionCount);
+ QCOMPARE(ThrowingType::destructedCount.loadAcquire(), 0);
+}
+
+Q_GLOBAL_STATIC(int, checkedAfterDestruction)
+void tst_QGlobalStatic::afterDestruction()
+{
+ // this test will not produce results now
+ // it will simply run some code on destruction (after the global statics have been deleted)
+ // if that fails, this will cause a crash
+
+ // static destruction is LIFO: so we must add our exit-time code before the
+ // global static is used for the first time
+ static struct RunAtExit {
+ ~RunAtExit() {
+ int *ptr = checkedAfterDestruction();
+ if (ptr)
+ qFatal("Global static is not null as was expected");
+ }
+ } runAtExit;
+ (void) runAtExit;
+
+ *checkedAfterDestruction = 42;
+}
+
+QTEST_APPLESS_MAIN(tst_QGlobalStatic);
+
+#include "tst_qglobalstatic.moc"
diff --git a/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp b/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp
index 9d3519680c..45f143b9fb 100644
--- a/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp
+++ b/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp
@@ -43,6 +43,10 @@
#include <QObject>
#include <QProcessEnvironment>
+#ifdef QT_NO_PROCESS
+QTEST_NOOP_MAIN
+#else
+
class tst_QProcessEnvironment: public QObject
{
Q_OBJECT
@@ -318,3 +322,4 @@ void tst_QProcessEnvironment::putenv()
QTEST_MAIN(tst_QProcessEnvironment)
#include "tst_qprocessenvironment.moc"
+#endif
diff --git a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
index a6e1f73904..56c07f1590 100644
--- a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
+++ b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
@@ -194,7 +194,7 @@ private slots:
void pos();
void pos2();
void pos3LargeFile();
-#ifndef Q_OS_WINCE
+#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS)
void readStdin();
void readAllFromStdin();
void readLineFromStdin();
@@ -1386,8 +1386,8 @@ void tst_QTextStream::pos3LargeFile()
}
// ------------------------------------------------------------------------------
-#ifndef Q_OS_WINCE
// Qt/CE has no stdin/out support for processes
+#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS)
void tst_QTextStream::readStdin()
{
QProcess stdinProcess;
@@ -1409,10 +1409,8 @@ void tst_QTextStream::readStdin()
QCOMPARE(b, 2);
QCOMPARE(c, 3);
}
-#endif
// ------------------------------------------------------------------------------
-#ifndef Q_OS_WINCE
// Qt/CE has no stdin/out support for processes
void tst_QTextStream::readAllFromStdin()
{
@@ -1430,10 +1428,8 @@ void tst_QTextStream::readAllFromStdin()
QChar quoteChar('"');
QCOMPARE(stream.readAll(), QString::fromLatin1("%1hello world%2 \n").arg(quoteChar).arg(quoteChar));
}
-#endif
// ------------------------------------------------------------------------------
-#ifndef Q_OS_WINCE
// Qt/CE has no stdin/out support for processes
void tst_QTextStream::readLineFromStdin()
{
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index 865264c43a..a6d1d9f14d 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -144,6 +144,16 @@ private slots:
void disconnectDoesNotLeakFunctor();
};
+struct QObjectCreatedOnShutdown
+{
+ QObjectCreatedOnShutdown() {}
+ ~QObjectCreatedOnShutdown()
+ {
+ QObject();
+ }
+};
+static QObjectCreatedOnShutdown s_qobjectCreatedOnShutdown;
+
class SenderObject : public QObject
{
Q_OBJECT
diff --git a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp
index daf8c31772..02f99b08d3 100644
--- a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp
+++ b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp
@@ -82,7 +82,7 @@ private slots:
void removeWhileAttached();
#endif
void emptyMemory();
-#ifndef Q_OS_WIN
+#if !defined(Q_OS_WIN) && !defined(QT_NO_PROCESS)
void readOnly();
#endif
@@ -98,8 +98,10 @@ private slots:
void simpleThreadedProducerConsumer();
// with processes
+#ifndef QT_NO_PROCESS
void simpleProcessProducerConsumer_data();
void simpleProcessProducerConsumer();
+#endif
// extreme cases
void useTooMuchMemory();
@@ -447,7 +449,7 @@ void tst_QSharedMemory::emptyMemory()
by writing to data and causing a segfault.
*/
// This test opens a crash dialog on Windows.
-#ifndef Q_OS_WIN
+#if !defined(Q_OS_WIN) && !defined(QT_NO_PROCESS)
void tst_QSharedMemory::readOnly()
{
rememberKey("readonly_segfault");
@@ -728,6 +730,7 @@ void tst_QSharedMemory::simpleThreadedProducerConsumer()
}
}
+#ifndef QT_NO_PROCESS
void tst_QSharedMemory::simpleProcessProducerConsumer_data()
{
QTest::addColumn<int>("processes");
@@ -785,6 +788,7 @@ void tst_QSharedMemory::simpleProcessProducerConsumer()
producer.waitForBytesWritten();
QVERIFY(producer.waitForFinished(5000));
}
+#endif
void tst_QSharedMemory::uniqueKey_data()
{
diff --git a/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp b/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp
index b10da3ecb7..d2b6848dab 100644
--- a/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp
+++ b/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp
@@ -66,6 +66,7 @@ private slots:
void basicacquire();
void complexacquire();
+#ifndef QT_NO_PROCESS
void basicProcesses();
void processes_data();
@@ -75,6 +76,7 @@ private slots:
void undo();
#endif
void initialValue();
+#endif // QT_NO_PROCESS
private:
QString helperBinary();
@@ -154,6 +156,7 @@ void tst_QSystemSemaphore::complexacquire()
QCOMPARE(sem.errorString(), QString());
}
+#ifndef QT_NO_PROCESS
void tst_QSystemSemaphore::basicProcesses()
{
QSystemSemaphore sem("store", 0, QSystemSemaphore::Create);
@@ -261,6 +264,7 @@ void tst_QSystemSemaphore::initialValue()
release.waitForFinished(HELPERWAITTIME);
QVERIFY(acquire.state()== QProcess::NotRunning);
}
+#endif
QString tst_QSystemSemaphore::helperBinary()
{
diff --git a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp
index 224c992def..197d56359f 100644
--- a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp
+++ b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp
@@ -73,7 +73,9 @@ private slots:
void versions();
void threadUniqueness();
+#ifndef QT_NO_PROCESS
void processUniqueness();
+#endif
void hash();
@@ -319,6 +321,7 @@ void tst_QUuid::threadUniqueness()
qDeleteAll(threads);
}
+#ifndef QT_NO_PROCESS
void tst_QUuid::processUniqueness()
{
QProcess process;
@@ -346,6 +349,7 @@ void tst_QUuid::processUniqueness()
// They should be *different*!
QVERIFY(processOneOutput != processTwoOutput);
}
+#endif
void tst_QUuid::hash()
{
diff --git a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp
index 29dbf2e31f..2072034f5f 100644
--- a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp
+++ b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp
@@ -71,7 +71,9 @@ private slots:
void autoDelete();
void adoptedThreads();
void ensureCleanupOrder();
+#ifndef QT_NO_PROCESS
void crashOnExit();
+#endif
void leakInDestructor();
void resetInDestructor();
void valueBased();
@@ -305,6 +307,7 @@ void tst_QThreadStorage::ensureCleanupOrder()
QVERIFY(First::order < Second::order);
}
+#ifndef QT_NO_PROCESS
static inline bool runCrashOnExit(const QString &binary, QString *errorMessage)
{
const int timeout = 60000;
@@ -332,6 +335,7 @@ void tst_QThreadStorage::crashOnExit()
QVERIFY2(runCrashOnExit(m_crashOnExit, &errorMessage),
qPrintable(errorMessage));
}
+#endif
// S stands for thread Safe.
class SPointer
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index acdd2a9b64..fcd763f60f 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -238,7 +238,7 @@ private slots:
#ifdef QT_USE_ICU
void toUpperLower_icu();
#endif
-#if defined(QT_UNICODE_LITERAL) && (defined(Q_COMPILER_LAMBDA) || defined(Q_CC_GNU))
+#if !defined(QT_NO_UNICODE_LITERAL) && defined(Q_COMPILER_LAMBDA)
void literals();
#endif
void eightBitLiterals_data();
@@ -5437,7 +5437,7 @@ void tst_QString::toUpperLower_icu()
}
#endif
-#if defined(QT_UNICODE_LITERAL) && (defined(Q_COMPILER_LAMBDA) || defined(Q_CC_GNU))
+#if !defined(QT_NO_UNICODE_LITERAL) && defined(Q_COMPILER_LAMBDA)
// Only tested on c++0x compliant compiler or gcc
void tst_QString::literals()
{
diff --git a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
index ea5c4e7b2b..c87b3297ee 100644
--- a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
+++ b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
@@ -1200,6 +1200,19 @@ void tst_QDBusConnection::registerVirtualObject()
QVERIFY(!con.registerVirtualObject(path, &obj, QDBusConnection::SubPath));
QCOMPARE(con.objectRegisteredAt(path), static_cast<QObject *>(0));
}
+
+ {
+ // Register object, make sure no SubPath handling object can be registered on a parent path.
+ // (same as above, but deeper)
+ QObject objectAtSubPath;
+ QVERIFY(con.registerObject(childChildPath, &objectAtSubPath));
+ QCOMPARE(con.objectRegisteredAt(childChildPath), static_cast<QObject *>(&objectAtSubPath));
+
+ VirtualObject obj;
+ QVERIFY(!con.registerVirtualObject(path, &obj, QDBusConnection::SubPath));
+ QCOMPARE(con.objectRegisteredAt(path), static_cast<QObject *>(0));
+ }
+
QCOMPARE(con.objectRegisteredAt(path), static_cast<QObject *>(0));
QCOMPARE(con.objectRegisteredAt(childPath), static_cast<QObject *>(0));
QCOMPARE(con.objectRegisteredAt(childChildPath), static_cast<QObject *>(0));
diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
index 50176d2430..bd11089a82 100644
--- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
@@ -94,6 +94,7 @@ private slots:
void multiWordNamedColorXPM();
void supportedFormats();
+ void supportedMimeTypes();
void readFromDevice_data();
void readFromDevice();
@@ -570,6 +571,26 @@ void tst_QImageReader::supportedFormats()
QCOMPARE(formatSet.size(), formats.size());
}
+void tst_QImageReader::supportedMimeTypes()
+{
+ QList<QByteArray> mimeTypes = QImageReader::supportedMimeTypes();
+ QList<QByteArray> sortedMimeTypes = mimeTypes;
+ qSort(sortedMimeTypes);
+
+ // check that the list is sorted
+ QCOMPARE(mimeTypes, sortedMimeTypes);
+
+ QSet<QByteArray> mimeTypeSet;
+ foreach (QByteArray mimeType, mimeTypes)
+ mimeTypeSet << mimeType;
+
+ // check the list as a minimum contains image/bmp
+ QVERIFY(mimeTypeSet.contains("image/bmp"));
+
+ // check that the list does not contain duplicates
+ QCOMPARE(mimeTypeSet.size(), mimeTypes.size());
+}
+
void tst_QImageReader::setBackgroundColor_data()
{
QTest::addColumn<QString>("fileName");
diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
index 3c36482d62..f1d0e227f6 100644
--- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
+++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
@@ -81,6 +81,7 @@ private slots:
void writeImage2_data();
void writeImage2();
void supportedFormats();
+ void supportedMimeTypes();
void writeToInvalidDevice();
@@ -352,6 +353,26 @@ void tst_QImageWriter::supportedFormats()
QCOMPARE(formatSet.size(), formats.size());
}
+void tst_QImageWriter::supportedMimeTypes()
+{
+ QList<QByteArray> mimeTypes = QImageWriter::supportedMimeTypes();
+ QList<QByteArray> sortedMimeTypes = mimeTypes;
+ qSort(sortedMimeTypes);
+
+ // check that the list is sorted
+ QCOMPARE(mimeTypes, sortedMimeTypes);
+
+ QSet<QByteArray> mimeTypeSet;
+ foreach (QByteArray mimeType, mimeTypes)
+ mimeTypeSet << mimeType;
+
+ // check the list as a minimum contains image/bmp
+ QVERIFY(mimeTypeSet.contains("image/bmp"));
+
+ // check that the list does not contain duplicates
+ QCOMPARE(mimeTypeSet.size(), mimeTypes.size());
+}
+
void tst_QImageWriter::writeToInvalidDevice()
{
QLatin1String fileName("/these/directories/do/not/exist/001.png");
diff --git a/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp b/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp
index 8522031406..529f45f001 100644
--- a/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp
+++ b/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp
@@ -75,7 +75,9 @@ private slots:
void sessionClosing_data();
void sessionClosing();
+#ifndef QT_NO_PROCESS
void outOfProcessSession();
+#endif
void invalidSession();
void repeatedOpenClose_data();
@@ -901,6 +903,7 @@ QDebug operator<<(QDebug debug, const QList<QNetworkConfiguration> &list)
// Note: outOfProcessSession requires that at least one configuration is
// at Discovered -state.
+#ifndef QT_NO_PROCESS
void tst_QNetworkSession::outOfProcessSession()
{
updateConfigurations();
@@ -998,6 +1001,7 @@ void tst_QNetworkSession::outOfProcessSession()
QSKIP("Lackey failed");
}
}
+#endif
// A convenience / helper function for testcases. Return the first matching configuration.
// Ignores configurations in other than 'discovered' -state. Returns invalid (QNetworkConfiguration())
diff --git a/tests/auto/other/networkselftest/tst_networkselftest.cpp b/tests/auto/other/networkselftest/tst_networkselftest.cpp
index fa758d0498..2932387bdb 100644
--- a/tests/auto/other/networkselftest/tst_networkselftest.cpp
+++ b/tests/auto/other/networkselftest/tst_networkselftest.cpp
@@ -975,6 +975,7 @@ void tst_NetworkSelfTest::smbServer()
QCOMPARE(ret, strlen(contents));
QVERIFY(memcmp(buf, contents, strlen(contents)) == 0);
#else
+#ifndef QT_NO_PROCESS
// try to use Samba
QString progname = "smbclient";
QProcess smbclient;
@@ -1012,6 +1013,9 @@ void tst_NetworkSelfTest::smbServer()
output = smbclient.readAll();
QCOMPARE(output.constData(), contents);
qDebug() << "Test file is correct";
+#else
+ QSKIP( "No QProcess support", SkipAll);
+#endif
#endif
}
diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp
index ea4feae9db..9e055a3d0e 100644
--- a/tests/auto/testlib/selftests/tst_selftests.cpp
+++ b/tests/auto/testlib/selftests/tst_selftests.cpp
@@ -563,6 +563,9 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge
&& subdir != QLatin1String("cmptest") // QImage comparison requires QGuiApplication
&& subdir != QLatin1String("fetchbogus")
&& subdir != QLatin1String("xunit")
+#ifdef Q_CC_MINGW
+ && subdir != QLatin1String("silent") // calls qFatal()
+#endif
&& subdir != QLatin1String("benchlibcallgrind"))
QVERIFY2(err.isEmpty(), err.constData());
@@ -570,8 +573,8 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge
QString logger = loggers[n];
QList<QByteArray> res = splitLines(actualOutputs[n]);
QList<QByteArray> exp = expectedResult(subdir, logger);
-#ifdef Q_CC_MSVC
- // MSVC formats double numbers differently
+#if defined (Q_CC_MSVC) || defined(Q_CC_MINGW)
+ // MSVC, MinGW format double numbers differently
if (n == 0 && subdir == QStringLiteral("float")) {
for (int i = 0; i < exp.size(); ++i) {
exp[i].replace("e-07", "e-007");
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
index 7e1cc77172..52cd1051ba 100644
--- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
+++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
@@ -2142,6 +2142,7 @@ void tst_QApplication::qtbug_12673()
QVERIFY2(!path.isEmpty(), "Cannot locate modal helper application");
path += "modal";
+#ifndef QT_NO_PROCESS
QProcess testProcess;
QStringList arguments;
testProcess.start(path, arguments);
@@ -2149,6 +2150,9 @@ void tst_QApplication::qtbug_12673()
qPrintable(QString::fromLatin1("Cannot start '%1': %2").arg(path, testProcess.errorString())));
QVERIFY(testProcess.waitForFinished(20000));
QCOMPARE(testProcess.exitStatus(), QProcess::NormalExit);
+#else
+ QSKIP( "No QProcess support", SkipAll);
+#endif
}
class NoQuitOnHideWidget : public QWidget
@@ -2222,7 +2226,9 @@ void tst_QApplication::abortQuitOnShow()
executed *after* the destruction of QApplication.
*/
Q_GLOBAL_STATIC(QLocale, tst_qapp_locale);
+#ifndef QT_NO_PROCESS
Q_GLOBAL_STATIC(QProcess, tst_qapp_process);
+#endif
Q_GLOBAL_STATIC(QFileSystemWatcher, tst_qapp_fileSystemWatcher);
#ifndef QT_NO_SHAREDMEMORY
Q_GLOBAL_STATIC(QSharedMemory, tst_qapp_sharedMemory);
@@ -2243,7 +2249,9 @@ void tst_QApplication::globalStaticObjectDestruction()
int argc = 1;
QApplication app(argc, &argv0);
QVERIFY(tst_qapp_locale());
+#ifndef QT_NO_PROCESS
QVERIFY(tst_qapp_process());
+#endif
QVERIFY(tst_qapp_fileSystemWatcher());
#ifndef QT_NO_SHAREDMEMORY
QVERIFY(tst_qapp_sharedMemory());
diff --git a/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp b/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp
index 17716ff130..c8a12a9866 100644
--- a/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp
+++ b/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp
@@ -201,7 +201,9 @@ private slots:
void deleteStack();
void checkSignals();
void addStackAndDie();
+#ifndef QT_NO_PROCESS
void commandTextFormat();
+#endif
};
tst_QUndoGroup::tst_QUndoGroup()
@@ -605,6 +607,7 @@ void tst_QUndoGroup::addStackAndDie()
delete stack;
}
+#ifndef QT_NO_PROCESS
void tst_QUndoGroup::commandTextFormat()
{
QString binDir = QLibraryInfo::location(QLibraryInfo::BinariesPath);
@@ -644,6 +647,7 @@ void tst_QUndoGroup::commandTextFormat()
qApp->removeTranslator(&translator);
}
+#endif
#else
class tst_QUndoGroup : public QObject
diff --git a/tests/auto/widgets/util/qundostack/tst_qundostack.cpp b/tests/auto/widgets/util/qundostack/tst_qundostack.cpp
index 4d47ed4f58..9b48dc7798 100644
--- a/tests/auto/widgets/util/qundostack/tst_qundostack.cpp
+++ b/tests/auto/widgets/util/qundostack/tst_qundostack.cpp
@@ -247,7 +247,9 @@ private slots:
void macroBeginEnd();
void compression();
void undoLimit();
+#ifndef QT_NO_PROCESS
void commandTextFormat();
+#endif
void separateUndoText();
};
@@ -2964,6 +2966,7 @@ void tst_QUndoStack::undoLimit()
true); // redoChanged
}
+#ifndef QT_NO_PROCESS
void tst_QUndoStack::commandTextFormat()
{
QString binDir = QLibraryInfo::location(QLibraryInfo::BinariesPath);
@@ -3001,6 +3004,7 @@ void tst_QUndoStack::commandTextFormat()
qApp->removeTranslator(&translator);
}
+#endif
void tst_QUndoStack::separateUndoText()
{
diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
index 86e9a70d0b..740f958e21 100644
--- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
+++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
@@ -758,6 +758,11 @@ void tst_QDateTimeEdit::displayFormat()
void tst_QDateTimeEdit::selectAndScrollWithKeys()
{
+#ifdef Q_OS_MAC
+ QSKIP("QTBUG-23674");
+ return;
+#endif
+
qApp->setActiveWindow(testWidget);
testWidget->setDate(QDate(2004, 05, 11));
testWidget->setDisplayFormat("dd/MM/yyyy");
@@ -768,9 +773,6 @@ void tst_QDateTimeEdit::selectAndScrollWithKeys()
QTest::keyClick(testWidget, Qt::Key_Home);
#endif
QTest::keyClick(testWidget, Qt::Key_Right, Qt::ShiftModifier);
-#ifdef Q_OS_MAC
- QEXPECT_FAIL("", "QTBUG-23674", Abort);
-#endif
QCOMPARE(testWidget->lineEdit()->selectedText(), QString("1"));
QTest::keyClick(testWidget, Qt::Key_Right, Qt::ShiftModifier);
QCOMPARE(testWidget->lineEdit()->selectedText(), QString("11"));