summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/cmake/cmake.pro1
-rw-r--r--tests/auto/corelib/global/qtendian/qtendian.pro4
-rw-r--r--tests/auto/corelib/io/qdebug/tst_qdebug.cpp13
-rw-r--r--tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp2
-rw-r--r--tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp130
-rw-r--r--tests/auto/corelib/itemmodels/qsortfilterproxymodel/qsortfilterproxymodel.pro2
-rw-r--r--tests/auto/corelib/json/tst_qtjson.cpp71
-rw-r--r--tests/auto/corelib/kernel/kernel.pro1
-rw-r--r--tests/auto/corelib/kernel/qmetatype/qmetatype.pro15
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp105
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp4
-rw-r--r--tests/auto/corelib/tools/qbytearray/qbytearray.pro5
-rw-r--r--tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp12
-rw-r--r--tests/auto/corelib/tools/qbytearray/tst_qbytearray_mac.mm114
-rw-r--r--tests/auto/corelib/tools/qbytearraylist/qbytearraylist.pro4
-rw-r--r--tests/auto/corelib/tools/qbytearraylist/tst_qbytearraylist.cpp223
-rw-r--r--tests/auto/corelib/tools/tools.pro1
-rw-r--r--tests/auto/dbus/qdbusabstractadaptor/test/test.pro2
-rw-r--r--tests/auto/dbus/qdbusabstractinterface/test/test.pro2
-rw-r--r--tests/auto/dbus/qdbusconnection/qdbusconnection.pro2
-rw-r--r--tests/auto/dbus/qdbuscontext/qdbuscontext.pro2
-rw-r--r--tests/auto/dbus/qdbusinterface/test/test.pro2
-rw-r--r--tests/auto/dbus/qdbuslocalcalls/qdbuslocalcalls.pro2
-rw-r--r--tests/auto/dbus/qdbusmarshall/test/test.pro2
-rw-r--r--tests/auto/dbus/qdbusmetaobject/qdbusmetaobject.pro2
-rw-r--r--tests/auto/dbus/qdbusmetatype/qdbusmetatype.pro2
-rw-r--r--tests/auto/dbus/qdbuspendingcall/qdbuspendingcall.pro2
-rw-r--r--tests/auto/dbus/qdbuspendingreply/qdbuspendingreply.pro2
-rw-r--r--tests/auto/dbus/qdbusreply/qdbusreply.pro2
-rw-r--r--tests/auto/dbus/qdbusservicewatcher/qdbusservicewatcher.pro2
-rw-r--r--tests/auto/dbus/qdbusthreading/qdbusthreading.pro2
-rw-r--r--tests/auto/gui/itemmodels/qstandarditem/qstandarditem.pro2
-rw-r--r--tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.pro1
-rw-r--r--tests/auto/gui/kernel/qguiapplication/qguiapplication.pro2
-rw-r--r--tests/auto/gui/qopengl/qopengl.pro2
-rw-r--r--tests/auto/gui/text/qstatictext/qstatictext.pro2
-rw-r--r--tests/auto/network/access/qftp/qftp.pro3
-rw-r--r--tests/auto/network/access/qftp/tst_qftp.cpp203
-rw-r--r--tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp2
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp25
-rw-r--r--tests/auto/network/access/spdy/tst_spdy.cpp12
-rw-r--r--tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp2
-rw-r--r--tests/auto/opengl/qgl/tst_qgl.cpp8
-rw-r--r--tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp2
-rw-r--r--tests/auto/opengl/qglthreads/tst_qglthreads.cpp14
-rw-r--r--tests/auto/other/networkselftest/tst_networkselftest.cpp21
-rw-r--r--tests/auto/other/qaccessibilitylinux/qaccessibilitylinux.pro2
-rw-r--r--tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro2
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp23
-rw-r--r--tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp5
50 files changed, 641 insertions, 427 deletions
diff --git a/tests/auto/cmake/cmake.pro b/tests/auto/cmake/cmake.pro
index 715e710490..9c715974f8 100644
--- a/tests/auto/cmake/cmake.pro
+++ b/tests/auto/cmake/cmake.pro
@@ -13,3 +13,4 @@ qtHaveModule(opengl): CMAKE_QT_MODULES_UNDER_TEST += opengl
qtHaveModule(concurrent): CMAKE_QT_MODULES_UNDER_TEST += concurrent
CONFIG += ctest_testcase
+win32:testcase.timeout = 1000 # this test is slow on Windows
diff --git a/tests/auto/corelib/global/qtendian/qtendian.pro b/tests/auto/corelib/global/qtendian/qtendian.pro
index 470a363c09..363b86988d 100644
--- a/tests/auto/corelib/global/qtendian/qtendian.pro
+++ b/tests/auto/corelib/global/qtendian/qtendian.pro
@@ -2,4 +2,8 @@ CONFIG += testcase parallel_test
TARGET = tst_qtendian
QT = core testlib
SOURCES = tst_qtendian.cpp
+wince* { # QTBUG-37194 , internal compiler errors with MSVC2008 for Windows CE
+ QMAKE_CFLAGS_RELEASE -= -O2
+ QMAKE_CXXFLAGS_RELEASE -= -O2
+}
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
index 29c7e6a81e..80144dba20 100644
--- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
+++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
@@ -57,6 +57,7 @@ private slots:
void veryLongWarningMessage() const;
void qDebugQStringRef() const;
void qDebugQLatin1String() const;
+ void textStreamModifiers() const;
void defaultMessagehandler() const;
};
@@ -280,6 +281,18 @@ void tst_QDebug::qDebugQLatin1String() const
QCOMPARE(QString::fromLatin1(s_function), function);
}
+void tst_QDebug::textStreamModifiers() const
+{
+ MessageHandlerSetter mhs(myMessageHandler);
+ { qDebug() << hex << short(0xf) << int(0xf) << unsigned(0xf) << long(0xf) << qint64(0xf) << quint64(0xf); }
+ QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO;
+ QCOMPARE(s_msgType, QtDebugMsg);
+ QCOMPARE(s_msg, QString::fromLatin1("f f f f f f"));
+ QCOMPARE(QString::fromLatin1(s_file), file);
+ QCOMPARE(s_line, line);
+ QCOMPARE(QString::fromLatin1(s_function), function);
+}
+
void tst_QDebug::defaultMessagehandler() const
{
MessageHandlerSetter mhs(0);
diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
index 74667a951f..b31b6631f4 100644
--- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
@@ -713,7 +713,7 @@ void tst_QFileInfo::dir_data()
QTest::newRow("resource1") << ":/tst_qfileinfo/resources/file1.ext1" << true << ":/tst_qfileinfo/resources";
#ifdef Q_OS_WIN
QTest::newRow("driveWithSlash") << "C:/file1.ext1.ext2" << true << "C:/";
- QTest::newRow("driveWithoutSlash") << QDir::currentPath().left(2) + "file1.ext1.ext2" << false << QDir::currentPath();
+ QTest::newRow("driveWithoutSlash") << QDir::currentPath().left(2) + "file1.ext1.ext2" << false << QDir::currentPath().left(2);
#endif
}
diff --git a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp
index dc6f16828b..4318396bd4 100644
--- a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp
+++ b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp
@@ -45,6 +45,13 @@
#include <QtCore/private/qloggingregistry_p.h>
QT_USE_NAMESPACE
+enum LoggingRuleState {
+ Invalid,
+ Match,
+ NoMatch
+};
+Q_DECLARE_METATYPE(LoggingRuleState);
+Q_DECLARE_METATYPE(QtMsgType);
class tst_QLoggingRegistry : public QObject
{
@@ -57,6 +64,122 @@ private slots:
// ensure a clean environment
QStandardPaths::setTestModeEnabled(true);
qunsetenv("QT_LOGGING_CONF");
+ qunsetenv("QT_LOGGING_RULES");
+ }
+
+ void QLoggingRule_parse_data()
+ {
+ QTest::addColumn<QString>("pattern");
+ QTest::addColumn<QString>("category");
+ QTest::addColumn<QtMsgType>("msgType");
+ QTest::addColumn<LoggingRuleState>("result");
+
+ // _empty_ should match (only) _empty_
+ QTest::newRow("_empty_-_empty_")
+ << QString("") << QString("") << QtDebugMsg << Match;
+ QTest::newRow("_empty_-default")
+ << QString("") << QString("default") << QtDebugMsg << NoMatch;
+ QTest::newRow(".debug-_empty_")
+ << QString(".debug") << QString("") << QtDebugMsg << Match;
+ QTest::newRow(".warning-default")
+ << QString(".warning") << QString("default") << QtDebugMsg << NoMatch;
+
+ // literal should match only literal
+ QTest::newRow("qt-qt")
+ << QString("qt") << QString("qt") << QtDebugMsg << Match;
+ QTest::newRow("qt-_empty_")
+ << QString("qt") << QString("") << QtDebugMsg << NoMatch;
+ QTest::newRow("qt-qtx")
+ << QString("qt") << QString("qtx") << QtDebugMsg << NoMatch;
+ QTest::newRow("qt-qt.io")
+ << QString("qt") << QString("qt.io") << QtDebugMsg << NoMatch;
+ QTest::newRow("qt.debug-qt")
+ << QString("qt.debug") << QString("qt") << QtDebugMsg << Match;
+ QTest::newRow("qt.critical-qt")
+ << QString("qt.critical") << QString("qt") << QtDebugMsg << NoMatch;
+
+ // * should match everything
+ QTest::newRow("_star_-qt.io.debug")
+ << QString("*") << QString("qt.io") << QtDebugMsg << Match;
+ QTest::newRow("_star_-qt.io.warning")
+ << QString("*") << QString("qt.io") << QtWarningMsg << Match;
+ QTest::newRow("_star_-qt.io.critical")
+ << QString("*") << QString("qt.io") << QtCriticalMsg << Match;
+ QTest::newRow("_star_-_empty_")
+ << QString("*") << QString("") << QtDebugMsg << Match;
+ QTest::newRow("_star_.debug-qt.io")
+ << QString("*.debug") << QString("qt.io") << QtDebugMsg << Match;
+ QTest::newRow("_star_.warning-qt.io")
+ << QString("*.warning") << QString("qt.io") << QtDebugMsg << NoMatch;
+
+ // qt.* should match everything starting with 'qt.'
+ QTest::newRow("qt._star_-qt.io")
+ << QString("qt.*") << QString("qt.io") << QtDebugMsg << Match;
+ QTest::newRow("qt._star_-qt")
+ << QString("qt.*") << QString("qt") << QtDebugMsg << NoMatch;
+ QTest::newRow("qt__star_-qt")
+ << QString("qt*") << QString("qt") << QtDebugMsg << Match;
+ QTest::newRow("qt._star_-qt.io.fs")
+ << QString("qt.*") << QString("qt.io.fs") << QtDebugMsg << Match;
+ QTest::newRow("qt._star_.debug-qt.io.fs")
+ << QString("qt.*.debug") << QString("qt.io.fs") << QtDebugMsg << Match;
+ QTest::newRow("qt._star_.warning-qt.io.fs")
+ << QString("qt.*.warning") << QString("qt.io.fs") << QtDebugMsg << NoMatch;
+
+ // *.io should match everything ending with .io
+ QTest::newRow("_star_.io-qt.io")
+ << QString("*.io") << QString("qt.io") << QtDebugMsg << Match;
+ QTest::newRow("_star_io-qt.io")
+ << QString("*io") << QString("qt.io") << QtDebugMsg << Match;
+ QTest::newRow("_star_.io-io")
+ << QString("*.io") << QString("io") << QtDebugMsg << NoMatch;
+ QTest::newRow("_star_io-io")
+ << QString("*io") << QString("io") << QtDebugMsg << Match;
+ QTest::newRow("_star_.io-qt.ios")
+ << QString("*.io") << QString("qt.ios") << QtDebugMsg << NoMatch;
+ QTest::newRow("_star_.io-qt.io.x")
+ << QString("*.io") << QString("qt.io.x") << QtDebugMsg << NoMatch;
+ QTest::newRow("_star_.io.debug-qt.io")
+ << QString("*.io.debug") << QString("qt.io") << QtDebugMsg << Match;
+ QTest::newRow("_star_.io.warning-qt.io")
+ << QString("*.io.warning") << QString("qt.io") << QtDebugMsg << NoMatch;
+
+ // *qt* should match everything that contains 'qt'
+ QTest::newRow("_star_qt_star_-qt.core.io")
+ << QString("*qt*") << QString("qt.core.io") << QtDebugMsg << Match;
+ QTest::newRow("_star_qt_star_-default")
+ << QString("*qt*") << QString("default") << QtDebugMsg << NoMatch;
+ QTest::newRow("_star_qt._star_.debug-qt.io")
+ << QString("*qt.*.debug") << QString("qt.io") << QtDebugMsg << Match;
+ QTest::newRow("_star_.qt._star_.warning-qt.io")
+ << QString("*.qt.*.warning") << QString("qt.io") << QtDebugMsg << NoMatch;
+ QTest::newRow("**")
+ << QString("**") << QString("qt.core.io") << QtDebugMsg << Match;
+
+ // * outside of start/end
+ QTest::newRow("qt.*.io")
+ << QString("qt.*.io") << QString("qt.core.io") << QtDebugMsg << Invalid;
+ QTest::newRow("***")
+ << QString("***") << QString("qt.core.io") << QtDebugMsg << Invalid;
+ }
+
+ void QLoggingRule_parse()
+ {
+ QFETCH(QString, pattern);
+ QFETCH(QString, category);
+ QFETCH(QtMsgType, msgType);
+ QFETCH(LoggingRuleState, result);
+
+ QLoggingRule rule(QStringRef(&pattern), true);
+ LoggingRuleState state = Invalid;
+ if (rule.flags != QLoggingRule::Invalid) {
+ switch (rule.pass(category, msgType)) {
+ case -1: QFAIL("Shoudn't happen, we set pattern to true"); break;
+ case 0: state = NoMatch; break;
+ case 1: state = Match; break;
+ }
+ }
+ QCOMPARE(state, result);
}
void QLoggingSettingsParser_iniStyle()
@@ -97,6 +220,13 @@ private slots:
QCOMPARE(registry.envRules.size(), 1);
QCOMPARE(registry.rules.size(), 1);
+
+ // check that QT_LOGGING_RULES take precedence
+ qputenv("QT_LOGGING_RULES", "Digia.*=true");
+ registry.init();
+ QCOMPARE(registry.envRules.size(), 2);
+ QCOMPARE(registry.envRules.at(1).enabled, true);
+ QCOMPARE(registry.rules.size(), 2);
}
void QLoggingRegistry_config()
diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/qsortfilterproxymodel.pro b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/qsortfilterproxymodel.pro
index 44957bcb57..25947990a7 100644
--- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/qsortfilterproxymodel.pro
+++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/qsortfilterproxymodel.pro
@@ -2,7 +2,7 @@ CONFIG += testcase
CONFIG += parallel_test
TARGET = tst_qsortfilterproxymodel
-QT += gui widgets testlib
+QT += widgets testlib
mtdir = ../../../other/modeltest
INCLUDEPATH += $$PWD/$${mtdir}
diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp
index 6736a33405..2f75ad631f 100644
--- a/tests/auto/corelib/json/tst_qtjson.cpp
+++ b/tests/auto/corelib/json/tst_qtjson.cpp
@@ -95,6 +95,7 @@ private Q_SLOTS:
void undefinedValues();
+ void fromVariant();
void fromVariantMap();
void toVariantMap();
void toVariantList();
@@ -200,20 +201,6 @@ void tst_QtJson::testValueSimple()
QCOMPARE(value.toBool(), false);
QCOMPARE(value.toObject(), QJsonObject());
QCOMPARE(value.toArray(), QJsonArray());
-
- value = true;
- QCOMPARE(value.toDouble(), 0.);
- QCOMPARE(value.toString(), QString());
- QCOMPARE(value.toBool(), true);
- QCOMPARE(value.toObject(), QJsonObject());
- QCOMPARE(value.toArray(), QJsonArray());
-
- value = 999.;
- QCOMPARE(value.toDouble(), 999.);
- QCOMPARE(value.toString(), QString());
- QCOMPARE(value.toBool(), false);
- QCOMPARE(value.toObject(), QJsonObject());
- QCOMPARE(value.toArray(), QJsonArray());
}
void tst_QtJson::testNumbers()
@@ -1054,6 +1041,62 @@ void tst_QtJson::undefinedValues()
QCOMPARE(array.at(-1).type(), QJsonValue::Undefined);
}
+void tst_QtJson::fromVariant()
+{
+ bool boolValue = true;
+ int intValue = -1;
+ uint uintValue = 1;
+ long long longlongValue = -2;
+ unsigned long long ulonglongValue = 2;
+ float floatValue = 3.3f;
+ double doubleValue = 4.4;
+ QString stringValue("str");
+
+ QStringList stringList;
+ stringList.append(stringValue);
+ stringList.append("str2");
+ QJsonArray jsonArray_string;
+ jsonArray_string.append(stringValue);
+ jsonArray_string.append("str2");
+
+ QVariantList variantList;
+ variantList.append(boolValue);
+ variantList.append(floatValue);
+ variantList.append(doubleValue);
+ variantList.append(stringValue);
+ variantList.append(stringList);
+ variantList.append(QVariant());
+ QJsonArray jsonArray_variant;
+ jsonArray_variant.append(boolValue);
+ jsonArray_variant.append(floatValue);
+ jsonArray_variant.append(doubleValue);
+ jsonArray_variant.append(stringValue);
+ jsonArray_variant.append(jsonArray_string);
+ jsonArray_variant.append(QJsonValue());
+
+ QVariantMap variantMap;
+ variantMap["bool"] = boolValue;
+ variantMap["float"] = floatValue;
+ variantMap["string"] = stringValue;
+ variantMap["array"] = variantList;
+ QJsonObject jsonObject;
+ jsonObject["bool"] = boolValue;
+ jsonObject["float"] = floatValue;
+ jsonObject["string"] = stringValue;
+ jsonObject["array"] = jsonArray_variant;
+
+ QCOMPARE(QJsonValue::fromVariant(QVariant(boolValue)), QJsonValue(boolValue));
+ QCOMPARE(QJsonValue::fromVariant(QVariant(intValue)), QJsonValue(intValue));
+ QCOMPARE(QJsonValue::fromVariant(QVariant(uintValue)), QJsonValue(static_cast<double>(uintValue)));
+ QCOMPARE(QJsonValue::fromVariant(QVariant(longlongValue)), QJsonValue(longlongValue));
+ QCOMPARE(QJsonValue::fromVariant(QVariant(ulonglongValue)), QJsonValue(static_cast<double>(ulonglongValue)));
+ QCOMPARE(QJsonValue::fromVariant(QVariant(floatValue)), QJsonValue(static_cast<double>(floatValue)));
+ QCOMPARE(QJsonValue::fromVariant(QVariant(doubleValue)), QJsonValue(doubleValue));
+ QCOMPARE(QJsonValue::fromVariant(QVariant(stringValue)), QJsonValue(stringValue));
+ QCOMPARE(QJsonValue::fromVariant(QVariant(stringList)), QJsonValue(jsonArray_string));
+ QCOMPARE(QJsonValue::fromVariant(QVariant(variantList)), QJsonValue(jsonArray_variant));
+ QCOMPARE(QJsonValue::fromVariant(QVariant(variantMap)), QJsonValue(jsonObject));
+}
void tst_QtJson::fromVariantMap()
{
diff --git a/tests/auto/corelib/kernel/kernel.pro b/tests/auto/corelib/kernel/kernel.pro
index 4b3b2e824e..604a0f4fd8 100644
--- a/tests/auto/corelib/kernel/kernel.pro
+++ b/tests/auto/corelib/kernel/kernel.pro
@@ -8,7 +8,6 @@ SUBDIRS=\
qmetaobjectbuilder \
qmetamethod \
qmetaproperty \
- qmetatype \
qmimedata \
qobject \
qpointer \
diff --git a/tests/auto/corelib/kernel/qmetatype/qmetatype.pro b/tests/auto/corelib/kernel/qmetatype/qmetatype.pro
index d19ec23760..fc262b8fc7 100644
--- a/tests/auto/corelib/kernel/qmetatype/qmetatype.pro
+++ b/tests/auto/corelib/kernel/qmetatype/qmetatype.pro
@@ -15,3 +15,18 @@ win32-msvc*|wince|winrt {
QMAKE_CFLAGS_RELEASE -= -O2
}
}
+
+clang {
+ # clang has some performance problems with the test. Especially
+ # with automaticTemplateRegistration which creates few thousands
+ # template instantiations (QTBUG-37237). Removing -O2 and -g
+ # improves the situation, but it is not solving the problem.
+ QMAKE_CXXFLAGS_RELEASE -= -O2
+ QMAKE_CFLAGS_RELEASE -= -O2
+ QMAKE_CXXFLAGS_RELEASE -= -g
+ QMAKE_CFLAGS_RELEASE -= -g
+
+ # Building for ARM (eg iOS) is affected so much that we disable
+ #the template part of the test
+ contains(QT_ARCH, arm): DEFINES += TST_QMETATYPE_BROKEN_COMPILER
+}
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
index acff6a55ba..0e3ea86165 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
@@ -1314,6 +1314,27 @@ public:
typedef MyObject* MyObjectPtr;
Q_DECLARE_METATYPE(MyObjectPtr)
+#if defined(Q_COMPILER_VARIADIC_MACROS) && !defined(TST_QMETATYPE_BROKEN_COMPILER)
+static QByteArray createTypeName(const char *begin, const char *va)
+{
+ QByteArray tn(begin);
+ const QList<QByteArray> args = QByteArray(va).split(',');
+ tn += args.first().trimmed();
+ if (args.size() > 1) {
+ QList<QByteArray>::const_iterator it = args.constBegin() + 1;
+ const QList<QByteArray>::const_iterator end = args.constEnd();
+ for (; it != end; ++it) {
+ tn += ",";
+ tn += it->trimmed();
+ }
+ }
+ if (tn.endsWith('>'))
+ tn += ' ';
+ tn += ">";
+ return tn;
+}
+#endif
+
void tst_QMetaType::automaticTemplateRegistration()
{
#define TEST_SEQUENTIAL_CONTAINER(CONTAINER, VALUE_TYPE) \
@@ -1480,58 +1501,32 @@ void tst_QMetaType::automaticTemplateRegistration()
#if defined(Q_COMPILER_VARIADIC_MACROS) && !defined(TST_QMETATYPE_BROKEN_COMPILER)
- #define FOR_EACH_STATIC_PRIMITIVE_TYPE(F, ...) \
- F(bool, __VA_ARGS__) \
- F(int, __VA_ARGS__) \
- F(uint, __VA_ARGS__) \
- F(qlonglong, __VA_ARGS__) \
- F(qulonglong, __VA_ARGS__) \
- F(double, __VA_ARGS__) \
- F(long, __VA_ARGS__) \
- F(short, __VA_ARGS__) \
- F(char, __VA_ARGS__) \
- F(ulong, __VA_ARGS__) \
- F(ushort, __VA_ARGS__) \
- F(uchar, __VA_ARGS__) \
- F(float, __VA_ARGS__) \
- F(QObject*, __VA_ARGS__) \
- F(QString, __VA_ARGS__) \
- F(CustomMovable, __VA_ARGS__)
-
- #define FOR_EACH_STATIC_PRIMITIVE_TYPE2(F, ...) \
- F(bool, __VA_ARGS__) \
- F(int, __VA_ARGS__) \
- F(uint, __VA_ARGS__) \
- F(qlonglong, __VA_ARGS__) \
- F(qulonglong, __VA_ARGS__) \
- F(long, __VA_ARGS__) \
- F(short, __VA_ARGS__) \
- F(char, __VA_ARGS__) \
- F(ulong, __VA_ARGS__) \
- F(ushort, __VA_ARGS__) \
- F(uchar, __VA_ARGS__) \
- F(QObject*, __VA_ARGS__) \
- F(QString, __VA_ARGS__)
-
+ #define FOR_EACH_STATIC_PRIMITIVE_TYPE(F) \
+ F(bool) \
+ F(int) \
+ F(qulonglong) \
+ F(double) \
+ F(short) \
+ F(char) \
+ F(ulong) \
+ F(uchar) \
+ F(float) \
+ F(QObject*) \
+ F(QString) \
+ F(CustomMovable)
+
+ #define FOR_EACH_STATIC_PRIMITIVE_TYPE2(F, SecondaryRealName) \
+ F(uint, SecondaryRealName) \
+ F(qlonglong, SecondaryRealName) \
+ F(char, SecondaryRealName) \
+ F(uchar, SecondaryRealName) \
+ F(QObject*, SecondaryRealName)
#define CREATE_AND_VERIFY_CONTAINER(CONTAINER, ...) \
{ \
CONTAINER< __VA_ARGS__ > t; \
const QVariant v = QVariant::fromValue(t); \
- QByteArray tn = #CONTAINER + QByteArray("<"); \
- const QList<QByteArray> args = QByteArray(#__VA_ARGS__).split(','); \
- tn += args.first().trimmed(); \
- if (args.size() > 1) { \
- QList<QByteArray>::const_iterator it = args.constBegin() + 1; \
- const QList<QByteArray>::const_iterator end = args.constEnd(); \
- for (; it != end; ++it) { \
- tn += ","; \
- tn += it->trimmed(); \
- } \
- } \
- if (tn.endsWith('>')) \
- tn += ' '; \
- tn += ">"; \
+ QByteArray tn = createTypeName(#CONTAINER "<", #__VA_ARGS__); \
const int type = QMetaType::type(tn); \
const int expectedType = ::qMetaTypeId<CONTAINER< __VA_ARGS__ > >(); \
QCOMPARE(type, expectedType); \
@@ -1547,18 +1542,18 @@ void tst_QMetaType::automaticTemplateRegistration()
F(QStack, TYPE) \
F(QSet, TYPE)
- #define PRINT_1ARG_TEMPLATE(RealName, ...) \
+ #define PRINT_1ARG_TEMPLATE(RealName) \
FOR_EACH_1ARG_TEMPLATE_TYPE(CREATE_AND_VERIFY_CONTAINER, RealName)
- #define FOR_EACH_2ARG_TEMPLATE_TYPE(F, RealName, ...) \
- F(QHash, __VA_ARGS__) \
- F(QMap, __VA_ARGS__) \
- F(QPair, __VA_ARGS__)
+ #define FOR_EACH_2ARG_TEMPLATE_TYPE(F, RealName1, RealName2) \
+ F(QHash, RealName1, RealName2) \
+ F(QMap, RealName1, RealName2) \
+ F(QPair, RealName1, RealName2)
- #define PRINT_2ARG_TEMPLATE_INTERNAL(RealName, ...) \
- FOR_EACH_2ARG_TEMPLATE_TYPE(CREATE_AND_VERIFY_CONTAINER, 0, RealName, __VA_ARGS__)
+ #define PRINT_2ARG_TEMPLATE_INTERNAL(RealName1, RealName2) \
+ FOR_EACH_2ARG_TEMPLATE_TYPE(CREATE_AND_VERIFY_CONTAINER, RealName1, RealName2)
- #define PRINT_2ARG_TEMPLATE(RealName, ...) \
+ #define PRINT_2ARG_TEMPLATE(RealName) \
FOR_EACH_STATIC_PRIMITIVE_TYPE2(PRINT_2ARG_TEMPLATE_INTERNAL, RealName)
#define REGISTER_TYPEDEF(TYPE, ARG1, ARG2) \
diff --git a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp
index 6ddd2ff233..6f8dc13325 100644
--- a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp
+++ b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp
@@ -181,12 +181,12 @@ private Q_SLOTS:
};
template <bool> inline void booleanHelper() { }
-template <typename T> struct TypeInStruct { T type; };
+struct TypeInStruct { TEST_TYPE type; };
void tst_QAtomicIntegerXX::static_checks()
{
Q_STATIC_ASSERT(sizeof(QAtomicInteger<T>) == sizeof(T));
- Q_STATIC_ASSERT(Q_ALIGNOF(QAtomicInteger<T>) == Q_ALIGNOF(TypeInStruct<T>));
+ Q_STATIC_ASSERT(Q_ALIGNOF(QAtomicInteger<T>) == Q_ALIGNOF(TypeInStruct));
// statements with no effect
(void) QAtomicInteger<T>::isReferenceCountingNative();
diff --git a/tests/auto/corelib/tools/qbytearray/qbytearray.pro b/tests/auto/corelib/tools/qbytearray/qbytearray.pro
index 4a5cfbf133..8d2efce0be 100644
--- a/tests/auto/corelib/tools/qbytearray/qbytearray.pro
+++ b/tests/auto/corelib/tools/qbytearray/qbytearray.pro
@@ -5,3 +5,8 @@ SOURCES = tst_qbytearray.cpp
TESTDATA += rfc3252.txt
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+mac {
+ OBJECTIVE_SOURCES += tst_qbytearray_mac.mm
+ LIBS += -framework Foundation
+}
diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
index d7cc92e6c0..b06741b23e 100644
--- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
+++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
@@ -151,6 +151,8 @@ private slots:
#if defined(Q_COMPILER_LAMBDA)
void literals();
#endif
+
+ void macTypes();
};
static const struct StaticByteArrays {
@@ -1980,6 +1982,16 @@ void tst_QByteArray::literals()
}
#endif
+void tst_QByteArray::macTypes()
+{
+#ifndef Q_OS_MAC
+ QSKIP("This is a Apple-only test");
+#else
+ extern void tst_QByteArray_macTypes(); // in qbytearray_mac.mm
+ tst_QByteArray_macTypes();
+#endif
+}
+
const char globalChar = '1';
QTEST_MAIN(tst_QByteArray)
diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray_mac.mm b/tests/auto/corelib/tools/qbytearray/tst_qbytearray_mac.mm
new file mode 100644
index 0000000000..63d3e6a222
--- /dev/null
+++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray_mac.mm
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Samuel Gaist <samuel.gaist@edeltech.ch>
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QByteArray>
+#include <QtTest/QtTest>
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <Foundation/Foundation.h>
+
+void tst_QByteArray_macTypes()
+{
+ // QByteArray <-> CFData
+ {
+ QByteArray qtByteArray("test bytearray");
+ const CFDataRef cfData = qtByteArray.toCFData();
+ QCOMPARE(QByteArray::fromCFData(cfData), qtByteArray);
+ CFRelease(cfData);
+ }
+ {
+ QByteArray qtByteArray("test bytearray");
+ const CFDataRef cfData = qtByteArray.toCFData();
+ QByteArray qtByteArrayCopy(qtByteArray);
+ qtByteArray = qtByteArray.toUpper(); // modify
+ QCOMPARE(QByteArray::fromCFData(cfData), qtByteArrayCopy);
+ }
+ // QByteArray <-> CFData Raw
+ {
+ QByteArray qtByteArray("test bytearray");
+ const CFDataRef cfData = qtByteArray.toRawCFData();
+ const UInt8 * cfDataPtr = CFDataGetBytePtr(cfData);
+ QCOMPARE(reinterpret_cast<const UInt8*>(qtByteArray.constData()), cfDataPtr);
+ CFRelease(cfData);
+ }
+ {
+ const UInt8 data[] = "cfdata test";
+ const CFDataRef cfData = CFDataCreate(kCFAllocatorDefault, data, sizeof(data));
+ const UInt8 * cfDataPtr = CFDataGetBytePtr(cfData);
+ QByteArray qtByteArray = QByteArray::fromRawCFData(cfData);
+ QCOMPARE(reinterpret_cast<const UInt8*>(qtByteArray.constData()), cfDataPtr);
+ CFRelease(cfData);
+ }
+ // QByteArray <-> NSData
+ {
+ NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
+ QByteArray qtByteArray("test bytearray");
+ const NSData *nsData = qtByteArray.toNSData();
+ QCOMPARE(QByteArray::fromNSData(nsData), qtByteArray);
+ [autoreleasepool release];
+ }
+ {
+ NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
+ QByteArray qtByteArray("test bytearray");
+ const NSData *nsData = qtByteArray.toNSData();
+ QByteArray qtByteArrayCopy(qtByteArray);
+ qtByteArray = qtByteArray.toUpper(); // modify
+ QCOMPARE(QByteArray::fromNSData(nsData), qtByteArrayCopy);
+ [autoreleasepool release];
+ }
+ // QByteArray <-> NSData Raw
+ {
+ NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
+ QByteArray qtByteArray("test bytearray");
+ const NSData *nsData = qtByteArray.toRawNSData();
+ QCOMPARE([nsData bytes], qtByteArray.constData());
+ [autoreleasepool release];
+ }
+ {
+ NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
+ const char data[] = "nsdata test";
+ const NSData *nsData = [NSData dataWithBytes:data length:sizeof(data)];
+ QByteArray qtByteArray = QByteArray::fromRawNSData(nsData);
+ QCOMPARE(qtByteArray.constData(), [nsData bytes]);
+ [autoreleasepool release];
+ }
+}
diff --git a/tests/auto/corelib/tools/qbytearraylist/qbytearraylist.pro b/tests/auto/corelib/tools/qbytearraylist/qbytearraylist.pro
deleted file mode 100644
index 2cd4522f67..0000000000
--- a/tests/auto/corelib/tools/qbytearraylist/qbytearraylist.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-CONFIG += testcase parallel_test
-TARGET = tst_qbytearraylist
-QT = core testlib
-SOURCES = tst_qbytearraylist.cpp
diff --git a/tests/auto/corelib/tools/qbytearraylist/tst_qbytearraylist.cpp b/tests/auto/corelib/tools/qbytearraylist/tst_qbytearraylist.cpp
deleted file mode 100644
index 86a56abae3..0000000000
--- a/tests/auto/corelib/tools/qbytearraylist/tst_qbytearraylist.cpp
+++ /dev/null
@@ -1,223 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 by Southwest Research Institute (R)
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include <qbytearraylist.h>
-
-#include <qmetatype.h>
-
-Q_DECLARE_METATYPE(QByteArrayList)
-
-class tst_QByteArrayList : public QObject
-{
- Q_OBJECT
-private slots:
- void join() const;
- void join_data() const;
- void joinByteArray() const;
- void joinByteArray_data() const;
- void joinChar() const;
- void joinChar_data() const;
- void joinEmptiness() const;
-
- void operator_plus() const;
- void operator_plus_data() const;
-
- void initializeList() const;
-};
-
-void tst_QByteArrayList::join() const
-{
- QFETCH(QByteArrayList, input);
- QFETCH(QByteArray, expectedResult);
-
- QCOMPARE(input.join(), expectedResult);
-}
-
-void tst_QByteArrayList::join_data() const
-{
- QTest::addColumn<QByteArrayList>("input");
- QTest::addColumn<QByteArray>("expectedResult");
-
- QTest::newRow("data1") << QByteArrayList()
- << QByteArray();
-
- QTest::newRow("data2") << QByteArrayList("one")
- << QByteArray("one");
-
- QTest::newRow("data3") << (QByteArrayList() << "a" << "b")
- << QByteArray("ab");
-
- QTest::newRow("data4") << (QByteArrayList() << "a" << "b" << "c")
- << QByteArray("abc");
-}
-
-void tst_QByteArrayList::joinByteArray() const
-{
- QFETCH(QByteArrayList, input);
- QFETCH(QByteArray, separator);
- QFETCH(QByteArray, expectedResult);
-
- QCOMPARE(input.join(separator), expectedResult);
-}
-
-void tst_QByteArrayList::joinByteArray_data() const
-{
- QTest::addColumn<QByteArrayList>("input");
- QTest::addColumn<QByteArray>("separator");
- QTest::addColumn<QByteArray>("expectedResult");
-
- QTest::newRow("data1") << QByteArrayList()
- << QByteArray()
- << QByteArray();
-
- QTest::newRow("data2") << QByteArrayList()
- << QByteArray("separator")
- << QByteArray();
-
- QTest::newRow("data3") << QByteArrayList("one")
- << QByteArray("separator")
- << QByteArray("one");
-
- QTest::newRow("data4") << (QByteArrayList() << "a" << "b")
- << QByteArray(" ")
- << QByteArray("a b");
-
- QTest::newRow("data5") << (QByteArrayList() << "a" << "b" << "c")
- << QByteArray(" ")
- << QByteArray("a b c");
-
- QTest::newRow("data6") << (QByteArrayList() << "a" << "b" << "c")
- << QByteArray()
- << QByteArray("abc");
-
- QTest::newRow("data7") << (QByteArrayList() << "a" << "b" << "c")
- << QByteArray("") //empty
- << QByteArray("abc");
-}
-
-void tst_QByteArrayList::joinChar() const
-{
- QFETCH(QByteArrayList, input);
- QFETCH(char, separator);
- QFETCH(QByteArray, expectedResult);
-
- QCOMPARE(input.join(separator), expectedResult);
-}
-
-void tst_QByteArrayList::joinChar_data() const
-{
- QTest::addColumn<QByteArrayList>("input");
- QTest::addColumn<char>("separator");
- QTest::addColumn<QByteArray>("expectedResult");
-
- QTest::newRow("data1") << QByteArrayList()
- << ' '
- << QByteArray();
-
- QTest::newRow("data2") << (QByteArrayList() << "a" << "b")
- << ' '
- << QByteArray("a b");
-
- QTest::newRow("data3") << (QByteArrayList() << "a" << "b" << "c")
- << ' '
- << QByteArray("a b c");
-}
-
-void tst_QByteArrayList::joinEmptiness() const
-{
- QByteArrayList list;
- QByteArray string = list.join(QByteArray());
-
- QVERIFY(string.isEmpty());
- QVERIFY(string.isNull());
-}
-
-void tst_QByteArrayList::operator_plus() const
-{
- QFETCH(QByteArrayList, a1);
- QFETCH(QByteArrayList, a2);
- QFETCH(QByteArrayList, expectedResult);
-
- QCOMPARE(a1+a2, expectedResult);
- a1 += a2;
- QCOMPARE(a1, expectedResult);
-}
-
-void tst_QByteArrayList::operator_plus_data() const
-{
- QTest::addColumn<QByteArrayList>("a1");
- QTest::addColumn<QByteArrayList>("a2");
- QTest::addColumn<QByteArrayList>("expectedResult");
-
- QTest::newRow("simpl") << ( QByteArrayList() << "a" )
- << ( QByteArrayList() << "b" << "c" )
- << ( QByteArrayList() << "a" << "b" << "c" );
-
- QTest::newRow("blank1") << QByteArrayList()
- << QByteArrayList()
- << QByteArrayList();
-
- QTest::newRow("blank2") << ( QByteArrayList() )
- << ( QByteArrayList() << "b" << "c" )
- << ( QByteArrayList() << "b" << "c" );
-
- QTest::newRow("empty1") << ( QByteArrayList() << "" )
- << ( QByteArrayList() << "b" << "c" )
- << ( QByteArrayList() << "" << "b" << "c" );
-
- QTest::newRow("empty2") << ( QByteArrayList() << "a" )
- << ( QByteArrayList() << "" << "c" )
- << ( QByteArrayList() << "a" << "" << "c" );
-}
-
-void tst_QByteArrayList::initializeList() const
-{
-#ifdef Q_COMPILER_INITIALIZER_LISTS
- // C++11 support is required
- QByteArrayList v1{QByteArray("hello"),"world",QByteArray("plop")};
- QCOMPARE(v1, (QByteArrayList() << "hello" << "world" << "plop"));
- QCOMPARE(v1, (QByteArrayList{"hello","world","plop"}));
-#endif
-}
-
-QTEST_APPLESS_MAIN(tst_QByteArrayList)
-#include "tst_qbytearraylist.moc"
diff --git a/tests/auto/corelib/tools/tools.pro b/tests/auto/corelib/tools/tools.pro
index d5c9e50190..1ef8e77071 100644
--- a/tests/auto/corelib/tools/tools.pro
+++ b/tests/auto/corelib/tools/tools.pro
@@ -5,7 +5,6 @@ SUBDIRS=\
qarraydata_strictiterators \
qbitarray \
qbytearray \
- qbytearraylist \
qbytearraymatcher \
qbytedatabuffer \
qcache \
diff --git a/tests/auto/dbus/qdbusabstractadaptor/test/test.pro b/tests/auto/dbus/qdbusabstractadaptor/test/test.pro
index 5a65abe238..0e4dc91128 100644
--- a/tests/auto/dbus/qdbusabstractadaptor/test/test.pro
+++ b/tests/auto/dbus/qdbusabstractadaptor/test/test.pro
@@ -5,3 +5,5 @@ TARGET = ../tst_qdbusabstractadaptor
QT = core core-private dbus testlib
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+macx:CONFIG += insignificant_test # QTBUG-37469
diff --git a/tests/auto/dbus/qdbusabstractinterface/test/test.pro b/tests/auto/dbus/qdbusabstractinterface/test/test.pro
index 66744b9252..223c94866c 100644
--- a/tests/auto/dbus/qdbusabstractinterface/test/test.pro
+++ b/tests/auto/dbus/qdbusabstractinterface/test/test.pro
@@ -10,3 +10,5 @@ DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
DBUS_INTERFACES = ../org.qtproject.QtDBus.Pinger.xml
QDBUSXML2CPP_INTERFACE_HEADER_FLAGS += -i ../interface.h
+
+macx:CONFIG += insignificant_test # QTBUG-37469
diff --git a/tests/auto/dbus/qdbusconnection/qdbusconnection.pro b/tests/auto/dbus/qdbusconnection/qdbusconnection.pro
index 2fd62a234b..9616607fd9 100644
--- a/tests/auto/dbus/qdbusconnection/qdbusconnection.pro
+++ b/tests/auto/dbus/qdbusconnection/qdbusconnection.pro
@@ -3,3 +3,5 @@ TARGET = tst_qdbusconnection
QT = core dbus testlib
SOURCES += tst_qdbusconnection.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+macx:CONFIG += insignificant_test # QTBUG-37469
diff --git a/tests/auto/dbus/qdbuscontext/qdbuscontext.pro b/tests/auto/dbus/qdbuscontext/qdbuscontext.pro
index b7d7223613..3477f8a41f 100644
--- a/tests/auto/dbus/qdbuscontext/qdbuscontext.pro
+++ b/tests/auto/dbus/qdbuscontext/qdbuscontext.pro
@@ -3,3 +3,5 @@ TARGET = tst_qdbuscontext
QT = core dbus testlib
SOURCES += tst_qdbuscontext.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+macx:CONFIG += insignificant_test # QTBUG-37469
diff --git a/tests/auto/dbus/qdbusinterface/test/test.pro b/tests/auto/dbus/qdbusinterface/test/test.pro
index 6fc51d2f31..ba70273aab 100644
--- a/tests/auto/dbus/qdbusinterface/test/test.pro
+++ b/tests/auto/dbus/qdbusinterface/test/test.pro
@@ -5,3 +5,5 @@ TARGET = ../tst_qdbusinterface
QT = core core-private dbus testlib
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+macx:CONFIG += insignificant_test # QTBUG-37469
diff --git a/tests/auto/dbus/qdbuslocalcalls/qdbuslocalcalls.pro b/tests/auto/dbus/qdbuslocalcalls/qdbuslocalcalls.pro
index cbe3e89a16..79ad5763e0 100644
--- a/tests/auto/dbus/qdbuslocalcalls/qdbuslocalcalls.pro
+++ b/tests/auto/dbus/qdbuslocalcalls/qdbuslocalcalls.pro
@@ -3,3 +3,5 @@ TARGET = tst_qdbuslocalcalls
QT = core dbus testlib
SOURCES += tst_qdbuslocalcalls.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+macx:CONFIG += insignificant_test # QTBUG-37469
diff --git a/tests/auto/dbus/qdbusmarshall/test/test.pro b/tests/auto/dbus/qdbusmarshall/test/test.pro
index 40bea4509b..5c67bfc624 100644
--- a/tests/auto/dbus/qdbusmarshall/test/test.pro
+++ b/tests/auto/dbus/qdbusmarshall/test/test.pro
@@ -7,3 +7,5 @@ QT = core-private dbus-private testlib
LIBS += $$QT_LIBS_DBUS
QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+macx:CONFIG += insignificant_test # QTBUG-37469
diff --git a/tests/auto/dbus/qdbusmetaobject/qdbusmetaobject.pro b/tests/auto/dbus/qdbusmetaobject/qdbusmetaobject.pro
index c0b38cf478..ca567605dd 100644
--- a/tests/auto/dbus/qdbusmetaobject/qdbusmetaobject.pro
+++ b/tests/auto/dbus/qdbusmetaobject/qdbusmetaobject.pro
@@ -3,3 +3,5 @@ TARGET = tst_qdbusmetaobject
QT = core dbus-private testlib
SOURCES += tst_qdbusmetaobject.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+macx:CONFIG += insignificant_test # QTBUG-37469
diff --git a/tests/auto/dbus/qdbusmetatype/qdbusmetatype.pro b/tests/auto/dbus/qdbusmetatype/qdbusmetatype.pro
index aef9bc73cb..47b9c40aea 100644
--- a/tests/auto/dbus/qdbusmetatype/qdbusmetatype.pro
+++ b/tests/auto/dbus/qdbusmetatype/qdbusmetatype.pro
@@ -3,3 +3,5 @@ TARGET = tst_qdbusmetatype
QT = core dbus testlib
SOURCES += tst_qdbusmetatype.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+macx:CONFIG += insignificant_test # QTBUG-37469
diff --git a/tests/auto/dbus/qdbuspendingcall/qdbuspendingcall.pro b/tests/auto/dbus/qdbuspendingcall/qdbuspendingcall.pro
index 7b5f867798..7f11422e1a 100644
--- a/tests/auto/dbus/qdbuspendingcall/qdbuspendingcall.pro
+++ b/tests/auto/dbus/qdbuspendingcall/qdbuspendingcall.pro
@@ -3,3 +3,5 @@ TARGET = tst_qdbuspendingcall
QT = core dbus testlib
SOURCES += tst_qdbuspendingcall.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+macx:CONFIG += insignificant_test # QTBUG-37469
diff --git a/tests/auto/dbus/qdbuspendingreply/qdbuspendingreply.pro b/tests/auto/dbus/qdbuspendingreply/qdbuspendingreply.pro
index d6b9e71084..b0ba53fb8e 100644
--- a/tests/auto/dbus/qdbuspendingreply/qdbuspendingreply.pro
+++ b/tests/auto/dbus/qdbuspendingreply/qdbuspendingreply.pro
@@ -3,3 +3,5 @@ TARGET = tst_qdbuspendingreply
QT = core dbus testlib
SOURCES += tst_qdbuspendingreply.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+macx:CONFIG += insignificant_test # QTBUG-37469
diff --git a/tests/auto/dbus/qdbusreply/qdbusreply.pro b/tests/auto/dbus/qdbusreply/qdbusreply.pro
index 0ffb35e461..decf8462ad 100644
--- a/tests/auto/dbus/qdbusreply/qdbusreply.pro
+++ b/tests/auto/dbus/qdbusreply/qdbusreply.pro
@@ -3,3 +3,5 @@ TARGET = tst_qdbusreply
QT = core dbus testlib
SOURCES += tst_qdbusreply.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+macx:CONFIG += insignificant_test # QTBUG-37469
diff --git a/tests/auto/dbus/qdbusservicewatcher/qdbusservicewatcher.pro b/tests/auto/dbus/qdbusservicewatcher/qdbusservicewatcher.pro
index 82a0f3bb7e..0b3bcbb338 100644
--- a/tests/auto/dbus/qdbusservicewatcher/qdbusservicewatcher.pro
+++ b/tests/auto/dbus/qdbusservicewatcher/qdbusservicewatcher.pro
@@ -3,3 +3,5 @@ TARGET = tst_qdbusservicewatcher
QT = core dbus testlib
SOURCES += tst_qdbusservicewatcher.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+macx:CONFIG += insignificant_test # QTBUG-37469
diff --git a/tests/auto/dbus/qdbusthreading/qdbusthreading.pro b/tests/auto/dbus/qdbusthreading/qdbusthreading.pro
index e50804336b..639cf4df31 100644
--- a/tests/auto/dbus/qdbusthreading/qdbusthreading.pro
+++ b/tests/auto/dbus/qdbusthreading/qdbusthreading.pro
@@ -3,3 +3,5 @@ TARGET = tst_qdbusthreading
QT = core dbus testlib
SOURCES += tst_qdbusthreading.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+macx:CONFIG += insignificant_test # QTBUG-37469
diff --git a/tests/auto/gui/itemmodels/qstandarditem/qstandarditem.pro b/tests/auto/gui/itemmodels/qstandarditem/qstandarditem.pro
index 282737ed7d..b85d475e97 100644
--- a/tests/auto/gui/itemmodels/qstandarditem/qstandarditem.pro
+++ b/tests/auto/gui/itemmodels/qstandarditem/qstandarditem.pro
@@ -1,7 +1,7 @@
CONFIG += testcase
CONFIG += parallel_test
TARGET = tst_qstandarditem
-QT += gui testlib
+QT += testlib
SOURCES += tst_qstandarditem.cpp
diff --git a/tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.pro b/tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.pro
index b84ff760ca..a4abaeedc6 100644
--- a/tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.pro
+++ b/tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.pro
@@ -1,4 +1,3 @@
TEMPLATE = app
TARGET = qfileopeneventexternal
-QT += core gui
SOURCES += qfileopeneventexternal.cpp
diff --git a/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro b/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro
index 79acb9e5f1..cd363bab31 100644
--- a/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro
+++ b/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro
@@ -5,5 +5,5 @@ include($${CORE_TEST_PATH}/qcoreapplication.pro)
INCLUDEPATH += $$CORE_TEST_PATH
TARGET = tst_qguiapplication
-QT += gui gui-private
+QT += gui-private
SOURCES += tst_qguiapplication.cpp
diff --git a/tests/auto/gui/qopengl/qopengl.pro b/tests/auto/gui/qopengl/qopengl.pro
index 34af962d36..12429bbeed 100644
--- a/tests/auto/gui/qopengl/qopengl.pro
+++ b/tests/auto/gui/qopengl/qopengl.pro
@@ -5,7 +5,7 @@
CONFIG += testcase
CONFIG += parallel_test
TARGET = tst_qopengl
-QT += gui gui-private core-private testlib
+QT += gui-private core-private testlib
SOURCES += tst_qopengl.cpp
diff --git a/tests/auto/gui/text/qstatictext/qstatictext.pro b/tests/auto/gui/text/qstatictext/qstatictext.pro
index 55b218deb7..435b132ffd 100644
--- a/tests/auto/gui/text/qstatictext/qstatictext.pro
+++ b/tests/auto/gui/text/qstatictext/qstatictext.pro
@@ -3,5 +3,5 @@ CONFIG += parallel_test
linux: CONFIG += insignificant_test
TARGET = tst_qstatictext
QT += testlib
-QT += core core-private gui gui-private
+QT += core-private gui-private
SOURCES += tst_qstatictext.cpp
diff --git a/tests/auto/network/access/qftp/qftp.pro b/tests/auto/network/access/qftp/qftp.pro
index c56dfa2b6e..44161f4e1e 100644
--- a/tests/auto/network/access/qftp/qftp.pro
+++ b/tests/auto/network/access/qftp/qftp.pro
@@ -9,9 +9,6 @@ wince*: {
addFiles.files = rfc3252.txt
addFiles.path = .
DEPLOYMENT += addFiles
- DEFINES += SRCDIR=\\\"\\\"
-} else {
- DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
CONFIG+=insignificant_test # QTBUG-15111: uses live qt-test-server, inherently unstable
diff --git a/tests/auto/network/access/qftp/tst_qftp.cpp b/tests/auto/network/access/qftp/tst_qftp.cpp
index fffe663f0a..5c6f48c59b 100644
--- a/tests/auto/network/access/qftp/tst_qftp.cpp
+++ b/tests/auto/network/access/qftp/tst_qftp.cpp
@@ -57,6 +57,14 @@
#include "../../../network-settings.h"
+template <class T1, class T2>
+static QByteArray msgComparison(T1 lhs, const char *op, T2 rhs)
+{
+ QString result;
+ QTextStream(&result) << lhs << ' ' << op << ' ' << rhs;
+ return result.toLatin1();
+}
+
class tst_QFtp : public QObject
{
Q_OBJECT
@@ -174,6 +182,7 @@ private:
bool inFileDirExistsFunction;
QString uniqueExtension;
+ QString rfc3252File;
};
//#define DUMP_SIGNALS
@@ -220,6 +229,8 @@ void tst_QFtp::initTestCase()
networkSessionImplicit->open();
QVERIFY(networkSessionImplicit->waitForOpened(60000)); //there may be user prompt on 1st connect
#endif
+ rfc3252File = QFINDTESTDATA("rfc3252.txt");
+ QVERIFY(!rfc3252File.isEmpty());
}
void tst_QFtp::cleanupTestCase()
@@ -327,6 +338,16 @@ void tst_QFtp::connectToHost_data()
QTest::newRow( "error02" ) << QString("foo.bar") << (uint)21 << (int)QFtp::Unconnected;
}
+static QByteArray msgTimedOut(const QString &host, quint16 port = 0)
+{
+ QByteArray result = "Network operation timed out on " + host.toLatin1();
+ if (port) {
+ result += ':';
+ result += QByteArray::number(port);
+ }
+ return result;
+}
+
void tst_QFtp::connectToHost()
{
QFETCH( QString, host );
@@ -339,7 +360,7 @@ void tst_QFtp::connectToHost()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QFAIL( "Network operation timed out" );
+ QFAIL( msgTimedOut(host, port) );
QTEST( connectToHost_state, "state" );
@@ -347,9 +368,9 @@ void tst_QFtp::connectToHost()
QVERIFY( it != resultMap.end() );
QFETCH( int, state );
if ( state == QFtp::Connected ) {
- QVERIFY( it.value().success == 1 );
+ QCOMPARE( it.value().success, 1 );
} else {
- QVERIFY( it.value().success == 0 );
+ QCOMPARE( it.value().success , 0 );
}
}
@@ -382,10 +403,10 @@ void tst_QFtp::connectToUnresponsiveHost()
#endif
QVERIFY2(! QTestEventLoop::instance().timeout(), "Network timeout longer than expected (should have been 60 seconds)");
- QVERIFY( ftp->state() == QFtp::Unconnected);
+ QCOMPARE( ftp->state(), QFtp::Unconnected);
ResMapIt it = resultMap.find( QFtp::ConnectToHost );
QVERIFY( it != resultMap.end() );
- QVERIFY( it.value().success == 0 );
+ QCOMPARE( it.value().success, 0 );
delete ftp;
ftp = 0;
@@ -423,16 +444,17 @@ void tst_QFtp::login()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QFAIL( "Network operation timed out" );
+ QFAIL( msgTimedOut(host, port) );
ResMapIt it = resultMap.find( QFtp::Login );
QVERIFY( it != resultMap.end() );
QTEST( it.value().success, "success" );
+ const QFtp::State loginState = static_cast<QFtp::State>(login_state);
if ( it.value().success ) {
- QVERIFY( login_state == QFtp::LoggedIn );
+ QCOMPARE( loginState, QFtp::LoggedIn );
} else {
- QVERIFY( login_state != QFtp::LoggedIn );
+ QVERIFY2( loginState != QFtp::LoggedIn, msgComparison(loginState, "!=", QFtp::LoggedIn));
}
}
@@ -470,13 +492,13 @@ void tst_QFtp::close()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QFAIL( "Network operation timed out" );
+ QFAIL( msgTimedOut(host, port) );
QCOMPARE( close_state, (int)QFtp::Unconnected );
ResMapIt it = resultMap.find( QFtp::Close );
QVERIFY( it != resultMap.end() );
- QVERIFY( it.value().success == 1 );
+ QCOMPARE( it.value().success, 1 );
}
void tst_QFtp::list_data()
@@ -538,7 +560,7 @@ void tst_QFtp::list()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QFAIL( "Network operation timed out" );
+ QFAIL( msgTimedOut(host, port) );
ResMapIt it = resultMap.find( QFtp::List );
QVERIFY( it != resultMap.end() );
@@ -599,7 +621,7 @@ void tst_QFtp::cd()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() ) {
- QFAIL( "Network operation timed out" );
+ QFAIL( msgTimedOut(host, port) );
}
ResMapIt it = resultMap.find( QFtp::Cd );
@@ -624,8 +646,8 @@ void tst_QFtp::get_data()
QTest::addColumn<bool>("useIODevice");
// ### move this into external testdata
- QFile file( SRCDIR "rfc3252.txt" );
- QVERIFY( file.open( QIODevice::ReadOnly ) );
+ QFile file(rfc3252File);
+ QVERIFY2( file.open( QIODevice::ReadOnly ), qPrintable(file.errorString()) );
QByteArray rfc3252 = file.readAll();
// test the two get() overloads in one routine
@@ -675,7 +697,7 @@ void tst_QFtp::get()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QFAIL( "Network operation timed out" );
+ QFAIL( msgTimedOut(host, port) );
ResMapIt it = resultMap.find( QFtp::Get );
QVERIFY( it != resultMap.end() );
@@ -685,17 +707,17 @@ void tst_QFtp::get()
} else {
QTEST( newData_ba, "res" );
}
- QVERIFY( bytesTotal != bytesTotal_init );
+ QVERIFY2( bytesTotal != bytesTotal_init, msgComparison(bytesTotal, "!=", bytesTotal_init) );
if ( bytesTotal != -1 ) {
- QVERIFY( bytesDone == bytesTotal );
+ QCOMPARE( bytesDone, bytesTotal );
}
if ( useIODevice ) {
if ( bytesDone != bytesDone_init ) {
- QVERIFY( (int)buf_ba.size() == bytesDone );
+ QCOMPARE( qlonglong(buf_ba.size()), bytesDone );
}
} else {
if ( bytesDone != bytesDone_init ) {
- QVERIFY( (int)newData_ba.size() == bytesDone );
+ QCOMPARE( qlonglong(newData_ba.size()), bytesDone );
}
}
}
@@ -712,8 +734,8 @@ void tst_QFtp::put_data()
QTest::addColumn<int>("success");
// ### move this into external testdata
- QFile file( SRCDIR "rfc3252.txt" );
- QVERIFY( file.open( QIODevice::ReadOnly ) );
+ QFile file(rfc3252File);
+ QVERIFY2( file.open( QIODevice::ReadOnly ), qPrintable(file.errorString()) );
QByteArray rfc3252 = file.readAll();
QByteArray bigData( 10*1024*1024, 0 );
@@ -801,7 +823,7 @@ void tst_QFtp::put()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QFAIL( "Network operation timed out" );
+ QFAIL( msgTimedOut(host, port) );
it = resultMap.find( QFtp::Put );
QVERIFY( it != resultMap.end() );
@@ -810,8 +832,8 @@ void tst_QFtp::put()
QVERIFY( !fileExists( host, port, user, password, file ) );
return; // the following tests are only meaningful if the file could be put
}
- QVERIFY( bytesTotal == (int)fileData.size() );
- QVERIFY( bytesDone == bytesTotal );
+ QCOMPARE( bytesTotal, qlonglong(fileData.size()) );
+ QCOMPARE( bytesDone, bytesTotal );
QVERIFY( fileExists( host, port, user, password, file ) );
@@ -834,9 +856,9 @@ void tst_QFtp::put()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QFAIL( "Network operation timed out" );
+ QFAIL( msgTimedOut(host, port) );
- QVERIFY( done_success == 1 );
+ QCOMPARE( done_success, 1 );
QTEST( buf.buffer(), "fileData" );
//////////////////////////////////////////////////////////////////
@@ -852,7 +874,7 @@ void tst_QFtp::put()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QFAIL( "Network operation timed out" );
+ QFAIL( msgTimedOut(host, port) );
it = resultMap.find( QFtp::Remove );
QVERIFY( it != resultMap.end() );
@@ -916,7 +938,7 @@ void tst_QFtp::mkdir()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QFAIL( "Network operation timed out" );
+ QFAIL( msgTimedOut(host, port) );
ResMapIt it = resultMap.find( QFtp::Mkdir );
QVERIFY( it != resultMap.end() );
@@ -941,7 +963,7 @@ void tst_QFtp::mkdir()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QFAIL( "Network operation timed out" );
+ QFAIL( msgTimedOut(host, port) );
it = resultMap.find( QFtp::Mkdir );
QVERIFY( it != resultMap.end() );
@@ -961,7 +983,7 @@ void tst_QFtp::mkdir()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QFAIL( "Network operation timed out" );
+ QFAIL( msgTimedOut(host, port) );
it = resultMap.find( QFtp::Rmdir );
QVERIFY( it != resultMap.end() );
@@ -1074,11 +1096,11 @@ void tst_QFtp::renameInit( const QString &host, const QString &user, const QStri
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QFAIL( "Network operation timed out" );
+ QFAIL( msgTimedOut(host) );
ResMapIt it = resultMap.find( QFtp::Put );
QVERIFY( it != resultMap.end() );
- QVERIFY( it.value().success == 1 );
+ QCOMPARE( it.value().success, 1 );
QVERIFY( fileExists( host, 21, user, password, createFile ) );
}
@@ -1099,11 +1121,11 @@ void tst_QFtp::renameCleanup( const QString &host, const QString &user, const QS
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QFAIL( "Network operation timed out" );
+ QFAIL( msgTimedOut(host) );
ResMapIt it = resultMap.find( QFtp::Remove );
QVERIFY( it != resultMap.end() );
- QVERIFY( it.value().success == 1 );
+ QCOMPARE( it.value().success, 1 );
QVERIFY( !fileExists( host, 21, user, password, fileToDelete ) );
}
@@ -1144,7 +1166,7 @@ void tst_QFtp::rename()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QFAIL( "Network operation timed out" );
+ QFAIL( msgTimedOut(host) );
ResMapIt it = resultMap.find( QFtp::Rename );
QVERIFY( it != resultMap.end() );
@@ -1300,25 +1322,27 @@ void tst_QFtp::commandSequence()
QFETCH( QList<FtpCommand>, cmds );
ftp = newFtp();
+ QString host;
+ quint16 port = 0;
QList<FtpCommand>::iterator it;
for ( it = cmds.begin(); it != cmds.end(); ++it ) {
switch ( (*it).cmd ) {
case QFtp::ConnectToHost:
{
- QVERIFY( (*it).args.count() == 2 );
- uint port;
+ QCOMPARE( (*it).args.count(), 2 );
bool portOk;
- port = (*it).args[1].toUInt( &portOk );
+ port = (*it).args[1].toUShort( &portOk );
QVERIFY( portOk );
- ids << ftp->connectToHost( (*it).args[0], port );
+ host = (*it).args[0];
+ ids << ftp->connectToHost( host, port );
}
break;
case QFtp::Login:
- QVERIFY( (*it).args.count() == 2 );
+ QCOMPARE( (*it).args.count(), 2 );
ids << ftp->login( (*it).args[0], (*it).args[1] );
break;
case QFtp::Close:
- QVERIFY( (*it).args.count() == 0 );
+ QCOMPARE( (*it).args.count(), 0 );
ids << ftp->close();
break;
default:
@@ -1331,7 +1355,7 @@ void tst_QFtp::commandSequence()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QFAIL( "Network operation timed out" );
+ QFAIL( msgTimedOut(host) );
QTEST( commandSequence_success, "success" );
}
@@ -1358,6 +1382,7 @@ void tst_QFtp::abort_data()
void tst_QFtp::abort()
{
+ QSKIP("This test takes too long.");
// In case you wonder where the abort() actually happens, look into
// tst_QFtp::dataTransferProgress
//
@@ -1389,7 +1414,7 @@ void tst_QFtp::abort()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QFAIL( "Network operation timed out" );
+ QFAIL( msgTimedOut(host, port) );
ResMapIt it = resultMap.find( cmd );
QVERIFY( it != resultMap.end() );
@@ -1399,18 +1424,18 @@ void tst_QFtp::abort()
// the operation was aborted. So we have to use some heuristics.
if ( host == QtNetworkSettings::serverName() ) {
if ( cmd == QFtp::Get ) {
- QVERIFY(bytesDone <= bytesTotal);
+ QVERIFY2(bytesDone <= bytesTotal, msgComparison(bytesDone, "<=", bytesTotal));
} else {
// put commands should always be aborted, since we use really
// big data
- QVERIFY( bytesDone != bytesTotal );
+ QVERIFY2( bytesDone != bytesTotal, msgComparison(bytesDone, "!=", bytesTotal) );
}
} else {
// this could be tested by verifying that no more progress signals are emitted
- QVERIFY(bytesDone <= bytesTotal);
+ QVERIFY2(bytesDone <= bytesTotal, msgComparison(bytesDone, "<=", bytesTotal));
}
} else {
- QVERIFY( bytesDone != bytesTotal );
+ QVERIFY2( bytesDone != bytesTotal, msgComparison(bytesDone, "!=", bytesTotal) );
}
if ( cmd == QFtp::Put ) {
@@ -1427,11 +1452,11 @@ void tst_QFtp::abort()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QFAIL( "Network operation timed out" );
+ QFAIL( msgTimedOut(host, port) );
it = resultMap.find( QFtp::Remove );
QVERIFY( it != resultMap.end() );
- QVERIFY( it.value().success == 1 );
+ QCOMPARE( it.value().success, 1 );
}
}
@@ -1466,7 +1491,7 @@ void tst_QFtp::bytesAvailable()
QTestEventLoop::instance().enterLoop( 40 );
if ( QTestEventLoop::instance().timeout() )
- QFAIL( "Network operation timed out" );
+ QFAIL( msgTimedOut(host) );
ResMapIt it = resultMap.find( QFtp::Get );
QVERIFY( it != resultMap.end() );
@@ -1482,7 +1507,7 @@ void tst_QFtp::bytesAvailable()
QCOMPARE(bytesAvailable_done, bytesAvailDone);
ftp->readAll();
- QVERIFY( ftp->bytesAvailable() == 0 );
+ QCOMPARE( ftp->bytesAvailable(), 0 );
delete ftp;
ftp = 0;
}
@@ -1500,7 +1525,7 @@ void tst_QFtp::activeMode()
connect(&ftp, SIGNAL(done(bool)), SLOT(activeModeDone(bool)));
QTestEventLoop::instance().enterLoop(900);
QFile::remove("tst_QFtp_activeMode_inittab");
- QVERIFY(done_success == 1);
+ QCOMPARE(done_success, 1);
}
@@ -1559,7 +1584,7 @@ void tst_QFtp::proxy()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() ) {
- QFAIL( "Network operation timed out" );
+ QFAIL( msgTimedOut(host, port) );
}
ResMapIt it = resultMap.find( QFtp::Cd );
@@ -1594,7 +1619,7 @@ void tst_QFtp::binaryAscii()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QFAIL( "Network operation timed out" );
+ QFAIL( msgTimedOut(QtNetworkSettings::serverName()) );
ResMapIt it = resultMap.find(QFtp::Put);
QVERIFY(it != resultMap.end());
@@ -1616,7 +1641,7 @@ void tst_QFtp::binaryAscii()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QFAIL( "Network operation timed out" );
+ QFAIL( msgTimedOut(QtNetworkSettings::serverName()) );
ResMapIt it2 = resultMap.find(QFtp::Get);
QVERIFY(it2 != resultMap.end());
@@ -1624,7 +1649,7 @@ void tst_QFtp::binaryAscii()
// most modern ftp servers leave the file as it is by default
// (and do not remove the windows line ending), the -1 below could be
// deleted in the future
- QVERIFY(getData.size() == putData.size()-1);
+ QCOMPARE(getData.size(), putData.size() - 1);
//////////////////////////////////////////////////////////////////
// cleanup (i.e. remove the file) -- this also tests the remove command
init();
@@ -1639,7 +1664,7 @@ void tst_QFtp::binaryAscii()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QFAIL( "Network operation timed out" );
+ QFAIL( msgTimedOut(QtNetworkSettings::serverName()) );
it = resultMap.find( QFtp::Remove );
QVERIFY( it != resultMap.end() );
@@ -1666,11 +1691,11 @@ void tst_QFtp::commandStarted( int id )
qDebug( "%d:commandStarted( %d )", ftp->currentId(), id );
#endif
// make sure that the commandStarted and commandFinished are nested correctly
- QVERIFY( current_id == 0 );
+ QCOMPARE( current_id, 0 );
current_id = id;
QVERIFY( !ids.isEmpty() );
- QVERIFY( ids.first() == id );
+ QCOMPARE( ids.first(), id );
if ( ids.count() > 1 ) {
QVERIFY( ftp->hasPendingCommands() );
} else {
@@ -1678,10 +1703,10 @@ void tst_QFtp::commandStarted( int id )
}
QVERIFY( ftp->currentId() == id );
- QVERIFY( cur_state == ftp->state() );
+ QCOMPARE( cur_state, int(ftp->state()) );
CURRENTCOMMAND_TEST;
- QVERIFY( ftp->error() == QFtp::NoError );
+ QCOMPARE( ftp->error(), QFtp::NoError );
}
void tst_QFtp::commandFinished( int id, bool error )
@@ -1696,32 +1721,32 @@ void tst_QFtp::commandFinished( int id, bool error )
bytesAvailable_finished = ftp->bytesAvailable();
// make sure that the commandStarted and commandFinished are nested correctly
- QVERIFY( current_id == id );
+ QCOMPARE( current_id, id );
current_id = 0;
QVERIFY( !ids.isEmpty() );
- QVERIFY( ids.first() == id );
+ QCOMPARE( ids.first(), id );
if ( !error && ids.count() > 1) {
QVERIFY( ftp->hasPendingCommands() );
} else {
QVERIFY( !ftp->hasPendingCommands() );
}
if ( error ) {
- QVERIFY( ftp->error() != QFtp::NoError );
+ QVERIFY2( ftp->error() != QFtp::NoError, msgComparison(ftp->error(), "!=", QFtp::NoError) );
ids.clear();
} else {
- QVERIFY( ftp->error() == QFtp::NoError );
+ QCOMPARE( ftp->error(), QFtp::NoError );
ids.pop_front();
}
- QVERIFY( ftp->currentId() == id );
- QVERIFY( cur_state == ftp->state() );
+ QCOMPARE( ftp->currentId(), id );
+ QCOMPARE( cur_state, int(ftp->state()) );
CURRENTCOMMAND_TEST;
if ( QTest::currentTestFunction() != QLatin1String("commandSequence") ) {
ResMapIt it = resultMap.find( ftp->currentCommand() );
QVERIFY( it != resultMap.end() );
- QVERIFY( it.value().success == -1 );
+ QCOMPARE( it.value().success, -1 );
if ( error )
it.value().success = 0;
else
@@ -1736,25 +1761,25 @@ void tst_QFtp::done( bool error )
#endif
bytesAvailable_done = ftp->bytesAvailable();
- QVERIFY( ftp->currentId() == 0 );
+ QCOMPARE( ftp->currentId(), 0 );
QVERIFY( current_id == 0 );
QVERIFY( ids.isEmpty() );
QVERIFY( cur_state == ftp->state() );
QVERIFY( !ftp->hasPendingCommands() );
if ( QTest::currentTestFunction() == QLatin1String("commandSequence") ) {
- QVERIFY( commandSequence_success == -1 );
+ QCOMPARE( commandSequence_success, -1 );
if ( error )
commandSequence_success = 0;
else
commandSequence_success = 1;
}
- QVERIFY( done_success == -1 );
+ QCOMPARE( done_success, -1 );
if ( error ) {
- QVERIFY( ftp->error() != QFtp::NoError );
+ QVERIFY2( ftp->error() != QFtp::NoError, msgComparison(ftp->error(), "!=", QFtp::NoError) );
done_success = 0;
} else {
- QVERIFY( ftp->error() == QFtp::NoError );
+ QCOMPARE( ftp->error(), QFtp::NoError );
done_success = 1;
}
QTestEventLoop::instance().exitLoop();
@@ -1768,13 +1793,13 @@ void tst_QFtp::stateChanged( int state )
QCOMPARE( ftp->currentId(), current_id );
CURRENTCOMMAND_TEST;
- QVERIFY( state != cur_state );
+ QVERIFY2( state != cur_state, msgComparison(state, "!=", cur_state) );
QCOMPARE( state, (int)ftp->state() );
if ( state != QFtp::Unconnected ) {
// make sure that the states are always emitted in the right order (for
// this, we assume an ordering on the enum values, which they have at
// the moment)
- QVERIFY( cur_state < state );
+ QVERIFY2( cur_state < state, msgComparison(cur_state, "<", state) );
// make sure that state changes are only emitted in response to certain
// commands
@@ -1818,10 +1843,10 @@ void tst_QFtp::stateChanged( int state )
ResMapIt it = resultMap.find( QFtp::Close );
if ( it!=resultMap.end() && ftp->currentId()==it.value().id ) {
if ( state == QFtp::Closing ) {
- QVERIFY( close_state == -1 );
+ QCOMPARE( close_state, -1 );
close_state = state;
} else if ( state == QFtp::Unconnected ) {
- QVERIFY( close_state == QFtp::Closing );
+ QCOMPARE(close_state, int(QFtp::Closing) );
close_state = state;
}
}
@@ -1829,7 +1854,7 @@ void tst_QFtp::stateChanged( int state )
ResMapIt it = resultMap.find( QFtp::Login );
if ( it!=resultMap.end() && ftp->currentId()==it.value().id ) {
if ( state == QFtp::LoggedIn ) {
- QVERIFY( login_state == -1 );
+ QCOMPARE( login_state, -1 );
login_state = state;
}
}
@@ -1847,13 +1872,13 @@ void tst_QFtp::listInfo( const QUrlInfo &i )
} else {
QVERIFY( !ftp->hasPendingCommands() );
}
- QVERIFY( cur_state == ftp->state() );
+ QCOMPARE( cur_state, int(ftp->state()) );
CURRENTCOMMAND_TEST;
if ( QTest::currentTestFunction()==QLatin1String("list") || QTest::currentTestFunction()==QLatin1String("cd") || QTest::currentTestFunction()==QLatin1String("proxy") || inFileDirExistsFunction ) {
ResMapIt it = resultMap.find( QFtp::List );
QVERIFY( it != resultMap.end() );
- QVERIFY( ftp->currentId() == it.value().id );
+ QCOMPARE( ftp->currentId(), it.value().id );
listInfo_i << i;
}
}
@@ -1876,14 +1901,14 @@ void tst_QFtp::readyRead()
int oldSize = newData_ba.size();
qlonglong bytesAvail = ftp->bytesAvailable();
QByteArray ba = ftp->readAll();
- QVERIFY( ba.size() == (int) bytesAvail );
+ QCOMPARE( ba.size(), (int) bytesAvail );
newData_ba.resize( oldSize + ba.size() );
memcpy( newData_ba.data()+oldSize, ba.data(), ba.size() );
if ( bytesTotal != -1 ) {
- QVERIFY( (int)newData_ba.size() <= bytesTotal );
+ QVERIFY2( (int)newData_ba.size() <= bytesTotal, msgComparison(newData_ba.size(), "<=", bytesTotal) );
}
- QVERIFY( (int)newData_ba.size() == bytesDone );
+ QCOMPARE( qlonglong(newData_ba.size()), bytesDone );
}
}
@@ -1898,20 +1923,20 @@ void tst_QFtp::dataTransferProgress( qint64 done, qint64 total )
} else {
QVERIFY( !ftp->hasPendingCommands() );
}
- QVERIFY( cur_state == ftp->state() );
+ QCOMPARE( cur_state, int(ftp->state()) );
CURRENTCOMMAND_TEST;
if ( bytesTotal == bytesTotal_init ) {
bytesTotal = total;
} else {
- QVERIFY( bytesTotal == total );
+ QCOMPARE( bytesTotal, total );
}
- QVERIFY( bytesTotal != bytesTotal_init );
- QVERIFY( bytesDone <= done );
+ QVERIFY2( bytesTotal != bytesTotal_init, msgComparison(bytesTotal, "!=", bytesTotal_init) );
+ QVERIFY2( bytesDone <= done, msgComparison(bytesDone, "<=", done) );
bytesDone = done;
if ( bytesTotal != -1 ) {
- QVERIFY( bytesDone <= bytesTotal );
+ QVERIFY2( bytesDone <= bytesTotal, msgComparison(bytesDone, "<=", bytesTotal) );
}
if ( QTest::currentTestFunction() == QLatin1String("abort") ) {
@@ -2044,7 +2069,7 @@ bool tst_QFtp::dirExists( const QString &host, quint16 port, const QString &user
ftp = 0;
if ( QTestEventLoop::instance().timeout() ) {
// ### make this test work
- // QFAIL( "Network operation timed out" );
+ // QFAIL( msgTimedOut(host, port) );
qWarning("tst_QFtp::dirExists: Network operation timed out");
return false;
}
diff --git a/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp b/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
index 8e0090e486..b793df674b 100644
--- a/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
+++ b/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
@@ -303,7 +303,7 @@ void tst_QHttpNetworkConnection::put_data()
QTest::newRow("success-internal") << "http://" << QtNetworkSettings::serverName() << "/dav/file1.txt" << ushort(80) << false << "Hello World\nEnd of file\n"<<true;
QTest::newRow("fail-internal") << "http://" << QtNetworkSettings::serverName() << "/dav2/file1.txt" << ushort(80) << false << "Hello World\nEnd of file\n"<<false;
- QTest::newRow("fail-host") << "http://" << "fluke-nosuchhost.troll.no" << "/dav2/file1.txt" << ushort(80) << false << "Hello World\nEnd of file\n"<<false;
+ QTest::newRow("fail-host") << "http://" << "invalid.test.qt-project.org" << "/dav2/file1.txt" << ushort(80) << false << "Hello World\nEnd of file\n"<<false;
}
void tst_QHttpNetworkConnection::put()
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index 8e13c1de6e..c448e89375 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -530,7 +530,7 @@ class MiniHttpServer: public QTcpServer
{
Q_OBJECT
public:
- QTcpSocket *client; // always the last one that was received
+ QPointer<QTcpSocket> client; // always the last one that was received
QByteArray dataToTransmit;
QByteArray receivedData;
QSemaphore ready;
@@ -541,7 +541,7 @@ public:
int totalConnections;
MiniHttpServer(const QByteArray &data, bool ssl = false, QThread *thread = 0, bool useipv6 = false)
- : client(0), dataToTransmit(data), doClose(true), doSsl(ssl), ipv6(useipv6),
+ : dataToTransmit(data), doClose(true), doSsl(ssl), ipv6(useipv6),
multiple(false), totalConnections(0)
{
if (useipv6) {
@@ -591,6 +591,7 @@ protected:
}
virtual void reply() {
+ Q_ASSERT(!client.isNull());
// we need to emulate the bytesWrittenSlot call if the data is empty.
if (dataToTransmit.size() == 0)
QMetaObject::invokeMethod(this, "bytesWrittenSlot", Qt::QueuedConnection);
@@ -600,10 +601,11 @@ protected:
private:
void connectSocketSignals()
{
+ Q_ASSERT(!client.isNull());
//qDebug() << "connectSocketSignals" << client;
- connect(client, SIGNAL(readyRead()), this, SLOT(readyReadSlot()));
- connect(client, SIGNAL(bytesWritten(qint64)), this, SLOT(bytesWrittenSlot()));
- connect(client, SIGNAL(error(QAbstractSocket::SocketError)),
+ connect(client.data(), SIGNAL(readyRead()), this, SLOT(readyReadSlot()));
+ connect(client.data(), SIGNAL(bytesWritten(qint64)), this, SLOT(bytesWrittenSlot()));
+ connect(client.data(), SIGNAL(error(QAbstractSocket::SocketError)),
this, SLOT(slotError(QAbstractSocket::SocketError)));
}
@@ -611,17 +613,20 @@ private slots:
#ifndef QT_NO_SSL
void slotSslErrors(const QList<QSslError>& errors)
{
+ Q_ASSERT(!client.isNull());
qDebug() << "slotSslErrors" << client->errorString() << errors;
}
#endif
void slotError(QAbstractSocket::SocketError err)
{
+ Q_ASSERT(!client.isNull());
qDebug() << "slotError" << err << client->errorString();
}
public slots:
void readyReadSlot()
{
+ Q_ASSERT(!client.isNull());
receivedData += client->readAll();
int doubleEndlPos = receivedData.indexOf("\r\n\r\n");
@@ -635,9 +640,11 @@ public slots:
}
void bytesWrittenSlot() {
+ Q_ASSERT(!client.isNull());
+ // Disconnect and delete in next cycle (else Windows clients will fail with RemoteHostClosedError).
if (doClose && client->bytesToWrite() == 0) {
- client->disconnectFromHost();
disconnect(client, 0, this, 0);
+ client->deleteLater();
}
}
@@ -1835,7 +1842,7 @@ void tst_QNetworkReply::getErrors_data()
<< int(QNetworkReply::ProtocolUnknownError) << 0 << true;
// file: errors
- QTest::newRow("file-host") << "file://this-host-doesnt-exist.troll.no/foo.txt"
+ QTest::newRow("file-host") << "file://invalid.test.qt-project.org/foo.txt"
#if !defined Q_OS_WIN
<< int(QNetworkReply::ProtocolInvalidOperationError) << 0 << true;
#else
@@ -1856,7 +1863,7 @@ void tst_QNetworkReply::getErrors_data()
<< int(QNetworkReply::ContentAccessDenied) << 0 << true;
// ftp: errors
- QTest::newRow("ftp-host") << "ftp://this-host-doesnt-exist.troll.no/foo.txt"
+ QTest::newRow("ftp-host") << "ftp://invalid.test.qt-project.org/foo.txt"
<< int(QNetworkReply::HostNotFoundError) << 0 << true;
QTest::newRow("ftp-no-path") << "ftp://" + QtNetworkSettings::serverName()
<< int(QNetworkReply::ContentOperationNotPermittedError) << 0 << true;
@@ -1870,7 +1877,7 @@ void tst_QNetworkReply::getErrors_data()
<< int(QNetworkReply::ContentNotFoundError) << 0 << true;
// http: errors
- QTest::newRow("http-host") << "http://this-host-will-never-exist.troll.no/"
+ QTest::newRow("http-host") << "http://invalid.test.qt-project.org/"
<< int(QNetworkReply::HostNotFoundError) << 0 << true;
QTest::newRow("http-exist") << "http://" + QtNetworkSettings::serverName() + "/this-file-doesnt-exist.txt"
<< int(QNetworkReply::ContentNotFoundError) << 404 << false;
diff --git a/tests/auto/network/access/spdy/tst_spdy.cpp b/tests/auto/network/access/spdy/tst_spdy.cpp
index 15c0831590..3f69549bbd 100644
--- a/tests/auto/network/access/spdy/tst_spdy.cpp
+++ b/tests/auto/network/access/spdy/tst_spdy.cpp
@@ -47,9 +47,9 @@
#include <QtNetwork/QHttpMultiPart>
#include <QtNetwork/QNetworkProxy>
#include <QtNetwork/QAuthenticator>
-#ifdef QT_BUILD_INTERNAL
+#if defined(QT_BUILD_INTERNAL) && !defined(QT_NO_OPENSSL)
#include <QtNetwork/private/qsslsocket_openssl_p.h>
-#endif // QT_BUILD_INTERNAL
+#endif // QT_BUILD_INTERNAL && !QT_NO_OPENSSL
#include "../../../network-settings.h"
@@ -67,13 +67,17 @@ private Q_SLOTS:
void initTestCase();
void settingsAndNegotiation_data();
void settingsAndNegotiation();
+#ifndef QT_NO_NETWORKPROXY
void download_data();
void download();
+#endif // !QT_NO_NETWORKPROXY
void headerFields();
+#ifndef QT_NO_NETWORKPROXY
void upload_data();
void upload();
void errors_data();
void errors();
+#endif // !QT_NO_NETWORKPROXY
void multipleRequests_data();
void multipleRequests();
@@ -202,6 +206,7 @@ void tst_Spdy::proxyAuthenticationRequired(const QNetworkProxy &/*proxy*/,
authenticator->setPassword("password");
}
+#ifndef QT_NO_NETWORKPROXY
void tst_Spdy::download_data()
{
QTest::addColumn<QUrl>("url");
@@ -299,6 +304,7 @@ void tst_Spdy::download()
reply->deleteLater();
m_manager.setProxy(QNetworkProxy()); // reset
}
+#endif // !QT_NO_NETWORKPROXY
void tst_Spdy::headerFields()
{
@@ -329,6 +335,7 @@ static inline QByteArray md5sum(const QByteArray &data)
return QCryptographicHash::hash(data, QCryptographicHash::Md5).toHex().append('\n');
}
+#ifndef QT_NO_NETWORKPROXY
void tst_Spdy::upload_data()
{
QTest::addColumn<QUrl>("url");
@@ -602,6 +609,7 @@ void tst_Spdy::errors()
this, SLOT(proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *)),
Qt::UniqueConnection); // reset
}
+#endif // !QT_NO_NETWORKPROXY
void tst_Spdy::multipleRequests_data()
{
diff --git a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp
index 10b41ced9e..f01d79d9bc 100644
--- a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp
+++ b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp
@@ -660,7 +660,7 @@ void tst_QTcpServer::invalidProxy_data()
<< int(QAbstractSocket::UnsupportedSocketOperationError);
QTest::newRow("no-such-host") << int(QNetworkProxy::Socks5Proxy)
- << "this-host-will-never-exist.troll.no" << 1080
+ << "invalid.test.qt-project.org" << 1080
<< int(QAbstractSocket::ProxyNotFoundError);
QTest::newRow("socks5-on-http") << int(QNetworkProxy::Socks5Proxy) << fluke << 3128
<< int(QAbstractSocket::SocketTimeoutError);
diff --git a/tests/auto/opengl/qgl/tst_qgl.cpp b/tests/auto/opengl/qgl/tst_qgl.cpp
index 57128e4a82..718b5263bf 100644
--- a/tests/auto/opengl/qgl/tst_qgl.cpp
+++ b/tests/auto/opengl/qgl/tst_qgl.cpp
@@ -752,7 +752,7 @@ void tst_QGL::openGLVersionCheck()
#elif defined(QT_OPENGL_ES_2)
QVERIFY(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_ES_Version_2_0);
#else
- if (QOpenGLFunctions::isES())
+ if (QOpenGLContext::currentContext()->isES())
QVERIFY(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_ES_Version_2_0);
else
QVERIFY(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_1);
@@ -1534,7 +1534,7 @@ void tst_QGL::fboFormat()
#ifdef QT_OPENGL_ES_2
GL_RGBA;
#else
- QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8;
+ QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL ? GL_RGBA : GL_RGBA8;
#endif
QCOMPARE(int(format1.internalTextureFormat()), expectedFormat);
@@ -1611,7 +1611,7 @@ void tst_QGL::fboFormat()
#ifdef QT_OPENGL_ES_2
GL_RGBA
#else
- QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8
+ QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL ? GL_RGBA : GL_RGBA8
#endif
);
QVERIFY(!(format1c == format3c));
@@ -1624,7 +1624,7 @@ void tst_QGL::fboFormat()
#ifdef QT_OPENGL_ES_2
GL_RGBA
#else
- QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8
+ QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL ? GL_RGBA : GL_RGBA8
#endif
);
QVERIFY(!(format1c == format4c));
diff --git a/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp b/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp
index fea3c7b643..cdd820cf5b 100644
--- a/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp
+++ b/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp
@@ -96,7 +96,7 @@ void tst_QGLFunctions::features()
funcs.initializeGLFunctions();
// Validate the features against what we expect for this platform.
- if (QOpenGLFunctions::isES()) {
+ if (QOpenGLContext::currentContext()->isES()) {
#if !defined(QT_OPENGL_ES) || defined(QT_OPENGL_ES_2)
QGLFunctions::OpenGLFeatures allFeatures =
(QGLFunctions::Multitexture |
diff --git a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp
index 765dc221dc..999761e3f0 100644
--- a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp
+++ b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp
@@ -216,6 +216,11 @@ public:
{
m_gl = new QGLWidget(0, shareWidget);
moveToThread(this);
+
+ }
+
+ void moveContextToThread()
+ {
m_gl->context()->moveToThread(this);
}
@@ -307,6 +312,7 @@ void tst_QGLThreads::textureUploadInThread()
display.show();
QVERIFY(QTest::qWaitForWindowActive(&display));
+ thread.moveContextToThread();
thread.start();
while (thread.isRunning()) {
@@ -333,7 +339,7 @@ static inline float qrandom() { return (rand() % 100) / 100.f; }
void renderAScene(int w, int h)
{
- if (QOpenGLFunctions::isES()) {
+ if (QOpenGLContext::currentContext()->isES()) {
QGLFunctions funcs(QGLContext::currentContext());
Q_UNUSED(w);
Q_UNUSED(h);
@@ -630,6 +636,12 @@ class PaintThreadManager
public:
PaintThreadManager(int count) : numThreads(count)
{
+ for (int i=0; i<numThreads; ++i)
+ devices.append(new T);
+ // Wait until resize events are processed on the internal
+ // QGLWidgets of the buffers to suppress errors
+ // about makeCurrent() from the wrong thread.
+ QCoreApplication::processEvents();
for (int i=0; i<numThreads; ++i) {
devices.append(new T);
threads.append(new QThread);
diff --git a/tests/auto/other/networkselftest/tst_networkselftest.cpp b/tests/auto/other/networkselftest/tst_networkselftest.cpp
index 108ec466c9..11f726dcd9 100644
--- a/tests/auto/other/networkselftest/tst_networkselftest.cpp
+++ b/tests/auto/other/networkselftest/tst_networkselftest.cpp
@@ -170,7 +170,9 @@ static QString prettyByteArray(const QByteArray &array)
return result;
}
-static bool doSocketRead(QTcpSocket *socket, int minBytesAvailable, int timeout = 4000)
+enum { defaultReadTimeoutMS = 4000 };
+
+static bool doSocketRead(QTcpSocket *socket, int minBytesAvailable, int timeout = defaultReadTimeoutMS)
{
QElapsedTimer timer;
timer.start();
@@ -185,6 +187,15 @@ static bool doSocketRead(QTcpSocket *socket, int minBytesAvailable, int timeout
}
}
+static QByteArray msgDoSocketReadFailed(const QString &host, quint16 port,
+ int step, int minBytesAvailable)
+{
+ return "Failed to receive "
+ + QByteArray::number(minBytesAvailable) + " bytes from "
+ + host.toLatin1() + ':' + QByteArray::number(port)
+ + " in step " + QByteArray::number(step) + ": timeout";
+}
+
static bool doSocketFlush(QTcpSocket *socket, int timeout = 4000)
{
#ifndef QT_NO_SSL
@@ -226,8 +237,8 @@ static void netChat(int port, const QList<Chat> &chat)
switch (it->type) {
case Chat::Expect: {
qDebug() << i << "Expecting" << prettyByteArray(it->data);
- if (!doSocketRead(&socket, it->data.length()))
- QFAIL(QString("Failed to receive data in step %1: timeout").arg(i).toLocal8Bit());
+ if (!doSocketRead(&socket, it->data.length(), 3 * defaultReadTimeoutMS))
+ QFAIL(msgDoSocketReadFailed(QtNetworkSettings::serverName(), port, i, it->data.length()));
// pop that many bytes off the socket
QByteArray received = socket.read(it->data.length());
@@ -245,7 +256,7 @@ static void netChat(int port, const QList<Chat> &chat)
while (true) {
// scan the buffer until we have our string
if (!doSocketRead(&socket, it->data.length()))
- QFAIL(QString("Failed to receive data in step %1: timeout").arg(i).toLocal8Bit());
+ QFAIL(msgDoSocketReadFailed(QtNetworkSettings::serverName(), port, i, it->data.length()));
QByteArray buffer;
buffer.resize(socket.bytesAvailable());
@@ -266,7 +277,7 @@ static void netChat(int port, const QList<Chat> &chat)
case Chat::SkipBytes: {
qDebug() << i << "Skipping" << it->value << "bytes";
if (!doSocketRead(&socket, it->value))
- QFAIL(QString("Failed to receive data in step %1: timeout").arg(i).toLocal8Bit());
+ QFAIL(msgDoSocketReadFailed(QtNetworkSettings::serverName(), port, i, it->value));
// now discard the bytes
QByteArray buffer = socket.read(it->value);
diff --git a/tests/auto/other/qaccessibilitylinux/qaccessibilitylinux.pro b/tests/auto/other/qaccessibilitylinux/qaccessibilitylinux.pro
index a9705453e9..cb5bc04c1d 100644
--- a/tests/auto/other/qaccessibilitylinux/qaccessibilitylinux.pro
+++ b/tests/auto/other/qaccessibilitylinux/qaccessibilitylinux.pro
@@ -10,5 +10,5 @@ SOURCES += tst_qaccessibilitylinux.cpp
CONFIG += gui
-QT += gui gui-private widgets dbus testlib
+QT += gui-private widgets dbus testlib
diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro b/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro
index 1f60cd5ca4..bc4671f60c 100644
--- a/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro
+++ b/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro
@@ -4,7 +4,7 @@ win32:testcase.timeout = 900
macx:testcase.timeout = 900
QT += widgets widgets-private
-QT += core-private gui testlib
+QT += core-private testlib
SOURCES += tst_qfilesystemmodel.cpp
TARGET = tst_qfilesystemmodel
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index 21e0286086..dd3d041f56 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -441,6 +441,8 @@ private slots:
void mouseDoubleClickBubbling_QTBUG29680();
void largerThanScreen_QTBUG30142();
+ void resizeStaticContentsChildWidget_QTBUG35282();
+
private:
bool ensureScreenSize(int width, int height);
QWidget *testWidget;
@@ -10220,5 +10222,26 @@ void tst_QWidget::largerThanScreen_QTBUG30142()
QVERIFY(widget2.frameGeometry().x() >= 0);
}
+void tst_QWidget::resizeStaticContentsChildWidget_QTBUG35282()
+{
+ QWidget widget;
+ widget.resize(200,200);
+
+ UpdateWidget childWidget(&widget);
+ childWidget.setAttribute(Qt::WA_StaticContents);
+ childWidget.setAttribute(Qt::WA_OpaquePaintEvent);
+ childWidget.setGeometry(250, 250, 500, 500);
+
+ widget.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&widget));
+ QVERIFY(childWidget.numPaintEvents == 0);
+ childWidget.reset();
+
+ widget.resize(1000,1000);
+ QVERIFY(QTest::qWaitForWindowExposed(&widget));
+ QGuiApplication::sync();
+ QVERIFY(childWidget.numPaintEvents >= 1);
+}
+
QTEST_MAIN(tst_QWidget)
#include "tst_qwidget.moc"
diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
index 5f4284e79a..ba9652a170 100644
--- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
+++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
@@ -59,6 +59,7 @@
#include <QTextEdit>
#ifndef QT_NO_OPENGL
#include <QtOpenGL>
+#include <QOpenGLContext>
#endif
#include <QStyleHints>
@@ -2596,8 +2597,8 @@ void tst_QMdiArea::nativeSubWindows()
const QString platformName = QGuiApplication::platformName();
if (platformName != QLatin1String("xcb") && platformName != QLatin1String("windows"))
QSKIP(qPrintable(QString::fromLatin1("nativeSubWindows() does not work on this platform (%1).").arg(platformName)));
-#ifdef Q_OS_WIN
- if (QOpenGLFunctions::isES())
+#if defined(Q_OS_WIN) && !defined(QT_NO_OPENGL)
+ if (QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL)
QSKIP("nativeSubWindows() does not work with ANGLE on Windows, QTBUG-28545.");
#endif
{ // Add native widgets after show.