diff options
Diffstat (limited to 'tests')
154 files changed, 1729 insertions, 178 deletions
diff --git a/tests/auto/corelib/global/global.pro b/tests/auto/corelib/global/global.pro index c05905bd15..219e9de818 100644 --- a/tests/auto/corelib/global/global.pro +++ b/tests/auto/corelib/global/global.pro @@ -9,4 +9,4 @@ SUBDIRS=\ qlogging \ qtendian \ qglobalstatic \ - + qhooks diff --git a/tests/auto/corelib/global/qhooks/qhooks.pro b/tests/auto/corelib/global/qhooks/qhooks.pro new file mode 100644 index 0000000000..f886e7d49a --- /dev/null +++ b/tests/auto/corelib/global/qhooks/qhooks.pro @@ -0,0 +1,4 @@ +CONFIG += testcase parallel_test +TARGET = tst_qhooks +QT = core-private testlib +SOURCES = tst_qhooks.cpp diff --git a/tests/auto/corelib/global/qhooks/tst_qhooks.cpp b/tests/auto/corelib/global/qhooks/tst_qhooks.cpp new file mode 100644 index 0000000000..817c0b8173 --- /dev/null +++ b/tests/auto/corelib/global/qhooks/tst_qhooks.cpp @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Volker Krause <volker.krause@kdab.com> +** 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 <QtCore/private/qhooks_p.h> + +class tst_QHooks: public QObject +{ + Q_OBJECT + +private slots: + void testVersion(); + void testAddRemoveObject(); +}; + +void tst_QHooks::testVersion() +{ + QVERIFY(qtHookData[QHooks::HookDataVersion] >= 1); + QCOMPARE(qtHookData[QHooks::HookDataSize], (quintptr)QHooks::LastHookIndex); + QCOMPARE(qtHookData[QHooks::QtVersion], (quintptr)QT_VERSION); +} + +static int objectCount = 0; + +static void objectAddHook(QObject*) +{ + ++objectCount; +} + +static void objectRemoveHook(QObject*) +{ + --objectCount; +} + +void tst_QHooks::testAddRemoveObject() +{ + QCOMPARE(qtHookData[QHooks::AddQObject], (quintptr)0); + QCOMPARE(qtHookData[QHooks::RemoveQObject], (quintptr)0); + + qtHookData[QHooks::AddQObject] = (quintptr)&objectAddHook; + qtHookData[QHooks::RemoveQObject] = (quintptr)&objectRemoveHook; + + QCOMPARE(objectCount, 0); + QObject *obj = new QObject; + QVERIFY(objectCount > 0); + delete obj; + QCOMPARE(objectCount, 0); +} + +QTEST_APPLESS_MAIN(tst_QHooks) +#include "tst_qhooks.moc" diff --git a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp index a6d76ea7b6..a477d6bc6c 100644 --- a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp @@ -270,7 +270,9 @@ static int NColorRoles[] = { QPalette::ToolTipText + 1, // Qt_5_0 QPalette::ToolTipText + 1, // Qt_5_1 QPalette::ToolTipText + 1, // Qt_5_2 - 0 // add the correct value for Qt_5_3 here later + QPalette::ToolTipText + 1, // Qt_5_3 + QPalette::ToolTipText + 1, // Qt_5_4 + 0 // add the correct value for Qt_5_5 here later }; // Testing get/set functions diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp index 80144dba20..07e011f449 100644 --- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp +++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp @@ -163,7 +163,8 @@ public: QDebug operator<< (QDebug s, const MyPoint& point) { const QDebugStateSaver saver(s); - return s.nospace() << "MyPoint(" << point.v1 << ", " << point.v2 << ")"; + s.nospace() << "MyPoint(" << point.v1 << ", " << point.v2 << ")"; + return s; } class MyLine @@ -199,10 +200,19 @@ void tst_QDebug::debugSpaceHandling() const d << 1 << 2; MyLine line(MyPoint(10, 11), MyPoint (12, 13)); d << line; + d << "bar"; // With the old implementation of MyPoint doing dbg.nospace() << ...; dbg.space() we ended up with // MyLine(MyPoint(10, 11) , MyPoint(12, 13) ) } - QCOMPARE(s_msg, QString::fromLatin1(" foo key=value 1 2 MyLine(MyPoint(10, 11), MyPoint(12, 13))")); + QCOMPARE(s_msg, QString::fromLatin1(" foo key=value 1 2 MyLine(MyPoint(10, 11), MyPoint(12, 13)) bar")); + + QVERIFY(qDebug().autoInsertSpaces()); + qDebug() << QPoint(21, 22) << QRect(23, 24, 25, 26) << QLine(27, 28, 29, 30); + QCOMPARE(s_msg, QString::fromLatin1("QPoint(21,22) QRect(23,24 25x26) QLine(QPoint(27,28),QPoint(29,30))")); + qDebug() << QPointF(21, 22) << QRectF(23, 24, 25, 26) << QLineF(27, 28, 29, 30); + QCOMPARE(s_msg, QString::fromLatin1("QPointF(21,22) QRectF(23,24 25x26) QLineF(QPointF(27,28),QPointF(29,30))")); + qDebug() << QMimeType() << QMimeDatabase().mimeTypeForName("application/pdf") << "foo"; + QCOMPARE(s_msg, QString::fromLatin1("QMimeType(invalid) QMimeType(\"application/pdf\") foo")); } void tst_QDebug::stateSaver() const @@ -214,7 +224,7 @@ void tst_QDebug::stateSaver() const QDebugStateSaver saver(d); d.nospace() << hex << right << qSetFieldWidth(3) << qSetPadChar('0') << 42; } - d.space() << 42; + d << 42; } QCOMPARE(s_msg, QString::fromLatin1("02a 42")); } diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp index 7247b02498..c373e80408 100644 --- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp +++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp @@ -56,7 +56,7 @@ #define Q_XDG_PLATFORM #endif -static const int MaxStandardLocation = QStandardPaths::GenericConfigLocation; +static const int MaxStandardLocation = QStandardPaths::AppDataLocation; class tst_qstandardpaths : public QObject { @@ -129,7 +129,8 @@ static const char * const enumNames[MaxStandardLocation + 1 - int(QStandardPaths "ConfigLocation", "DownloadLocation", "GenericCacheLocation", - "GenericConfigLocation" + "GenericConfigLocation", + "AppDataLocation" }; void tst_qstandardpaths::dump() @@ -238,7 +239,8 @@ void tst_qstandardpaths::enableTestMode() // Check this for locations where test programs typically write. Not desktop, download, music etc... typedef QHash<QStandardPaths::StandardLocation, QString> LocationHash; LocationHash testLocations; - testLocations.insert(QStandardPaths::DataLocation, QStandardPaths::writableLocation(QStandardPaths::DataLocation)); + testLocations.insert(QStandardPaths::AppDataLocation, QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)); + testLocations.insert(QStandardPaths::AppLocalDataLocation, QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)); testLocations.insert(QStandardPaths::GenericDataLocation, QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)); testLocations.insert(QStandardPaths::ConfigLocation, QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)); testLocations.insert(QStandardPaths::GenericConfigLocation, QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation)); @@ -294,18 +296,18 @@ void tst_qstandardpaths::testDataLocation() // applications are sandboxed. #if !defined(Q_OS_BLACKBERRY) && !defined(Q_OS_ANDROID) && !defined(Q_OS_WINRT) const QString base = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); - QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::DataLocation), base + "/tst_qstandardpaths"); + QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation), base + "/tst_qstandardpaths"); QCoreApplication::instance()->setOrganizationName("Qt"); - QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::DataLocation), base + "/Qt/tst_qstandardpaths"); + QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation), base + "/Qt/tst_qstandardpaths"); QCoreApplication::instance()->setApplicationName("QtTest"); - QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::DataLocation), base + "/Qt/QtTest"); + QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation), base + "/Qt/QtTest"); #endif #ifdef Q_XDG_PLATFORM setDefaultLocations(); const QString expectedAppDataDir = QDir::homePath() + QString::fromLatin1("/.local/share/Qt/QtTest"); - QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::DataLocation), expectedAppDataDir); - const QStringList appDataDirs = QStandardPaths::standardLocations(QStandardPaths::DataLocation); + QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation), expectedAppDataDir); + const QStringList appDataDirs = QStandardPaths::standardLocations(QStandardPaths::AppLocalDataLocation); QCOMPARE(appDataDirs.count(), 3); QCOMPARE(appDataDirs.at(0), expectedAppDataDir); QCOMPARE(appDataDirs.at(1), QString::fromLatin1("/usr/local/share/Qt/QtTest")); @@ -463,7 +465,7 @@ void tst_qstandardpaths::testAllWritableLocations_data() QTest::newRow("PicturesLocation") << QStandardPaths::PicturesLocation; QTest::newRow("TempLocation") << QStandardPaths::TempLocation; QTest::newRow("HomeLocation") << QStandardPaths::HomeLocation; - QTest::newRow("DataLocation") << QStandardPaths::DataLocation; + QTest::newRow("AppLocalDataLocation") << QStandardPaths::AppLocalDataLocation; QTest::newRow("DownloadLocation") << QStandardPaths::DownloadLocation; } diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index 92dbb96817..df090c3de9 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -165,6 +165,8 @@ private slots: void binaryData(); void fromUserInput_data(); void fromUserInput(); + void fromUserInputWithCwd_data(); + void fromUserInputWithCwd(); void fileName_data(); void fileName(); void isEmptyForEncodedUrl(); @@ -2913,6 +2915,52 @@ void tst_QUrl::fromUserInput() QCOMPARE(url, guessUrlFromString); } +void tst_QUrl::fromUserInputWithCwd_data() +{ + QTest::addColumn<QString>("string"); + QTest::addColumn<QString>("directory"); + QTest::addColumn<QUrl>("guessedUrlDefault"); + QTest::addColumn<QUrl>("guessedUrlAssumeLocalFile"); + + // Null + QTest::newRow("null") << QString() << QString() << QUrl() << QUrl(); + + // Existing file + QDirIterator it(QDir::currentPath(), QDir::NoDotDot | QDir::AllEntries); + int c = 0; + while (it.hasNext()) { + it.next(); + QUrl url = QUrl::fromLocalFile(it.filePath()); + QTest::newRow(QString("file-%1").arg(c++).toLatin1()) << it.fileName() << QDir::currentPath() << url << url; + } + QDir parent = QDir::current(); + QVERIFY(parent.cdUp()); + QUrl parentUrl = QUrl::fromLocalFile(parent.path()); + QTest::newRow("dotdot") << ".." << QDir::currentPath() << parentUrl << parentUrl; + + QTest::newRow("nonexisting") << "nonexisting" << QDir::currentPath() << QUrl("http://nonexisting") << QUrl::fromLocalFile(QDir::currentPath() + "/nonexisting"); + QTest::newRow("short-url") << "example.org" << QDir::currentPath() << QUrl("http://example.org") << QUrl::fromLocalFile(QDir::currentPath() + "/example.org"); + QTest::newRow("full-url") << "http://example.org" << QDir::currentPath() << QUrl("http://example.org") << QUrl("http://example.org"); + QTest::newRow("absolute") << "/doesnotexist.txt" << QDir::currentPath() << QUrl("file:///doesnotexist.txt") << QUrl("file:///doesnotexist.txt"); +#ifdef Q_OS_WIN + QTest::newRow("windows-absolute") << "c:/doesnotexist.txt" << QDir::currentPath() << QUrl("file:///c:/doesnotexist.txt") << QUrl("file:///c:/doesnotexist.txt"); +#endif +} + +void tst_QUrl::fromUserInputWithCwd() +{ + QFETCH(QString, string); + QFETCH(QString, directory); + QFETCH(QUrl, guessedUrlDefault); + QFETCH(QUrl, guessedUrlAssumeLocalFile); + + QUrl url = QUrl::fromUserInput(string, directory); + QCOMPARE(url, guessedUrlDefault); + + url = QUrl::fromUserInput(string, directory, QUrl::AssumeLocalFile); + QCOMPARE(url, guessedUrlAssumeLocalFile); +} + void tst_QUrl::fileName_data() { QTest::addColumn<QString>("urlStr"); diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index 959c79ed60..b65bddbf65 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -1341,6 +1341,8 @@ static QByteArray createTypeName(const char *begin, const char *va) } #endif +Q_DECLARE_METATYPE(const void*) + void tst_QMetaType::automaticTemplateRegistration() { #define TEST_SEQUENTIAL_CONTAINER(CONTAINER, VALUE_TYPE) \ @@ -1577,6 +1579,12 @@ void tst_QMetaType::automaticTemplateRegistration() ) CREATE_AND_VERIFY_CONTAINER(QList, QList<QMap<int, QHash<char, QVariantList> > >) + CREATE_AND_VERIFY_CONTAINER(QVector, void*) + CREATE_AND_VERIFY_CONTAINER(QVector, const void*) + CREATE_AND_VERIFY_CONTAINER(QList, void*) + CREATE_AND_VERIFY_CONTAINER(QPair, void*, void*) + CREATE_AND_VERIFY_CONTAINER(QHash, void*, void*) + CREATE_AND_VERIFY_CONTAINER(QHash, const void*, const void*) #endif // Q_COMPILER_VARIADIC_MACROS diff --git a/tests/auto/corelib/tools/qregularexpression/.gitignore b/tests/auto/corelib/tools/qregularexpression/.gitignore index c9249e090e..4650b4454e 100644 --- a/tests/auto/corelib/tools/qregularexpression/.gitignore +++ b/tests/auto/corelib/tools/qregularexpression/.gitignore @@ -1,2 +1,3 @@ tst_qregularexpression_alwaysoptimize tst_qregularexpression_defaultoptimize +tst_qregularexpression_forceoptimize diff --git a/tests/auto/corelib/tools/qregularexpression/forceoptimize/forceoptimize.pro b/tests/auto/corelib/tools/qregularexpression/forceoptimize/forceoptimize.pro new file mode 100644 index 0000000000..d34bc9b93d --- /dev/null +++ b/tests/auto/corelib/tools/qregularexpression/forceoptimize/forceoptimize.pro @@ -0,0 +1,8 @@ +CONFIG += testcase parallel_test +TARGET = tst_qregularexpression_forceoptimize +QT = core testlib +HEADERS = ../tst_qregularexpression.h +SOURCES = \ + tst_qregularexpression_forceoptimize.cpp \ + ../tst_qregularexpression.cpp +DEFINES += forceOptimize=true diff --git a/tests/auto/corelib/tools/qregularexpression/forceoptimize/tst_qregularexpression_forceoptimize.cpp b/tests/auto/corelib/tools/qregularexpression/forceoptimize/tst_qregularexpression_forceoptimize.cpp new file mode 100644 index 0000000000..6244aacedf --- /dev/null +++ b/tests/auto/corelib/tools/qregularexpression/forceoptimize/tst_qregularexpression_forceoptimize.cpp @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> +** 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 <QtTest/QtTest> +#include "../tst_qregularexpression.h" + +class tst_QRegularExpression_ForceOptimize : public tst_QRegularExpression +{ + Q_OBJECT +}; + +QTEST_APPLESS_MAIN(tst_QRegularExpression_ForceOptimize) + +#include "tst_qregularexpression_forceoptimize.moc" diff --git a/tests/auto/corelib/tools/qregularexpression/qregularexpression.pro b/tests/auto/corelib/tools/qregularexpression/qregularexpression.pro index 0cae10112f..c030f04a27 100644 --- a/tests/auto/corelib/tools/qregularexpression/qregularexpression.pro +++ b/tests/auto/corelib/tools/qregularexpression/qregularexpression.pro @@ -1,3 +1,3 @@ TEMPLATE = subdirs -SUBDIRS = defaultoptimize +SUBDIRS = defaultoptimize forceoptimize contains(QT_CONFIG,private_tests):SUBDIRS += alwaysoptimize diff --git a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp index 909725f4b8..5fad1bb738 100644 --- a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp +++ b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp @@ -48,6 +48,10 @@ #include "tst_qregularexpression.h" +#ifndef forceOptimize +#define forceOptimize false +#endif + struct Match { Match() @@ -329,22 +333,30 @@ void tst_QRegularExpression::gettersSetters() { QRegularExpression re; re.setPattern(pattern); + if (forceOptimize) + re.optimize(); QCOMPARE(re.pattern(), pattern); QCOMPARE(re.patternOptions(), QRegularExpression::NoPatternOption); } { QRegularExpression re; re.setPatternOptions(patternOptions); + if (forceOptimize) + re.optimize(); QCOMPARE(re.pattern(), QString()); QCOMPARE(re.patternOptions(), patternOptions); } { QRegularExpression re(pattern); + if (forceOptimize) + re.optimize(); QCOMPARE(re.pattern(), pattern); QCOMPARE(re.patternOptions(), QRegularExpression::NoPatternOption); } { QRegularExpression re(pattern, patternOptions); + if (forceOptimize) + re.optimize(); QCOMPARE(re.pattern(), pattern); QCOMPARE(re.patternOptions(), patternOptions); } @@ -385,6 +397,8 @@ void tst_QRegularExpression::escape() QFETCH(QString, escaped); QCOMPARE(QRegularExpression::escape(string), escaped); QRegularExpression re(escaped); + if (forceOptimize) + re.optimize(); QCOMPARE(re.isValid(), true); } @@ -415,6 +429,8 @@ void tst_QRegularExpression::validity() QFETCH(QString, pattern); QFETCH(bool, validity); QRegularExpression re(pattern); + if (forceOptimize) + re.optimize(); QCOMPARE(re.isValid(), validity); if (!validity) QTest::ignoreMessage(QtWarningMsg, "QRegularExpressionPrivate::doMatch(): called on an invalid QRegularExpression object"); @@ -501,6 +517,9 @@ void tst_QRegularExpression::patternOptions() QFETCH(QString, subject); QFETCH(Match, match); + if (forceOptimize) + regexp.optimize(); + QRegularExpressionMatch m = regexp.match(subject); consistencyCheck(m); QVERIFY(m == match); @@ -717,6 +736,9 @@ void tst_QRegularExpression::normalMatch() QFETCH(QRegularExpression::MatchOptions, matchOptions); QFETCH(Match, match); + if (forceOptimize) + regexp.optimize(); + { QRegularExpressionMatch m = regexp.match(subject, offset, QRegularExpression::NormalMatch, matchOptions); consistencyCheck(m); @@ -995,6 +1017,9 @@ void tst_QRegularExpression::partialMatch() QFETCH(QRegularExpression::MatchOptions, matchOptions); QFETCH(Match, match); + if (forceOptimize) + regexp.optimize(); + { QRegularExpressionMatch m = regexp.match(subject, offset, matchType, matchOptions); consistencyCheck(m); @@ -1286,6 +1311,10 @@ void tst_QRegularExpression::globalMatch() QFETCH(QRegularExpression::MatchType, matchType); QFETCH(QRegularExpression::MatchOptions, matchOptions); QFETCH(QList<Match>, matchList); + + if (forceOptimize) + regexp.optimize(); + { QRegularExpressionMatchIterator iterator = regexp.globalMatch(subject, offset, matchType, matchOptions); consistencyCheck(iterator); @@ -1320,6 +1349,10 @@ void tst_QRegularExpression::serialize() QFETCH(QString, pattern); QFETCH(QRegularExpression::PatternOptions, patternOptions); QRegularExpression outRe(pattern, patternOptions); + + if (forceOptimize) + outRe.optimize(); + QByteArray buffer; { QDataStream out(&buffer, QIODevice::WriteOnly); @@ -1376,16 +1409,34 @@ void tst_QRegularExpression::operatoreq() { QRegularExpression re1(pattern); QRegularExpression re2(pattern); + + if (forceOptimize) + re1.optimize(); + if (forceOptimize) + re2.optimize(); + verifyEquality(re1, re2); } { QRegularExpression re1(QString(), patternOptions); QRegularExpression re2(QString(), patternOptions); + + if (forceOptimize) + re1.optimize(); + if (forceOptimize) + re2.optimize(); + verifyEquality(re1, re2); } { QRegularExpression re1(pattern, patternOptions); QRegularExpression re2(pattern, patternOptions); + + if (forceOptimize) + re1.optimize(); + if (forceOptimize) + re2.optimize(); + verifyEquality(re1, re2); } } @@ -1414,6 +1465,10 @@ void tst_QRegularExpression::captureCount() { QFETCH(QString, pattern); QRegularExpression re(pattern); + + if (forceOptimize) + re.optimize(); + QTEST(re.captureCount(), "captureCount"); if (!re.isValid()) QCOMPARE(re.captureCount(), -1); @@ -1480,7 +1535,11 @@ void tst_QRegularExpression::captureNames() QFETCH(QString, pattern); QFETCH(StringToIntMap, namedCapturesIndexMap); - const QRegularExpression re(pattern); + QRegularExpression re(pattern); + + if (forceOptimize) + re.optimize(); + QStringList namedCaptureGroups = re.namedCaptureGroups(); int namedCaptureGroupsCount = namedCaptureGroups.size(); @@ -1515,6 +1574,10 @@ void tst_QRegularExpression::pcreJitStackUsage() QFETCH(QString, subject); QRegularExpression re(pattern); + + if (forceOptimize) + re.optimize(); + QVERIFY(re.isValid()); QRegularExpressionMatch match = re.match(subject); consistencyCheck(match); @@ -1541,6 +1604,10 @@ void tst_QRegularExpression::regularExpressionMatch() QFETCH(QString, subject); QRegularExpression re(pattern); + + if (forceOptimize) + re.optimize(); + QVERIFY(re.isValid()); QRegularExpressionMatch match = re.match(subject); consistencyCheck(match); @@ -1580,5 +1647,7 @@ void tst_QRegularExpression::JOptionUsage() QRegularExpression re(pattern); if (isValid && JOptionUsed) QTest::ignoreMessage(QtWarningMsg, qPrintable(warningMessage.arg(pattern))); + if (forceOptimize) + re.optimize(); QCOMPARE(re.isValid(), isValid); } diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp index 5b1a2cf076..9bcce60e93 100644 --- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp @@ -74,6 +74,7 @@ private slots: void useOfForwardDeclared(); void memoryManagement(); void dropLastReferenceOfForwardDeclared(); + void lock(); void downCast(); void functionCallDownCast(); void upCast(); @@ -391,12 +392,56 @@ void tst_QSharedPointer::swap() QVERIFY(p2 != control); QVERIFY(p2.isNull()); QVERIFY(*p1 == 42); + + QWeakPointer<int> w1, w2 = control; + + QVERIFY(w1.isNull()); + QVERIFY(!w2.isNull()); + QVERIFY(w2.lock() == control); + QVERIFY(!w1.lock()); + + w1.swap(w2); + QVERIFY(w2.isNull()); + QVERIFY(!w1.isNull()); + QVERIFY(w1.lock() == control); + QVERIFY(!w2.lock()); + + qSwap(w1, w2); + QVERIFY(w1.isNull()); + QVERIFY(w2.lock() == control); + + p1.reset(); + p2.reset(); + control.reset(); + + QVERIFY(w1.isNull()); + QVERIFY(w2.isNull()); } void tst_QSharedPointer::useOfForwardDeclared() { // this just a compile test: use the forward-declared class QSharedPointer<ForwardDeclared> sp; + + // copying should work, too: + QSharedPointer<ForwardDeclared> sp2 = sp; + + // and assignment: + QSharedPointer<ForwardDeclared> sp3; + sp3 = sp; + + // move assignment: + QSharedPointer<ForwardDeclared> sp4; + sp4 = qMove(sp); + + // and move constuction: + QSharedPointer<ForwardDeclared> sp5 = qMove(sp2); + + // swapping: + sp4.swap(sp3); + qSwap(sp4, sp3); + + // and, of course, destruction } @@ -474,6 +519,22 @@ void tst_QSharedPointer::dropLastReferenceOfForwardDeclared() QCOMPARE(forwardDeclaredDestructorRunCount, 1); } +void tst_QSharedPointer::lock() +{ + QSharedPointer<int> sp = QSharedPointer<int>::create(); + QVERIFY(sp); + QWeakPointer<int> wp = sp; + QVERIFY(sp == wp); + QVERIFY(sp == wp.lock()); + QVERIFY(sp == wp.toStrongRef()); + + sp.reset(); + QVERIFY(!wp); + QVERIFY(sp != wp); // this is why op(shared_ptr, weak_ptr) is a bad idea (apart from MT races)... + QVERIFY(sp == wp.lock()); + QVERIFY(sp == wp.toStrongRef()); +} + class DerivedData: public Data { public: @@ -846,6 +907,7 @@ void tst_QSharedPointer::objectCast() ptr.clear(); QVERIFY(ptr.isNull()); QVERIFY(weakptr.toStrongRef().isNull()); + QVERIFY(weakptr.lock().isNull()); // verify that the object casts fail without crash QSharedPointer<OtherObject> otherptr = qSharedPointerObjectCast<OtherObject>(weakptr); diff --git a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp index 246560e47f..91501a0106 100644 --- a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp +++ b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp @@ -66,6 +66,7 @@ private slots: void lastIndexOf_regExp(); void streamingOperator(); + void assignmentOperator(); void join() const; void join_data() const; void joinEmptiness() const; @@ -296,9 +297,11 @@ void tst_QStringList::removeDuplicates_data() QTest::addColumn<QString>("before"); QTest::addColumn<QString>("after"); QTest::addColumn<int>("count"); + QTest::addColumn<bool>("detached"); - QTest::newRow("empty-1") << "Hello,Hello" << "Hello" << 1; - QTest::newRow("empty-2") << "Hello,World" << "Hello,World" << 0; + QTest::newRow("empty-1") << "Hello,Hello" << "Hello" << 1 << true; + QTest::newRow("empty-2") << "Hello,World" << "Hello,World" << 0 << false; + QTest::newRow("middle") << "Hello,World,Hello" << "Hello,World" << 1 << true; } void tst_QStringList::removeDuplicates() @@ -306,13 +309,16 @@ void tst_QStringList::removeDuplicates() QFETCH(QString, before); QFETCH(QString, after); QFETCH(int, count); + QFETCH(bool, detached); QStringList lbefore = before.split(','); + const QStringList oldlbefore = lbefore; QStringList lafter = after.split(','); int removed = lbefore.removeDuplicates(); QCOMPARE(removed, count); QCOMPARE(lbefore, lafter); + QCOMPARE(detached, !oldlbefore.isSharedWith(lbefore)); } void tst_QStringList::streamingOperator() @@ -321,8 +327,13 @@ void tst_QStringList::streamingOperator() list << "hei"; list << list << "hopp" << list; + QList<QString> slist = list; + list << slist; + QCOMPARE(list, QStringList() << "hei" << "hei" << "hopp" + << "hei" << "hei" << "hopp" + << "hei" << "hei" << "hopp" << "hei" << "hei" << "hopp"); QStringList list2; @@ -334,6 +345,21 @@ void tst_QStringList::streamingOperator() QCOMPARE(list2 << list3, QStringList() << "adam" << "eva"); } +void tst_QStringList::assignmentOperator() +{ + // compile-only test + + QStringList adam; + adam << "adam"; + QList<QString> eva; + eva << "eva"; + QStringList result; + QStringList &ref1 = (result = adam); + QStringList &ref2 = (result = eva); + Q_UNUSED(ref1); + Q_UNUSED(ref2); +} + void tst_QStringList::join() const { QFETCH(QStringList, input); diff --git a/tests/auto/corelib/tools/qvector/tst_qvector.cpp b/tests/auto/corelib/tools/qvector/tst_qvector.cpp index f1efbf0812..776251fa52 100644 --- a/tests/auto/corelib/tools/qvector/tst_qvector.cpp +++ b/tests/auto/corelib/tools/qvector/tst_qvector.cpp @@ -225,7 +225,9 @@ private slots: void fromListCustom() const; void fromStdVector() const; void indexOf() const; - void insert() const; + void insertInt() const; + void insertMovable() const; + void insertCustom() const; void isEmpty() const; void last() const; void lastIndexOf() const; @@ -296,6 +298,7 @@ private: template<typename T> void eraseReserved() const; template<typename T> void fill() const; template<typename T> void fromList() const; + template<typename T> void insert() const; template<typename T> void prepend() const; template<typename T> void remove() const; template<typename T> void size() const; @@ -1231,32 +1234,87 @@ void tst_QVector::indexOf() const QVERIFY(myvec.indexOf("A", 4) == -1); } +template <typename T> void tst_QVector::insert() const { - QVector<QString> myvec; - myvec << "A" << "B" << "C"; + QVector<T> myvec; + const T + tA = SimpleValue<T>::at(0), + tB = SimpleValue<T>::at(1), + tC = SimpleValue<T>::at(2), + tX = SimpleValue<T>::at(3), + tZ = SimpleValue<T>::at(4), + tT = SimpleValue<T>::at(5), + ti = SimpleValue<T>::at(6); + myvec << tA << tB << tC; + QVector<T> myvec2 = myvec; // first position - QCOMPARE(myvec.at(0), QLatin1String("A")); - myvec.insert(0, QLatin1String("X")); - QCOMPARE(myvec.at(0), QLatin1String("X")); - QCOMPARE(myvec.at(1), QLatin1String("A")); + QCOMPARE(myvec.at(0), tA); + myvec.insert(0, tX); + QCOMPARE(myvec.at(0), tX); + QCOMPARE(myvec.at(1), tA); + + QCOMPARE(myvec2.at(0), tA); + myvec2.insert(myvec2.begin(), tX); + QCOMPARE(myvec2.at(0), tX); + QCOMPARE(myvec2.at(1), tA); // middle - myvec.insert(1, QLatin1String("Z")); - QCOMPARE(myvec.at(0), QLatin1String("X")); - QCOMPARE(myvec.at(1), QLatin1String("Z")); - QCOMPARE(myvec.at(2), QLatin1String("A")); + myvec.insert(1, tZ); + QCOMPARE(myvec.at(0), tX); + QCOMPARE(myvec.at(1), tZ); + QCOMPARE(myvec.at(2), tA); + + myvec2.insert(myvec2.begin() + 1, tZ); + QCOMPARE(myvec2.at(0), tX); + QCOMPARE(myvec2.at(1), tZ); + QCOMPARE(myvec2.at(2), tA); // end - myvec.insert(5, QLatin1String("T")); - QCOMPARE(myvec.at(5), QLatin1String("T")); - QCOMPARE(myvec.at(4), QLatin1String("C")); + myvec.insert(5, tT); + QCOMPARE(myvec.at(5), tT); + QCOMPARE(myvec.at(4), tC); + + myvec2.insert(myvec2.end(), tT); + QCOMPARE(myvec2.at(5), tT); + QCOMPARE(myvec2.at(4), tC); // insert a lot of garbage in the middle - myvec.insert(2, 2, QLatin1String("infinity")); - QCOMPARE(myvec, QVector<QString>() << "X" << "Z" << "infinity" << "infinity" - << "A" << "B" << "C" << "T"); + myvec.insert(2, 2, ti); + QCOMPARE(myvec, QVector<T>() << tX << tZ << ti << ti + << tA << tB << tC << tT); + + myvec2.insert(myvec2.begin() + 2, 2, ti); + QCOMPARE(myvec2, myvec); + + // insert from references to the same container: + myvec.insert(0, 1, myvec[5]); // inserts tB + myvec2.insert(0, 1, myvec2[5]); // inserts tB + QCOMPARE(myvec, QVector<T>() << tB << tX << tZ << ti << ti + << tA << tB << tC << tT); + QCOMPARE(myvec2, myvec); + + myvec.insert(0, 1, const_cast<const QVector<T>&>(myvec)[0]); // inserts tB + myvec2.insert(0, 1, const_cast<const QVector<T>&>(myvec2)[0]); // inserts tB + QCOMPARE(myvec, QVector<T>() << tB << tB << tX << tZ << ti << ti + << tA << tB << tC << tT); + QCOMPARE(myvec2, myvec); +} + +void tst_QVector::insertInt() const +{ + insert<int>(); +} + +void tst_QVector::insertMovable() const +{ + insert<Movable>(); +} + +void tst_QVector::insertCustom() const +{ + insert<Custom>(); } void tst_QVector::isEmpty() const @@ -1386,13 +1444,28 @@ void tst_QVector::remove() const T val1 = SimpleValue<T>::at(1); T val2 = SimpleValue<T>::at(2); T val3 = SimpleValue<T>::at(3); + T val4 = SimpleValue<T>::at(4); + myvec << val1 << val2 << val3; + myvec << val1 << val2 << val3; myvec << val1 << val2 << val3; // remove middle myvec.remove(1); - QCOMPARE(myvec, QVector<T>() << val1 << val3); + QCOMPARE(myvec, QVector<T>() << val1 << val3 << val1 << val2 << val3 << val1 << val2 << val3); + + // removeOne() + QVERIFY(!myvec.removeOne(val4)); + QVERIFY(myvec.removeOne(val2)); + QCOMPARE(myvec, QVector<T>() << val1 << val3 << val1 << val3 << val1 << val2 << val3); + + // removeAll() + QCOMPARE(myvec.removeAll(val4), 0); + QCOMPARE(myvec.removeAll(val1), 3); + QCOMPARE(myvec, QVector<T>() << val3 << val3 << val2 << val3); + QCOMPARE(myvec.removeAll(val2), 1); + QCOMPARE(myvec, QVector<T>() << val3 << val3 << val3); // remove rest - myvec.remove(0, 2); + myvec.remove(0, 3); QCOMPARE(myvec, QVector<T>()); } diff --git a/tests/auto/corelib/xml/qxmlstream/data/009.ref b/tests/auto/corelib/xml/qxmlstream/data/009.ref index 1de530df1c..12b994eac4 100644 --- a/tests/auto/corelib/xml/qxmlstream/data/009.ref +++ b/tests/auto/corelib/xml/qxmlstream/data/009.ref @@ -24,4 +24,4 @@ Invalid( name="bar" qualifiedName="bar" Attribute( name="attr" namespaceUri="http://example.org/~wilbur" qualifiedName="b:attr" prefix="b" value="2" ) ) -ERROR: Attribute redefined. +ERROR: Attribute 'b:attr' redefined. diff --git a/tests/auto/corelib/xml/qxmlstream/data/010.ref b/tests/auto/corelib/xml/qxmlstream/data/010.ref index 217f4963a1..07def503a5 100644 --- a/tests/auto/corelib/xml/qxmlstream/data/010.ref +++ b/tests/auto/corelib/xml/qxmlstream/data/010.ref @@ -24,4 +24,4 @@ Invalid( name="bar" qualifiedName="bar" Attribute( name="attr" namespaceUri="http://example.org/~wilbur" qualifiedName="b:attr" prefix="b" value="2" ) ) -ERROR: Attribute redefined. +ERROR: Attribute 'b:attr' redefined. diff --git a/tests/auto/corelib/xml/qxmlstream/data/011.ref b/tests/auto/corelib/xml/qxmlstream/data/011.ref index e3945324eb..faa6e75429 100644 --- a/tests/auto/corelib/xml/qxmlstream/data/011.ref +++ b/tests/auto/corelib/xml/qxmlstream/data/011.ref @@ -27,4 +27,4 @@ Invalid( name="bar" qualifiedName="bar" Attribute( name="attr" namespaceUri="http://example.org/~wilbur" qualifiedName="b:attr" prefix="b" value="2" ) ) -ERROR: Attribute redefined. +ERROR: Attribute 'b:attr' redefined. diff --git a/tests/auto/corelib/xml/qxmlstream/data/012.ref b/tests/auto/corelib/xml/qxmlstream/data/012.ref index 7a688b103d..834db97ba6 100644 --- a/tests/auto/corelib/xml/qxmlstream/data/012.ref +++ b/tests/auto/corelib/xml/qxmlstream/data/012.ref @@ -24,4 +24,4 @@ Invalid( name="bar" qualifiedName="bar" Attribute( name="attr" namespaceUri="urn:xyzzy" qualifiedName="b:attr" prefix="b" value="2" ) ) -ERROR: Attribute redefined. +ERROR: Attribute 'b:attr' redefined. diff --git a/tests/auto/corelib/xml/qxmlstream/data/035.ref b/tests/auto/corelib/xml/qxmlstream/data/035.ref index e172fc90e1..cab0158a51 100644 --- a/tests/auto/corelib/xml/qxmlstream/data/035.ref +++ b/tests/auto/corelib/xml/qxmlstream/data/035.ref @@ -13,4 +13,4 @@ Invalid( name="bar" qualifiedName="bar" Attribute( name="attr" namespaceUri="http://example.org/~wilbur" qualifiedName="a:attr" prefix="a" value="2" ) ) -ERROR: Attribute redefined. +ERROR: Attribute 'a:attr' redefined. diff --git a/tests/auto/corelib/xml/qxmlstream/data/036.ref b/tests/auto/corelib/xml/qxmlstream/data/036.ref index 158e7361f9..50939ed7e7 100644 --- a/tests/auto/corelib/xml/qxmlstream/data/036.ref +++ b/tests/auto/corelib/xml/qxmlstream/data/036.ref @@ -13,4 +13,4 @@ Invalid( name="bar" qualifiedName="bar" Attribute( name="attr" namespaceUri="http://example.org/~wilbur" qualifiedName="b:attr" prefix="b" value="2" ) ) -ERROR: Attribute redefined. +ERROR: Attribute 'b:attr' redefined. diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index 95a9b142ec..d2072e0e56 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -170,6 +170,10 @@ private slots: void scaled_QTBUG35972(); + void convertToPixelFormat(); + void convertToImageFormat_data(); + void convertToImageFormat(); + void cleanupFunctions(); }; @@ -2460,6 +2464,46 @@ void tst_QImage::scaled_QTBUG35972() QCOMPARE(pixels[i], 0xffffffff); } +void tst_QImage::convertToPixelFormat() +{ + QPixelFormat rgb565 = QPixelFormatRgb(5,6,5,0,QPixelFormat::IgnoresAlpha, QPixelFormat::AtBeginning, QPixelFormat::NotPremultiplied, QPixelFormat::UnsignedShort); + QPixelFormat rgb565ImageFormat = QImage::toPixelFormat(QImage::Format_RGB16); + QCOMPARE(rgb565, rgb565ImageFormat); +} + +void tst_QImage::convertToImageFormat_data() +{ + QTest::addColumn<QImage::Format>("image_format"); + QTest::newRow("Convert Format_Invalid") << QImage::Format_Invalid; + QTest::newRow("Convert Format_Mono") << QImage::Format_Mono; + //This ends up being a QImage::Format_Mono since we cant specify LSB in QPixelFormat + //QTest::newRow("Convert Format_MonoLSB") << QImage::Format_MonoLSB; + QTest::newRow("Convert Format_Indexed8") << QImage::Format_Indexed8; + QTest::newRow("Convert Format_RGB32") << QImage::Format_RGB32; + QTest::newRow("Convert Format_ARGB32") << QImage::Format_ARGB32; + QTest::newRow("Convert Format_ARGB32_Premultiplied") << QImage::Format_ARGB32_Premultiplied; + QTest::newRow("Convert Format_RGB16") << QImage::Format_RGB16; + QTest::newRow("Convert Format_ARGB8565_Premultiplied") << QImage::Format_ARGB8565_Premultiplied; + QTest::newRow("Convert Format_RGB666") << QImage::Format_RGB666; + QTest::newRow("Convert Format_ARGB6666_Premultiplied") << QImage::Format_ARGB6666_Premultiplied; + QTest::newRow("Convert Format_RGB555") << QImage::Format_RGB555; + QTest::newRow("Convert Format_ARGB8555_Premultiplied") << QImage::Format_ARGB8555_Premultiplied; + QTest::newRow("Convert Format_RGB888") << QImage::Format_RGB888; + QTest::newRow("Convert Format_RGB444") << QImage::Format_RGB444; + QTest::newRow("Convert Format_ARGB4444_Premultiplied") << QImage::Format_ARGB4444_Premultiplied; + QTest::newRow("Convert Format_RGBX8888") << QImage::Format_RGBX8888; + QTest::newRow("Convert Format_RGBA8888") << QImage::Format_RGBA8888; + QTest::newRow("Convert Format_RGBA8888_Premultiplied") << QImage::Format_RGBA8888_Premultiplied; +} +void tst_QImage::convertToImageFormat() +{ + QFETCH(QImage::Format, image_format); + + QPixelFormat pixel_format = QImage::toPixelFormat(image_format); + QImage::Format format = QImage::toImageFormat(pixel_format); + QCOMPARE(format, image_format); +} + static void cleanupFunction(void* info) { bool *called = static_cast<bool*>(info); diff --git a/tests/auto/gui/image/qpicture/tst_qpicture.cpp b/tests/auto/gui/image/qpicture/tst_qpicture.cpp index 2e766c5bf5..986431941f 100644 --- a/tests/auto/gui/image/qpicture/tst_qpicture.cpp +++ b/tests/auto/gui/image/qpicture/tst_qpicture.cpp @@ -45,6 +45,7 @@ #include <qpicture.h> #include <qpainter.h> #include <qimage.h> +#include <qpaintengine.h> #ifndef QT_NO_WIDGETS #include <qdesktopwidget.h> #include <qapplication.h> @@ -64,7 +65,7 @@ private slots: void paintingActive(); void boundingRect(); void swap(); - void operator_lt_lt(); + void serialization(); #ifndef QT_NO_WIDGETS void save_restore(); @@ -169,36 +170,94 @@ void tst_QPicture::swap() QCOMPARE(p2.boundingRect(), QRect(0,0,5,5)); } -// operator<< and operator>> -void tst_QPicture::operator_lt_lt() +Q_DECLARE_METATYPE(QDataStream::Version) +Q_DECLARE_METATYPE(QPicture) + +void ensureSerializesCorrectly(const QPicture &picture, QDataStream::Version version) + { + QDataStream stream; + + QBuffer buffer; + buffer.open(QIODevice::WriteOnly); + stream.setDevice(&buffer); + stream.setVersion(version); + stream << picture; + buffer.close(); + + buffer.open(QIODevice::ReadOnly); + QPicture readpicture; + stream >> readpicture; + QVERIFY2(memcmp(picture.data(), readpicture.data(), picture.size()) == 0, + qPrintable(QString::fromLatin1("Picture data does not compare equal for QDataStream version %1").arg(version))); +} + +class PaintEngine : public QPaintEngine { - // streaming of null pictures - { - QPicture pic1, pic2; - QByteArray ba( 100, 0 ); - QDataStream str1( &ba, QIODevice::WriteOnly ); - str1 << pic1; - QDataStream str2( &ba, QIODevice::ReadOnly ); - str2 >> pic2; - QVERIFY( pic2.isNull() ); +public: + PaintEngine() : QPaintEngine() {} + bool begin(QPaintDevice *) { return true; } + bool end() { return true; } + void updateState(const QPaintEngineState &) {} + void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) {} + Type type() const { return Raster; } + + QFont font() { return state->font(); } +}; + +class Picture : public QPicture +{ +public: + Picture() : QPicture() {} + QPaintEngine *paintEngine() const { return (QPaintEngine*)&mPaintEngine; } +private: + PaintEngine mPaintEngine; +}; + +void tst_QPicture::serialization() +{ + QDataStream stream; + const int thisVersion = stream.version(); + + for (int version = QDataStream::Qt_1_0; version <= thisVersion; ++version) { + const QDataStream::Version versionEnum = static_cast<QDataStream::Version>(version); + + { + // streaming of null pictures + ensureSerializesCorrectly(QPicture(), versionEnum); + } + { + // picture with a simple line, checking bitwise equality + QPicture picture; + QPainter painter(&picture); + painter.drawLine(10, 20, 30, 40); + ensureSerializesCorrectly(picture, versionEnum); + } } - // picture with a simple line, checking bitwise equality { - QPicture pic1, pic2; - QPainter p( &pic1 ); - p.drawLine( 10, 20, 30, 40 ); - p.end(); - QByteArray ba( 10 * pic1.size(), 0 ); - QDataStream str1( &ba, QIODevice::WriteOnly ); - str1 << pic1; - QDataStream str2( &ba, QIODevice::ReadOnly ); - str2 >> pic2; - QCOMPARE( pic1.size(), pic2.size() ); - QVERIFY( memcmp( pic1.data(), pic2.data(), pic1.size() ) == 0 ); + // Test features that were added after Qt 4.5, as that was hard-coded as the major + // version for a while, which was incorrect. In this case, we'll test font hints. + QPicture picture; + QPainter painter; + QFont font; + font.setStyleName("Blah"); + font.setHintingPreference(QFont::PreferFullHinting); + painter.begin(&picture); + painter.setFont(font); + painter.drawText(20, 20, "Hello"); + painter.end(); + + Picture customPicture; + painter.begin(&customPicture); + picture.play(&painter); + const QFont actualFont = ((PaintEngine*)customPicture.paintEngine())->font(); + painter.end(); + QCOMPARE(actualFont.styleName(), QStringLiteral("Blah")); + QCOMPARE(actualFont.hintingPreference(), QFont::PreferFullHinting); } } + #ifndef QT_NO_WIDGETS static QPointF scalePoint(const QPointF &point, QPaintDevice *sourceDevice, QPaintDevice *destDevice) { diff --git a/tests/auto/gui/kernel/kernel.pro b/tests/auto/gui/kernel/kernel.pro index e4d9ce9d27..bbcdd91ea3 100644 --- a/tests/auto/gui/kernel/kernel.pro +++ b/tests/auto/gui/kernel/kernel.pro @@ -20,6 +20,7 @@ SUBDIRS=\ qtouchevent \ qwindow \ qguiapplication \ + qpixelformat \ !qtHaveModule(widgets): SUBDIRS -= \ qmouseevent_modal \ diff --git a/tests/auto/gui/kernel/qguiapplication/icons/appicon.png b/tests/auto/gui/kernel/qguiapplication/icons/appicon.png Binary files differnew file mode 100644 index 0000000000..b5d3ecbddf --- /dev/null +++ b/tests/auto/gui/kernel/qguiapplication/icons/appicon.png diff --git a/tests/auto/gui/kernel/qguiapplication/icons/usericon.png b/tests/auto/gui/kernel/qguiapplication/icons/usericon.png Binary files differnew file mode 100644 index 0000000000..8d703640c1 --- /dev/null +++ b/tests/auto/gui/kernel/qguiapplication/icons/usericon.png diff --git a/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro b/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro index cd363bab31..895c2a0307 100644 --- a/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro +++ b/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro @@ -7,3 +7,5 @@ INCLUDEPATH += $$CORE_TEST_PATH TARGET = tst_qguiapplication QT += gui-private SOURCES += tst_qguiapplication.cpp + +RESOURCES = tst_qguiapplication.qrc diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp index e551d99959..e1cdb8db45 100644 --- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp +++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp @@ -65,6 +65,7 @@ class tst_QGuiApplication: public tst_QCoreApplication private slots: void displayName(); void firstWindowTitle(); + void windowIcon(); void focusObject(); void allWindows(); void topLevelWindows(); @@ -99,6 +100,24 @@ void tst_QGuiApplication::firstWindowTitle() QCOMPARE(window.title(), QString("User Title")); } +void tst_QGuiApplication::windowIcon() +{ + int argc = 3; + char *argv[] = { const_cast<char*>("tst_qguiapplication"), const_cast<char*>("-qwindowicon"), const_cast<char*>(":/icons/usericon.png") }; + QGuiApplication app(argc, argv); + QIcon appIcon(":/icons/appicon.png"); + app.setWindowIcon(appIcon); + + QWindow window; + window.show(); + + QIcon userIcon(":/icons/usericon.png"); + // Comparing icons is hard. cacheKey() differs because the icon was independently loaded. + // So we use availableSizes, after making sure that the app and user icons do have different sizes. + QVERIFY(userIcon.availableSizes() != appIcon.availableSizes()); + QCOMPARE(window.icon().availableSizes(), userIcon.availableSizes()); +} + class DummyWindow : public QWindow { public: diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.qrc b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.qrc new file mode 100644 index 0000000000..b26fba37b9 --- /dev/null +++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.qrc @@ -0,0 +1,6 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource prefix="/"> + <file>icons/usericon.png</file> + <file>icons/appicon.png</file> +</qresource> +</RCC> diff --git a/tests/auto/gui/kernel/qpixelformat/qpixelformat.pro b/tests/auto/gui/kernel/qpixelformat/qpixelformat.pro new file mode 100644 index 0000000000..970e5c7c2d --- /dev/null +++ b/tests/auto/gui/kernel/qpixelformat/qpixelformat.pro @@ -0,0 +1,6 @@ +CONFIG += testcase +TARGET = tst_qpixelformat + +QT += gui testlib + +SOURCES += tst_qpixelformat.cpp diff --git a/tests/auto/gui/kernel/qpixelformat/tst_qpixelformat.cpp b/tests/auto/gui/kernel/qpixelformat/tst_qpixelformat.cpp new file mode 100644 index 0000000000..c3b19a3b44 --- /dev/null +++ b/tests/auto/gui/kernel/qpixelformat/tst_qpixelformat.cpp @@ -0,0 +1,243 @@ +/**************************************************************************** +** +** 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 <QtTest/QtTest> + +#include <QtGui/qpixelformat.h> + +class tst_QPixelFormat : public QObject +{ + Q_OBJECT + +private slots: + void testOperators(); + void testQVectorOfFormats(); + void testRGB(); + void testCMYK(); + void testHSLandHSV(); + void testYUV_data(); + void testYUV(); + void testEnums(); +}; + +void tst_QPixelFormat::testOperators() +{ + QPixelFormat first = QPixelFormatRgb(8,8,8,8,QPixelFormat::UsesAlpha, QPixelFormat::AtBeginning, QPixelFormat::Premultiplied); + QPixelFormat second = QPixelFormatRgb(8,8,8,8,QPixelFormat::UsesAlpha, QPixelFormat::AtBeginning, QPixelFormat::Premultiplied); + QVERIFY(first == second); + + QPixelFormat third = QPixelFormatRgb(8,8,8,8,QPixelFormat::UsesAlpha, QPixelFormat::AtEnd, QPixelFormat::NotPremultiplied); + QVERIFY(first != third); +} + +void tst_QPixelFormat::testQVectorOfFormats() +{ + QVector<QPixelFormat> reallocedVector; + QVector<QPixelFormat> reservedVector; + reservedVector.reserve(QImage::NImageFormats); + for (int i = 0; i < QImage::NImageFormats; i++) { + if (i == 0 || i == 2) // skip invalid and monolsb + continue; + QImage::Format image_format = static_cast<QImage::Format>(i); + QPixelFormat format = QImage::toPixelFormat(image_format); + reallocedVector.append(format); + reservedVector.append(format); + } + + for (int i = 0; i < reallocedVector.size(); i++) { + QCOMPARE(reallocedVector.at(i), reservedVector.at(i)); + } +} + +void tst_QPixelFormat::testRGB() +{ + QPixelFormat argb8888 = QPixelFormatRgb(8,8,8,8,QPixelFormat::UsesAlpha,QPixelFormat::AtBeginning, QPixelFormat::Premultiplied); + QCOMPARE(argb8888.redSize(), uchar(8)); + QCOMPARE(argb8888.greenSize(), uchar(8)); + QCOMPARE(argb8888.blueSize(), uchar(8)); + QCOMPARE(argb8888.alphaSize(), uchar(8)); + + QPixelFormat rgb565 = QPixelFormatRgb(5,6,5,0,QPixelFormat::IgnoresAlpha,QPixelFormat::AtBeginning, QPixelFormat::NotPremultiplied); + QCOMPARE(rgb565.redSize(), uchar(5)); + QCOMPARE(rgb565.greenSize(), uchar(6)); + QCOMPARE(rgb565.blueSize(), uchar(5)); + QCOMPARE(rgb565.alphaSize(), uchar(0)); + QCOMPARE(rgb565.bitsPerPixel(), uchar(16)); + + QPixelFormat rgba1235 = QPixelFormatRgb(1,2,3,5,QPixelFormat::IgnoresAlpha, QPixelFormat::AtEnd, QPixelFormat::Premultiplied); + QCOMPARE(rgba1235.redSize(), uchar(1)); + QCOMPARE(rgba1235.greenSize(), uchar(2)); + QCOMPARE(rgba1235.blueSize(), uchar(3)); + QCOMPARE(rgba1235.alphaSize(), uchar(5)); + QCOMPARE(rgba1235.bitsPerPixel(), uchar(1 + 2 + 3 + 5)); +} + +void tst_QPixelFormat::testCMYK() +{ + QPixelFormat cmyk6 = QPixelFormatCmyk(6); + QCOMPARE(cmyk6.cyanSize(), uchar(6)); + QCOMPARE(cmyk6.magentaSize(), uchar(6)); + QCOMPARE(cmyk6.yellowSize(), uchar(6)); + QCOMPARE(cmyk6.blackSize(), uchar(6)); + QCOMPARE(cmyk6.bitsPerPixel(), uchar(6*4)); + + QPixelFormat cmykWithAlpha = QPixelFormatCmyk(8,8); + QCOMPARE(cmykWithAlpha.bitsPerPixel(), uchar(8*5)); +} +void tst_QPixelFormat::testHSLandHSV() +{ + QPixelFormat hsl = QPixelFormatHsl(3,5); + + QCOMPARE(hsl.hueSize(), uchar(3)); + QCOMPARE(hsl.saturationSize(), uchar(3)); + QCOMPARE(hsl.lightnessSize(), uchar(3)); + QCOMPARE(hsl.bitsPerPixel(), uchar(3 * 3 + 5)); + + QPixelFormat hsv = QPixelFormatHsv(5,7); + + QCOMPARE(hsv.hueSize(), uchar(5)); + QCOMPARE(hsv.saturationSize(), uchar(5)); + QCOMPARE(hsv.brightnessSize(), uchar(5)); + QCOMPARE(hsv.bitsPerPixel(), uchar(5 * 3 + 7)); +} + +Q_DECLARE_METATYPE(QPixelFormat::YUVLayout) +void tst_QPixelFormat::testYUV_data() +{ + QTest::addColumn<QPixelFormat::YUVLayout>("yuv_layout"); + QTest::newRow("YUV Layout YUV444") << QPixelFormat::YUV444; + QTest::newRow("YUV Layout YUV422") << QPixelFormat::YUV422; + QTest::newRow("YUV Layout YUV411") << QPixelFormat::YUV411; + QTest::newRow("YUV Layout YUV420P") << QPixelFormat::YUV420P; + QTest::newRow("YUV Layout YUV420SP") << QPixelFormat::YUV420SP; + QTest::newRow("YUV Layout YV12") << QPixelFormat::YV12; + QTest::newRow("YUV Layout UYVY") << QPixelFormat::UYVY; + QTest::newRow("YUV Layout YUYV") << QPixelFormat::YUYV; + QTest::newRow("YUV Layout NV12") << QPixelFormat::NV12; + QTest::newRow("YUV Layout NV21") << QPixelFormat::NV21; + QTest::newRow("YUV Layout IMC1") << QPixelFormat::IMC1; + QTest::newRow("YUV Layout IMC2") << QPixelFormat::IMC2; + QTest::newRow("YUV Layout IMC3") << QPixelFormat::IMC3; + QTest::newRow("YUV Layout IMC4") << QPixelFormat::IMC4; + QTest::newRow("YUV Layout Y8") << QPixelFormat::Y8; + QTest::newRow("YUV Layout Y16") << QPixelFormat::Y16; +} + +void tst_QPixelFormat::testYUV() +{ + QFETCH(QPixelFormat::YUVLayout, yuv_layout); + + QPixelFormat format = QPixelFormatYuv(yuv_layout, 0); + + switch (yuv_layout) { + case QPixelFormat::YUV444: + QCOMPARE(format.bitsPerPixel(), uchar(24)); + break; + case QPixelFormat::YUV422: + QCOMPARE(format.bitsPerPixel(), uchar(16)); + break; + case QPixelFormat::YUV411: + case QPixelFormat::YUV420P: + case QPixelFormat::YUV420SP: + case QPixelFormat::YV12: + QCOMPARE(format.bitsPerPixel(), uchar(12)); + break; + case QPixelFormat::UYVY: + case QPixelFormat::YUYV: + QCOMPARE(format.bitsPerPixel(), uchar(16)); + break; + case QPixelFormat::NV12: + case QPixelFormat::NV21: + QCOMPARE(format.bitsPerPixel(), uchar(12)); + break; + case QPixelFormat::IMC1: + case QPixelFormat::IMC2: + case QPixelFormat::IMC3: + case QPixelFormat::IMC4: + QCOMPARE(format.bitsPerPixel(), uchar(12)); + break; + case QPixelFormat::Y8: + QCOMPARE(format.bitsPerPixel(), uchar(8)); + break; + case QPixelFormat::Y16: + QCOMPARE(format.bitsPerPixel(), uchar(16)); + break; + default: + QVERIFY(!"the value stored for the yuvLayout is wrong!"); + } + +} + +void tst_QPixelFormat::testEnums() +{ + QPixelFormat allSet = QPixelFormat(QPixelFormat::BGR,1,2,3,4,5,6, + QPixelFormat::UsesAlpha, + QPixelFormat::AtEnd, + QPixelFormat::Premultiplied, + QPixelFormat::FloatingPoint, + QPixelFormat::BigEndian, + (1 << 6) - 1); + + QCOMPARE(allSet.alphaUsage(), QPixelFormat::UsesAlpha); + QCOMPARE(allSet.alphaPosition(), QPixelFormat::AtEnd); + QCOMPARE(allSet.premultiplied(), QPixelFormat::Premultiplied); + QCOMPARE(allSet.byteOrder(), QPixelFormat::BigEndian); + QCOMPARE(allSet.typeInterpretation(), QPixelFormat::FloatingPoint); + QCOMPARE(allSet.byteOrder(), QPixelFormat::BigEndian); + QCOMPARE(allSet.subEnum(), uchar(63)); + + QPixelFormat nonSet = QPixelFormat(QPixelFormat::RGB,6,5,4,3,2,1, + QPixelFormat::IgnoresAlpha, + QPixelFormat::AtBeginning, + QPixelFormat::NotPremultiplied, + QPixelFormat::UnsignedInteger, + QPixelFormat::LittleEndian); + + QCOMPARE(nonSet.alphaUsage(), QPixelFormat::IgnoresAlpha); + QCOMPARE(nonSet.alphaPosition(), QPixelFormat::AtBeginning); + QCOMPARE(nonSet.premultiplied(), QPixelFormat::NotPremultiplied); + QCOMPARE(nonSet.byteOrder(), QPixelFormat::LittleEndian); + QCOMPARE(nonSet.typeInterpretation(), QPixelFormat::UnsignedInteger); + QCOMPARE(nonSet.byteOrder(), QPixelFormat::LittleEndian); + QCOMPARE(nonSet.subEnum(), uchar(0)); +} + +#include <tst_qpixelformat.moc> +QTEST_MAIN(tst_QPixelFormat); diff --git a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp index 1b1f5575b1..2e1d55ced4 100644 --- a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp +++ b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp @@ -530,10 +530,19 @@ static const int rgbTblSize = sizeof(rgbTbl) / sizeof(RGBData); void tst_QColor::setNamedColor() { for (int i = 0; i < rgbTblSize; ++i) { - QColor color; - color.setNamedColor(QLatin1String(rgbTbl[i].name)); QColor expected; expected.setRgba(rgbTbl[i].value); + + QColor color; + color.setNamedColor(QLatin1String(rgbTbl[i].name)); + QCOMPARE(color, expected); + + // name should be case insensitive + color.setNamedColor(QString(rgbTbl[i].name).toUpper()); + QCOMPARE(color, expected); + + // spaces should be ignored + color.setNamedColor(QString(rgbTbl[i].name).insert(1, ' ')); QCOMPARE(color, expected); } } diff --git a/tests/auto/gui/painting/qpen/tst_qpen.cpp b/tests/auto/gui/painting/qpen/tst_qpen.cpp index 07c996d026..a373c51710 100644 --- a/tests/auto/gui/painting/qpen/tst_qpen.cpp +++ b/tests/auto/gui/painting/qpen/tst_qpen.cpp @@ -57,6 +57,8 @@ public: private slots: void getSetCheck(); void swap(); + void move(); + void move_assign(); void operator_eq_eq(); void operator_eq_eq_data(); @@ -101,6 +103,57 @@ void tst_QPen::swap() QCOMPARE(p2.color(), QColor(Qt::black)); } +void tst_QPen::move() +{ + QPen p1(Qt::black); + + // check that moving does the right thing: + QPen p2 = qMove(p1); // could be move or copy construction, so don't check p1's state + QCOMPARE(p2.color(), QColor(Qt::black)); + + // this, executed ehre, would crash: + // QVERIFY(p1.style() != Qt::NoPen); + + // check that moved-from QPen p1 can still be safely copied: + const QPen p3 = p1; + + // check that moved-from QPen p1 can still be safely assigned to: + const QPen p4(Qt::yellow); + p1 = p4; + QCOMPARE(p1.color(), QColor(Qt::yellow)); + + // check that moved-from QPens p2, p3 can still be safely destroyed: + QPen p5 = qMove(p2); + + // intentionally no more statements beyond this point +} + +void tst_QPen::move_assign() +{ + QPen p1(Qt::black), p2(Qt::white); + + // check that moving does the right thing: + p2 = qMove(p1); // could be move or copy assignment, so don't check p1's state + QCOMPARE(p2.color(), QColor(Qt::black)); + + // check that move-assigned-from QPen p1 can still be used, albeit + // with undocumented state (it's p2's original state): + QVERIFY(p1.style() != Qt::NoPen); + + // check that moved-from QPen p1 can still be safely copied: + const QPen p3 = p1; + + // check that moved-from QPen p1 can still be safely assigned to: + const QPen p4(Qt::yellow); + p1 = p4; + QCOMPARE(p1.color(), QColor(Qt::yellow)); + + // check that moved-from QPens p2, p3 can still be safely destroyed: + QPen p5; + p5 = qMove(p2); + + // intentionally no more statements beyond this point +} tst_QPen::tst_QPen() diff --git a/tests/auto/gui/qopengl/qopengl.pro b/tests/auto/gui/qopengl/qopengl.pro index 12429bbeed..fcf457fec4 100644 --- a/tests/auto/gui/qopengl/qopengl.pro +++ b/tests/auto/gui/qopengl/qopengl.pro @@ -10,3 +10,5 @@ QT += gui-private core-private testlib SOURCES += tst_qopengl.cpp win32-msvc2010:contains(QT_CONFIG, angle):CONFIG += insignificant_test # QTBUG-31611 + +linux:contains(QT_CONFIG, xcb-glx):contains(QT_CONFIG, xcb-xlib): DEFINES += USE_GLX diff --git a/tests/auto/gui/qopengl/tst_qopengl.cpp b/tests/auto/gui/qopengl/tst_qopengl.cpp index 63fe8b9693..c32edd3f71 100644 --- a/tests/auto/gui/qopengl/tst_qopengl.cpp +++ b/tests/auto/gui/qopengl/tst_qopengl.cpp @@ -51,12 +51,19 @@ #include <QtGui/QGenericMatrix> #include <QtGui/QMatrix4x4> #include <QtGui/private/qopengltextureblitter_p.h> - +#include <QtGui/private/qguiapplication_p.h> +#include <qpa/qplatformintegration.h> +#include <qpa/qplatformnativeinterface.h> #include <QtTest/QtTest> #include <QSignalSpy> +#ifdef USE_GLX +// Must be included last due to the X11 types +#include <QtPlatformHeaders/QGLXNativeContext> +#endif + class tst_QOpenGL : public QObject { Q_OBJECT @@ -85,6 +92,10 @@ private slots: void textureblitterPartOriginTopLeftSourceRectTransform(); void textureblitterFullTargetRectTransform(); void textureblitterPartTargetRectTransform(); + +#ifdef USE_GLX + void glxContextWrap(); +#endif }; struct SharedResourceTracker @@ -448,9 +459,9 @@ void tst_QOpenGL::fboSimpleRendering() QVERIFY(fbo->bind()); - glClearColor(1.0, 0.0, 0.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - glFinish(); + ctx.functions()->glClearColor(1.0, 0.0, 0.0, 1.0); + ctx.functions()->glClear(GL_COLOR_BUFFER_BIT); + ctx.functions()->glFinish(); const QImage fb = fbo->toImage().convertToFormat(QImage::Format_RGB32); QCOMPARE(fb.size(), size); @@ -494,9 +505,9 @@ void tst_QOpenGL::fboTextureOwnership() fbo->bind(); QVERIFY(fbo->texture() != 0 && fbo->texture() != texture); - glClearColor(1.0, 0.0, 0.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - glFinish(); + ctx.functions()->glClearColor(1.0, 0.0, 0.0, 1.0); + ctx.functions()->glClear(GL_COLOR_BUFFER_BIT); + ctx.functions()->glFinish(); QImage fb = fbo->toImage().convertToFormat(QImage::Format_RGB32); QImage reference(fb.size(), QImage::Format_RGB32); @@ -504,7 +515,7 @@ void tst_QOpenGL::fboTextureOwnership() QFUZZY_COMPARE_IMAGES(fb, reference); - glDeleteTextures(1, &texture); + ctx.functions()->glDeleteTextures(1, &texture); delete fbo; } @@ -970,6 +981,45 @@ void tst_QOpenGL::textureblitterPartTargetRectTransform() QCOMPARE(targetBottomRight, expectedBottomRight); } +#ifdef USE_GLX +void tst_QOpenGL::glxContextWrap() +{ + QWindow *window = new QWindow; + window->setSurfaceType(QWindow::OpenGLSurface); + window->setGeometry(0, 0, 10, 10); + window->show(); + QTest::qWaitForWindowExposed(window); + + QPlatformNativeInterface *nativeIf = QGuiApplicationPrivate::instance()->platformIntegration()->nativeInterface(); + QVERIFY(nativeIf); + + // Fetch a GLXContext. + QOpenGLContext *ctx0 = new QOpenGLContext; + ctx0->setFormat(window->format()); + QVERIFY(ctx0->create()); + QVariant v = ctx0->nativeHandle(); + QVERIFY(!v.isNull()); + QVERIFY(v.canConvert<QGLXNativeContext>()); + GLXContext context = v.value<QGLXNativeContext>().context(); + QVERIFY(context); + + // Then create another QOpenGLContext wrapping it. + QOpenGLContext *ctx = new QOpenGLContext; + ctx->setNativeHandle(QVariant::fromValue<QGLXNativeContext>(QGLXNativeContext(context))); + QVERIFY(ctx->create()); + QVERIFY(ctx->nativeHandle().value<QGLXNativeContext>().context() == context); + QVERIFY(nativeIf->nativeResourceForContext(QByteArrayLiteral("glxcontext"), ctx) == (void *) context); + + QVERIFY(ctx->makeCurrent(window)); + ctx->doneCurrent(); + + delete ctx; + delete ctx0; + + delete window; +} +#endif // USE_GLX + QTEST_MAIN(tst_QOpenGL) #include "tst_qopengl.moc" diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp index 4c88212c72..6f75a1f8bb 100644 --- a/tests/auto/gui/text/qfont/tst_qfont.cpp +++ b/tests/auto/gui/text/qfont/tst_qfont.cpp @@ -76,7 +76,8 @@ private slots: void isCopyOf(); void italicOblique(); void insertAndRemoveSubstitutions(); - void serializeSpacing(); + void serialize_data(); + void serialize(); void lastResortFont(); void styleName(); void defaultFamily_data(); @@ -534,7 +535,6 @@ void tst_QFont::insertAndRemoveSubstitutions() QVERIFY(QFont::substitutes("bogusfontfamily").isEmpty()); } - static QFont copyFont(const QFont &font1) // copy using a QDataStream { QBuffer buffer; @@ -549,29 +549,115 @@ static QFont copyFont(const QFont &font1) // copy using a QDataStream return font2; } -void tst_QFont::serializeSpacing() +Q_DECLARE_METATYPE(QDataStream::Version) + +void tst_QFont::serialize_data() { - QFont font; - QCOMPARE(font.letterSpacing(), 0.); - QCOMPARE(font.wordSpacing(), 0.); + QTest::addColumn<QFont>("font"); + // The version in which the tested feature was added. + QTest::addColumn<QDataStream::Version>("minimumStreamVersion"); + + QFont basicFont; + // Versions <= Qt 2.1 had broken point size serialization, + // so we set an integer point size. + basicFont.setPointSize(9); + + QFont font = basicFont; + QTest::newRow("defaultConstructed") << font << QDataStream::Qt_1_0; font.setLetterSpacing(QFont::AbsoluteSpacing, 105); - QCOMPARE(font.letterSpacing(), 105.); - QCOMPARE(font.letterSpacingType(), QFont::AbsoluteSpacing); - QCOMPARE(font.wordSpacing(), 0.); - QFont font2 = copyFont(font); - QCOMPARE(font2.letterSpacing(), 105.); - QCOMPARE(font2.letterSpacingType(), QFont::AbsoluteSpacing); - QCOMPARE(font2.wordSpacing(), 0.); + QTest::newRow("letterSpacing") << font << QDataStream::Qt_4_5; + font = basicFont; font.setWordSpacing(50.0); - QCOMPARE(font.letterSpacing(), 105.); - QCOMPARE(font.wordSpacing(), 50.); + QTest::newRow("wordSpacing") << font << QDataStream::Qt_4_5; + + font = basicFont; + font.setPointSize(20); + QTest::newRow("pointSize") << font << QDataStream::Qt_1_0; + + font = basicFont; + font.setPixelSize(32); + QTest::newRow("pixelSize") << font << QDataStream::Qt_3_0; + + font = basicFont; + font.setStyleHint(QFont::Monospace); + QTest::newRow("styleHint") << font << QDataStream::Qt_1_0; + + font = basicFont; + font.setStretch(4000); + QTest::newRow("stretch") << font << QDataStream::Qt_4_3; + + font = basicFont; + font.setWeight(99); + QTest::newRow("weight") << font << QDataStream::Qt_1_0; + + font = basicFont; + font.setUnderline(true); + QTest::newRow("underline") << font << QDataStream::Qt_1_0; + + font = basicFont; + font.setStrikeOut(true); + QTest::newRow("strikeOut") << font << QDataStream::Qt_1_0; + + font = basicFont; + font.setFixedPitch(true); + // This fails for versions less than this, as ignorePitch is set to false + // whenever setFixedPitch() is called, but ignorePitch is considered an + // extended bit, which were apparently not available until 4.4. + QTest::newRow("fixedPitch") << font << QDataStream::Qt_4_4; + + font = basicFont; + font.setLetterSpacing(QFont::AbsoluteSpacing, 10); + // Fails for 4.4 because letterSpacing wasn't read until 4.5. + QTest::newRow("letterSpacing") << font << QDataStream::Qt_4_5; + + font = basicFont; + font.setRawMode(true); + QTest::newRow("rawMode") << font << QDataStream::Qt_1_0; + + font = basicFont; + font.setKerning(false); + QTest::newRow("kerning") << font << QDataStream::Qt_4_0; + + font = basicFont; + font.setStyleStrategy(QFont::NoFontMerging); + // This wasn't read properly until 5.4. + QTest::newRow("styleStrategy") << font << QDataStream::Qt_5_4; + + font = basicFont; + font.setHintingPreference(QFont::PreferFullHinting); + // This wasn't read until 5.4. + QTest::newRow("hintingPreference") << font << QDataStream::Qt_5_4; + + font = basicFont; + font.setStyleName("Regular Black Condensed"); + // This wasn't read until 5.4. + QTest::newRow("styleName") << font << QDataStream::Qt_5_4; +} - QFont font3 = copyFont(font); - QCOMPARE(font3.letterSpacing(), 105.); - QCOMPARE(font3.letterSpacingType(), QFont::AbsoluteSpacing); - QCOMPARE(font3.wordSpacing(), 50.); +void tst_QFont::serialize() +{ + QFETCH(QFont, font); + QFETCH(QDataStream::Version, minimumStreamVersion); + + QDataStream stream; + const int thisVersion = stream.version(); + + for (int version = minimumStreamVersion; version <= thisVersion; ++version) { + QBuffer buffer; + buffer.open(QIODevice::WriteOnly); + stream.setDevice(&buffer); + stream.setVersion(version); + stream << font; + buffer.close(); + + buffer.open(QIODevice::ReadOnly); + QFont readFont; + stream >> readFont; + QVERIFY2(readFont == font, qPrintable(QString::fromLatin1("Fonts do not compare equal for QDataStream version ") + + QString::fromLatin1("%1:\nactual: %2\nexpected: %3").arg(version).arg(readFont.toString()).arg(font.toString()))); + } } // QFont::lastResortFont() may abort with qFatal() on QWS/QPA diff --git a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp index ae6e450301..08c7148342 100644 --- a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp +++ b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp @@ -312,16 +312,24 @@ void tst_QRawFont::advances() bool supportsSubPixelPositions = font_d->fontEngine->supportsSubPixelPositions(); QVector<QPointF> advances = font.advancesForGlyphIndexes(glyphIndices); - for (int i=0; i<glyphIndices.size(); ++i) { -#ifdef Q_OS_WIN - // In Windows, freetype engine returns advance of 9 when full hinting is used (default) for - // some of the glyphs. - if (font_d->fontEngine->type() == QFontEngine::Freetype - && (hintingPreference == QFont::PreferFullHinting || hintingPreference == QFont::PreferDefaultHinting) - && (i == 0 || i == 5)) { - QEXPECT_FAIL("", "Advance for some glyphs is not the expected with Windows Freetype engine (9 instead of 8)", Continue); - } + + // On Windows and QNX, freetype engine returns advance of 9 for some of the glyphs + // when full hinting is used (default on Windows). + bool mayFail = false; +#if defined (Q_OS_WIN) + mayFail = font_d->fontEngine->type() == QFontEngine::Freetype + && (hintingPreference == QFont::PreferFullHinting + || hintingPreference == QFont::PreferDefaultHinting); +#elif defined(Q_OS_QNX) + mayFail = font_d->fontEngine->type() == QFontEngine::Freetype + && hintingPreference == QFont::PreferFullHinting; #endif + + for (int i = 0; i < glyphIndices.size(); ++i) { + if (mayFail && (i == 0 || i == 5)) { + QEXPECT_FAIL("", "FreeType engine reports unexpected advance " + "for some glyphs (9 instead of 8)", Continue); + } QVERIFY(qFuzzyCompare(qRound(advances.at(i).x()), 8.0)); if (supportsSubPixelPositions) QVERIFY(advances.at(i).x() > 8.0); @@ -339,16 +347,11 @@ void tst_QRawFont::advances() QVERIFY(font.advancesForGlyphIndexes(glyphIndices.constData(), advances.data(), numGlyphs)); - for (int i=0; i<glyphIndices.size(); ++i) { -#ifdef Q_OS_WIN - // In Windows, freetype engine returns advance of 9 when full hinting is used (default) for - // some of the glyphs. - if (font_d->fontEngine->type() == QFontEngine::Freetype - && (hintingPreference == QFont::PreferFullHinting || hintingPreference == QFont::PreferDefaultHinting) - && (i == 0 || i == 5)) { - QEXPECT_FAIL("", "Advance for some glyphs is not the expected with Windows Freetype engine (9 instead of 8)", Continue); + for (int i = 0; i < glyphIndices.size(); ++i) { + if (mayFail && (i == 0 || i == 5)) { + QEXPECT_FAIL("", "FreeType engine reports unexpected advance " + "for some glyphs (9 instead of 8)", Continue); } -#endif QVERIFY(qFuzzyCompare(qRound(advances.at(i).x()), 8.0)); if (supportsSubPixelPositions) QVERIFY(advances.at(i).x() > 8.0); diff --git a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp index 74c3f7833b..e3151ba862 100644 --- a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp @@ -104,6 +104,7 @@ private slots: void largeSerialNumber(); void largeExpirationDate(); void blacklistedCertificates(); + void selfsignedCertificates(); void toText(); void multipleCommonNames(); void subjectAndIssuerAttributes(); @@ -846,6 +847,13 @@ void tst_QSslCertificate::blacklistedCertificates() } } +void tst_QSslCertificate::selfsignedCertificates() +{ + QVERIFY(QSslCertificate::fromPath(testDataDir + "/certificates/cert-ss.pem").first().isSelfSigned()); + QVERIFY(!QSslCertificate::fromPath(testDataDir + "/certificates/cert.pem").first().isSelfSigned()); + QVERIFY(!QSslCertificate().isSelfSigned()); +} + void tst_QSslCertificate::toText() { QList<QSslCertificate> certList = diff --git a/tests/auto/opengl/qgl/tst_qgl.cpp b/tests/auto/opengl/qgl/tst_qgl.cpp index ba2528d3cf..71243339aa 100644 --- a/tests/auto/opengl/qgl/tst_qgl.cpp +++ b/tests/auto/opengl/qgl/tst_qgl.cpp @@ -1090,9 +1090,10 @@ void tst_QGL::glFBOSimpleRendering() fbo->bind(); - glClearColor(1.0, 0.0, 0.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - glFinish(); + QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions(); + funcs->glClearColor(1.0, 0.0, 0.0, 1.0); + funcs->glClear(GL_COLOR_BUFFER_BIT); + funcs->glFinish(); QImage fb = fbo->toImage().convertToFormat(QImage::Format_RGB32); QImage reference(fb.size(), QImage::Format_RGB32); @@ -1390,11 +1391,11 @@ class RenderPixmapWidget : public QGLWidget protected: void initializeGL() { // Set some gl state: - glClearColor(1.0, 0.0, 0.0, 1.0); + QOpenGLContext::currentContext()->functions()->glClearColor(1.0, 0.0, 0.0, 1.0); } void paintGL() { - glClear(GL_COLOR_BUFFER_BIT); + QOpenGLContext::currentContext()->functions()->glClear(GL_COLOR_BUFFER_BIT); } }; @@ -1683,11 +1684,12 @@ protected: void paintEvent(QPaintEvent*) { // clear the stencil with junk - glStencilMask(0xFFFF); - glClearStencil(0xFFFF); - glDisable(GL_STENCIL_TEST); - glDisable(GL_SCISSOR_TEST); - glClear(GL_STENCIL_BUFFER_BIT); + QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions(); + funcs->glStencilMask(0xFFFF); + funcs->glClearStencil(0xFFFF); + funcs->glDisable(GL_STENCIL_TEST); + funcs->glDisable(GL_SCISSOR_TEST); + funcs->glClear(GL_STENCIL_BUFFER_BIT); QPainter painter(this); paint(&painter); @@ -2029,26 +2031,27 @@ void tst_QGL::qglContextDefaultBindTexture() QVERIFY(QImagePixmapCleanupHooks::isImageCached(*boundImage)); QVERIFY(QImagePixmapCleanupHooks::isPixmapCached(*boundPixmap)); + QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions(); // Make sure the texture IDs returned are valid: - QCOMPARE((bool)glIsTexture(boundImageTextureId), GL_TRUE); - QCOMPARE((bool)glIsTexture(boundPixmapTextureId), GL_TRUE); + QCOMPARE((bool)funcs->glIsTexture(boundImageTextureId), GL_TRUE); + QCOMPARE((bool)funcs->glIsTexture(boundPixmapTextureId), GL_TRUE); // Make sure the textures are still valid after we delete the image/pixmap: // Also check that although the textures are left intact, the cache entries are removed: delete boundImage; boundImage = 0; - QCOMPARE((bool)glIsTexture(boundImageTextureId), GL_TRUE); + QCOMPARE((bool)funcs->glIsTexture(boundImageTextureId), GL_TRUE); QCOMPARE(QGLTextureCache::instance()->size(), startCacheItemCount+1); delete boundPixmap; boundPixmap = 0; - QCOMPARE((bool)glIsTexture(boundPixmapTextureId), GL_TRUE); + QCOMPARE((bool)funcs->glIsTexture(boundPixmapTextureId), GL_TRUE); QCOMPARE(QGLTextureCache::instance()->size(), startCacheItemCount); // Finally, make sure QGLContext::deleteTexture deletes the texture IDs: ctx->deleteTexture(boundImageTextureId); ctx->deleteTexture(boundPixmapTextureId); - QCOMPARE((bool)glIsTexture(boundImageTextureId), GL_FALSE); - QCOMPARE((bool)glIsTexture(boundPixmapTextureId), GL_FALSE); + QCOMPARE((bool)funcs->glIsTexture(boundImageTextureId), GL_FALSE); + QCOMPARE((bool)funcs->glIsTexture(boundPixmapTextureId), GL_FALSE); } #endif diff --git a/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp b/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp index 2f09d84772..a465afef21 100644 --- a/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp +++ b/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp @@ -62,7 +62,7 @@ bool tst_QGLFunctions::hasExtension(const char *name) { QString extensions = QString::fromLatin1 - (reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS))); + (reinterpret_cast<const char *>(QOpenGLContext::currentContext()->functions()->glGetString(GL_EXTENSIONS))); return extensions.split(QLatin1Char(' ')).contains (QString::fromLatin1(name)); } @@ -194,46 +194,46 @@ void tst_QGLFunctions::features() // Verify that the multitexture functions appear to resolve and work. void tst_QGLFunctions::multitexture() { - QGLFunctions funcs; + QOpenGLFunctions funcs; QGLWidget glw; if (!glw.isValid()) QSKIP("Could not create a GL context"); glw.makeCurrent(); - funcs.initializeGLFunctions(); + funcs.initializeOpenGLFunctions(); - if (!funcs.hasOpenGLFeature(QGLFunctions::Multitexture)) + if (!funcs.hasOpenGLFeature(QOpenGLFunctions::Multitexture)) QSKIP("Multitexture functions are not supported"); funcs.glActiveTexture(GL_TEXTURE1); GLint active = 0; - glGetIntegerv(GL_ACTIVE_TEXTURE, &active); + funcs.glGetIntegerv(GL_ACTIVE_TEXTURE, &active); QVERIFY(active == GL_TEXTURE1); funcs.glActiveTexture(GL_TEXTURE0); active = 0; - glGetIntegerv(GL_ACTIVE_TEXTURE, &active); + funcs.glGetIntegerv(GL_ACTIVE_TEXTURE, &active); QVERIFY(active == GL_TEXTURE0); } // Verify that the glBlendColor() function appears to resolve and work. void tst_QGLFunctions::blendColor() { - QGLFunctions funcs; + QOpenGLFunctions funcs; QGLWidget glw; if (!glw.isValid()) QSKIP("Could not create a GL context"); glw.makeCurrent(); - funcs.initializeGLFunctions(); + funcs.initializeOpenGLFunctions(); - if (!funcs.hasOpenGLFeature(QGLFunctions::BlendColor)) + if (!funcs.hasOpenGLFeature(QOpenGLFunctions::BlendColor)) QSKIP("glBlendColor() is not supported"); funcs.glBlendColor(0.0f, 1.0f, 0.0f, 1.0f); GLfloat colors[4] = {0.5f, 0.5f, 0.5f, 0.5f}; - glGetFloatv(GL_BLEND_COLOR, colors); + funcs.glGetFloatv(GL_BLEND_COLOR, colors); QCOMPARE(colors[0], 0.0f); QCOMPARE(colors[1], 1.0f); diff --git a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp index 70e3a3b62a..25057ba2a0 100644 --- a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp +++ b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp @@ -48,6 +48,10 @@ #include <QtOpenGL/QtOpenGL> #include "tst_qglthreads.h" +#ifndef QT_OPENGL_ES_2 +#include <QtGui/QOpenGLFunctions_1_0> +#endif + #define RUNNING_TIME 5000 tst_QGLThreads::tst_QGLThreads(QObject *parent) @@ -339,8 +343,9 @@ static inline float qrandom() { return (rand() % 100) / 100.f; } void renderAScene(int w, int h) { + QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions(); + if (QOpenGLContext::currentContext()->isOpenGLES()) { - QGLFunctions funcs(QGLContext::currentContext()); Q_UNUSED(w); Q_UNUSED(h); QGLShaderProgram program; @@ -349,7 +354,7 @@ void renderAScene(int w, int h) program.bindAttributeLocation("pos", 0); program.bind(); - funcs.glEnableVertexAttribArray(0); + funcs->glEnableVertexAttribArray(0); for (int i=0; i<1000; ++i) { GLfloat pos[] = { @@ -361,30 +366,33 @@ void renderAScene(int w, int h) (rand() % 100) / 100.f }; - funcs.glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, pos); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); + funcs->glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, pos); + funcs->glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); } } else { #ifndef QT_OPENGL_ES_2 - glViewport(0, 0, w, h); + QOpenGLFunctions_1_0 *gl1funcs = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_1_0>(); + gl1funcs->initializeOpenGLFunctions(); + + gl1funcs->glViewport(0, 0, w, h); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(0, w, h, 0, 1, 100); - glTranslated(0, 0, -1); + gl1funcs->glMatrixMode(GL_PROJECTION); + gl1funcs->glLoadIdentity(); + gl1funcs->glFrustum(0, w, h, 0, 1, 100); + gl1funcs->glTranslated(0, 0, -1); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); + gl1funcs->glMatrixMode(GL_MODELVIEW); + gl1funcs->glLoadIdentity(); for (int i=0;i<1000; ++i) { - glBegin(GL_TRIANGLES); - glColor3f(qrandom(), qrandom(), qrandom()); - glVertex2f(qrandom() * w, qrandom() * h); - glColor3f(qrandom(), qrandom(), qrandom()); - glVertex2f(qrandom() * w, qrandom() * h); - glColor3f(qrandom(), qrandom(), qrandom()); - glVertex2f(qrandom() * w, qrandom() * h); - glEnd(); + gl1funcs->glBegin(GL_TRIANGLES); + gl1funcs->glColor3f(qrandom(), qrandom(), qrandom()); + gl1funcs->glVertex2f(qrandom() * w, qrandom() * h); + gl1funcs->glColor3f(qrandom(), qrandom(), qrandom()); + gl1funcs->glVertex2f(qrandom() * w, qrandom() * h); + gl1funcs->glColor3f(qrandom(), qrandom(), qrandom()); + gl1funcs->glVertex2f(qrandom() * w, qrandom() * h); + gl1funcs->glEnd(); } #endif } @@ -434,8 +442,9 @@ public: QSize s = m_widget->newSize; m_widget->mutex.unlock(); + QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions(); if (s != m_size) { - glViewport(0, 0, s.width(), s.height()); + funcs->glViewport(0, 0, s.width(), s.height()); } if (QGLContext::currentContext() != m_widget->context()) { @@ -443,7 +452,7 @@ public: break; } - glClear(GL_COLOR_BUFFER_BIT); + funcs->glClear(GL_COLOR_BUFFER_BIT); int w = m_widget->width(); int h = m_widget->height(); @@ -451,7 +460,7 @@ public: renderAScene(w, h); int color; - glReadPixels(w / 2, h / 2, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &color); + funcs->glReadPixels(w / 2, h / 2, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &color); m_widget->swapBuffers(); } diff --git a/tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp b/tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp index 47d6789327..40e1070fcc 100644 --- a/tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp +++ b/tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp @@ -65,6 +65,19 @@ private slots: void wait_signalEmittedLater(); void wait_signalEmittedTooLate(); void wait_signalEmittedMultipleTimes(); + + void spyFunctionPointerWithoutArgs(); + void spyFunctionPointerWithBasicArgs(); + void spyFunctionPointerWithPointers(); + void spyFunctionPointerWithQtClasses(); + void spyFunctionPointerWithBasicQtClasses(); + void spyFunctionPointerWithQtTypedefs(); + + void waitFunctionPointer_signalEmitted(); + void waitFunctionPointer_timeout(); + void waitFunctionPointer_signalEmittedLater(); + void waitFunctionPointer_signalEmittedTooLate(); + void waitFunctionPointer_signalEmittedMultipleTimes(); }; class QtTestObject: public QObject @@ -278,5 +291,160 @@ void tst_QSignalSpy::wait_signalEmittedMultipleTimes() QCOMPARE(spy.count(), 3); } +void tst_QSignalSpy::spyFunctionPointerWithoutArgs() +{ + QtTestObject obj; + + QSignalSpy spy(&obj, &QtTestObject::sig0); + QCOMPARE(spy.count(), 0); + + emit obj.sig0(); + QCOMPARE(spy.count(), 1); + emit obj.sig0(); + QCOMPARE(spy.count(), 2); + + QList<QVariant> args = spy.takeFirst(); + QCOMPARE(args.count(), 0); +} + +void tst_QSignalSpy::spyFunctionPointerWithBasicArgs() +{ + QtTestObject obj; + QSignalSpy spy(&obj, &QtTestObject::sig1); + + emit obj.sig1(1, 2); + QCOMPARE(spy.count(), 1); + + QList<QVariant> args = spy.takeFirst(); + QCOMPARE(args.count(), 2); + QCOMPARE(args.at(0).toInt(), 1); + QCOMPARE(args.at(1).toInt(), 2); + + QSignalSpy spyl(&obj, &QtTestObject::sigLong); + + emit obj.sigLong(1l, 2l); + args = spyl.takeFirst(); + QCOMPARE(args.count(), 2); + QCOMPARE(qvariant_cast<long>(args.at(0)), 1l); + QCOMPARE(qvariant_cast<long>(args.at(1)), 2l); +} + + +void tst_QSignalSpy::spyFunctionPointerWithPointers() +{ + qRegisterMetaType<int *>("int*"); + + QtTestObject obj; + QSignalSpy spy(&obj, &QtTestObject::sig2); + + int i1 = 1; + int i2 = 2; + + emit obj.sig2(&i1, &i2); + QCOMPARE(spy.count(), 1); + + QList<QVariant> args = spy.takeFirst(); + QCOMPARE(args.count(), 2); + QCOMPARE(*static_cast<int * const *>(args.at(0).constData()), &i1); + QCOMPARE(*static_cast<int * const *>(args.at(1).constData()), &i2); +} + +void tst_QSignalSpy::spyFunctionPointerWithBasicQtClasses() +{ + QtTestObject2 obj; + + QSignalSpy spy(&obj, &QtTestObject2::sig); + emit obj.sig(QString("bubu")); + QCOMPARE(spy.count(), 1); + QCOMPARE(spy.at(0).count(), 1); + QCOMPARE(spy.at(0).at(0).toString(), QString("bubu")); + + QSignalSpy spy2(&obj, &QtTestObject2::sig5); + QVariant val(45); + emit obj.sig5(val); + QCOMPARE(spy2.count(), 1); + QCOMPARE(spy2.at(0).count(), 1); + QCOMPARE(spy2.at(0).at(0), val); + QCOMPARE(qvariant_cast<QVariant>(spy2.at(0).at(0)), val); +} + +void tst_QSignalSpy::spyFunctionPointerWithQtClasses() +{ + QtTestObject2 obj; + + QSignalSpy spy(&obj, &QtTestObject2::sig2); + QDateTime dt = QDateTime::currentDateTime(); + emit obj.sig2(dt); + QCOMPARE(spy.count(), 1); + QCOMPARE(spy.at(0).count(), 1); + QCOMPARE(spy.at(0).at(0).typeName(), "QDateTime"); + QCOMPARE(*static_cast<const QDateTime *>(spy.at(0).at(0).constData()), dt); + QCOMPARE(spy.at(0).at(0).toDateTime(), dt); + + QSignalSpy spy2(&obj, &QtTestObject2::sig3); + emit obj.sig3(this); + QCOMPARE(*static_cast<QObject * const *>(spy2.value(0).value(0).constData()), + (QObject *)this); + QCOMPARE(qvariant_cast<QObject *>(spy2.value(0).value(0)), (QObject*)this); + + QSignalSpy spy3(&obj, &QtTestObject2::sig4); + emit obj.sig4(QChar('A')); + QCOMPARE(qvariant_cast<QChar>(spy3.value(0).value(0)), QChar('A')); +} + +void tst_QSignalSpy::spyFunctionPointerWithQtTypedefs() +{ + QtTestObject3 obj; + + QSignalSpy spy2(&obj, &QtTestObject3::sig2); + emit obj.sig2(42, 43); + QCOMPARE(spy2.value(0).value(0).toInt(), 42); + QCOMPARE(spy2.value(0).value(1).toInt(), 43); +} + +void tst_QSignalSpy::waitFunctionPointer_signalEmitted() +{ + QTimer::singleShot(0, this, SIGNAL(sigFoo())); + QSignalSpy spy(this, &tst_QSignalSpy::sigFoo); + QVERIFY(spy.wait(1)); +} + +void tst_QSignalSpy::waitFunctionPointer_timeout() +{ + QSignalSpy spy(this, &tst_QSignalSpy::sigFoo); + QVERIFY(!spy.wait(1)); +} + +void tst_QSignalSpy::waitFunctionPointer_signalEmittedLater() +{ + QTimer::singleShot(500, this, SIGNAL(sigFoo())); + QSignalSpy spy(this, &tst_QSignalSpy::sigFoo); + QVERIFY(spy.wait(1000)); +} + +void tst_QSignalSpy::waitFunctionPointer_signalEmittedTooLate() +{ + QTimer::singleShot(500, this, SIGNAL(sigFoo())); + QSignalSpy spy(this, &tst_QSignalSpy::sigFoo); + QVERIFY(!spy.wait(200)); + QTest::qWait(400); + QCOMPARE(spy.count(), 1); +} + +void tst_QSignalSpy::waitFunctionPointer_signalEmittedMultipleTimes() +{ + QTimer::singleShot(100, this, SIGNAL(sigFoo())); + QTimer::singleShot(800, this, SIGNAL(sigFoo())); + QSignalSpy spy(this, &tst_QSignalSpy::sigFoo); + QVERIFY(spy.wait()); + QCOMPARE(spy.count(), 1); // we don't wait for the second signal... + QVERIFY(spy.wait()); + QCOMPARE(spy.count(), 2); + QVERIFY(!spy.wait(1)); + QTimer::singleShot(10, this, SIGNAL(sigFoo())); + QVERIFY(spy.wait()); + QCOMPARE(spy.count(), 3); +} + QTEST_MAIN(tst_QSignalSpy) #include "tst_qsignalspy.moc" diff --git a/tests/auto/testlib/selftests/expected_assert.lightxml b/tests/auto/testlib/selftests/expected_assert.lightxml index d2d4ae5153..b40ff41da3 100644 --- a/tests/auto/testlib/selftests/expected_assert.lightxml +++ b/tests/auto/testlib/selftests/expected_assert.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_assert.xml b/tests/auto/testlib/selftests/expected_assert.xml index 9e5ea760ae..9770b3cd57 100644 --- a/tests/auto/testlib/selftests/expected_assert.xml +++ b/tests/auto/testlib/selftests/expected_assert.xml @@ -2,6 +2,7 @@ <TestCase name="tst_Assert"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_assert.xunitxml b/tests/auto/testlib/selftests/expected_assert.xunitxml index 0aebe72745..96daa33dcf 100644 --- a/tests/auto/testlib/selftests/expected_assert.xunitxml +++ b/tests/auto/testlib/selftests/expected_assert.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase result="pass" name="testNumber1"/> diff --git a/tests/auto/testlib/selftests/expected_badxml.lightxml b/tests/auto/testlib/selftests/expected_badxml.lightxml index e4c79e3bb0..94f479a79a 100644 --- a/tests/auto/testlib/selftests/expected_badxml.lightxml +++ b/tests/auto/testlib/selftests/expected_badxml.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_badxml.xml b/tests/auto/testlib/selftests/expected_badxml.xml index 0811db0f3a..c1266bfeed 100644 --- a/tests/auto/testlib/selftests/expected_badxml.xml +++ b/tests/auto/testlib/selftests/expected_badxml.xml @@ -2,6 +2,7 @@ <TestCase name="tst_BadXml"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_badxml.xunitxml b/tests/auto/testlib/selftests/expected_badxml.xunitxml index a696da58c9..49048fdad6 100644 --- a/tests/auto/testlib/selftests/expected_badxml.xunitxml +++ b/tests/auto/testlib/selftests/expected_badxml.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase result="fail" name="badDataTag"> diff --git a/tests/auto/testlib/selftests/expected_benchlibcounting.lightxml b/tests/auto/testlib/selftests/expected_benchlibcounting.lightxml index 08872be733..6fe511462c 100644 --- a/tests/auto/testlib/selftests/expected_benchlibcounting.lightxml +++ b/tests/auto/testlib/selftests/expected_benchlibcounting.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_benchlibcounting.xml b/tests/auto/testlib/selftests/expected_benchlibcounting.xml index ee6fd98ef2..d945511eec 100644 --- a/tests/auto/testlib/selftests/expected_benchlibcounting.xml +++ b/tests/auto/testlib/selftests/expected_benchlibcounting.xml @@ -2,6 +2,7 @@ <TestCase name="tst_BenchlibCounting"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_benchlibcounting.xunitxml b/tests/auto/testlib/selftests/expected_benchlibcounting.xunitxml index 83e429aa3a..05d1da9874 100644 --- a/tests/auto/testlib/selftests/expected_benchlibcounting.xunitxml +++ b/tests/auto/testlib/selftests/expected_benchlibcounting.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase result="pass" name="passingBenchmark"> diff --git a/tests/auto/testlib/selftests/expected_benchlibeventcounter.lightxml b/tests/auto/testlib/selftests/expected_benchlibeventcounter.lightxml index cba91a374f..0bc00569e9 100644 --- a/tests/auto/testlib/selftests/expected_benchlibeventcounter.lightxml +++ b/tests/auto/testlib/selftests/expected_benchlibeventcounter.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_benchlibeventcounter.xml b/tests/auto/testlib/selftests/expected_benchlibeventcounter.xml index 7d28975ead..f543e2775c 100644 --- a/tests/auto/testlib/selftests/expected_benchlibeventcounter.xml +++ b/tests/auto/testlib/selftests/expected_benchlibeventcounter.xml @@ -2,6 +2,7 @@ <TestCase name="tst_BenchlibEventCounter"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_benchlibeventcounter.xunitxml b/tests/auto/testlib/selftests/expected_benchlibeventcounter.xunitxml index 60dca28d4f..ce0a81110d 100644 --- a/tests/auto/testlib/selftests/expected_benchlibeventcounter.xunitxml +++ b/tests/auto/testlib/selftests/expected_benchlibeventcounter.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase result="pass" name="events"> diff --git a/tests/auto/testlib/selftests/expected_benchlibtickcounter.lightxml b/tests/auto/testlib/selftests/expected_benchlibtickcounter.lightxml index 97422240d9..11296ad9c2 100644 --- a/tests/auto/testlib/selftests/expected_benchlibtickcounter.lightxml +++ b/tests/auto/testlib/selftests/expected_benchlibtickcounter.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_benchlibtickcounter.xml b/tests/auto/testlib/selftests/expected_benchlibtickcounter.xml index 24c2e51084..3dd56b4af7 100644 --- a/tests/auto/testlib/selftests/expected_benchlibtickcounter.xml +++ b/tests/auto/testlib/selftests/expected_benchlibtickcounter.xml @@ -2,6 +2,7 @@ <TestCase name="tst_BenchlibTickCounter"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_benchlibtickcounter.xunitxml b/tests/auto/testlib/selftests/expected_benchlibtickcounter.xunitxml index 28c8f11143..779d3bdcbc 100644 --- a/tests/auto/testlib/selftests/expected_benchlibtickcounter.xunitxml +++ b/tests/auto/testlib/selftests/expected_benchlibtickcounter.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase result="pass" name="threeBillionTicks"> diff --git a/tests/auto/testlib/selftests/expected_benchlibwalltime.lightxml b/tests/auto/testlib/selftests/expected_benchlibwalltime.lightxml index b2e819b26d..c75a6c944d 100644 --- a/tests/auto/testlib/selftests/expected_benchlibwalltime.lightxml +++ b/tests/auto/testlib/selftests/expected_benchlibwalltime.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_benchlibwalltime.xml b/tests/auto/testlib/selftests/expected_benchlibwalltime.xml index 6ae355783a..a2f0edecc6 100644 --- a/tests/auto/testlib/selftests/expected_benchlibwalltime.xml +++ b/tests/auto/testlib/selftests/expected_benchlibwalltime.xml @@ -2,6 +2,7 @@ <TestCase name="tst_BenchlibWalltime"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_benchlibwalltime.xunitxml b/tests/auto/testlib/selftests/expected_benchlibwalltime.xunitxml index e4ffca4d09..6a0510c4c9 100644 --- a/tests/auto/testlib/selftests/expected_benchlibwalltime.xunitxml +++ b/tests/auto/testlib/selftests/expected_benchlibwalltime.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase result="pass" name="waitForOneThousand"> diff --git a/tests/auto/testlib/selftests/expected_cmptest.lightxml b/tests/auto/testlib/selftests/expected_cmptest.lightxml index 3a776ea7cb..4a376b5c8b 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.lightxml +++ b/tests/auto/testlib/selftests/expected_cmptest.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_cmptest.xml b/tests/auto/testlib/selftests/expected_cmptest.xml index 970544e4b6..aefb1b5f4c 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.xml +++ b/tests/auto/testlib/selftests/expected_cmptest.xml @@ -2,6 +2,7 @@ <TestCase name="tst_Cmptest"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_cmptest.xunitxml b/tests/auto/testlib/selftests/expected_cmptest.xunitxml index 7874c6c52e..7502d3cc54 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.xunitxml +++ b/tests/auto/testlib/selftests/expected_cmptest.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase result="pass" name="compare_boolfuncs"/> diff --git a/tests/auto/testlib/selftests/expected_commandlinedata.lightxml b/tests/auto/testlib/selftests/expected_commandlinedata.lightxml index c11017f022..894ae7ae23 100644 --- a/tests/auto/testlib/selftests/expected_commandlinedata.lightxml +++ b/tests/auto/testlib/selftests/expected_commandlinedata.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_commandlinedata.xml b/tests/auto/testlib/selftests/expected_commandlinedata.xml index 20dc0c6a7c..b2aa98f6a7 100644 --- a/tests/auto/testlib/selftests/expected_commandlinedata.xml +++ b/tests/auto/testlib/selftests/expected_commandlinedata.xml @@ -2,6 +2,7 @@ <TestCase name="tst_DataTable"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_commandlinedata.xunitxml b/tests/auto/testlib/selftests/expected_commandlinedata.xunitxml index 45b833cf19..5072a7e6f4 100644 --- a/tests/auto/testlib/selftests/expected_commandlinedata.xunitxml +++ b/tests/auto/testlib/selftests/expected_commandlinedata.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase result="pass" name="fiveTablePasses"> diff --git a/tests/auto/testlib/selftests/expected_counting.lightxml b/tests/auto/testlib/selftests/expected_counting.lightxml index e5fe1ee3cf..836c35fb85 100644 --- a/tests/auto/testlib/selftests/expected_counting.lightxml +++ b/tests/auto/testlib/selftests/expected_counting.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_counting.xml b/tests/auto/testlib/selftests/expected_counting.xml index e015dddcc6..892fd762c6 100644 --- a/tests/auto/testlib/selftests/expected_counting.xml +++ b/tests/auto/testlib/selftests/expected_counting.xml @@ -2,6 +2,7 @@ <TestCase name="tst_Counting"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_counting.xunitxml b/tests/auto/testlib/selftests/expected_counting.xunitxml index 72bf047ba8..cb3a7815af 100644 --- a/tests/auto/testlib/selftests/expected_counting.xunitxml +++ b/tests/auto/testlib/selftests/expected_counting.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase result="pass" name="testPassPass"/> diff --git a/tests/auto/testlib/selftests/expected_datatable.lightxml b/tests/auto/testlib/selftests/expected_datatable.lightxml index 6cc2d1c46f..c14a6a1940 100644 --- a/tests/auto/testlib/selftests/expected_datatable.lightxml +++ b/tests/auto/testlib/selftests/expected_datatable.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_datatable.xml b/tests/auto/testlib/selftests/expected_datatable.xml index 79963db0a4..297cb0d5de 100644 --- a/tests/auto/testlib/selftests/expected_datatable.xml +++ b/tests/auto/testlib/selftests/expected_datatable.xml @@ -2,6 +2,7 @@ <TestCase name="tst_DataTable"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_datatable.xunitxml b/tests/auto/testlib/selftests/expected_datatable.xunitxml index 6bac80e0a2..89fc7ee819 100644 --- a/tests/auto/testlib/selftests/expected_datatable.xunitxml +++ b/tests/auto/testlib/selftests/expected_datatable.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase result="pass" name="singleTestFunction1"/> diff --git a/tests/auto/testlib/selftests/expected_datetime.lightxml b/tests/auto/testlib/selftests/expected_datetime.lightxml index 02c60d04f9..48ad0933f7 100644 --- a/tests/auto/testlib/selftests/expected_datetime.lightxml +++ b/tests/auto/testlib/selftests/expected_datetime.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_datetime.xml b/tests/auto/testlib/selftests/expected_datetime.xml index 03aec4430e..30afde60ec 100644 --- a/tests/auto/testlib/selftests/expected_datetime.xml +++ b/tests/auto/testlib/selftests/expected_datetime.xml @@ -2,6 +2,7 @@ <TestCase name="tst_DateTime"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_datetime.xunitxml b/tests/auto/testlib/selftests/expected_datetime.xunitxml index 00bd43f904..901462b6bf 100644 --- a/tests/auto/testlib/selftests/expected_datetime.xunitxml +++ b/tests/auto/testlib/selftests/expected_datetime.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase result="fail" name="dateTime"> diff --git a/tests/auto/testlib/selftests/expected_exceptionthrow.lightxml b/tests/auto/testlib/selftests/expected_exceptionthrow.lightxml index 6c9675a2aa..2b802aabaf 100644 --- a/tests/auto/testlib/selftests/expected_exceptionthrow.lightxml +++ b/tests/auto/testlib/selftests/expected_exceptionthrow.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> @@ -7,7 +8,7 @@ <Duration msecs="0"/> </TestFunction> <TestFunction name="throwException"> -<Incident type="fail" file="/home/frederik/dev/qt/qt-src-dev/qtbase/src/testlib/qtestcase.cpp" line="2229"> +<Incident type="fail" file="qtestcase.cpp" line="2235"> <Description><![CDATA[Caught unhandled exception]]></Description> </Incident> <Duration msecs="0"/> diff --git a/tests/auto/testlib/selftests/expected_exceptionthrow.xml b/tests/auto/testlib/selftests/expected_exceptionthrow.xml index 87d9d2d431..a265d5ba5f 100644 --- a/tests/auto/testlib/selftests/expected_exceptionthrow.xml +++ b/tests/auto/testlib/selftests/expected_exceptionthrow.xml @@ -2,6 +2,7 @@ <TestCase name="tst_Exception"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> @@ -9,7 +10,7 @@ <Duration msecs="0"/> </TestFunction> <TestFunction name="throwException"> -<Incident type="fail" file="/home/frederik/dev/qt/qt-src-dev/qtbase/src/testlib/qtestcase.cpp" line="2229"> +<Incident type="fail" file="qtestcase.cpp" line="2235"> <Description><![CDATA[Caught unhandled exception]]></Description> </Incident> <Duration msecs="0"/> diff --git a/tests/auto/testlib/selftests/expected_exceptionthrow.xunitxml b/tests/auto/testlib/selftests/expected_exceptionthrow.xunitxml index ab0d379255..7d10bf6f04 100644 --- a/tests/auto/testlib/selftests/expected_exceptionthrow.xunitxml +++ b/tests/auto/testlib/selftests/expected_exceptionthrow.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase result="fail" name="throwException"> diff --git a/tests/auto/testlib/selftests/expected_expectfail.lightxml b/tests/auto/testlib/selftests/expected_expectfail.lightxml index e5fcca5875..cd5ab78fbe 100644 --- a/tests/auto/testlib/selftests/expected_expectfail.lightxml +++ b/tests/auto/testlib/selftests/expected_expectfail.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_expectfail.xml b/tests/auto/testlib/selftests/expected_expectfail.xml index 14fee2129e..a98b97810c 100644 --- a/tests/auto/testlib/selftests/expected_expectfail.xml +++ b/tests/auto/testlib/selftests/expected_expectfail.xml @@ -2,6 +2,7 @@ <TestCase name="tst_ExpectFail"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_expectfail.xunitxml b/tests/auto/testlib/selftests/expected_expectfail.xunitxml index 45c260c77f..47483d71bf 100644 --- a/tests/auto/testlib/selftests/expected_expectfail.xunitxml +++ b/tests/auto/testlib/selftests/expected_expectfail.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase result="xfail" name="xfailAndContinue"> diff --git a/tests/auto/testlib/selftests/expected_failcleanup.lightxml b/tests/auto/testlib/selftests/expected_failcleanup.lightxml index cfc18ef5da..b2db64c4e2 100644 --- a/tests/auto/testlib/selftests/expected_failcleanup.lightxml +++ b/tests/auto/testlib/selftests/expected_failcleanup.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_failcleanup.xml b/tests/auto/testlib/selftests/expected_failcleanup.xml index 3aa7aa265d..476e56c4f4 100644 --- a/tests/auto/testlib/selftests/expected_failcleanup.xml +++ b/tests/auto/testlib/selftests/expected_failcleanup.xml @@ -2,6 +2,7 @@ <TestCase name="tst_FailCleanup"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_failcleanup.xunitxml b/tests/auto/testlib/selftests/expected_failcleanup.xunitxml index 6e35566be8..813e284ee0 100644 --- a/tests/auto/testlib/selftests/expected_failcleanup.xunitxml +++ b/tests/auto/testlib/selftests/expected_failcleanup.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase result="pass" name="aTestFunction"/> diff --git a/tests/auto/testlib/selftests/expected_failinit.lightxml b/tests/auto/testlib/selftests/expected_failinit.lightxml index c0d193998d..5a940fc36b 100644 --- a/tests/auto/testlib/selftests/expected_failinit.lightxml +++ b/tests/auto/testlib/selftests/expected_failinit.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_failinit.xml b/tests/auto/testlib/selftests/expected_failinit.xml index 70ad613f3f..51e1a7fce4 100644 --- a/tests/auto/testlib/selftests/expected_failinit.xml +++ b/tests/auto/testlib/selftests/expected_failinit.xml @@ -2,6 +2,7 @@ <TestCase name="tst_FailInit"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_failinit.xunitxml b/tests/auto/testlib/selftests/expected_failinit.xunitxml index 3c2e31be29..3715725ea5 100644 --- a/tests/auto/testlib/selftests/expected_failinit.xunitxml +++ b/tests/auto/testlib/selftests/expected_failinit.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="fail" name="initTestCase"> <failure message="'false' returned FALSE. ()" result="fail"/> diff --git a/tests/auto/testlib/selftests/expected_failinitdata.lightxml b/tests/auto/testlib/selftests/expected_failinitdata.lightxml index 285471470f..f9da42c060 100644 --- a/tests/auto/testlib/selftests/expected_failinitdata.lightxml +++ b/tests/auto/testlib/selftests/expected_failinitdata.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_failinitdata.xml b/tests/auto/testlib/selftests/expected_failinitdata.xml index e86e102202..e843863bfc 100644 --- a/tests/auto/testlib/selftests/expected_failinitdata.xml +++ b/tests/auto/testlib/selftests/expected_failinitdata.xml @@ -2,6 +2,7 @@ <TestCase name="tst_FailInitData"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_failinitdata.xunitxml b/tests/auto/testlib/selftests/expected_failinitdata.xunitxml index f32ccd5e81..d245bc0dff 100644 --- a/tests/auto/testlib/selftests/expected_failinitdata.xunitxml +++ b/tests/auto/testlib/selftests/expected_failinitdata.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="fail" name="initTestCase"> <failure message="'false' returned FALSE. ()" result="fail"/> diff --git a/tests/auto/testlib/selftests/expected_fetchbogus.lightxml b/tests/auto/testlib/selftests/expected_fetchbogus.lightxml index c5587cf031..c62a93eb49 100644 --- a/tests/auto/testlib/selftests/expected_fetchbogus.lightxml +++ b/tests/auto/testlib/selftests/expected_fetchbogus.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_fetchbogus.xml b/tests/auto/testlib/selftests/expected_fetchbogus.xml index 40295bdebc..c20de137a2 100644 --- a/tests/auto/testlib/selftests/expected_fetchbogus.xml +++ b/tests/auto/testlib/selftests/expected_fetchbogus.xml @@ -2,6 +2,7 @@ <TestCase name="tst_FetchBogus"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_fetchbogus.xunitxml b/tests/auto/testlib/selftests/expected_fetchbogus.xunitxml index fe31b4b600..77ccbd896a 100644 --- a/tests/auto/testlib/selftests/expected_fetchbogus.xunitxml +++ b/tests/auto/testlib/selftests/expected_fetchbogus.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase result="fail" name="fetchBogus"> diff --git a/tests/auto/testlib/selftests/expected_findtestdata.lightxml b/tests/auto/testlib/selftests/expected_findtestdata.lightxml index 4c1c7298ed..e3c3cea7bc 100644 --- a/tests/auto/testlib/selftests/expected_findtestdata.lightxml +++ b/tests/auto/testlib/selftests/expected_findtestdata.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_findtestdata.xml b/tests/auto/testlib/selftests/expected_findtestdata.xml index b1f33abaf6..6abaa15103 100644 --- a/tests/auto/testlib/selftests/expected_findtestdata.xml +++ b/tests/auto/testlib/selftests/expected_findtestdata.xml @@ -2,6 +2,7 @@ <TestCase name="FindTestData"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_findtestdata.xunitxml b/tests/auto/testlib/selftests/expected_findtestdata.xunitxml index 60283a1064..c1138da6cb 100644 --- a/tests/auto/testlib/selftests/expected_findtestdata.xunitxml +++ b/tests/auto/testlib/selftests/expected_findtestdata.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase result="pass" name="paths"> diff --git a/tests/auto/testlib/selftests/expected_globaldata.lightxml b/tests/auto/testlib/selftests/expected_globaldata.lightxml index fd128d2c61..7d4c43905c 100644 --- a/tests/auto/testlib/selftests/expected_globaldata.lightxml +++ b/tests/auto/testlib/selftests/expected_globaldata.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_globaldata.xml b/tests/auto/testlib/selftests/expected_globaldata.xml index 0867619fde..5e5d4d8922 100644 --- a/tests/auto/testlib/selftests/expected_globaldata.xml +++ b/tests/auto/testlib/selftests/expected_globaldata.xml @@ -2,6 +2,7 @@ <TestCase name="tst_globaldata"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_globaldata.xunitxml b/tests/auto/testlib/selftests/expected_globaldata.xunitxml index e8cd03a59c..bdd7e3f00a 100644 --- a/tests/auto/testlib/selftests/expected_globaldata.xunitxml +++ b/tests/auto/testlib/selftests/expected_globaldata.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"> <!-- message="initTestCase initTestCase (null)" type="qdebug" --> diff --git a/tests/auto/testlib/selftests/expected_longstring.lightxml b/tests/auto/testlib/selftests/expected_longstring.lightxml index 45c6d3f78d..f8796bed4a 100644 --- a/tests/auto/testlib/selftests/expected_longstring.lightxml +++ b/tests/auto/testlib/selftests/expected_longstring.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_longstring.xml b/tests/auto/testlib/selftests/expected_longstring.xml index efc29d6def..6623b7cd88 100644 --- a/tests/auto/testlib/selftests/expected_longstring.xml +++ b/tests/auto/testlib/selftests/expected_longstring.xml @@ -2,6 +2,7 @@ <TestCase name="tst_LongString"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_longstring.xunitxml b/tests/auto/testlib/selftests/expected_longstring.xunitxml index 6486817dbb..269c06fe08 100644 --- a/tests/auto/testlib/selftests/expected_longstring.xunitxml +++ b/tests/auto/testlib/selftests/expected_longstring.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase result="fail" name="failWithLongString"> diff --git a/tests/auto/testlib/selftests/expected_maxwarnings.lightxml b/tests/auto/testlib/selftests/expected_maxwarnings.lightxml index ce6d828eb2..49db189352 100644 --- a/tests/auto/testlib/selftests/expected_maxwarnings.lightxml +++ b/tests/auto/testlib/selftests/expected_maxwarnings.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_maxwarnings.xml b/tests/auto/testlib/selftests/expected_maxwarnings.xml index 758af9d6d5..614b054fad 100644 --- a/tests/auto/testlib/selftests/expected_maxwarnings.xml +++ b/tests/auto/testlib/selftests/expected_maxwarnings.xml @@ -2,6 +2,7 @@ <TestCase name="MaxWarnings"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_maxwarnings.xunitxml b/tests/auto/testlib/selftests/expected_maxwarnings.xunitxml index b1b0215cef..329fae5f1d 100644 --- a/tests/auto/testlib/selftests/expected_maxwarnings.xunitxml +++ b/tests/auto/testlib/selftests/expected_maxwarnings.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase result="pass" name="warn"> diff --git a/tests/auto/testlib/selftests/expected_singleskip.lightxml b/tests/auto/testlib/selftests/expected_singleskip.lightxml index 685396a243..ce09c0a9ad 100644 --- a/tests/auto/testlib/selftests/expected_singleskip.lightxml +++ b/tests/auto/testlib/selftests/expected_singleskip.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_singleskip.xml b/tests/auto/testlib/selftests/expected_singleskip.xml index c10626ca41..0c5cdade3d 100644 --- a/tests/auto/testlib/selftests/expected_singleskip.xml +++ b/tests/auto/testlib/selftests/expected_singleskip.xml @@ -2,6 +2,7 @@ <TestCase name="tst_SingleSkip"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_singleskip.xunitxml b/tests/auto/testlib/selftests/expected_singleskip.xunitxml index 70968fa1c4..2b2da2f504 100644 --- a/tests/auto/testlib/selftests/expected_singleskip.xunitxml +++ b/tests/auto/testlib/selftests/expected_singleskip.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase name="myTest"> diff --git a/tests/auto/testlib/selftests/expected_skip.lightxml b/tests/auto/testlib/selftests/expected_skip.lightxml index 408bc44871..ee83d263b5 100644 --- a/tests/auto/testlib/selftests/expected_skip.lightxml +++ b/tests/auto/testlib/selftests/expected_skip.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_skip.xml b/tests/auto/testlib/selftests/expected_skip.xml index b220722b6c..2c830bc9fb 100644 --- a/tests/auto/testlib/selftests/expected_skip.xml +++ b/tests/auto/testlib/selftests/expected_skip.xml @@ -2,6 +2,7 @@ <TestCase name="tst_Skip"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_skip.xunitxml b/tests/auto/testlib/selftests/expected_skip.xunitxml index 956d51f531..63e582f96a 100644 --- a/tests/auto/testlib/selftests/expected_skip.xunitxml +++ b/tests/auto/testlib/selftests/expected_skip.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase name="test"> diff --git a/tests/auto/testlib/selftests/expected_skipcleanup.lightxml b/tests/auto/testlib/selftests/expected_skipcleanup.lightxml index 49c9d148f5..dbbc30c0db 100644 --- a/tests/auto/testlib/selftests/expected_skipcleanup.lightxml +++ b/tests/auto/testlib/selftests/expected_skipcleanup.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_skipcleanup.xml b/tests/auto/testlib/selftests/expected_skipcleanup.xml index 0bf1fe53a3..7b787ebb3d 100644 --- a/tests/auto/testlib/selftests/expected_skipcleanup.xml +++ b/tests/auto/testlib/selftests/expected_skipcleanup.xml @@ -2,6 +2,7 @@ <TestCase name="tst_SkipCleanup"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_skipcleanup.xunitxml b/tests/auto/testlib/selftests/expected_skipcleanup.xunitxml index b8f67e2d07..9934584ec5 100644 --- a/tests/auto/testlib/selftests/expected_skipcleanup.xunitxml +++ b/tests/auto/testlib/selftests/expected_skipcleanup.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase result="pass" name="aTestFunction"/> diff --git a/tests/auto/testlib/selftests/expected_skipinit.lightxml b/tests/auto/testlib/selftests/expected_skipinit.lightxml index e06c745205..3682068825 100644 --- a/tests/auto/testlib/selftests/expected_skipinit.lightxml +++ b/tests/auto/testlib/selftests/expected_skipinit.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_skipinit.xml b/tests/auto/testlib/selftests/expected_skipinit.xml index 6a62b93614..9d6a38b82f 100644 --- a/tests/auto/testlib/selftests/expected_skipinit.xml +++ b/tests/auto/testlib/selftests/expected_skipinit.xml @@ -2,6 +2,7 @@ <TestCase name="tst_SkipInit"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_skipinit.xunitxml b/tests/auto/testlib/selftests/expected_skipinit.xunitxml index f62df71d96..bab08c375c 100644 --- a/tests/auto/testlib/selftests/expected_skipinit.xunitxml +++ b/tests/auto/testlib/selftests/expected_skipinit.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase name="initTestCase"> <!-- message="Skip inside initTestCase. This should skip all tests in the class." type="skip" --> diff --git a/tests/auto/testlib/selftests/expected_skipinitdata.lightxml b/tests/auto/testlib/selftests/expected_skipinitdata.lightxml index 41abd5dccd..26afcb4ab1 100644 --- a/tests/auto/testlib/selftests/expected_skipinitdata.lightxml +++ b/tests/auto/testlib/selftests/expected_skipinitdata.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_skipinitdata.xml b/tests/auto/testlib/selftests/expected_skipinitdata.xml index 8efe12195e..9ab84f21a1 100644 --- a/tests/auto/testlib/selftests/expected_skipinitdata.xml +++ b/tests/auto/testlib/selftests/expected_skipinitdata.xml @@ -2,6 +2,7 @@ <TestCase name="tst_SkipInitData"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_skipinitdata.xunitxml b/tests/auto/testlib/selftests/expected_skipinitdata.xunitxml index 699d50f7a7..e61d50b06b 100644 --- a/tests/auto/testlib/selftests/expected_skipinitdata.xunitxml +++ b/tests/auto/testlib/selftests/expected_skipinitdata.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase name="initTestCase"> <!-- message="Skip inside initTestCase_data. This should skip all tests in the class." type="skip" --> diff --git a/tests/auto/testlib/selftests/expected_strcmp.lightxml b/tests/auto/testlib/selftests/expected_strcmp.lightxml index f0d266d400..298e910be8 100644 --- a/tests/auto/testlib/selftests/expected_strcmp.lightxml +++ b/tests/auto/testlib/selftests/expected_strcmp.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_strcmp.xml b/tests/auto/testlib/selftests/expected_strcmp.xml index 20ffee0611..29208f9a87 100644 --- a/tests/auto/testlib/selftests/expected_strcmp.xml +++ b/tests/auto/testlib/selftests/expected_strcmp.xml @@ -2,6 +2,7 @@ <TestCase name="tst_StrCmp"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_strcmp.xunitxml b/tests/auto/testlib/selftests/expected_strcmp.xunitxml index dde9ff5299..14bef9ec47 100644 --- a/tests/auto/testlib/selftests/expected_strcmp.xunitxml +++ b/tests/auto/testlib/selftests/expected_strcmp.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase result="pass" name="compareCharStars"/> diff --git a/tests/auto/testlib/selftests/expected_subtest.lightxml b/tests/auto/testlib/selftests/expected_subtest.lightxml index 467fabb7ac..2e484aafef 100644 --- a/tests/auto/testlib/selftests/expected_subtest.lightxml +++ b/tests/auto/testlib/selftests/expected_subtest.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_subtest.xml b/tests/auto/testlib/selftests/expected_subtest.xml index 1107bcb070..f011489ec8 100644 --- a/tests/auto/testlib/selftests/expected_subtest.xml +++ b/tests/auto/testlib/selftests/expected_subtest.xml @@ -2,6 +2,7 @@ <TestCase name="tst_Subtest"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_subtest.xunitxml b/tests/auto/testlib/selftests/expected_subtest.xunitxml index 753711f837..b49c006940 100644 --- a/tests/auto/testlib/selftests/expected_subtest.xunitxml +++ b/tests/auto/testlib/selftests/expected_subtest.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"> <!-- message="initTestCase initTestCase (null)" type="qdebug" --> diff --git a/tests/auto/testlib/selftests/expected_verbose1.lightxml b/tests/auto/testlib/selftests/expected_verbose1.lightxml index 45dca139fa..6d7ce13ea0 100644 --- a/tests/auto/testlib/selftests/expected_verbose1.lightxml +++ b/tests/auto/testlib/selftests/expected_verbose1.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_verbose1.xml b/tests/auto/testlib/selftests/expected_verbose1.xml index 7a182183c1..b5ae1286cb 100644 --- a/tests/auto/testlib/selftests/expected_verbose1.xml +++ b/tests/auto/testlib/selftests/expected_verbose1.xml @@ -2,6 +2,7 @@ <TestCase name="tst_Counting"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_verbose1.xunitxml b/tests/auto/testlib/selftests/expected_verbose1.xunitxml index 72bf047ba8..cb3a7815af 100644 --- a/tests/auto/testlib/selftests/expected_verbose1.xunitxml +++ b/tests/auto/testlib/selftests/expected_verbose1.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase result="pass" name="testPassPass"/> diff --git a/tests/auto/testlib/selftests/expected_verbose2.lightxml b/tests/auto/testlib/selftests/expected_verbose2.lightxml index 0ead76884c..85f9ec45af 100644 --- a/tests/auto/testlib/selftests/expected_verbose2.lightxml +++ b/tests/auto/testlib/selftests/expected_verbose2.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_verbose2.xml b/tests/auto/testlib/selftests/expected_verbose2.xml index 6d592f4a52..94fef3eed7 100644 --- a/tests/auto/testlib/selftests/expected_verbose2.xml +++ b/tests/auto/testlib/selftests/expected_verbose2.xml @@ -2,6 +2,7 @@ <TestCase name="tst_Counting"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_verbose2.xunitxml b/tests/auto/testlib/selftests/expected_verbose2.xunitxml index 6dabbd34fc..6764a5564f 100644 --- a/tests/auto/testlib/selftests/expected_verbose2.xunitxml +++ b/tests/auto/testlib/selftests/expected_verbose2.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase result="pass" name="testPassPass"> diff --git a/tests/auto/testlib/selftests/expected_verifyexceptionthrown.lightxml b/tests/auto/testlib/selftests/expected_verifyexceptionthrown.lightxml index fb8f61503e..d38363fb6e 100644 --- a/tests/auto/testlib/selftests/expected_verifyexceptionthrown.lightxml +++ b/tests/auto/testlib/selftests/expected_verifyexceptionthrown.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_verifyexceptionthrown.xml b/tests/auto/testlib/selftests/expected_verifyexceptionthrown.xml index a89528cfb8..8c57fe5c0f 100644 --- a/tests/auto/testlib/selftests/expected_verifyexceptionthrown.xml +++ b/tests/auto/testlib/selftests/expected_verifyexceptionthrown.xml @@ -2,6 +2,7 @@ <TestCase name="tst_VerifyExceptionThrown"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_verifyexceptionthrown.xunitxml b/tests/auto/testlib/selftests/expected_verifyexceptionthrown.xunitxml index f49746a9af..003a31a1cc 100644 --- a/tests/auto/testlib/selftests/expected_verifyexceptionthrown.xunitxml +++ b/tests/auto/testlib/selftests/expected_verifyexceptionthrown.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase result="pass" name="testCorrectStdTypes"/> diff --git a/tests/auto/testlib/selftests/expected_warnings.lightxml b/tests/auto/testlib/selftests/expected_warnings.lightxml index bbc96b7010..31b3d842aa 100644 --- a/tests/auto/testlib/selftests/expected_warnings.lightxml +++ b/tests/auto/testlib/selftests/expected_warnings.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_warnings.xml b/tests/auto/testlib/selftests/expected_warnings.xml index acb80e4f2a..a3821f84df 100644 --- a/tests/auto/testlib/selftests/expected_warnings.xml +++ b/tests/auto/testlib/selftests/expected_warnings.xml @@ -2,6 +2,7 @@ <TestCase name="tst_Warnings"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_warnings.xunitxml b/tests/auto/testlib/selftests/expected_warnings.xunitxml index 7be47174c6..7ea66522c6 100644 --- a/tests/auto/testlib/selftests/expected_warnings.xunitxml +++ b/tests/auto/testlib/selftests/expected_warnings.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase result="pass" name="testWarnings"> diff --git a/tests/auto/testlib/selftests/expected_xunit.lightxml b/tests/auto/testlib/selftests/expected_xunit.lightxml index 6660cf4e7a..95ab8f03f0 100644 --- a/tests/auto/testlib/selftests/expected_xunit.lightxml +++ b/tests/auto/testlib/selftests/expected_xunit.lightxml @@ -1,5 +1,6 @@ <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_xunit.xml b/tests/auto/testlib/selftests/expected_xunit.xml index af9fe1f502..f56ca947be 100644 --- a/tests/auto/testlib/selftests/expected_xunit.xml +++ b/tests/auto/testlib/selftests/expected_xunit.xml @@ -2,6 +2,7 @@ <TestCase name="tst_Xunit"> <Environment> <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> </Environment> <TestFunction name="initTestCase"> diff --git a/tests/auto/testlib/selftests/expected_xunit.xunitxml b/tests/auto/testlib/selftests/expected_xunit.xunitxml index 7d133da7a5..395b6efdd9 100644 --- a/tests/auto/testlib/selftests/expected_xunit.xunitxml +++ b/tests/auto/testlib/selftests/expected_xunit.xunitxml @@ -3,6 +3,7 @@ <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> + <property value="" name="QtBuild"/> </properties> <testcase result="pass" name="initTestCase"/> <testcase result="pass" name="testFunc1"> diff --git a/tests/auto/testlib/selftests/generate_expected_output.py b/tests/auto/testlib/selftests/generate_expected_output.py index 1c09faf4db..8c1de0d8b4 100755 --- a/tests/auto/testlib/selftests/generate_expected_output.py +++ b/tests/auto/testlib/selftests/generate_expected_output.py @@ -56,8 +56,11 @@ isWindows = sys.platform == 'win32' replacements = [ (qtver, r'@INSERT_QT_VERSION_HERE@'), + (r'Config: Using QtTest library.*', r'Config: Using QtTest library'), # Build string in text logs (rootPath.encode('unicode-escape').decode('utf-8'), r''), (r'( *)<Duration msecs="[\d\.]+"/>', r'\1<Duration msecs="0"/>'), + (r'( *)<QtBuild>[^<]+</QtBuild>', r'\1<QtBuild/>'), # Build element in xml, lightxml + (r'<property value="[^"]+" name="QtBuild"/>', r'<property value="" name="QtBuild"/>') # Build in xunitxml ] extraArgs = { diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index 8167a96eaa..e73bdc5223 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -169,12 +169,17 @@ QString tst_Selftests::logName(const QString &logger) const return (logger.startsWith("stdout") ? "" : QString(tempDir.path() + "/test_output." + logger)); } +static QString expectedFileNameFromTest(const QString &subdir, const QString &logger) +{ + return QStringLiteral("expected_") + subdir + QLatin1Char('.') + logFormat(logger); +} + // Load the expected test output for the nominated test (subdir) and logger // as an array of lines. If there is no expected output file, return an // empty array. -static QList<QByteArray> expectedResult(const QString &subdir, const QString &logger) +static QList<QByteArray> expectedResult(const QString &fileName) { - QFile file(":/expected_" + subdir + "." + logFormat(logger)); + QFile file(QStringLiteral(":/") + fileName); if (!file.open(QIODevice::ReadOnly)) return QList<QByteArray>(); return splitLines(file.readAll()); @@ -619,7 +624,8 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge for (int n = 0; n < loggers.count(); ++n) { QString logger = loggers[n]; QList<QByteArray> res = splitLines(actualOutputs[n]); - QList<QByteArray> exp = expectedResult(subdir, logger); + const QString expectedFileName = expectedFileNameFromTest(subdir, logger); + QList<QByteArray> exp = expectedResult(expectedFileName); #if defined (Q_CC_MSVC) || defined(Q_CC_MINGW) // MSVC, MinGW format double numbers differently if (n == 0 && subdir == QStringLiteral("float")) { @@ -638,7 +644,7 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge QList<QByteArray> tmp; int i = 1; do { - tmp = expectedResult(subdir + QString("_%1").arg(i++), logger); + tmp = expectedResult(expectedFileNameFromTest(subdir + QLatin1Char('_') + QString::number(i++), logger)); if (tmp.count()) expArr += tmp; } while (tmp.count()); @@ -667,8 +673,8 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge qDebug() << ">>>>>>"; QVERIFY2(res.count() == exp.count(), - qPrintable(QString::fromLatin1("Mismatch in line count: %1 != %2 (%3).") - .arg(res.count()).arg(exp.count()).arg(loggers.at(n)))); + qPrintable(QString::fromLatin1("Mismatch in line count: %1 != %2 (%3, %4).") + .arg(res.count()).arg(exp.count()).arg(loggers.at(n), expectedFileName))); } } @@ -711,6 +717,12 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge if (line.endsWith(" : failure location")) continue; + if (line.startsWith("Config: Using QtTest library") // Text build string + || line.startsWith(" <QtBuild") // XML, Light XML build string + || (line.startsWith(" <property value=") && line.endsWith("name=\"QtBuild\"/>"))) { // XUNIT-XML build string + continue; + } + const QString output(QString::fromLatin1(line)); const QString expected(QString::fromLatin1(exp.at(i)).replace("@INSERT_QT_VERSION_HERE@", QT_VERSION_STR)); @@ -740,8 +752,8 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge .arg(i).arg(loggers.at(n), output))); } else { QVERIFY2(output == expected, - qPrintable(QString::fromLatin1("Mismatch at line %1 (%2): '%3' != '%4'") - .arg(i).arg(loggers.at(n), output, expected))); + qPrintable(QString::fromLatin1("Mismatch at line %1 (%2, %3): '%4' != '%5'") + .arg(i + 1).arg(loggers.at(n), expectedFileName, output, expected))); } benchmark = line.startsWith("RESULT : "); diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 04140fa4a1..c5469bd33a 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -174,6 +174,9 @@ class TestClassinfoWithEscapes: public QObject Q_OBJECT Q_CLASSINFO("escaped", "\"bar\"") Q_CLASSINFO("\"escaped\"", "foo") + Q_CLASSINFO("cpp c*/omment", "f/*oo") + Q_CLASSINFO("endswith\\", "Or?\?/") + Q_CLASSINFO("newline\n inside\n", "Or \r") public slots: void slotWithAReallyLongName(int) { } @@ -800,6 +803,14 @@ void tst_Moc::classinfoWithEscapes() const QMetaObject *mobj = &TestClassinfoWithEscapes::staticMetaObject; QCOMPARE(mobj->methodCount() - mobj->methodOffset(), 1); + QCOMPARE(mobj->classInfoCount(), 5); + QCOMPARE(mobj->classInfo(2).name(), "cpp c*/omment"); + QCOMPARE(mobj->classInfo(2).value(), "f/*oo"); + QCOMPARE(mobj->classInfo(3).name(), "endswith\\"); + QCOMPARE(mobj->classInfo(3).value(), "Or?\?/"); + QCOMPARE(mobj->classInfo(4).name(), "newline\n inside\n"); + QCOMPARE(mobj->classInfo(4).value(), "Or \r"); + QMetaMethod mm = mobj->method(mobj->methodOffset()); QCOMPARE(mm.methodSignature(), QByteArray("slotWithAReallyLongName(int)")); } diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 84466b92d1..f686b5854c 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -377,6 +377,8 @@ private slots: void itemClipsChildrenToShape5(); void itemClipsTextChildToShape(); void itemClippingDiscovery(); + void itemContainsChildrenInShape(); + void itemContainsChildrenInShape2(); void ancestorFlags(); void untransformable(); void contextMenuEventPropagation(); @@ -5845,6 +5847,102 @@ void tst_QGraphicsItem::itemClippingDiscovery() QCOMPARE(scene.itemAt(90, 90), (QGraphicsItem *)0); } +class ItemCountsBoundingRectCalls : public QGraphicsRectItem +{ +public: + ItemCountsBoundingRectCalls(const QRectF & rect, QGraphicsItem *parent = 0) + : QGraphicsRectItem(rect, parent), boundingRectCalls(0) {} + QRectF boundingRect () const { + ++boundingRectCalls; + return QGraphicsRectItem::boundingRect(); + } + mutable int boundingRectCalls; +}; + +void tst_QGraphicsItem::itemContainsChildrenInShape() +{ + ItemCountsBoundingRectCalls *parent = new ItemCountsBoundingRectCalls(QRectF(0,0, 10, 10)); + ItemCountsBoundingRectCalls *childOutsideShape = new ItemCountsBoundingRectCalls(QRectF(0,0, 10, 10), parent); + childOutsideShape->setPos(20,0); + + QGraphicsScene scene; + scene.setItemIndexMethod(QGraphicsScene::NoIndex); + scene.addItem(parent); + + QVERIFY(parent->boundingRectCalls == childOutsideShape->boundingRectCalls); + + int oldParentBoundingRectCalls = parent->boundingRectCalls; + int oldChildBoundingRectCalls = childOutsideShape->boundingRectCalls; + + // First test that both items are searched if no optimization flags are set + QGraphicsItem* item = scene.itemAt(25,5); + + QVERIFY(item == childOutsideShape); + QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls); + QVERIFY(childOutsideShape->boundingRectCalls > oldChildBoundingRectCalls); + QVERIFY(parent->boundingRectCalls == childOutsideShape->boundingRectCalls); + + oldParentBoundingRectCalls = parent->boundingRectCalls; + oldChildBoundingRectCalls = childOutsideShape->boundingRectCalls; + + // Repeat the test to make sure that no caching/indexing is in effect + item = scene.itemAt(25,5); + + QVERIFY(item == childOutsideShape); + QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls); + QVERIFY(childOutsideShape->boundingRectCalls > oldChildBoundingRectCalls); + QVERIFY(parent->boundingRectCalls == childOutsideShape->boundingRectCalls); + + oldParentBoundingRectCalls = parent->boundingRectCalls; + oldChildBoundingRectCalls = childOutsideShape->boundingRectCalls; + + // Set the optimization flag and make sure that the child is not returned + // and that the child's boundingRect() method is never called. + parent->setFlag(QGraphicsItem::ItemContainsChildrenInShape); + item = scene.itemAt(25,5); + + QVERIFY(!(item)); + QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls); + QVERIFY(childOutsideShape->boundingRectCalls == oldChildBoundingRectCalls); + QVERIFY(parent->boundingRectCalls > childOutsideShape->boundingRectCalls); +} + +void tst_QGraphicsItem::itemContainsChildrenInShape2() +{ + //The tested flag behaves almost identically to ItemClipsChildrenToShape + //in terms of optimizations but does not enforce the clip. + //This test makes sure there is no clip. + QGraphicsScene scene; + QGraphicsItem *rect = scene.addRect(0, 0, 50, 50, QPen(Qt::NoPen), QBrush(Qt::yellow)); + + QGraphicsItem *ellipse = scene.addEllipse(0, 0, 100, 100, QPen(Qt::NoPen), QBrush(Qt::green)); + ellipse->setParentItem(rect); + + QGraphicsItem *clippedEllipse = scene.addEllipse(0, 0, 50, 50, QPen(Qt::NoPen), QBrush(Qt::blue)); + clippedEllipse->setParentItem(ellipse); + + QGraphicsItem *clippedEllipse2 = scene.addEllipse(0, 0, 25, 25, QPen(Qt::NoPen), QBrush(Qt::red)); + clippedEllipse2->setParentItem(clippedEllipse); + + QVERIFY(!(ellipse->flags() & QGraphicsItem::ItemClipsChildrenToShape)); + QVERIFY(!(ellipse->flags() & QGraphicsItem::ItemContainsChildrenInShape)); + ellipse->setFlags(QGraphicsItem::ItemContainsChildrenInShape); + QVERIFY(!(ellipse->flags() & QGraphicsItem::ItemClipsChildrenToShape)); + QVERIFY((ellipse->flags() & QGraphicsItem::ItemContainsChildrenInShape)); + + QImage image(100, 100, QImage::Format_ARGB32_Premultiplied); + image.fill(0); + QPainter painter(&image); + painter.setRenderHint(QPainter::Antialiasing); + scene.render(&painter); + painter.end(); + + QCOMPARE(image.pixel(2, 2), QColor(Qt::yellow).rgba()); + QCOMPARE(image.pixel(12, 12), QColor(Qt::red).rgba()); + QCOMPARE(image.pixel(2, 25), QColor(Qt::blue).rgba()); + QCOMPARE(image.pixel(2, 50), QColor(Qt::green).rgba()); +} + void tst_QGraphicsItem::ancestorFlags() { QGraphicsItem *level1 = new QGraphicsRectItem; @@ -5965,11 +6063,27 @@ void tst_QGraphicsItem::ancestorFlags() // Nobody handles child events level21->setHandlesChildEvents(false); - for (int i = 0; i < 2; ++i) { - QGraphicsItem::GraphicsItemFlag flag = !i ? QGraphicsItem::ItemClipsChildrenToShape - : QGraphicsItem::ItemIgnoresTransformations; - int ancestorFlag = !i ? QGraphicsItemPrivate::AncestorClipsChildren - : QGraphicsItemPrivate::AncestorIgnoresTransformations; + for (int i = 0; i < 3; ++i) { + QGraphicsItem::GraphicsItemFlag flag; + int ancestorFlag; + + switch (i) { + case(0): + flag = QGraphicsItem::ItemClipsChildrenToShape; + ancestorFlag = QGraphicsItemPrivate::AncestorClipsChildren; + break; + case(1): + flag = QGraphicsItem::ItemIgnoresTransformations; + ancestorFlag = QGraphicsItemPrivate::AncestorIgnoresTransformations; + break; + case(2): + flag = QGraphicsItem::ItemContainsChildrenInShape; + ancestorFlag = QGraphicsItemPrivate::AncestorContainsChildren; + break; + default: + qFatal("Unknown ancestor flag, please fix!"); + break; + } QCOMPARE(int(level1->d_ptr->ancestorFlags), 0); QCOMPARE(int(level21->d_ptr->ancestorFlags), 0); diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index dfc8465210..a4752126bc 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -267,6 +267,7 @@ private slots: void removeFullyTransparentItem(); void zeroScale(); void focusItemChangedSignal(); + void minimumRenderSize(); // task specific tests below me void task139710_bspTreeCrash(); @@ -4678,6 +4679,78 @@ void tst_QGraphicsScene::focusItemChangedSignal() } +class ItemCountsPaintCalls : public QGraphicsRectItem +{ +public: + ItemCountsPaintCalls(const QRectF & rect, QGraphicsItem *parent = 0) + : QGraphicsRectItem(rect, parent), repaints(0) {} + void paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 ) + { + QGraphicsRectItem::paint(painter, option, widget); + ++repaints; + } + int repaints; +}; + +void tst_QGraphicsScene::minimumRenderSize() +{ + Q_CHECK_PAINTEVENTS + + ItemCountsPaintCalls *bigParent = new ItemCountsPaintCalls(QRectF(0,0,100,100)); + ItemCountsPaintCalls *smallChild = new ItemCountsPaintCalls(QRectF(0,0,10,10), bigParent); + ItemCountsPaintCalls *smallerGrandChild = new ItemCountsPaintCalls(QRectF(0,0,1,1), smallChild); + QGraphicsScene scene; + scene.addItem(bigParent); + + CustomView view; + view.setScene(&scene); + view.show(); + QVERIFY(QTest::qWaitForWindowExposed(&view)); + qApp->processEvents(); + + // Initially, everything should be repainted the same number of times + int viewRepaints = 0; + QTRY_VERIFY(view.repaints > viewRepaints); + viewRepaints = view.repaints; + + QVERIFY(viewRepaints == bigParent->repaints); + QVERIFY(viewRepaints == smallChild->repaints); + QVERIFY(viewRepaints == smallerGrandChild->repaints); + + // Setting a minimum render size should cause a repaint + scene.setMinimumRenderSize(0.5); + qApp->processEvents(); + + QTRY_VERIFY(view.repaints > viewRepaints); + viewRepaints = view.repaints; + + QVERIFY(viewRepaints == bigParent->repaints); + QVERIFY(viewRepaints == smallChild->repaints); + QVERIFY(viewRepaints == smallerGrandChild->repaints); + + // Scaling should cause a repaint of big items only. + view.scale(0.1, 0.1); + qApp->processEvents(); + + QTRY_VERIFY(view.repaints > viewRepaints); + viewRepaints = view.repaints; + + QVERIFY(viewRepaints == bigParent->repaints); + QVERIFY(viewRepaints == smallChild->repaints); + QVERIFY(smallChild->repaints > smallerGrandChild->repaints); + + // Scaling further should cause even fewer items to be repainted + view.scale(0.1, 0.1); // Stacks with previous scale + qApp->processEvents(); + + QTRY_VERIFY(view.repaints > viewRepaints); + viewRepaints = view.repaints; + + QVERIFY(viewRepaints == bigParent->repaints); + QVERIFY(bigParent->repaints > smallChild->repaints); + QVERIFY(smallChild->repaints > smallerGrandChild->repaints); +} + void tst_QGraphicsScene::taskQTBUG_15977_renderWithDeviceCoordinateCache() { QGraphicsScene scene; diff --git a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp index 21034e8f1b..350ae23d8a 100644 --- a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp @@ -393,18 +393,31 @@ void tst_QSpinBox::valueChangedHelper(int value) actualValues << value; } +class MySpinBox: public QSpinBox +{ +public: + MySpinBox(QWidget *parent = 0) : QSpinBox(parent) {} + + void changeEvent(QEvent *ev) { + eventsReceived.append(ev->type()); + } + QList<QEvent::Type> eventsReceived; +}; + void tst_QSpinBox::setReadOnly() { - QSpinBox spin(0); + MySpinBox spin(0); spin.show(); QTest::keyClick(&spin, Qt::Key_Up); QCOMPARE(spin.value(), 1); spin.setReadOnly(true); + QCOMPARE(spin.eventsReceived, QList<QEvent::Type>() << QEvent::ReadOnlyChange); QTest::keyClick(&spin, Qt::Key_Up); QCOMPARE(spin.value(), 1); spin.stepBy(1); QCOMPARE(spin.value(), 2); spin.setReadOnly(false); + QCOMPARE(spin.eventsReceived, QList<QEvent::Type>() << QEvent::ReadOnlyChange << QEvent::ReadOnlyChange); QTest::keyClick(&spin, Qt::Key_Up); QCOMPARE(spin.value(), 3); } diff --git a/tests/manual/widgets/itemviews/qheaderview/qheaderviewtest.pro b/tests/manual/widgets/itemviews/qheaderview/qheaderview.pro index f83136266d..f83136266d 100644 --- a/tests/manual/widgets/itemviews/qheaderview/qheaderviewtest.pro +++ b/tests/manual/widgets/itemviews/qheaderview/qheaderview.pro diff --git a/tests/manual/widgets/itemviews/qtreeview/qtreeviewtest.pro b/tests/manual/widgets/itemviews/qtreeview/qtreeview.pro index c241ee1045..c241ee1045 100644 --- a/tests/manual/widgets/itemviews/qtreeview/qtreeviewtest.pro +++ b/tests/manual/widgets/itemviews/qtreeview/qtreeview.pro diff --git a/tests/manual/widgets/itemviews/qtreewidget/qtreewidgettest.pro b/tests/manual/widgets/itemviews/qtreewidget/qtreewidget.pro index 4b1da9be38..4b1da9be38 100644 --- a/tests/manual/widgets/itemviews/qtreewidget/qtreewidgettest.pro +++ b/tests/manual/widgets/itemviews/qtreewidget/qtreewidget.pro diff --git a/tests/manual/widgets/kernel/layoutreplace/main.pro b/tests/manual/widgets/kernel/layoutreplace/layoutreplace.pro index 54c6a4a9fc..54c6a4a9fc 100644 --- a/tests/manual/widgets/kernel/layoutreplace/main.pro +++ b/tests/manual/widgets/kernel/layoutreplace/layoutreplace.pro diff --git a/tests/manual/widgets/kernel/qtooltip/main.pro b/tests/manual/widgets/kernel/qtooltip/qtooltip.pro index dac880a10e..dac880a10e 100644 --- a/tests/manual/widgets/kernel/qtooltip/main.pro +++ b/tests/manual/widgets/kernel/qtooltip/qtooltip.pro diff --git a/tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.pro b/tests/manual/widgets/qgraphicsview/rubberband/rubberband.pro index 805b0cc119..805b0cc119 100644 --- a/tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.pro +++ b/tests/manual/widgets/qgraphicsview/rubberband/rubberband.pro |