diff options
Diffstat (limited to 'tests')
419 files changed, 11517 insertions, 3511 deletions
diff --git a/tests/auto/corelib/global/qglobal/qglobal.pro b/tests/auto/corelib/global/qglobal/qglobal.pro index a40cb9a288..b105769430 100644 --- a/tests/auto/corelib/global/qglobal/qglobal.pro +++ b/tests/auto/corelib/global/qglobal/qglobal.pro @@ -2,3 +2,4 @@ CONFIG += testcase TARGET = tst_qglobal QT = core testlib SOURCES = tst_qglobal.cpp qglobal.c +contains(QT_CONFIG, c++1z): CONFIG += c++1z diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp index 78b954f373..56da047147 100644 --- a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp +++ b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp @@ -126,6 +126,46 @@ void tst_QGlobal::for_each() QCOMPARE(i, counter++); } QCOMPARE(counter, list.count()); + + // Should also work with an existing variable + int local; + counter = 0; + foreach (local, list) { + QCOMPARE(local, counter++); + } + QCOMPARE(counter, list.count()); + QCOMPARE(local, counter - 1); + + // Test the macro does not mess if/else conditions + counter = 0; + if (true) + foreach (int i, list) + QCOMPARE(i, counter++); + else + QFAIL("If/Else mismatch"); + QCOMPARE(counter, list.count()); + + counter = 0; + if (false) + foreach (int i, list) + if (i) QFAIL("If/Else mismatch"); + else QFAIL("If/Else mismatch"); + else + foreach (int i, list) + if (false) { } + else QCOMPARE(i, counter++); + QCOMPARE(counter, list.count()); + + // break and continue + counter = 0; + foreach (int i, list) { + if (i == 0) + continue; + QCOMPARE(i, (counter++) + 1); + if (i == 3) + break; + } + QCOMPARE(counter, 3); } void tst_QGlobal::qassert() diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index 34588b19bc..b703a8839f 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -2045,7 +2045,7 @@ void tst_QDir::detachingOperations() QCOMPARE(dir2.nameFilters(), nameFilters); QCOMPARE(dir2.sorting(), sorting); - dir2 = path1; + dir2.setPath(path1); QCOMPARE(dir2.path(), path1); QCOMPARE(dir2.filter(), filter); QCOMPARE(dir2.nameFilters(), nameFilters); diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index baf78f6a04..646fb2078a 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -96,31 +96,36 @@ inline bool qIsLikelyToBeNfs(const QString &path) } #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) -enum NtfsTargetType { - NtfsTargetFile = 0x0, - NtfsTargetDir = 0x1 -}; - -static bool createNtfsSymLinkHelper(const QString &path, const QString &target, NtfsTargetType targetType) -{ - DWORD dwFlags = targetType; - DWORD err = ERROR_SUCCESS; - - SetLastError(0); - const bool result = CreateSymbolicLink(reinterpret_cast<const wchar_t*>(path.utf16()), - reinterpret_cast<const wchar_t*>(target.utf16()), dwFlags); - err = GetLastError(); - - // CreateSymbolicLink can return TRUE & still fail to create the link, - // the error code in that case might be ERROR_PRIVILEGE_NOT_HELD (1314) - if (!result || err != ERROR_SUCCESS) { - qWarning() << "Error creating NTFS-symlink from:" << path << "to" << target << ":" << qt_error_string(err); +# ifndef SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE // MinGW +# define SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE (0x2) +# endif - return false; +static DWORD createSymbolicLink(const QString &symLinkName, const QString &target, + QString *errorMessage) +{ + DWORD result = ERROR_SUCCESS; + const QString nativeSymLinkName = QDir::toNativeSeparators(symLinkName); + const QString nativeTarget = QDir::toNativeSeparators(target); + DWORD flags = 0; + if (QOperatingSystemVersion::current() >= QOperatingSystemVersion(QOperatingSystemVersion::Windows, 10, 0, 14972)) + flags |= SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE; + if (QFileInfo(target).isDir()) + flags |= SYMBOLIC_LINK_FLAG_DIRECTORY; + if (CreateSymbolicLink(reinterpret_cast<const wchar_t*>(nativeSymLinkName.utf16()), + reinterpret_cast<const wchar_t*>(nativeTarget.utf16()), flags) == FALSE) { + result = GetLastError(); + QTextStream(errorMessage) << "CreateSymbolicLink(" << nativeSymLinkName << ", " + << nativeTarget << ", 0x" << hex << flags << dec << ") failed with error " << result + << ": " << qt_error_string(int(result)); } - return true; + return result; } -#endif + +static QByteArray msgInsufficientPrivileges(const QString &errorMessage) +{ + return "Insufficient privileges (" + errorMessage.toLocal8Bit() + ')'; +} +#endif // Q_OS_WIN && !Q_OS_WINRT static QString seedAndTemplate() { @@ -650,6 +655,8 @@ void tst_QFileInfo::canonicalFilePath() QVERIFY(tempFile.open(QFile::WriteOnly)); QFileInfo fi(tempFile.fileName()); QCOMPARE(fi.canonicalFilePath(), QDir::currentPath() + "/" + fileName); + fi = QFileInfo(tempFile.fileName() + QString::fromLatin1("/")); + QCOMPARE(fi.canonicalFilePath(), QString::fromLatin1("")); tempFile.remove(); // This used to crash on Mac, verify that it doesn't anymore. @@ -731,13 +738,14 @@ void tst_QFileInfo::canonicalFilePath() #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) { + QString errorMessage; const QString linkTarget = QStringLiteral("res"); - BOOL ret = createNtfsSymLinkHelper(linkTarget, m_resourcesDir, NtfsTargetDir); - if (!ret) - QSKIP("Symbolic links aren't supported by FS"); + const DWORD dwErr = createSymbolicLink(linkTarget, m_resourcesDir, &errorMessage); + if (dwErr == ERROR_PRIVILEGE_NOT_HELD) + QSKIP(msgInsufficientPrivileges(errorMessage)); + QVERIFY2(dwErr == ERROR_SUCCESS, qPrintable(errorMessage)); QString currentPath = QDir::currentPath(); - bool is_res_Current = QDir::setCurrent(linkTarget); - QCOMPARE(is_res_Current, true); + QVERIFY(QDir::setCurrent(linkTarget)); const QString actualCanonicalPath = QFileInfo("file1").canonicalFilePath(); QVERIFY(QDir::setCurrent(currentPath)); QCOMPARE(actualCanonicalPath, m_resourcesDir + QStringLiteral("/file1")); @@ -1476,8 +1484,24 @@ void tst_QFileInfo::refresh() } #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) + +struct NtfsTestResource { + + enum Type { None, SymLink, Junction }; + + explicit NtfsTestResource(Type tp = None, const QString &s = QString(), const QString &t = QString()) + : source(s), target(t), type(tp) {} + + QString source; + QString target; + Type type; +}; + +Q_DECLARE_METATYPE(NtfsTestResource) + void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data() { + QTest::addColumn<NtfsTestResource>("resource"); QTest::addColumn<QString>("path"); QTest::addColumn<bool>("isSymLink"); QTest::addColumn<QString>("linkTarget"); @@ -1500,25 +1524,20 @@ void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data() QString fileInSymlink(absSymlink); fileInSymlink.append("\\file"); QFile file(fileInTarget); - file.open(QIODevice::ReadWrite); + QVERIFY2(file.open(QIODevice::ReadWrite), qPrintable(file.errorString())); file.close(); - bool result = true; - if (!pwd.exists("abs_symlink")) - result = createNtfsSymLinkHelper(absSymlink, absTarget, NtfsTargetDir); - if (result && !pwd.exists(relSymlink)) - result = createNtfsSymLinkHelper(relSymlink, relTarget, NtfsTargetDir); - if (!result) { - //we need at least one data set for the test not to assert fail when skipping _data function - QDir target("target"); - QTest::newRow("dummy") << target.path() << false << "" << target.canonicalPath(); - QSKIP("link not supported by FS or insufficient privilege"); - } QVERIFY2(file.exists(), msgDoesNotExist(file.fileName()).constData()); - QTest::newRow("absolute dir symlink") << absSymlink << true << QDir::fromNativeSeparators(absTarget) << target.canonicalPath(); - QTest::newRow("relative dir symlink") << relSymlink << true << QDir::fromNativeSeparators(absTarget) << target.canonicalPath(); - QTest::newRow("file in symlink dir") << fileInSymlink << false << "" << target.canonicalPath().append("/file"); + QTest::newRow("absolute dir symlink") + << NtfsTestResource(NtfsTestResource::SymLink, absSymlink, absTarget) + << absSymlink << true << QDir::fromNativeSeparators(absTarget) << target.canonicalPath(); + QTest::newRow("relative dir symlink") + << NtfsTestResource(NtfsTestResource::SymLink, relSymlink, relTarget) + << relSymlink << true << QDir::fromNativeSeparators(absTarget) << target.canonicalPath(); + QTest::newRow("file in symlink dir") + << NtfsTestResource() + << fileInSymlink << false << "" << target.canonicalPath().append("/file"); } { //File symlinks @@ -1531,41 +1550,51 @@ void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data() QString relSymlink = "rel_symlink.cpp"; QString relToRelTarget = QDir::toNativeSeparators(relativeDir.relativeFilePath(target.absoluteFilePath())); QString relToRelSymlink = "relative/rel_symlink"; - QVERIFY(pwd.exists("abs_symlink.cpp") || createNtfsSymLinkHelper(absSymlink, absTarget, NtfsTargetFile)); - QVERIFY(pwd.exists(relSymlink) || createNtfsSymLinkHelper(relSymlink, relTarget, NtfsTargetFile)); - QVERIFY(pwd.exists(relToRelSymlink) || createNtfsSymLinkHelper(relToRelSymlink, relToRelTarget, NtfsTargetFile)); - QTest::newRow("absolute file symlink") << absSymlink << true << QDir::fromNativeSeparators(absTarget) << target.canonicalFilePath(); - QTest::newRow("relative file symlink") << relSymlink << true << QDir::fromNativeSeparators(absTarget) << target.canonicalFilePath(); - QTest::newRow("relative to relative file symlink") << relToRelSymlink << true << QDir::fromNativeSeparators(absTarget) << target.canonicalFilePath(); + + QTest::newRow("absolute file symlink") + << NtfsTestResource(NtfsTestResource::SymLink, absSymlink, absTarget) + << absSymlink << true << QDir::fromNativeSeparators(absTarget) << target.canonicalFilePath(); + QTest::newRow("relative file symlink") + << NtfsTestResource(NtfsTestResource::SymLink, relSymlink, relTarget) + << relSymlink << true << QDir::fromNativeSeparators(absTarget) << target.canonicalFilePath(); + QTest::newRow("relative to relative file symlink") + << NtfsTestResource(NtfsTestResource::SymLink, relToRelSymlink, relToRelTarget) + << relToRelSymlink << true << QDir::fromNativeSeparators(absTarget) << target.canonicalFilePath(); } { // Symlink to UNC share pwd.mkdir("unc"); + QString errorMessage; QString uncTarget = QStringLiteral("//") + QtNetworkSettings::winServerName() + "/testshare"; QString uncSymlink = QDir::toNativeSeparators(pwd.absolutePath().append("\\unc\\link_to_unc")); - QVERIFY(pwd.exists("link_to_unc") || createNtfsSymLinkHelper(uncSymlink, uncTarget, NtfsTargetDir)); - QTest::newRow("UNC symlink") << uncSymlink << true << uncTarget << uncTarget; + QTest::newRow("UNC symlink") + << NtfsTestResource(NtfsTestResource::SymLink, uncSymlink, uncTarget) + << QDir::fromNativeSeparators(uncSymlink) << true << QDir::fromNativeSeparators(uncTarget) << uncTarget; } //Junctions QString target = "target"; QString junction = "junction_pwd"; - FileSystem::createNtfsJunction(target, junction); QFileInfo targetInfo(target); - QTest::newRow("junction_pwd") << junction << false << QString() << QString(); + QTest::newRow("junction_pwd") + << NtfsTestResource(NtfsTestResource::Junction, junction, target) + << junction << false << QString() << QString(); QFileInfo fileInJunction(targetInfo.absoluteFilePath().append("/file")); QFile file(fileInJunction.absoluteFilePath()); - file.open(QIODevice::ReadWrite); + QVERIFY2(file.open(QIODevice::ReadWrite), qPrintable(file.errorString())); file.close(); QVERIFY2(file.exists(), msgDoesNotExist(file.fileName()).constData()); - QTest::newRow("file in junction") << fileInJunction.absoluteFilePath() << false << "" << fileInJunction.canonicalFilePath(); + QTest::newRow("file in junction") + << NtfsTestResource() + << fileInJunction.absoluteFilePath() << false << QString() << fileInJunction.canonicalFilePath(); target = QDir::rootPath(); junction = "junction_root"; - FileSystem::createNtfsJunction(target, junction); targetInfo.setFile(target); - QTest::newRow("junction_root") << junction << false << QString() << QString(); + QTest::newRow("junction_root") + << NtfsTestResource(NtfsTestResource::Junction, junction, target) + << junction << false << QString() << QString(); //Mountpoint wchar_t buffer[MAX_PATH]; @@ -1574,17 +1603,38 @@ void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data() QString rootVolume = QString::fromWCharArray(buffer); junction = "mountpoint"; rootVolume.replace("\\\\?\\","\\??\\"); - FileSystem::createNtfsJunction(rootVolume, junction); - QTest::newRow("mountpoint") << junction << false << QString() << QString(); + QTest::newRow("mountpoint") + << NtfsTestResource(NtfsTestResource::Junction, junction, rootVolume) + << junction << false << QString() << QString(); } void tst_QFileInfo::ntfsJunctionPointsAndSymlinks() { + QFETCH(NtfsTestResource, resource); QFETCH(QString, path); QFETCH(bool, isSymLink); QFETCH(QString, linkTarget); QFETCH(QString, canonicalFilePath); + QString errorMessage; + DWORD creationResult = ERROR_SUCCESS; + switch (resource.type) { + case NtfsTestResource::None: + break; + case NtfsTestResource::SymLink: + creationResult = createSymbolicLink(resource.source, resource.target, &errorMessage); + break; + case NtfsTestResource::Junction: + creationResult = FileSystem::createNtfsJunction(resource.target, resource.source, &errorMessage); + if (creationResult == ERROR_NOT_SUPPORTED) // Special value indicating non-NTFS drive + QSKIP(qPrintable(errorMessage)); + break; + } + + if (creationResult == ERROR_PRIVILEGE_NOT_HELD) + QSKIP(msgInsufficientPrivileges(errorMessage)); + QVERIFY2(creationResult == ERROR_SUCCESS, qPrintable(errorMessage)); + QFileInfo fi(path); const bool actualIsSymLink = fi.isSymLink(); const QString actualSymLinkTarget = isSymLink ? fi.symLinkTarget() : QString(); @@ -1984,7 +2034,7 @@ static void stateCheck(const QFileInfo &info, const QString &dirname, const QStr QVERIFY(!info.isRoot()); QCOMPARE(info.isNativePath(), !filename.isEmpty()); - QCOMPARE(info.readLink(), QString()); + QCOMPARE(info.symLinkTarget(), QString()); QCOMPARE(info.ownerId(), uint(-2)); QCOMPARE(info.groupId(), uint(-2)); QCOMPARE(info.owner(), QString()); diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index e0aa577154..c51994c1c1 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -185,12 +185,12 @@ void tst_QProcess::getSetCheck() { QProcess obj1; // ProcessChannelMode QProcess::readChannelMode() - // void QProcess::setReadChannelMode(ProcessChannelMode) - obj1.setReadChannelMode(QProcess::ProcessChannelMode(QProcess::SeparateChannels)); + // void QProcess::setProcessChannelMode(ProcessChannelMode) + obj1.setProcessChannelMode(QProcess::ProcessChannelMode(QProcess::SeparateChannels)); QCOMPARE(QProcess::ProcessChannelMode(QProcess::SeparateChannels), obj1.readChannelMode()); - obj1.setReadChannelMode(QProcess::ProcessChannelMode(QProcess::MergedChannels)); + obj1.setProcessChannelMode(QProcess::ProcessChannelMode(QProcess::MergedChannels)); QCOMPARE(QProcess::ProcessChannelMode(QProcess::MergedChannels), obj1.readChannelMode()); - obj1.setReadChannelMode(QProcess::ProcessChannelMode(QProcess::ForwardedChannels)); + obj1.setProcessChannelMode(QProcess::ProcessChannelMode(QProcess::ForwardedChannels)); QCOMPARE(QProcess::ProcessChannelMode(QProcess::ForwardedChannels), obj1.readChannelMode()); // ProcessChannel QProcess::readChannel() @@ -913,7 +913,7 @@ public: switch (n) { case 0: - setReadChannelMode(QProcess::MergedChannels); + setProcessChannelMode(QProcess::MergedChannels); connect(this, &QIODevice::readyRead, this, &SoftExitProcess::terminateSlot); break; case 1: @@ -929,7 +929,7 @@ public: this, &SoftExitProcess::terminateSlot); break; case 4: - setReadChannelMode(QProcess::MergedChannels); + setProcessChannelMode(QProcess::MergedChannels); connect(this, SIGNAL(channelReadyRead(int)), this, SLOT(terminateSlot())); break; default: @@ -1025,7 +1025,7 @@ void tst_QProcess::softExitInSlots() void tst_QProcess::mergedChannels() { QProcess process; - process.setReadChannelMode(QProcess::MergedChannels); + process.setProcessChannelMode(QProcess::MergedChannels); QCOMPARE(process.readChannelMode(), QProcess::MergedChannels); process.start("testProcessEcho2/testProcessEcho2"); @@ -1951,7 +1951,7 @@ void tst_QProcess::setStandardOutputFile() // run the process QProcess process; - process.setReadChannelMode(channelMode); + process.setProcessChannelMode(channelMode); if (channelToTest == QProcess::StandardOutput) process.setStandardOutputFile(file.fileName(), mode); else @@ -2037,7 +2037,7 @@ void tst_QProcess::setStandardOutputProcess() QFETCH(bool, merged); QFETCH(bool, waitForBytesWritten); - source.setReadChannelMode(merged ? QProcess::MergedChannels : QProcess::SeparateChannels); + source.setProcessChannelMode(merged ? QProcess::MergedChannels : QProcess::SeparateChannels); source.setStandardOutputProcess(&sink); source.start("testProcessEcho2/testProcessEcho2"); diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp index dbc3d68e93..cf4ab4902d 100644 --- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp @@ -376,7 +376,7 @@ void tst_QTemporaryFile::io() before.setSecsSinceEpoch(before.toSecsSinceEpoch()); QVERIFY(file.open()); - QVERIFY(file.readLink().isEmpty()); // it's not a link! + QVERIFY(file.symLinkTarget().isEmpty()); // it's not a link! QFile::Permissions perm = file.permissions(); QVERIFY(perm & QFile::ReadOwner); QVERIFY(file.setPermissions(perm)); diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index d697dae9dd..9c106c7f58 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -3410,6 +3410,21 @@ void tst_QUrl::effectiveTLDs_data() QTest::newRow("yes16") << QUrl::fromEncoded("http://anything.pagespeedmobilizer.com") << ".pagespeedmobilizer.com"; QTest::newRow("yes17") << QUrl::fromEncoded("http://anything.eu-central-1.compute.amazonaws.com") << ".eu-central-1.compute.amazonaws.com"; QTest::newRow("yes18") << QUrl::fromEncoded("http://anything.ltd.hk") << ".ltd.hk"; + QTest::newRow("trentino.it") + << QUrl::fromEncoded("http://any.thing.trentino.it") << ".trentino.it"; + QTest::newRow("net.ni") << QUrl::fromEncoded("http://test.net.ni") << ".net.ni"; + QTest::newRow("dyn.cosidns.de") + << QUrl::fromEncoded("http://test.dyn.cosidns.de") << ".dyn.cosidns.de"; + QTest::newRow("freeddns.org") + << QUrl::fromEncoded("http://test.freeddns.org") << ".freeddns.org"; + QTest::newRow("app.os.stg.fedoraproject.org") + << QUrl::fromEncoded("http://test.app.os.stg.fedoraproject.org") + << ".app.os.stg.fedoraproject.org"; + QTest::newRow("development.run") << QUrl::fromEncoded("http://test.development.run") << ".development.run"; + QTest::newRow("crafting.xyz") << QUrl::fromEncoded("http://test.crafting.xyz") << ".crafting.xyz"; + QTest::newRow("nym.ie") << QUrl::fromEncoded("http://shamus.nym.ie") << ".nym.ie"; + QTest::newRow("vapor.cloud") << QUrl::fromEncoded("http://test.vapor.cloud") << ".vapor.cloud"; + QTest::newRow("official.academy") << QUrl::fromEncoded("http://acredited.official.academy") << ".official.academy"; } void tst_QUrl::effectiveTLDs() diff --git a/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp b/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp index d839141091..25d392b37e 100644 --- a/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp +++ b/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp @@ -233,6 +233,14 @@ void tst_QUrlQuery::constructing() query += qMakePair(QString("prosent"), QString("%")); copy.setQueryItems(query); QVERIFY(!copy.isEmpty()); + + QUrlQuery fromList = { + {QString("type"), QString("login")}, + {QString("name"), QString::fromUtf8("åge nissemannsen")}, + {QString("ole&du"), QString::fromUtf8("anne+jørgen=sant")}, + {QString("prosent"), QString("%")} + }; + QCOMPARE(fromList, copy); } void tst_QUrlQuery::addRemove() diff --git a/tests/auto/corelib/itemmodels/itemmodels.pro b/tests/auto/corelib/itemmodels/itemmodels.pro index cca350ad43..ffbda6ec40 100644 --- a/tests/auto/corelib/itemmodels/itemmodels.pro +++ b/tests/auto/corelib/itemmodels/itemmodels.pro @@ -5,9 +5,11 @@ SUBDIRS = qstringlistmodel qtHaveModule(gui): SUBDIRS += \ qabstractitemmodel \ qabstractproxymodel \ + qconcatenatetablesproxymodel \ qidentityproxymodel \ qitemselectionmodel \ qsortfilterproxymodel_recursive \ + qtransposeproxymodel \ qtHaveModule(widgets) { SUBDIRS += \ diff --git a/tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/qconcatenatetablesproxymodel.pro b/tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/qconcatenatetablesproxymodel.pro new file mode 100644 index 0000000000..ee4ea28b5b --- /dev/null +++ b/tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/qconcatenatetablesproxymodel.pro @@ -0,0 +1,5 @@ +CONFIG += testcase +TARGET = tst_qconcatenatetablesproxymodel +QT = core gui testlib + +SOURCES = tst_qconcatenatetablesproxymodel.cpp diff --git a/tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/tst_qconcatenatetablesproxymodel.cpp b/tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/tst_qconcatenatetablesproxymodel.cpp new file mode 100644 index 0000000000..40617c1f7d --- /dev/null +++ b/tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/tst_qconcatenatetablesproxymodel.cpp @@ -0,0 +1,823 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure <david.faure@kdab.com> +** Contact: https://www.qt.io/licensing/ +** +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/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 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QSignalSpy> +#include <QSortFilterProxyModel> +#include <QTest> +#include <QStandardItemModel> +#include <QIdentityProxyModel> +#include <QItemSelectionModel> +#include <QMimeData> +#include <QStringListModel> +#include <QAbstractItemModelTester> + +#include <qconcatenatetablesproxymodel.h> + +Q_DECLARE_METATYPE(QModelIndex) + +// Extracts a full row from a model as a string +// Works best if every cell contains only one character +static QString extractRowTexts(QAbstractItemModel *model, int row, const QModelIndex &parent = QModelIndex()) +{ + QString result; + const int colCount = model->columnCount(); + for (int col = 0; col < colCount; ++col) { + const QString txt = model->index(row, col, parent).data().toString(); + result += txt.isEmpty() ? QStringLiteral(" ") : txt; + } + return result; +} + +// Extracts a full column from a model as a string +// Works best if every cell contains only one character +static QString extractColumnTexts(QAbstractItemModel *model, int column, const QModelIndex &parent = QModelIndex()) +{ + QString result; + const int rowCount = model->rowCount(); + for (int row = 0; row < rowCount; ++row) { + const QString txt = model->index(row, column, parent).data().toString(); + result += txt.isEmpty() ? QStringLiteral(" ") : txt; + } + return result; +} + +static QString rowSpyToText(const QSignalSpy &spy) +{ + if (!spy.isValid()) + return QStringLiteral("THE SIGNALSPY IS INVALID!"); + QString str; + for (int i = 0; i < spy.count(); ++i) { + str += spy.at(i).at(1).toString() + QLatin1Char(',') + spy.at(i).at(2).toString(); + if (i + 1 < spy.count()) + str += QLatin1Char(';'); + } + return str; +} + +class tst_QConcatenateTablesProxyModel : public QObject +{ + Q_OBJECT + +private Q_SLOTS: + void init(); + void shouldAggregateTwoModelsCorrectly(); + void shouldAggregateThenRemoveTwoEmptyModelsCorrectly(); + void shouldAggregateTwoEmptyModelsWhichThenGetFilled(); + void shouldHandleDataChanged(); + void shouldHandleSetData(); + void shouldHandleSetItemData(); + void shouldHandleRowInsertionAndRemoval(); + void shouldAggregateAnotherModelThenRemoveModels(); + void shouldUseSmallestColumnCount(); + void shouldIncreaseColumnCountWhenRemovingFirstModel(); + void shouldHandleColumnInsertionAndRemoval(); + void shouldPropagateLayoutChanged(); + void shouldReactToModelReset(); + void shouldUpdateColumnsOnModelReset(); + void shouldPropagateDropOnItem_data(); + void shouldPropagateDropOnItem(); + void shouldPropagateDropBetweenItems(); + void shouldPropagateDropBetweenItemsAtModelBoundary(); + void shouldPropagateDropAfterLastRow_data(); + void shouldPropagateDropAfterLastRow(); + +private: + QStandardItemModel mod; + QStandardItemModel mod2; + QStandardItemModel mod3; +}; + +void tst_QConcatenateTablesProxyModel::init() +{ + // Prepare some source models to use later on + mod.clear(); + mod.appendRow({ new QStandardItem(QStringLiteral("A")), new QStandardItem(QStringLiteral("B")), new QStandardItem(QStringLiteral("C")) }); + mod.setHorizontalHeaderLabels(QStringList() << QStringLiteral("H1") << QStringLiteral("H2") << QStringLiteral("H3")); + mod.setVerticalHeaderLabels(QStringList() << QStringLiteral("One")); + + mod2.clear(); + mod2.appendRow({ new QStandardItem(QStringLiteral("D")), new QStandardItem(QStringLiteral("E")), new QStandardItem(QStringLiteral("F")) }); + mod2.setHorizontalHeaderLabels(QStringList() << QStringLiteral("H1") << QStringLiteral("H2") << QStringLiteral("H3")); + mod2.setVerticalHeaderLabels(QStringList() << QStringLiteral("Two")); + + mod3.clear(); + mod3.appendRow({ new QStandardItem(QStringLiteral("1")), new QStandardItem(QStringLiteral("2")), new QStandardItem(QStringLiteral("3")) }); + mod3.appendRow({ new QStandardItem(QStringLiteral("4")), new QStandardItem(QStringLiteral("5")), new QStandardItem(QStringLiteral("6")) }); +} + +void tst_QConcatenateTablesProxyModel::shouldAggregateTwoModelsCorrectly() +{ + // Given a combining proxy + QConcatenateTablesProxyModel pm; + + // When adding two source models + pm.addSourceModel(&mod); + pm.addSourceModel(&mod2); + QAbstractItemModelTester modelTest(&pm, this); + + // Then the proxy should show 2 rows + QCOMPARE(pm.rowCount(), 2); + QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("ABC")); + QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("DEF")); + + // ... and correct headers + QCOMPARE(pm.headerData(0, Qt::Horizontal).toString(), QStringLiteral("H1")); + QCOMPARE(pm.headerData(1, Qt::Horizontal).toString(), QStringLiteral("H2")); + QCOMPARE(pm.headerData(2, Qt::Horizontal).toString(), QStringLiteral("H3")); + QCOMPARE(pm.headerData(0, Qt::Vertical).toString(), QStringLiteral("One")); + QCOMPARE(pm.headerData(1, Qt::Vertical).toString(), QStringLiteral("Two")); + + QVERIFY(!pm.canFetchMore(QModelIndex())); +} + +void tst_QConcatenateTablesProxyModel::shouldAggregateThenRemoveTwoEmptyModelsCorrectly() +{ + // Given a combining proxy + QConcatenateTablesProxyModel pm; + + // When adding two empty models + QSignalSpy rowATBISpy(&pm, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int))); + QSignalSpy rowInsertedSpy(&pm, SIGNAL(rowsInserted(QModelIndex,int,int))); + QSignalSpy rowATBRSpy(&pm, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int))); + QSignalSpy rowRemovedSpy(&pm, SIGNAL(rowsRemoved(QModelIndex,int,int))); + QIdentityProxyModel i1, i2; + pm.addSourceModel(&i1); + pm.addSourceModel(&i2); + + // Then the proxy should still be empty (and no signals emitted) + QCOMPARE(pm.rowCount(), 0); + QCOMPARE(pm.columnCount(), 0); + QCOMPARE(rowATBISpy.count(), 0); + QCOMPARE(rowInsertedSpy.count(), 0); + + // When removing the empty models + pm.removeSourceModel(&i1); + pm.removeSourceModel(&i2); + + // Then the proxy should still be empty (and no signals emitted) + QCOMPARE(pm.rowCount(), 0); + QCOMPARE(pm.columnCount(), 0); + QCOMPARE(rowATBRSpy.count(), 0); + QCOMPARE(rowRemovedSpy.count(), 0); +} + +void tst_QConcatenateTablesProxyModel::shouldAggregateTwoEmptyModelsWhichThenGetFilled() +{ + // Given a combining proxy with two empty models + QConcatenateTablesProxyModel pm; + QIdentityProxyModel i1, i2; + pm.addSourceModel(&i1); + pm.addSourceModel(&i2); + + // When filling them afterwards + i1.setSourceModel(&mod); + i2.setSourceModel(&mod2); + QAbstractItemModelTester modelTest(&pm, this); + + // Then the proxy should show 2 rows + QCOMPARE(pm.rowCount(), 2); + QCOMPARE(pm.columnCount(), 3); + QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("ABC")); + QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("DEF")); + + // ... and correct headers + QCOMPARE(pm.headerData(0, Qt::Horizontal).toString(), QStringLiteral("H1")); + QCOMPARE(pm.headerData(1, Qt::Horizontal).toString(), QStringLiteral("H2")); + QCOMPARE(pm.headerData(2, Qt::Horizontal).toString(), QStringLiteral("H3")); + QCOMPARE(pm.headerData(0, Qt::Vertical).toString(), QStringLiteral("One")); + QCOMPARE(pm.headerData(1, Qt::Vertical).toString(), QStringLiteral("Two")); + + QVERIFY(!pm.canFetchMore(QModelIndex())); +} + +void tst_QConcatenateTablesProxyModel::shouldHandleDataChanged() +{ + // Given two models combined + QConcatenateTablesProxyModel pm; + pm.addSourceModel(&mod); + pm.addSourceModel(&mod2); + QAbstractItemModelTester modelTest(&pm, this); + QSignalSpy dataChangedSpy(&pm, SIGNAL(dataChanged(QModelIndex,QModelIndex))); + + // When a cell in a source model changes + mod.item(0, 0)->setData("a", Qt::EditRole); + + // Then the change should be notified to the proxy + QCOMPARE(dataChangedSpy.count(), 1); + QCOMPARE(dataChangedSpy.at(0).at(0).toModelIndex(), pm.index(0, 0)); + QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("aBC")); + + // Same test with the other model + mod2.item(0, 2)->setData("f", Qt::EditRole); + + QCOMPARE(dataChangedSpy.count(), 2); + QCOMPARE(dataChangedSpy.at(1).at(0).toModelIndex(), pm.index(1, 2)); + QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("DEf")); +} + +void tst_QConcatenateTablesProxyModel::shouldHandleSetData() +{ + // Given two models combined + QConcatenateTablesProxyModel pm; + pm.addSourceModel(&mod); + pm.addSourceModel(&mod2); + QAbstractItemModelTester modelTest(&pm, this); + QSignalSpy dataChangedSpy(&pm, SIGNAL(dataChanged(QModelIndex,QModelIndex))); + + // When changing a cell using setData + pm.setData(pm.index(0, 0), "a"); + + // Then the change should be notified to the proxy + QCOMPARE(dataChangedSpy.count(), 1); + QCOMPARE(dataChangedSpy.at(0).at(0).toModelIndex(), pm.index(0, 0)); + QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("aBC")); + + // Same test with the other model + pm.setData(pm.index(1, 2), "f"); + + QCOMPARE(dataChangedSpy.count(), 2); + QCOMPARE(dataChangedSpy.at(1).at(0).toModelIndex(), pm.index(1, 2)); + QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("DEf")); +} + +void tst_QConcatenateTablesProxyModel::shouldHandleSetItemData() +{ + // Given two models combined + QConcatenateTablesProxyModel pm; + pm.addSourceModel(&mod); + pm.addSourceModel(&mod2); + QAbstractItemModelTester modelTest(&pm, this); + QSignalSpy dataChangedSpy(&pm, SIGNAL(dataChanged(QModelIndex,QModelIndex))); + + // When changing a cell using setData + pm.setItemData(pm.index(0, 0), QMap<int, QVariant>{ std::make_pair<int, QVariant>(Qt::DisplayRole, QStringLiteral("X")), + std::make_pair<int, QVariant>(Qt::UserRole, 88) }); + + // Then the change should be notified to the proxy + QCOMPARE(dataChangedSpy.count(), 1); + QCOMPARE(dataChangedSpy.at(0).at(0).toModelIndex(), pm.index(0, 0)); + QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("XBC")); + QCOMPARE(pm.index(0, 0).data(Qt::UserRole).toInt(), 88); + + // Same test with the other model + pm.setItemData(pm.index(1, 2), QMap<int, QVariant>{ std::make_pair<int, QVariant>(Qt::DisplayRole, QStringLiteral("Y")), + std::make_pair<int, QVariant>(Qt::UserRole, 89) }); + + QCOMPARE(dataChangedSpy.count(), 2); + QCOMPARE(dataChangedSpy.at(1).at(0).toModelIndex(), pm.index(1, 2)); + QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("DEY")); + QCOMPARE(pm.index(1, 2).data(Qt::UserRole).toInt(), 89); +} + +void tst_QConcatenateTablesProxyModel::shouldHandleRowInsertionAndRemoval() +{ + // Given two models combined + QConcatenateTablesProxyModel pm; + pm.addSourceModel(&mod); + pm.addSourceModel(&mod2); + QAbstractItemModelTester modelTest(&pm, this); + QSignalSpy rowATBISpy(&pm, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int))); + QSignalSpy rowInsertedSpy(&pm, SIGNAL(rowsInserted(QModelIndex,int,int))); + + // When a source model inserts a new row + QList<QStandardItem *> row; + row.append(new QStandardItem(QStringLiteral("1"))); + row.append(new QStandardItem(QStringLiteral("2"))); + row.append(new QStandardItem(QStringLiteral("3"))); + mod2.insertRow(0, row); + + // Then the proxy should notify its users and show changes + QCOMPARE(rowSpyToText(rowATBISpy), QStringLiteral("1,1")); + QCOMPARE(rowSpyToText(rowInsertedSpy), QStringLiteral("1,1")); + QCOMPARE(pm.rowCount(), 3); + QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("ABC")); + QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("123")); + QCOMPARE(extractRowTexts(&pm, 2), QStringLiteral("DEF")); + + // When removing that row + QSignalSpy rowATBRSpy(&pm, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int))); + QSignalSpy rowRemovedSpy(&pm, SIGNAL(rowsRemoved(QModelIndex,int,int))); + mod2.removeRow(0); + + // Then the proxy should notify its users and show changes + QCOMPARE(rowATBRSpy.count(), 1); + QCOMPARE(rowATBRSpy.at(0).at(1).toInt(), 1); + QCOMPARE(rowATBRSpy.at(0).at(2).toInt(), 1); + QCOMPARE(rowRemovedSpy.count(), 1); + QCOMPARE(rowRemovedSpy.at(0).at(1).toInt(), 1); + QCOMPARE(rowRemovedSpy.at(0).at(2).toInt(), 1); + QCOMPARE(pm.rowCount(), 2); + QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("ABC")); + QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("DEF")); + + // When removing the last row from mod2 + rowATBRSpy.clear(); + rowRemovedSpy.clear(); + mod2.removeRow(0); + + // Then the proxy should notify its users and show changes + QCOMPARE(rowATBRSpy.count(), 1); + QCOMPARE(rowATBRSpy.at(0).at(1).toInt(), 1); + QCOMPARE(rowATBRSpy.at(0).at(2).toInt(), 1); + QCOMPARE(rowRemovedSpy.count(), 1); + QCOMPARE(rowRemovedSpy.at(0).at(1).toInt(), 1); + QCOMPARE(rowRemovedSpy.at(0).at(2).toInt(), 1); + QCOMPARE(pm.rowCount(), 1); + QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("ABC")); +} + +void tst_QConcatenateTablesProxyModel::shouldAggregateAnotherModelThenRemoveModels() +{ + // Given two models combined, and a third model + QConcatenateTablesProxyModel pm; + pm.addSourceModel(&mod); + pm.addSourceModel(&mod2); + QAbstractItemModelTester modelTest(&pm, this); + + QSignalSpy rowATBISpy(&pm, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int))); + QSignalSpy rowInsertedSpy(&pm, SIGNAL(rowsInserted(QModelIndex,int,int))); + + // When adding the new source model + pm.addSourceModel(&mod3); + + // Then the proxy should notify its users about the two rows inserted + QCOMPARE(rowSpyToText(rowATBISpy), QStringLiteral("2,3")); + QCOMPARE(rowSpyToText(rowInsertedSpy), QStringLiteral("2,3")); + QCOMPARE(pm.rowCount(), 4); + QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("ABC")); + QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("DEF")); + QCOMPARE(extractRowTexts(&pm, 2), QStringLiteral("123")); + QCOMPARE(extractRowTexts(&pm, 3), QStringLiteral("456")); + + // When removing that source model again + QSignalSpy rowATBRSpy(&pm, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int))); + QSignalSpy rowRemovedSpy(&pm, SIGNAL(rowsRemoved(QModelIndex,int,int))); + pm.removeSourceModel(&mod3); + + // Then the proxy should notify its users about the row removed + QCOMPARE(rowATBRSpy.count(), 1); + QCOMPARE(rowATBRSpy.at(0).at(1).toInt(), 2); + QCOMPARE(rowATBRSpy.at(0).at(2).toInt(), 3); + QCOMPARE(rowRemovedSpy.count(), 1); + QCOMPARE(rowRemovedSpy.at(0).at(1).toInt(), 2); + QCOMPARE(rowRemovedSpy.at(0).at(2).toInt(), 3); + QCOMPARE(pm.rowCount(), 2); + QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("ABC")); + QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("DEF")); + + // When removing model 2 + rowATBRSpy.clear(); + rowRemovedSpy.clear(); + pm.removeSourceModel(&mod2); + QCOMPARE(rowATBRSpy.count(), 1); + QCOMPARE(rowATBRSpy.at(0).at(1).toInt(), 1); + QCOMPARE(rowATBRSpy.at(0).at(2).toInt(), 1); + QCOMPARE(rowRemovedSpy.count(), 1); + QCOMPARE(rowRemovedSpy.at(0).at(1).toInt(), 1); + QCOMPARE(rowRemovedSpy.at(0).at(2).toInt(), 1); + QCOMPARE(pm.rowCount(), 1); + QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("ABC")); + + // When removing model 1 + rowATBRSpy.clear(); + rowRemovedSpy.clear(); + pm.removeSourceModel(&mod); + QCOMPARE(rowATBRSpy.count(), 1); + QCOMPARE(rowATBRSpy.at(0).at(1).toInt(), 0); + QCOMPARE(rowATBRSpy.at(0).at(2).toInt(), 0); + QCOMPARE(rowRemovedSpy.count(), 1); + QCOMPARE(rowRemovedSpy.at(0).at(1).toInt(), 0); + QCOMPARE(rowRemovedSpy.at(0).at(2).toInt(), 0); + QCOMPARE(pm.rowCount(), 0); +} + +void tst_QConcatenateTablesProxyModel::shouldUseSmallestColumnCount() +{ + QConcatenateTablesProxyModel pm; + pm.addSourceModel(&mod); + pm.addSourceModel(&mod2); + mod2.setColumnCount(1); + pm.addSourceModel(&mod3); + QAbstractItemModelTester modelTest(&pm, this); + + QCOMPARE(pm.rowCount(), 4); + QCOMPARE(pm.columnCount(), 1); + QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("A")); + QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("D")); + QCOMPARE(extractRowTexts(&pm, 2), QStringLiteral("1")); + QCOMPARE(extractRowTexts(&pm, 3), QStringLiteral("4")); + + const QModelIndex indexA = pm.mapFromSource(mod.index(0, 0)); + QVERIFY(indexA.isValid()); + QCOMPARE(indexA, pm.index(0, 0)); + + const QModelIndex indexB = pm.mapFromSource(mod.index(0, 1)); + QVERIFY(!indexB.isValid()); + + const QModelIndex indexD = pm.mapFromSource(mod2.index(0, 0)); + QVERIFY(indexD.isValid()); + QCOMPARE(indexD, pm.index(1, 0)); +} + +void tst_QConcatenateTablesProxyModel::shouldIncreaseColumnCountWhenRemovingFirstModel() +{ + // Given a model with 2 columns and one with 3 columns + QConcatenateTablesProxyModel pm; + pm.addSourceModel(&mod); + QAbstractItemModelTester modelTest(&pm, this); + mod.setColumnCount(2); + pm.addSourceModel(&mod2); + QCOMPARE(pm.rowCount(), 2); + QCOMPARE(pm.columnCount(), 2); + + QSignalSpy colATBISpy(&pm, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int))); + QSignalSpy colInsertedSpy(&pm, SIGNAL(columnsInserted(QModelIndex,int,int))); + QSignalSpy rowATBRSpy(&pm, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int))); + QSignalSpy rowRemovedSpy(&pm, SIGNAL(rowsRemoved(QModelIndex,int,int))); + + // When removing the first source model + pm.removeSourceModel(&mod); + + // Then the proxy should notify its users about the row removed, and the column added + QCOMPARE(pm.rowCount(), 1); + QCOMPARE(pm.columnCount(), 3); + QCOMPARE(rowSpyToText(rowATBRSpy), QStringLiteral("0,0")); + QCOMPARE(rowSpyToText(rowRemovedSpy), QStringLiteral("0,0")); + QCOMPARE(rowSpyToText(colATBISpy), QStringLiteral("2,2")); + QCOMPARE(rowSpyToText(colInsertedSpy), QStringLiteral("2,2")); + QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("DEF")); +} + +void tst_QConcatenateTablesProxyModel::shouldHandleColumnInsertionAndRemoval() +{ + // Given two models combined, one with 2 columns and one with 3 + QConcatenateTablesProxyModel pm; + pm.addSourceModel(&mod); + QAbstractItemModelTester modelTest(&pm, this); + mod.setColumnCount(2); + pm.addSourceModel(&mod2); + QSignalSpy colATBISpy(&pm, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int))); + QSignalSpy colInsertedSpy(&pm, SIGNAL(columnsInserted(QModelIndex,int,int))); + QSignalSpy colATBRSpy(&pm, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int))); + QSignalSpy colRemovedSpy(&pm, SIGNAL(columnsRemoved(QModelIndex,int,int))); + + // When the first source model inserts a new column + QCOMPARE(mod.columnCount(), 2); + mod.setColumnCount(3); + + // Then the proxy should notify its users and show changes + QCOMPARE(rowSpyToText(colATBISpy), QStringLiteral("2,2")); + QCOMPARE(rowSpyToText(colInsertedSpy), QStringLiteral("2,2")); + QCOMPARE(pm.rowCount(), 2); + QCOMPARE(pm.columnCount(), 3); + QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("AB ")); + QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("DEF")); + + // And when removing two columns + mod.setColumnCount(1); + + // Then the proxy should notify its users and show changes + QCOMPARE(rowSpyToText(colATBRSpy), QStringLiteral("1,2")); + QCOMPARE(rowSpyToText(colRemovedSpy), QStringLiteral("1,2")); + QCOMPARE(pm.rowCount(), 2); + QCOMPARE(pm.columnCount(), 1); + QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("A")); + QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("D")); +} + +void tst_QConcatenateTablesProxyModel::shouldPropagateLayoutChanged() +{ + // Given two source models, the second one being a QSFPM + QConcatenateTablesProxyModel pm; + pm.addSourceModel(&mod); + QAbstractItemModelTester modelTest(&pm, this); + + QSortFilterProxyModel qsfpm; + qsfpm.setSourceModel(&mod3); + pm.addSourceModel(&qsfpm); + + QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("ABC")); + QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("123")); + QCOMPARE(extractRowTexts(&pm, 2), QStringLiteral("456")); + + // And a selection (row 1) + QItemSelectionModel selection(&pm); + selection.select(pm.index(1, 0), QItemSelectionModel::Select | QItemSelectionModel::Rows); + const QModelIndexList lst = selection.selectedIndexes(); + QCOMPARE(lst.count(), 3); + for (int col = 0; col < lst.count(); ++col) { + QCOMPARE(lst.at(col).row(), 1); + QCOMPARE(lst.at(col).column(), col); + } + + QSignalSpy layoutATBCSpy(&pm, SIGNAL(layoutAboutToBeChanged())); + QSignalSpy layoutChangedSpy(&pm, SIGNAL(layoutChanged())); + + // When changing the sorting in the QSFPM + qsfpm.sort(0, Qt::DescendingOrder); + + // Then the proxy should emit the layoutChanged signals, and show re-sorted data + QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("ABC")); + QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("456")); + QCOMPARE(extractRowTexts(&pm, 2), QStringLiteral("123")); + QCOMPARE(layoutATBCSpy.count(), 1); + QCOMPARE(layoutChangedSpy.count(), 1); + + // And the selection should be updated accordingly (it became row 2) + const QModelIndexList lstAfter = selection.selectedIndexes(); + QCOMPARE(lstAfter.count(), 3); + for (int col = 0; col < lstAfter.count(); ++col) { + QCOMPARE(lstAfter.at(col).row(), 2); + QCOMPARE(lstAfter.at(col).column(), col); + } +} + +void tst_QConcatenateTablesProxyModel::shouldReactToModelReset() +{ + // Given two source models, the second one being a QSFPM + QConcatenateTablesProxyModel pm; + pm.addSourceModel(&mod); + QAbstractItemModelTester modelTest(&pm, this); + + QSortFilterProxyModel qsfpm; + qsfpm.setSourceModel(&mod3); + pm.addSourceModel(&qsfpm); + + QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("ABC")); + QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("123")); + QCOMPARE(extractRowTexts(&pm, 2), QStringLiteral("456")); + QSignalSpy rowATBRSpy(&pm, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int))); + QSignalSpy rowRemovedSpy(&pm, SIGNAL(rowsRemoved(QModelIndex,int,int))); + QSignalSpy rowATBISpy(&pm, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int))); + QSignalSpy rowInsertedSpy(&pm, SIGNAL(rowsInserted(QModelIndex,int,int))); + QSignalSpy colATBRSpy(&pm, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int))); + QSignalSpy colRemovedSpy(&pm, SIGNAL(columnsRemoved(QModelIndex,int,int))); + QSignalSpy modelATBResetSpy(&pm, SIGNAL(modelAboutToBeReset())); + QSignalSpy modelResetSpy(&pm, SIGNAL(modelReset())); + + // When changing the source model of the QSFPM + qsfpm.setSourceModel(&mod2); + + // Then the proxy should emit the reset signals, and show the new data + QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("ABC")); + QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("DEF")); + QCOMPARE(rowATBRSpy.count(), 0); + QCOMPARE(rowRemovedSpy.count(), 0); + QCOMPARE(rowATBISpy.count(), 0); + QCOMPARE(rowInsertedSpy.count(), 0); + QCOMPARE(colATBRSpy.count(), 0); + QCOMPARE(colRemovedSpy.count(), 0); + QCOMPARE(modelATBResetSpy.count(), 1); + QCOMPARE(modelResetSpy.count(), 1); +} + +void tst_QConcatenateTablesProxyModel::shouldUpdateColumnsOnModelReset() +{ + // Given two source models, the first one being a QSFPM + QConcatenateTablesProxyModel pm; + + QSortFilterProxyModel qsfpm; + qsfpm.setSourceModel(&mod3); + pm.addSourceModel(&qsfpm); + pm.addSourceModel(&mod); + QAbstractItemModelTester modelTest(&pm, this); + + QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("123")); + QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("456")); + QCOMPARE(extractRowTexts(&pm, 2), QStringLiteral("ABC")); + + // ... and a model with only 2 columns + QStandardItemModel mod2Columns; + mod2Columns.appendRow({ new QStandardItem(QStringLiteral("W")), new QStandardItem(QStringLiteral("X")) }); + + QSignalSpy rowATBRSpy(&pm, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int))); + QSignalSpy rowRemovedSpy(&pm, SIGNAL(rowsRemoved(QModelIndex,int,int))); + QSignalSpy rowATBISpy(&pm, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int))); + QSignalSpy rowInsertedSpy(&pm, SIGNAL(rowsInserted(QModelIndex,int,int))); + QSignalSpy colATBRSpy(&pm, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int))); + QSignalSpy colRemovedSpy(&pm, SIGNAL(columnsRemoved(QModelIndex,int,int))); + QSignalSpy modelATBResetSpy(&pm, SIGNAL(modelAboutToBeReset())); + QSignalSpy modelResetSpy(&pm, SIGNAL(modelReset())); + + // When changing the source model of the QSFPM + qsfpm.setSourceModel(&mod2Columns); + + // Then the proxy should reset, and show the new data + QCOMPARE(modelATBResetSpy.count(), 1); + QCOMPARE(modelResetSpy.count(), 1); + QCOMPARE(rowATBRSpy.count(), 0); + QCOMPARE(rowRemovedSpy.count(), 0); + QCOMPARE(rowATBISpy.count(), 0); + QCOMPARE(rowInsertedSpy.count(), 0); + QCOMPARE(colATBRSpy.count(), 0); + QCOMPARE(colRemovedSpy.count(), 0); + + QCOMPARE(pm.rowCount(), 2); + QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("WX")); + QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("AB")); +} + +void tst_QConcatenateTablesProxyModel::shouldPropagateDropOnItem_data() +{ + QTest::addColumn<int>("sourceRow"); + QTest::addColumn<int>("destRow"); + QTest::addColumn<QString>("expectedResult"); + + QTest::newRow("0-3") << 0 << 3 << QStringLiteral("ABCA"); + QTest::newRow("1-2") << 1 << 2 << QStringLiteral("ABBD"); + QTest::newRow("2-1") << 2 << 1 << QStringLiteral("ACCD"); + QTest::newRow("3-0") << 3 << 0 << QStringLiteral("DBCD"); + +} + +void tst_QConcatenateTablesProxyModel::shouldPropagateDropOnItem() +{ + // Given two source models who handle drops + + // Note: QStandardItemModel handles drop onto items by inserting child rows, + // which is good for QTreeView but not for QTableView or QConcatenateTablesProxyModel. + // So we use QStringListModel here instead. + QConcatenateTablesProxyModel pm; + QStringListModel model1({QStringLiteral("A"), QStringLiteral("B")}); + QStringListModel model2({QStringLiteral("C"), QStringLiteral("D")}); + pm.addSourceModel(&model1); + pm.addSourceModel(&model2); + QAbstractItemModelTester modelTest(&pm, this); + QCOMPARE(extractColumnTexts(&pm, 0), QStringLiteral("ABCD")); + + // When dragging one item + QFETCH(int, sourceRow); + QMimeData* mimeData = pm.mimeData({pm.index(sourceRow, 0)}); + QVERIFY(mimeData); + + // and dropping onto another item + QFETCH(int, destRow); + QVERIFY(pm.canDropMimeData(mimeData, Qt::CopyAction, -1, -1, pm.index(destRow, 0))); + QVERIFY(pm.dropMimeData(mimeData, Qt::CopyAction, -1, -1, pm.index(destRow, 0))); + delete mimeData; + + // Then the result should be as expected + QFETCH(QString, expectedResult); + QCOMPARE(extractColumnTexts(&pm, 0), expectedResult); +} + +void tst_QConcatenateTablesProxyModel::shouldPropagateDropBetweenItems() +{ + // Given two models combined + QConcatenateTablesProxyModel pm; + pm.addSourceModel(&mod3); + pm.addSourceModel(&mod2); + QAbstractItemModelTester modelTest(&pm, this); + QCOMPARE(pm.rowCount(), 3); + QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("123")); + QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("456")); + QCOMPARE(extractRowTexts(&pm, 2), QStringLiteral("DEF")); + + // When dragging the last row + QModelIndexList indexes; + indexes.reserve(pm.columnCount()); + for (int col = 0; col < pm.columnCount(); ++col) { + indexes.append(pm.index(2, col)); + } + QMimeData* mimeData = pm.mimeData(indexes); + QVERIFY(mimeData); + + // and dropping it before row 1 + const int destRow = 1; + QVERIFY(pm.canDropMimeData(mimeData, Qt::CopyAction, destRow, 0, QModelIndex())); + QVERIFY(pm.dropMimeData(mimeData, Qt::CopyAction, destRow, 0, QModelIndex())); + delete mimeData; + + // Then a new row should be inserted + QCOMPARE(pm.rowCount(), 4); + QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("123")); + QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("DEF")); + QCOMPARE(extractRowTexts(&pm, 2), QStringLiteral("456")); + QCOMPARE(extractRowTexts(&pm, 3), QStringLiteral("DEF")); +} + +void tst_QConcatenateTablesProxyModel::shouldPropagateDropBetweenItemsAtModelBoundary() +{ + // Given two models combined + QConcatenateTablesProxyModel pm; + pm.addSourceModel(&mod3); + pm.addSourceModel(&mod2); + QAbstractItemModelTester modelTest(&pm, this); + QCOMPARE(pm.rowCount(), 3); + QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("123")); + QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("456")); + QCOMPARE(extractRowTexts(&pm, 2), QStringLiteral("DEF")); + + // When dragging the first row + QModelIndexList indexes; + indexes.reserve(pm.columnCount()); + for (int col = 0; col < pm.columnCount(); ++col) { + indexes.append(pm.index(0, col)); + } + QMimeData* mimeData = pm.mimeData(indexes); + QVERIFY(mimeData); + + // and dropping it before row 2 + const int destRow = 2; + QVERIFY(pm.canDropMimeData(mimeData, Qt::CopyAction, destRow, 0, QModelIndex())); + QVERIFY(pm.dropMimeData(mimeData, Qt::CopyAction, destRow, 0, QModelIndex())); + delete mimeData; + + // Then a new row should be inserted + QCOMPARE(pm.rowCount(), 4); + QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("123")); + QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("456")); + QCOMPARE(extractRowTexts(&pm, 2), QStringLiteral("123")); + QCOMPARE(extractRowTexts(&pm, 3), QStringLiteral("DEF")); + + // and it should be part of the second model + QCOMPARE(mod2.rowCount(), 2); +} + +void tst_QConcatenateTablesProxyModel::shouldPropagateDropAfterLastRow_data() +{ + QTest::addColumn<int>("destRow"); + + // Dropping after the last row is documented to be done with destRow == -1. + QTest::newRow("-1") << -1; + // However, sometimes QTreeView calls dropMimeData with destRow == rowCount... + // Not sure if that's a bug or not, but let's support it in the model, just in case. + QTest::newRow("3") << 3; +} + +void tst_QConcatenateTablesProxyModel::shouldPropagateDropAfterLastRow() +{ + QFETCH(int, destRow); + + // Given two models combined + QConcatenateTablesProxyModel pm; + pm.addSourceModel(&mod3); + pm.addSourceModel(&mod2); + QAbstractItemModelTester modelTest(&pm, this); + QCOMPARE(pm.rowCount(), 3); + QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("123")); + QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("456")); + QCOMPARE(extractRowTexts(&pm, 2), QStringLiteral("DEF")); + + // When dragging the second row + QModelIndexList indexes; + indexes.reserve(pm.columnCount()); + for (int col = 0; col < pm.columnCount(); ++col) { + indexes.append(pm.index(1, col)); + } + QMimeData* mimeData = pm.mimeData(indexes); + QVERIFY(mimeData); + + // and dropping it after the last row + QVERIFY(pm.canDropMimeData(mimeData, Qt::CopyAction, destRow, 0, QModelIndex())); + QVERIFY(pm.dropMimeData(mimeData, Qt::CopyAction, destRow, 0, QModelIndex())); + delete mimeData; + + // Then a new row should be inserted at the end + QCOMPARE(pm.rowCount(), 4); + QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("123")); + QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("456")); + QCOMPARE(extractRowTexts(&pm, 2), QStringLiteral("DEF")); + QCOMPARE(extractRowTexts(&pm, 3), QStringLiteral("456")); + +} + +QTEST_GUILESS_MAIN(tst_QConcatenateTablesProxyModel) + +#include "tst_qconcatenatetablesproxymodel.moc" diff --git a/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp b/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp index 6ea7a38137..dbc7173028 100644 --- a/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp +++ b/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp @@ -251,7 +251,7 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model) QString val = xval + QString::number(y) + QString::number(i); QModelIndex index = model->index(x, y, parent); model->setData(index, val); - model->setData(index, blue, Qt::TextColorRole); + model->setData(index, blue, Qt::ForegroundRole); } } */ @@ -276,7 +276,7 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model) QString val = xval + QString::number(y) + QString::number(i); QModelIndex index = realModel->index(x, y, parent); realModel->setData(index, val); - realModel->setData(index, blue, Qt::TextColorRole); + realModel->setData(index, blue, Qt::ForegroundRole); } } */ diff --git a/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp b/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp index af52852b99..b9deb7b6a9 100644 --- a/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp +++ b/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp @@ -577,12 +577,12 @@ void tst_QItemModel::data() alignment == Qt::AlignJustify); } - QVariant colorVariant = currentModel->data(currentModel->index(0,0), Qt::BackgroundColorRole); + QVariant colorVariant = currentModel->data(currentModel->index(0,0), Qt::BackgroundRole); if (colorVariant.isValid()) { QVERIFY(colorVariant.canConvert<QColor>()); } - colorVariant = currentModel->data(currentModel->index(0,0), Qt::TextColorRole); + colorVariant = currentModel->data(currentModel->index(0,0), Qt::ForegroundRole); if (colorVariant.isValid()) { QVERIFY(colorVariant.canConvert<QColor>()); } diff --git a/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp b/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp index 1b40e77648..0b8686560c 100644 --- a/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp +++ b/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp @@ -84,8 +84,116 @@ private slots: void setData_emits_on_change_only(); void supportedDragDropActions(); + + void moveRows_data(); + void moveRows(); + void moveRowsInvalid_data(); + void moveRowsInvalid(); + + void itemData(); + void setItemData(); }; +void tst_QStringListModel::moveRowsInvalid_data() +{ + QTest::addColumn<QStringListModel*>("baseModel"); + QTest::addColumn<QModelIndex>("startParent"); + QTest::addColumn<int>("startRow"); + QTest::addColumn<int>("count"); + QTest::addColumn<QModelIndex>("destinationParent"); + QTest::addColumn<int>("destination"); + + QStringListModel* tempModel = new QStringListModel(QStringList{"A", "B", "C", "D", "E", "F"}, this); + QTest::addRow("destination_equal_source") << tempModel << QModelIndex() << 0 << 1 << QModelIndex() << 1; + tempModel = new QStringListModel(QStringList{"A", "B", "C", "D", "E", "F"}, this); + QTest::addRow("count_equal_0") << tempModel << QModelIndex() << 0 << 0 << QModelIndex() << 2; + tempModel = new QStringListModel(QStringList{"A", "B", "C", "D", "E", "F"}, this); + QTest::addRow("move_child") << tempModel << tempModel->index(0, 0) << 0 << 1 << QModelIndex() << 2; + tempModel = new QStringListModel(QStringList{"A", "B", "C", "D", "E", "F"}, this); + QTest::addRow("move_to_child") << tempModel << QModelIndex() << 0 << 1 << tempModel->index(0, 0) << 2; + tempModel = new QStringListModel(QStringList{"A", "B", "C", "D", "E", "F"}, this); + QTest::addRow("negative_count") << tempModel << QModelIndex() << 0 << -1 << QModelIndex() << 2; + tempModel = new QStringListModel(QStringList{"A", "B", "C", "D", "E", "F"}, this); + QTest::addRow("negative_source_row") << tempModel << QModelIndex() << -1 << 1 << QModelIndex() << 2; + tempModel = new QStringListModel(QStringList{"A", "B", "C", "D", "E", "F"}, this); + QTest::addRow("negative_destination_row") << tempModel << QModelIndex() << 0 << 1 << QModelIndex() << -1; + tempModel = new QStringListModel(QStringList{"A", "B", "C", "D", "E", "F"}, this); + QTest::addRow("source_row_equal_rowCount") << tempModel << QModelIndex() << tempModel->rowCount() << 1 << QModelIndex() << 1; + tempModel = new QStringListModel(QStringList{"A", "B", "C", "D", "E", "F"}, this); + QTest::addRow("destination_row_greater_rowCount") << tempModel << QModelIndex() << 0 << 1 << QModelIndex() << tempModel->rowCount() + 1; + tempModel = new QStringListModel(QStringList{"A", "B", "C", "D", "E", "F"}, this); + QTest::addRow("move_row_within_source_range") << tempModel << QModelIndex() << 0 << 3 << QModelIndex() << 2; + tempModel = new QStringListModel(QStringList{"A", "B", "C", "D", "E", "F"}, this); + QTest::addRow("destination_row_before_0") << tempModel << QModelIndex() << 1 << 1 << QModelIndex() << 0; +} + +void tst_QStringListModel::moveRowsInvalid() +{ + QFETCH(QStringListModel* const, baseModel); + QFETCH(const QModelIndex, startParent); + QFETCH(const int, startRow); + QFETCH(const int, count); + QFETCH(const QModelIndex, destinationParent); + QFETCH(const int, destination); + + QSignalSpy rowMovedSpy(baseModel, &QAbstractItemModel::rowsMoved); + QSignalSpy rowAboutMovedSpy(baseModel, &QAbstractItemModel::rowsAboutToBeMoved); + QVERIFY(rowMovedSpy.isValid()); + QVERIFY(rowAboutMovedSpy.isValid()); + QVERIFY(!baseModel->moveRows(startParent, startRow, count, destinationParent, destination)); + QCOMPARE(rowMovedSpy.size(), 0); + QCOMPARE(rowAboutMovedSpy.size(), 0); + delete baseModel; +} + +void tst_QStringListModel::moveRows_data() +{ + QTest::addColumn<int>("startRow"); + QTest::addColumn<int>("count"); + QTest::addColumn<int>("destination"); + QTest::addColumn<QStringList>("expected"); + + QTest::newRow("1_Item_from_top_to_middle") << 0 << 1 << 3 << QStringList{"B", "C", "A", "D", "E", "F"}; + QTest::newRow("1_Item_from_top_to_bottom") << 0 << 1 << 6 << QStringList{"B", "C", "D", "E", "F", "A"}; + QTest::newRow("1_Item_from_middle_to_top") << 2 << 1 << 1 << QStringList{"C", "A", "B", "D", "E", "F"}; + QTest::newRow("1_Item_from_bottom_to_middle") << 5 << 1 << 3 << QStringList{"A", "B", "F", "C", "D", "E"}; + QTest::newRow("1_Item_from_bottom to_top") << 5 << 1 << 1 << QStringList{"F", "A", "B", "C", "D", "E"}; + QTest::newRow("1_Item_from_middle_to_bottom") << 2 << 1 << 6 << QStringList{"A", "B", "D", "E", "F", "C"}; + QTest::newRow("1_Item_from_middle_to_middle_before") << 2 << 1 << 1 << QStringList{"C", "A", "B", "D", "E", "F"}; + QTest::newRow("1_Item_from_middle_to_middle_after") << 2 << 1 << 4 << QStringList{"A", "B", "D", "C", "E", "F"}; + + QTest::newRow("2_Items_from_top_to_middle") << 0 << 2 << 3 << QStringList{"C", "A", "B", "D", "E", "F"}; + QTest::newRow("2_Items_from_top_to_bottom") << 0 << 2 << 6 << QStringList{"C", "D", "E", "F", "A", "B"}; + QTest::newRow("2_Items_from_middle_to_top") << 2 << 2 << 1 << QStringList{"C", "D", "A", "B", "E", "F"}; + QTest::newRow("2_Items_from_bottom_to_middle") << 4 << 2 << 3 << QStringList{"A", "B", "E", "F", "C", "D"}; + QTest::newRow("2_Items_from_bottom_to_top") << 4 << 2 << 1 << QStringList{"E", "F", "A", "B", "C", "D"}; + QTest::newRow("2_Items_from_middle_to_bottom") << 2 << 2 << 6 << QStringList{"A", "B", "E", "F", "C", "D"}; + QTest::newRow("2_Items_from_middle_to_middle_before") << 3 << 2 << 2 << QStringList{"A", "D", "E", "B", "C", "F"}; + QTest::newRow("2_Items_from_middle_to_middle_after") << 1 << 2 << 5 << QStringList{"A", "D", "E", "B", "C", "F"}; +} + +void tst_QStringListModel::moveRows() +{ + QFETCH(const int, startRow); + QFETCH(const int, count); + QFETCH(const int, destination); + QFETCH(const QStringList, expected); + QStringListModel baseModel(QStringList{"A", "B", "C", "D", "E", "F"}); + QSignalSpy rowMovedSpy(&baseModel, &QAbstractItemModel::rowsMoved); + QSignalSpy rowAboutMovedSpy(&baseModel, &QAbstractItemModel::rowsAboutToBeMoved); + QVERIFY(baseModel.moveRows(QModelIndex(), startRow, count, QModelIndex(), destination)); + QCOMPARE(baseModel.stringList(), expected); + QCOMPARE(rowMovedSpy.size(), 1); + QCOMPARE(rowAboutMovedSpy.size(), 1); + for (const QList<QVariant> &signalArgs : {rowMovedSpy.first(), rowAboutMovedSpy.first()}){ + QVERIFY(!signalArgs.at(0).value<QModelIndex>().isValid()); + QCOMPARE(signalArgs.at(1).toInt(), startRow); + QCOMPARE(signalArgs.at(2).toInt(), startRow + count - 1); + QVERIFY(!signalArgs.at(3).value<QModelIndex>().isValid()); + QCOMPARE(signalArgs.at(4).toInt(), destination); + } +} + void tst_QStringListModel::rowsAboutToBeRemoved_rowsRemoved_data() { QTest::addColumn<QStringList>("input"); @@ -248,6 +356,74 @@ void tst_QStringListModel::setData_emits_both_roles() expected); } +void tst_QStringListModel::itemData() +{ + QStringListModel testModel{ QStringList { + QStringLiteral("One"), + QStringLiteral("Two"), + QStringLiteral("Three"), + QStringLiteral("Four"), + QStringLiteral("Five") + }}; + QMap<int, QVariant> compareMap; + QCOMPARE(testModel.itemData(QModelIndex()), compareMap); + compareMap.insert(Qt::DisplayRole, QStringLiteral("Two")); + compareMap.insert(Qt::EditRole, QStringLiteral("Two")); + QCOMPARE(testModel.itemData(testModel.index(1, 0)), compareMap); +} + +void tst_QStringListModel::setItemData() +{ + QStringListModel testModel{ QStringList { + QStringLiteral("One"), + QStringLiteral("Two"), + QStringLiteral("Three"), + QStringLiteral("Four"), + QStringLiteral("Five") + }}; + QSignalSpy dataChangedSpy(&testModel, &QAbstractItemModel::dataChanged); + QModelIndex changeIndex = testModel.index(1, 0); + const QVector<int> changeRoles{Qt::DisplayRole, Qt::EditRole}; + const QString changedString("Changed"); + QMap<int, QVariant> newItemData{std::make_pair<int>(Qt::DisplayRole, changedString)}; + // invalid index does nothing and returns false + QVERIFY(!testModel.setItemData(QModelIndex(), newItemData)); + // valid data is set, return value is true and dataChanged is emitted once + QVERIFY(testModel.setItemData(changeIndex, newItemData)); + QCOMPARE(changeIndex.data(Qt::DisplayRole).toString(), changedString); + QCOMPARE(changeIndex.data(Qt::EditRole).toString(), changedString); + QCOMPARE(dataChangedSpy.size(), 1); + QVariantList dataChangedArguments = dataChangedSpy.takeFirst(); + QCOMPARE(dataChangedArguments.at(0).value<QModelIndex>(), changeIndex); + QCOMPARE(dataChangedArguments.at(1).value<QModelIndex>(), changeIndex); + QCOMPARE(dataChangedArguments.at(2).value<QVector<int> >(), changeRoles); + // Unsupported roles do nothing return false + newItemData.clear(); + newItemData.insert(Qt::UserRole, changedString); + QVERIFY(!testModel.setItemData(changeIndex, newItemData)); + QCOMPARE(dataChangedSpy.size(), 0); + // If some but not all the roles are supported it returns false and does nothing + newItemData.insert(Qt::EditRole, changedString); + changeIndex = testModel.index(2, 0); + QVERIFY(!testModel.setItemData(changeIndex, newItemData)); + QCOMPARE(changeIndex.data(Qt::DisplayRole).toString(), QStringLiteral("Three")); + QCOMPARE(changeIndex.data(Qt::EditRole).toString(), QStringLiteral("Three")); + QCOMPARE(dataChangedSpy.size(), 0); + // Qt::EditRole and Qt::DisplayRole are both set, Qt::EditRole takes precedence + newItemData.clear(); + newItemData.insert(Qt::EditRole, changedString); + newItemData.insert(Qt::DisplayRole, QStringLiteral("Ignored")); + changeIndex = testModel.index(3, 0); + QVERIFY(testModel.setItemData(changeIndex, newItemData)); + QCOMPARE(changeIndex.data(Qt::DisplayRole).toString(), changedString); + QCOMPARE(changeIndex.data(Qt::EditRole).toString(), changedString); + QCOMPARE(dataChangedSpy.size(), 1); + dataChangedArguments = dataChangedSpy.takeFirst(); + QCOMPARE(dataChangedArguments.at(0).value<QModelIndex>(), changeIndex); + QCOMPARE(dataChangedArguments.at(1).value<QModelIndex>(), changeIndex); + QCOMPARE(dataChangedArguments.at(2).value<QVector<int> >(), changeRoles); +} + void tst_QStringListModel::setData_emits_on_change_only() { QStringListModel model(QStringList{QStringLiteral("one"), QStringLiteral("two")}); diff --git a/tests/auto/corelib/itemmodels/qtransposeproxymodel/qtransposeproxymodel.pro b/tests/auto/corelib/itemmodels/qtransposeproxymodel/qtransposeproxymodel.pro new file mode 100644 index 0000000000..3834add115 --- /dev/null +++ b/tests/auto/corelib/itemmodels/qtransposeproxymodel/qtransposeproxymodel.pro @@ -0,0 +1,6 @@ +CONFIG += testcase +TARGET = tst_qtransposeproxymodel +QT = core gui testlib + +SOURCES = tst_qtransposeproxymodel.cpp + diff --git a/tests/auto/corelib/itemmodels/qtransposeproxymodel/tst_qtransposeproxymodel.cpp b/tests/auto/corelib/itemmodels/qtransposeproxymodel/tst_qtransposeproxymodel.cpp new file mode 100644 index 0000000000..a30ac46571 --- /dev/null +++ b/tests/auto/corelib/itemmodels/qtransposeproxymodel/tst_qtransposeproxymodel.cpp @@ -0,0 +1,915 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Luca Beldi <v.ronin@yahoo.it> +** Contact: https://www.qt.io/licensing/ +** +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/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 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QTest> +#include <QSignalSpy> +#include <QStandardItemModel> +#include <QStringListModel> +#include <QAbstractItemModelTester> +#include <random> + +#include <qtransposeproxymodel.h> + +class tst_QTransposeProxyModel : public QObject +{ + Q_OBJECT +private Q_SLOTS: + void initTestCase(); + void index(); + void data(); + void setData_data(); + void setData(); + void parent(); + void mapToSource(); + void mapFromSource(); + void basicTest_data(); + void basicTest(); + void sort(); + void insertRowBase_data(); + void insertRowBase(); + void insertColumnBase_data(); + void insertColumnBase(); + void insertColumnProxy_data(); + void insertColumnProxy(); + void insertRowProxy_data(); + void insertRowProxy(); + void removeRowBase_data(); + void removeRowBase(); + void removeColumnBase_data(); + void removeColumnBase(); + void removeColumnProxy_data(); + void removeColumnProxy(); + void removeRowProxy_data(); + void removeRowProxy(); + void headerData(); + void setHeaderData(); + void span(); + void itemData(); + void setItemData(); + void moveRowsBase(); + void moveColumnsProxy(); +private: + void testTransposed( + const QAbstractItemModel *const baseModel, + const QAbstractItemModel *const transposed, + const QModelIndex &baseParent = QModelIndex(), + const QModelIndex &transposedParent = QModelIndex() + ); + QAbstractItemModel *createListModel(QObject *parent); + QAbstractItemModel *createTableModel(QObject *parent); + QAbstractItemModel *createTreeModel(QObject *parent); +}; + +QAbstractItemModel *tst_QTransposeProxyModel::createListModel(QObject *parent) +{ + QStringList sequence; + sequence.reserve(10); + for (int i = 0; i < 10; ++i) + sequence.append(QString::number(i)); + return new QStringListModel(sequence, parent); +} + +QAbstractItemModel *tst_QTransposeProxyModel::createTableModel(QObject *parent) +{ + QAbstractItemModel *model = new QStandardItemModel(parent); + model->insertRows(0, 5); + model->insertColumns(0, 4); + for (int i = 0; i < model->rowCount(); ++i) { + for (int j = 0; j < model->columnCount(); ++j) { + model->setData(model->index(i, j), QStringLiteral("%1,%2").arg(i).arg(j), Qt::EditRole); + model->setData(model->index(i, j), i, Qt::UserRole); + model->setData(model->index(i, j), j, Qt::UserRole + 1); + } + } + return model; +} + +QAbstractItemModel *tst_QTransposeProxyModel::createTreeModel(QObject *parent) +{ + QAbstractItemModel *model = new QStandardItemModel(parent); + model->insertRows(0, 5); + model->insertColumns(0, 4); + for (int i = 0; i < model->rowCount(); ++i) { + for (int j = 0; j < model->columnCount(); ++j) { + const QModelIndex parIdx = model->index(i, j); + model->setData(parIdx, QStringLiteral("%1,%2").arg(i).arg(j), Qt::EditRole); + model->setData(parIdx, i, Qt::UserRole); + model->setData(parIdx, j, Qt::UserRole + 1); + model->insertRows(0, 3, parIdx); + model->insertColumns(0, 2, parIdx); + for (int h = 0; h < model->rowCount(parIdx); ++h) { + for (int k = 0; k < model->columnCount(parIdx); ++k) { + const QModelIndex childIdx = model->index(h, k, parIdx); + model->setData(childIdx, QStringLiteral("%1,%2,%3,%4").arg(i).arg(j).arg(h).arg(k), Qt::EditRole); + model->setData(childIdx, i, Qt::UserRole); + model->setData(childIdx, j, Qt::UserRole + 1); + model->setData(childIdx, h, Qt::UserRole + 2); + model->setData(childIdx, k, Qt::UserRole + 3); + } + } + } + } + return model; +} + +void tst_QTransposeProxyModel::testTransposed( + const QAbstractItemModel *const baseModel, + const QAbstractItemModel *const transposed, + const QModelIndex &baseParent, + const QModelIndex &transposedParent +) +{ + QCOMPARE(transposed->hasChildren(transposedParent), baseModel->hasChildren(baseParent)); + QCOMPARE(transposed->columnCount(transposedParent), baseModel->rowCount(baseParent)); + QCOMPARE(transposed->rowCount(transposedParent), baseModel->columnCount(baseParent)); + for (int i = 0, maxRow = baseModel->rowCount(baseParent); i < maxRow; ++i) { + for (int j = 0, maxCol = baseModel->columnCount(baseParent); j < maxCol; ++j) { + const QModelIndex baseIdx = baseModel->index(i, j, baseParent); + const QModelIndex transIdx = transposed->index(j, i, transposedParent); + QCOMPARE(transIdx.data(), baseIdx.data()); + QCOMPARE(transIdx.data(Qt::UserRole), baseIdx.data(Qt::UserRole)); + QCOMPARE(transIdx.data(Qt::UserRole + 1), baseIdx.data(Qt::UserRole + 1)); + QCOMPARE(transIdx.data(Qt::UserRole + 2), baseIdx.data(Qt::UserRole + 2)); + QCOMPARE(transIdx.data(Qt::UserRole + 3), baseIdx.data(Qt::UserRole + 3)); + if (baseModel->hasChildren(baseIdx)) { + testTransposed(baseModel, transposed, baseIdx, transIdx); + } + } + } +} + +void tst_QTransposeProxyModel::initTestCase() +{ + qRegisterMetaType<QList<QPersistentModelIndex> >(); + qRegisterMetaType<QAbstractItemModel::LayoutChangeHint>(); +} + +void tst_QTransposeProxyModel::index() +{ + QAbstractItemModel *model = createTreeModel(this); + QTransposeProxyModel proxy; + new QAbstractItemModelTester(&proxy, &proxy); + proxy.setSourceModel(model); + QVERIFY(!proxy.index(0, -1).isValid()); + QVERIFY(!proxy.index(0, -1).isValid()); + QVERIFY(!proxy.index(-1, -1).isValid()); + QVERIFY(!proxy.index(0, proxy.columnCount()).isValid()); + QVERIFY(!proxy.index(proxy.rowCount(), 0).isValid()); + QVERIFY(!proxy.index(proxy.rowCount(), proxy.columnCount()).isValid()); + QModelIndex tempIdx = proxy.index(0, 1); + QVERIFY(tempIdx.isValid()); + QCOMPARE(tempIdx.row(), 0); + QCOMPARE(tempIdx.column(), 1); + tempIdx = proxy.index(0, 1, tempIdx); + QVERIFY(tempIdx.isValid()); + QCOMPARE(tempIdx.row(), 0); + QCOMPARE(tempIdx.column(), 1); + delete model; +} + +void tst_QTransposeProxyModel::data() +{ + QStringListModel model{QStringList{"A", "B"}}; + QTransposeProxyModel proxy; + new QAbstractItemModelTester(&proxy, &proxy); + proxy.setSourceModel(&model); + QCOMPARE(proxy.index(0, 1).data().toString(), QStringLiteral("B")); +} + +void tst_QTransposeProxyModel::parent() +{ + QAbstractItemModel *model = createTreeModel(this); + QTransposeProxyModel proxy; + new QAbstractItemModelTester(&proxy, &proxy); + proxy.setSourceModel(model); + const QModelIndex parentIdx = proxy.index(0, 0); + const QModelIndex childIdx = proxy.index(0, 0, parentIdx); + QVERIFY(parentIdx.isValid()); + QVERIFY(childIdx.isValid()); + QCOMPARE(childIdx.parent(), parentIdx); + delete model; +} + +void tst_QTransposeProxyModel::mapToSource() +{ + QAbstractItemModel *model = createTreeModel(this); + QTransposeProxyModel proxy; + new QAbstractItemModelTester(&proxy, &proxy); + proxy.setSourceModel(model); + QVERIFY(!proxy.mapToSource(QModelIndex()).isValid()); + QCOMPARE(proxy.mapToSource(proxy.index(0, 0)), model->index(0, 0)); + QCOMPARE(proxy.mapToSource(proxy.index(1, 0)), model->index(0, 1)); + QCOMPARE(proxy.mapToSource(proxy.index(0, 1)), model->index(1, 0)); + const QModelIndex proxyParent = proxy.index(1, 0); + const QModelIndex sourceParent = model->index(0, 1); + QCOMPARE(proxy.mapToSource(proxy.index(0, 0, proxyParent)), model->index(0, 0, sourceParent)); + QCOMPARE(proxy.mapToSource(proxy.index(1, 0, proxyParent)), model->index(0, 1, sourceParent)); + QCOMPARE(proxy.mapToSource(proxy.index(0, 1, proxyParent)), model->index(1, 0, sourceParent)); + delete model; +} + +void tst_QTransposeProxyModel::mapFromSource() +{ + QAbstractItemModel *model = createTreeModel(this); + QTransposeProxyModel proxy; + new QAbstractItemModelTester(&proxy, &proxy); + proxy.setSourceModel(model); + QVERIFY(!proxy.mapFromSource(QModelIndex()).isValid()); + QCOMPARE(proxy.mapFromSource(model->index(0, 0)), proxy.index(0, 0)); + QCOMPARE(proxy.mapFromSource(model->index(0, 1)), proxy.index(1, 0)); + QCOMPARE(proxy.mapFromSource(model->index(1, 0)), proxy.index(0, 1)); + const QModelIndex proxyParent = proxy.index(1, 0); + const QModelIndex sourceParent = model->index(0, 1); + QCOMPARE(proxy.mapToSource(proxy.index(0, 0, proxyParent)), model->index(0, 0, sourceParent)); + QCOMPARE(proxy.mapFromSource(model->index(1, 0, sourceParent)), proxy.index(0, 1, proxyParent)); + QCOMPARE(proxy.mapFromSource(model->index(0, 1, sourceParent)), proxy.index(1, 0, proxyParent)); + delete model; +} + +void tst_QTransposeProxyModel::basicTest_data() +{ + QTest::addColumn<QAbstractItemModel *>("model"); + QTest::newRow("List") << createListModel(this); + QTest::newRow("Table") << createTableModel(this); + QTest::newRow("Tree") << createTreeModel(this); +} + +void tst_QTransposeProxyModel::basicTest() +{ + QFETCH(QAbstractItemModel *, model); + QTransposeProxyModel proxy; + new QAbstractItemModelTester(&proxy, &proxy); + proxy.setSourceModel(model); + testTransposed(model, &proxy); + delete model; +} + +void tst_QTransposeProxyModel::sort() +{ + QStringList sequence; + sequence.reserve(100); + for (int i = 0; i < 100; ++i) + sequence.append(QStringLiteral("%1").arg(i, 3, 10, QLatin1Char('0'))); + std::shuffle(sequence.begin(), sequence.end(), std::mt19937(88)); + const QString firstItemBeforeSort = sequence.first(); + QStringListModel baseModel(sequence); + QTransposeProxyModel proxyModel; + new QAbstractItemModelTester(&proxyModel, &proxyModel); + proxyModel.setSourceModel(&baseModel); + QSignalSpy layoutChangedSpy(&proxyModel, &QAbstractItemModel::layoutChanged); + QVERIFY(layoutChangedSpy.isValid()); + QSignalSpy layoutAboutToBeChangedSpy(&proxyModel, &QAbstractItemModel::layoutAboutToBeChanged); + QVERIFY(layoutAboutToBeChangedSpy.isValid()); + QPersistentModelIndex firstIndexBeforeSort = proxyModel.index(0, 0); + baseModel.sort(0, Qt::AscendingOrder); + QCOMPARE(layoutChangedSpy.count(), 1); + QCOMPARE(layoutAboutToBeChangedSpy.count(), 1); + QCOMPARE(layoutChangedSpy.takeFirst().at(1).toInt(), int(QAbstractItemModel::HorizontalSortHint)); + QCOMPARE(firstIndexBeforeSort.data().toString(), firstItemBeforeSort); + for (int i = 0; i < 100; ++i) + QCOMPARE(proxyModel.index(0, i).data().toInt(), i); +} + +void tst_QTransposeProxyModel::removeColumnBase_data() +{ + QTest::addColumn<QAbstractItemModel *>("model"); + QTest::addColumn<QModelIndex>("parent"); + QTest::newRow("Table") << createTableModel(this) << QModelIndex(); + QTest::newRow("Tree_Root_Item") << createTreeModel(this) << QModelIndex(); + QAbstractItemModel *model = createTreeModel(this); + QTest::newRow("Tree_Child_Item") << model << model->index(0, 0); +} + +void tst_QTransposeProxyModel::removeColumnBase() +{ + QFETCH(QAbstractItemModel * const, model); + QFETCH(const QModelIndex, parent); + QTransposeProxyModel proxy; + QSignalSpy rowRemoveSpy(&proxy, &QAbstractItemModel::rowsRemoved); + QVERIFY(rowRemoveSpy.isValid()); + QSignalSpy rowAboutToBeRemoveSpy(&proxy, &QAbstractItemModel::rowsAboutToBeRemoved); + QVERIFY(rowAboutToBeRemoveSpy.isValid()); + new QAbstractItemModelTester(&proxy, &proxy); + proxy.setSourceModel(model); + const int oldRowCount = proxy.rowCount(proxy.mapFromSource(parent)); + const QVariant expectedNewVal = model->index(0, 2, parent).data(); + QVERIFY(model->removeColumn(1, parent)); + QCOMPARE(proxy.rowCount(proxy.mapFromSource(parent)), oldRowCount - 1); + QCOMPARE(proxy.index(1, 0, proxy.mapFromSource(parent)).data(), expectedNewVal); + QCOMPARE(rowRemoveSpy.count(), 1); + QCOMPARE(rowAboutToBeRemoveSpy.count(), 1); + for (const auto &spyArgs : {rowRemoveSpy.takeFirst(), + rowAboutToBeRemoveSpy.takeFirst()}) { + QCOMPARE(spyArgs.at(0).value<QModelIndex>(), proxy.mapFromSource(parent)); + QCOMPARE(spyArgs.at(1).toInt(), 1); + QCOMPARE(spyArgs.at(2).toInt(), 1); + } + delete model; +} + +void tst_QTransposeProxyModel::insertColumnBase_data() +{ + QTest::addColumn<QAbstractItemModel *>("model"); + QTest::addColumn<QModelIndex>("parent"); + QTest::newRow("Table") << createTableModel(this) << QModelIndex(); + QTest::newRow("Tree_Root_Item") << createTreeModel(this) << QModelIndex(); + QAbstractItemModel *model = createTreeModel(this); + QTest::newRow("Tree_Child_Item") << model << model->index(0, 0); +} + +void tst_QTransposeProxyModel::insertColumnBase() +{ + QFETCH(QAbstractItemModel * const, model); + QFETCH(const QModelIndex, parent); + QTransposeProxyModel proxy; + QSignalSpy rowInsertSpy(&proxy, &QAbstractItemModel::rowsInserted); + QVERIFY(rowInsertSpy.isValid()); + QSignalSpy rowAboutToBeInsertSpy(&proxy, &QAbstractItemModel::rowsAboutToBeInserted); + QVERIFY(rowAboutToBeInsertSpy.isValid()); + new QAbstractItemModelTester(&proxy, &proxy); + proxy.setSourceModel(model); + const int oldRowCount = proxy.rowCount(proxy.mapFromSource(parent)); + QVERIFY(model->insertColumn(1, parent)); + QCOMPARE(proxy.rowCount(proxy.mapFromSource(parent)), oldRowCount + 1); + QVERIFY(!proxy.index(1, 0, proxy.mapFromSource(parent)).data().isValid()); + QCOMPARE(rowInsertSpy.count(), 1); + QCOMPARE(rowAboutToBeInsertSpy.count(), 1); + for (const auto &spyArgs : {rowInsertSpy.takeFirst(), + rowAboutToBeInsertSpy.takeFirst()}) { + QCOMPARE(spyArgs.at(0).value<QModelIndex>(), proxy.mapFromSource(parent)); + QCOMPARE(spyArgs.at(1).toInt(), 1); + QCOMPARE(spyArgs.at(2).toInt(), 1); + } + delete model; +} + +void tst_QTransposeProxyModel::removeRowBase_data() +{ + QTest::addColumn<QAbstractItemModel *>("model"); + QTest::addColumn<QModelIndex>("parent"); + QTest::newRow("List") << createListModel(this) << QModelIndex(); + QTest::newRow("Table") << createTableModel(this) << QModelIndex(); + QTest::newRow("Tree_Root_Item") << createTreeModel(this) << QModelIndex(); + QAbstractItemModel *model = createTreeModel(this); + QTest::newRow("Tree_Child_Item") << model << model->index(0, 0); +} + +void tst_QTransposeProxyModel::removeRowBase() +{ + QFETCH(QAbstractItemModel * const, model); + QFETCH(const QModelIndex, parent); + QTransposeProxyModel proxy; + QSignalSpy columnsRemoveSpy(&proxy, &QAbstractItemModel::columnsRemoved); + QVERIFY(columnsRemoveSpy.isValid()); + QSignalSpy columnsAboutToBeRemoveSpy(&proxy, &QAbstractItemModel::columnsAboutToBeRemoved); + QVERIFY(columnsAboutToBeRemoveSpy.isValid()); + new QAbstractItemModelTester(&proxy, &proxy); + proxy.setSourceModel(model); + const int oldColCount = proxy.columnCount(proxy.mapFromSource(parent)); + const QVariant expectedNewVal = model->index(2, 0, parent).data(); + QVERIFY(model->removeRow(1, parent)); + QCOMPARE(proxy.columnCount(proxy.mapFromSource(parent)), oldColCount - 1); + QCOMPARE(proxy.index(0, 1, proxy.mapFromSource(parent)).data(), expectedNewVal); + QCOMPARE(columnsRemoveSpy.count(), 1); + QCOMPARE(columnsAboutToBeRemoveSpy.count(), 1); + for (const auto &spyArgs : {columnsRemoveSpy.takeFirst(), + columnsAboutToBeRemoveSpy.takeFirst()}) { + QCOMPARE(spyArgs.at(0).value<QModelIndex>(), proxy.mapFromSource(parent)); + QCOMPARE(spyArgs.at(1).toInt(), 1); + QCOMPARE(spyArgs.at(2).toInt(), 1); + } + delete model; +} + +void tst_QTransposeProxyModel::insertRowBase_data() +{ + QTest::addColumn<QAbstractItemModel *>("model"); + QTest::addColumn<QModelIndex>("parent"); + QTest::newRow("List") << createListModel(this) << QModelIndex(); + QTest::newRow("Table") << createTableModel(this) << QModelIndex(); + QTest::newRow("Tree_Root_Item") << createTreeModel(this) << QModelIndex(); + QAbstractItemModel *model = createTreeModel(this); + QTest::newRow("Tree_Child_Item") << model << model->index(0, 0); +} + +void tst_QTransposeProxyModel::insertRowBase() +{ + QFETCH(QAbstractItemModel * const, model); + QFETCH(const QModelIndex, parent); + QTransposeProxyModel proxy; + QSignalSpy columnsInsertSpy(&proxy, &QAbstractItemModel::columnsInserted); + QVERIFY(columnsInsertSpy.isValid()); + QSignalSpy columnsAboutToBeInsertSpy(&proxy, &QAbstractItemModel::columnsAboutToBeInserted); + QVERIFY(columnsAboutToBeInsertSpy.isValid()); + new QAbstractItemModelTester(&proxy, &proxy); + proxy.setSourceModel(model); + const int oldColCount = proxy.columnCount(proxy.mapFromSource(parent)); + QVERIFY(model->insertRow(1, parent)); + QCOMPARE(proxy.columnCount(proxy.mapFromSource(parent)), oldColCount + 1); + QVERIFY(proxy.index(0, 1, proxy.mapFromSource(parent)).data().isNull()); + QCOMPARE(columnsInsertSpy.count(), 1); + QCOMPARE(columnsAboutToBeInsertSpy.count(), 1); + for (const auto &spyArgs : {columnsInsertSpy.takeFirst(), + columnsAboutToBeInsertSpy.takeFirst()}) { + QCOMPARE(spyArgs.at(0).value<QModelIndex>(), proxy.mapFromSource(parent)); + QCOMPARE(spyArgs.at(1).toInt(), 1); + QCOMPARE(spyArgs.at(2).toInt(), 1); + } + delete model; +} + +void tst_QTransposeProxyModel::removeColumnProxy_data() +{ + QTest::addColumn<QAbstractItemModel *>("model"); + QTest::addColumn<bool>("rootItem"); + QTest::newRow("List") << createListModel(this) << true; + QTest::newRow("Table") << createTableModel(this) << true; + QTest::newRow("Tree_Root_Item") << createTreeModel(this) << true; + QTest::newRow("Tree_Child_Item") << createTreeModel(this) << false; +} + +void tst_QTransposeProxyModel::removeColumnProxy() +{ + QFETCH(QAbstractItemModel *, model); + QFETCH(bool, rootItem); + QTransposeProxyModel proxy; + new QAbstractItemModelTester(&proxy, &proxy); + QSignalSpy columnsRemoveSpy(&proxy, &QAbstractItemModel::columnsRemoved); + QVERIFY(columnsRemoveSpy.isValid()); + QSignalSpy columnsAboutToBeRemoveSpy(&proxy, &QAbstractItemModel::columnsAboutToBeRemoved); + QVERIFY(columnsAboutToBeRemoveSpy.isValid()); + QSignalSpy rowsRemoveSpy(model, &QAbstractItemModel::rowsRemoved); + QVERIFY(rowsRemoveSpy.isValid()); + QSignalSpy rowsAboutToBeRemoveSpy(model, &QAbstractItemModel::rowsAboutToBeRemoved); + QVERIFY(rowsAboutToBeRemoveSpy.isValid()); + proxy.setSourceModel(model); + const QModelIndex proxyParent = rootItem ? QModelIndex() : proxy.index(0, 1); + const QModelIndex sourceParent = proxy.mapToSource(proxyParent); + const int oldColCount = proxy.columnCount(proxyParent); + const int oldRowCount = model->rowCount(sourceParent); + const QVariant expectedNewVal = proxy.index(0, 2, proxyParent).data(); + QVERIFY(proxy.removeColumn(1, proxyParent)); + QCOMPARE(proxy.columnCount(proxyParent), oldColCount - 1); + QCOMPARE(model->rowCount(sourceParent), oldRowCount - 1); + QCOMPARE(proxy.index(0, 1, proxyParent).data(), expectedNewVal); + QCOMPARE(model->index(1, 0, sourceParent).data(), expectedNewVal); + QCOMPARE(columnsRemoveSpy.count(), 1); + QCOMPARE(columnsAboutToBeRemoveSpy.count(), 1); + QCOMPARE(rowsRemoveSpy.count(), 1); + QCOMPARE(rowsAboutToBeRemoveSpy.count(), 1); + for (const auto &spyArgs : {columnsRemoveSpy.takeFirst(), + columnsAboutToBeRemoveSpy.takeFirst()}) { + QCOMPARE(spyArgs.at(0).value<QModelIndex>(), proxyParent); + QCOMPARE(spyArgs.at(1).toInt(), 1); + QCOMPARE(spyArgs.at(2).toInt(), 1); + } + for (const auto &spyArgs : {rowsRemoveSpy.takeFirst(), + rowsAboutToBeRemoveSpy.takeFirst()}) { + QCOMPARE(spyArgs.at(0).value<QModelIndex>(), sourceParent); + QCOMPARE(spyArgs.at(1).toInt(), 1); + QCOMPARE(spyArgs.at(2).toInt(), 1); + } + delete model; +} + +void tst_QTransposeProxyModel::insertColumnProxy_data() +{ + QTest::addColumn<QAbstractItemModel *>("model"); + QTest::addColumn<bool>("rootItem"); + QTest::newRow("List") << createListModel(this) << true; + QTest::newRow("Table") << createTableModel(this) << true; + QTest::newRow("Tree_Root_Item") << createTreeModel(this) << true; + QTest::newRow("Tree_Child_Item") << createTreeModel(this) << false; +} + +void tst_QTransposeProxyModel::insertColumnProxy() +{ + QFETCH(QAbstractItemModel *, model); + QFETCH(bool, rootItem); + QTransposeProxyModel proxy; + new QAbstractItemModelTester(&proxy, &proxy); + QSignalSpy columnsInsertSpy(&proxy, &QAbstractItemModel::columnsInserted); + QVERIFY(columnsInsertSpy.isValid()); + QSignalSpy columnsAboutToBeInsertSpy(&proxy, &QAbstractItemModel::columnsAboutToBeInserted); + QVERIFY(columnsAboutToBeInsertSpy.isValid()); + QSignalSpy rowsInsertSpy(model, &QAbstractItemModel::rowsInserted); + QVERIFY(rowsInsertSpy.isValid()); + QSignalSpy rowsAboutToBeInsertSpy(model, &QAbstractItemModel::rowsAboutToBeInserted); + QVERIFY(rowsAboutToBeInsertSpy.isValid()); + proxy.setSourceModel(model); + const QModelIndex proxyParent = rootItem ? QModelIndex() : proxy.index(0, 1); + const QModelIndex sourceParent = proxy.mapToSource(proxyParent); + const int oldColCount = proxy.columnCount(proxyParent); + const int oldRowCount = model->rowCount(sourceParent); + QVERIFY(proxy.insertColumn(1, proxyParent)); + QCOMPARE(proxy.columnCount(proxyParent), oldColCount + 1); + QCOMPARE(model->rowCount(sourceParent), oldRowCount + 1); + QVERIFY(proxy.index(0, 1, proxyParent).data().isNull()); + QVERIFY(model->index(1, 0, sourceParent).data().isNull()); + QCOMPARE(columnsInsertSpy.count(), 1); + QCOMPARE(columnsAboutToBeInsertSpy.count(), 1); + QCOMPARE(rowsInsertSpy.count(), 1); + QCOMPARE(rowsAboutToBeInsertSpy.count(), 1); + for (const auto &spyArgs : {columnsInsertSpy.takeFirst(), + columnsAboutToBeInsertSpy.takeFirst()}) { + QCOMPARE(spyArgs.at(0).value<QModelIndex>(), proxyParent); + QCOMPARE(spyArgs.at(1).toInt(), 1); + QCOMPARE(spyArgs.at(2).toInt(), 1); + } + for (const auto &spyArgs : {rowsInsertSpy.takeFirst(), + rowsAboutToBeInsertSpy.takeFirst()}) { + QCOMPARE(spyArgs.at(0).value<QModelIndex>(), sourceParent); + QCOMPARE(spyArgs.at(1).toInt(), 1); + QCOMPARE(spyArgs.at(2).toInt(), 1); + } + delete model; +} + +void tst_QTransposeProxyModel::removeRowProxy_data() +{ + QTest::addColumn<QAbstractItemModel *>("model"); + QTest::addColumn<bool>("rootItem"); + QTest::newRow("Table") << createTableModel(this) << true; + QTest::newRow("Tree_Root_Item") << createTreeModel(this) << true; + QTest::newRow("Tree_Child_Item") << createTreeModel(this) << false; +} + +void tst_QTransposeProxyModel::removeRowProxy() +{ + QFETCH(QAbstractItemModel *, model); + QFETCH(bool, rootItem); + QTransposeProxyModel proxy; + new QAbstractItemModelTester(&proxy, &proxy); + QSignalSpy rowsRemoveSpy(&proxy, &QAbstractItemModel::rowsRemoved); + QVERIFY(rowsRemoveSpy.isValid()); + QSignalSpy rowsAboutToBeRemoveSpy(&proxy, &QAbstractItemModel::rowsAboutToBeRemoved); + QVERIFY(rowsAboutToBeRemoveSpy.isValid()); + QSignalSpy columnsRemoveSpy(model, &QAbstractItemModel::columnsRemoved); + QVERIFY(columnsRemoveSpy.isValid()); + QSignalSpy columnsAboutToBeRemoveSpy(model, &QAbstractItemModel::columnsAboutToBeRemoved); + QVERIFY(columnsAboutToBeRemoveSpy.isValid()); + proxy.setSourceModel(model); + const QModelIndex proxyParent = rootItem ? QModelIndex() : proxy.index(0, 1); + const QModelIndex sourceParent = proxy.mapToSource(proxyParent); + const int oldRowCount = proxy.rowCount(proxyParent); + const int oldColCount = model->columnCount(sourceParent); + const QVariant expectedNewVal = proxy.index(2, 0, proxyParent).data(); + QVERIFY(proxy.removeRow(1, proxyParent)); + QCOMPARE(proxy.rowCount(proxyParent), oldRowCount - 1); + QCOMPARE(model->columnCount(sourceParent), oldColCount - 1); + QCOMPARE(proxy.index(1, 0, proxyParent).data(), expectedNewVal); + QCOMPARE(model->index(0, 1, sourceParent).data(), expectedNewVal); + QCOMPARE(columnsRemoveSpy.count(), 1); + QCOMPARE(columnsAboutToBeRemoveSpy.count(), 1); + QCOMPARE(rowsRemoveSpy.count(), 1); + QCOMPARE(rowsAboutToBeRemoveSpy.count(), 1); + for (const auto &spyArgs : {columnsRemoveSpy.takeFirst(), + columnsAboutToBeRemoveSpy.takeFirst()}) { + QCOMPARE(spyArgs.at(0).value<QModelIndex>(), sourceParent); + QCOMPARE(spyArgs.at(1).toInt(), 1); + QCOMPARE(spyArgs.at(2).toInt(), 1); + } + for (const auto &spyArgs : {rowsRemoveSpy.takeFirst(), + rowsAboutToBeRemoveSpy.takeFirst()}) { + QCOMPARE(spyArgs.at(0).value<QModelIndex>(), proxyParent); + QCOMPARE(spyArgs.at(1).toInt(), 1); + QCOMPARE(spyArgs.at(2).toInt(), 1); + } + delete model; +} + +void tst_QTransposeProxyModel::insertRowProxy_data() +{ + QTest::addColumn<QAbstractItemModel *>("model"); + QTest::addColumn<bool>("rootItem"); + QTest::newRow("Table") << createTableModel(this) << true; + QTest::newRow("Tree_Root_Item") << createTreeModel(this) << true; + QTest::newRow("Tree_Child_Item") << createTreeModel(this) << false; +} + +void tst_QTransposeProxyModel::insertRowProxy() +{ + QFETCH(QAbstractItemModel *, model); + QFETCH(bool, rootItem); + QTransposeProxyModel proxy; + new QAbstractItemModelTester(&proxy, &proxy); + QSignalSpy rowsInsertSpy(&proxy, &QAbstractItemModel::rowsInserted); + QVERIFY(rowsInsertSpy.isValid()); + QSignalSpy rowsAboutToBeInsertSpy(&proxy, &QAbstractItemModel::rowsAboutToBeInserted); + QVERIFY(rowsAboutToBeInsertSpy.isValid()); + QSignalSpy columnsInsertSpy(model, &QAbstractItemModel::columnsInserted); + QVERIFY(columnsInsertSpy.isValid()); + QSignalSpy columnsAboutToBeInsertSpy(model, &QAbstractItemModel::columnsAboutToBeInserted); + QVERIFY(columnsAboutToBeInsertSpy.isValid()); + proxy.setSourceModel(model); + const QModelIndex proxyParent = rootItem ? QModelIndex() : proxy.index(0, 1); + const QModelIndex sourceParent = proxy.mapToSource(proxyParent); + const int oldRowCount = proxy.rowCount(proxyParent); + const int oldColCount = model->columnCount(sourceParent); + QVERIFY(proxy.insertRow(1, proxyParent)); + QCOMPARE(proxy.rowCount(proxyParent), oldRowCount + 1); + QCOMPARE(model->columnCount(sourceParent), oldColCount + 1); + QVERIFY(proxy.index(1, 0, proxyParent).data().isNull()); + QVERIFY(model->index(0, 1, sourceParent).data().isNull()); + QCOMPARE(columnsInsertSpy.count(), 1); + QCOMPARE(columnsAboutToBeInsertSpy.count(), 1); + QCOMPARE(rowsInsertSpy.count(), 1); + QCOMPARE(rowsAboutToBeInsertSpy.count(), 1); + for (const auto &spyArgs : {columnsInsertSpy.takeFirst(), + columnsAboutToBeInsertSpy.takeFirst()}) { + QCOMPARE(spyArgs.at(0).value<QModelIndex>(), sourceParent); + QCOMPARE(spyArgs.at(1).toInt(), 1); + QCOMPARE(spyArgs.at(2).toInt(), 1); + } + for (const auto &spyArgs : {rowsInsertSpy.takeFirst(), + rowsAboutToBeInsertSpy.takeFirst()}) { + QCOMPARE(spyArgs.at(0).value<QModelIndex>(), proxyParent); + QCOMPARE(spyArgs.at(1).toInt(), 1); + QCOMPARE(spyArgs.at(2).toInt(), 1); + } + delete model; +} + +void tst_QTransposeProxyModel::headerData() +{ + QStandardItemModel model; + model.insertRows(0, 3); + model.insertColumns(0, 5); + for (int i = 0; i < model.rowCount(); ++i) + model.setHeaderData(i, Qt::Horizontal, QChar('A' + i)); + for (int i = 1; i <= model.columnCount(); ++i) + model.setHeaderData(i, Qt::Vertical, i); + QTransposeProxyModel proxy; + new QAbstractItemModelTester(&proxy, &proxy); + proxy.setSourceModel(&model); + for (int i = 0; i < model.rowCount(); ++i) + QCOMPARE(model.headerData(i, Qt::Horizontal), proxy.headerData(i, Qt::Vertical)); + for (int i = 0; i < model.columnCount(); ++i) + QCOMPARE(model.headerData(i, Qt::Vertical), proxy.headerData(i, Qt::Horizontal)); +} + +void tst_QTransposeProxyModel::setHeaderData() +{ + QStandardItemModel model; + model.insertRows(0, 3); + model.insertColumns(0, 5); + for (int i = 0; i < model.rowCount(); ++i) + model.setHeaderData(i, Qt::Horizontal, QChar('A' + i)); + for (int i = 1; i <= model.columnCount(); ++i) + model.setHeaderData(i, Qt::Vertical, i); + QTransposeProxyModel proxy; + new QAbstractItemModelTester(&proxy, &proxy); + proxy.setSourceModel(&model); + QVERIFY(proxy.setHeaderData(1, Qt::Horizontal, 99)); + QCOMPARE(model.headerData(1, Qt::Vertical).toInt(), 99); + QVERIFY(proxy.setHeaderData(1, Qt::Vertical, QChar('Z'))); + QCOMPARE(model.headerData(1, Qt::Horizontal).toChar(), QChar('Z')); +} + +void tst_QTransposeProxyModel::span() +{ + class SpanModel : public QStandardItemModel + { + Q_DISABLE_COPY(SpanModel) + public: + SpanModel(int rows, int columns, QObject *parent = nullptr) + : QStandardItemModel(rows, columns, parent) + {} + QSize span(const QModelIndex &index) const override + { + Q_UNUSED(index) + return QSize(2, 1); + } + }; + SpanModel model(3, 5); + QTransposeProxyModel proxy; + new QAbstractItemModelTester(&proxy, &proxy); + proxy.setSourceModel(&model); + QCOMPARE(proxy.span(proxy.index(0, 0)), QSize(1, 2)); +} + +void tst_QTransposeProxyModel::itemData() +{ + QAbstractItemModel *model = createTreeModel(this); + QTransposeProxyModel proxy; + new QAbstractItemModelTester(&proxy, &proxy); + proxy.setSourceModel(model); + QMap<int, QVariant> itmData = proxy.itemData(proxy.index(0, 1)); + QCOMPARE(itmData.value(Qt::DisplayRole).toString(), QStringLiteral("1,0")); + QCOMPARE(itmData.value(Qt::UserRole).toInt(), 1); + QCOMPARE(itmData.value(Qt::UserRole + 1).toInt(), 0); + itmData = proxy.itemData(proxy.index(1, 2, proxy.index(0, 1))); + QCOMPARE(itmData.value(Qt::DisplayRole).toString(), QStringLiteral("1,0,2,1")); + QCOMPARE(itmData.value(Qt::UserRole).toInt(), 1); + QCOMPARE(itmData.value(Qt::UserRole + 1).toInt(), 0); + QCOMPARE(itmData.value(Qt::UserRole + 2).toInt(), 2); + QCOMPARE(itmData.value(Qt::UserRole + 3).toInt(), 1); + QVERIFY(proxy.itemData(QModelIndex()).isEmpty()); + delete model; +} + +void tst_QTransposeProxyModel::setItemData() +{ + QAbstractItemModel *model = createTreeModel(this); + QTransposeProxyModel proxy; + new QAbstractItemModelTester(&proxy, &proxy); + proxy.setSourceModel(model); + QSignalSpy sourceDataChangeSpy(model, &QAbstractItemModel::dataChanged); + QVERIFY(sourceDataChangeSpy.isValid()); + QSignalSpy proxyDataChangeSpy(&proxy, &QAbstractItemModel::dataChanged); + QVERIFY(proxyDataChangeSpy.isValid()); + const QMap<int, QVariant> itmData = { + std::make_pair<int, QVariant>(Qt::DisplayRole, QStringLiteral("Test")), + std::make_pair<int, QVariant>(Qt::UserRole, 88), + std::make_pair<int, QVariant>(Qt::UserRole + 1, 99), + }; + QModelIndex idx = proxy.index(0, 1); + QVERIFY(proxy.setItemData(idx, itmData)); + QCOMPARE(idx.data(Qt::DisplayRole).toString(), QStringLiteral("Test")); + QCOMPARE(idx.data(Qt::UserRole).toInt(), 88); + QCOMPARE(idx.data(Qt::UserRole + 1).toInt(), 99); + QCOMPARE(sourceDataChangeSpy.size(), 1); + QCOMPARE(proxyDataChangeSpy.size(), 1); + auto signalData = proxyDataChangeSpy.takeFirst(); + QCOMPARE(signalData.at(0).value<QModelIndex>(), idx); + QCOMPARE(signalData.at(1).value<QModelIndex>(), idx); + const QVector<int> expectedRoles{Qt::DisplayRole, Qt::UserRole, Qt::EditRole, Qt::UserRole + 1}; + QVector<int> receivedRoles = signalData.at(2).value<QVector<int> >(); + QCOMPARE(receivedRoles.size(), expectedRoles.size()); + for (int role : expectedRoles) + QVERIFY(receivedRoles.contains(role)); + signalData = sourceDataChangeSpy.takeFirst(); + QCOMPARE(signalData.at(0).value<QModelIndex>(), proxy.mapToSource(idx)); + QCOMPARE(signalData.at(1).value<QModelIndex>(), proxy.mapToSource(idx)); + receivedRoles = signalData.at(2).value<QVector<int> >(); + QCOMPARE(receivedRoles.size(), expectedRoles.size()); + for (int role : expectedRoles) + QVERIFY(receivedRoles.contains(role)); + idx = proxy.index(1, 2, proxy.index(0, 1)); + QVERIFY(proxy.setItemData(idx, itmData)); + QCOMPARE(idx.data(Qt::DisplayRole).toString(), QStringLiteral("Test")); + QCOMPARE(idx.data(Qt::UserRole).toInt(), 88); + QCOMPARE(idx.data(Qt::UserRole + 1).toInt(), 99); + QCOMPARE(idx.data(Qt::UserRole + 2).toInt(), 2); + QCOMPARE(idx.data(Qt::UserRole + 3).toInt(), 1); + QCOMPARE(sourceDataChangeSpy.size(), 1); + QCOMPARE(proxyDataChangeSpy.size(), 1); + signalData = proxyDataChangeSpy.takeFirst(); + QCOMPARE(signalData.at(0).value<QModelIndex>(), idx); + QCOMPARE(signalData.at(1).value<QModelIndex>(), idx); + receivedRoles = signalData.at(2).value<QVector<int> >(); + QCOMPARE(receivedRoles.size(), expectedRoles.size()); + for (int role : expectedRoles) + QVERIFY(receivedRoles.contains(role)); + signalData = sourceDataChangeSpy.takeFirst(); + QCOMPARE(signalData.at(0).value<QModelIndex>(), proxy.mapToSource(idx)); + QCOMPARE(signalData.at(1).value<QModelIndex>(), proxy.mapToSource(idx)); + receivedRoles = signalData.at(2).value<QVector<int> >(); + QCOMPARE(receivedRoles.size(), expectedRoles.size()); + for (int role : expectedRoles) + QVERIFY(receivedRoles.contains(role)); + QVERIFY(!proxy.setItemData(QModelIndex(), itmData)); + delete model; +} + +void tst_QTransposeProxyModel::moveRowsBase() +{ + QStringListModel model{QStringList{"A", "B", "C", "D"}}; + QTransposeProxyModel proxy; + QSignalSpy columnsMoveSpy(&proxy, &QAbstractItemModel::columnsMoved); + QVERIFY(columnsMoveSpy.isValid()); + QSignalSpy columnsAboutToBeMoveSpy(&proxy, &QAbstractItemModel::columnsAboutToBeMoved); + QVERIFY(columnsAboutToBeMoveSpy.isValid()); + new QAbstractItemModelTester(&proxy, &proxy); + proxy.setSourceModel(&model); + const QStringList expectedNewVal = {"B", "A", "C", "D"}; + QVERIFY(model.moveRows(QModelIndex(), 0, 1, QModelIndex(), 2)); + for (int i = 0; i < expectedNewVal.size(); ++i) + QCOMPARE(proxy.index(0, i).data(), expectedNewVal.at(i)); + QCOMPARE(columnsMoveSpy.count(), 1); + QCOMPARE(columnsAboutToBeMoveSpy.count(), 1); + for (const auto &spyArgs : {columnsMoveSpy.takeFirst(), + columnsAboutToBeMoveSpy.takeFirst()}) { + QVERIFY(!spyArgs.at(0).value<QModelIndex>().isValid()); + QCOMPARE(spyArgs.at(1).toInt(), 0); + QCOMPARE(spyArgs.at(2).toInt(), 0); + QVERIFY(!spyArgs.at(3).value<QModelIndex>().isValid()); + QCOMPARE(spyArgs.at(4).toInt(), 2); + } +} + +void tst_QTransposeProxyModel::moveColumnsProxy() +{ + QStringListModel model{QStringList{"A", "B", "C", "D"}}; + QTransposeProxyModel proxy; + new QAbstractItemModelTester(&proxy, &proxy); + QSignalSpy columnsMoveSpy(&proxy, &QAbstractItemModel::columnsMoved); + QVERIFY(columnsMoveSpy.isValid()); + QSignalSpy columnsAboutToBeMoveSpy(&proxy, &QAbstractItemModel::columnsAboutToBeMoved); + QVERIFY(columnsAboutToBeMoveSpy.isValid()); + QSignalSpy rowsMoveSpy(&model, &QAbstractItemModel::rowsMoved); + QVERIFY(rowsMoveSpy.isValid()); + QSignalSpy rowsAboutToBeMoveSpy(&model, &QAbstractItemModel::rowsAboutToBeMoved); + QVERIFY(rowsAboutToBeMoveSpy.isValid()); + proxy.setSourceModel(&model); + const QStringList expectedNewVal = {"B", "A", "C", "D"}; + QVERIFY(proxy.moveColumns(QModelIndex(), 0, 1, QModelIndex(), 2)); + for (int i = 0; i < expectedNewVal.size(); ++i) + QCOMPARE(proxy.index(0, i).data(), expectedNewVal.at(i)); + for (int i = 0; i < expectedNewVal.size(); ++i) + QCOMPARE(model.index(i, 0).data(), expectedNewVal.at(i)); + QCOMPARE(columnsMoveSpy.count(), 1); + QCOMPARE(columnsAboutToBeMoveSpy.count(), 1); + QCOMPARE(rowsMoveSpy.count(), 1); + QCOMPARE(rowsAboutToBeMoveSpy.count(), 1); + for (const auto &spyArgs : {columnsMoveSpy.takeFirst(), + columnsAboutToBeMoveSpy.takeFirst(), + rowsMoveSpy.takeFirst(),rowsAboutToBeMoveSpy.takeFirst()}) { + QVERIFY(!spyArgs.at(0).value<QModelIndex>().isValid()); + QCOMPARE(spyArgs.at(1).toInt(), 0); + QCOMPARE(spyArgs.at(2).toInt(), 0); + QVERIFY(!spyArgs.at(3).value<QModelIndex>().isValid()); + } +} + +void tst_QTransposeProxyModel::setData_data() +{ + QTest::addColumn<QAbstractItemModel *>("model"); + QTest::addColumn<bool>("rootItem"); + QTest::addColumn<bool>("viaProxy"); + QTest::newRow("List_via_Base") << createListModel(this) << true << false; + QTest::newRow("Table_via_Base") << createTableModel(this) << true << false; + QTest::newRow("Tree_via_Base_Root_Item") << createTreeModel(this) << true << false; + QTest::newRow("Tree_via_Base_Child_Item") << createTreeModel(this) << false << false; + QTest::newRow("List_via_Proxy") << createListModel(this) << true << true; + QTest::newRow("Table_via_Proxy") << createTableModel(this) << true << true; + QTest::newRow("Tree_via_Proxy_Root_Item") << createTreeModel(this) << true << true; + QTest::newRow("Tree_via_Proxy_Child_Item") << createTreeModel(this) << false << true; +} + +void tst_QTransposeProxyModel::setData() +{ + QFETCH(QAbstractItemModel *, model); + QFETCH(bool, rootItem); + QFETCH(bool, viaProxy); + QTransposeProxyModel proxy; + new QAbstractItemModelTester(&proxy, &proxy); + proxy.setSourceModel(model); + QSignalSpy sourceDataChangeSpy(model, &QAbstractItemModel::dataChanged); + QVERIFY(sourceDataChangeSpy.isValid()); + QSignalSpy proxyDataChangeSpy(&proxy, &QAbstractItemModel::dataChanged); + QVERIFY(proxyDataChangeSpy.isValid()); + const QString testData = QStringLiteral("TestingSetData"); + if (viaProxy) { + const QModelIndex parIdx = rootItem ? QModelIndex() : proxy.index(0, 1); + QVERIFY(proxy.setData(proxy.index(0, 1, parIdx), testData)); + QCOMPARE(model->index(1, 0, proxy.mapToSource(parIdx)).data().toString(), testData); + } else { + const QModelIndex parIdx = rootItem ? QModelIndex() : model->index(1, 0); + QVERIFY(model->setData(model->index(1, 0, parIdx), testData)); + QCOMPARE(proxy.index(0, 1, proxy.mapFromSource(parIdx)).data().toString(), testData); + } + QCOMPARE(sourceDataChangeSpy.size(), 1); + QCOMPARE(proxyDataChangeSpy.size(), 1); + delete model; +} + +QTEST_GUILESS_MAIN(tst_QTransposeProxyModel) + +#include "tst_qtransposeproxymodel.moc" diff --git a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp index ac0731b883..89a06b358e 100644 --- a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp +++ b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp @@ -331,6 +331,7 @@ private slots: void signal(); void signalIndex_data(); void signalIndex(); + void enumDebugStream_data(); void enumDebugStream(); void inherits_data(); @@ -1772,37 +1773,104 @@ void tst_QMetaObject::signalIndex() SignalTestHelper::signalIndex(mm)); } +void tst_QMetaObject::enumDebugStream_data() +{ + QTest::addColumn<int>("verbosity"); + QTest::addColumn<QString>("normalEnumMsg"); + QTest::addColumn<QString>("scopedEnumMsg"); + QTest::addColumn<QString>("globalEnumMsg"); + QTest::addColumn<QString>("normalFlagMsg"); + QTest::addColumn<QString>("normalFlagsMsg"); + QTest::addColumn<QString>("scopedFlagMsg"); + QTest::addColumn<QString>("scopedFlagsMsg"); + QTest::addColumn<QString>("flagAsEnumMsg"); + + QTest::newRow("verbosity=0") << 0 + << "hello MyEnum2 world" + << "hello MyScopedEnum::Enum3 scoped world" + << "WindowTitleHint Window Desktop WindowSystemMenuHint" + << "hello MyFlag1 world" + << "MyFlag1 MyFlag2|MyFlag3" + << "MyScopedFlag(MyFlag2)" + << "MyScopedFlag(MyFlag2|MyFlag3)" + << "MyFlag1"; + + QTest::newRow("verbosity=1") << 1 + << "hello MyEnum::MyEnum2 world" + << "hello MyScopedEnum::Enum3 scoped world" + << "WindowType::WindowTitleHint WindowType::Window WindowType::Desktop WindowType::WindowSystemMenuHint" + << "hello MyFlag(MyFlag1) world" + << "MyFlag(MyFlag1) MyFlag(MyFlag2|MyFlag3)" + << "MyScopedFlag(MyFlag2)" + << "MyScopedFlag(MyFlag2|MyFlag3)" + << "MyFlag::MyFlag1"; + + QTest::newRow("verbosity=2") << 2 + << "hello MyNamespace::MyClass::MyEnum2 world" + << "hello MyNamespace::MyClass::MyScopedEnum::Enum3 scoped world" + << "Qt::WindowTitleHint Qt::Window Qt::Desktop Qt::WindowSystemMenuHint" + << "hello QFlags<MyNamespace::MyClass::MyFlag>(MyFlag1) world" + << "QFlags<MyNamespace::MyClass::MyFlag>(MyFlag1) QFlags<MyNamespace::MyClass::MyFlag>(MyFlag2|MyFlag3)" + << "QFlags<MyNamespace::MyClass::MyScopedFlag>(MyFlag2)" + << "QFlags<MyNamespace::MyClass::MyScopedFlag>(MyFlag2|MyFlag3)" + << "MyNamespace::MyClass::MyFlag1"; + + QTest::newRow("verbosity=3") << 3 + << "hello MyNamespace::MyClass::MyEnum::MyEnum2 world" + << "hello MyNamespace::MyClass::MyScopedEnum::Enum3 scoped world" + << "Qt::WindowType::WindowTitleHint Qt::WindowType::Window Qt::WindowType::Desktop Qt::WindowType::WindowSystemMenuHint" + << "hello QFlags<MyNamespace::MyClass::MyFlag>(MyFlag1) world" + << "QFlags<MyNamespace::MyClass::MyFlag>(MyFlag1) QFlags<MyNamespace::MyClass::MyFlag>(MyFlag2|MyFlag3)" + << "QFlags<MyNamespace::MyClass::MyScopedFlag>(MyFlag2)" + << "QFlags<MyNamespace::MyClass::MyScopedFlag>(MyFlag2|MyFlag3)" + << "MyNamespace::MyClass::MyFlag::MyFlag1"; +} + void tst_QMetaObject::enumDebugStream() { - QTest::ignoreMessage(QtDebugMsg, "hello MyNamespace::MyClass::MyEnum2 world "); - qDebug() << "hello" << MyNamespace::MyClass::MyEnum2 << "world"; + QFETCH(int, verbosity); + + QFETCH(QString, normalEnumMsg); + QFETCH(QString, scopedEnumMsg); + QFETCH(QString, globalEnumMsg); + + QFETCH(QString, normalFlagMsg); + QFETCH(QString, normalFlagsMsg); + QFETCH(QString, scopedFlagMsg); + QFETCH(QString, scopedFlagsMsg); + QFETCH(QString, flagAsEnumMsg); + + // Enums + QTest::ignoreMessage(QtDebugMsg, qPrintable(normalEnumMsg)); + qDebug().verbosity(verbosity) << "hello" << MyNamespace::MyClass::MyEnum2 << "world"; - QTest::ignoreMessage(QtDebugMsg, "hello MyNamespace::MyClass::MyScopedEnum::Enum3 scoped world "); - qDebug() << "hello" << MyNamespace::MyClass::MyScopedEnum::Enum3 << "scoped world"; + QTest::ignoreMessage(QtDebugMsg, qPrintable(scopedEnumMsg)); + qDebug().verbosity(verbosity) << "hello" << MyNamespace::MyClass::MyScopedEnum::Enum3 << "scoped world"; - QTest::ignoreMessage(QtDebugMsg, "Qt::WindowTitleHint Qt::Window Qt::Desktop Qt::WindowSystemMenuHint"); - qDebug() << Qt::WindowTitleHint << Qt::Window << Qt::Desktop << Qt::WindowSystemMenuHint; + QTest::ignoreMessage(QtDebugMsg, qPrintable(globalEnumMsg)); + qDebug().verbosity(verbosity) << Qt::WindowTitleHint << Qt::Window << Qt::Desktop << Qt::WindowSystemMenuHint; - QTest::ignoreMessage(QtDebugMsg, "hello QFlags<MyNamespace::MyClass::MyFlag>(MyFlag1) world"); + // Flags + QTest::ignoreMessage(QtDebugMsg, qPrintable(normalFlagMsg)); MyNamespace::MyClass::MyFlags f1 = MyNamespace::MyClass::MyFlag1; - qDebug() << "hello" << f1 << "world"; + qDebug().verbosity(verbosity) << "hello" << f1 << "world"; MyNamespace::MyClass::MyFlags f2 = MyNamespace::MyClass::MyFlag2 | MyNamespace::MyClass::MyFlag3; - QTest::ignoreMessage(QtDebugMsg, "QFlags<MyNamespace::MyClass::MyFlag>(MyFlag1) QFlags<MyNamespace::MyClass::MyFlag>(MyFlag2|MyFlag3)"); - qDebug() << f1 << f2; + QTest::ignoreMessage(QtDebugMsg, qPrintable(normalFlagsMsg)); + qDebug().verbosity(verbosity) << f1 << f2; - QTest::ignoreMessage(QtDebugMsg, "QFlags<MyNamespace::MyClass::MyScopedFlag>(MyFlag2)"); + QTest::ignoreMessage(QtDebugMsg, qPrintable(scopedFlagMsg)); MyNamespace::MyClass::MyScopedFlags f3 = MyNamespace::MyClass::MyScopedFlag::MyFlag2; - qDebug() << f3; + qDebug().verbosity(verbosity) << f3; - QTest::ignoreMessage(QtDebugMsg, "QFlags<MyNamespace::MyClass::MyScopedFlag>(MyFlag2|MyFlag3)"); + QTest::ignoreMessage(QtDebugMsg, qPrintable(scopedFlagsMsg)); f3 |= MyNamespace::MyClass::MyScopedFlag::MyFlag3; - qDebug() << f3; + qDebug().verbosity(verbosity) << f3; // Single flag recognized as enum: - QTest::ignoreMessage(QtDebugMsg, "MyNamespace::MyClass::MyFlag1"); + QTest::ignoreMessage(QtDebugMsg, qPrintable(flagAsEnumMsg)); MyNamespace::MyClass::MyFlag f4 = MyNamespace::MyClass::MyFlag1; - qDebug() << f4; + qDebug().verbosity(verbosity) << f4; } void tst_QMetaObject::inherits_data() diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index e6fac74ccc..e2bb7dab2a 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -73,6 +73,7 @@ private slots: void defined(); void threadSafety(); void namespaces(); + void id(); void qMetaTypeId(); void properties(); void normalizedTypes(); @@ -342,6 +343,7 @@ struct Bar ++failureCount; } } + ~Bar() {} public: static int failureCount; @@ -458,7 +460,7 @@ void tst_QMetaType::threadSafety() namespace TestSpace { - struct Foo { double d; }; + struct Foo { double d; public: ~Foo() {} }; struct QungTfu {}; } Q_DECLARE_METATYPE(TestSpace::Foo) @@ -476,6 +478,12 @@ void tst_QMetaType::namespaces() QCOMPARE(QMetaType::typeName(qungTfuId), "TestSpace::QungTfu"); } +void tst_QMetaType::id() +{ + QCOMPARE(QMetaType(QMetaType::QString).id(), QMetaType::QString); + QCOMPARE(QMetaType(::qMetaTypeId<TestSpace::Foo>()).id(), ::qMetaTypeId<TestSpace::Foo>()); +} + void tst_QMetaType::qMetaTypeId() { QCOMPARE(::qMetaTypeId<QString>(), int(QMetaType::QString)); @@ -509,11 +517,17 @@ void tst_QMetaType::properties() } template <typename T> -struct Whity { T t; }; +struct Whity { T t; Whity() {} }; Q_DECLARE_METATYPE( Whity < int > ) Q_DECLARE_METATYPE(Whity<double>) +#if !defined(Q_CC_CLANG) && defined(Q_CC_GNU) && Q_CC_GNU < 501 +QT_BEGIN_NAMESPACE +Q_DECLARE_TYPEINFO(Whity<double>, Q_MOVABLE_TYPE); +QT_END_NAMESPACE +#endif + void tst_QMetaType::normalizedTypes() { int WhityIntId = ::qMetaTypeId<Whity<int> >(); @@ -812,10 +826,13 @@ void tst_QMetaType::sizeOfStaticLess() QCOMPARE(size_t(QMetaType(type).sizeOf()), size); } -struct CustomMovable {}; +struct CustomMovable { CustomMovable() {} }; +#if !defined(Q_CC_CLANG) && defined(Q_CC_GNU) && Q_CC_GNU < 501 QT_BEGIN_NAMESPACE Q_DECLARE_TYPEINFO(CustomMovable, Q_MOVABLE_TYPE); QT_END_NAMESPACE +#endif + Q_DECLARE_METATYPE(CustomMovable); class CustomObject : public QObject @@ -844,13 +861,15 @@ public: }; Q_DECLARE_METATYPE(CustomMultiInheritanceObject*); -class C { char _[4]; }; -class M { char _[4]; }; +class C { char _[4]; public: C() = default; C(const C&) {} }; +class M { char _[4]; public: M() {} }; class P { char _[4]; }; QT_BEGIN_NAMESPACE +#if defined(Q_CC_GNU) && Q_CC_GNU < 501 Q_DECLARE_TYPEINFO(M, Q_MOVABLE_TYPE); Q_DECLARE_TYPEINFO(P, Q_PRIMITIVE_TYPE); +#endif QT_END_NAMESPACE // avoid the comma: @@ -896,7 +915,7 @@ QT_FOR_EACH_STATIC_PRIMITIVE_POINTER(ADD_METATYPE_TEST_ROW) QT_FOR_EACH_STATIC_CORE_POINTER(ADD_METATYPE_TEST_ROW) #undef ADD_METATYPE_TEST_ROW QTest::newRow("TestSpace::Foo") << ::qMetaTypeId<TestSpace::Foo>() << false << true << false << false; - QTest::newRow("Whity<double>") << ::qMetaTypeId<Whity<double> >() << false << true << false << false; + QTest::newRow("Whity<double>") << ::qMetaTypeId<Whity<double> >() << true << true << false << false; QTest::newRow("CustomMovable") << ::qMetaTypeId<CustomMovable>() << true << true << false << false; QTest::newRow("CustomObject*") << ::qMetaTypeId<CustomObject*>() << true << false << true << false; QTest::newRow("CustomMultiInheritanceObject*") << ::qMetaTypeId<CustomMultiInheritanceObject*>() << true << false << true << false; @@ -1815,13 +1834,6 @@ DECLARE_NONSTREAMABLE(void) DECLARE_NONSTREAMABLE(void*) DECLARE_NONSTREAMABLE(QModelIndex) DECLARE_NONSTREAMABLE(QPersistentModelIndex) -DECLARE_NONSTREAMABLE(QJsonValue) -DECLARE_NONSTREAMABLE(QJsonObject) -DECLARE_NONSTREAMABLE(QJsonArray) -DECLARE_NONSTREAMABLE(QJsonDocument) -DECLARE_NONSTREAMABLE(QCborValue) -DECLARE_NONSTREAMABLE(QCborArray) -DECLARE_NONSTREAMABLE(QCborMap) DECLARE_NONSTREAMABLE(QObject*) DECLARE_NONSTREAMABLE(QWidget*) diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 06254091cd..31268c5cf3 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -41,6 +41,7 @@ #include <QThread> #include <QMutex> #include <QWaitCondition> +#include <QScopedPointer> #if QT_CONFIG(process) # include <QProcess> #endif @@ -285,104 +286,100 @@ static void playWithObjects() void tst_QObject::disconnect() { - SenderObject *s = new SenderObject; - ReceiverObject *r1 = new ReceiverObject; - ReceiverObject *r2 = new ReceiverObject; + SenderObject s; + ReceiverObject r1; + ReceiverObject r2; - connect( s, SIGNAL(signal1()), r1, SLOT(slot1()) ); + connect(&s, SIGNAL(signal1()), &r1, SLOT(slot1())); - connect( s, SIGNAL(signal2()), r1, SLOT(slot2()) ); - connect( s, SIGNAL(signal3()), r1, SLOT(slot3()) ); - connect( s, SIGNAL(signal4()), r1, SLOT(slot4()) ); + connect(&s, SIGNAL(signal2()), &r1, SLOT(slot2())); + connect(&s, SIGNAL(signal3()), &r1, SLOT(slot3())); + connect(&s, SIGNAL(signal4()), &r1, SLOT(slot4())); - s->emitSignal1(); - s->emitSignal2(); - s->emitSignal3(); - s->emitSignal4(); + s.emitSignal1(); + s.emitSignal2(); + s.emitSignal3(); + s.emitSignal4(); - QVERIFY(r1->called(1)); - QVERIFY(r1->called(2)); - QVERIFY(r1->called(3)); - QVERIFY(r1->called(4)); - r1->reset(); + QVERIFY(r1.called(1)); + QVERIFY(r1.called(2)); + QVERIFY(r1.called(3)); + QVERIFY(r1.called(4)); + r1.reset(); // usual disconnect with all parameters given - bool ret = QObject::disconnect( s, SIGNAL(signal1()), r1, SLOT(slot1()) ); + bool ret = QObject::disconnect(&s, SIGNAL(signal1()), &r1, SLOT(slot1())); - s->emitSignal1(); + s.emitSignal1(); - QVERIFY(!r1->called(1)); - r1->reset(); + QVERIFY(!r1.called(1)); + r1.reset(); QVERIFY(ret); - ret = QObject::disconnect( s, SIGNAL(signal1()), r1, SLOT(slot1()) ); + ret = QObject::disconnect(&s, SIGNAL(signal1()), &r1, SLOT(slot1())); QVERIFY(!ret); // disconnect all signals from s from all slots from r1 - QObject::disconnect( s, 0, r1, 0 ); + QObject::disconnect(&s, 0, &r1, 0); - s->emitSignal2(); - s->emitSignal3(); - s->emitSignal4(); + s.emitSignal2(); + s.emitSignal3(); + s.emitSignal4(); - QVERIFY(!r1->called(2)); - QVERIFY(!r1->called(3)); - QVERIFY(!r1->called(4)); - r1->reset(); + QVERIFY(!r1.called(2)); + QVERIFY(!r1.called(3)); + QVERIFY(!r1.called(4)); + r1.reset(); - connect( s, SIGNAL(signal1()), r1, SLOT(slot1()) ); - connect( s, SIGNAL(signal1()), r1, SLOT(slot2()) ); - connect( s, SIGNAL(signal1()), r1, SLOT(slot3()) ); - connect( s, SIGNAL(signal2()), r1, SLOT(slot4()) ); + connect(&s, SIGNAL(signal1()), &r1, SLOT(slot1())); + connect(&s, SIGNAL(signal1()), &r1, SLOT(slot2())); + connect(&s, SIGNAL(signal1()), &r1, SLOT(slot3())); + connect(&s, SIGNAL(signal2()), &r1, SLOT(slot4())); // disconnect s's signal1() from all slots of r1 - QObject::disconnect( s, SIGNAL(signal1()), r1, 0 ); + QObject::disconnect(&s, SIGNAL(signal1()), &r1, 0); - s->emitSignal1(); - s->emitSignal2(); + s.emitSignal1(); + s.emitSignal2(); - QVERIFY(!r1->called(1)); - QVERIFY(!r1->called(2)); - QVERIFY(!r1->called(3)); - QVERIFY(r1->called(4)); - r1->reset(); + QVERIFY(!r1.called(1)); + QVERIFY(!r1.called(2)); + QVERIFY(!r1.called(3)); + QVERIFY(r1.called(4)); + r1.reset(); // make sure all is disconnected again - QObject::disconnect( s, 0, r1, 0 ); + QObject::disconnect(&s, 0, &r1, 0); - connect( s, SIGNAL(signal1()), r1, SLOT(slot1()) ); - connect( s, SIGNAL(signal1()), r2, SLOT(slot1()) ); - connect( s, SIGNAL(signal2()), r1, SLOT(slot2()) ); - connect( s, SIGNAL(signal2()), r2, SLOT(slot2()) ); - connect( s, SIGNAL(signal3()), r1, SLOT(slot3()) ); - connect( s, SIGNAL(signal3()), r2, SLOT(slot3()) ); + connect(&s, SIGNAL(signal1()), &r1, SLOT(slot1())); + connect(&s, SIGNAL(signal1()), &r2, SLOT(slot1())); + connect(&s, SIGNAL(signal2()), &r1, SLOT(slot2())); + connect(&s, SIGNAL(signal2()), &r2, SLOT(slot2())); + connect(&s, SIGNAL(signal3()), &r1, SLOT(slot3())); + connect(&s, SIGNAL(signal3()), &r2, SLOT(slot3())); // disconnect signal1() from all receivers - QObject::disconnect( s, SIGNAL(signal1()), 0, 0 ); - s->emitSignal1(); - s->emitSignal2(); - s->emitSignal3(); + QObject::disconnect(&s, SIGNAL(signal1()), 0, 0); + s.emitSignal1(); + s.emitSignal2(); + s.emitSignal3(); - QVERIFY(!r1->called(1)); - QVERIFY(!r2->called(1)); - QVERIFY(r1->called(2)); - QVERIFY(r2->called(2)); - QVERIFY(r1->called(2)); - QVERIFY(r2->called(2)); + QVERIFY(!r1.called(1)); + QVERIFY(!r2.called(1)); + QVERIFY(r1.called(2)); + QVERIFY(r2.called(2)); + QVERIFY(r1.called(2)); + QVERIFY(r2.called(2)); - r1->reset(); - r2->reset(); + r1.reset(); + r2.reset(); // disconnect all signals of s from all receivers - QObject::disconnect( s, 0, 0, 0 ); + QObject::disconnect(&s, 0, 0, 0); - QVERIFY(!r1->called(2)); - QVERIFY(!r2->called(2)); - QVERIFY(!r1->called(2)); - QVERIFY(!r2->called(2)); - - delete r2; - delete r1; - delete s; + QVERIFY(!r1.called(2)); + QVERIFY(!r2.called(2)); + QVERIFY(!r1.called(2)); + QVERIFY(!r2.called(2)); } class AutoConnectSender : public QObject @@ -504,14 +501,13 @@ void tst_QObject::connectSlotsByName() void tst_QObject::qobject_castTemplate() { - QObject *o = 0; - QVERIFY( !::qobject_cast<QObject*>(o) ); + QScopedPointer<QObject> o; + QVERIFY(!::qobject_cast<QObject*>(o.data())); - o = new SenderObject; - QVERIFY( ::qobject_cast<SenderObject*>(o) ); - QVERIFY( ::qobject_cast<QObject*>(o) ); - QVERIFY( !::qobject_cast<ReceiverObject*>(o) ); - delete o; + o.reset(new SenderObject); + QVERIFY(::qobject_cast<SenderObject*>(o.data())); + QVERIFY(::qobject_cast<QObject*>(o.data())); + QVERIFY(!::qobject_cast<ReceiverObject*>(o.data())); } void tst_QObject::findChildren() @@ -798,192 +794,197 @@ void tst_QObject::connectDisconnectNotify_data() void tst_QObject::connectDisconnectNotify() { - NotifyObject *s = new NotifyObject; - NotifyObject *r = new NotifyObject; + NotifyObject s; + NotifyObject r; QFETCH(QString, a_signal); QFETCH(QString, a_slot); // Obtaining meta methods - int signalIndx = ((SenderObject*)s)->metaObject()->indexOfSignal( + int signalIndx = ((SenderObject &)s).metaObject()->indexOfSignal( QMetaObject::normalizedSignature(a_signal.toLatin1().constData()+1).constData()); - int methodIndx = ((ReceiverObject*)r)->metaObject()->indexOfMethod( + int methodIndx = ((ReceiverObject &)r).metaObject()->indexOfMethod( QMetaObject::normalizedSignature(a_slot.toLatin1().constData()+1).constData()); - QMetaMethod signal = ((SenderObject*)s)->metaObject()->method(signalIndx); - QMetaMethod method = ((ReceiverObject*)r)->metaObject()->method(methodIndx); + QMetaMethod signal = ((SenderObject &)s).metaObject()->method(signalIndx); + QMetaMethod method = ((ReceiverObject &)r).metaObject()->method(methodIndx); QVERIFY(signal.isValid()); QVERIFY(method.isValid()); // Test connectNotify - QVERIFY(QObject::connect((SenderObject*)s, a_signal.toLatin1(), (ReceiverObject*)r, a_slot.toLatin1())); - QCOMPARE(s->connectedSignals.size(), 1); - QCOMPARE(s->connectedSignals.at(0), signal); - QVERIFY(s->disconnectedSignals.isEmpty()); + QVERIFY(QObject::connect((SenderObject *)&s, a_signal.toLatin1(), + (ReceiverObject *)&r, a_slot.toLatin1())); + QCOMPARE(s.connectedSignals.size(), 1); + QCOMPARE(s.connectedSignals.at(0), signal); + QVERIFY(s.disconnectedSignals.isEmpty()); // Test disconnectNotify - QVERIFY(QObject::disconnect((SenderObject*)s, a_signal.toLatin1(), (ReceiverObject*)r, a_slot.toLatin1())); - QCOMPARE(s->disconnectedSignals.size(), 1); - QCOMPARE(s->disconnectedSignals.at(0), signal); - QCOMPARE(s->connectedSignals.size(), 1); + QVERIFY(QObject::disconnect((SenderObject *)&s, a_signal.toLatin1(), + (ReceiverObject *)&r, a_slot.toLatin1())); + QCOMPARE(s.disconnectedSignals.size(), 1); + QCOMPARE(s.disconnectedSignals.at(0), signal); + QCOMPARE(s.connectedSignals.size(), 1); // Reconnect - s->clearNotifications(); - QVERIFY(QObject::connect((SenderObject*)s, a_signal.toLatin1(), (ReceiverObject*)r, a_slot.toLatin1())); - QCOMPARE(s->connectedSignals.size(), 1); - QCOMPARE(s->connectedSignals.at(0), signal); - QVERIFY(s->disconnectedSignals.isEmpty()); + s.clearNotifications(); + QVERIFY(QObject::connect((SenderObject *)&s, a_signal.toLatin1(), + (ReceiverObject *)&r, a_slot.toLatin1())); + QCOMPARE(s.connectedSignals.size(), 1); + QCOMPARE(s.connectedSignals.at(0), signal); + QVERIFY(s.disconnectedSignals.isEmpty()); // Test disconnectNotify for a complete disconnect - QVERIFY(((SenderObject*)s)->disconnect((ReceiverObject*)r)); - QCOMPARE(s->disconnectedSignals.size(), 1); - QCOMPARE(s->disconnectedSignals.at(0), QMetaMethod()); - QCOMPARE(s->connectedSignals.size(), 1); + QVERIFY(((SenderObject *)&s)->disconnect((ReceiverObject *)&r)); + QCOMPARE(s.disconnectedSignals.size(), 1); + QCOMPARE(s.disconnectedSignals.at(0), QMetaMethod()); + QCOMPARE(s.connectedSignals.size(), 1); // Test connectNotify when connecting by QMetaMethod - s->clearNotifications(); - QVERIFY(QObject::connect((SenderObject*)s, signal, (ReceiverObject*)r, method)); - QCOMPARE(s->connectedSignals.size(), 1); - QCOMPARE(s->connectedSignals.at(0), signal); - QVERIFY(s->disconnectedSignals.isEmpty()); + s.clearNotifications(); + QVERIFY(QObject::connect((SenderObject *)&s, signal, (ReceiverObject *)&r, method)); + QCOMPARE(s.connectedSignals.size(), 1); + QCOMPARE(s.connectedSignals.at(0), signal); + QVERIFY(s.disconnectedSignals.isEmpty()); // Test disconnectNotify when disconnecting by QMetaMethod - QVERIFY(QObject::disconnect((SenderObject*)s, signal, (ReceiverObject*)r, method)); - QCOMPARE(s->disconnectedSignals.size(), 1); - QCOMPARE(s->disconnectedSignals.at(0), signal); - QCOMPARE(s->connectedSignals.size(), 1); + QVERIFY(QObject::disconnect((SenderObject *)&s, signal, (ReceiverObject *)&r, method)); + QCOMPARE(s.disconnectedSignals.size(), 1); + QCOMPARE(s.disconnectedSignals.at(0), signal); + QCOMPARE(s.connectedSignals.size(), 1); // Reconnect - s->clearNotifications(); - QVERIFY(QObject::connect((SenderObject*)s, a_signal.toLatin1(), (ReceiverObject*)r, a_slot.toLatin1())); + s.clearNotifications(); + QVERIFY(QObject::connect((SenderObject *)&s, a_signal.toLatin1(), + (ReceiverObject *)&r, a_slot.toLatin1())); // Test disconnectNotify for a complete disconnect by QMetaMethod - QVERIFY(QObject::disconnect((SenderObject*)s, QMetaMethod(), 0, QMetaMethod())); - QCOMPARE(s->disconnectedSignals.size(), 1); - QCOMPARE(s->disconnectedSignals.at(0), QMetaMethod()); - QCOMPARE(s->connectedSignals.size(), 1); + QVERIFY(QObject::disconnect((SenderObject *)&s, QMetaMethod(), 0, QMetaMethod())); + QCOMPARE(s.disconnectedSignals.size(), 1); + QCOMPARE(s.disconnectedSignals.at(0), QMetaMethod()); + QCOMPARE(s.connectedSignals.size(), 1); // Test connectNotify when connecting by index - s->clearNotifications(); - QVERIFY(QMetaObject::connect((SenderObject*)s, signalIndx, (ReceiverObject*)r, methodIndx)); - QCOMPARE(s->connectedSignals.size(), 1); - QCOMPARE(s->connectedSignals.at(0), signal); - QVERIFY(s->disconnectedSignals.isEmpty()); + s.clearNotifications(); + QVERIFY(QMetaObject::connect((SenderObject *)&s, signalIndx, (ReceiverObject *)&r, methodIndx)); + QCOMPARE(s.connectedSignals.size(), 1); + QCOMPARE(s.connectedSignals.at(0), signal); + QVERIFY(s.disconnectedSignals.isEmpty()); // Test disconnectNotify when disconnecting by index - QVERIFY(QMetaObject::disconnect((SenderObject*)s, signalIndx, (ReceiverObject*)r, methodIndx)); - QCOMPARE(s->disconnectedSignals.size(), 1); - QCOMPARE(s->disconnectedSignals.at(0), signal); - QCOMPARE(s->connectedSignals.size(), 1); - - delete s; - delete r; + QVERIFY(QMetaObject::disconnect((SenderObject *)&s, signalIndx, + (ReceiverObject *)&r, methodIndx)); + QCOMPARE(s.disconnectedSignals.size(), 1); + QCOMPARE(s.disconnectedSignals.at(0), signal); + QCOMPARE(s.connectedSignals.size(), 1); } static void connectDisconnectNotifyTestSlot() {} void tst_QObject::connectDisconnectNotifyPMF() { - NotifyObject *s = new NotifyObject; - NotifyObject *r = new NotifyObject; + NotifyObject s; + NotifyObject r; QMetaMethod signal = QMetaMethod::fromSignal(&SenderObject::signal1); // Test connectNotify - QVERIFY(QObject::connect((SenderObject*)s, &SenderObject::signal1, (ReceiverObject*)r, &ReceiverObject::slot1)); - QCOMPARE(s->connectedSignals.size(), 1); - QCOMPARE(s->connectedSignals.at(0), signal); - QVERIFY(s->disconnectedSignals.isEmpty()); + QVERIFY(QObject::connect((SenderObject *)&s, &SenderObject::signal1, + (ReceiverObject *)&r, &ReceiverObject::slot1)); + QCOMPARE(s.connectedSignals.size(), 1); + QCOMPARE(s.connectedSignals.at(0), signal); + QVERIFY(s.disconnectedSignals.isEmpty()); // Test disconnectNotify - QVERIFY(QObject::disconnect((SenderObject*)s, &SenderObject::signal1, (ReceiverObject*)r, &ReceiverObject::slot1)); - QCOMPARE(s->disconnectedSignals.size(), 1); - QCOMPARE(s->disconnectedSignals.at(0), signal); - QCOMPARE(s->connectedSignals.size(), 1); + QVERIFY(QObject::disconnect((SenderObject *)&s, &SenderObject::signal1, + (ReceiverObject *)&r, &ReceiverObject::slot1)); + QCOMPARE(s.disconnectedSignals.size(), 1); + QCOMPARE(s.disconnectedSignals.at(0), signal); + QCOMPARE(s.connectedSignals.size(), 1); // Reconnect - s->clearNotifications(); - QVERIFY(QObject::connect((SenderObject*)s, &SenderObject::signal1, (ReceiverObject*)r, &ReceiverObject::slot1)); - QCOMPARE(s->connectedSignals.size(), 1); - QCOMPARE(s->connectedSignals.at(0), signal); - QVERIFY(s->disconnectedSignals.isEmpty()); + s.clearNotifications(); + QVERIFY(QObject::connect((SenderObject *)&s, &SenderObject::signal1, + (ReceiverObject *)&r, &ReceiverObject::slot1)); + QCOMPARE(s.connectedSignals.size(), 1); + QCOMPARE(s.connectedSignals.at(0), signal); + QVERIFY(s.disconnectedSignals.isEmpty()); // Test disconnectNotify with wildcard slot - QVERIFY(QObject::disconnect((SenderObject*)s, &SenderObject::signal1, (ReceiverObject*)r, 0)); - QCOMPARE(s->disconnectedSignals.size(), 1); - QCOMPARE(s->disconnectedSignals.at(0), signal); - QCOMPARE(s->connectedSignals.size(), 1); + QVERIFY(QObject::disconnect((SenderObject *)&s, &SenderObject::signal1, + (ReceiverObject *)&r, 0)); + QCOMPARE(s.disconnectedSignals.size(), 1); + QCOMPARE(s.disconnectedSignals.at(0), signal); + QCOMPARE(s.connectedSignals.size(), 1); // Reconnect - s->clearNotifications(); - QMetaObject::Connection conn = connect((SenderObject*)s, &SenderObject::signal1, - (ReceiverObject*)r, &ReceiverObject::slot1); + s.clearNotifications(); + QMetaObject::Connection conn = connect((SenderObject *)&s, &SenderObject::signal1, + (ReceiverObject *)&r, &ReceiverObject::slot1); QVERIFY(conn); // Test disconnectNotify when disconnecting by QMetaObject::Connection QVERIFY(QObject::disconnect(conn)); - QVERIFY(!s->disconnectedSignals.isEmpty()); + QVERIFY(!s.disconnectedSignals.isEmpty()); // Test connectNotify when connecting by function pointer - s->clearNotifications(); - QVERIFY(QObject::connect((SenderObject*)s, &SenderObject::signal1, connectDisconnectNotifyTestSlot)); - QCOMPARE(s->connectedSignals.size(), 1); - QCOMPARE(s->connectedSignals.at(0), signal); - QVERIFY(s->disconnectedSignals.isEmpty()); - - delete s; - delete r; + s.clearNotifications(); + QVERIFY(QObject::connect((SenderObject *)&s, &SenderObject::signal1, + connectDisconnectNotifyTestSlot)); + QCOMPARE(s.connectedSignals.size(), 1); + QCOMPARE(s.connectedSignals.at(0), signal); + QVERIFY(s.disconnectedSignals.isEmpty()); } void tst_QObject::disconnectNotify_receiverDestroyed() { - NotifyObject *s = new NotifyObject; - NotifyObject *r = new NotifyObject; - - QVERIFY(QObject::connect((SenderObject*)s, SIGNAL(signal1()), (ReceiverObject*)r, SLOT(slot1()))); - - delete r; - QCOMPARE(s->disconnectedSignals.count(), 1); - QCOMPARE(s->disconnectedSignals.at(0), QMetaMethod::fromSignal(&SenderObject::signal1)); + NotifyObject s; - s->disconnectedSignals.clear(); - r = new NotifyObject; + { + NotifyObject r; + QVERIFY(QObject::connect((SenderObject *)&s, SIGNAL(signal1()), + (ReceiverObject *)&r, SLOT(slot1()))); + } + QCOMPARE(s.disconnectedSignals.count(), 1); + QCOMPARE(s.disconnectedSignals.at(0), QMetaMethod::fromSignal(&SenderObject::signal1)); - QVERIFY(QObject::connect((SenderObject*)s, SIGNAL(signal3()), (ReceiverObject*)r, SLOT(slot3()))); + s.disconnectedSignals.clear(); - delete r; - QCOMPARE(s->disconnectedSignals.count(), 1); - QCOMPARE(s->disconnectedSignals.at(0), QMetaMethod::fromSignal(&SenderObject::signal3)); + { + NotifyObject r; + QVERIFY(QObject::connect((SenderObject *)&s, SIGNAL(signal3()), + (ReceiverObject *)&r, SLOT(slot3()))); + } - s->disconnectedSignals.clear(); - r = new NotifyObject; + QCOMPARE(s.disconnectedSignals.count(), 1); + QCOMPARE(s.disconnectedSignals.at(0), QMetaMethod::fromSignal(&SenderObject::signal3)); - QVERIFY(QObject::connect((SenderObject*)s, SIGNAL(destroyed()), (ReceiverObject*)r, SLOT(slot3()))); + s.disconnectedSignals.clear(); - delete r; - QCOMPARE(s->disconnectedSignals.count(), 1); - QCOMPARE(s->disconnectedSignals.at(0), QMetaMethod::fromSignal(&QObject::destroyed)); + { + NotifyObject r; + QVERIFY(QObject::connect((SenderObject *)&s, SIGNAL(destroyed()), (ReceiverObject *)&r, SLOT(slot3()))); + } - delete s; + QCOMPARE(s.disconnectedSignals.count(), 1); + QCOMPARE(s.disconnectedSignals.at(0), QMetaMethod::fromSignal(&QObject::destroyed)); } void tst_QObject::disconnectNotify_metaObjConnection() { - NotifyObject *s = new NotifyObject; - NotifyObject *r = new NotifyObject; - - QMetaObject::Connection c = QObject::connect((SenderObject*)s, SIGNAL(signal1()), - (ReceiverObject*)r, SLOT(slot1())); - QVERIFY(c); - QVERIFY(QObject::disconnect(c)); + NotifyObject s; + { + NotifyObject r; - QCOMPARE(s->disconnectedSignals.count(), 1); - QCOMPARE(s->disconnectedSignals.at(0), QMetaMethod::fromSignal(&SenderObject::signal1)); + QMetaObject::Connection c = QObject::connect((SenderObject *)&s, SIGNAL(signal1()), + (ReceiverObject *)&r, SLOT(slot1())); + QVERIFY(c); + QVERIFY(QObject::disconnect(c)); - delete r; - QCOMPARE(s->disconnectedSignals.count(), 1); + QCOMPARE(s.disconnectedSignals.count(), 1); + QCOMPARE(s.disconnectedSignals.at(0), QMetaMethod::fromSignal(&SenderObject::signal1)); - delete s; + QCOMPARE(s.disconnectedSignals.count(), 1); + } } class ConnectByNameNotifySenderObject : public QObject @@ -3463,130 +3464,131 @@ void tst_QObject::qobjectConstCast() void tst_QObject::uniqConnection() { - SenderObject *s = new SenderObject; - ReceiverObject *r1 = new ReceiverObject; - ReceiverObject *r2 = new ReceiverObject; - r1->reset(); - r2->reset(); + SenderObject s; + ReceiverObject r1; + ReceiverObject r2; + r1.reset(); + r2.reset(); ReceiverObject::sequence = 0; - QVERIFY( connect( s, SIGNAL(signal1()), r1, SLOT(slot1()) , Qt::UniqueConnection) ); - QVERIFY( connect( s, SIGNAL(signal1()), r2, SLOT(slot1()) , Qt::UniqueConnection) ); - QVERIFY( connect( s, SIGNAL(signal1()), r1, SLOT(slot3()) , Qt::UniqueConnection) ); - QVERIFY( connect( s, SIGNAL(signal3()), r1, SLOT(slot3()) , Qt::UniqueConnection) ); + QVERIFY(connect(&s, SIGNAL(signal1()), &r1, SLOT(slot1()) , Qt::UniqueConnection) ); + QVERIFY(connect(&s, SIGNAL(signal1()), &r2, SLOT(slot1()) , Qt::UniqueConnection) ); + QVERIFY(connect(&s, SIGNAL(signal1()), &r1, SLOT(slot3()) , Qt::UniqueConnection) ); + QVERIFY(connect(&s, SIGNAL(signal3()), &r1, SLOT(slot3()) , Qt::UniqueConnection) ); - s->emitSignal1(); - s->emitSignal2(); - s->emitSignal3(); - s->emitSignal4(); - - QCOMPARE( r1->count_slot1, 1 ); - QCOMPARE( r1->count_slot2, 0 ); - QCOMPARE( r1->count_slot3, 2 ); - QCOMPARE( r1->count_slot4, 0 ); - QCOMPARE( r2->count_slot1, 1 ); - QCOMPARE( r2->count_slot2, 0 ); - QCOMPARE( r2->count_slot3, 0 ); - QCOMPARE( r2->count_slot4, 0 ); - QCOMPARE( r1->sequence_slot1, 1 ); - QCOMPARE( r2->sequence_slot1, 2 ); - QCOMPARE( r1->sequence_slot3, 4 ); - - r1->reset(); - r2->reset(); + s.emitSignal1(); + s.emitSignal2(); + s.emitSignal3(); + s.emitSignal4(); + + QCOMPARE(r1.count_slot1, 1); + QCOMPARE(r1.count_slot2, 0); + QCOMPARE(r1.count_slot3, 2); + QCOMPARE(r1.count_slot4, 0); + QCOMPARE(r2.count_slot1, 1); + QCOMPARE(r2.count_slot2, 0); + QCOMPARE(r2.count_slot3, 0); + QCOMPARE(r2.count_slot4, 0); + QCOMPARE(r1.sequence_slot1, 1); + QCOMPARE(r2.sequence_slot1, 2); + QCOMPARE(r1.sequence_slot3, 4); + + r1.reset(); + r2.reset(); ReceiverObject::sequence = 0; - QVERIFY( connect( s, SIGNAL(signal4()), r1, SLOT(slot4()) , Qt::UniqueConnection) ); - QVERIFY( connect( s, SIGNAL(signal4()), r2, SLOT(slot4()) , Qt::UniqueConnection) ); - QVERIFY(!connect( s, SIGNAL(signal4()), r2, SLOT(slot4()) , Qt::UniqueConnection) ); - QVERIFY( connect( s, SIGNAL(signal1()), r2, SLOT(slot4()) , Qt::UniqueConnection) ); - QVERIFY(!connect( s, SIGNAL(signal4()), r1, SLOT(slot4()) , Qt::UniqueConnection) ); + QVERIFY( connect(&s, SIGNAL(signal4()), &r1, SLOT(slot4()) , Qt::UniqueConnection)); + QVERIFY( connect(&s, SIGNAL(signal4()), &r2, SLOT(slot4()) , Qt::UniqueConnection)); + QVERIFY(!connect(&s, SIGNAL(signal4()), &r2, SLOT(slot4()) , Qt::UniqueConnection)); + QVERIFY( connect(&s, SIGNAL(signal1()), &r2, SLOT(slot4()) , Qt::UniqueConnection)); + QVERIFY(!connect(&s, SIGNAL(signal4()), &r1, SLOT(slot4()) , Qt::UniqueConnection)); - s->emitSignal4(); - QCOMPARE( r1->count_slot4, 1 ); - QCOMPARE( r2->count_slot4, 1 ); - QCOMPARE( r1->sequence_slot4, 1 ); - QCOMPARE( r2->sequence_slot4, 2 ); + s.emitSignal4(); + QCOMPARE(r1.count_slot4, 1); + QCOMPARE(r2.count_slot4, 1); + QCOMPARE(r1.sequence_slot4, 1); + QCOMPARE(r2.sequence_slot4, 2); - r1->reset(); - r2->reset(); + r1.reset(); + r2.reset(); ReceiverObject::sequence = 0; - connect( s, SIGNAL(signal4()), r1, SLOT(slot4()) ); - - s->emitSignal4(); - QCOMPARE( r1->count_slot4, 2 ); - QCOMPARE( r2->count_slot4, 1 ); - QCOMPARE( r1->sequence_slot4, 3 ); - QCOMPARE( r2->sequence_slot4, 2 ); + connect(&s, SIGNAL(signal4()), &r1, SLOT(slot4())); - delete s; - delete r1; - delete r2; + s.emitSignal4(); + QCOMPARE(r1.count_slot4, 2); + QCOMPARE(r2.count_slot4, 1); + QCOMPARE(r1.sequence_slot4, 3); + QCOMPARE(r2.sequence_slot4, 2); } void tst_QObject::uniqConnectionPtr() { - SenderObject *s = new SenderObject; - ReceiverObject *r1 = new ReceiverObject; - ReceiverObject *r2 = new ReceiverObject; - r1->reset(); - r2->reset(); + SenderObject s; + ReceiverObject r1; + ReceiverObject r2; + r1.reset(); + r2.reset(); ReceiverObject::sequence = 0; - QVERIFY( connect( s, &SenderObject::signal1, r1, &ReceiverObject::slot1 , Qt::UniqueConnection) ); - QVERIFY( connect( s, &SenderObject::signal1, r2, &ReceiverObject::slot1 , Qt::UniqueConnection) ); - QVERIFY( connect( s, &SenderObject::signal1, r1, &ReceiverObject::slot3 , Qt::UniqueConnection) ); - QVERIFY( connect( s, &SenderObject::signal3, r1, &ReceiverObject::slot3 , Qt::UniqueConnection) ); + QVERIFY(connect(&s, &SenderObject::signal1, &r1, &ReceiverObject::slot1 , + Qt::UniqueConnection)); + QVERIFY(connect(&s, &SenderObject::signal1, &r2, &ReceiverObject::slot1 , + Qt::UniqueConnection)); + QVERIFY(connect(&s, &SenderObject::signal1, &r1, &ReceiverObject::slot3 , + Qt::UniqueConnection)); + QVERIFY(connect(&s, &SenderObject::signal3, &r1, &ReceiverObject::slot3 , + Qt::UniqueConnection)); - s->emitSignal1(); - s->emitSignal2(); - s->emitSignal3(); - s->emitSignal4(); - - QCOMPARE( r1->count_slot1, 1 ); - QCOMPARE( r1->count_slot2, 0 ); - QCOMPARE( r1->count_slot3, 2 ); - QCOMPARE( r1->count_slot4, 0 ); - QCOMPARE( r2->count_slot1, 1 ); - QCOMPARE( r2->count_slot2, 0 ); - QCOMPARE( r2->count_slot3, 0 ); - QCOMPARE( r2->count_slot4, 0 ); - QCOMPARE( r1->sequence_slot1, 1 ); - QCOMPARE( r2->sequence_slot1, 2 ); - QCOMPARE( r1->sequence_slot3, 4 ); - - r1->reset(); - r2->reset(); + s.emitSignal1(); + s.emitSignal2(); + s.emitSignal3(); + s.emitSignal4(); + + QCOMPARE(r1.count_slot1, 1); + QCOMPARE(r1.count_slot2, 0); + QCOMPARE(r1.count_slot3, 2); + QCOMPARE(r1.count_slot4, 0); + QCOMPARE(r2.count_slot1, 1); + QCOMPARE(r2.count_slot2, 0); + QCOMPARE(r2.count_slot3, 0); + QCOMPARE(r2.count_slot4, 0); + QCOMPARE(r1.sequence_slot1, 1); + QCOMPARE(r2.sequence_slot1, 2); + QCOMPARE(r1.sequence_slot3, 4); + + r1.reset(); + r2.reset(); ReceiverObject::sequence = 0; - QVERIFY( connect( s, &SenderObject::signal4, r1, &ReceiverObject::slot4 , Qt::UniqueConnection) ); - QVERIFY( connect( s, &SenderObject::signal4, r2, &ReceiverObject::slot4 , Qt::UniqueConnection) ); - QVERIFY(!connect( s, &SenderObject::signal4, r2, &ReceiverObject::slot4 , Qt::UniqueConnection) ); - QVERIFY( connect( s, &SenderObject::signal1, r2, &ReceiverObject::slot4 , Qt::UniqueConnection) ); - QVERIFY(!connect( s, &SenderObject::signal4, r1, &ReceiverObject::slot4 , Qt::UniqueConnection) ); + QVERIFY( connect(&s, &SenderObject::signal4, &r1, &ReceiverObject::slot4 , + Qt::UniqueConnection)); + QVERIFY( connect(&s, &SenderObject::signal4, &r2, &ReceiverObject::slot4 , + Qt::UniqueConnection)); + QVERIFY(!connect(&s, &SenderObject::signal4, &r2, &ReceiverObject::slot4 , + Qt::UniqueConnection)); + QVERIFY( connect(&s, &SenderObject::signal1, &r2, &ReceiverObject::slot4 , + Qt::UniqueConnection)); + QVERIFY(!connect(&s, &SenderObject::signal4, &r1, &ReceiverObject::slot4 , + Qt::UniqueConnection)); - s->emitSignal4(); - QCOMPARE( r1->count_slot4, 1 ); - QCOMPARE( r2->count_slot4, 1 ); - QCOMPARE( r1->sequence_slot4, 1 ); - QCOMPARE( r2->sequence_slot4, 2 ); + s.emitSignal4(); + QCOMPARE(r1.count_slot4, 1); + QCOMPARE(r2.count_slot4, 1); + QCOMPARE(r1.sequence_slot4, 1); + QCOMPARE(r2.sequence_slot4, 2); - r1->reset(); - r2->reset(); + r1.reset(); + r2.reset(); ReceiverObject::sequence = 0; - connect( s, &SenderObject::signal4, r1, &ReceiverObject::slot4 ); + connect(&s, &SenderObject::signal4, &r1, &ReceiverObject::slot4); - s->emitSignal4(); - QCOMPARE( r1->count_slot4, 2 ); - QCOMPARE( r2->count_slot4, 1 ); - QCOMPARE( r1->sequence_slot4, 3 ); - QCOMPARE( r2->sequence_slot4, 2 ); - - delete s; - delete r1; - delete r2; + s.emitSignal4(); + QCOMPARE(r1.count_slot4, 2); + QCOMPARE(r2.count_slot4, 1); + QCOMPARE(r1.sequence_slot4, 3); + QCOMPARE(r2.sequence_slot4, 2); } void tst_QObject::interfaceIid() @@ -3890,217 +3892,214 @@ void tst_QObject::isSignalConnectedAfterDisconnection() void tst_QObject::qMetaObjectConnect() { - SenderObject *s = new SenderObject; - ReceiverObject *r1 = new ReceiverObject; - ReceiverObject *r2 = new ReceiverObject; - r1->reset(); - r2->reset(); - ReceiverObject::sequence = 0; - - int signal1Index = s->metaObject()->indexOfSignal("signal1()"); - int signal3Index = s->metaObject()->indexOfSignal("signal3()"); - int slot1Index = r1->metaObject()->indexOfSlot("slot1()"); - int slot2Index = r1->metaObject()->indexOfSlot("slot2()"); - int slot3Index = r1->metaObject()->indexOfSlot("slot3()"); - - QVERIFY(slot1Index > 0); - QVERIFY(slot2Index > 0); - QVERIFY(slot3Index > 0); - - QVERIFY( QMetaObject::connect( s, signal1Index, r1, slot1Index) ); - QVERIFY( QMetaObject::connect( s, signal3Index, r2, slot3Index) ); - QVERIFY( QMetaObject::connect( s, -1, r2, slot2Index) ); - - QCOMPARE( r1->count_slot1, 0 ); - QCOMPARE( r1->count_slot2, 0 ); - QCOMPARE( r1->count_slot3, 0 ); - QCOMPARE( r2->count_slot1, 0 ); - QCOMPARE( r2->count_slot2, 0 ); - QCOMPARE( r2->count_slot3, 0 ); - - s->emitSignal1(); - - QCOMPARE( r1->count_slot1, 1 ); - QCOMPARE( r1->count_slot2, 0 ); - QCOMPARE( r1->count_slot3, 0 ); - QCOMPARE( r2->count_slot1, 0 ); - QCOMPARE( r2->count_slot2, 1 ); - QCOMPARE( r2->count_slot3, 0 ); - - s->emitSignal2(); - s->emitSignal3(); - s->emitSignal4(); - - QCOMPARE( r1->count_slot1, 1 ); - QCOMPARE( r1->count_slot2, 0 ); - QCOMPARE( r1->count_slot3, 0 ); - QCOMPARE( r2->count_slot1, 0 ); - QCOMPARE( r2->count_slot2, 4 ); - QCOMPARE( r2->count_slot3, 1 ); - - QVERIFY( QMetaObject::disconnect( s, signal1Index, r1, slot1Index) ); - QVERIFY( QMetaObject::disconnect( s, signal3Index, r2, slot3Index) ); - QVERIFY( QMetaObject::disconnect( s, -1, r2, slot2Index) ); - - s->emitSignal1(); - s->emitSignal2(); - s->emitSignal3(); - s->emitSignal4(); - - QCOMPARE( r1->count_slot1, 1 ); - QCOMPARE( r1->count_slot2, 0 ); - QCOMPARE( r1->count_slot3, 0 ); - QCOMPARE( r2->count_slot1, 0 ); - QCOMPARE( r2->count_slot2, 4 ); - QCOMPARE( r2->count_slot3, 1 ); - - //some "dynamic" signal - QVERIFY( QMetaObject::connect( s, s->metaObject()->methodOffset() + 20, r1, slot3Index) ); - QVERIFY( QMetaObject::connect( s, s->metaObject()->methodOffset() + 35, r2, slot1Index) ); - QVERIFY( QMetaObject::connect( s, -1, r1, slot2Index) ); - - r1->reset(); - r2->reset(); - - void *args[] = { 0 , 0 }; - QMetaObject::activate(s, s->metaObject()->methodOffset() + 20, args); - QMetaObject::activate(s, s->metaObject()->methodOffset() + 48, args); - QCOMPARE( r1->count_slot1, 0 ); - QCOMPARE( r1->count_slot2, 2 ); - QCOMPARE( r1->count_slot3, 1 ); - QCOMPARE( r2->count_slot1, 0 ); - QCOMPARE( r2->count_slot2, 0 ); - QCOMPARE( r2->count_slot3, 0 ); - - QMetaObject::activate(s, s->metaObject()->methodOffset() + 35, args); - s->emitSignal1(); - s->emitSignal2(); - - QCOMPARE( r1->count_slot1, 0 ); - QCOMPARE( r1->count_slot2, 5 ); - QCOMPARE( r1->count_slot3, 1 ); - QCOMPARE( r2->count_slot1, 1 ); - QCOMPARE( r2->count_slot2, 0 ); - QCOMPARE( r2->count_slot3, 0 ); + ReceiverObject r1; + ReceiverObject r2; + int slot1Index, slot2Index, slot3Index; + { + SenderObject s; + r1.reset(); + r2.reset(); + ReceiverObject::sequence = 0; + + int signal1Index = s.metaObject()->indexOfSignal("signal1()"); + int signal3Index = s.metaObject()->indexOfSignal("signal3()"); + slot1Index = r1.metaObject()->indexOfSlot("slot1()"); + slot2Index = r1.metaObject()->indexOfSlot("slot2()"); + slot3Index = r1.metaObject()->indexOfSlot("slot3()"); + + QVERIFY(slot1Index > 0); + QVERIFY(slot2Index > 0); + QVERIFY(slot3Index > 0); + + QVERIFY(QMetaObject::connect(&s, signal1Index, &r1, slot1Index)); + QVERIFY(QMetaObject::connect(&s, signal3Index, &r2, slot3Index)); + QVERIFY(QMetaObject::connect(&s, -1, &r2, slot2Index)); + + QCOMPARE(r1.count_slot1, 0); + QCOMPARE(r1.count_slot2, 0); + QCOMPARE(r1.count_slot3, 0); + QCOMPARE(r2.count_slot1, 0); + QCOMPARE(r2.count_slot2, 0); + QCOMPARE(r2.count_slot3, 0); + + s.emitSignal1(); + + QCOMPARE(r1.count_slot1, 1); + QCOMPARE(r1.count_slot2, 0); + QCOMPARE(r1.count_slot3, 0); + QCOMPARE(r2.count_slot1, 0); + QCOMPARE(r2.count_slot2, 1); + QCOMPARE(r2.count_slot3, 0); + + s.emitSignal2(); + s.emitSignal3(); + s.emitSignal4(); + + QCOMPARE(r1.count_slot1, 1); + QCOMPARE(r1.count_slot2, 0); + QCOMPARE(r1.count_slot3, 0); + QCOMPARE(r2.count_slot1, 0); + QCOMPARE(r2.count_slot2, 4); + QCOMPARE(r2.count_slot3, 1); + + QVERIFY(QMetaObject::disconnect(&s, signal1Index, &r1, slot1Index)); + QVERIFY(QMetaObject::disconnect(&s, signal3Index, &r2, slot3Index)); + QVERIFY(QMetaObject::disconnect(&s, -1, &r2, slot2Index)); + + s.emitSignal1(); + s.emitSignal2(); + s.emitSignal3(); + s.emitSignal4(); + + QCOMPARE(r1.count_slot1, 1); + QCOMPARE(r1.count_slot2, 0); + QCOMPARE(r1.count_slot3, 0); + QCOMPARE(r2.count_slot1, 0); + QCOMPARE(r2.count_slot2, 4); + QCOMPARE(r2.count_slot3, 1); + + //some "dynamic" signal + QVERIFY(QMetaObject::connect(&s, s.metaObject()->methodOffset() + 20, &r1, slot3Index)); + QVERIFY(QMetaObject::connect(&s, s.metaObject()->methodOffset() + 35, &r2, slot1Index)); + QVERIFY(QMetaObject::connect(&s, -1, &r1, slot2Index)); + + r1.reset(); + r2.reset(); + + void *args[] = { 0 , 0 }; + QMetaObject::activate(&s, s.metaObject()->methodOffset() + 20, args); + QMetaObject::activate(&s, s.metaObject()->methodOffset() + 48, args); + QCOMPARE(r1.count_slot1, 0); + QCOMPARE(r1.count_slot2, 2); + QCOMPARE(r1.count_slot3, 1); + QCOMPARE(r2.count_slot1, 0); + QCOMPARE(r2.count_slot2, 0); + QCOMPARE(r2.count_slot3, 0); + + QMetaObject::activate(&s, s.metaObject()->methodOffset() + 35, args); + s.emitSignal1(); + s.emitSignal2(); + + QCOMPARE(r1.count_slot1, 0); + QCOMPARE(r1.count_slot2, 5); + QCOMPARE(r1.count_slot3, 1); + QCOMPARE(r2.count_slot1, 1); + QCOMPARE(r2.count_slot2, 0); + QCOMPARE(r2.count_slot3, 0); + } - delete s; - r1->reset(); - r2->reset(); + r1.reset(); + r2.reset(); #define SIGNAL_INDEX(S) obj1.metaObject()->indexOfSignal(QMetaObject::normalizedSignature(#S)) OverloadObject obj1; QObject obj2, obj3; - QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(int)) , r1, slot1Index); - QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(QObject *, QObject *, QObject *)) , r2, slot1Index); + QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(int)) , &r1, slot1Index); + QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(QObject *, QObject *, QObject *)) , + &r2, slot1Index); - QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(QObject *, QObject *, QObject *, QObject *)) , r1, slot2Index); - QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(QObject *)) , r2, slot2Index); - QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(int, int)) , r1, slot3Index); + QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(QObject *, QObject *, QObject *, QObject *)) , + &r1, slot2Index); + QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(QObject *)) , &r2, slot2Index); + QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(int, int)) , &r1, slot3Index); emit obj1.sig(0.5); //connected to nothing emit obj1.sig(1, 'a'); //connected to nothing - QCOMPARE( r1->count_slot1, 0 ); - QCOMPARE( r1->count_slot2, 0 ); - QCOMPARE( r1->count_slot3, 0 ); - QCOMPARE( r2->count_slot1, 0 ); - QCOMPARE( r2->count_slot2, 0 ); - QCOMPARE( r2->count_slot3, 0 ); + QCOMPARE(r1.count_slot1, 0); + QCOMPARE(r1.count_slot2, 0); + QCOMPARE(r1.count_slot3, 0); + QCOMPARE(r2.count_slot1, 0); + QCOMPARE(r2.count_slot2, 0); + QCOMPARE(r2.count_slot3, 0); emit obj1.sig(1); //this signal is connected emit obj1.sig(&obj2); - QCOMPARE( r1->count_slot1, 1 ); - QCOMPARE( r1->count_slot2, 0 ); - QCOMPARE( r1->count_slot3, 1 ); - QCOMPARE( r2->count_slot1, 0 ); - QCOMPARE( r2->count_slot2, 1 ); - QCOMPARE( r2->count_slot3, 0 ); + QCOMPARE(r1.count_slot1, 1); + QCOMPARE(r1.count_slot2, 0); + QCOMPARE(r1.count_slot3, 1); + QCOMPARE(r2.count_slot1, 0); + QCOMPARE(r2.count_slot2, 1); + QCOMPARE(r2.count_slot3, 0); emit obj1.sig(&obj2, &obj3); //this signal is connected - QCOMPARE( r1->count_slot1, 1 ); - QCOMPARE( r1->count_slot2, 1 ); - QCOMPARE( r1->count_slot3, 1 ); - QCOMPARE( r2->count_slot1, 1 ); - QCOMPARE( r2->count_slot2, 1 ); - QCOMPARE( r2->count_slot3, 0 ); - - delete r1; - delete r2; - + QCOMPARE(r1.count_slot1, 1); + QCOMPARE(r1.count_slot2, 1); + QCOMPARE(r1.count_slot3, 1); + QCOMPARE(r2.count_slot1, 1); + QCOMPARE(r2.count_slot2, 1); + QCOMPARE(r2.count_slot3, 0); } void tst_QObject::qMetaObjectDisconnectOne() { - SenderObject *s = new SenderObject; - ReceiverObject *r1 = new ReceiverObject; + SenderObject s; + ReceiverObject r1; - int signal1Index = s->metaObject()->indexOfSignal("signal1()"); - int signal3Index = s->metaObject()->indexOfSignal("signal3()"); - int slot1Index = r1->metaObject()->indexOfSlot("slot1()"); - int slot2Index = r1->metaObject()->indexOfSlot("slot2()"); + int signal1Index = s.metaObject()->indexOfSignal("signal1()"); + int signal3Index = s.metaObject()->indexOfSignal("signal3()"); + int slot1Index = r1.metaObject()->indexOfSlot("slot1()"); + int slot2Index = r1.metaObject()->indexOfSlot("slot2()"); QVERIFY(signal1Index > 0); QVERIFY(signal3Index > 0); QVERIFY(slot1Index > 0); QVERIFY(slot2Index > 0); - QVERIFY( QMetaObject::connect(s, signal1Index, r1, slot1Index) ); - QVERIFY( QMetaObject::connect(s, signal3Index, r1, slot2Index) ); - QVERIFY( QMetaObject::connect(s, signal3Index, r1, slot2Index) ); - QVERIFY( QMetaObject::connect(s, signal3Index, r1, slot2Index) ); - - r1->reset(); - QCOMPARE( r1->count_slot1, 0 ); - QCOMPARE( r1->count_slot2, 0 ); + QVERIFY(QMetaObject::connect(&s, signal1Index, &r1, slot1Index)); + QVERIFY(QMetaObject::connect(&s, signal3Index, &r1, slot2Index)); + QVERIFY(QMetaObject::connect(&s, signal3Index, &r1, slot2Index)); + QVERIFY(QMetaObject::connect(&s, signal3Index, &r1, slot2Index)); - s->emitSignal1(); - QCOMPARE( r1->count_slot1, 1 ); - QCOMPARE( r1->count_slot2, 0 ); + r1.reset(); + QCOMPARE(r1.count_slot1, 0); + QCOMPARE(r1.count_slot2, 0); - s->emitSignal3(); - QCOMPARE( r1->count_slot1, 1 ); - QCOMPARE( r1->count_slot2, 3 ); + s.emitSignal1(); + QCOMPARE(r1.count_slot1, 1); + QCOMPARE(r1.count_slot2, 0); - r1->reset(); - QVERIFY( QMetaObject::disconnectOne(s, signal1Index, r1, slot1Index) ); - QVERIFY( QMetaObject::disconnectOne(s, signal3Index, r1, slot2Index) ); + s.emitSignal3(); + QCOMPARE(r1.count_slot1, 1); + QCOMPARE(r1.count_slot2, 3); - s->emitSignal1(); - QCOMPARE( r1->count_slot1, 0 ); - QCOMPARE( r1->count_slot2, 0 ); + r1.reset(); + QVERIFY(QMetaObject::disconnectOne(&s, signal1Index, &r1, slot1Index)); + QVERIFY(QMetaObject::disconnectOne(&s, signal3Index, &r1, slot2Index)); - s->emitSignal3(); - QCOMPARE( r1->count_slot1, 0 ); - QCOMPARE( r1->count_slot2, 2 ); + s.emitSignal1(); + QCOMPARE(r1.count_slot1, 0); + QCOMPARE(r1.count_slot2, 0); - r1->reset(); - QVERIFY( false == QMetaObject::disconnectOne(s, signal1Index, r1, slot1Index) ); - QVERIFY( QMetaObject::disconnectOne(s, signal3Index, r1, slot2Index) ); + s.emitSignal3(); + QCOMPARE(r1.count_slot1, 0); + QCOMPARE(r1.count_slot2, 2); - s->emitSignal1(); - QCOMPARE( r1->count_slot1, 0 ); - QCOMPARE( r1->count_slot2, 0 ); + r1.reset(); + QVERIFY(!QMetaObject::disconnectOne(&s, signal1Index, &r1, slot1Index)); + QVERIFY( QMetaObject::disconnectOne(&s, signal3Index, &r1, slot2Index)); - s->emitSignal3(); - QCOMPARE( r1->count_slot1, 0 ); - QCOMPARE( r1->count_slot2, 1 ); + s.emitSignal1(); + QCOMPARE(r1.count_slot1, 0); + QCOMPARE(r1.count_slot2, 0); - r1->reset(); - QVERIFY( false == QMetaObject::disconnectOne(s, signal1Index, r1, slot1Index) ); - QVERIFY( QMetaObject::disconnectOne(s, signal3Index, r1, slot2Index) ); + s.emitSignal3(); + QCOMPARE(r1.count_slot1, 0); + QCOMPARE(r1.count_slot2, 1); - s->emitSignal1(); - QCOMPARE( r1->count_slot1, 0 ); - QCOMPARE( r1->count_slot2, 0 ); + r1.reset(); + QVERIFY(!QMetaObject::disconnectOne(&s, signal1Index, &r1, slot1Index)); + QVERIFY( QMetaObject::disconnectOne(&s, signal3Index, &r1, slot2Index)); - s->emitSignal3(); - QCOMPARE( r1->count_slot1, 0 ); - QCOMPARE( r1->count_slot2, 0 ); + s.emitSignal1(); + QCOMPARE(r1.count_slot1, 0); + QCOMPARE(r1.count_slot2, 0); - delete s; - delete r1; + s.emitSignal3(); + QCOMPARE(r1.count_slot1, 0); + QCOMPARE(r1.count_slot2, 0); } class ConfusingObject : public SenderObject @@ -4222,106 +4221,95 @@ void tst_QObject::connectConstructorByMetaMethod() void tst_QObject::disconnectByMetaMethod() { - SenderObject *s = new SenderObject; - ReceiverObject *r1 = new ReceiverObject; - ReceiverObject *r2 = new ReceiverObject; - - QMetaMethod signal1 = s->metaObject()->method( - s->metaObject()->indexOfMethod("signal1()")); - QMetaMethod signal2 = s->metaObject()->method( - s->metaObject()->indexOfMethod("signal2()")); - QMetaMethod signal3 = s->metaObject()->method( - s->metaObject()->indexOfMethod("signal3()")); - - QMetaMethod slot1 = r1->metaObject()->method( - r1->metaObject()->indexOfMethod("slot1()")); - QMetaMethod slot2 = r1->metaObject()->method( - r1->metaObject()->indexOfMethod("slot2()")); - QMetaMethod slot3 = r1->metaObject()->method( - r1->metaObject()->indexOfMethod("slot3()")); - QMetaMethod slot4 = r1->metaObject()->method( - r1->metaObject()->indexOfMethod("slot4()")); - - connect(s, signal1, r1, slot1); + SenderObject s; + ReceiverObject r1; + ReceiverObject r2; - s->emitSignal1(); + QMetaMethod signal1 = s.metaObject()->method(s.metaObject()->indexOfMethod("signal1()")); + QMetaMethod signal2 = s.metaObject()->method(s.metaObject()->indexOfMethod("signal2()")); + QMetaMethod signal3 = s.metaObject()->method(s.metaObject()->indexOfMethod("signal3()")); + + QMetaMethod slot1 = r1.metaObject()->method(r1.metaObject()->indexOfMethod("slot1()")); + QMetaMethod slot2 = r1.metaObject()->method(r1.metaObject()->indexOfMethod("slot2()")); + QMetaMethod slot3 = r1.metaObject()->method(r1.metaObject()->indexOfMethod("slot3()")); + QMetaMethod slot4 = r1.metaObject()->method(r1.metaObject()->indexOfMethod("slot4()")); + + connect(&s, signal1, &r1, slot1); - QVERIFY(r1->called(1)); - r1->reset(); + s.emitSignal1(); + + QVERIFY(r1.called(1)); + r1.reset(); // usual disconnect with all parameters given - bool ret = QObject::disconnect(s, signal1, r1, slot1); + bool ret = QObject::disconnect(&s, signal1, &r1, slot1); - s->emitSignal1(); + s.emitSignal1(); - QVERIFY(!r1->called(1)); - r1->reset(); + QVERIFY(!r1.called(1)); + r1.reset(); QVERIFY(ret); - ret = QObject::disconnect(s, signal1, r1, slot1); + ret = QObject::disconnect(&s, signal1, &r1, slot1); QVERIFY(!ret); - r1->reset(); + r1.reset(); - connect( s, signal1, r1, slot1 ); - connect( s, signal1, r1, slot2 ); - connect( s, signal1, r1, slot3 ); - connect( s, signal2, r1, slot4 ); + connect(&s, signal1, &r1, slot1); + connect(&s, signal1, &r1, slot2); + connect(&s, signal1, &r1, slot3); + connect(&s, signal2, &r1, slot4); // disconnect s's signal1() from all slots of r1 - QObject::disconnect(s, signal1, r1, QMetaMethod()); + QObject::disconnect(&s, signal1, &r1, QMetaMethod()); - s->emitSignal1(); - s->emitSignal2(); + s.emitSignal1(); + s.emitSignal2(); - QVERIFY(!r1->called(1)); - QVERIFY(!r1->called(2)); - QVERIFY(!r1->called(3)); - QVERIFY(r1->called(4)); - r1->reset(); + QVERIFY(!r1.called(1)); + QVERIFY(!r1.called(2)); + QVERIFY(!r1.called(3)); + QVERIFY(r1.called(4)); + r1.reset(); // make sure all is disconnected again - QObject::disconnect(s, 0, r1, 0); + QObject::disconnect(&s, 0, &r1, 0); - connect(s, signal1, r1, slot1); - connect(s, signal1, r2, slot1); - connect(s, signal2, r1, slot2); - connect(s, signal2, r2, slot2); - connect(s, signal3, r1, slot3); - connect(s, signal3, r2, slot3); + connect(&s, signal1, &r1, slot1); + connect(&s, signal1, &r2, slot1); + connect(&s, signal2, &r1, slot2); + connect(&s, signal2, &r2, slot2); + connect(&s, signal3, &r1, slot3); + connect(&s, signal3, &r2, slot3); // disconnect signal1() from all receivers - QObject::disconnect(s, signal1, 0, QMetaMethod()); - s->emitSignal1(); - s->emitSignal2(); - s->emitSignal3(); + QObject::disconnect(&s, signal1, 0, QMetaMethod()); + s.emitSignal1(); + s.emitSignal2(); + s.emitSignal3(); - QVERIFY(!r1->called(1)); - QVERIFY(!r2->called(1)); - QVERIFY(r1->called(2)); - QVERIFY(r2->called(2)); - QVERIFY(r1->called(2)); - QVERIFY(r2->called(2)); + QVERIFY(!r1.called(1)); + QVERIFY(!r2.called(1)); + QVERIFY(r1.called(2)); + QVERIFY(r2.called(2)); + QVERIFY(r1.called(2)); + QVERIFY(r2.called(2)); - r1->reset(); - r2->reset(); + r1.reset(); + r2.reset(); // disconnect all signals of s from all receivers - QObject::disconnect( s, 0, 0, 0 ); + QObject::disconnect(&s, 0, 0, 0); - connect( s, signal1, r1, slot1 ); - connect( s, signal1, r2, slot1 ); + connect(&s, signal1, &r1, slot1); + connect(&s, signal1, &r2, slot1); // disconnect all signals from slot1 of r1 - QObject::disconnect(s, QMetaMethod(), r1, slot1); + QObject::disconnect(&s, QMetaMethod(), &r1, slot1); - s->emitSignal1(); - - QVERIFY(!r1->called(1)); - QVERIFY(r2->called(1)); + s.emitSignal1(); - delete r2; - delete r1; - delete s; + QVERIFY(!r1.called(1)); + QVERIFY(r2.called(1)); } void tst_QObject::disconnectNotSignalMetaMethod() @@ -4459,63 +4447,64 @@ void tst_QObject::baseDestroyed() void tst_QObject::pointerConnect() { - SenderObject *s = new SenderObject; - ReceiverObject *r1 = new ReceiverObject; - ReceiverObject *r2 = new ReceiverObject; - r1->reset(); - r2->reset(); + SenderObject s; + ReceiverObject r1; + ReceiverObject r2; + r1.reset(); + r2.reset(); ReceiverObject::sequence = 0; QTimer timer; - QVERIFY( connect( s, &SenderObject::signal1 , r1, &ReceiverObject::slot1 ) ); - QVERIFY( connect( s, &SenderObject::signal1 , r2, &ReceiverObject::slot1 ) ); - QVERIFY( connect( s, &SenderObject::signal1 , r1, &ReceiverObject::slot3 ) ); - QVERIFY( connect( s, &SenderObject::signal3 , r1, &ReceiverObject::slot3 ) ); - QVERIFY2( connect( &timer, &QTimer::timeout, r1, &ReceiverObject::deleteLater ), - "Signal connection failed most likely due to failing comparison of pointers to member functions caused by problems with -reduce-relocations on this platform."); + QVERIFY(connect(&s, &SenderObject::signal1 , &r1, &ReceiverObject::slot1)); + QVERIFY(connect(&s, &SenderObject::signal1 , &r2, &ReceiverObject::slot1)); + QVERIFY(connect(&s, &SenderObject::signal1 , &r1, &ReceiverObject::slot3)); + QVERIFY(connect(&s, &SenderObject::signal3 , &r1, &ReceiverObject::slot3)); + QVERIFY2(connect(&timer, &QTimer::timeout, &r1, &ReceiverObject::deleteLater), + "Signal connection failed most likely due to failing comparison of pointers to member " + "functions caused by problems with -reduce-relocations on this platform."); - s->emitSignal1(); - s->emitSignal2(); - s->emitSignal3(); - s->emitSignal4(); - - QCOMPARE( r1->count_slot1, 1 ); - QCOMPARE( r1->count_slot2, 0 ); - QCOMPARE( r1->count_slot3, 2 ); - QCOMPARE( r1->count_slot4, 0 ); - QCOMPARE( r2->count_slot1, 1 ); - QCOMPARE( r2->count_slot2, 0 ); - QCOMPARE( r2->count_slot3, 0 ); - QCOMPARE( r2->count_slot4, 0 ); - QCOMPARE( r1->sequence_slot1, 1 ); - QCOMPARE( r2->sequence_slot1, 2 ); - QCOMPARE( r1->sequence_slot3, 4 ); - - r1->reset(); - r2->reset(); + s.emitSignal1(); + s.emitSignal2(); + s.emitSignal3(); + s.emitSignal4(); + + QCOMPARE(r1.count_slot1, 1); + QCOMPARE(r1.count_slot2, 0); + QCOMPARE(r1.count_slot3, 2); + QCOMPARE(r1.count_slot4, 0); + QCOMPARE(r2.count_slot1, 1); + QCOMPARE(r2.count_slot2, 0); + QCOMPARE(r2.count_slot3, 0); + QCOMPARE(r2.count_slot4, 0); + QCOMPARE(r1.sequence_slot1, 1); + QCOMPARE(r2.sequence_slot1, 2); + QCOMPARE(r1.sequence_slot3, 4); + + r1.reset(); + r2.reset(); ReceiverObject::sequence = 0; - QVERIFY( connect( s, &SenderObject::signal4, r1, &ReceiverObject::slot4 ) ); - QVERIFY( connect( s, &SenderObject::signal4, r2, &ReceiverObject::slot4 ) ); - QVERIFY( connect( s, &SenderObject::signal1, r2, &ReceiverObject::slot4 ) ); + QVERIFY(connect(&s, &SenderObject::signal4, &r1, &ReceiverObject::slot4)); + QVERIFY(connect(&s, &SenderObject::signal4, &r2, &ReceiverObject::slot4)); + QVERIFY(connect(&s, &SenderObject::signal1, &r2, &ReceiverObject::slot4)); - s->emitSignal4(); - QCOMPARE( r1->count_slot4, 1 ); - QCOMPARE( r2->count_slot4, 1 ); - QCOMPARE( r1->sequence_slot4, 1 ); - QCOMPARE( r2->sequence_slot4, 2 ); + s.emitSignal4(); + QCOMPARE(r1.count_slot4, 1); + QCOMPARE(r2.count_slot4, 1); + QCOMPARE(r1.sequence_slot4, 1); + QCOMPARE(r2.sequence_slot4, 2); - r1->reset(); - r2->reset(); + r1.reset(); + r2.reset(); ReceiverObject::sequence = 0; - connect( s, &SenderObject::signal4 , r1, &ReceiverObject::slot4 ); + connect(&s, &SenderObject::signal4 , &r1, &ReceiverObject::slot4); - s->emitSignal4(); - QCOMPARE( r1->count_slot4, 2 ); - QCOMPARE( r2->count_slot4, 1 ); - QCOMPARE( r1->sequence_slot4, 3 ); - QCOMPARE( r2->sequence_slot4, 2 ); + s.emitSignal4(); + QCOMPARE(r1.count_slot4, 2); + QCOMPARE(r2.count_slot4, 1); + QCOMPARE(r1.sequence_slot4, 3); + QCOMPARE(r2.sequence_slot4, 2); QMetaObject::Connection con; QVERIFY(!con); @@ -4523,116 +4512,107 @@ void tst_QObject::pointerConnect() //connect a slot to a signal (== error) QTest::ignoreMessage(QtWarningMsg, "QObject::connect: signal not found in ReceiverObject"); - con = connect(r1, &ReceiverObject::slot4 , s, &SenderObject::signal4 ); + con = connect(&r1, &ReceiverObject::slot4 , &s, &SenderObject::signal4); QVERIFY(!con); QVERIFY(!QObject::disconnect(con)); - - delete s; - delete r1; - delete r2; } void tst_QObject::pointerDisconnect() { - SenderObject *s = new SenderObject; - ReceiverObject *r1 = new ReceiverObject; - ReceiverObject *r2 = new ReceiverObject; + SenderObject s; + ReceiverObject r1; + ReceiverObject r2; - connect( s, &SenderObject::signal1, r1, &ReceiverObject::slot1 ); + connect(&s, &SenderObject::signal1, &r1, &ReceiverObject::slot1); - connect( s, &SenderObject::signal2, r1, &ReceiverObject::slot2 ); - connect( s, &SenderObject::signal3, r1, &ReceiverObject::slot3 ); - connect( s, &SenderObject::signal4, r1, &ReceiverObject::slot4 ); + connect(&s, &SenderObject::signal2, &r1, &ReceiverObject::slot2); + connect(&s, &SenderObject::signal3, &r1, &ReceiverObject::slot3); + connect(&s, &SenderObject::signal4, &r1, &ReceiverObject::slot4); - s->emitSignal1(); - s->emitSignal2(); - s->emitSignal3(); - s->emitSignal4(); + s.emitSignal1(); + s.emitSignal2(); + s.emitSignal3(); + s.emitSignal4(); - QVERIFY(r1->called(1)); - QVERIFY(r1->called(2)); - QVERIFY(r1->called(3)); - QVERIFY(r1->called(4)); - r1->reset(); + QVERIFY(r1.called(1)); + QVERIFY(r1.called(2)); + QVERIFY(r1.called(3)); + QVERIFY(r1.called(4)); + r1.reset(); // usual disconnect with all parameters given - bool ret = QObject::disconnect( s, &SenderObject::signal1, r1, &ReceiverObject::slot1 ); + bool ret = QObject::disconnect(&s, &SenderObject::signal1, &r1, &ReceiverObject::slot1); - s->emitSignal1(); + s.emitSignal1(); - QVERIFY(!r1->called(1)); - r1->reset(); + QVERIFY(!r1.called(1)); + r1.reset(); QVERIFY(ret); - ret = QObject::disconnect( s, &SenderObject::signal1, r1, &ReceiverObject::slot1 ); + ret = QObject::disconnect(&s, &SenderObject::signal1, &r1, &ReceiverObject::slot1); QVERIFY(!ret); // disconnect all signals from s from all slots from r1 - QObject::disconnect( s, 0, r1, 0 ); + QObject::disconnect(&s, 0, &r1, 0); - s->emitSignal2(); - s->emitSignal3(); - s->emitSignal4(); + s.emitSignal2(); + s.emitSignal3(); + s.emitSignal4(); - QVERIFY(!r1->called(2)); - QVERIFY(!r1->called(3)); - QVERIFY(!r1->called(4)); - r1->reset(); + QVERIFY(!r1.called(2)); + QVERIFY(!r1.called(3)); + QVERIFY(!r1.called(4)); + r1.reset(); - connect( s, &SenderObject::signal1, r1, &ReceiverObject::slot1 ); - connect( s, &SenderObject::signal1, r1, &ReceiverObject::slot2 ); - connect( s, &SenderObject::signal1, r1, &ReceiverObject::slot3 ); - connect( s, &SenderObject::signal2, r1, &ReceiverObject::slot4 ); + connect(&s, &SenderObject::signal1, &r1, &ReceiverObject::slot1); + connect(&s, &SenderObject::signal1, &r1, &ReceiverObject::slot2); + connect(&s, &SenderObject::signal1, &r1, &ReceiverObject::slot3); + connect(&s, &SenderObject::signal2, &r1, &ReceiverObject::slot4); // disconnect s's signal1() from all slots of r1 - QObject::disconnect( s, &SenderObject::signal1, r1, 0 ); + QObject::disconnect(&s, &SenderObject::signal1, &r1, 0); - s->emitSignal1(); - s->emitSignal2(); + s.emitSignal1(); + s.emitSignal2(); - QVERIFY(!r1->called(1)); - QVERIFY(!r1->called(2)); - QVERIFY(!r1->called(3)); - QVERIFY(r1->called(4)); - r1->reset(); + QVERIFY(!r1.called(1)); + QVERIFY(!r1.called(2)); + QVERIFY(!r1.called(3)); + QVERIFY(r1.called(4)); + r1.reset(); // make sure all is disconnected again - QObject::disconnect( s, 0, r1, 0 ); + QObject::disconnect(&s, 0, &r1, 0); - connect( s, &SenderObject::signal1, r1, &ReceiverObject::slot1 ); - connect( s, &SenderObject::signal1, r2, &ReceiverObject::slot1 ); - connect( s, &SenderObject::signal2, r1, &ReceiverObject::slot2 ); - connect( s, &SenderObject::signal2, r2, &ReceiverObject::slot2 ); - connect( s, &SenderObject::signal3, r1, &ReceiverObject::slot3 ); - connect( s, &SenderObject::signal3, r2, &ReceiverObject::slot3 ); + connect(&s, &SenderObject::signal1, &r1, &ReceiverObject::slot1); + connect(&s, &SenderObject::signal1, &r2, &ReceiverObject::slot1); + connect(&s, &SenderObject::signal2, &r1, &ReceiverObject::slot2); + connect(&s, &SenderObject::signal2, &r2, &ReceiverObject::slot2); + connect(&s, &SenderObject::signal3, &r1, &ReceiverObject::slot3); + connect(&s, &SenderObject::signal3, &r2, &ReceiverObject::slot3); // disconnect signal1() from all receivers - QObject::disconnect( s, &SenderObject::signal1, 0, 0 ); - s->emitSignal1(); - s->emitSignal2(); - s->emitSignal3(); + QObject::disconnect(&s, &SenderObject::signal1, 0, 0); + s.emitSignal1(); + s.emitSignal2(); + s.emitSignal3(); - QVERIFY(!r1->called(1)); - QVERIFY(!r2->called(1)); - QVERIFY(r1->called(2)); - QVERIFY(r2->called(2)); - QVERIFY(r1->called(2)); - QVERIFY(r2->called(2)); + QVERIFY(!r1.called(1)); + QVERIFY(!r2.called(1)); + QVERIFY(r1.called(2)); + QVERIFY(r2.called(2)); + QVERIFY(r1.called(2)); + QVERIFY(r2.called(2)); - r1->reset(); - r2->reset(); + r1.reset(); + r2.reset(); // disconnect all signals of s from all receivers - QObject::disconnect( s, 0, 0, 0 ); - - QVERIFY(!r1->called(2)); - QVERIFY(!r2->called(2)); - QVERIFY(!r1->called(2)); - QVERIFY(!r2->called(2)); - - delete r2; - delete r1; - delete s; + QObject::disconnect(&s, 0, 0, 0); + QVERIFY(!r1.called(2)); + QVERIFY(!r2.called(2)); + QVERIFY(!r1.called(2)); + QVERIFY(!r2.called(2)); } @@ -4756,35 +4736,32 @@ void tst_QObject::customTypesPointer() void tst_QObject::connectCxx0x() { - SenderObject *s = new SenderObject; - ReceiverObject *r1 = new ReceiverObject; + SenderObject s; + ReceiverObject r1; - QObject::connect(s, &SenderObject::signal1, r1, &ReceiverObject::slot1); - QObject::connect(s, &SenderObject::signal3, r1, &ReceiverObject::slot2); - QObject::connect(s, &SenderObject::signal3, r1, &ReceiverObject::slot2); - QObject::connect(s, &SenderObject::signal3, r1, &ReceiverObject::slot2); + QObject::connect(&s, &SenderObject::signal1, &r1, &ReceiverObject::slot1); + QObject::connect(&s, &SenderObject::signal3, &r1, &ReceiverObject::slot2); + QObject::connect(&s, &SenderObject::signal3, &r1, &ReceiverObject::slot2); + QObject::connect(&s, &SenderObject::signal3, &r1, &ReceiverObject::slot2); - r1->reset(); - QCOMPARE( r1->count_slot1, 0 ); - QCOMPARE( r1->count_slot2, 0 ); + r1.reset(); + QCOMPARE(r1.count_slot1, 0); + QCOMPARE(r1.count_slot2, 0); - s->emitSignal1(); - QCOMPARE( r1->count_slot1, 1 ); - QCOMPARE( r1->count_slot2, 0 ); + s.emitSignal1(); + QCOMPARE(r1.count_slot1, 1); + QCOMPARE(r1.count_slot2, 0); - s->emitSignal3(); - QCOMPARE( r1->count_slot1, 1 ); - QCOMPARE( r1->count_slot2, 3 ); + s.emitSignal3(); + QCOMPARE(r1.count_slot1, 1); + QCOMPARE(r1.count_slot2, 3); // connect signal to signal - QObject::connect(s, &SenderObject::signal2, s, &SenderObject::signal1); + QObject::connect(&s, &SenderObject::signal2, &s, &SenderObject::signal1); - r1->reset(); - s->emitSignal2(); - QCOMPARE( r1->count_slot1, 1 ); - - delete s; - delete r1; + r1.reset(); + s.emitSignal2(); + QCOMPARE(r1.count_slot1, 1); } int receivedCount; diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp index 8d194dafc1..3b10547dc4 100644 --- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp +++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp @@ -51,6 +51,8 @@ private slots: void singleShotTimeout(); void timeout(); void remainingTime(); + void remainingTimeInitial_data(); + void remainingTimeInitial(); void remainingTimeDuringActivation_data(); void remainingTimeDuringActivation(); void basic_chrono(); @@ -133,14 +135,41 @@ void tst_QTimer::remainingTime() QCOMPARE(timeoutSpy.count(), 0); int remainingTime = timer.remainingTime(); - QVERIFY2(qAbs(remainingTime - 150) < 50, qPrintable(QString::number(remainingTime))); + QVERIFY2(remainingTime >= 50 && remainingTime <= 200, qPrintable(QString::number(remainingTime))); QVERIFY(timeoutSpy.wait()); QCOMPARE(timeoutSpy.count(), 1); // the timer is still active, so it should have a non-zero remaining time remainingTime = timer.remainingTime(); - QVERIFY2(remainingTime > 150, qPrintable(QString::number(remainingTime))); + QVERIFY2(remainingTime >= 50, qPrintable(QString::number(remainingTime))); +} + +void tst_QTimer::remainingTimeInitial_data() +{ + QTest::addColumn<int>("startTimeMs"); + QTest::addColumn<Qt::TimerType>("timerType"); + + QTest::addRow("precise time 0ms") << 0 << Qt::PreciseTimer; + QTest::addRow("precise time 1ms") << 1 << Qt::PreciseTimer; + QTest::addRow("precise time 10ms") << 10 << Qt::PreciseTimer; + + QTest::addRow("coarse time 0ms") << 0 << Qt::CoarseTimer; + QTest::addRow("coarse time 1ms") << 1 << Qt::CoarseTimer; + QTest::addRow("coarse time 10ms") << 10 << Qt::CoarseTimer; +} + +void tst_QTimer::remainingTimeInitial() +{ + QFETCH(int, startTimeMs); + QFETCH(Qt::TimerType, timerType); + + QTimer timer; + timer.setTimerType(timerType); + timer.start(startTimeMs); + + const int rt = timer.remainingTime(); + QVERIFY2(rt >= 0 && rt <= startTimeMs, qPrintable(QString::number(rt))); } void tst_QTimer::remainingTimeDuringActivation_data() @@ -228,7 +257,7 @@ void tst_QTimer::basic_chrono() QCOMPARE(timeoutSpy.count(), 0); milliseconds rt = timer.remainingTimeAsDuration(); - QVERIFY2(qAbs(rt.count() - 150) < 50, qPrintable(QString::number(rt.count()))); + QVERIFY2(rt.count() >= 50 && rt.count() <= 200, qPrintable(QString::number(rt.count()))); timeoutSpy.clear(); timer.setSingleShot(true); diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp index 9df52887f7..fd3cc18af5 100644 --- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp +++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp @@ -73,12 +73,12 @@ static inline QString testSuiteWarning() str << "\nCannot find the shared-mime-info test suite\nstarting from: " << QDir::toNativeSeparators(QDir::currentPath()) << "\n" "cd " << QDir::toNativeSeparators(QStringLiteral("tests/auto/corelib/mimetypes/qmimedatabase")) << "\n" - "wget http://cgit.freedesktop.org/xdg/shared-mime-info/snapshot/Release-1-8.zip\n" - "unzip Release-1-8.zip\n"; + "wget http://cgit.freedesktop.org/xdg/shared-mime-info/snapshot/Release-1-10.zip\n" + "unzip Release-1-10.zip\n"; #ifdef Q_OS_WIN - str << "mkdir testfiles\nxcopy /s Release-1-8 s-m-i\n"; + str << "mkdir testfiles\nxcopy /s Release-1-10 s-m-i\n"; #else - str << "ln -s Release-1-8 s-m-i\n"; + str << "ln -s Release-1-10 s-m-i\n"; #endif return result; } @@ -611,7 +611,7 @@ void tst_QMimeDatabase::allMimeTypes() QVERIFY(!lst.isEmpty()); // Hardcoding this is the only way to check both providers find the same number of mimetypes. - QCOMPARE(lst.count(), 749); + QCOMPARE(lst.count(), 779); foreach (const QMimeType &mime, lst) { const QString name = mime.name(); @@ -640,7 +640,7 @@ void tst_QMimeDatabase::suffixes_data() QTest::newRow("mimetype with multiple patterns") << "text/plain" << "*.asc;*.txt;*,v" << "txt"; QTest::newRow("mimetype with uncommon pattern") << "text/x-readme" << "README*" << QString(); QTest::newRow("mimetype with no patterns") << "application/x-ole-storage" << QString() << QString(); - QTest::newRow("default_mimetype") << "application/octet-stream" << "*.bin" << QString(); + QTest::newRow("default_mimetype") << "application/octet-stream" << QString() << QString(); } void tst_QMimeDatabase::suffixes() diff --git a/tests/auto/corelib/plugin/qpluginloader/qpluginloader.pro b/tests/auto/corelib/plugin/qpluginloader/qpluginloader.pro index 3745782dfc..18c9c8d198 100644 --- a/tests/auto/corelib/plugin/qpluginloader/qpluginloader.pro +++ b/tests/auto/corelib/plugin/qpluginloader/qpluginloader.pro @@ -3,6 +3,7 @@ TEMPLATE = subdirs tst.depends = lib theplugin SUBDIRS = lib \ + staticplugin \ theplugin \ tst !android:!win32:!darwin { diff --git a/tests/auto/corelib/plugin/qpluginloader/staticplugin/.gitignore b/tests/auto/corelib/plugin/qpluginloader/staticplugin/.gitignore new file mode 100644 index 0000000000..26f7ecd506 --- /dev/null +++ b/tests/auto/corelib/plugin/qpluginloader/staticplugin/.gitignore @@ -0,0 +1,3 @@ +*staticplugin.prl +libstaticplugin.a +staticplugin.lib diff --git a/tests/auto/corelib/plugin/qpluginloader/staticplugin/main.cpp b/tests/auto/corelib/plugin/qpluginloader/staticplugin/main.cpp new file mode 100644 index 0000000000..d891839b1e --- /dev/null +++ b/tests/auto/corelib/plugin/qpluginloader/staticplugin/main.cpp @@ -0,0 +1,39 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Intel Corporation. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include <QtPlugin> +#include <QObject> + +class StaticPlugin : public QObject +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "SomeIID") +public: + StaticPlugin() {} +}; + +#include "main.moc" diff --git a/tests/auto/corelib/plugin/qpluginloader/staticplugin/staticplugin.pro b/tests/auto/corelib/plugin/qpluginloader/staticplugin/staticplugin.pro new file mode 100644 index 0000000000..ff65ab728c --- /dev/null +++ b/tests/auto/corelib/plugin/qpluginloader/staticplugin/staticplugin.pro @@ -0,0 +1,7 @@ +TEMPLATE = lib +CONFIG += plugin static +SOURCES = main.cpp +QT = core + +# Add extra metadata to the plugin +QMAKE_MOC_OPTIONS += -M ExtraMetaData=StaticPlugin -M ExtraMetaData=foo diff --git a/tests/auto/corelib/plugin/qpluginloader/tst/tst.pro b/tests/auto/corelib/plugin/qpluginloader/tst/tst.pro index c20e56ba4c..a3885f4134 100644 --- a/tests/auto/corelib/plugin/qpluginloader/tst/tst.pro +++ b/tests/auto/corelib/plugin/qpluginloader/tst/tst.pro @@ -8,9 +8,14 @@ HEADERS = ../theplugin/plugininterface.h win32 { CONFIG(debug, debug|release) { TARGET = ../../debug/tst_qpluginloader + LIBS += -L../staticplugin/debug } else { TARGET = ../../release/tst_qpluginloader + LIBS += -L../staticplugin/release } +} else { + LIBS += -L../staticplugin } +LIBS += -lstaticplugin TESTDATA += ../elftest ../machtest diff --git a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp index c517c0809a..4316ea14ea 100644 --- a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp +++ b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Intel Corporation. +** Copyright (C) 2018 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -121,8 +121,11 @@ private slots: void reloadPlugin(); void preloadedPlugin_data(); void preloadedPlugin(); + void staticPlugins(); }; +Q_IMPORT_PLUGIN(StaticPlugin) + void tst_QPluginLoader::cleanup() { // check if the library/plugin was leaked @@ -520,5 +523,37 @@ void tst_QPluginLoader::preloadedPlugin() QVERIFY(lib.unload()); } +void tst_QPluginLoader::staticPlugins() +{ + const QObjectList instances = QPluginLoader::staticInstances(); + QVERIFY(instances.size()); + + bool found = false; + for (QObject *obj : instances) { + found = obj->metaObject()->className() == QLatin1String("StaticPlugin"); + if (found) + break; + } + QVERIFY(found); + + const auto plugins = QPluginLoader::staticPlugins(); + QCOMPARE(plugins.size(), instances.size()); + + // find the metadata + QJsonObject metaData; + for (const auto &p : plugins) { + metaData = p.metaData(); + found = metaData.value("className").toString() == QLatin1String("StaticPlugin"); + if (found) + break; + } + QVERIFY(found); + + QCOMPARE(metaData.value("version").toInt(), QT_VERSION); + QCOMPARE(metaData.value("IID").toString(), "SomeIID"); + QCOMPARE(metaData.value("ExtraMetaData"), QJsonArray({ "StaticPlugin", "foo" })); +} + + QTEST_MAIN(tst_QPluginLoader) #include "tst_qpluginloader.moc" diff --git a/tests/auto/corelib/serialization/json/tst_qtjson.cpp b/tests/auto/corelib/serialization/json/tst_qtjson.cpp index 4651258ef3..8907704a33 100644 --- a/tests/auto/corelib/serialization/json/tst_qtjson.cpp +++ b/tests/auto/corelib/serialization/json/tst_qtjson.cpp @@ -153,6 +153,18 @@ private Q_SLOTS: void implicitValueType(); void implicitDocumentType(); + void streamSerializationQJsonDocument_data(); + void streamSerializationQJsonDocument(); + void streamSerializationQJsonArray_data(); + void streamSerializationQJsonArray(); + void streamSerializationQJsonObject_data(); + void streamSerializationQJsonObject(); + void streamSerializationQJsonValue_data(); + void streamSerializationQJsonValue(); + void streamSerializationQJsonValueEmpty(); + void streamVariantSerialization(); + void escapeSurrogateCodePoints_data(); + void escapeSurrogateCodePoints(); private: QString testDataDir; }; @@ -3011,5 +3023,188 @@ void tst_QtJson::implicitDocumentType() QCOMPARE(arrayDocument[-1].toInt(123), 123); } +void tst_QtJson::streamSerializationQJsonDocument_data() +{ + QTest::addColumn<QJsonDocument>("document"); + QTest::newRow("empty") << QJsonDocument(); + QTest::newRow("object") << QJsonDocument(QJsonObject{{"value", 42}}); +} + +void tst_QtJson::streamSerializationQJsonDocument() +{ + // Check interface only, implementation is tested through to and from + // json functions. + QByteArray buffer; + QFETCH(QJsonDocument, document); + QJsonDocument output; + QDataStream save(&buffer, QIODevice::WriteOnly); + save << document; + QDataStream load(buffer); + load >> output; + QCOMPARE(output, document); +} + +void tst_QtJson::streamSerializationQJsonArray_data() +{ + QTest::addColumn<QJsonArray>("array"); + QTest::newRow("empty") << QJsonArray(); + QTest::newRow("values") << QJsonArray{665, 666, 667}; +} + +void tst_QtJson::streamSerializationQJsonArray() +{ + // Check interface only, implementation is tested through to and from + // json functions. + QByteArray buffer; + QFETCH(QJsonArray, array); + QJsonArray output; + QDataStream save(&buffer, QIODevice::WriteOnly); + save << array; + QDataStream load(buffer); + load >> output; + QCOMPARE(output, array); +} + +void tst_QtJson::streamSerializationQJsonObject_data() +{ + QTest::addColumn<QJsonObject>("object"); + QTest::newRow("empty") << QJsonObject(); + QTest::newRow("non-empty") << QJsonObject{{"foo", 665}, {"bar", 666}}; +} + +void tst_QtJson::streamSerializationQJsonObject() +{ + // Check interface only, implementation is tested through to and from + // json functions. + QByteArray buffer; + QFETCH(QJsonObject, object); + QJsonObject output; + QDataStream save(&buffer, QIODevice::WriteOnly); + save << object; + QDataStream load(buffer); + load >> output; + QCOMPARE(output, object); +} + +void tst_QtJson::streamSerializationQJsonValue_data() +{ + QTest::addColumn<QJsonValue>("value"); + QTest::newRow("double") << QJsonValue{665}; + QTest::newRow("bool") << QJsonValue{true}; + QTest::newRow("string") << QJsonValue{QStringLiteral("bum")}; + QTest::newRow("array") << QJsonValue{QJsonArray{12,1,5,6,7}}; + QTest::newRow("object") << QJsonValue{QJsonObject{{"foo", 665}, {"bar", 666}}}; + // test json escape sequence + QTest::newRow("array with 0xD800") << QJsonValue(QJsonArray{QString(0xD800)}); + QTest::newRow("array with 0xDF06,0xD834") << QJsonValue(QJsonArray{QString(0xDF06).append(0xD834)}); +} + +void tst_QtJson::streamSerializationQJsonValue() +{ + QByteArray buffer; + QFETCH(QJsonValue, value); + QJsonValue output; + QDataStream save(&buffer, QIODevice::WriteOnly); + save << value; + QDataStream load(buffer); + load >> output; + QCOMPARE(output, value); +} + +void tst_QtJson::streamSerializationQJsonValueEmpty() +{ + QByteArray buffer; + { + QJsonValue undef{QJsonValue::Undefined}; + QDataStream save(&buffer, QIODevice::WriteOnly); + save << undef; + QDataStream load(buffer); + QJsonValue output; + load >> output; + QVERIFY(output.isUndefined()); + } + { + QJsonValue null{QJsonValue::Null}; + QDataStream save(&buffer, QIODevice::WriteOnly); + save << null; + QDataStream load(buffer); + QJsonValue output; + load >> output; + QVERIFY(output.isNull()); + } +} + +void tst_QtJson::streamVariantSerialization() +{ + // Check interface only, implementation is tested through to and from + // json functions. + QByteArray buffer; + { + QJsonDocument objectDoc(QJsonArray{665, 666, 667}); + QVariant output; + QVariant variant(objectDoc); + QDataStream save(&buffer, QIODevice::WriteOnly); + save << variant; + QDataStream load(buffer); + load >> output; + QCOMPARE(output.userType(), QMetaType::QJsonDocument); + QCOMPARE(output.toJsonDocument(), objectDoc); + } + { + QJsonArray array{665, 666, 667}; + QVariant output; + QVariant variant(array); + QDataStream save(&buffer, QIODevice::WriteOnly); + save << variant; + QDataStream load(buffer); + load >> output; + QCOMPARE(output.userType(), QMetaType::QJsonArray); + QCOMPARE(output.toJsonArray(), array); + } + { + QJsonObject obj{{"foo", 42}}; + QVariant output; + QVariant variant(obj); + QDataStream save(&buffer, QIODevice::WriteOnly); + save << variant; + QDataStream load(buffer); + load >> output; + QCOMPARE(output.userType(), QMetaType::QJsonObject); + QCOMPARE(output.toJsonObject(), obj); + } + { + QJsonValue value{42}; + QVariant output; + QVariant variant(value); + QDataStream save(&buffer, QIODevice::WriteOnly); + save << variant; + QDataStream load(buffer); + load >> output; + QCOMPARE(output.userType(), QMetaType::QJsonValue); + QCOMPARE(output.toJsonValue(), value); + } +} + +void tst_QtJson::escapeSurrogateCodePoints_data() +{ + QTest::addColumn<QString>("str"); + QTest::addColumn<QByteArray>("escStr"); + QTest::newRow("0xD800") << QString(0xD800) << QByteArray("\\ud800"); + QTest::newRow("0xDF06,0xD834") << QString(0xDF06).append(0xD834) << QByteArray("\\udf06\\ud834"); +} + +void tst_QtJson::escapeSurrogateCodePoints() +{ + QFETCH(QString, str); + QFETCH(QByteArray, escStr); + QJsonArray array; + array.append(str); + QByteArray buffer; + QDataStream save(&buffer, QIODevice::WriteOnly); + save << array; + // verify the buffer has escaped values + QVERIFY(buffer.contains(escStr)); +} + QTEST_MAIN(tst_QtJson) #include "tst_qtjson.moc" diff --git a/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp b/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp index 4b753eab6b..f69ce4120d 100644 --- a/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp +++ b/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp @@ -97,6 +97,10 @@ private slots: void validation(); void toDiagnosticNotation_data(); void toDiagnosticNotation(); + + void datastreamSerialization_data(); + void datastreamSerialization(); + void streamVariantSerialization(); }; // Get the validation data from TinyCBOR (see src/3rdparty/tinycbor/tests/parser/data.cpp) @@ -380,11 +384,17 @@ void tst_QCborValue::arrayDefaultInitialization() QVERIFY(v.isArray()); QVERIFY(!v.isMap()); QVERIFY(!v.isTag()); - QVERIFY(v[0].isUndefined()); QCborArray a2 = v.toArray(); QVERIFY(a2.isEmpty()); QCOMPARE(a2, a); + auto front = v[0]; + QVERIFY(front.isUndefined()); + front = 1; + QCOMPARE(v[0], 1); + QVERIFY(a2.isEmpty()); + a2 = v.toArray(); + QCOMPARE(a2.size(), 1); } void tst_QCborValue::mapDefaultInitialization() @@ -421,7 +431,7 @@ void tst_QCborValue::mapDefaultInitialization() QVERIFY(m == QCborMap{}); QVERIFY(QCborMap{} == m); - QCborValue v(m); + const QCborValue v(m); QVERIFY(v.isMap()); QVERIFY(!v.isArray()); QVERIFY(!v.isTag()); @@ -723,6 +733,31 @@ void tst_QCborValue::arrayMutation() QCOMPARE(a.at(1), QCborValue(-1)); QCOMPARE(a2.at(1), QCborValue(nullptr)); QCOMPARE(++it, end); + + // Array accessed via value: + QCborValue val(a); + val[2] = QCborArray{2, 3, 5, 7}; + QCOMPARE(a.size(), 2); // Unchanged + QVERIFY(val.isArray()); + QCOMPARE(val.toArray().size(), 3); + val[2][4] = 17; + QVERIFY(val.isArray()); + QVERIFY(val[2].isArray()); + QCOMPARE(val[2].toArray().size(), 5); + QCOMPARE(val[2][4], 17); + QCOMPARE(val.toArray().size(), 3); + val[3] = 42; + QVERIFY(val.isArray()); + QCOMPARE(val.toArray().size(), 4); + QCOMPARE(val[3], 42); + + // Coerce to map on string key: + const QLatin1String any("any"); + val[any] = any; + QVERIFY(val.isMap()); + QCOMPARE(val.toMap().size(), 5); + QVERIFY(val[2].isArray()); + QCOMPARE(val[2].toArray().size(), 5); } void tst_QCborValue::mapMutation() @@ -778,6 +813,30 @@ void tst_QCborValue::mapMutation() QCOMPARE((m.end() - 1)->toInteger(), -1); QVERIFY((m2.end() - 1)->isNull()); QCOMPARE(++it, end); + + // Map accessed via value: + QCborValue val(m); + val[7] = QCborMap({{0, 2}, {1, 3}, {2, 5}}); + QCOMPARE(m.size(), 2); // Unchanged + QVERIFY(val.isMap()); + QCOMPARE(val.toMap().size(), 3); + val[7][3] = 11; + QVERIFY(val.isMap()); + QVERIFY(val[7].isMap()); + QCOMPARE(val[7].toMap().size(), 4); + val[14] = 42; + QVERIFY(val.isMap()); + QCOMPARE(val.toMap().size(), 4); + + const QLatin1String any("any"); + const QString hello(QStringLiteral("Hello World")); + val[any][3][hello] = any; + QVERIFY(val.isMap()); + QCOMPARE(val.toMap().size(), 5); + QVERIFY(val[any].isMap()); + QCOMPARE(val[any].toMap().size(), 1); + QVERIFY(val[any][3].isMap()); + QCOMPARE(val[any][3].toMap().size(), 1); } void tst_QCborValue::arrayPrepend() @@ -1690,6 +1749,83 @@ void tst_QCborValue::toDiagnosticNotation() QCOMPARE(result, expected); } + +void tst_QCborValue::datastreamSerialization_data() +{ + addCommonCborData(); +} + +void tst_QCborValue::datastreamSerialization() +{ + QFETCH(QCborValue, v); + QByteArray buffer; + { + QDataStream save(&buffer, QIODevice::WriteOnly); + save << v; + QDataStream load(buffer); + QCborValue output; + load >> output; + QCOMPARE(output, v); + } + if (v.isArray()) { + QCborArray array = v.toArray(); + QDataStream save(&buffer, QIODevice::WriteOnly); + save << array; + QDataStream load(buffer); + QCborValue output; + load >> output; + QCOMPARE(output, array); + } else if (v.isMap()) { + QCborMap map = v.toMap(); + QDataStream save(&buffer, QIODevice::WriteOnly); + save << map; + QDataStream load(buffer); + QCborValue output; + load >> output; + QCOMPARE(output, map); + } +} + +void tst_QCborValue::streamVariantSerialization() +{ + // Check interface only, implementation is tested through to and from + // cbor functions. + QByteArray buffer; + { + QCborArray array{665, 666, 667}; + QVariant output; + QVariant variant = QVariant::fromValue(array); + QDataStream save(&buffer, QIODevice::WriteOnly); + save << variant; + QDataStream load(buffer); + load >> output; + QCOMPARE(output.userType(), QMetaType::QCborArray); + QCOMPARE(qvariant_cast<QCborArray>(output), array); + } + { + QCborMap obj{{"foo", 42}}; + QVariant output; + QVariant variant = QVariant::fromValue(obj); + QDataStream save(&buffer, QIODevice::WriteOnly); + save << variant; + QDataStream load(buffer); + load >> output; + QCOMPARE(output.userType(), QMetaType::QCborMap); + QCOMPARE(qvariant_cast<QCborMap>(output), obj); + } + { + QCborValue value{42}; + QVariant output; + QVariant variant = QVariant::fromValue(value); + QDataStream save(&buffer, QIODevice::WriteOnly); + save << variant; + QDataStream load(buffer); + load >> output; + QCOMPARE(output.userType(), QMetaType::QCborValue); + QCOMPARE(qvariant_cast<QCborValue>(output), value); + } +} + QTEST_MAIN(tst_QCborValue) #include "tst_qcborvalue.moc" diff --git a/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp index 011a0e1a85..d204727bbd 100644 --- a/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp @@ -135,6 +135,15 @@ private slots: void stream_QByteArray2(); + void stream_QJsonDocument(); + void stream_QJsonArray(); + void stream_QJsonObject(); + void stream_QJsonValue(); + + void stream_QCborArray(); + void stream_QCborMap(); + void stream_QCborValue(); + void setVersion_data(); void setVersion(); @@ -2095,6 +2104,138 @@ void tst_QDataStream::stream_QByteArray2() } } +void tst_QDataStream::stream_QJsonDocument() +{ + QByteArray buffer; + { + QDataStream save(&buffer, QIODevice::WriteOnly); + save << QByteArrayLiteral("invalidJson"); + QDataStream load(&buffer, QIODevice::ReadOnly); + QJsonDocument doc; + load >> doc; + QVERIFY(doc.isEmpty()); + QVERIFY(load.status() != QDataStream::Ok); + QCOMPARE(load.status(), QDataStream::ReadCorruptData); + } + { + QDataStream save(&buffer, QIODevice::WriteOnly); + QJsonDocument docSave(QJsonArray{1,2,3}); + save << docSave; + QDataStream load(&buffer, QIODevice::ReadOnly); + QJsonDocument docLoad; + load >> docLoad; + QCOMPARE(docLoad, docSave); + } +} + +void tst_QDataStream::stream_QJsonArray() +{ + QByteArray buffer; + { + QDataStream save(&buffer, QIODevice::WriteOnly); + save << QByteArrayLiteral("invalidJson"); + QDataStream load(&buffer, QIODevice::ReadOnly); + QJsonArray array; + load >> array; + QVERIFY(array.isEmpty()); + QVERIFY(load.status() != QDataStream::Ok); + QCOMPARE(load.status(), QDataStream::ReadCorruptData); + } + { + QDataStream save(&buffer, QIODevice::WriteOnly); + QJsonArray arraySave(QJsonArray{1,2,3}); + save << arraySave; + QDataStream load(&buffer, QIODevice::ReadOnly); + QJsonArray arrayLoad; + load >> arrayLoad; + QCOMPARE(arrayLoad, arraySave); + } +} + +void tst_QDataStream::stream_QJsonObject() +{ + QByteArray buffer; + { + QDataStream save(&buffer, QIODevice::WriteOnly); + save << QByteArrayLiteral("invalidJson"); + QDataStream load(&buffer, QIODevice::ReadOnly); + QJsonObject object; + load >> object; + QVERIFY(object.isEmpty()); + QVERIFY(load.status() != QDataStream::Ok); + QCOMPARE(load.status(), QDataStream::ReadCorruptData); + } + { + QDataStream save(&buffer, QIODevice::WriteOnly); + QJsonObject objSave{{"foo", 1}, {"bar", 2}}; + save << objSave; + QDataStream load(&buffer, QIODevice::ReadOnly); + QJsonObject objLoad; + load >> objLoad; + QCOMPARE(objLoad, objSave); + } +} + +void tst_QDataStream::stream_QJsonValue() +{ + QByteArray buffer; + { + QDataStream save(&buffer, QIODevice::WriteOnly); + save << quint8(42); + QDataStream load(&buffer, QIODevice::ReadOnly); + QJsonValue value; + load >> value; + QVERIFY(value.isUndefined()); + QVERIFY(load.status() != QDataStream::Ok); + QCOMPARE(load.status(), QDataStream::ReadCorruptData); + } + { + QDataStream save(&buffer, QIODevice::WriteOnly); + QJsonValue valueSave{42}; + save << valueSave; + QDataStream load(&buffer, QIODevice::ReadOnly); + QJsonValue valueLoad; + load >> valueLoad; + QCOMPARE(valueLoad, valueSave); + } +} + +void tst_QDataStream::stream_QCborArray() +{ + QByteArray buffer; + QDataStream save(&buffer, QIODevice::WriteOnly); + QCborArray arraySave({1, 2, 3}); + save << arraySave; + QDataStream load(&buffer, QIODevice::ReadOnly); + QCborArray arrayLoad; + load >> arrayLoad; + QCOMPARE(arrayLoad, arraySave); +} + +void tst_QDataStream::stream_QCborMap() +{ + QByteArray buffer; + QDataStream save(&buffer, QIODevice::WriteOnly); + QCborMap objSave{{"foo", 1}, {"bar", 2}}; + save << objSave; + QDataStream load(&buffer, QIODevice::ReadOnly); + QCborMap objLoad; + load >> objLoad; + QCOMPARE(objLoad, objSave); +} + +void tst_QDataStream::stream_QCborValue() +{ + QByteArray buffer; + QDataStream save(&buffer, QIODevice::WriteOnly); + QCborValue valueSave{42}; + save << valueSave; + QDataStream load(&buffer, QIODevice::ReadOnly); + QCborValue valueLoad; + load >> valueLoad; + QCOMPARE(valueLoad, valueSave); +} + void tst_QDataStream::setVersion_data() { QTest::addColumn<int>("vers"); diff --git a/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp index 159fbd7b03..8bb35554c8 100644 --- a/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp +++ b/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp @@ -2665,28 +2665,30 @@ void tst_QTextStream::useCase2() // ------------------------------------------------------------------------------ void tst_QTextStream::manipulators_data() { - QTest::addColumn<int>("flags"); + QTest::addColumn<int>("base"); + QTest::addColumn<int>("alignFlag"); + QTest::addColumn<int>("numberFlag"); QTest::addColumn<int>("width"); QTest::addColumn<double>("realNumber"); QTest::addColumn<int>("intNumber"); QTest::addColumn<QString>("textData"); QTest::addColumn<QByteArray>("result"); - QTest::newRow("no flags") << 0 << 0 << 5.0 << 5 << QString("five") << QByteArray("55five"); - QTest::newRow("rightadjust") << 0 << 10 << 5.0 << 5 << QString("five") << QByteArray(" 5 5 five"); - - // ### FIX -// QTest::newRow("leftadjust") << int(QTextStream::left) << 10 << 5.0 << 5 << QString("five") << QByteArray("5 5 five "); -// QTest::newRow("showpos") << int(QTextStream::showpos) << 10 << 5.0 << 5 << QString("five") << QByteArray(" +5 +5 five"); -// QTest::newRow("showpos2") << int(QTextStream::showpos) << 5 << 3.14 << -5 << QString("five") << QByteArray("+3.14 -5 five"); -// QTest::newRow("hex") << int(QTextStream::hex | QTextStream::showbase) << 5 << 3.14 << -5 << QString("five") << QByteArray(" 3.14 -0x5 five"); -// QTest::newRow("hex uppercase") << int(QTextStream::hex | QTextStream::uppercase | QTextStream::showbase) << 5 << 3.14 << -5 << QString("five") << QByteArray(" 3.14 -0X5 five"); + QTest::newRow("no flags") << 10 << 0 << 0 << 0 << 5.0 << 5 << QString("five") << QByteArray("55five"); + QTest::newRow("rightadjust") << 10 << int(QTextStream::AlignRight) << 0 << 10 << 5.0 << 5 << QString("five") << QByteArray(" 5 5 five"); + QTest::newRow("leftadjust") << 10 << int(QTextStream::AlignLeft) << 0 << 10 << 5.0 << 5 << QString("five") << QByteArray("5 5 five "); + QTest::newRow("showpos") << 10 << int(QTextStream::AlignRight) << int(QTextStream::ForceSign) << 10 << 5.0 << 5 << QString("five") << QByteArray(" +5 +5 five"); + QTest::newRow("showpos2") << 10 << int(QTextStream::AlignRight) << int(QTextStream::ForceSign) << 5 << 3.14 << -5 << QString("five") << QByteArray("+3.14 -5 five"); + QTest::newRow("hex") << 16 << int(QTextStream::AlignRight) << int(QTextStream::ShowBase) << 5 << 3.14 << -5 << QString("five") << QByteArray(" 3.14 -0x5 five"); + QTest::newRow("hex") << 16 << int(QTextStream::AlignRight) << int(QTextStream::ShowBase | QTextStream::UppercaseBase) << 5 << 3.14 << -5 << QString("five") << QByteArray(" 3.14 -0X5 five"); } // ------------------------------------------------------------------------------ void tst_QTextStream::manipulators() { -// QFETCH(int, flags); + QFETCH(int, base); + QFETCH(int, alignFlag); + QFETCH(int, numberFlag); QFETCH(int, width); QFETCH(double, realNumber); QFETCH(int, intNumber); @@ -2700,14 +2702,16 @@ void tst_QTextStream::manipulators() stream.setCodec(QTextCodec::codecForName("ISO-8859-1")); stream.setAutoDetectUnicode(true); -// stream.setFlags(flags); + stream.setIntegerBase(base); + stream.setFieldAlignment(QTextStream::FieldAlignment(alignFlag)); + stream.setNumberFlags(QTextStream::NumberFlag(numberFlag)); stream.setFieldWidth(width); stream << realNumber; stream << intNumber; stream << textData; stream.flush(); - QCOMPARE(buffer.data().constData(), result.constData()); + QCOMPARE(buffer.data(), result); } void tst_QTextStream::generateBOM() diff --git a/tests/auto/corelib/tools/qbytearraylist/tst_qbytearraylist.cpp b/tests/auto/corelib/tools/qbytearraylist/tst_qbytearraylist.cpp index 85b4c4bfb7..2d2c536453 100644 --- a/tests/auto/corelib/tools/qbytearraylist/tst_qbytearraylist.cpp +++ b/tests/auto/corelib/tools/qbytearraylist/tst_qbytearraylist.cpp @@ -49,6 +49,9 @@ private slots: void operator_plus() const; void operator_plus_data() const; + void indexOf_data() const; + void indexOf() const; + void initializerList() const; }; @@ -259,6 +262,29 @@ void tst_QByteArrayList::operator_plus_data() const << ( QByteArrayList() << "a" << "" << "c" ); } +void tst_QByteArrayList::indexOf_data() const +{ + QTest::addColumn<QByteArrayList>("list"); + QTest::addColumn<QByteArray>("item"); + QTest::addColumn<int>("expectedResult"); + + QTest::newRow("empty") << QByteArrayList() << QByteArray("a") << -1; + QTest::newRow("found_1") << ( QByteArrayList() << "a" ) << QByteArray("a") << 0; + QTest::newRow("not_found_1") << ( QByteArrayList() << "a" ) << QByteArray("b") << -1; + QTest::newRow("found_2") << ( QByteArrayList() << "hello" << "world" ) << QByteArray("world") << 1; + QTest::newRow("returns_first") << ( QByteArrayList() << "hello" << "world" << "hello" << "again" ) << QByteArray("hello") << 0; +} + +void tst_QByteArrayList::indexOf() const +{ + QFETCH(QByteArrayList, list); + QFETCH(QByteArray, item); + QFETCH(int, expectedResult); + + QCOMPARE(list.indexOf(item), expectedResult); + QCOMPARE(list.indexOf(item.constData()), expectedResult); +} + void tst_QByteArrayList::initializerList() const { #ifdef Q_COMPILER_INITIALIZER_LISTS diff --git a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp index 62c29229e1..7980f1f8f4 100644 --- a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp +++ b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp @@ -74,6 +74,7 @@ private slots: void testHelpOption_data(); void testHelpOption(); void testQuoteEscaping(); + void testUnknownOption(); }; static char *empty_argv[] = { 0 }; @@ -648,6 +649,27 @@ void tst_QCommandLineParser::testQuoteEscaping() #endif // QT_CONFIG(process) } +void tst_QCommandLineParser::testUnknownOption() +{ +#if !QT_CONFIG(process) + QSKIP("This test requires QProcess support"); +#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) + QSKIP("Deploying executable applications to file system on Android not supported."); +#else + QCoreApplication app(empty_argc, empty_argv); + QProcess process; + process.start("testhelper/qcommandlineparser_test_helper", QStringList() << + QString::number(QCommandLineParser::ParseAsLongOptions) << + "-unknown-option"); + QVERIFY(process.waitForFinished(5000)); + QCOMPARE(process.exitStatus(), QProcess::NormalExit); + process.setReadChannel(QProcess::StandardError); + QString output = process.readAll(); + QVERIFY2(output.contains("qcommandlineparser_test_helper"), qPrintable(output)); // separate in case of .exe extension + QVERIFY2(output.contains(": Unknown option 'unknown-option'"), qPrintable(output)); +#endif // QT_CONFIG(process) +} + QTEST_APPLESS_MAIN(tst_QCommandLineParser) #include "tst_qcommandlineparser.moc" diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp index b128ccebc5..38b72ab91f 100644 --- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp @@ -37,9 +37,6 @@ #ifdef Q_OS_WIN # include <qt_windows.h> -# if defined(Q_OS_WINRT) -# define tzset() -# endif #endif class tst_QDateTime : public QObject @@ -81,9 +78,11 @@ private slots: void toString_isoDate_data(); void toString_isoDate(); void toString_isoDate_extra(); +#if QT_CONFIG(datestring) void toString_textDate_data(); void toString_textDate(); void toString_textDate_extra(); +#endif void toString_rfcDate_data(); void toString_rfcDate(); void toString_enumformat(); @@ -145,9 +144,7 @@ private slots: void isDaylightTime() const; void daylightTransitions() const; void timeZones() const; -#if defined(Q_OS_UNIX) void systemTimeZoneChange() const; -#endif void invalid() const; @@ -174,7 +171,7 @@ private: void reset(const QByteArray &zone) { qputenv("TZ", zone.constData()); - tzset(); + qTzSet(); } ~TimeZoneRollback() { @@ -182,7 +179,7 @@ private: qunsetenv("TZ"); else qputenv("TZ", prior.constData()); - tzset(); + qTzSet(); } }; }; @@ -805,11 +802,11 @@ void tst_QDateTime::toString_isoDate_data() QTest::newRow("positive OffsetFromUTC") << dt << Qt::ISODate << QString("1978-11-09T13:28:34+05:30"); - dt.setUtcOffset(-7200); + dt.setOffsetFromUtc(-7200); QTest::newRow("negative OffsetFromUTC") << dt << Qt::ISODate << QString("1978-11-09T13:28:34-02:00"); - dt.setUtcOffset(-900); + dt.setOffsetFromUtc(-900); QTest::newRow("negative non-integral OffsetFromUTC") << dt << Qt::ISODate << QString("1978-11-09T13:28:34-00:15"); @@ -845,7 +842,7 @@ void tst_QDateTime::toString_isoDate() QCOMPARE(resultDatetime.date(), datetime.date()); QCOMPARE(resultDatetime.time(), datetime.time()); QCOMPARE(resultDatetime.timeSpec(), datetime.timeSpec()); - QCOMPARE(resultDatetime.utcOffset(), datetime.utcOffset()); + QCOMPARE(resultDatetime.offsetFromUtc(), datetime.offsetFromUtc()); } else { QCOMPARE(resultDatetime, QDateTime()); } @@ -875,12 +872,14 @@ void tst_QDateTime::toString_isoDate_extra() #endif // timezone } +#if QT_CONFIG(datestring) void tst_QDateTime::toString_textDate_data() { QTest::addColumn<QDateTime>("datetime"); QTest::addColumn<QString>("expected"); - QString wednesdayJanuary = QDate::shortDayName(3) + ' ' + QDate::shortMonthName(1); + QString wednesdayJanuary = QLocale::system().dayName(3, QLocale::ShortFormat) + + ' ' + QLocale::system().monthName(1, QLocale::ShortFormat); QTest::newRow("localtime") << QDateTime(QDate(2013, 1, 2), QTime(1, 2, 3), Qt::LocalTime) << wednesdayJanuary + QString(" 2 01:02:03 2013"); @@ -909,7 +908,7 @@ void tst_QDateTime::toString_textDate() QCOMPARE(resultDatetime.date(), datetime.date()); QCOMPARE(resultDatetime.time(), datetime.time()); QCOMPARE(resultDatetime.timeSpec(), datetime.timeSpec()); - QCOMPARE(resultDatetime.utcOffset(), datetime.utcOffset()); + QCOMPARE(resultDatetime.offsetFromUtc(), datetime.offsetFromUtc()); } void tst_QDateTime::toString_textDate_extra() @@ -958,6 +957,7 @@ void tst_QDateTime::toString_textDate_extra() dt = QDateTime::fromMSecsSinceEpoch(0, Qt::UTC); QVERIFY(dt.toString().endsWith(GMT)); } +#endif // datestring void tst_QDateTime::toString_rfcDate_data() { @@ -973,11 +973,11 @@ void tst_QDateTime::toString_rfcDate_data() << QDateTime(QDate(1978, 11, 9), QTime(13, 28, 34), Qt::UTC) << QString("09 Nov 1978 13:28:34 +0000"); QDateTime dt(QDate(1978, 11, 9), QTime(13, 28, 34)); - dt.setUtcOffset(19800); + dt.setOffsetFromUtc(19800); QTest::newRow("positive OffsetFromUTC") << dt << QString("09 Nov 1978 13:28:34 +0530"); - dt.setUtcOffset(-7200); + dt.setOffsetFromUtc(-7200); QTest::newRow("negative OffsetFromUTC") << dt << QString("09 Nov 1978 13:28:34 -0200"); @@ -3425,33 +3425,10 @@ void tst_QDateTime::timeZones() const QCOMPARE(future.offsetFromUtc(), 28800); } -#if defined(Q_OS_UNIX) -// Currently disabled on Windows as adjusting the timezone -// requires additional privileges that aren't normally -// enabled for a process. This can be achieved by calling -// AdjustTokenPrivileges() and then SetTimeZoneInformation(), -// which will require linking to a different library to access that API. -static void setTimeZone(const QByteArray &tz) -{ - qputenv("TZ", tz); - ::tzset(); - -// following left for future reference, see comment above -// #if defined(Q_OS_WIN32) -// ::_tzset(); -// #endif -} - void tst_QDateTime::systemTimeZoneChange() const { - struct ResetTZ { - QByteArray original; - ResetTZ() : original(qgetenv("TZ")) {} - ~ResetTZ() { setTimeZone(original); } - } scopedReset; - // Set the timezone to Brisbane time - setTimeZone(QByteArray("AEST-10:00")); + TimeZoneRollback useZone(QByteArray("AEST-10:00")); QDateTime localDate = QDateTime(QDate(2012, 6, 1), QTime(2, 15, 30), Qt::LocalTime); QDateTime utcDate = QDateTime(QDate(2012, 6, 1), QTime(2, 15, 30), Qt::UTC); @@ -3464,16 +3441,18 @@ void tst_QDateTime::systemTimeZoneChange() const QVERIFY(tzDate.timeZone().isValid()); // Change to Indian time - setTimeZone(QByteArray("IST-05:30")); + useZone.reset(QByteArray("IST-05:30")); QCOMPARE(localDate, QDateTime(QDate(2012, 6, 1), QTime(2, 15, 30), Qt::LocalTime)); +#ifdef Q_OS_WINRT + QEXPECT_FAIL("", "WinRT gets this wrong, QTBUG-71185", Continue); +#endif QVERIFY(localMsecs != localDate.toMSecsSinceEpoch()); QCOMPARE(utcDate, QDateTime(QDate(2012, 6, 1), QTime(2, 15, 30), Qt::UTC)); QCOMPARE(utcDate.toMSecsSinceEpoch(), utcMsecs); QCOMPARE(tzDate, QDateTime(QDate(2012, 6, 1), QTime(2, 15, 30), QTimeZone("Australia/Brisbane"))); QCOMPARE(tzDate.toMSecsSinceEpoch(), tzMsecs); } -#endif void tst_QDateTime::invalid() const { diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index 230ae4d8aa..be2e2a2e08 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -2002,9 +2002,11 @@ static void setWinLocaleInfo(LCTYPE type, const QString &value) # define LOCALE_SSHORTTIME 0x00000079 #endif -class RestoreLocaleHelper { +class RestoreLocaleHelper +{ public: - RestoreLocaleHelper() { + RestoreLocaleHelper() + { m_decimal = getWinLocaleInfo(LOCALE_SDECIMAL); m_thousand = getWinLocaleInfo(LOCALE_STHOUSAND); m_sdate = getWinLocaleInfo(LOCALE_SSHORTDATE); @@ -2012,7 +2014,8 @@ public: m_time = getWinLocaleInfo(LOCALE_SSHORTTIME); } - ~RestoreLocaleHelper() { + ~RestoreLocaleHelper() + { // restore these, or the user will get a surprise setWinLocaleInfo(LOCALE_SDECIMAL, m_decimal); setWinLocaleInfo(LOCALE_STHOUSAND, m_thousand); @@ -2020,12 +2023,10 @@ public: setWinLocaleInfo(LOCALE_SLONGDATE, m_ldate); setWinLocaleInfo(LOCALE_SSHORTTIME, m_time); - // make sure QLocale::system() gets updated - QLocalePrivate::updateSystemPrivate(); + QSystemLocale dummy; // to provoke a refresh of the system locale } QString m_decimal, m_thousand, m_sdate, m_ldate, m_time; - }; void tst_QLocale::windowsDefaultLocale() @@ -2041,8 +2042,7 @@ void tst_QLocale::windowsDefaultLocale() const QString shortTimeFormat = QStringLiteral("h^m^s"); setWinLocaleInfo(LOCALE_SSHORTTIME, shortTimeFormat); - // make sure QLocale::system() gets updated - QLocalePrivate::updateSystemPrivate(); + QSystemLocale dummy; // to provoke a refresh of the system locale QLocale locale = QLocale::system(); // make sure we are seeing the system's format strings @@ -2783,9 +2783,11 @@ void tst_QLocale::textDirection_data() case QLocale::Sabaean: case QLocale::Samaritan: case QLocale::Sindhi: + case QLocale::SouthernKurdish: case QLocale::Syriac: case QLocale::Uighur: case QLocale::Urdu: + case QLocale::WesternBalochi: case QLocale::Yiddish: // false if there is no locale data for language: rightToLeft = (QLocale(QLocale::Language(language)).language() diff --git a/tests/auto/corelib/tools/qoffsetstringarray/qoffsetstringarray.pro b/tests/auto/corelib/tools/qoffsetstringarray/qoffsetstringarray.pro new file mode 100644 index 0000000000..c8e6a8e05a --- /dev/null +++ b/tests/auto/corelib/tools/qoffsetstringarray/qoffsetstringarray.pro @@ -0,0 +1,6 @@ +CONFIG += testcase +TARGET = tst_qoffsetstringarray +QT = core testlib core-private +CONFIG += c++11 +CONFIG += strict_c++ +SOURCES = $$PWD/tst_qoffsetstringarray.cpp diff --git a/tests/auto/corelib/tools/qoffsetstringarray/tst_qoffsetstringarray.cpp b/tests/auto/corelib/tools/qoffsetstringarray/tst_qoffsetstringarray.cpp new file mode 100644 index 0000000000..dfa0450b18 --- /dev/null +++ b/tests/auto/corelib/tools/qoffsetstringarray/tst_qoffsetstringarray.cpp @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtTest/QtTest> + +#include <private/qoffsetstringarray_p.h> + + +class tst_QOffsetStringArray : public QObject +{ + Q_OBJECT + +private slots: + void init(); + void access(); +}; + + +constexpr const auto messages = qOffsetStringArray( + "level - 0", + "level - 1", + "level - 2", + "level - 3", + "level - 4", + "" +); + +constexpr const auto messages257 = qOffsetStringArray( + "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", + + "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", + + "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "end" +); + +constexpr const auto messagesBigOffsets = qOffsetStringArray( + " 10 20 30 40 50 60 70 80 90", + " 10 20 30 40 50 60 70 80 90", + " 10 20 30 40 50 60 70 80 90", + " 10 20 30 40 50 60 70 80 90" +); + +void tst_QOffsetStringArray::init() +{ + static_assert(messages.sizeString == 51, "message.sizeString"); + static_assert(messages.sizeOffsets == 6, "message.sizeOffsets"); + static_assert(std::is_same<decltype(messages)::Type, quint8>::value, "messages::Type != quint8"); + + static_assert(messages257.sizeOffsets == 257, "messages257.sizeOffsets"); + static_assert(messages257.sizeString == 260, "messages257.sizeString"); + static_assert(std::is_same<decltype(messages257)::Type, quint16>::value, + "messages257::Type != quint16"); + + static_assert(messagesBigOffsets.sizeOffsets == 4, "messagesBigOffsets.sizeOffsets"); + static_assert(messagesBigOffsets.sizeString == 364, "messagesBigOffsets.sizeString"); + static_assert(std::is_same<decltype(messagesBigOffsets)::Type, quint16>::value, + "messagesBigOffsets::Type != quint16"); +} + +void tst_QOffsetStringArray::access() +{ + QCOMPARE(messages[0], "level - 0"); + QCOMPARE(messages[1], "level - 1"); + QCOMPARE(messages[2], "level - 2"); + QCOMPARE(messages[3], "level - 3"); + QCOMPARE(messages[4], "level - 4"); + QCOMPARE(messages[5], ""); + QCOMPARE(messages[6], ""); +} + + +QTEST_APPLESS_MAIN(tst_QOffsetStringArray) +#include "tst_qoffsetstringarray.moc" diff --git a/tests/auto/corelib/tools/qpair/tst_qpair.cpp b/tests/auto/corelib/tools/qpair/tst_qpair.cpp index 1d5f7536c8..dedc353e67 100644 --- a/tests/auto/corelib/tools/qpair/tst_qpair.cpp +++ b/tests/auto/corelib/tools/qpair/tst_qpair.cpp @@ -41,8 +41,8 @@ private Q_SLOTS: void taskQTBUG_48780_pairContainingCArray(); }; -class C { char _[4]; }; -class M { char _[4]; }; +class C { C() {} char _[4]; }; +class M { M() {} char _[4]; }; class P { char _[4]; }; QT_BEGIN_NAMESPACE diff --git a/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp b/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp index cb1fd9eb7d..82d58becfe 100644 --- a/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp +++ b/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp @@ -1020,7 +1020,7 @@ void tst_QStringApiSymmetry::trimmed_data() for (int len = 0; len < latin1Whitespace.size(); ++len) { for (int pos = 0; pos < latin1Whitespace.size() - len; ++pos) { const QString unicode = latin1Whitespace.mid(pos, len) + str + latin1Whitespace.mid(pos, len); - const QScopedPointer<const char> escaped(QTest::toString(unicode)); + const QScopedArrayPointer<const char> escaped(QTest::toString(unicode)); QTest::addRow("%s", escaped.data()) << unicode << QStringRef(&str); } } diff --git a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp index a3aec4c299..42bdf62a93 100644 --- a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp +++ b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp @@ -43,7 +43,9 @@ private slots: void removeDuplicates(); void removeDuplicates_data(); void contains(); + void indexOf_data(); void indexOf(); + void lastIndexOf_data(); void lastIndexOf(); void indexOf_regExp(); @@ -141,20 +143,52 @@ void tst_QStringList::lastIndexOf_regExp() } +void tst_QStringList::indexOf_data() +{ + QTest::addColumn<QString>("search"); + QTest::addColumn<int>("from"); + QTest::addColumn<int>("expectedResult"); + + QTest::newRow("harald") << "harald" << 0 << 0; + QTest::newRow("trond") << "trond" << 0 << 1; + QTest::newRow("vohi") << "vohi" << 0 << 2; + QTest::newRow("harald-1") << "harald" << 1 << 3; + + QTest::newRow("hans") << "hans" << 0 << -1; + QTest::newRow("trond-1") << "trond" << 2 << -1; + QTest::newRow("harald-2") << "harald" << -1 << 3; + QTest::newRow("vohi-1") << "vohi" << -3 << 2; +} + void tst_QStringList::indexOf() { QStringList list; list << "harald" << "trond" << "vohi" << "harald"; - QCOMPARE(list.indexOf("harald"), 0); - QCOMPARE(list.indexOf("trond"), 1); - QCOMPARE(list.indexOf("vohi"), 2); - QCOMPARE(list.indexOf("harald", 1), 3); + QFETCH(QString, search); + QFETCH(int, from); + QFETCH(int, expectedResult); - QCOMPARE(list.indexOf("hans"), -1); - QCOMPARE(list.indexOf("trond", 2), -1); - QCOMPARE(list.indexOf("harald", -1), 3); - QCOMPARE(list.indexOf("vohi", -3), 2); + QCOMPARE(list.indexOf(search, from), expectedResult); + QCOMPARE(list.indexOf(QStringView(search), from), expectedResult); + QCOMPARE(list.indexOf(QLatin1String(search.toLatin1()), from), expectedResult); +} + +void tst_QStringList::lastIndexOf_data() +{ + QTest::addColumn<QString>("search"); + QTest::addColumn<int>("from"); + QTest::addColumn<int>("expectedResult"); + + QTest::newRow("harald") << "harald" << -1 << 3; + QTest::newRow("trond") << "trond" << -1 << 1; + QTest::newRow("vohi") << "vohi" << -1 << 2; + QTest::newRow("harald-1") << "harald" << 2 << 0; + + QTest::newRow("hans") << "hans" << -1 << -1; + QTest::newRow("vohi-1") << "vohi" << 1 << -1; + QTest::newRow("vohi-2") << "vohi" << -1 << 2; + QTest::newRow("vohi-3") << "vohi" << -3 << -1; } void tst_QStringList::lastIndexOf() @@ -162,15 +196,13 @@ void tst_QStringList::lastIndexOf() QStringList list; list << "harald" << "trond" << "vohi" << "harald"; - QCOMPARE(list.lastIndexOf("harald"), 3); - QCOMPARE(list.lastIndexOf("trond"), 1); - QCOMPARE(list.lastIndexOf("vohi"), 2); - QCOMPARE(list.lastIndexOf("harald", 2), 0); + QFETCH(QString, search); + QFETCH(int, from); + QFETCH(int, expectedResult); - QCOMPARE(list.lastIndexOf("hans"), -1); - QCOMPARE(list.lastIndexOf("vohi", 1), -1); - QCOMPARE(list.lastIndexOf("vohi", -1), 2); - QCOMPARE(list.lastIndexOf("vohi", -3), -1); + QCOMPARE(list.lastIndexOf(search, from), expectedResult); + QCOMPARE(list.lastIndexOf(QStringView(search), from), expectedResult); + QCOMPARE(list.lastIndexOf(QLatin1String(search.toLatin1()), from), expectedResult); } void tst_QStringList::filter() diff --git a/tests/auto/corelib/tools/tools.pro b/tests/auto/corelib/tools/tools.pro index f28cf21b8b..2a975e67d1 100644 --- a/tests/auto/corelib/tools/tools.pro +++ b/tests/auto/corelib/tools/tools.pro @@ -35,6 +35,7 @@ SUBDIRS=\ qmap_strictiterators \ qmargins \ qmessageauthenticationcode \ + qoffsetstringarray \ qpair \ qpoint \ qpointf \ diff --git a/tests/auto/dbus/qdbusservicewatcher/tst_qdbusservicewatcher.cpp b/tests/auto/dbus/qdbusservicewatcher/tst_qdbusservicewatcher.cpp index b79f3ea5e3..1ba7ee51b1 100644 --- a/tests/auto/dbus/qdbusservicewatcher/tst_qdbusservicewatcher.cpp +++ b/tests/auto/dbus/qdbusservicewatcher/tst_qdbusservicewatcher.cpp @@ -34,22 +34,27 @@ class tst_QDBusServiceWatcher: public QObject { Q_OBJECT - QString serviceName; int testCounter; public: tst_QDBusServiceWatcher(); private slots: void initTestCase(); - void init(); - + void watchForCreation_data(); void watchForCreation(); + void watchForDisappearance_data(); void watchForDisappearance(); void watchForDisappearanceUniqueConnection(); + void watchForOwnerChange_data(); void watchForOwnerChange(); + void modeChange_data(); void modeChange(); void disconnectedConnection(); + void setConnection_data(); void setConnection(); + +private: + QString generateServiceName(); }; tst_QDBusServiceWatcher::tst_QDBusServiceWatcher() @@ -63,18 +68,45 @@ void tst_QDBusServiceWatcher::initTestCase() QVERIFY(con.isConnected()); } -void tst_QDBusServiceWatcher::init() +QString tst_QDBusServiceWatcher::generateServiceName() { + return "com.example.TestService" + QString::number(testCounter++); +} + +void tst_QDBusServiceWatcher::watchForCreation_data() { - // change the service name from test to test - serviceName = "com.example.TestService" + QString::number(testCounter++); + QTest::addColumn<QString>("watchedName"); + QTest::addColumn<QString>("registeredName"); + + //com.example.TestService5 matches com.example.TestService5 + QString name = generateServiceName(); + QTest::newRow("normal") << name << name; + + //com.example* matches com.example.TestService5 + name = generateServiceName(); + QTest::newRow("wildcard") << "com.example*" << name; + + //com.example.TestService5* matches com.example.TestService5 + name = generateServiceName(); + QTest::newRow("wildcard_exact") << name+"*" << name; + + //com.example.TestService5* matches com.example.TestService5.Foo + name = generateServiceName(); + QTest::newRow("wildcard_subdomain") << name+"*" << name + ".Foo"; + + //com.example.TestService5* matches com.example.TestService5.Foo.Bar + name = generateServiceName(); + QTest::newRow("wildcard_subsubdomain") << name+"*" << name + ".Foo.Bar"; } void tst_QDBusServiceWatcher::watchForCreation() { + QFETCH(QString, watchedName); + QFETCH(QString, registeredName); + QDBusConnection con = QDBusConnection::sessionBus(); QVERIFY(con.isConnected()); - QDBusServiceWatcher watcher(serviceName, con, QDBusServiceWatcher::WatchForRegistration); + QDBusServiceWatcher watcher(watchedName, con, QDBusServiceWatcher::WatchForRegistration); QSignalSpy spyR(&watcher, SIGNAL(serviceRegistered(QString))); QSignalSpy spyU(&watcher, SIGNAL(serviceUnregistered(QString))); @@ -82,18 +114,18 @@ void tst_QDBusServiceWatcher::watchForCreation() QTestEventLoop::instance().connect(&watcher, SIGNAL(serviceRegistered(QString)), SLOT(exitLoop())); // register a name - QVERIFY(con.registerService(serviceName)); + QVERIFY(con.registerService(registeredName)); QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); QCOMPARE(spyR.count(), 1); - QCOMPARE(spyR.at(0).at(0).toString(), serviceName); + QCOMPARE(spyR.at(0).at(0).toString(), registeredName); QCOMPARE(spyU.count(), 0); QCOMPARE(spyO.count(), 1); - QCOMPARE(spyO.at(0).at(0).toString(), serviceName); + QCOMPARE(spyO.at(0).at(0).toString(), registeredName); QVERIFY(spyO.at(0).at(1).toString().isEmpty()); QCOMPARE(spyO.at(0).at(2).toString(), con.baseService()); @@ -102,31 +134,39 @@ void tst_QDBusServiceWatcher::watchForCreation() spyO.clear(); // unregister it: - con.unregisterService(serviceName); + con.unregisterService(registeredName); // and register again - QVERIFY(con.registerService(serviceName)); + QVERIFY(con.registerService(registeredName)); QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); QCOMPARE(spyR.count(), 1); - QCOMPARE(spyR.at(0).at(0).toString(), serviceName); + QCOMPARE(spyR.at(0).at(0).toString(), registeredName); QCOMPARE(spyU.count(), 0); QCOMPARE(spyO.count(), 1); - QCOMPARE(spyO.at(0).at(0).toString(), serviceName); + QCOMPARE(spyO.at(0).at(0).toString(), registeredName); QVERIFY(spyO.at(0).at(1).toString().isEmpty()); QCOMPARE(spyO.at(0).at(2).toString(), con.baseService()); } +void tst_QDBusServiceWatcher::watchForDisappearance_data() +{ + tst_QDBusServiceWatcher::watchForCreation_data(); +} + void tst_QDBusServiceWatcher::watchForDisappearance() { + QFETCH(QString, watchedName); + QFETCH(QString, registeredName); + QDBusConnection con = QDBusConnection::sessionBus(); QVERIFY(con.isConnected()); - QDBusServiceWatcher watcher(serviceName, con, QDBusServiceWatcher::WatchForUnregistration); + QDBusServiceWatcher watcher(watchedName, con, QDBusServiceWatcher::WatchForUnregistration); watcher.setObjectName("watcher for disappearance"); QSignalSpy spyR(&watcher, SIGNAL(serviceRegistered(QString))); @@ -135,10 +175,10 @@ void tst_QDBusServiceWatcher::watchForDisappearance() QTestEventLoop::instance().connect(&watcher, SIGNAL(serviceUnregistered(QString)), SLOT(exitLoop())); // register a name - QVERIFY(con.registerService(serviceName)); + QVERIFY(con.registerService(registeredName)); // unregister it: - con.unregisterService(serviceName); + con.unregisterService(registeredName); QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); @@ -146,10 +186,10 @@ void tst_QDBusServiceWatcher::watchForDisappearance() QCOMPARE(spyR.count(), 0); QCOMPARE(spyU.count(), 1); - QCOMPARE(spyU.at(0).at(0).toString(), serviceName); + QCOMPARE(spyU.at(0).at(0).toString(), registeredName); QCOMPARE(spyO.count(), 1); - QCOMPARE(spyO.at(0).at(0).toString(), serviceName); + QCOMPARE(spyO.at(0).at(0).toString(), registeredName); QCOMPARE(spyO.at(0).at(1).toString(), con.baseService()); QVERIFY(spyO.at(0).at(2).toString().isEmpty()); } @@ -188,12 +228,20 @@ void tst_QDBusServiceWatcher::watchForDisappearanceUniqueConnection() QVERIFY(spyO.at(0).at(2).toString().isEmpty()); } +void tst_QDBusServiceWatcher::watchForOwnerChange_data() +{ + watchForCreation_data(); +} + void tst_QDBusServiceWatcher::watchForOwnerChange() { + QFETCH(QString, watchedName); + QFETCH(QString, registeredName); + QDBusConnection con = QDBusConnection::sessionBus(); QVERIFY(con.isConnected()); - QDBusServiceWatcher watcher(serviceName, con, QDBusServiceWatcher::WatchForOwnerChange); + QDBusServiceWatcher watcher(watchedName, con, QDBusServiceWatcher::WatchForOwnerChange); QSignalSpy spyR(&watcher, SIGNAL(serviceRegistered(QString))); QSignalSpy spyU(&watcher, SIGNAL(serviceUnregistered(QString))); @@ -201,18 +249,18 @@ void tst_QDBusServiceWatcher::watchForOwnerChange() QTestEventLoop::instance().connect(&watcher, SIGNAL(serviceRegistered(QString)), SLOT(exitLoop())); // register a name - QVERIFY(con.registerService(serviceName)); + QVERIFY(con.registerService(registeredName)); QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); QCOMPARE(spyR.count(), 1); - QCOMPARE(spyR.at(0).at(0).toString(), serviceName); + QCOMPARE(spyR.at(0).at(0).toString(), registeredName); QCOMPARE(spyU.count(), 0); QCOMPARE(spyO.count(), 1); - QCOMPARE(spyO.at(0).at(0).toString(), serviceName); + QCOMPARE(spyO.at(0).at(0).toString(), registeredName); QVERIFY(spyO.at(0).at(1).toString().isEmpty()); QCOMPARE(spyO.at(0).at(2).toString(), con.baseService()); @@ -221,35 +269,43 @@ void tst_QDBusServiceWatcher::watchForOwnerChange() spyO.clear(); // unregister it: - con.unregisterService(serviceName); + con.unregisterService(registeredName); // and register again - QVERIFY(con.registerService(serviceName)); + QVERIFY(con.registerService(registeredName)); QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); QCOMPARE(spyR.count(), 1); - QCOMPARE(spyR.at(0).at(0).toString(), serviceName); + QCOMPARE(spyR.at(0).at(0).toString(), registeredName); QCOMPARE(spyU.count(), 1); - QCOMPARE(spyU.at(0).at(0).toString(), serviceName); + QCOMPARE(spyU.at(0).at(0).toString(), registeredName); QCOMPARE(spyO.count(), 2); - QCOMPARE(spyO.at(0).at(0).toString(), serviceName); + QCOMPARE(spyO.at(0).at(0).toString(), registeredName); QCOMPARE(spyO.at(0).at(1).toString(), con.baseService()); QVERIFY(spyO.at(0).at(2).toString().isEmpty()); - QCOMPARE(spyO.at(1).at(0).toString(), serviceName); + QCOMPARE(spyO.at(1).at(0).toString(), registeredName); QVERIFY(spyO.at(1).at(1).toString().isEmpty()); QCOMPARE(spyO.at(1).at(2).toString(), con.baseService()); } +void tst_QDBusServiceWatcher::modeChange_data() +{ + watchForCreation_data(); +} + void tst_QDBusServiceWatcher::modeChange() { + QFETCH(QString, watchedName); + QFETCH(QString, registeredName); + QDBusConnection con = QDBusConnection::sessionBus(); QVERIFY(con.isConnected()); - QDBusServiceWatcher watcher(serviceName, con, QDBusServiceWatcher::WatchForRegistration); + QDBusServiceWatcher watcher(watchedName, con, QDBusServiceWatcher::WatchForRegistration); QSignalSpy spyR(&watcher, SIGNAL(serviceRegistered(QString))); QSignalSpy spyU(&watcher, SIGNAL(serviceUnregistered(QString))); @@ -257,18 +313,18 @@ void tst_QDBusServiceWatcher::modeChange() QTestEventLoop::instance().connect(&watcher, SIGNAL(serviceRegistered(QString)), SLOT(exitLoop())); // register a name - QVERIFY(con.registerService(serviceName)); + QVERIFY(con.registerService(registeredName)); QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); QCOMPARE(spyR.count(), 1); - QCOMPARE(spyR.at(0).at(0).toString(), serviceName); + QCOMPARE(spyR.at(0).at(0).toString(), registeredName); QCOMPARE(spyU.count(), 0); QCOMPARE(spyO.count(), 1); - QCOMPARE(spyO.at(0).at(0).toString(), serviceName); + QCOMPARE(spyO.at(0).at(0).toString(), registeredName); QVERIFY(spyO.at(0).at(1).toString().isEmpty()); QCOMPARE(spyO.at(0).at(2).toString(), con.baseService()); @@ -279,7 +335,7 @@ void tst_QDBusServiceWatcher::modeChange() watcher.setWatchMode(QDBusServiceWatcher::WatchForUnregistration); // unregister it: - con.unregisterService(serviceName); + con.unregisterService(registeredName); QTestEventLoop::instance().connect(&watcher, SIGNAL(serviceUnregistered(QString)), SLOT(exitLoop())); QTestEventLoop::instance().enterLoop(1); @@ -288,10 +344,10 @@ void tst_QDBusServiceWatcher::modeChange() QCOMPARE(spyR.count(), 0); QCOMPARE(spyU.count(), 1); - QCOMPARE(spyU.at(0).at(0).toString(), serviceName); + QCOMPARE(spyU.at(0).at(0).toString(), registeredName); QCOMPARE(spyO.count(), 1); - QCOMPARE(spyO.at(0).at(0).toString(), serviceName); + QCOMPARE(spyO.at(0).at(0).toString(), registeredName); QCOMPARE(spyO.at(0).at(1).toString(), con.baseService()); QVERIFY(spyO.at(0).at(2).toString().isEmpty()); } @@ -301,7 +357,7 @@ void tst_QDBusServiceWatcher::disconnectedConnection() QDBusConnection con(""); QVERIFY(!con.isConnected()); - QDBusServiceWatcher watcher(serviceName, con, QDBusServiceWatcher::WatchForRegistration); + QDBusServiceWatcher watcher(generateServiceName(), con, QDBusServiceWatcher::WatchForRegistration); watcher.addWatchedService("com.example.somethingelse"); watcher.addWatchedService("org.freedesktop.DBus"); @@ -311,8 +367,15 @@ void tst_QDBusServiceWatcher::disconnectedConnection() watcher.setWatchedServices(QStringList()); } +void tst_QDBusServiceWatcher::setConnection_data() +{ + QTest::addColumn<QString>("serviceName"); + QTest::newRow("normal") << generateServiceName(); +} + void tst_QDBusServiceWatcher::setConnection() { + QFETCH(QString, serviceName); // begin with a disconnected connection QDBusConnection con(""); QVERIFY(!con.isConnected()); diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index bb81b9f61f..4d41b5e873 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -301,6 +301,8 @@ static QLatin1String formatToString(QImage::Format format) return QLatin1String("RGBA64"); case QImage::Format_RGBA64_Premultiplied: return QLatin1String("RGBA64pm"); + case QImage::Format_Grayscale16: + return QLatin1String("Grayscale16"); default: break; }; @@ -2369,8 +2371,11 @@ void tst_QImage::rgbSwapped_data() QTest::addColumn<QImage::Format>("format"); for (int i = QImage::Format_Indexed8; i < QImage::NImageFormats; ++i) { - if (i == QImage::Format_Alpha8 || i == QImage::Format_Grayscale8) + if (i == QImage::Format_Alpha8 + || i == QImage::Format_Grayscale8 + || i == QImage::Format_Grayscale16) { continue; + } QTest::addRow("%s", formatToString(QImage::Format(i)).data()) << QImage::Format(i); } } @@ -2615,8 +2620,11 @@ void tst_QImage::inplaceMirrored_data() QTest::addColumn<bool>("swap_horizontal"); for (int i = QImage::Format_Mono; i < QImage::NImageFormats; ++i) { - if (i == QImage::Format_Alpha8 || i == QImage::Format_Grayscale8) + if (i == QImage::Format_Alpha8 + || i == QImage::Format_Grayscale8 + || i == QImage::Format_Grayscale16) { continue; + } if (i == QImage::Format_RGB444 || i == QImage::Format_ARGB4444_Premultiplied) continue; const auto fmt = formatToString(QImage::Format(i)); @@ -2788,11 +2796,11 @@ void tst_QImage::genericRgbConversion_data() QTest::addColumn<QImage::Format>("dest_format"); for (int i = QImage::Format_RGB32; i < QImage::NImageFormats; ++i) { - if (i == QImage::Format_Alpha8 || i == QImage::Format_Grayscale8) + if (i == QImage::Format_Alpha8) continue; const QLatin1String formatI = formatToString(QImage::Format(i)); for (int j = QImage::Format_RGB32; j < QImage::NImageFormats; ++j) { - if (j == QImage::Format_Alpha8 || j == QImage::Format_Grayscale8) + if (j == QImage::Format_Alpha8) continue; if (i == j) continue; @@ -2808,6 +2816,9 @@ void tst_QImage::genericRgbConversion() QFETCH(QImage::Format, format); QFETCH(QImage::Format, dest_format); + bool srcGrayscale = format == QImage::Format_Grayscale8 || format == QImage::Format_Grayscale16; + bool dstGrayscale = dest_format == QImage::Format_Grayscale8 || dest_format == QImage::Format_Grayscale16; + QImage image(16, 16, format); for (int i = 0; i < image.height(); ++i) @@ -2819,8 +2830,12 @@ void tst_QImage::genericRgbConversion() for (int i = 0; i < imageConverted.height(); ++i) { for (int j = 0; j < imageConverted.width(); ++j) { QRgb convertedColor = imageConverted.pixel(j,i); - QCOMPARE(qRed(convertedColor) & 0xF0, j * 16); - QCOMPARE(qGreen(convertedColor) & 0xF0, i * 16); + if (srcGrayscale || dstGrayscale) { + QVERIFY(qAbs(qGray(convertedColor) - qGray(qRgb(j*16, i*16, 0))) < 15); + } else { + QCOMPARE(qRed(convertedColor) & 0xF0, j * 16); + QCOMPARE(qGreen(convertedColor) & 0xF0, i * 16); + } } } } @@ -2831,11 +2846,17 @@ void tst_QImage::inplaceRgbConversion_data() QTest::addColumn<QImage::Format>("dest_format"); for (int i = QImage::Format_RGB32; i < QImage::NImageFormats; ++i) { - if (i == QImage::Format_Alpha8 || i == QImage::Format_Grayscale8) + if (i == QImage::Format_Alpha8 + || i == QImage::Format_Grayscale8 + || i == QImage::Format_Grayscale16) { continue; + } for (int j = QImage::Format_RGB32; j < QImage::NImageFormats; ++j) { - if (j == QImage::Format_Alpha8 || j == QImage::Format_Grayscale8) + if (j == QImage::Format_Alpha8 + || j == QImage::Format_Grayscale8 + || j == QImage::Format_Grayscale16) { continue; + } if (i == j) continue; QTest::addRow("%s -> %s", formatToString(QImage::Format(i)).data(), formatToString(QImage::Format(j)).data()) @@ -3005,8 +3026,11 @@ void tst_QImage::invertPixelsRGB_data() QTest::addColumn<QImage::Format>("image_format"); for (int i = QImage::Format_RGB32; i < QImage::NImageFormats; ++i) { - if (i == QImage::Format_Alpha8 || i == QImage::Format_Grayscale8) + if (i == QImage::Format_Alpha8 + || i == QImage::Format_Grayscale8 + || i == QImage::Format_Grayscale16) { continue; + } QTest::addRow("%s", formatToString(QImage::Format(i)).data()) << QImage::Format(i); } } diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp index c2ec5b8925..1cf01133b2 100644 --- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp @@ -525,7 +525,7 @@ void tst_QImageReader::imageFormat_data() QTest::newRow("png") << QString("kollada.png") << QByteArray("png") << QImage::Format_ARGB32; QTest::newRow("png-2") << QString("YCbCr_cmyk.png") << QByteArray("png") << QImage::Format_RGB32; QTest::newRow("png-3") << QString("kollada-16bpc.png") << QByteArray("png") << QImage::Format_RGBA64; - QTest::newRow("png-4") << QString("basn0g16.png") << QByteArray("png") << QImage::Format_RGBX64; // Grayscale16 + QTest::newRow("png-4") << QString("basn0g16.png") << QByteArray("png") << QImage::Format_Grayscale16; QTest::newRow("png-5") << QString("basn2c16.png") << QByteArray("png") << QImage::Format_RGBX64; QTest::newRow("png-6") << QString("basn4a16.png") << QByteArray("png") << QImage::Format_RGBA64; // Grayscale16Alpha16 QTest::newRow("png-7") << QString("basn6a16.png") << QByteArray("png") << QImage::Format_RGBA64; diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp index 77851cd7d0..aaa8475c74 100644 --- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp +++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp @@ -239,7 +239,7 @@ void tst_QImageWriter::writeImage2_data() // QLatin1String("jpeg"), }; - QImage image0(70, 70, QImage::Format_ARGB32); + QImage image0(70, 70, QImage::Format_RGB32); image0.fill(QColor(Qt::red).rgb()); QImage::Format imgFormat = QImage::Format_Mono; @@ -304,10 +304,10 @@ void tst_QImageWriter::writeImage2() if (!equalImageContents(written, image)) { qDebug() << "image" << image.format() << image.width() << image.height() << image.depth() - << hex << image.pixel(0, 0); + << image.pixelColor(0, 0); qDebug() << "written" << written.format() << written.width() << written.height() << written.depth() - << hex << written.pixel(0, 0); + << written.pixelColor(0, 0); } QVERIFY(equalImageContents(written, image)); diff --git a/tests/auto/gui/itemmodels/qstandarditem/tst_qstandarditem.cpp b/tests/auto/gui/itemmodels/qstandarditem/tst_qstandarditem.cpp index d19aa9b54f..2deb84fa5f 100644 --- a/tests/auto/gui/itemmodels/qstandarditem/tst_qstandarditem.cpp +++ b/tests/auto/gui/itemmodels/qstandarditem/tst_qstandarditem.cpp @@ -202,9 +202,7 @@ void tst_QStandardItem::getSetData() QCOMPARE(qvariant_cast<QSize>(item.data(Qt::SizeHintRole)), sizeHint); QCOMPARE(qvariant_cast<QFont>(item.data(Qt::FontRole)), font); QCOMPARE(qvariant_cast<int>(item.data(Qt::TextAlignmentRole)), int(textAlignment)); - QCOMPARE(qvariant_cast<QBrush>(item.data(Qt::BackgroundColorRole)), QBrush(backgroundColor)); QCOMPARE(qvariant_cast<QBrush>(item.data(Qt::BackgroundRole)), QBrush(backgroundColor)); - QCOMPARE(qvariant_cast<QBrush>(item.data(Qt::TextColorRole)), QBrush(textColor)); QCOMPARE(qvariant_cast<QBrush>(item.data(Qt::ForegroundRole)), QBrush(textColor)); QCOMPARE(qvariant_cast<int>(item.data(Qt::CheckStateRole)), int(checkState)); QCOMPARE(qvariant_cast<QString>(item.data(Qt::AccessibleTextRole)), accessibleText); @@ -236,9 +234,7 @@ void tst_QStandardItem::getSetData() QCOMPARE(item.data(Qt::SizeHintRole), QVariant()); QCOMPARE(item.data(Qt::FontRole), QVariant()); QCOMPARE(item.data(Qt::TextAlignmentRole), QVariant()); - QCOMPARE(item.data(Qt::BackgroundColorRole), QVariant()); QCOMPARE(item.data(Qt::BackgroundRole), QVariant()); - QCOMPARE(item.data(Qt::TextColorRole), QVariant()); QCOMPARE(item.data(Qt::ForegroundRole), QVariant()); QCOMPARE(item.data(Qt::CheckStateRole), QVariant()); QCOMPARE(item.data(Qt::AccessibleTextRole), QVariant()); diff --git a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp index e2d7a41bd1..550f70890e 100644 --- a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp +++ b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp @@ -1160,7 +1160,7 @@ void tst_QStandardItemModel::getSetItemData() QColor backgroundColor(Qt::blue); roles.insert(Qt::BackgroundRole, backgroundColor); QColor textColor(Qt::green); - roles.insert(Qt::TextColorRole, textColor); + roles.insert(Qt::ForegroundRole, textColor); Qt::CheckState checkState(Qt::PartiallyChecked); roles.insert(Qt::CheckStateRole, int(checkState)); QLatin1String accessibleText("accessibleText"); diff --git a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp index 993ebbaac6..bff9f7d0e0 100644 --- a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp +++ b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp @@ -215,7 +215,7 @@ static bool runHelper(const QString &program, const QStringList &arguments, QByt { #if QT_CONFIG(process) QProcess process; - process.setReadChannelMode(QProcess::ForwardedChannels); + process.setProcessChannelMode(QProcess::ForwardedChannels); process.start(program, arguments); if (!process.waitForStarted()) { *errorMessage = "Unable to start '" + program.toLocal8Bit() + " ': " diff --git a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp index cca0e95c29..b2572188b9 100644 --- a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp +++ b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp @@ -49,6 +49,8 @@ private slots: void construct(); void constructCopy_data(); void constructCopy(); + void saveAndLoadBuiltin_data(); + void saveAndLoadBuiltin(); }; #define FOR_EACH_GUI_METATYPE_BASE(F) \ @@ -442,5 +444,49 @@ FOR_EACH_GUI_METATYPE(RETURN_CONSTRUCT_COPY_FUNCTION) TypeTestFunctionGetter::get(type)(); } +template <typename T> +struct StreamingTraits +{ + // Streamable by default, as currently all gui built-in types are streamable + enum { isStreamable = 1 }; +}; + +void tst_QGuiMetaType::saveAndLoadBuiltin_data() +{ + QTest::addColumn<int>("type"); + QTest::addColumn<bool>("isStreamable"); + +#define ADD_METATYPE_TEST_ROW(MetaTypeName, MetaTypeId, RealType) \ + QTest::newRow(#RealType) << MetaTypeId << bool(StreamingTraits<RealType>::isStreamable); + QT_FOR_EACH_STATIC_GUI_CLASS(ADD_METATYPE_TEST_ROW) +#undef ADD_METATYPE_TEST_ROW +} + +void tst_QGuiMetaType::saveAndLoadBuiltin() +{ + QFETCH(int, type); + QFETCH(bool, isStreamable); + + void *value = QMetaType::create(type); + + QByteArray ba; + QDataStream stream(&ba, QIODevice::ReadWrite); + QCOMPARE(QMetaType::save(stream, type, value), isStreamable); + QCOMPARE(stream.status(), QDataStream::Ok); + + if (isStreamable) + QVERIFY(QMetaType::load(stream, type, value)); + + stream.device()->seek(0); + stream.resetStatus(); + QCOMPARE(QMetaType::load(stream, type, value), isStreamable); + QCOMPARE(stream.status(), QDataStream::Ok); + + if (isStreamable) + QVERIFY(QMetaType::load(stream, type, value)); + + QMetaType::destroy(type, value); +} + QTEST_MAIN(tst_QGuiMetaType) #include "tst_qguimetatype.moc" diff --git a/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp b/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp index a0ac1b3631..7f29b1c24e 100644 --- a/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp +++ b/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp @@ -37,6 +37,7 @@ class tst_QPalette : public QObject private Q_SLOTS: void roleValues_data(); void roleValues(); + void resolve(); void copySemantics(); void moveSemantics(); void setBrush(); @@ -80,6 +81,43 @@ void tst_QPalette::roleValues() QCOMPARE(role, value); } +void tst_QPalette::resolve() +{ + QPalette p1; + p1.setBrush(QPalette::WindowText, Qt::green); + p1.setBrush(QPalette::Button, Qt::green); + + QVERIFY(p1.isBrushSet(QPalette::Active, QPalette::WindowText)); + QVERIFY(p1.isBrushSet(QPalette::Active, QPalette::Button)); + + QPalette p2; + p2.setBrush(QPalette::WindowText, Qt::red); + + QVERIFY(p2.isBrushSet(QPalette::Active, QPalette::WindowText)); + QVERIFY(!p2.isBrushSet(QPalette::Active, QPalette::Button)); + + QPalette p1ResolvedTo2 = p1.resolve(p2); + // p1ResolvedTo2 gets everything from p1 and nothing copied from p2 because + // it already has a WindowText. That is two brushes, and to the same value + // as p1. + QCOMPARE(p1ResolvedTo2, p1); + QVERIFY(p1ResolvedTo2.isBrushSet(QPalette::Active, QPalette::WindowText)); + QCOMPARE(p1.windowText(), p1ResolvedTo2.windowText()); + QVERIFY(p1ResolvedTo2.isBrushSet(QPalette::Active, QPalette::Button)); + QCOMPARE(p1.button(), p1ResolvedTo2.button()); + + QPalette p2ResolvedTo1 = p2.resolve(p1); + // p2ResolvedTo1 gets the WindowText set, and to the same value as the + // original p2, however, Button gets set from p1. + QVERIFY(p2ResolvedTo1.isBrushSet(QPalette::Active, QPalette::WindowText)); + QCOMPARE(p2.windowText(), p2ResolvedTo1.windowText()); + QVERIFY(p2ResolvedTo1.isBrushSet(QPalette::Active, QPalette::Button)); + QCOMPARE(p1.button(), p2ResolvedTo1.button()); + + QVERIFY(p2ResolvedTo1 != p1); + QVERIFY(p2ResolvedTo1 != p2); +} + void tst_QPalette::copySemantics() { QPalette src(Qt::red), dst; diff --git a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp index 16215714f3..69c961c1a1 100644 --- a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp +++ b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp @@ -43,6 +43,8 @@ public slots: void cleanupTestCase(); private slots: void getSetCheck(); + void clear(); + void reserveAndCapacity(); void swap(); void contains_QPointF_data(); @@ -148,6 +150,47 @@ void tst_QPainterPath::swap() QCOMPARE(p2.boundingRect().toRect(), QRect( 0, 0,10,10)); } +void tst_QPainterPath::clear() +{ + QPainterPath p1; + QPainterPath p2; + p1.clear(); + QCOMPARE(p1, p2); + + p1.addRect(0, 0, 10, 10); + p1.clear(); + QCOMPARE(p1, p2); + + QCOMPARE(p1.fillRule(), Qt::OddEvenFill); + p1.setFillRule(Qt::WindingFill); + p1.clear(); + QCOMPARE(p1.fillRule(), Qt::WindingFill); +} + +void tst_QPainterPath::reserveAndCapacity() +{ + QPainterPath p; + QVERIFY(p.capacity() == 0); + + p.addRect(0, 0, 10, 10); + QVERIFY(p.capacity() > 0); + + p.clear(); + QVERIFY(p.capacity() > 0); + + p = QPainterPath{}; + QVERIFY(p.capacity() == 0); + + p.moveTo(100, 100); + QVERIFY(p.capacity() > 1); + + p.reserve(1000); + QVERIFY(p.capacity() >= 1000); + + p.reserve(0); + QVERIFY(p.capacity() >= 1000); +} + Q_DECLARE_METATYPE(QPainterPath) void tst_QPainterPath::currentPosition() diff --git a/tests/auto/gui/painting/qregion/tst_qregion.cpp b/tests/auto/gui/painting/qregion/tst_qregion.cpp index 5256fbd1dc..24c4583819 100644 --- a/tests/auto/gui/painting/qregion/tst_qregion.cpp +++ b/tests/auto/gui/painting/qregion/tst_qregion.cpp @@ -84,6 +84,8 @@ private slots: #endif void regionFromPath(); + void scaleRegions_data(); + void scaleRegions(); #ifdef QT_BUILD_INTERNAL void regionToPath_data(); @@ -973,6 +975,59 @@ void tst_QRegion::regionFromPath() } } +void tst_QRegion::scaleRegions_data() +{ + QTest::addColumn<qreal>("scale"); + QTest::addColumn<QVector<QRect>>("inputRects"); + QTest::addColumn<QVector<QRect>>("expectedRects"); + + QTest::newRow("1.0 single") << 1.0 + << QVector<QRect>{ QRect(10, 10, 20, 20) } + << QVector<QRect>{ QRect(10, 10, 20, 20) }; + QTest::newRow("1.0 multi") << 1.0 + << QVector<QRect>{ QRect(10, 10, 20, 20), QRect(40, 10, 20, 20) } + << QVector<QRect>{ QRect(10, 10, 20, 20), QRect(40, 10, 20, 20) }; + QTest::newRow("2.0 single") << 2.0 + << QVector<QRect>{ QRect(10, 10, 20, 20) } + << QVector<QRect>{ QRect(20, 20, 40, 40) }; + QTest::newRow("2.0 multi") << 2.0 + << QVector<QRect>{ QRect(10, 10, 20, 20), QRect(40, 10, 20, 20) } + << QVector<QRect>{ QRect(20, 20, 40, 40), QRect(80, 20, 40, 40) }; + QTest::newRow("-1.0 single") << -1.0 + << QVector<QRect>{ QRect(10, 10, 20, 20) } + << QVector<QRect>{ QRect(-30, -30, 20, 20) }; + QTest::newRow("-1.0 multi") << -1.0 + << QVector<QRect>{ QRect(10, 10, 20, 20), QRect(40, 10, 20, 20) } + << QVector<QRect>{ QRect(-60, -30, 20, 20), QRect(-30, -30, 20, 20) }; + QTest::newRow("-2.0 single") << -2.0 + << QVector<QRect>{ QRect(10, 10, 20, 20) } + << QVector<QRect>{ QRect(-60, -60, 40, 40) }; + QTest::newRow("-2.0 multi") << -2.0 + << QVector<QRect>{ QRect(10, 10, 20, 20), QRect(40, 10, 20, 20) } + << QVector<QRect>{ QRect(-120, -60, 40, 40), QRect(-60, -60, 40, 40) }; +} + +void tst_QRegion::scaleRegions() +{ + QFETCH(qreal, scale); + QFETCH(QVector<QRect>, inputRects); + QFETCH(QVector<QRect>, expectedRects); + + QRegion region; + region.setRects(inputRects.constData(), inputRects.size()); + + QRegion expected(expectedRects.first()); + expected.setRects(expectedRects.constData(), expectedRects.size()); + + QTransform t; + t.scale(scale, scale); + + auto result = t.map(region); + + QCOMPARE(result.rectCount(), expectedRects.size()); + QCOMPARE(result, expected); +} + Q_DECLARE_METATYPE(QPainterPath) #ifdef QT_BUILD_INTERNAL diff --git a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp index cfd24a8701..7dbeb13aa7 100644 --- a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp +++ b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp @@ -835,17 +835,32 @@ void tst_QCssParser::colorValue_data() QTest::newRow("hexcolor") << "color: #12af0e" << QColor(0x12, 0xaf, 0x0e); QTest::newRow("functional1") << "color: rgb(21, 45, 73)" << QColor(21, 45, 73); QTest::newRow("functional2") << "color: rgb(100%, 0%, 100%)" << QColor(0xff, 0, 0xff); + QTest::newRow("rgb") << "color: rgb(10, 20, 30)" << QColor(10, 20, 30); QTest::newRow("rgba") << "color: rgba(10, 20, 30, 40)" << QColor(10, 20, 30, 40); QTest::newRow("rgbaf") << "color: rgba(10, 20, 30, 0.5)" << QColor(10, 20, 30, 127); - QTest::newRow("rgb") << "color: rgb(10, 20, 30, 40)" << QColor(10, 20, 30, 40); - QTest::newRow("hsl") << "color: hsv(10, 20, 30)" << QColor::fromHsv(10, 20, 30, 255); - QTest::newRow("hsla") << "color: hsva(10, 20, 30, 40)" << QColor::fromHsv(10, 20, 30, 40); + QTest::newRow("hsv") << "color: hsv(10, 20, 30)" << QColor::fromHsv(10, 20, 30); + QTest::newRow("hsva") << "color: hsva(10, 20, 30, 40)" << QColor::fromHsv(10, 20, 30, 40); + // the percent and float values are well chosen to not get in trouble due to rounding errors + QTest::newRow("hsva-percent") << "color: hsva(100%, 20%, 40%, 60%)" << QColor::fromHsv(359, 51, 102, 153); + QTest::newRow("hsva-float") << "color: hsva(180, 20%, 40%, 0.6)" << QColor::fromHsvF(0.5, 0.2, 0.4, 0.6); + QTest::newRow("hsl") << "color: hsl(60, 100%, 50%)" << QColor::fromHsl(60., 255, 127); + QTest::newRow("hsla") << "color: hsla(240, 255, 127, 192)" << QColor::fromHsl(240, 255, 127, 192); + QTest::newRow("hsla-percent") << "color: hsla(100%, 80%, 40%, 0%)" << QColor::fromHsl(359, 204, 102, 0); + QTest::newRow("hsla-float") << "color: hsla(252, 40%, 60%, 0.2)" << QColor::fromHslF(0.7, 0.4, 0.6, 0.2); QTest::newRow("invalid1") << "color: rgb(why, does, it, always, rain, on, me)" << QColor(); QTest::newRow("invalid2") << "color: rgba(i, meant, norway)" << QColor(); QTest::newRow("invalid3") << "color: rgb(21)" << QColor(); + QTest::newRow("invalid4") << "color: rgbx(1, 2, 3)" << QColor(); + QTest::newRow("invalid5") << "color: rgbax(1, 2, 3, 4)" << QColor(); + QTest::newRow("invalid6") << "color: hsv(360, 0, 0)" << QColor(); + QTest::newRow("invalid7") << "color: hsla(1, a, 1, 21)" << QColor(); QTest::newRow("role") << "color: palette(base)" << qApp->palette().color(QPalette::Base); QTest::newRow("role2") << "color: palette( window-text ) " << qApp->palette().color(QPalette::WindowText); QTest::newRow("transparent") << "color: transparent" << QColor(Qt::transparent); + + // ### Qt6: no longer valid + QTest::newRow("rgb-invalid") << "color: rgb(10, 20, 30, 40)" << QColor(10, 20, 30, 40); + QTest::newRow("rgba-invalid") << "color: rgba(10, 20, 30)" << QColor(10, 20, 30, 255); } void tst_QCssParser::colorValue() diff --git a/tests/auto/gui/text/qfont/qfont.pro b/tests/auto/gui/text/qfont/qfont.pro index 048d952faf..96cd4cfdab 100644 --- a/tests/auto/gui/text/qfont/qfont.pro +++ b/tests/auto/gui/text/qfont/qfont.pro @@ -4,3 +4,4 @@ QT += testlib QT += core-private gui-private qtHaveModule(widgets): QT += widgets SOURCES += tst_qfont.cpp +RESOURCES += testfont.qrc diff --git a/tests/auto/gui/text/qfont/testfont.qrc b/tests/auto/gui/text/qfont/testfont.qrc new file mode 100644 index 0000000000..cf51e4a2b4 --- /dev/null +++ b/tests/auto/gui/text/qfont/testfont.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>weirdfont.otf</file> + </qresource> +</RCC> diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp index 8090f38a2c..9acf877790 100644 --- a/tests/auto/gui/text/qfont/tst_qfont.cpp +++ b/tests/auto/gui/text/qfont/tst_qfont.cpp @@ -66,6 +66,12 @@ private slots: void fromStringWithoutStyleName(); void sharing(); + void familyNameWithCommaQuote_data(); + void familyNameWithCommaQuote(); + void setFamilies_data(); + void setFamilies(); + void setFamiliesAndFamily_data(); + void setFamiliesAndFamily(); }; // Testing get/set functions @@ -116,6 +122,14 @@ void tst_QFont::exactMatch() QVERIFY(!QFont("sans-serif").exactMatch()); QVERIFY(!QFont("serif").exactMatch()); QVERIFY(!QFont("monospace").exactMatch()); + + font.setFamilies(QStringList() << "BogusFont"); + QVERIFY(!font.exactMatch()); + QVERIFY(!QFont("sans").exactMatch()); + QVERIFY(!QFont("sans-serif").exactMatch()); + QVERIFY(!QFont("serif").exactMatch()); + QVERIFY(!QFont("monospace").exactMatch()); + } void tst_QFont::italicOblique() @@ -277,6 +291,12 @@ void tst_QFont::resolve() QCOMPARE(f4.pointSize(), 45); f4 = f4.resolve(f3); QCOMPARE(f4.pointSize(), 55); + + QFont font5, font6; + const QStringList fontFamilies = { QStringLiteral("Arial") }; + font5.setFamilies(fontFamilies); + font6 = font6.resolve(font5); + QCOMPARE(font6.families(), fontFamilies); } #ifndef QT_NO_WIDGETS @@ -624,5 +644,108 @@ void tst_QFont::sharing() QVERIFY(QFontPrivate::get(f2)->engineData != QFontPrivate::get(f)->engineData); } +void tst_QFont::familyNameWithCommaQuote_data() +{ + QTest::addColumn<QString>("familyName"); + QTest::addColumn<QString>("chosenFamilyName"); + + const QString standardFont(QFont().defaultFamily()); + if (standardFont.isEmpty()) + QSKIP("No default font available on the system"); + const QString weirdFont(QLatin1String("'My, weird'' font name',")); + const QString commaSeparated(standardFont + QLatin1String(",Times New Roman")); + const QString commaSeparatedWeird(weirdFont + QLatin1String(",") + standardFont); + const QString commaSeparatedBogus(QLatin1String("BogusFont,") + standardFont); + + QTest::newRow("standard") << standardFont << standardFont; + QTest::newRow("weird") << weirdFont << weirdFont; + QTest::newRow("commaSeparated") << commaSeparated << standardFont; + QTest::newRow("commaSeparatedWeird") << commaSeparatedWeird << weirdFont; + QTest::newRow("commaSeparatedBogus") << commaSeparatedBogus << standardFont; +} + +void tst_QFont::familyNameWithCommaQuote() +{ + QFETCH(QString, familyName); + QFETCH(QString, chosenFamilyName); + + const int weirdFontId = QFontDatabase::addApplicationFont(":/weirdfont.otf"); + + QVERIFY(weirdFontId != -1); + QFont f(familyName); + QCOMPARE(f.family(), familyName); + QCOMPARE(QFontInfo(f).family(), chosenFamilyName); + + QFontDatabase::removeApplicationFont(weirdFontId); +} + +void tst_QFont::setFamilies_data() +{ + QTest::addColumn<QStringList>("families"); + QTest::addColumn<QString>("chosenFamilyName"); + + const QString weirdFont(QLatin1String("'My, weird'' font name',")); + const QString standardFont(QFont().defaultFamily()); + if (standardFont.isEmpty()) + QSKIP("No default font available on the system"); + + QTest::newRow("standard") << (QStringList() << standardFont) << standardFont; + QTest::newRow("weird") << (QStringList() << weirdFont) << weirdFont; + QTest::newRow("standard-weird") << (QStringList() << standardFont << weirdFont) << standardFont; + QTest::newRow("weird-standard") << (QStringList() << weirdFont << standardFont) << weirdFont; + QTest::newRow("nonexist-weird") << (QStringList() << "NonExistentFont" << weirdFont) << weirdFont; +} + +void tst_QFont::setFamilies() +{ + QFETCH(QStringList, families); + QFETCH(QString, chosenFamilyName); + + const int weirdFontId = QFontDatabase::addApplicationFont(":/weirdfont.otf"); + + QVERIFY(weirdFontId != -1); + QFont f; + f.setFamilies(families); + QCOMPARE(QFontInfo(f).family(), chosenFamilyName); + + QFontDatabase::removeApplicationFont(weirdFontId); +} + +void tst_QFont::setFamiliesAndFamily_data() +{ + QTest::addColumn<QStringList>("families"); + QTest::addColumn<QString>("family"); + QTest::addColumn<QString>("chosenFamilyName"); + + const QString weirdFont(QLatin1String("'My, weird'' font name',")); + const QString defaultFont(QFont().defaultFamily()); + if (defaultFont.isEmpty()) + QSKIP("No default font available on the system"); + + const QString timesFont(QLatin1String("Times")); + const QString nonExistFont(QLatin1String("NonExistentFont")); + + QTest::newRow("firstInFamilies") << (QStringList() << defaultFont << timesFont) << weirdFont << defaultFont; + QTest::newRow("secondInFamilies") << (QStringList() << nonExistFont << weirdFont) << defaultFont << weirdFont; + QTest::newRow("family") << (QStringList() << nonExistFont) << defaultFont << defaultFont; +} + +void tst_QFont::setFamiliesAndFamily() +{ + QFETCH(QStringList, families); + QFETCH(QString, family); + QFETCH(QString, chosenFamilyName); + + const int weirdFontId = QFontDatabase::addApplicationFont(":/weirdfont.otf"); + + QVERIFY(weirdFontId != -1); + QFont f; + f.setFamilies(families); + f.setFamily(family); + QCOMPARE(QFontInfo(f).family(), chosenFamilyName); + + QFontDatabase::removeApplicationFont(weirdFontId); +} + QTEST_MAIN(tst_QFont) #include "tst_qfont.moc" diff --git a/tests/auto/gui/text/qfont/weirdfont.otf b/tests/auto/gui/text/qfont/weirdfont.otf Binary files differnew file mode 100644 index 0000000000..b91c559f5b --- /dev/null +++ b/tests/auto/gui/text/qfont/weirdfont.otf diff --git a/tests/auto/gui/text/qfontcache/tst_qfontcache.cpp b/tests/auto/gui/text/qfontcache/tst_qfontcache.cpp index fbca313ea3..785cc3fef2 100644 --- a/tests/auto/gui/text/qfontcache/tst_qfontcache.cpp +++ b/tests/auto/gui/text/qfontcache/tst_qfontcache.cpp @@ -45,6 +45,8 @@ public: private slots: void engineData_data(); void engineData(); + void engineDataFamilies_data(); + void engineDataFamilies(); void clear(); }; @@ -109,6 +111,49 @@ void tst_QFontCache::engineData() QCOMPARE(engineData, QFontPrivate::get(f)->engineData); } +void tst_QFontCache::engineDataFamilies_data() +{ + QTest::addColumn<QStringList>("families"); + + const QStringList multiple = { QLatin1String("invalid"), QLatin1String("Times New Roman") }; + const QStringList multipleQuotes = { QLatin1String("'invalid'"), QLatin1String("Times New Roman") }; + const QStringList multiple2 = { QLatin1String("invalid"), QLatin1String("Times New Roman"), + QLatin1String("foobar"), QLatin1String("'baz'") }; + + QTest::newRow("unquoted-family-name") << QStringList(QLatin1String("Times New Roman")); + QTest::newRow("quoted-family-name") << QStringList(QLatin1String("Times New Roman")); + QTest::newRow("invalid") << QStringList(QLatin1String("invalid")); + QTest::newRow("multiple") << multiple; + QTest::newRow("multiple spaces quotes") << multipleQuotes; + QTest::newRow("multiple2") << multiple2; +} + +void tst_QFontCache::engineDataFamilies() +{ + QFETCH(QStringList, families); + + QFont f; + f.setFamily(QString()); // Unset the family as taken from the QGuiApplication default + f.setFamilies(families); + f.exactMatch(); // loads engine + QFontPrivate *d = QFontPrivate::get(f); + + QFontDef req = d->request; + // copy-pasted from QFontDatabase::load(), to engineer the cache key + if (req.pixelSize == -1) { + req.pixelSize = std::floor(((req.pointSize * d->dpi) / 72) * 100 + 0.5) / 100; + req.pixelSize = qRound(req.pixelSize); + } + if (req.pointSize < 0) + req.pointSize = req.pixelSize*72.0/d->dpi; + + req.families = families; + + QFontEngineData *engineData = QFontCache::instance()->findEngineData(req); + + QCOMPARE(engineData, QFontPrivate::get(f)->engineData); +} + void tst_QFontCache::clear() { #ifdef QT_BUILD_INTERNAL diff --git a/tests/auto/gui/text/qglyphrun/BLACKLIST b/tests/auto/gui/text/qglyphrun/BLACKLIST index 57f32c683d..d8dbdabb4b 100644 --- a/tests/auto/gui/text/qglyphrun/BLACKLIST +++ b/tests/auto/gui/text/qglyphrun/BLACKLIST @@ -1,3 +1,4 @@ [mixedScripts] ubuntu-18.04 b2qt +windows diff --git a/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp b/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp index b7f014d0e2..1429e4cb7f 100644 --- a/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp +++ b/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp @@ -491,10 +491,6 @@ void tst_QGlyphRun::drawMultiScriptText2() drawGlyphs.save("drawMultiScriptText2_drawGlyphIndexes.png"); #endif -#ifdef Q_OS_OSX - if (drawGlyphs.toImage() != textLayoutDraw.toImage()) - QEXPECT_FAIL("", "See QTBUG-32690", Continue); -#endif // Q_OS_OSX QCOMPARE(drawGlyphs, textLayoutDraw); } diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp index 3f602f5aae..97546c34fd 100644 --- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp @@ -1128,7 +1128,7 @@ void tst_QTextDocument::toHtml_data() QTextCharFormat fmt; fmt.setAnchor(true); - fmt.setAnchorName("blub"); + fmt.setAnchorNames({"blub"}); cursor.insertText("Blah", fmt); QTest::newRow("named anchor") << QTextDocumentFragment(&doc) diff --git a/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp b/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp index d652bb066d..fe0b6dae49 100644 --- a/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp +++ b/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp @@ -159,6 +159,7 @@ private slots: void nonZeroMarginOnImport(); void html_charFormatPropertiesUnset(); void html_headings(); + void html_quotedFontFamily_data(); void html_quotedFontFamily(); void html_spanBackgroundColor(); void defaultFont(); @@ -2206,23 +2207,45 @@ void tst_QTextDocumentFragment::html_headings() QCOMPARE(doc->blockCount(), 2); } -void tst_QTextDocumentFragment::html_quotedFontFamily() +void tst_QTextDocumentFragment::html_quotedFontFamily_data() { - setHtml("<div style=\"font-family: 'Foo Bar';\">Test</div>"); - QCOMPARE(doc->begin().begin().fragment().charFormat().fontFamily(), QString("Foo Bar")); - - setHtml("<div style='font-family: \"Foo Bar\";'>Test</div>"); - QCOMPARE(doc->begin().begin().fragment().charFormat().fontFamily(), QString("Foo Bar")); - - setHtml("<div style='font-family: \"Foo Bar\";'>Test</div>"); - QCOMPARE(doc->begin().begin().fragment().charFormat().fontFamily(), QString("Foo Bar")); - - setHtml("<div style='font-family: Foo\n Bar;'>Test</div>"); - QCOMPARE(doc->begin().begin().fragment().charFormat().fontFamily(), QString("Foo Bar")); + QTest::addColumn<QString>("html"); + QTest::addColumn<QString>("fontFamily"); + QTest::addColumn<QStringList>("fontFamilies"); + + const QString fooFamily = QLatin1String("Foo Bar"); + const QString weirdFamily = QLatin1String("'Weird, & font '' name',"); + + QTest::newRow("data1") << QString("<div style=\"font-family: 'Foo Bar';\">Test</div>") + << fooFamily << QStringList(fooFamily); + QTest::newRow("data2") << QString("<div style='font-family: \"Foo Bar\";'>Test</div>") + << QString("Foo Bar") << QStringList("Foo Bar"); + QTest::newRow("data3") << QString("<div style='font-family: Foo\n Bar;'>Test</div>") + << fooFamily << QStringList(fooFamily); + QTest::newRow("data4") << QString("<div style='font-family: Foo\n Bar, serif, \"bar foo\";'>Test" + "</div>") + << fooFamily << (QStringList() << "Foo Bar" << "serif" << "bar foo"); + QTest::newRow("data5") << QString("<div style='font-family: \"\\'Weird, & font \\'\\' name\\'," + "\";'>Test</div>") + << weirdFamily << QStringList(weirdFamily); + QTest::newRow("data6") << QString("<div style='font-family: \"\\'Weird, & font \\'\\' name\\'," + "\";'>Test</div>") + << weirdFamily << QStringList(weirdFamily); + QTest::newRow("data7") << QString("<div style='font-family: \"\\'Weird, & font \\'\\' name\\',\", " + "serif, \"bar foo\";'>Test</div>") + << weirdFamily + << (QStringList() << weirdFamily << "serif" << "bar foo"); +} - setHtml("<div style='font-family: Foo\n Bar, serif, \"bar foo\";'>Test</div>"); - QCOMPARE(doc->begin().begin().fragment().charFormat().fontFamily(), QString("Foo Bar,serif,bar foo")); +void tst_QTextDocumentFragment::html_quotedFontFamily() +{ + QFETCH(QString, html); + QFETCH(QString, fontFamily); + QFETCH(QStringList, fontFamilies); + setHtml(html); + QCOMPARE(doc->begin().begin().fragment().charFormat().fontFamily(), fontFamily); + QCOMPARE(doc->begin().begin().fragment().charFormat().font().families(), fontFamilies); } void tst_QTextDocumentFragment::defaultFont() diff --git a/tests/auto/gui/util/qtexturefilereader/qtexturefilereader.qrc b/tests/auto/gui/util/qtexturefilereader/qtexturefilereader.qrc index ab882b5db2..8aab86e1ff 100644 --- a/tests/auto/gui/util/qtexturefilereader/qtexturefilereader.qrc +++ b/tests/auto/gui/util/qtexturefilereader/qtexturefilereader.qrc @@ -3,5 +3,7 @@ <file>texturefiles/car.ktx</file> <file>texturefiles/pattern.pkm</file> <file>texturefiles/car_mips.ktx</file> + <file>texturefiles/newlogo_srgb.astc</file> + <file>texturefiles/newlogo.astc</file> </qresource> </RCC> diff --git a/tests/auto/gui/util/qtexturefilereader/texturefiles/newlogo.astc b/tests/auto/gui/util/qtexturefilereader/texturefiles/newlogo.astc Binary files differnew file mode 100644 index 0000000000..39bf3f1734 --- /dev/null +++ b/tests/auto/gui/util/qtexturefilereader/texturefiles/newlogo.astc diff --git a/tests/auto/gui/util/qtexturefilereader/texturefiles/newlogo_srgb.astc b/tests/auto/gui/util/qtexturefilereader/texturefiles/newlogo_srgb.astc Binary files differnew file mode 100644 index 0000000000..38e876829b --- /dev/null +++ b/tests/auto/gui/util/qtexturefilereader/texturefiles/newlogo_srgb.astc diff --git a/tests/auto/gui/util/qtexturefilereader/tst_qtexturefilereader.cpp b/tests/auto/gui/util/qtexturefilereader/tst_qtexturefilereader.cpp index 9ff4f0ccf2..9b78d18954 100644 --- a/tests/auto/gui/util/qtexturefilereader/tst_qtexturefilereader.cpp +++ b/tests/auto/gui/util/qtexturefilereader/tst_qtexturefilereader.cpp @@ -49,33 +49,55 @@ void tst_qtexturefilereader::checkHandlers_data() QTest::addColumn<QList<int>>("dataOffsets"); QTest::addColumn<QList<int>>("dataLengths"); - QTest::addRow("pattern.pkm") << QStringLiteral(":/texturefiles/pattern.pkm") - << QSize(64, 64) - << quint32(0x0) - << quint32(0x8d64) - << quint32(0x0) - << 1 - << (QList<int>() << 16) - << (QList<int>() << 2048); + QTest::addRow("pattern.pkm") + << QStringLiteral(":/texturefiles/pattern.pkm") + << QSize(64, 64) + << quint32(0x0) + << quint32(0x8d64) + << quint32(0x0) + << 1 + << (QList<int>() << 16) + << (QList<int>() << 2048); - QTest::addRow("car.ktx") << QStringLiteral(":/texturefiles/car.ktx") - << QSize(146, 80) - << quint32(0x0) - << quint32(0x9278) - << quint32(0x1908) - << 1 - << (QList<int>() << 68) - << (QList<int>() << 11840); + QTest::addRow("car.ktx") + << QStringLiteral(":/texturefiles/car.ktx") + << QSize(146, 80) + << quint32(0x0) + << quint32(0x9278) + << quint32(0x1908) + << 1 + << (QList<int>() << 68) + << (QList<int>() << 11840); - QTest::addRow("car_mips.ktx") << QStringLiteral(":/texturefiles/car_mips.ktx") - << QSize(146, 80) - << quint32(0x0) - << quint32(0x9274) - << quint32(0x1907) - << 8 - << (QList<int>() << 68 << 5992 << 7516 << 7880 << 8004 << 8056 << 8068 << 8080) - << (QList<int>() << 5920 << 1520 << 360 << 120 << 48 << 8 << 8 << 8); + QTest::addRow("car_mips.ktx") + << QStringLiteral(":/texturefiles/car_mips.ktx") + << QSize(146, 80) + << quint32(0x0) + << quint32(0x9274) + << quint32(0x1907) + << 8 + << (QList<int>() << 68 << 5992 << 7516 << 7880 << 8004 << 8056 << 8068 << 8080) + << (QList<int>() << 5920 << 1520 << 360 << 120 << 48 << 8 << 8 << 8); + QTest::addRow("newlogo.astc") + << QStringLiteral(":/texturefiles/newlogo.astc") + << QSize(111, 78) + << quint32(0x0) + << quint32(0x93b9) + << quint32(0x0) + << 1 + << (QList<int>() << 16) + << (QList<int>() << 2496); + + QTest::addRow("newlogo_srgb.astc") + << QStringLiteral(":/texturefiles/newlogo_srgb.astc") + << QSize(111, 78) + << quint32(0x0) + << quint32(0x93d9) + << quint32(0x0) + << 1 + << (QList<int>() << 16) + << (QList<int>() << 2496); } void tst_qtexturefilereader::checkHandlers() diff --git a/tests/auto/network-settings.h b/tests/auto/network-settings.h index a3c318420f..f162c3ae9f 100644 --- a/tests/auto/network-settings.h +++ b/tests/auto/network-settings.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -143,7 +143,7 @@ public: return true; } - static bool verifyConnection(QString serverName, quint16 port, quint32 retry = 10) + static bool verifyConnection(QString serverName, quint16 port, quint32 retry = 60) { QTcpSocket socket; for (quint32 i = 1; i < retry; i++) { @@ -176,7 +176,7 @@ public: static QString ftpServerName() { -#ifdef QT_TEST_SERVER +#ifdef QT_TEST_SERVER_NAME return QString("vsftpd.") % serverDomainName(); #else return serverName(); @@ -184,7 +184,7 @@ public: } static QString ftpProxyServerName() { -#ifdef QT_TEST_SERVER +#ifdef QT_TEST_SERVER_NAME return QString("ftp-proxy.") % serverDomainName(); #else return serverName(); @@ -192,7 +192,7 @@ public: } static QString httpServerName() { -#ifdef QT_TEST_SERVER +#ifdef QT_TEST_SERVER_NAME return QString("apache2.") % serverDomainName(); #else return serverName(); @@ -200,7 +200,7 @@ public: } static QString httpProxyServerName() { -#ifdef QT_TEST_SERVER +#ifdef QT_TEST_SERVER_NAME return QString("squid.") % serverDomainName(); #else return serverName(); @@ -208,7 +208,7 @@ public: } static QString socksProxyServerName() { -#ifdef QT_TEST_SERVER +#ifdef QT_TEST_SERVER_NAME return QString("danted.") % serverDomainName(); #else return serverName(); diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp index 9ca7c892f7..53d0e7a694 100644 --- a/tests/auto/network/access/http2/tst_http2.cpp +++ b/tests/auto/network/access/http2/tst_http2.cpp @@ -50,7 +50,8 @@ #include "emulationdetector.h" -#if !defined(QT_NO_OPENSSL) && OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_TLSEXT) +#if (!defined(QT_NO_OPENSSL) && OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_TLSEXT)) \ + || QT_CONFIG(schannel) // HTTP/2 over TLS requires ALPN/NPN to negotiate the protocol version. const bool clearTextHTTP2 = false; #else diff --git a/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp b/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp index 8b49679042..6c3443a735 100644 --- a/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp +++ b/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp @@ -35,7 +35,9 @@ #include <QtNetwork/QNetworkCookieJar> #include <QtNetwork/QNetworkCookie> #include <QtNetwork/QNetworkRequest> +#if QT_CONFIG(topleveldomain) #include "private/qtldurl_p.h" +#endif class tst_QNetworkCookieJar: public QObject { @@ -47,7 +49,7 @@ private slots: void setCookiesFromUrl(); void cookiesForUrl_data(); void cookiesForUrl(); -#ifdef QT_BUILD_INTERNAL +#if defined(QT_BUILD_INTERNAL) && QT_CONFIG(topleveldomain) void effectiveTLDs_data(); void effectiveTLDs(); #endif @@ -398,7 +400,7 @@ void tst_QNetworkCookieJar::cookiesForUrl() } // This test requires private API. -#ifdef QT_BUILD_INTERNAL +#if defined(QT_BUILD_INTERNAL) && QT_CONFIG(topleveldomain) void tst_QNetworkCookieJar::effectiveTLDs_data() { QTest::addColumn<QString>("domain"); diff --git a/tests/auto/network/access/qnetworkreply/certs/qt-test-server-host-network-cacert.pem b/tests/auto/network/access/qnetworkreply/certs/qt-test-server-host-network-cacert.pem new file mode 100644 index 0000000000..5bdce3a3f9 --- /dev/null +++ b/tests/auto/network/access/qnetworkreply/certs/qt-test-server-host-network-cacert.pem @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE----- +MIIClzCCAgACCQDeuuUc2HkfKDANBgkqhkiG9w0BAQQFADCBjzELMAkGA1UEChMC +UXQxGTAXBgNVBAsTEENvcmUgQW5kIE5ldHdvcmsxGzAZBgkqhkiG9w0BCQEWDG5v +Ym9keS5xdC5pbzENMAsGA1UEBxMET3NsbzENMAsGA1UECBMET3NsbzELMAkGA1UE +BhMCTk8xHTAbBgNVBAMTFHF0LXRlc3Qtc2VydmVyLmxvY2FsMB4XDTE5MDEyNTE1 +NDE0N1oXDTQ5MDExNzE1NDE0N1owgY8xCzAJBgNVBAoTAlF0MRkwFwYDVQQLExBD +b3JlIEFuZCBOZXR3b3JrMRswGQYJKoZIhvcNAQkBFgxub2JvZHkucXQuaW8xDTAL +BgNVBAcTBE9zbG8xDTALBgNVBAgTBE9zbG8xCzAJBgNVBAYTAk5PMR0wGwYDVQQD +ExRxdC10ZXN0LXNlcnZlci5sb2NhbDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC +gYEAzarbb9Y0yafxwL7kQRgZ4gLJIuan1boDLp4oevRfGndfd6kRO49+8C7Gnus6 +2RLXwQxR6CRSPyPDQgwRxvIcoUL+tMJpg633cLEYFcwgKGIw8CwV5jMZr8PrHMCR +9xFolFD4STcIMtc+dd+jvGkAFd7Nhw9cAmuCyAF9avAd3HMCAwEAATANBgkqhkiG +9w0BAQQFAAOBgQB1dxK3Ia4sCpvSikKLaf1ZXu+9GKaNWKJe9bWex9/RmNOla9N2 +FIh6/CfaPFDy/OXCkyEiGg78iyg/DgqVoa9JJGV3diI6berisHMPJpv1syyz9YEU +G3RQUClPcPV6EcedyqCdpbnIFtiSZbtJ0ZBGef4KzBN3rTmPucKb+bhMPg== +-----END CERTIFICATE----- diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 3876621983..8627a37e12 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -550,8 +550,15 @@ static void setupSslServer(QSslSocket* serverSocket) } #ifdef QT_TEST_SERVER +#ifdef QT_TEST_SERVER_NAME +// In this case, each server is assigned a unique hostname. Use the wildcard SSL +// certificate (*.test-net.qt.local). const QString tst_QNetworkReply::certsFilePath = "/certs/qt-test-net-cacert.pem"; #else +// Otherwise, select the single-name SSL certificate (qt-test-server.local) instead. +const QString tst_QNetworkReply::certsFilePath = "/certs/qt-test-server-host-network-cacert.pem"; +#endif // QT_TEST_SERVER_NAME +#else const QString tst_QNetworkReply::certsFilePath = "/certs/qt-test-server-cacert.pem"; #endif @@ -1809,6 +1816,11 @@ void tst_QNetworkReply::getFromFileSpecial_data() void tst_QNetworkReply::getFromFileSpecial() { +#if defined(QT_TEST_SERVER) && defined(Q_OS_WIN) + if (qstrcmp(QTest::currentDataTag(), "smb-path") == 0) + QSKIP("Docker-based test server doesn't support smb protocol yet"); +#endif + QFETCH(QString, fileName); QFETCH(QString, url); @@ -3202,6 +3214,11 @@ void tst_QNetworkReply::ioGetFromFileSpecial_data() void tst_QNetworkReply::ioGetFromFileSpecial() { +#if defined(QT_TEST_SERVER) && defined(Q_OS_WIN) + if (qstrcmp(QTest::currentDataTag(), "smb-path") == 0) + QSKIP("Docker-based test server doesn't support smb protocol yet"); +#endif + QFETCH(QString, fileName); QFETCH(QString, url); diff --git a/tests/auto/network/ssl/qocsp/certs/alice.crt b/tests/auto/network/ssl/qocsp/certs/alice.crt new file mode 100644 index 0000000000..02df86a517 --- /dev/null +++ b/tests/auto/network/ssl/qocsp/certs/alice.crt @@ -0,0 +1,24 @@ +-----BEGIN CERTIFICATE----- +MIIEGDCCAwCgAwIBAgIBAjANBgkqhkiG9w0BAQsFADCBjjELMAkGA1UEBhMCTk8x +DTALBgNVBAgMBE9zbG8xEjAQBgNVBAcMCU9zbG8gQ2l0eTETMBEGA1UECgwKVGhl +IFF0IENBMTENMAsGA1UECwwEUVRDTjERMA8GA1UEAwwIY2ExcXQuaW8xJTAjBgkq +hkiG9w0BCQEWFnRpbXVyLnBvY2hlcHRzb3ZAcXQuaW8wHhcNMTgxMTIyMTEwNjE4 +WhcNMjgxMTE5MTEwNjE4WjCBkjELMAkGA1UEBhMCTk8xDTALBgNVBAgMBE9zbG8x +EjAQBgNVBAcMCU9zbG8gQ2l0eTEdMBsGA1UECgwUVGhlIEZhbW91cyBBbGljZSBM +dGQxDTALBgNVBAsMBEdPQUExEjAQBgNVBAMMCWFsaWNlLm9yZzEeMBwGCSqGSIb3 +DQEJARYPYWxpY2VAYWxpY2Uub3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB +CgKCAQEAtuGDR9oIEkK57xlxq/xc3u7B1ni4pdoyhf9r+pkgmu591qp2kl3Xcq3W +Ve5Z553orAUCAExPlKfFV+CYYAedSgsDYlKk8DN+f/n+hkG6Wl2qyFzHgl+mvPwa +eDqdVMIcDHGhSljALi9AqsN4lbrUhSxiyuPhAwl82WB0EIucmBs1NxSSZgFPRBLG +Uzy9WvtQFq1qtn795PVIUsNg68qZQ9BvRduOQAr3bg3anoYqytthWnzLWKri2QR4 +Z4Y0mvcbT/PZwhtcFZzDXG3Hvc7k3AroAbWoSghMEgok9TW9grKYkW2d5cpQTP+l +ptkB6yZ06MY9/uCdYzhm8eu2RgVndwIDAQABo3sweTAJBgNVHRMEAjAAMCwGCWCG +SAGG+EIBDQQfFh1PcGVuU1NMIEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAdBgNVHQ4E +FgQUQz2PuE4VuqHtZYTvVLr4+0IuHTUwHwYDVR0jBBgwFoAUeBcnAkU7sTqm7i2Q +vTxwgr0nQ0QwDQYJKoZIhvcNAQELBQADggEBABGGmo1vUAXKQm9kowvUtjDpEIIY +TpT+KqiUBOgJg5fGn6a63vBn5GMA6eT948ywi9ZU2M9dIXJCM+bdqjXeOtt4bBPZ +xz6DcBPW9CoTR4CV1muNa95WIXzAHatq3XYG041ddMf41WG7QIdQsojBYEG0IYlv +PQx+B+m2cu7A04aI2tCS8aUh7Xc9wRilJ+h/FlYFFQzgyEKsd7CFgkyxG/sLyFNH +skYYk/DLlmaWa+YScHYB5kAk8StoETeMI2LLs7rgJmchi8eAxjLroYDUhQclUjqz +vlNM+4GvcF5RluyuEXFOZVdmQahkXcyu0Q3yxvsBbnDglmbb2YHPl/blB7w= +-----END CERTIFICATE----- diff --git a/tests/auto/network/ssl/qocsp/certs/alice.key b/tests/auto/network/ssl/qocsp/certs/alice.key new file mode 100644 index 0000000000..6f2666ebde --- /dev/null +++ b/tests/auto/network/ssl/qocsp/certs/alice.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC24YNH2ggSQrnv +GXGr/Fze7sHWeLil2jKF/2v6mSCa7n3WqnaSXddyrdZV7lnnneisBQIATE+Up8VX +4JhgB51KCwNiUqTwM35/+f6GQbpaXarIXMeCX6a8/Bp4Op1UwhwMcaFKWMAuL0Cq +w3iVutSFLGLK4+EDCXzZYHQQi5yYGzU3FJJmAU9EEsZTPL1a+1AWrWq2fv3k9UhS +w2DryplD0G9F245ACvduDdqehirK22FafMtYquLZBHhnhjSa9xtP89nCG1wVnMNc +bce9zuTcCugBtahKCEwSCiT1Nb2CspiRbZ3lylBM/6Wm2QHrJnToxj3+4J1jOGbx +67ZGBWd3AgMBAAECggEADbzU+sHDF3QRuYdExbGYXFq9DtpUrIi+gNhWCSYVj+3Y +YBa//3CzLXcngZ78++wdvUZHBzS0SatspJRHffc0doprP6iLoUuM9hoWZ4lqcT1W +BeUKS53ZzZp2do+Yn/RQ3RJwFkCidxWvmuRCG6VEL5jM9wa1MWA2E7IuJcwHAFny +WIByosje5Qrd7eXDuVoqr1hjJ2UxIjIJ8Zgg3EE9wVUyJE3PU1HLz2AefonYRwbL +XlzNgnj0c9Ti9ejfyon+jTnpslLKtPal2kxyGoKPAngadAhCzqSaCWggACm7R8Ge +pZ0Y0pV7QReEgjfFd4D3qOqLRQZVJOMDb3vJu2/rsQKBgQDfKjfSpUweBM9li7GS +xXbDpC3Y8zQ2VY+2SvgYoYiYU/Y6YenxhKM1XDbWZxhxS8GVfCUAESFDOTZcMvdi +QEbG1uEmuCn1ksvrC2y54rtd8WDppcS0vJxCrU4nZG0v9IjVKp67B8EpBpAQeNb1 +tR6ByT2fLJu5+WU2S7OxqX7uLwKBgQDRyfKvrCQgdJOQlJlHOv1y1hN8WY51A8P/ +JbDXoun3PCPd+JczvFXCUh3ZLXqUEAX2qDOBD1pBM62EN6/A9ukO4mcMd8uYIet6 +nR4nVqXUjWuzXe6eo913lTDQrIOGWpViTc8fnvFlwBPfwzxbZNx38HZbw0L0nT7d +8TE/JxLROQKBgQC4Kzo4b8vadjPGZLueGbICkQp5IXR0ZrYcRdBrW1vEAn6Q/d84 +PzMFxV1IIXrNfSx8NiC+5mQh+yQ+gJ0iC1OdoxXag1+1V3lMN3h6C4B/bcWB7Rjh +40m9yRJXdgyZ59/Is8ydIzAosE7SGTelPNy5VR+yrfiySPxbC6x3MR8cZwKBgQCq +PVTg1bIjXDZ7NvsDYI1XaP07BXmi30FnhXByLFPsOzNn51jbtNNq8zQhjtRP3ojY +VjolWw4EpykBiCbpUfRiDbtN1NC0TaJHR8S2a4v6ZiCl123R8mu/pKOOUtAQcOWU +dkvD/zkpNqtqA4axK7H06n9Bi7yDwC7J7/Xkp5KPkQKBgFDprXrXg4zvIsxbXYZ3 +2bCaxyhBXNKcGwtWbbLfJcOwHJPns/abGkYIJ0NbMZX1LwTDfQWmC+8YKKvIlbKG +S2uk5H4qzupR4XN6YJ7SCHlGv2z0vxVjV7aWc1TME2iZQoBuO1urxPZwHd/euruo +kluWh1KV5XnWjBSYjZpiXxWl +-----END PRIVATE KEY----- diff --git a/tests/auto/network/ssl/qocsp/certs/ca1.crt b/tests/auto/network/ssl/qocsp/certs/ca1.crt new file mode 100644 index 0000000000..b5ae194fab --- /dev/null +++ b/tests/auto/network/ssl/qocsp/certs/ca1.crt @@ -0,0 +1,24 @@ +-----BEGIN CERTIFICATE----- +MIID9DCCAtygAwIBAgIJAMQbE3657KDYMA0GCSqGSIb3DQEBCwUAMIGOMQswCQYD +VQQGEwJOTzENMAsGA1UECAwET3NsbzESMBAGA1UEBwwJT3NsbyBDaXR5MRMwEQYD +VQQKDApUaGUgUXQgQ0ExMQ0wCwYDVQQLDARRVENOMREwDwYDVQQDDAhjYTFxdC5p +bzElMCMGCSqGSIb3DQEJARYWdGltdXIucG9jaGVwdHNvdkBxdC5pbzAeFw0xODEx +MjIxMDIxMTNaFw0yODExMTkxMDIxMTNaMIGOMQswCQYDVQQGEwJOTzENMAsGA1UE +CAwET3NsbzESMBAGA1UEBwwJT3NsbyBDaXR5MRMwEQYDVQQKDApUaGUgUXQgQ0Ex +MQ0wCwYDVQQLDARRVENOMREwDwYDVQQDDAhjYTFxdC5pbzElMCMGCSqGSIb3DQEJ +ARYWdGltdXIucG9jaGVwdHNvdkBxdC5pbzCCASIwDQYJKoZIhvcNAQEBBQADggEP +ADCCAQoCggEBAOCs3AV7sDKHJUJcm7a0OqnShIvoB1qv6UcOmlBmUzGl5GzX90Jz +7jYJoOPjxjNyRxMOsOReB1ZcSuIAjkdAEfFMaVe6j7qKTJ5ycTVY/fVoxyxsSNuI +xOJ6RCEjLHcxONEbkN/xI8LMdVko3m4P10r5GxwrgyPvpa87Yq5+XJ1BPWJyKbD7 +Tqpn3dvZUj0/POsMUTT7Q7VXOfDlZj58XWAC6ECTqJauhGFMhiwgqOn2Qo1W0QjV +DkGqRTdgIAM6Rv2cSRxgnflwW5QZ8kWUV81h/yx4cck/D9TcVxjr3Pvy6aJ/U41u +d4XJQgwCj4LJi4msw1S0CvZWmz+2BKxcbRsCAwEAAaNTMFEwHQYDVR0OBBYEFHgX +JwJFO7E6pu4tkL08cIK9J0NEMB8GA1UdIwQYMBaAFHgXJwJFO7E6pu4tkL08cIK9 +J0NEMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBADp1kqDRcyVG +BdMge+Il10IjbpzzSjAoZiqiw69V99LiHW9ePbxG4AmliE6Za60GE5PCXOLjJh/5 +efgnIbybbyIOIT9iK4TXWLw2XW+rMY51c0RAxp2h/sc+5CZ0F0I811F5VUHXg2qR +U7C2zbzqAimN8TBm6FRe7NFQfqLCrsuFJjSc3obrqKQcpvRwxMk6NpkdoemzqLmY +lrBrTaeVbZ4ix3srVPvXRm9TdiC+JuuFmvulMfe+/wwnhb+dwT3JUC+EIq/Uf5Wb +g8lvB4ntitL8NLQ2hFGqYuoFNIGs6tRN71ohk+/ONqe9wJhcI9QAruPOvsg+8J0H +uGooX7PUNHg= +-----END CERTIFICATE----- diff --git a/tests/auto/network/ssl/qocsp/certs/ca1.key b/tests/auto/network/ssl/qocsp/certs/ca1.key new file mode 100644 index 0000000000..4ee080f706 --- /dev/null +++ b/tests/auto/network/ssl/qocsp/certs/ca1.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDgrNwFe7AyhyVC +XJu2tDqp0oSL6Adar+lHDppQZlMxpeRs1/dCc+42CaDj48YzckcTDrDkXgdWXEri +AI5HQBHxTGlXuo+6ikyecnE1WP31aMcsbEjbiMTiekQhIyx3MTjRG5Df8SPCzHVZ +KN5uD9dK+RscK4Mj76WvO2KuflydQT1icimw+06qZ93b2VI9PzzrDFE0+0O1Vznw +5WY+fF1gAuhAk6iWroRhTIYsIKjp9kKNVtEI1Q5BqkU3YCADOkb9nEkcYJ35cFuU +GfJFlFfNYf8seHHJPw/U3FcY69z78umif1ONbneFyUIMAo+CyYuJrMNUtAr2Vps/ +tgSsXG0bAgMBAAECggEBAL1RCwjXw42gEUZM8KzQS0pD6IpXVrMU3ZWReXhb8Kg6 +KDOK+3+UXlpMXLUKfj1lgvxM+cNEdBxSIoszerARDc1s3KseufOui4dL2ZbhSQVc +Z9BH4lCSe4x3CCeAEvzQjhatirMY51BCpnMdm+fUE07KfwyKobNLQSpZ+Pod4f5i +oQbOiZYfRfU2quaWIsVb/a5IiUD0gG0KS9O5wX6VigVeFRpOPHT4YCQ1qds4HqQq +PKQtkLq0mo6beXCfXWrJ5Nc0QOIFlgSAHkeRR7zLK8MlaerwZ5YdeJIWuPM9l9H+ +34FVkHle1rPN6dJf7EPwWxn1PceFe3QYn1GHoiMmXfkCgYEA/U6iQypbLEKLmLbt +XTvhV1FVDQM42BX+ATNQ8Wro0ybdyzM+d4271uAUGTF1Zvxndv22p+JOmldWveAR +0iVK4mvrs25ACg27Bz3LiUaQB2OyYrj9M7TLgQ47gYEhwgnsSniFyrMcptNyIfW5 +GoB1N00EKiCvHyWo5LK6kRZt5QcCgYEA4xBOC/Otc9lTp24iSVA8Y7XJ+nlypFtc +pehf262jH11wEkWskmc9aP/kpxt9fUrDxf3YIOqITR4mMNn184P1WywHAQF7Adfd +3r5YBMVaanuaMsSuAZOJGyvuk2BE6328IKdE+3emndzXuQdDf0X2TUznwdKe9AzZ +qadCBLfUpk0CgYAgDKbzIJTQkMrg06RMu5rTVXMRZmr2zDGLLVb8dK5oqO4/G4i3 +z7MIiOmCFoPoN99PauKFc1jGpm5PL96RXC6RX14/IZ/wpbQYQnVSNR9cD/0uCIHg +3OsytP5KcHA5ANBoy78B2o+xe+dg7JozBDXQfWodem0t37Hy3bpFSTU2WQKBgETY +qcFn9hydNYcblpvCDz1wXjhq4H7DENlhFseF42LcMuHnbEbLtMwEYrDkXe1CYQ/E +QubgFcnELXI8dB2M0jT9qXX9m+1YJXanIgr4R8zngz6HcfcaY8TwUhsvYlZAvmzs +KrdQdR2CW4pHkIijjuWrPs3+7aEz0D9nblX94yU1AoGATVCfQOwmEMFHg33luMMt +0lTOHsar6g1O5vz0ZPZ1NjJF9Qe3+T7B4n4gq9pLwfi7Ohoa4CDmt0nKmy56dBha +5LM8mzw+PaH9a3pP93caS6k/X68TLOp7fwvnzP6HTjtis2sdYzVma6ghEF0zRdQr +6nWMI6Kx2kFaNdzKSHzxP5A= +-----END PRIVATE KEY----- diff --git a/tests/auto/network/ssl/qocsp/certs/infbob.key b/tests/auto/network/ssl/qocsp/certs/infbob.key new file mode 100644 index 0000000000..7878339151 --- /dev/null +++ b/tests/auto/network/ssl/qocsp/certs/infbob.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDkF2BuPlkQa3Ox +JxnbQ+gy1mAxaGGzfnmGocraxVSKSssX3zSkeIrWB1kW3diOtIZ1jovYftHGsqoB +F5k6fN9dr37mFIZnilF6Bq0seYjNUl6I0d7Cf3NJSf7TG5+P+dAyNLN8aXILctY8 +krlSe4ysb++9xgawt2DYL3I0LBd+W27hd2BlfcmB4g2X3zOasjZM8F5HSBxF5e7f +fVaUmCC8S4jdXUQEbUNFk6HufDwDhP1gMtoGKHusWOdI5O6cQAfUUmRLSfi/jWoe +KLPafbj7KIcA8+YojOvub2guNpO42h9fc83/gCkkBJhwXNdIQjRUnz6Lu05kDTG9 +X28gbX9TAgMBAAECggEBAN9xCxVUXJmaOb6ciFblIi3TFm6wS62zw0chbgB8eQH0 +nRoonYBVWeSrVBnzf7bkoCe/Wb3fFo+o7KOfQ4spUwOK7SxlhPkfZgu9SJ4d/Obu +vw8XUTqF8iEkrM6P6/L2DX9xYzcIcSFIARlbvtJPmBJAocHtoRYyvltpt13mp6kt +/LVYR4qFAWRpPR6rnjlXEjfrE9taHWgIJEjwMj+IcTjnGiS1rX1T/JNhjRxsRJwU +qxqhYmeenNymyUJxS2B806EcG3UAJu63dK61VXN1dtPhS3FqjeR//GRlmy14n7RW +ZQAuT9dPB/WzUZVzEcOgTwe/+XsPTSfz7gpaoffgMJECgYEA/43xZRi48Dfp3tdq +qwwLf6Ya9pB2zb3XE8MUQhxsrygzL5ngZhmr2m0LgGCf5fXa983G6wzA6sOdpvve +jFAlBZYbWaYnvog9QIFcTj0S6PahGTBaR7PSNzK0UzoHYexYVCkyzQl1O2hktazd +Cankh/6IlAFkKbUSDqAwc07jNCkCgYEA5H0tNXpcDN6JTgKNe8YHM0GjZB+qGEoL +7YZbFlANjO9pOPY6JMQ3+DbOoruIH97CIyVYokuH0qRAfjm5LNiVYECFVFZRnGFb +BNPOPAnPJPISDF66zjW0KLMYCykJAHQ4SpHUPcJ6JnfBr76s/xSbNI9qnhpy3QYI +ATkqOrP25xsCgYEAy3pjmJGEv5BloM942VSv2yWRFn2UeuELXWrYuIMVbqndh6tH +50PNeA+XNtK4vktx3Bl2pzTybnrvDkRBwQsXT0lj4Y/Q2X509uWJb6plYiTtxLah +S7I8UUMIHbR4qFmdQvXCw0sikvjeJ2HKZaVml3ntmZs5+5N3GzolGcrYUXECgYEA +pPsBnsCoIJ66s7pCIKIfZtI5QT1f20P0EuDVemn5Ls9bwcaAuzV3WGFymKwiISj+ +MtRviFhTTTROYRYa8Be+3A4ad4gQS4M8bmLlYhKPIJUtlQL9jZHXcR/H9578ofhJ +AQcFIkb/XjFQiC58yX4+hxgbGufsEk2dkAyPwm1ZlQsCgYBTjnraJbYSz1v3MQKx +fHm9eHki/ODR3lWiCYYnnW3AwRa7AXS4ZiSw78wzkUX2XTJbE6JlEUH4M9DMzr4y +QBwKmx+3u+Im4WcZ889jo6XrF0X9mXRmY25+gr2ypTbKZjT8FCYcXIgiOxITLXZh +Bmn7KZcsdaPxSFn05ASEanLNqA== +-----END PRIVATE KEY----- diff --git a/tests/auto/network/ssl/qocsp/certs/infbobchain.crt b/tests/auto/network/ssl/qocsp/certs/infbobchain.crt new file mode 100644 index 0000000000..7ed13c2856 --- /dev/null +++ b/tests/auto/network/ssl/qocsp/certs/infbobchain.crt @@ -0,0 +1,49 @@ +-----BEGIN CERTIFICATE----- +MIIEHjCCAwagAwIBAgIBATANBgkqhkiG9w0BAQsFADCBjjELMAkGA1UEBhMCTk8x +DTALBgNVBAgMBE9zbG8xEjAQBgNVBAcMCU9zbG8gQ2l0eTETMBEGA1UECgwKVGhl +IFF0IENBMTENMAsGA1UECwwEUVRDTjERMA8GA1UEAwwIY2ExcXQuaW8xJTAjBgkq +hkiG9w0BCQEWFnRpbXVyLnBvY2hlcHRzb3ZAcXQuaW8wHhcNMTgxMTIyMTAyOTM3 +WhcNMjgxMTE5MTAyOTM3WjCBmDELMAkGA1UEBhMCTk8xDTALBgNVBAgMBE9zbG8x +EjAQBgNVBAcMCU9zbG8gQ2l0eTEkMCIGA1UECgwbVGhlIEluZmFtb3VzIFNuZWFr +eSBCb2IgTHRkMQwwCgYDVQQLDANCREExEzARBgNVBAMMCmluZmJvYi5jb20xHTAb +BgkqhkiG9w0BCQEWDmJvYkBpbmZib2IuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOC +AQ8AMIIBCgKCAQEA5Bdgbj5ZEGtzsScZ20PoMtZgMWhhs355hqHK2sVUikrLF980 +pHiK1gdZFt3YjrSGdY6L2H7RxrKqAReZOnzfXa9+5hSGZ4pRegatLHmIzVJeiNHe +wn9zSUn+0xufj/nQMjSzfGlyC3LWPJK5UnuMrG/vvcYGsLdg2C9yNCwXfltu4Xdg +ZX3JgeINl98zmrI2TPBeR0gcReXu331WlJggvEuI3V1EBG1DRZOh7nw8A4T9YDLa +Bih7rFjnSOTunEAH1FJkS0n4v41qHiiz2n24+yiHAPPmKIzr7m9oLjaTuNofX3PN +/4ApJASYcFzXSEI0VJ8+i7tOZA0xvV9vIG1/UwIDAQABo3sweTAJBgNVHRMEAjAA +MCwGCWCGSAGG+EIBDQQfFh1PcGVuU1NMIEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAd +BgNVHQ4EFgQUloqk6Iihkkcxp85jAzeUPGVmapkwHwYDVR0jBBgwFoAUeBcnAkU7 +sTqm7i2QvTxwgr0nQ0QwDQYJKoZIhvcNAQELBQADggEBAGCdYFNskTzMilRtmw+v +oJQM3mc6LdYYuADCuh8O/GKaqUnE7V2XnMBYWMN93eeN9VXmK2yAZaQU1J6ruP1S +pLMzJ8hbQej+sm+XAHVxAtr34KmEC50gIn1cB/sRKxHMombbNl7EK44puFU7q58P +zBz5lTXXTfA954D/ijEMMSDvIZ25me6vrGPMj1LX/wC6CWadSr9IxAO9HQVQQqwv +AbbqrCvMSMv633/f1EYU8Q6jhUCTlnin4pXtriOnqi+6MZICaYRCUgV224Rs3OUS +jmrbOeoaZUpmOVmuoYXWeexe229G2KGiEIgnSBEk5OLFHCeZ8++WJ5/SLHt8MBLc +O0w= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIID9DCCAtygAwIBAgIJAMQbE3657KDYMA0GCSqGSIb3DQEBCwUAMIGOMQswCQYD +VQQGEwJOTzENMAsGA1UECAwET3NsbzESMBAGA1UEBwwJT3NsbyBDaXR5MRMwEQYD +VQQKDApUaGUgUXQgQ0ExMQ0wCwYDVQQLDARRVENOMREwDwYDVQQDDAhjYTFxdC5p +bzElMCMGCSqGSIb3DQEJARYWdGltdXIucG9jaGVwdHNvdkBxdC5pbzAeFw0xODEx +MjIxMDIxMTNaFw0yODExMTkxMDIxMTNaMIGOMQswCQYDVQQGEwJOTzENMAsGA1UE +CAwET3NsbzESMBAGA1UEBwwJT3NsbyBDaXR5MRMwEQYDVQQKDApUaGUgUXQgQ0Ex +MQ0wCwYDVQQLDARRVENOMREwDwYDVQQDDAhjYTFxdC5pbzElMCMGCSqGSIb3DQEJ +ARYWdGltdXIucG9jaGVwdHNvdkBxdC5pbzCCASIwDQYJKoZIhvcNAQEBBQADggEP +ADCCAQoCggEBAOCs3AV7sDKHJUJcm7a0OqnShIvoB1qv6UcOmlBmUzGl5GzX90Jz +7jYJoOPjxjNyRxMOsOReB1ZcSuIAjkdAEfFMaVe6j7qKTJ5ycTVY/fVoxyxsSNuI +xOJ6RCEjLHcxONEbkN/xI8LMdVko3m4P10r5GxwrgyPvpa87Yq5+XJ1BPWJyKbD7 +Tqpn3dvZUj0/POsMUTT7Q7VXOfDlZj58XWAC6ECTqJauhGFMhiwgqOn2Qo1W0QjV +DkGqRTdgIAM6Rv2cSRxgnflwW5QZ8kWUV81h/yx4cck/D9TcVxjr3Pvy6aJ/U41u +d4XJQgwCj4LJi4msw1S0CvZWmz+2BKxcbRsCAwEAAaNTMFEwHQYDVR0OBBYEFHgX +JwJFO7E6pu4tkL08cIK9J0NEMB8GA1UdIwQYMBaAFHgXJwJFO7E6pu4tkL08cIK9 +J0NEMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBADp1kqDRcyVG +BdMge+Il10IjbpzzSjAoZiqiw69V99LiHW9ePbxG4AmliE6Za60GE5PCXOLjJh/5 +efgnIbybbyIOIT9iK4TXWLw2XW+rMY51c0RAxp2h/sc+5CZ0F0I811F5VUHXg2qR +U7C2zbzqAimN8TBm6FRe7NFQfqLCrsuFJjSc3obrqKQcpvRwxMk6NpkdoemzqLmY +lrBrTaeVbZ4ix3srVPvXRm9TdiC+JuuFmvulMfe+/wwnhb+dwT3JUC+EIq/Uf5Wb +g8lvB4ntitL8NLQ2hFGqYuoFNIGs6tRN71ohk+/ONqe9wJhcI9QAruPOvsg+8J0H +uGooX7PUNHg= +-----END CERTIFICATE----- diff --git a/tests/auto/network/ssl/qocsp/certs/ss1-private.key b/tests/auto/network/ssl/qocsp/certs/ss1-private.key new file mode 100644 index 0000000000..1c42daaf9f --- /dev/null +++ b/tests/auto/network/ssl/qocsp/certs/ss1-private.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQC4bXcfIjweShLx +6jBTKu/i5sXmlwTH9Z4PTzQ1VteKyEIDlnW5ocVWqRgBrvz3NlTFkDKkQXshkXyE +JyVZFbAPCfGsroZVISpFhUmJbPMBNn3SyGEU+sxWIpOZOKmG5tel6B4Bt5TWsRHL +mtU8Pv/APsz+i9JhgE25ksGhx16MqvdRv/xNGleF8qe+hDOeiNF3/lNv2hYb/MvD +1F73FBoDVnqty/VXXOJFb7elLE4ArXsTN/hip42Lbl1guYvnqnTZFhCHwMzRu4qc +3FTlemumfJpacpRnqVw2TURA5SdpTp9NYIxygEGNY201meNEjAEyg8GeFkAgu99R +LPQT+rTNAgMBAAECggEAPQEIfCXo2OQLrDWY0onLW7SWFZYyoKngJJRAYrxdA60G +GQW13zdhfS7ln/jv+B3ioI74EVkPj6T+GQCR3AvOdssFQ+dey93yi5hxIKIHJ4mM +ySI66qOi34MEa5RQjyzgfCJxeoPtGa7sgfqvOgRkuISNbk11w4abLx0aK5c08TY0 +JdeoWWhATaFZXl782Aw2FwGPTwOIf7GB09BJS3qUqlMT9fowLmWO10jOKkNtvcnT +2mAqT5cdZG1ffT5+f0JETPCbBPhhyE7VyYEVQfqTkRnEoz3hcZvjx91jD527+CSL +Qhg7zZu2oakyJQvpHETZ6cgrs7uDEiol7ARANezwyQKBgQDmapxV/qIOd5WFDVXw +lGt+dsELBBdMhvzr4A9eZdIZiXu48rdFG0XoECo5BKpXa1+ISr2od0U0YODrJrws +OHxHhlxGjJFs8kFteUPHyEZv6/rvkbA+xc0Uw04NnDRHBLK8VvX7MBWfvTqLN4bK +sZsMblscRBtEpFpN1fiJgnNASwKBgQDM56lBugtueBV9M4C/JF2is96d14ue3Y4i +SgMnHY18D3ru+KDuxPYoIs5Yos2vDWK2k8754WZ+WNXokjRoYPiFbeBPpI9NudJs +BUJz/sLJHjs3a4HrQs3hCuufczNxq9wQnALQHCMEqeBUTYCu/1+zYgwAu3Z/R8rJ +jKgexl+gRwKBgGrLCNCWpze7VzKGvsk1kSjZE5nueHoAqqMMgzMGUD2DyjMrU6QV +Au6O53Lr5aOE4Y9CzOqS9SFUsYprtpVsTLW94XDVX+W11ntN1At5mKPxJKn6xUwi +022HI9sNBfHQjKLcTz/vxmX2B3dU8gVqEenOEC5mppjG8A/ZV0ssigxHAoGAfGsG +OSSwoElGMxm8yVNZj9vMBufEnZhGH8f1FiE5seTsboKFpbXvCfvoc6WXYv2rvNUP +TmdxBrMGYAu2ytJm1Q4cr/9qDHYSsQiYizpcKCa1KjebUbDktgsde1pGGHWUUHmK +s7cCBGjqEAZnZtslzxRv2Vn639pF5hAEXXtywS0CgYAUIjhp43qgtbQdZMX7xbVR +lT26aq7NguCtt7njpgkhqc0HThb3I8ImrhNSDcS0/T9dPU70vt0ceruyRXmwX5hA +l28i5GzF5ufaRQdcsSR9u+P67nD5sTZBesbejXFySis5EC/97A4XZvkSfY4DQSZ+ +u8JJPZUlb2kGAHRpmxvpDA== +-----END PRIVATE KEY----- diff --git a/tests/auto/network/ssl/qocsp/certs/ss1.crt b/tests/auto/network/ssl/qocsp/certs/ss1.crt new file mode 100644 index 0000000000..43ca8316c2 --- /dev/null +++ b/tests/auto/network/ssl/qocsp/certs/ss1.crt @@ -0,0 +1,25 @@ +-----BEGIN CERTIFICATE----- +MIIEKzCCAxOgAwIBAgIJAOO/b5uLSmT8MA0GCSqGSIb3DQEBBQUAMIGqMQswCQYD +VQQGEwJOTzENMAsGA1UECAwET3NsbzENMAsGA1UEBwwET3NsbzESMBAGA1UECgwJ +VGhlIFF0IENBMScwJQYDVQQLDB5SJkQgKGZha2UgY2VydGlmaWNhdGVzIGlzc3Vl +cikxGTAXBgNVBAMMEFRpbXVyIFBvY2hlcHRzb3YxJTAjBgkqhkiG9w0BCQEWFnRp +bXVyLnBvY2hlcHRzb3ZAcXQuaW8wIBcNMTgxMTE3MDUxNDA1WhgPMjExODEwMjQw +NTE0MDVaMIGqMQswCQYDVQQGEwJOTzENMAsGA1UECAwET3NsbzENMAsGA1UEBwwE +T3NsbzESMBAGA1UECgwJVGhlIFF0IENBMScwJQYDVQQLDB5SJkQgKGZha2UgY2Vy +dGlmaWNhdGVzIGlzc3VlcikxGTAXBgNVBAMMEFRpbXVyIFBvY2hlcHRzb3YxJTAj +BgkqhkiG9w0BCQEWFnRpbXVyLnBvY2hlcHRzb3ZAcXQuaW8wggEiMA0GCSqGSIb3 +DQEBAQUAA4IBDwAwggEKAoIBAQC4bXcfIjweShLx6jBTKu/i5sXmlwTH9Z4PTzQ1 +VteKyEIDlnW5ocVWqRgBrvz3NlTFkDKkQXshkXyEJyVZFbAPCfGsroZVISpFhUmJ +bPMBNn3SyGEU+sxWIpOZOKmG5tel6B4Bt5TWsRHLmtU8Pv/APsz+i9JhgE25ksGh +x16MqvdRv/xNGleF8qe+hDOeiNF3/lNv2hYb/MvD1F73FBoDVnqty/VXXOJFb7el +LE4ArXsTN/hip42Lbl1guYvnqnTZFhCHwMzRu4qc3FTlemumfJpacpRnqVw2TURA +5SdpTp9NYIxygEGNY201meNEjAEyg8GeFkAgu99RLPQT+rTNAgMBAAGjUDBOMB0G +A1UdDgQWBBSyHPlJr6BrpwMY7Sxg2R3CpQR7UzAfBgNVHSMEGDAWgBSyHPlJr6Br +pwMY7Sxg2R3CpQR7UzAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQBD +o86xp1WwvX6mYzF94ifZlkq1aDN6/njj2B9fvJCtygfqq6b9BrQJ0hNeqRh8OaIh +v2YmjbdUaoYguHmUxL+SeS67Sp8QBoSwdU5x0i8ygrigBrbb3myNqN6hGvpGy9E0 +B8PnVDt9DaOCunaMyGNPMLNPVGYULmberGtxV9wilcH4Q6WZrk9IhuyfqeBZtBYM +IcjV3OKdUv/ggu2IZSN7njKcgr+uyPt0Ymo9GozJSTdnN/E4hsRgzcgzCMf2fxzj +nGcsDRQ4L1R8p1zDlduxmmk42zGCGz3duFX7dijAxJWirS8Zsea4aooLgDQYT/zI +8hKd3KC3knLhPcxFKiUg +-----END CERTIFICATE----- diff --git a/tests/auto/network/ssl/qocsp/qocsp.pro b/tests/auto/network/ssl/qocsp/qocsp.pro new file mode 100644 index 0000000000..f4e846f39b --- /dev/null +++ b/tests/auto/network/ssl/qocsp/qocsp.pro @@ -0,0 +1,15 @@ +CONFIG += testcase + +SOURCES += tst_qocsp.cpp +QT = core network network-private testlib + +TARGET = tst_qocsp + +win32 { + CONFIG(debug, debug|release) { + DESTDIR = debug + } else { + DESTDIR = release + } +} + diff --git a/tests/auto/network/ssl/qocsp/tst_qocsp.cpp b/tests/auto/network/ssl/qocsp/tst_qocsp.cpp new file mode 100644 index 0000000000..9716c04bbb --- /dev/null +++ b/tests/auto/network/ssl/qocsp/tst_qocsp.cpp @@ -0,0 +1,823 @@ +/**************************************************************************** + ** + ** Copyright (C) 2018 The Qt Company Ltd. + ** Contact: https://www.qt.io/licensing/ + ** + ** This file is part of the test suite of the Qt Toolkit. + ** + ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ + ** 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 The Qt Company. For licensing terms + ** and conditions see https://www.qt.io/terms-conditions. For further + ** information use the contact form at https://www.qt.io/contact-us. + ** + ** GNU General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU + ** General Public License version 3 as published by the Free Software + ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT + ** included in the packaging of this file. Please review the following + ** information to ensure the GNU General Public License requirements will + ** be met: https://www.gnu.org/licenses/gpl-3.0.html. + ** + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + +#include <QtTest/QtTest> + +#include <QtNetwork/private/qtnetworkglobal_p.h> + +#include <QtNetwork/private/qsslsocket_openssl_symbols_p.h> +#include <QtNetwork/private/qsslsocket_openssl_p.h> + +#include <QtNetwork/qsslcertificate.h> +#include <QtNetwork/qtcpserver.h> +#include <QtNetwork/qsslerror.h> +#include <QtNetwork/qsslkey.h> +#include <QtNetwork/qssl.h> + +#include <QtCore/qsharedpointer.h> +#include <QtCore/qbytearray.h> +#include <QtCore/qfileinfo.h> +#include <QtCore/qstring.h> +#include <QtCore/qfile.h> +#include <QtCore/qlist.h> +#include <QtCore/qdir.h> + +#include <openssl/ocsp.h> + +#include <algorithm> +#include <utility> + +// NOTE: the word 'subject' in the code below means the subject of a status request, +// so in general it's our peer's certificate we are asking about. + +using SslError = QT_PREPEND_NAMESPACE(QSslError); +using VectorOfErrors = QT_PREPEND_NAMESPACE(QVector<SslError>); +using Latin1String = QT_PREPEND_NAMESPACE(QLatin1String); + +Q_DECLARE_METATYPE(SslError) +Q_DECLARE_METATYPE(VectorOfErrors) +Q_DECLARE_METATYPE(Latin1String) + +QT_BEGIN_NAMESPACE + +namespace { + +using OcspResponse = QSharedPointer<OCSP_RESPONSE>; +using BasicResponse = QSharedPointer<OCSP_BASICRESP>; +using SingleResponse = QSharedPointer<OCSP_SINGLERESP>; +using CertId = QSharedPointer<OCSP_CERTID>; +using EvpKey = QSharedPointer<EVP_PKEY>; +using Asn1Time = QSharedPointer<ASN1_TIME>; +using CertificateChain = QList<QSslCertificate>; + +using NativeX509Ptr = X509 *; + +class X509Stack { +public: + explicit X509Stack(const QList<QSslCertificate> &chain); + + ~X509Stack(); + + int size() const; + X509 *operator[](int index) const; + operator STACK_OF(X509) *() const; + +private: + OPENSSL_STACK *stack = nullptr; + + Q_DISABLE_COPY(X509Stack) +}; + +X509Stack::X509Stack(const QList<QSslCertificate> &chain) +{ + if (!chain.size()) + return; + + stack = q_OPENSSL_sk_new_null(); + if (!stack) + return; + + for (const QSslCertificate &cert : chain) { + X509 *nativeCert = NativeX509Ptr(cert.handle()); + if (!nativeCert) + continue; + q_OPENSSL_sk_push(stack, nativeCert); + q_X509_up_ref(nativeCert); + } +} + +X509Stack::~X509Stack() +{ + if (stack) + q_OPENSSL_sk_pop_free(stack, reinterpret_cast<void(*)(void*)>(q_X509_free)); +} + +int X509Stack::size() const +{ + if (stack) + return q_OPENSSL_sk_num(stack); + return 0; +} + +X509 *X509Stack::operator[](int index) const +{ + return NativeX509Ptr(q_OPENSSL_sk_value(stack, index)); +} + +X509Stack::operator STACK_OF(X509) *() const +{ + return reinterpret_cast<STACK_OF(X509)*>(stack); +} + +struct OcspTimeStamp +{ + OcspTimeStamp() = default; + OcspTimeStamp(long secondsBeforeNow, long secondsAfterNow); + + static Asn1Time timeToAsn1Time(long adjustment); + + Asn1Time thisUpdate; + Asn1Time nextUpdate; +}; + +OcspTimeStamp::OcspTimeStamp(long secondsBeforeNow, long secondsAfterNow) +{ + Asn1Time start = timeToAsn1Time(secondsBeforeNow); + Asn1Time end = timeToAsn1Time(secondsAfterNow); + if (start.data() && end.data()) { + thisUpdate.swap(start); + nextUpdate.swap(end); + } +} + +Asn1Time OcspTimeStamp::timeToAsn1Time(long adjustment) +{ + if (ASN1_TIME *adjusted = q_X509_gmtime_adj(nullptr, adjustment)) + return Asn1Time(adjusted, q_ASN1_TIME_free); + return Asn1Time{}; +} + +struct OcspResponder +{ + OcspResponder(const OcspTimeStamp &stamp, const CertificateChain &subjs, + const CertificateChain &respChain, const QSslKey &respPKey); + + QByteArray buildResponse(int responseStatus, int certificateStatus) const; + static EvpKey privateKeyToEVP_PKEY(const QSslKey &privateKey); + static CertId certificateToCertId(X509 *subject, X509 *issuer); + static QByteArray responseToDer(OCSP_RESPONSE *response); + + OcspTimeStamp timeStamp; + // Plural, we can send a 'wrong' BasicResponse containing more than + // 1 SingleResponse. + X509Stack subjects; + X509Stack responderChain; + QSslKey responderKey; +}; + +OcspResponder::OcspResponder(const OcspTimeStamp &stamp, const CertificateChain &subjs, + const CertificateChain &respChain, const QSslKey &respPKey) + : timeStamp(stamp), + subjects(subjs), + responderChain(respChain), + responderKey(respPKey) +{ +} + +QByteArray OcspResponder::buildResponse(int responseStatus, int certificateStatus) const +{ + if (responseStatus != OCSP_RESPONSE_STATUS_SUCCESSFUL) { + OCSP_RESPONSE *response = q_OCSP_response_create(responseStatus, nullptr); + if (!response) + return {}; + const OcspResponse rGuard(response, q_OCSP_RESPONSE_free); + return responseToDer(response); + } + + Q_ASSERT(subjects.size() && responderChain.size() && responderKey.handle()); + + const EvpKey nativeKey = privateKeyToEVP_PKEY(responderKey); + if (!nativeKey.data()) + return {}; + + OCSP_BASICRESP *basicResponse = q_OCSP_BASICRESP_new(); + if (!basicResponse) + return {}; + const BasicResponse brGuard(basicResponse, q_OCSP_BASICRESP_free); + + for (int i = 0, e = subjects.size(); i < e; ++i) { + X509 *subject = subjects[i]; + Q_ASSERT(subject); + CertId certId = certificateToCertId(subject, responderChain[0]); + if (!certId.data()) + return {}; + + // NOTE: we do not own this 'singleResponse': + ASN1_TIME *revisionTime = certificateStatus == V_OCSP_CERTSTATUS_REVOKED ? + timeStamp.thisUpdate.data() : nullptr; + + if (!q_OCSP_basic_add1_status(basicResponse, certId.data(), certificateStatus, 0, revisionTime, + timeStamp.thisUpdate.data(), timeStamp.nextUpdate.data())) { + return {}; + } + } + + if (q_OCSP_basic_sign(basicResponse, responderChain[0], nativeKey.data(), q_EVP_sha1(), + responderChain, 0) != 1) { + return {}; + } + + OCSP_RESPONSE *ocspResponse = q_OCSP_response_create(OCSP_RESPONSE_STATUS_SUCCESSFUL, basicResponse); + if (!ocspResponse) + return {}; + const OcspResponse rGuard(ocspResponse, q_OCSP_RESPONSE_free); + return responseToDer(ocspResponse); +} + +EvpKey OcspResponder::privateKeyToEVP_PKEY(const QSslKey &privateKey) +{ + const EvpKey nullKey; + if (privateKey.isNull() || privateKey.algorithm() != QSsl::Rsa) { + // We use only RSA keys in this auto-test, since we test OCSP only, + // not handshake/TLS in general. + return nullKey; + } + + EVP_PKEY *nativeKey = q_EVP_PKEY_new(); + if (!nativeKey) + return nullKey; + + const EvpKey keyGuard(nativeKey, q_EVP_PKEY_free); + if (!q_EVP_PKEY_set1_RSA(nativeKey, reinterpret_cast<RSA *>(privateKey.handle()))) + return nullKey; + + return keyGuard; +} + +CertId OcspResponder::certificateToCertId(X509 *subject, X509 *issuer) +{ + const CertId nullId; + if (!subject || !issuer) + return nullId; + + const EVP_MD *digest = q_EVP_sha1(); + if (!digest) + return nullId; + + OCSP_CERTID *certId = q_OCSP_cert_to_id(digest, subject, issuer); + if (!certId) + return nullId; + + return CertId(certId, q_OCSP_CERTID_free); +} + +QByteArray OcspResponder::responseToDer(OCSP_RESPONSE *response) +{ + if (!response) + return {}; + + const int derSize = q_i2d_OCSP_RESPONSE(response, nullptr); + if (derSize <= 0) + return {}; + + QByteArray derData(derSize, Qt::Uninitialized); + unsigned char *pData = reinterpret_cast<unsigned char *>(derData.data()); + const int serializedSize = q_i2d_OCSP_RESPONSE(response, &pData); + if (serializedSize != derSize) + return {}; + + return derData; +} + +// The QTcpServer capable of sending OCSP status responses. +class OcspServer : public QTcpServer +{ + Q_OBJECT + +public: + OcspServer(const CertificateChain &serverChain, const QSslKey &privateKey); + + void configureResponse(const QByteArray &responseDer); + QString hostName() const; + QString peerVerifyName() const; + +Q_SIGNALS: + void internalServerError(); + +private: + void incomingConnection(qintptr descriptor) override; + +public: + QSslConfiguration serverConfig; + QSslSocket serverSocket; +}; + +OcspServer::OcspServer(const CertificateChain &serverChain, const QSslKey &privateKey) +{ + Q_ASSERT(serverChain.size()); + Q_ASSERT(!privateKey.isNull()); + + serverConfig = QSslConfiguration::defaultConfiguration(); + serverConfig.setLocalCertificateChain(serverChain); + serverConfig.setPrivateKey(privateKey); +} + +void OcspServer::configureResponse(const QByteArray &responseDer) +{ + serverConfig.setBackendConfigurationOption("Qt-OCSP-response", responseDer); +} + +QString OcspServer::hostName() const +{ + // It's 'name' and not 'address' to be consistent with QSslSocket's naming style, + // where it's connectToHostEncrypted(hostName, ...) + const QHostAddress &addr = serverAddress(); + if (addr == QHostAddress::Any || addr == QHostAddress::AnyIPv4) + return QStringLiteral("127.0.0.1"); + if (addr == QHostAddress::AnyIPv6) + return QStringLiteral("::1"); + return addr.toString(); +} + +QString OcspServer::peerVerifyName() const +{ + const CertificateChain &localChain = serverConfig.localCertificateChain(); + if (localChain.isEmpty()) + return {}; + const auto cert = localChain.first(); + if (cert.isNull()) + return {}; + + const QStringList &names = cert.subjectInfo(QSslCertificate::CommonName); + return names.isEmpty() ? QString{} : names.first(); +} + +void OcspServer::incomingConnection(qintptr socketDescriptor) +{ + close(); + + if (!serverSocket.setSocketDescriptor(socketDescriptor)) { + emit internalServerError(); + return; + } + + serverSocket.setSslConfiguration(serverConfig); + // Since we test a client, not a server, we don't care about any + // possible errors on the server (QAbstractSocket or QSslSocket-related). + // Thus, we don't connect to any error signal. + serverSocket.startServerEncryption(); +} + +} // unnamed namespace + +class tst_QOcsp : public QObject +{ + Q_OBJECT + +public slots: + void initTestCase(); + +private slots: + void connectSelfSigned(); + void badStatus_data(); + void badStatus(); + void multipleSingleResponses(); + void malformedResponse(); + void expiredResponse_data(); + void expiredResponse(); + void noNextUpdate(); + void wrongCertificateInResponse_data(); + void wrongCertificateInResponse(); + void untrustedResponder(); + + // OCSPTODO: more tests in future ... + +private: + void setupOcspClient(QSslSocket &clientSocket, const CertificateChain &trustedCAs, + const QString &peerName); + bool containsOcspErrors(const QList<QSslError> &errorsFound) const; + static bool containsError(const QList<QSslError> &errors, QSslError::SslError code); + static QByteArray goodResponse(const CertificateChain &subject, const CertificateChain &responder, + const QSslKey &privateKey, long beforeNow = -1000, long afterNow = 1000); + static bool loadPrivateKey(const QString &keyName, QSslKey &key); + static CertificateChain issuerToChain(const CertificateChain &chain); + static CertificateChain subjectToChain(const CertificateChain &chain); + + static QString certDirPath; + + void (QSslSocket::*socketErrorSignal)(QAbstractSocket::SocketError) = &QAbstractSocket::error; + void (QSslSocket::*tlsErrorsSignal)(const QList<QSslError> &) = &QSslSocket::sslErrors; + void (QTestEventLoop::*exitLoopSlot)() = &QTestEventLoop::exitLoop; + + const int handshakeTimeoutMS = 500; + QTestEventLoop loop; + + std::vector<QSslError::SslError> ocspErrorCodes = {QSslError::OcspNoResponseFound, + QSslError::OcspMalformedRequest, + QSslError::OcspMalformedResponse, + QSslError::OcspInternalError, + QSslError::OcspTryLater, + QSslError::OcspSigRequred, + QSslError::OcspUnauthorized, + QSslError::OcspResponseCannotBeTrusted, + QSslError::OcspResponseCertIdUnknown, + QSslError::OcspResponseExpired, + QSslError::OcspStatusUnknown}; +}; + +#define QCOMPARE_SINGLE_ERROR(sslSocket, expectedError) \ + const auto &tlsErrors = sslSocket.sslErrors(); \ + QCOMPARE(tlsErrors.size(), 1); \ + QCOMPARE(tlsErrors[0].error(), expectedError) + +#define QVERIFY_HANDSHAKE_WITHOUT_ERRORS(sslSocket) \ + QVERIFY(sslSocket.isEncrypted()); \ + QCOMPARE(sslSocket.state(), QAbstractSocket::ConnectedState); \ + QVERIFY(sslSocket.sslErrors().isEmpty()) + +#define QDECLARE_CHAIN(object, chainFileName) \ + CertificateChain object = QSslCertificate::fromPath(certDirPath + QLatin1String(chainFileName)); \ + QVERIFY(object.size()) + +#define QDECLARE_PRIVATE_KEY(key, keyFileName) \ + QSslKey key; \ + QVERIFY(loadPrivateKey(QLatin1String(keyFileName), key)) + +QString tst_QOcsp::certDirPath; + +void tst_QOcsp::initTestCase() +{ + QVERIFY(QSslSocket::supportsSsl()); + + certDirPath = QFileInfo(QFINDTESTDATA("certs")).absolutePath(); + QVERIFY(certDirPath.size() > 0); + certDirPath += QDir::separator() + QStringLiteral("certs") + QDir::separator(); +} + +void tst_QOcsp::connectSelfSigned() +{ + // This test may look a bit confusing, since we have essentially 1 + // self-signed certificate, which we trust for the purpose of this test, + // but we also request its (the certificate's) status and then we sign + // the status response using the same certificate and the corresponding + // private key. Anyway, we test the very basic things here: we send + // an OCSP status request, we verify the response (if server has sent it), + // and detect errors (if any). + QDECLARE_CHAIN(subjectChain, "ss1.crt"); + QDECLARE_CHAIN(responderChain, "ss1.crt"); + QDECLARE_PRIVATE_KEY(privateKey, "ss1-private.key"); + { + // This server ignores our status request: + const QSslError::SslError expectedError = QSslError::OcspNoResponseFound; + + OcspServer server(subjectChain, privateKey); + QVERIFY(server.listen()); + connect(&server, &OcspServer::internalServerError, &loop, exitLoopSlot); + + QSslSocket clientSocket; + QSslConfiguration clientConfig = QSslConfiguration::defaultConfiguration(); + auto roots = clientConfig.caCertificates(); + setupOcspClient(clientSocket, issuerToChain(subjectChain), server.peerVerifyName()); + clientSocket.connectToHostEncrypted(server.hostName(), server.serverPort()); + loop.enterLoopMSecs(handshakeTimeoutMS); + + QVERIFY(!clientSocket.isEncrypted()); + QCOMPARE_SINGLE_ERROR(clientSocket, expectedError); + } + { + // Now the server will send a valid 'status: good' response. + OcspServer server(subjectChain, privateKey); + const QByteArray response(goodResponse(subjectChain, responderChain, privateKey)); + QVERIFY(response.size()); + server.configureResponse(response); + QVERIFY(server.listen()); + + QSslSocket clientSocket; + setupOcspClient(clientSocket, issuerToChain(subjectChain), server.peerVerifyName()); + clientSocket.connectToHostEncrypted(server.hostName(), server.serverPort()); + loop.enterLoopMSecs(handshakeTimeoutMS); + + QVERIFY_HANDSHAKE_WITHOUT_ERRORS(clientSocket); + } +} + +void tst_QOcsp::badStatus_data() +{ + QTest::addColumn<int>("responseStatus"); + QTest::addColumn<int>("certificateStatus"); + QTest::addColumn<QSslError>("expectedError"); + + QTest::addRow("malformed-request") << OCSP_RESPONSE_STATUS_MALFORMEDREQUEST << 1 << QSslError(QSslError::OcspMalformedRequest); + QTest::addRow("internal-error") << OCSP_RESPONSE_STATUS_INTERNALERROR << 2 << QSslError(QSslError::OcspInternalError); + QTest::addRow("try-later") << OCSP_RESPONSE_STATUS_TRYLATER << 3 << QSslError(QSslError::OcspTryLater); + QTest::addRow("signed-request-require") << OCSP_RESPONSE_STATUS_SIGREQUIRED << 2 << QSslError(QSslError::OcspSigRequred); + QTest::addRow("unauthorized-request") << OCSP_RESPONSE_STATUS_UNAUTHORIZED << 1 <<QSslError(QSslError::OcspUnauthorized); + + QTest::addRow("certificate-revoked") << OCSP_RESPONSE_STATUS_SUCCESSFUL << V_OCSP_CERTSTATUS_REVOKED + << QSslError(QSslError::CertificateRevoked); + QTest::addRow("status-unknown") << OCSP_RESPONSE_STATUS_SUCCESSFUL << V_OCSP_CERTSTATUS_UNKNOWN + << QSslError(QSslError::OcspStatusUnknown); +} + +void tst_QOcsp::badStatus() +{ + // This test works with two types of 'bad' responses: + // 1. 'Error messages' (the response's status is anything but SUCCESSFUL, + // no information about the certificate itself, no signature); + // 2. 'REVOKED' or 'UNKNOWN' status for a certificate in question. + QFETCH(const int, responseStatus); + QFETCH(const int, certificateStatus); + QFETCH(const QSslError, expectedError); + + QDECLARE_CHAIN(subjectChain, "infbobchain.crt"); + QCOMPARE(subjectChain.size(), 2); + QDECLARE_CHAIN(responderChain, "ca1.crt"); + QDECLARE_PRIVATE_KEY(subjPrivateKey, "infbob.key"); + QDECLARE_PRIVATE_KEY(respPrivateKey, "ca1.key"); + + OcspServer server(subjectChain, subjPrivateKey); + const OcspTimeStamp stamp(-1000, 1000); + OcspResponder builder(stamp, subjectToChain(subjectChain), responderChain, respPrivateKey); + const QByteArray response(builder.buildResponse(responseStatus, certificateStatus)); + QVERIFY(response.size()); + server.configureResponse(response); + QVERIFY(server.listen()); + connect(&server, &OcspServer::internalServerError, &loop, exitLoopSlot); + + QSslSocket clientSocket; + setupOcspClient(clientSocket, issuerToChain(subjectChain), server.peerVerifyName()); + clientSocket.connectToHostEncrypted(server.hostName(), server.serverPort()); + loop.enterLoopMSecs(handshakeTimeoutMS); + + QVERIFY(!clientSocket.isEncrypted()); + QCOMPARE_SINGLE_ERROR(clientSocket, expectedError.error()); +} + +void tst_QOcsp::multipleSingleResponses() +{ + // We handle a response with more than one SingleResponse as malformed: + const QSslError::SslError expectedError = QSslError::OcspMalformedResponse; + + // Here we use subjectChain only to generate a response, the server + // is configured with the responder chain (it's the same cert after all). + QDECLARE_CHAIN(subjectChain, "ss1.crt"); + QDECLARE_CHAIN(responderChain, "ss1.crt"); + QDECLARE_PRIVATE_KEY(privateKey, "ss1-private.key"); + + // Let's have more than 1 certificate in a chain: + subjectChain.append(subjectChain[0]); + + OcspServer server(responderChain, privateKey); + // Generate a BasicOCSPResponse containing 2 SingleResponses: + const QByteArray response(goodResponse(subjectChain, responderChain, privateKey)); + QVERIFY(response.size()); + server.configureResponse(response); + QVERIFY(server.listen()); + connect(&server, &OcspServer::internalServerError, &loop, exitLoopSlot); + + QSslSocket clientSocket; + setupOcspClient(clientSocket, issuerToChain(responderChain), server.peerVerifyName()); + clientSocket.connectToHostEncrypted(server.hostName(), server.serverPort()); + loop.enterLoopMSecs(handshakeTimeoutMS); + + QVERIFY(!clientSocket.isEncrypted()); + QCOMPARE_SINGLE_ERROR(clientSocket, expectedError); +} + +void tst_QOcsp::malformedResponse() +{ + QDECLARE_CHAIN(serverChain, "ss1.crt"); + QDECLARE_PRIVATE_KEY(privateKey, "ss1-private.key"); + + OcspServer server(serverChain, privateKey); + // Let's send some arbitrary bytes instead of DER and see what happens next: + server.configureResponse("Sure, you can trust me, this cert was not revoked (I don't say it was issued at all)!"); + QVERIFY(server.listen()); + connect(&server, &OcspServer::internalServerError, &loop, exitLoopSlot); + + QSslSocket clientSocket; + setupOcspClient(clientSocket, issuerToChain(serverChain), server.peerVerifyName()); + clientSocket.connectToHostEncrypted(server.hostName(), server.serverPort()); + loop.enterLoopMSecs(handshakeTimeoutMS); + + QVERIFY(!clientSocket.isEncrypted()); + QCOMPARE(clientSocket.error(), QAbstractSocket::SslHandshakeFailedError); +} + +void tst_QOcsp::expiredResponse_data() +{ + QTest::addColumn<long>("beforeNow"); + QTest::addColumn<long>("afterNow"); + + QTest::addRow("expired") << -2000L << -1000L; + QTest::addRow("not-valid-yet") << 5000L << 10000L; + QTest::addRow("next-before-this") << -1000L << -2000L; +} + +void tst_QOcsp::expiredResponse() +{ + // We report different kinds of problems with [thisUpdate, nextUpdate] + // as 'expired' (to keep it simple): + const QSslError::SslError expectedError = QSslError::OcspResponseExpired; + + QFETCH(const long, beforeNow); + QFETCH(const long, afterNow); + + QDECLARE_CHAIN(subjectChain, "ss1.crt"); + QDECLARE_CHAIN(responderChain, "ss1.crt"); + QDECLARE_PRIVATE_KEY(privateKey, "ss1-private.key"); + + OcspServer server(subjectChain, privateKey); + const QByteArray response(goodResponse(subjectChain, responderChain, privateKey, beforeNow, afterNow)); + QVERIFY(response.size()); + server.configureResponse(response); + QVERIFY(server.listen()); + connect(&server, &OcspServer::internalServerError, &loop, exitLoopSlot); + + QSslSocket clientSocket; + setupOcspClient(clientSocket, issuerToChain(subjectChain), server.peerVerifyName()); + clientSocket.connectToHostEncrypted(server.hostName(), server.serverPort()); + loop.enterLoopMSecs(handshakeTimeoutMS); + + QVERIFY(!clientSocket.isEncrypted()); + QCOMPARE_SINGLE_ERROR(clientSocket, expectedError); +} + +void tst_QOcsp::noNextUpdate() +{ + // RFC2560, 2.4: + // "If nextUpdate is not set, the responder is indicating that newer + // revocation information is available all the time." + // + // This test is just to verify that we correctly handle such responses. + QDECLARE_CHAIN(subjectChain, "ss1.crt"); + QDECLARE_CHAIN(responderChain, "ss1.crt"); + QDECLARE_PRIVATE_KEY(privateKey, "ss1-private.key"); + + OcspServer server(subjectChain, privateKey); + OcspTimeStamp openRange(-1000, 0); + openRange.nextUpdate.clear(); + const OcspResponder responder(openRange, subjectChain, responderChain, privateKey); + const QByteArray response(responder.buildResponse(OCSP_RESPONSE_STATUS_SUCCESSFUL, + V_OCSP_CERTSTATUS_GOOD)); + QVERIFY(response.size()); + server.configureResponse(response); + QVERIFY(server.listen()); + connect(&server, &OcspServer::internalServerError, &loop, exitLoopSlot); + + QSslSocket clientSocket; + setupOcspClient(clientSocket, issuerToChain(subjectChain), server.peerVerifyName()); + clientSocket.connectToHostEncrypted(server.hostName(), server.serverPort()); + loop.enterLoopMSecs(handshakeTimeoutMS); + + QVERIFY_HANDSHAKE_WITHOUT_ERRORS(clientSocket); +} + +void tst_QOcsp::wrongCertificateInResponse_data() +{ + QTest::addColumn<QLatin1String>("respChainName"); + QTest::addColumn<QLatin1String>("respKeyName"); + QTest::addColumn<QLatin1String>("wrongChainName"); + + QTest::addRow("same-CA-wrong-subject") << QLatin1String("ca1.crt") << QLatin1String("ca1.key") + << QLatin1String("alice.crt"); + QTest::addRow("wrong-CA-same-subject") << QLatin1String("ss1.crt") << QLatin1String("ss1-private.key") + << QLatin1String("alice.crt"); + QTest::addRow("wrong-CA-wrong-subject") << QLatin1String("ss1.crt") << QLatin1String("ss1-private.key") + << QLatin1String("ss1.crt"); +} + +void tst_QOcsp::wrongCertificateInResponse() +{ + QFETCH(const QLatin1String, respChainName); + QFETCH(const QLatin1String, respKeyName); + QFETCH(const QLatin1String, wrongChainName); + // In this test, the server will send a valid response (correctly signed + // by a trusted key/cert) but for a wrong certificate (not the one the + // server presented to the client in the server's 'Certificate' message). + const QSslError::SslError expectedError = QSslError::OcspResponseCertIdUnknown; + + QDECLARE_CHAIN(subjectChain, "infbobchain.crt"); + QDECLARE_PRIVATE_KEY(subjectKey, "infbob.key"); + QDECLARE_CHAIN(responderChain, respChainName); + QDECLARE_PRIVATE_KEY(responderKey, respKeyName); + + QDECLARE_CHAIN(wrongChain, wrongChainName); + + OcspServer server(subjectToChain(subjectChain), subjectKey); + const QByteArray wrongResponse(goodResponse(wrongChain, responderChain, responderKey)); + QVERIFY(wrongResponse.size()); + server.configureResponse(wrongResponse); + QVERIFY(server.listen()); + connect(&server, &OcspServer::internalServerError, &loop, exitLoopSlot); + + QSslSocket clientSocket; + setupOcspClient(clientSocket, issuerToChain(subjectChain), server.peerVerifyName()); + clientSocket.connectToHostEncrypted(server.hostName(), server.serverPort()); + loop.enterLoopMSecs(handshakeTimeoutMS); + + QVERIFY(!clientSocket.isEncrypted()); + QVERIFY(containsError(clientSocket.sslErrors(), expectedError)); +} + +void tst_QOcsp::untrustedResponder() +{ + const QSslError::SslError expectedError = QSslError::OcspResponseCannotBeTrusted; + + QDECLARE_CHAIN(subjectChain, "infbobchain.crt"); + QDECLARE_PRIVATE_KEY(subjectKey, "infbob.key"); + QDECLARE_CHAIN(responderChain, "ca1.crt"); + QDECLARE_PRIVATE_KEY(responderKey, "ca1.key"); + + OcspServer server(subjectChain, subjectKey); + const QByteArray response(goodResponse(subjectToChain(subjectChain), responderChain, responderKey)); + QVERIFY(response.size()); + server.configureResponse(response); + QVERIFY(server.listen()); + connect(&server, &OcspServer::internalServerError, &loop, exitLoopSlot); + + QSslSocket clientSocket; + setupOcspClient(clientSocket, {}, server.peerVerifyName()); + clientSocket.connectToHostEncrypted(server.hostName(), server.serverPort()); + loop.enterLoopMSecs(handshakeTimeoutMS); + + QVERIFY(!clientSocket.isEncrypted()); + QVERIFY(containsError(clientSocket.sslErrors(), expectedError)); +} + +void tst_QOcsp::setupOcspClient(QSslSocket &clientSocket, const CertificateChain &caCerts, const QString &name) +{ + QSslConfiguration clientConfig = QSslConfiguration::defaultConfiguration(); + clientConfig.setOcspStaplingEnabled(true); + + if (caCerts.size()) { + auto roots = clientConfig.caCertificates(); + roots.append(caCerts); + clientConfig.setCaCertificates(roots); + } + + clientSocket.setSslConfiguration(clientConfig); + clientSocket.setPeerVerifyName(name); + + connect(&clientSocket, socketErrorSignal, &loop, exitLoopSlot); + connect(&clientSocket, tlsErrorsSignal, &loop, exitLoopSlot); + connect(&clientSocket, &QSslSocket::encrypted, &loop, exitLoopSlot); +} + +bool tst_QOcsp::containsOcspErrors(const QList<QSslError> &errorsFound) const +{ + for (auto code : ocspErrorCodes) { + if (containsError(errorsFound, code)) + return true; + } + return false; +} + +bool tst_QOcsp::containsError(const QList<QSslError> &errors, QSslError::SslError code) +{ + const auto it = std::find_if(errors.begin(), errors.end(), + [&code](const QSslError &other){return other.error() == code;}); + return it != errors.end(); +} + +QByteArray tst_QOcsp::goodResponse(const CertificateChain &subject, const CertificateChain &responder, + const QSslKey &privateKey, long beforeNow, long afterNow) +{ + const OcspResponder builder(OcspTimeStamp(beforeNow, afterNow), subject, responder, privateKey); + return builder.buildResponse(OCSP_RESPONSE_STATUS_SUCCESSFUL, V_OCSP_CERTSTATUS_GOOD); +} + +bool tst_QOcsp::loadPrivateKey(const QString &keyFileName, QSslKey &key) +{ + QFile keyFile(certDirPath + keyFileName); + if (!keyFile.open(QIODevice::ReadOnly)) + return false; + key = QSslKey(keyFile.readAll(), QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey); + return !key.isNull(); +} + +CertificateChain tst_QOcsp::issuerToChain(const CertificateChain &chain) +{ + // Here we presume that, if the chain isn't a single self-signed certificate, its second + // entry is the issuer. + const int length = chain.size(); + Q_ASSERT(length > 0); + return CertificateChain() << chain[length > 1 ? 1 : 0]; +} + +CertificateChain tst_QOcsp::subjectToChain(const CertificateChain &chain) +{ + Q_ASSERT(chain.size()); + return CertificateChain() << chain[0]; +} + +QT_END_NAMESPACE + +QTEST_MAIN(tst_QOcsp) + +#include "tst_qocsp.moc" diff --git a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp index 7f8580ddd6..88be13f41d 100644 --- a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp @@ -814,7 +814,7 @@ void tst_QSslCertificate::task256066toPem() void tst_QSslCertificate::nulInCN() { -#if defined(QT_SECURETRANSPORT) || defined(Q_OS_WINRT) +#if defined(QT_SECURETRANSPORT) || defined(Q_OS_WINRT) || QT_CONFIG(schannel) QSKIP("Generic QSslCertificatePrivate fails this test"); #endif QList<QSslCertificate> certList = @@ -833,7 +833,7 @@ void tst_QSslCertificate::nulInCN() void tst_QSslCertificate::nulInSan() { -#if defined(QT_SECURETRANSPORT) || defined(Q_OS_WINRT) +#if defined(QT_SECURETRANSPORT) || defined(Q_OS_WINRT) || QT_CONFIG(schannel) QSKIP("Generic QSslCertificatePrivate fails this test"); #endif QList<QSslCertificate> certList = diff --git a/tests/auto/network/ssl/qsslkey/keys/dh-pri-1024.der b/tests/auto/network/ssl/qsslkey/keys/dh-pri-1024.der Binary files differnew file mode 100644 index 0000000000..687009e087 --- /dev/null +++ b/tests/auto/network/ssl/qsslkey/keys/dh-pri-1024.der diff --git a/tests/auto/network/ssl/qsslkey/keys/dh-pri-1024.pem b/tests/auto/network/ssl/qsslkey/keys/dh-pri-1024.pem new file mode 100644 index 0000000000..233e0dfb37 --- /dev/null +++ b/tests/auto/network/ssl/qsslkey/keys/dh-pri-1024.pem @@ -0,0 +1,9 @@ +-----BEGIN PRIVATE KEY----- +MIIBIQIBADCBlQYJKoZIhvcNAQMBMIGHAoGBAIlk2YX0TJzfQ18ZzZroQoE5Nyjt +bWxWRxBriG/c+JWhBwttVDb6lzLN+GVJxXVPfc6JJmDORVRxdxAlMqu++2Vqpsnl +/H8xIXsxjuTcTjq8sXagGRa0LfeggkUD64tEhO4iZ8Q2TIdb3OHkAF0Sn+06b/0e +iIz323Kywq0CsspTAgECBIGDAoGAQCo39UHP4s2ZVH4nOmWgNlb4JsHPX4EzqDBr +ig46hvMLAFrILYnsCbqqD/+GNAUl1PV/nfEQoAk/HvtACqLFLG5/3jK2w6dVHGEo +JnVOGz9vZpWUx+SCslHJRFaeE+6AAbbvrTr0lci29Ta4IesHlamRsj+ZaUrVX6k/ +/9OTGAo= +-----END PRIVATE KEY----- diff --git a/tests/auto/network/ssl/qsslkey/keys/dh-pri-2048.der b/tests/auto/network/ssl/qsslkey/keys/dh-pri-2048.der Binary files differnew file mode 100644 index 0000000000..e193f25f07 --- /dev/null +++ b/tests/auto/network/ssl/qsslkey/keys/dh-pri-2048.der diff --git a/tests/auto/network/ssl/qsslkey/keys/dh-pri-2048.pem b/tests/auto/network/ssl/qsslkey/keys/dh-pri-2048.pem new file mode 100644 index 0000000000..32299b2b6c --- /dev/null +++ b/tests/auto/network/ssl/qsslkey/keys/dh-pri-2048.pem @@ -0,0 +1,14 @@ +-----BEGIN PRIVATE KEY----- +MIICJgIBADCCARcGCSqGSIb3DQEDATCCAQgCggEBAJsiReJxBjkC7Hy99AJATusq +YsNQHhjoeTLPeHhsBuLtJK18Krk736V09efX6qeAEmvgMQbvbHqtrOaY3q6dut6C +UTGVW+oVg3d/Y8qakkanvEnIlliaTIyWIz0JMjO2prC6AuU/QEzZcQVUS6bxyn3D +iYFxCE6+7cJJpEH9HVbcrl+J6Ch6ax5rQGUyxpSMkmItLJx92upRxOnaxJMHR+ZF +OSdDPfrkINpEzahnhteLszddyLasnE0or6ZnXYLvKsT1Uu6QwDc4EO1FJHScoeep +zsK/VRcXzMpj/1Rl+F9E/AikCqHRrnvISt25wrK0Mwy854P2T7dJlBNewc6vE6MC +AQIEggEEAoIBAGIctO30MoZ9DiuKbOBpqM9rl2bNH/I46GGcfEiSsO/zOw2V9WFC +MxkjF0I1ilDfPY+Ag3bLB2n89DPcfXliYH9MFolehPTc1fWplhX3+ImdC6y95uXO +FV5xtcEQCbPktnUtkUdcAT5831p9lu1QJo+DzMPrQa7axMLj8heBAi4VqAi+8Q31 +dpGKuhCUlgs+pLENx1o0QY2kui6Z5uR0YhmA547lwBWA4XEv5OV9ExmxytiatvOv +PZKT1ID76LrL9bnnZvOEGczWLQvJ9VaaZSpoP+2QisRANWW4w57d+PIR1WR/FTSH +F6xocElUoTzuiSPzRz60aw/KkisImBBKERQ= +-----END PRIVATE KEY----- diff --git a/tests/auto/network/ssl/qsslkey/keys/dh-pri-512.der b/tests/auto/network/ssl/qsslkey/keys/dh-pri-512.der Binary files differnew file mode 100644 index 0000000000..42ddbaaae2 --- /dev/null +++ b/tests/auto/network/ssl/qsslkey/keys/dh-pri-512.der diff --git a/tests/auto/network/ssl/qsslkey/keys/dh-pri-512.pem b/tests/auto/network/ssl/qsslkey/keys/dh-pri-512.pem new file mode 100644 index 0000000000..d2c3170b16 --- /dev/null +++ b/tests/auto/network/ssl/qsslkey/keys/dh-pri-512.pem @@ -0,0 +1,6 @@ +-----BEGIN PRIVATE KEY----- +MIGcAgEAMFMGCSqGSIb3DQEDATBGAkEAvXx0QxJvIGA2ig8Je55R2rmeO4Ta2Esj +ANLuyVIFRbtuLFsdhU+amUc8bs9RUQmkUNzS92jkpAfqtCv+mQ06EwIBAgRCAkBJ +rDM0BTevOPIHpJzMtSQhw3e7Dr38HUfTn8zF3uYi1RCxjkTUukmzRLPTf0aqPgpd +8dSldjG/11aZORl8/mXO +-----END PRIVATE KEY----- diff --git a/tests/auto/network/ssl/qsslkey/keys/dh-pub-1024.der b/tests/auto/network/ssl/qsslkey/keys/dh-pub-1024.der Binary files differnew file mode 100644 index 0000000000..2805a67633 --- /dev/null +++ b/tests/auto/network/ssl/qsslkey/keys/dh-pub-1024.der diff --git a/tests/auto/network/ssl/qsslkey/keys/dh-pub-1024.pem b/tests/auto/network/ssl/qsslkey/keys/dh-pub-1024.pem new file mode 100644 index 0000000000..da4e327ac9 --- /dev/null +++ b/tests/auto/network/ssl/qsslkey/keys/dh-pub-1024.pem @@ -0,0 +1,9 @@ +-----BEGIN PUBLIC KEY----- +MIIBHzCBlQYJKoZIhvcNAQMBMIGHAoGBAIlk2YX0TJzfQ18ZzZroQoE5NyjtbWxW +RxBriG/c+JWhBwttVDb6lzLN+GVJxXVPfc6JJmDORVRxdxAlMqu++2Vqpsnl/H8x +IXsxjuTcTjq8sXagGRa0LfeggkUD64tEhO4iZ8Q2TIdb3OHkAF0Sn+06b/0eiIz3 +23Kywq0CsspTAgECA4GEAAKBgA8pxU1sMDvRWKpvJKNs3jNhZPQWFf4Tszu/cMcb +1qAQ/q0DRb41VvsUoMaCfef/plZleV4MG26owb574AJeC86wX5MbRDTPS4CzAn+I +an92AZl3vlYRQ2sSo3ktkyhw6LV1iewi08Ky7J4rqvG0Oo335QGEZlK1OgwBsyh0 +FKLe +-----END PUBLIC KEY----- diff --git a/tests/auto/network/ssl/qsslkey/keys/dh-pub-2048.der b/tests/auto/network/ssl/qsslkey/keys/dh-pub-2048.der Binary files differnew file mode 100644 index 0000000000..9e749d8a41 --- /dev/null +++ b/tests/auto/network/ssl/qsslkey/keys/dh-pub-2048.der diff --git a/tests/auto/network/ssl/qsslkey/keys/dh-pub-2048.pem b/tests/auto/network/ssl/qsslkey/keys/dh-pub-2048.pem new file mode 100644 index 0000000000..f751157c87 --- /dev/null +++ b/tests/auto/network/ssl/qsslkey/keys/dh-pub-2048.pem @@ -0,0 +1,14 @@ +-----BEGIN PUBLIC KEY----- +MIICJDCCARcGCSqGSIb3DQEDATCCAQgCggEBAJsiReJxBjkC7Hy99AJATusqYsNQ +HhjoeTLPeHhsBuLtJK18Krk736V09efX6qeAEmvgMQbvbHqtrOaY3q6dut6CUTGV +W+oVg3d/Y8qakkanvEnIlliaTIyWIz0JMjO2prC6AuU/QEzZcQVUS6bxyn3DiYFx +CE6+7cJJpEH9HVbcrl+J6Ch6ax5rQGUyxpSMkmItLJx92upRxOnaxJMHR+ZFOSdD +PfrkINpEzahnhteLszddyLasnE0or6ZnXYLvKsT1Uu6QwDc4EO1FJHScoeepzsK/ +VRcXzMpj/1Rl+F9E/AikCqHRrnvISt25wrK0Mwy854P2T7dJlBNewc6vE6MCAQID +ggEFAAKCAQAUeWRuqjl7F84USogxJOM1M4y8yKtBYY2KLs5iIVhzV4UZ+9+cMNZA +otLXJ/e8BH0diR0yk7tjxD6hjjqd+nyafIkJGPElDMnTbRPHg5zZYMmI5L/efdSm +OPbM7QsodrYH5aoF4c7hjMb/cttYVG2Yupsy4tfORuDbwL70upqOo6rkVq55eOGS +6pseEume/SD+7e3xIPJTkrMMzBFHG6H7bVHikT4O7yWV1iVzElj919yi+4Zy6TK8 +0hG6l31D5bsJpOduhHYZtN1yQpw+sGT6Yiepkjgt+1YkGFiiRs5vDl4DHeYHyAhL +oH9uKcm3q4lhaOeT5ml765g87qQD6+vr +-----END PUBLIC KEY----- diff --git a/tests/auto/network/ssl/qsslkey/keys/dh-pub-512.der b/tests/auto/network/ssl/qsslkey/keys/dh-pub-512.der Binary files differnew file mode 100644 index 0000000000..8a75babb6d --- /dev/null +++ b/tests/auto/network/ssl/qsslkey/keys/dh-pub-512.der diff --git a/tests/auto/network/ssl/qsslkey/keys/dh-pub-512.pem b/tests/auto/network/ssl/qsslkey/keys/dh-pub-512.pem new file mode 100644 index 0000000000..1f4e5c9a47 --- /dev/null +++ b/tests/auto/network/ssl/qsslkey/keys/dh-pub-512.pem @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MIGaMFMGCSqGSIb3DQEDATBGAkEAvXx0QxJvIGA2ig8Je55R2rmeO4Ta2EsjANLu +yVIFRbtuLFsdhU+amUc8bs9RUQmkUNzS92jkpAfqtCv+mQ06EwIBAgNDAAJARGBh +9FmRRZZAxBtXZmS8wIgDwWvjB63GQ+E1pDLtZPztvPQ2eqUjTgSuGKV5cDankAV1 +Pkj/IA0Xl+SuFhLLew== +-----END PUBLIC KEY----- diff --git a/tests/auto/network/ssl/qsslkey/keys/genkeys.sh b/tests/auto/network/ssl/qsslkey/keys/genkeys.sh index 6210b42ab4..0106953bff 100755 --- a/tests/auto/network/ssl/qsslkey/keys/genkeys.sh +++ b/tests/auto/network/ssl/qsslkey/keys/genkeys.sh @@ -88,6 +88,27 @@ do openssl ec -in ec-pri-$size-$curve.pem -pubout -out ec-pub-$size-$curve.der -outform DER done +#--- DH ---------------------------------------------------------------------------- +for size in 512 1024 2048 +do + echo -e "\ngenerating DH parameters to PEM file ..." + openssl dhparam -out dhpar-$size.pem $size + + echo -e "\ngenerating DH private key to PEM file ..." + openssl genpkey -paramfile dhpar-$size.pem -out dh-pri-$size.pem + + /bin/rm dhpar-$size.pem + + echo -e "\ngenerating DH private key to DER file ..." + openssl pkey -in dh-pri-$size.pem -out dh-pri-$size.der -outform DER + + echo -e "\ngenerating DH public key to PEM file ..." + openssl pkey -in dh-pri-$size.pem -pubout -out dh-pub-$size.pem + + echo -e "\ngenerating DH public key to DER file ..." + openssl pkey -in dh-pri-$size.pem -pubout -out dh-pub-$size.der -outform DER +done + #--- PKCS#8 ------------------------------------------------------------------------ # Note: We'll just grab some of the keys generated earlier and convert those # https://www.openssl.org/docs/manmaster/man1/pkcs8.html#PKCS-5-v1.5-and-PKCS-12-algorithms diff --git a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp index ddfe52c5e4..28476fce5b 100644 --- a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp +++ b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp @@ -63,7 +63,7 @@ class tst_QSslKey : public QObject QList<KeyInfo> keyInfoList; - void createPlainTestRows(bool filter = false, QSsl::EncodingFormat format = QSsl::EncodingFormat::Pem); + void createPlainTestRows(bool pemOnly = false); public slots: void initTestCase(); @@ -111,13 +111,14 @@ void tst_QSslKey::initTestCase() QDir dir(testDataDir + "keys"); const QFileInfoList fileInfoList = dir.entryInfoList(QDir::Files | QDir::Readable); - QRegExp rx(QLatin1String("^(rsa|dsa|ec)-(pub|pri)-(\\d+)-?[\\w-]*\\.(pem|der)$")); + QRegExp rx(QLatin1String("^(rsa|dsa|dh|ec)-(pub|pri)-(\\d+)-?[\\w-]*\\.(pem|der)$")); for (const QFileInfo &fileInfo : fileInfoList) { if (rx.indexIn(fileInfo.fileName()) >= 0) { keyInfoList << KeyInfo( fileInfo, rx.cap(1) == QLatin1String("rsa") ? QSsl::Rsa : - (rx.cap(1) == QLatin1String("dsa") ? QSsl::Dsa : QSsl::Ec), + rx.cap(1) == QLatin1String("dsa") ? QSsl::Dsa : + rx.cap(1) == QLatin1String("dh") ? QSsl::Dh : QSsl::Ec, rx.cap(2) == QLatin1String("pub") ? QSsl::PublicKey : QSsl::PrivateKey, rx.cap(3).toInt(), rx.cap(4) == QLatin1String("pem") ? QSsl::Pem : QSsl::Der); @@ -154,7 +155,7 @@ Q_DECLARE_METATYPE(QSsl::KeyAlgorithm) Q_DECLARE_METATYPE(QSsl::KeyType) Q_DECLARE_METATYPE(QSsl::EncodingFormat) -void tst_QSslKey::createPlainTestRows(bool filter, QSsl::EncodingFormat format) +void tst_QSslKey::createPlainTestRows(bool pemOnly) { QTest::addColumn<QString>("absFilePath"); QTest::addColumn<QSsl::KeyAlgorithm>("algorithm"); @@ -162,11 +163,11 @@ void tst_QSslKey::createPlainTestRows(bool filter, QSsl::EncodingFormat format) QTest::addColumn<int>("length"); QTest::addColumn<QSsl::EncodingFormat>("format"); foreach (KeyInfo keyInfo, keyInfoList) { - if (filter && keyInfo.format != format) + if (pemOnly && keyInfo.format != QSsl::EncodingFormat::Pem) continue; -#ifdef Q_OS_WINRT +#if defined(Q_OS_WINRT) || QT_CONFIG(schannel) if (keyInfo.fileInfo.fileName().contains("RC2-64")) - continue; // WinRT treats RC2 as 128 bit + continue; // WinRT/Schannel treats RC2 as 128 bit #endif #if !defined(QT_NO_SSL) && defined(QT_NO_OPENSSL) // generic backend if (keyInfo.fileInfo.fileName().contains(QRegularExpression("-aes\\d\\d\\d-"))) @@ -598,11 +599,11 @@ void tst_QSslKey::encrypt() QFETCH(QByteArray, cipherText); QByteArray iv("abcdefgh"); -#ifdef Q_OS_WINRT - QEXPECT_FAIL("RC2-40-CBC, length 0", "WinRT treats RC2 as 128-bit", Abort); - QEXPECT_FAIL("RC2-40-CBC, length 8", "WinRT treats RC2 as 128-bit", Abort); - QEXPECT_FAIL("RC2-64-CBC, length 0", "WinRT treats RC2 as 128-bit", Abort); - QEXPECT_FAIL("RC2-64-CBC, length 8", "WinRT treats RC2 as 128-bit", Abort); +#if defined(Q_OS_WINRT) || QT_CONFIG(schannel) + QEXPECT_FAIL("RC2-40-CBC, length 0", "WinRT/Schannel treats RC2 as 128-bit", Abort); + QEXPECT_FAIL("RC2-40-CBC, length 8", "WinRT/Schannel treats RC2 as 128-bit", Abort); + QEXPECT_FAIL("RC2-64-CBC, length 0", "WinRT/Schannel treats RC2 as 128-bit", Abort); + QEXPECT_FAIL("RC2-64-CBC, length 8", "WinRT/Schannel treats RC2 as 128-bit", Abort); #endif QByteArray encrypted = QSslKeyPrivate::encrypt(cipher, plainText, key, iv); QCOMPARE(encrypted, cipherText); diff --git a/tests/auto/network/ssl/qsslsocket/certs/127-0-0-1-as-CN.crt b/tests/auto/network/ssl/qsslsocket/certs/127-0-0-1-as-CN.crt new file mode 100644 index 0000000000..2253469392 --- /dev/null +++ b/tests/auto/network/ssl/qsslsocket/certs/127-0-0-1-as-CN.crt @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIC/jCCAeagAwIBAgIJALBykhTMGxyEMA0GCSqGSIb3DQEBCwUAMBQxEjAQBgNV +BAMMCTEyNy4wLjAuMTAeFw0xOTAxMjUyMjU5NDFaFw0xOTAyMjQyMjU5NDFaMBQx +EjAQBgNVBAMMCTEyNy4wLjAuMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC +ggEBALMEo10Xd6e5ot4Rg99VejDV/WNdAhY6+2Ilzuc+1XdzDpEQCuqWY2hAGX9m +QXyFSR+UcpJWoUFUtJLsArXgRnxT+seHuemrLZGZOkDStUhKNpxfwOmhIT+sLocw +qXCwNf9oG4//3evGwGqJhLDpGUhTNVCAMaalb1yrcXskYEkWdelzCTMzoirVvbS2 +6PH3kE+WPaBehMFruLtp+v7btnVIA305DwFy4CLq+HHFq59BbxRWxhRSkfXM8w+d +g05P3VNpEb8Apn4rQ+n/xRz7oZs0Aou4GZG5JAgiLOibbVBK+xnD/UW/txeFWfRZ +1dzIi4yAKkdwIhPAg+pP1G6tgZMCAwEAAaNTMFEwHQYDVR0OBBYEFNGZZgb9dbVY +FKkkoQp/oAQ2/B51MB8GA1UdIwQYMBaAFNGZZgb9dbVYFKkkoQp/oAQ2/B51MA8G +A1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAFvHy0RE96TDw6Q2pfCY +aMz/X8dMAEMz5XqC7ImcztVg6VTRHpiw+QFQGqCLwNNuwkD9/pZ3IgVzSbRQw3oW +HO7wD30NFl17LQMONBdcmR9FO5ruBh8G0Q1tmeKNtuwjzF3LAkj/J3tAn6eVmHi5 +75WEK/vQgy9XElN6EC6TgC/4B5/DPdZuEMdL7AP8ADLq9UVf8JC9c4QjU9G1Ce2R +PzNwkhkLvtLlcxFcXciuc+oGhLENoJ2ZYHctT/ReOuBoRWEwIB1AeCWxitxjBZ6t +lmZ+UewuzJ7y1X5maQZr7w3o8f6DwqwYrmMd45tS6jkHHAJlaCs/yCfVnLBwZ1l4 +NeM= +-----END CERTIFICATE----- diff --git a/tests/auto/network/ssl/qsslsocket/certs/subjectAltNameIP.crt b/tests/auto/network/ssl/qsslsocket/certs/subjectAltNameIP.crt new file mode 100644 index 0000000000..1377fbbabb --- /dev/null +++ b/tests/auto/network/ssl/qsslsocket/certs/subjectAltNameIP.crt @@ -0,0 +1,20 @@ +-----BEGIN CERTIFICATE----- +MIIDMDCCAhigAwIBAgIURWaTvdnvU+Y+gPSONs61cMCH8JUwDQYJKoZIhvcNAQEL +BQAwFjEUMBIGA1UEAwwLZXhhbXBsZS5vcmcwHhcNMTkwMTA4MTExMDMxWhcNMTkw +MjA3MTExMDMxWjAWMRQwEgYDVQQDDAtleGFtcGxlLm9yZzCCASIwDQYJKoZIhvcN +AQEBBQADggEPADCCAQoCggEBALf0qv9vl8RqvDHpEWfjum7DMrY8qrQnD77C/9f/ +Jl0Jo4UZiSBr1OYYVbiWJyodw8LpQQsKE+fQCo2STb5X9BldJpwpQvvVi6ygxdzN +erJnB15G7xhUkGzDI2xhIJw3e6NGqf1PMB4CTNna6eN2cKYAxPfsWo5Pyh1YtU4s +5h+B3+43ol32ccBiRo4YXagbYMELjspEf0AvObvMWSxZQoBHcJ5JGEApxcgvFu8i +FBSALVy1IrYE3gXAv8TB0AK7IpuNIL48v5JXCA6JOGYbXFljj6aLFTzfrV3lzhQ0 +kqBVnQNqVfOUQNUhNT93bnEWVf911j/af5zuFtmr1kbMzucCAwEAAaN2MHQwHQYD +VR0OBBYEFHZOtGQHV3roaj3nlQ1XRU0O+05TMB8GA1UdIwQYMBaAFHZOtGQHV3ro +aj3nlQ1XRU0O+05TMA8GA1UdEwEB/wQFMAMBAf8wIQYDVR0RBBowGIcEwAUIEIcQ +/oAAAAAAAAA8KS+h3UQHZTANBgkqhkiG9w0BAQsFAAOCAQEAcvqvtUSJ2JM3rrWj +XjCOhosKY/cow4oDAVdn8AvI/Z4FJfcQZ1vA+ZM533/TaJStG4ThfjyX9t1Ej08M +UzP4ZUyXJTv8o6C6j5e9ggEwo/cFp1iWP+xr2SXLJ2cabnu8db5FN5J75HjNsuVs +PM95LYY9VlTm9W7JxMwkPEIG+wH5zu6Hj45UAAamwwjOKT1hJYumxdmLAp1oyG1p +u86b8iVUjiHG+K6qr4hAKXhuSXE1s/pYqcn1feyk2SbkKvGFR6ad+gmdT4ZaiNYT +nL8+t2wim/fRkV0CNdWrrJpWtLzjPq1al7g2eIopdLufSlqanouVpnzwuKGN5QC/ +MuDohA== +-----END CERTIFICATE----- diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index bca142e245..1c27901844 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -74,6 +74,16 @@ typedef QSharedPointer<QSslSocket> QSslSocketPtr; #endif #endif // QT_NO_SSL +// Detect ALPN (Application-Layer Protocol Negotiation) support +#undef ALPN_SUPPORTED // Undef the variable first to be safe +#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_TLSEXT) +#define ALPN_SUPPORTED 1 +#endif + +#if QT_CONFIG(schannel) && !defined(Q_CC_MINGW) +#define ALPN_SUPPORTED 1 +#endif + #if defined Q_OS_HPUX && defined Q_CC_GNU // This error is delivered every time we try to use the fluke CA // certificate. For now we work around this bug. Task 202317. @@ -233,18 +243,22 @@ private slots: void verifyClientCertificate(); void readBufferMaxSize(); + void allowedProtocolNegotiation(); + #ifndef QT_NO_OPENSSL void simplePskConnect_data(); void simplePskConnect(); void ephemeralServerKey_data(); void ephemeralServerKey(); - void allowedProtocolNegotiation(); void pskServer(); void forwardReadChannelFinished(); void signatureAlgorithm_data(); void signatureAlgorithm(); #endif + void disabledProtocols_data(); + void disabledProtocols(); + void setEmptyDefaultConfiguration(); // this test should be last protected slots: @@ -638,6 +652,10 @@ void tst_QSslSocket::sslErrors() QFETCH(int, port); QSslSocketPtr socket = newSocket(); +#if QT_CONFIG(schannel) + // Needs to be < 1.2 because of the old certificate and <= 1.0 because of the mail server + socket->setProtocol(QSsl::SslProtocol::TlsV1_0); +#endif QSignalSpy sslErrorsSpy(socket.data(), SIGNAL(sslErrors(QList<QSslError>))); QSignalSpy peerVerifyErrorSpy(socket.data(), SIGNAL(peerVerifyError(QSslError))); @@ -717,6 +735,9 @@ void tst_QSslSocket::connectToHostEncrypted() return; QSslSocketPtr socket = newSocket(); +#if QT_CONFIG(schannel) // old certificate not supported with TLS 1.2 + socket->setProtocol(QSsl::SslProtocol::TlsV1_1); +#endif this->socket = socket.data(); QVERIFY(socket->addCaCertificates(testDataDir + "certs/qt-test-server-cacert.pem")); #ifdef QSSLSOCKET_CERTUNTRUSTED_WORKAROUND @@ -750,6 +771,9 @@ void tst_QSslSocket::connectToHostEncryptedWithVerificationPeerName() return; QSslSocketPtr socket = newSocket(); +#if QT_CONFIG(schannel) // old certificate not supported with TLS 1.2 + socket->setProtocol(QSsl::SslProtocol::TlsV1_1); +#endif this->socket = socket.data(); socket->addCaCertificates(testDataDir + "certs/qt-test-server-cacert.pem"); @@ -952,24 +976,6 @@ void tst_QSslSocket::protocol() QCOMPARE(socket->protocol(), QSsl::SecureProtocols); QFETCH_GLOBAL(bool, setProxy); { - // qt-test-server allows SSLv3. - socket->setProtocol(QSsl::SslV3); - QCOMPARE(socket->protocol(), QSsl::SslV3); - socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); - if (setProxy && !socket->waitForEncrypted()) - QSKIP("Skipping flaky test - See QTBUG-29941"); - QCOMPARE(socket->protocol(), QSsl::SslV3); - socket->abort(); - QCOMPARE(socket->protocol(), QSsl::SslV3); - socket->connectToHost(QtNetworkSettings::serverName(), 443); - QVERIFY2(socket->waitForConnected(), qPrintable(socket->errorString())); - socket->startClientEncryption(); - if (setProxy && !socket->waitForEncrypted()) - QSKIP("Skipping flaky test - See QTBUG-29941"); - QCOMPARE(socket->protocol(), QSsl::SslV3); - socket->abort(); - } - { // qt-test-server allows TLSV1. socket->setProtocol(QSsl::TlsV1_0); QCOMPARE(socket->protocol(), QSsl::TlsV1_0); @@ -1045,26 +1051,6 @@ void tst_QSslSocket::protocol() socket->abort(); } #endif // TLS1_3_VERSION -#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) - { - // qt-test-server allows SSLV2. - socket->setProtocol(QSsl::SslV2); - QCOMPARE(socket->protocol(), QSsl::SslV2); - socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); - if (setProxy && !socket->waitForEncrypted()) - QSKIP("Skipping flaky test - See QTBUG-29941"); - QCOMPARE(socket->protocol(), QSsl::SslV2); - socket->abort(); - QCOMPARE(socket->protocol(), QSsl::SslV2); - socket->connectToHost(QtNetworkSettings::serverName(), 443); - if (setProxy && !socket->waitForConnected()) - QSKIP("Skipping flaky test - See QTBUG-29941"); - socket->startClientEncryption(); - if (setProxy && !socket->waitForEncrypted()) - QSKIP("Skipping flaky test - See QTBUG-29941"); - socket->abort(); - } -#endif { // qt-test-server allows SSLV3, so it allows AnyProtocol. socket->setProtocol(QSsl::AnyProtocol); @@ -1084,7 +1070,7 @@ void tst_QSslSocket::protocol() socket->abort(); } { - // qt-test-server allows SSLV3, so it allows NoSslV2 + // qt-test-server allows TlsV1, so it allows TlsV1SslV3 socket->setProtocol(QSsl::TlsV1SslV3); QCOMPARE(socket->protocol(), QSsl::TlsV1SslV3); socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); @@ -1207,120 +1193,38 @@ void tst_QSslSocket::protocolServerSide_data() QTest::addColumn<QSsl::SslProtocol>("clientProtocol"); QTest::addColumn<bool>("works"); -#if QT_CONFIG(opensslv11) -#if !defined(OPENSSL_NO_SSL2) - // OpenSSL 1.1 has removed SSL2 support. But there is no OPENSSL_NO_SSL2 macro ... -#define OPENSSL_NO_SSL2 -#endif // OPENSSL_NO_SSL2 -#endif // opensslv11 - -#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) - QTest::newRow("ssl2-ssl2") << QSsl::SslV2 << QSsl::SslV2 << false; // no idea why it does not work, but we don't care about SSL 2 -#endif -#if !defined(OPENSSL_NO_SSL3) - QTest::newRow("ssl3-ssl3") << QSsl::SslV3 << QSsl::SslV3 << true; -#endif QTest::newRow("tls1.0-tls1.0") << QSsl::TlsV1_0 << QSsl::TlsV1_0 << true; QTest::newRow("tls1ssl3-tls1ssl3") << QSsl::TlsV1SslV3 << QSsl::TlsV1SslV3 << true; QTest::newRow("any-any") << QSsl::AnyProtocol << QSsl::AnyProtocol << true; QTest::newRow("secure-secure") << QSsl::SecureProtocols << QSsl::SecureProtocols << true; -#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) - QTest::newRow("ssl2-ssl3") << QSsl::SslV2 << QSsl::SslV3 << false; - QTest::newRow("ssl2-tls1.0") << QSsl::SslV2 << QSsl::TlsV1_0 << false; - QTest::newRow("ssl2-tls1ssl3") << QSsl::SslV2 << QSsl::TlsV1SslV3 << false; - QTest::newRow("ssl2-secure") << QSsl::SslV2 << QSsl::SecureProtocols << false; - QTest::newRow("ssl2-any") << QSsl::SslV2 << QSsl::AnyProtocol << false; // no idea why it does not work, but we don't care about SSL 2 -#endif - -#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) && !defined(OPENSSL_NO_SSL3) - QTest::newRow("ssl3-ssl2") << QSsl::SslV3 << QSsl::SslV2 << false; -#endif -#if !defined(OPENSSL_NO_SSL3) - QTest::newRow("ssl3-tls1.0") << QSsl::SslV3 << QSsl::TlsV1_0 << false; - QTest::newRow("ssl3-tls1ssl3") << QSsl::SslV3 << QSsl::TlsV1SslV3 << true; - QTest::newRow("ssl3-secure") << QSsl::SslV3 << QSsl::SecureProtocols << false; -#endif -#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) && !defined(OPENSSL_NO_SSL3) - QTest::newRow("ssl3-any") << QSsl::SslV3 << QSsl::AnyProtocol << false; // we won't set a SNI header here because we connect to a - // numerical IP, so OpenSSL will send a SSL 2 handshake -#elif !defined(OPENSSL_NO_SSL3) - QTest::newRow("ssl3-any") << QSsl::SslV3 << QSsl::AnyProtocol << true; -#endif - -#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) - QTest::newRow("tls1.0-ssl2") << QSsl::TlsV1_0 << QSsl::SslV2 << false; -#endif -#if !defined(OPENSSL_NO_SSL3) - QTest::newRow("tls1.0-ssl3") << QSsl::TlsV1_0 << QSsl::SslV3 << false; -#endif QTest::newRow("tls1-tls1ssl3") << QSsl::TlsV1_0 << QSsl::TlsV1SslV3 << true; QTest::newRow("tls1.0-secure") << QSsl::TlsV1_0 << QSsl::SecureProtocols << true; -#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) - QTest::newRow("tls1.0-any") << QSsl::TlsV1_0 << QSsl::AnyProtocol << false; // we won't set a SNI header here because we connect to a - // numerical IP, so OpenSSL will send a SSL 2 handshake -#else QTest::newRow("tls1.0-any") << QSsl::TlsV1_0 << QSsl::AnyProtocol << true; -#endif -#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) - QTest::newRow("tls1ssl3-ssl2") << QSsl::TlsV1SslV3 << QSsl::SslV2 << false; -#endif -#if !defined(OPENSSL_NO_SSL3) - QTest::newRow("tls1ssl3-ssl3") << QSsl::TlsV1SslV3 << QSsl::SslV3 << true; -#endif QTest::newRow("tls1ssl3-tls1.0") << QSsl::TlsV1SslV3 << QSsl::TlsV1_0 << true; QTest::newRow("tls1ssl3-secure") << QSsl::TlsV1SslV3 << QSsl::SecureProtocols << true; QTest::newRow("tls1ssl3-any") << QSsl::TlsV1SslV3 << QSsl::AnyProtocol << true; -#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) - QTest::newRow("secure-ssl2") << QSsl::SecureProtocols << QSsl::SslV2 << false; -#endif -#if !defined(OPENSSL_NO_SSL3) - QTest::newRow("secure-ssl3") << QSsl::SecureProtocols << QSsl::SslV3 << false; -#endif QTest::newRow("secure-tls1.0") << QSsl::SecureProtocols << QSsl::TlsV1_0 << true; QTest::newRow("secure-tls1ssl3") << QSsl::SecureProtocols << QSsl::TlsV1SslV3 << true; QTest::newRow("secure-any") << QSsl::SecureProtocols << QSsl::AnyProtocol << true; -#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) - QTest::newRow("any-ssl2") << QSsl::AnyProtocol << QSsl::SslV2 << false; // no idea why it does not work, but we don't care about SSL 2 -#endif -#if !defined(OPENSSL_NO_SSL3) - QTest::newRow("any-ssl3") << QSsl::AnyProtocol << QSsl::SslV3 << true; -#endif - -#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) - QTest::newRow("tls1.0orlater-ssl2") << QSsl::TlsV1_0OrLater << QSsl::SslV2 << false; -#endif -#if !defined(OPENSSL_NO_SSL3) - QTest::newRow("tls1.0orlater-ssl3") << QSsl::TlsV1_0OrLater << QSsl::SslV3 << false; -#endif QTest::newRow("tls1.0orlater-tls1.0") << QSsl::TlsV1_0OrLater << QSsl::TlsV1_0 << true; QTest::newRow("tls1.0orlater-tls1.1") << QSsl::TlsV1_0OrLater << QSsl::TlsV1_1 << true; QTest::newRow("tls1.0orlater-tls1.2") << QSsl::TlsV1_0OrLater << QSsl::TlsV1_2 << true; #ifdef TLS1_3_VERSION QTest::newRow("tls1.0orlater-tls1.3") << QSsl::TlsV1_0OrLater << QSsl::TlsV1_3 << true; #endif -#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) - QTest::newRow("tls1.1orlater-ssl2") << QSsl::TlsV1_1OrLater << QSsl::SslV2 << false; -#endif -#if !defined(OPENSSL_NO_SSL3) - QTest::newRow("tls1.1orlater-ssl3") << QSsl::TlsV1_1OrLater << QSsl::SslV3 << false; -#endif QTest::newRow("tls1.1orlater-tls1.0") << QSsl::TlsV1_1OrLater << QSsl::TlsV1_0 << false; QTest::newRow("tls1.1orlater-tls1.1") << QSsl::TlsV1_1OrLater << QSsl::TlsV1_1 << true; QTest::newRow("tls1.1orlater-tls1.2") << QSsl::TlsV1_1OrLater << QSsl::TlsV1_2 << true; + #ifdef TLS1_3_VERSION QTest::newRow("tls1.1orlater-tls1.3") << QSsl::TlsV1_1OrLater << QSsl::TlsV1_3 << true; #endif -#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) - QTest::newRow("tls1.2orlater-ssl2") << QSsl::TlsV1_2OrLater << QSsl::SslV2 << false; -#endif -#if !defined(OPENSSL_NO_SSL3) - QTest::newRow("tls1.2orlater-ssl3") << QSsl::TlsV1_2OrLater << QSsl::SslV3 << false; -#endif + QTest::newRow("tls1.2orlater-tls1.0") << QSsl::TlsV1_2OrLater << QSsl::TlsV1_0 << false; QTest::newRow("tls1.2orlater-tls1.1") << QSsl::TlsV1_2OrLater << QSsl::TlsV1_1 << false; QTest::newRow("tls1.2orlater-tls1.2") << QSsl::TlsV1_2OrLater << QSsl::TlsV1_2 << true; @@ -1328,12 +1232,6 @@ void tst_QSslSocket::protocolServerSide_data() QTest::newRow("tls1.2orlater-tls1.3") << QSsl::TlsV1_2OrLater << QSsl::TlsV1_3 << true; #endif #ifdef TLS1_3_VERSION -#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) - QTest::newRow("tls1.3orlater-ssl2") << QSsl::TlsV1_3OrLater << QSsl::SslV2 << false; -#endif -#if !defined(OPENSSL_NO_SSL3) - QTest::newRow("tls1.3orlater-ssl3") << QSsl::TlsV1_3OrLater << QSsl::SslV3 << false; -#endif QTest::newRow("tls1.3orlater-tls1.0") << QSsl::TlsV1_3OrLater << QSsl::TlsV1_0 << false; QTest::newRow("tls1.3orlater-tls1.1") << QSsl::TlsV1_3OrLater << QSsl::TlsV1_1 << false; QTest::newRow("tls1.3orlater-tls1.2") << QSsl::TlsV1_3OrLater << QSsl::TlsV1_2 << false; @@ -1389,10 +1287,10 @@ void tst_QSslSocket::protocolServerSide() if (server.socket) QVERIFY(server.socket->error() == QAbstractSocket::UnknownSocketError); - QCOMPARE(int(client.state()), int(expectedState)); + QCOMPARE(client.state(), expectedState); } else if (server.socket->error() != QAbstractSocket::UnknownSocketError) { QVERIFY(client.error() == QAbstractSocket::UnknownSocketError); - QCOMPARE(int(server.socket->state()), int(expectedState)); + QCOMPARE(server.socket->state(), expectedState); } QCOMPARE(client.isEncrypted(), works); @@ -1536,6 +1434,11 @@ void tst_QSslSocket::setLocalCertificateChain() loop.exec(); QList<QSslCertificate> chain = socket->peerCertificateChain(); +#if QT_CONFIG(schannel) + QEXPECT_FAIL("", "Schannel cannot send intermediate certificates not " + "located in a system certificate store", + Abort); +#endif QCOMPARE(chain.size(), 2); QCOMPARE(chain[0].serialNumber(), QByteArray("10:a0:ad:77:58:f6:6e:ae:46:93:a3:43:f9:59:8a:9e")); QCOMPARE(chain[1].serialNumber(), QByteArray("3b:eb:99:c5:ea:d8:0b:5d:0b:97:5d:4f:06:75:4b:e1")); @@ -1603,6 +1506,9 @@ void tst_QSslSocket::setSslConfiguration() QSslSocketPtr socket = newSocket(); QFETCH(QSslConfiguration, configuration); socket->setSslConfiguration(configuration); +#if QT_CONFIG(schannel) // old certificate not supported with TLS 1.2 + socket->setProtocol(QSsl::SslProtocol::TlsV1_1); +#endif this->socket = socket.data(); socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); QFETCH(bool, works); @@ -1815,6 +1721,25 @@ void tst_QSslSocket::isMatchingHostname() QCOMPARE(QSslSocketPrivate::isMatchingHostname(cert, QString::fromUtf8("foo.foo.xn--schufele-2za.de")), false); QCOMPARE(QSslSocketPrivate::isMatchingHostname(cert, QString::fromUtf8("www.schaufele.de")), false); QCOMPARE(QSslSocketPrivate::isMatchingHostname(cert, QString::fromUtf8("www.schufele.de")), false); + + /* Generated with the following command (only valid with openssl >= 1.1.1 due to "-addext"): + openssl req -x509 -nodes -subj "/CN=example.org" \ + -addext "subjectAltName = IP:192.5.8.16, IP:fe80::3c29:2fa1:dd44:765" \ + -newkey rsa:2048 -keyout /dev/null -out subjectAltNameIP.crt + */ + certs = QSslCertificate::fromPath(testDataDir + "certs/subjectAltNameIP.crt"); + QVERIFY(!certs.isEmpty()); + cert = certs.first(); + QCOMPARE(QSslSocketPrivate::isMatchingHostname(cert, QString::fromUtf8("192.5.8.16")), true); + QCOMPARE(QSslSocketPrivate::isMatchingHostname(cert, QString::fromUtf8("fe80::3c29:2fa1:dd44:765")), true); + + /* openssl req -x509 -nodes -new -newkey rsa -keyout /dev/null -out 127-0-0-1-as-CN.crt \ + -subj "/CN=127.0.0.1" + */ + certs = QSslCertificate::fromPath(testDataDir + "certs/127-0-0-1-as-CN.crt"); + QVERIFY(!certs.isEmpty()); + cert = certs.first(); + QCOMPARE(QSslSocketPrivate::isMatchingHostname(cert, QString::fromUtf8("127.0.0.1")), true); } void tst_QSslSocket::wildcard() @@ -2297,6 +2222,9 @@ void tst_QSslSocket::verifyMode() return; QSslSocket socket; +#if QT_CONFIG(schannel) // old certificate not supported with TLS 1.2 + socket.setProtocol(QSsl::SslProtocol::TlsV1_1); +#endif QCOMPARE(socket.peerVerifyMode(), QSslSocket::AutoVerifyPeer); socket.setPeerVerifyMode(QSslSocket::VerifyNone); QCOMPARE(socket.peerVerifyMode(), QSslSocket::VerifyNone); @@ -2597,6 +2525,9 @@ void tst_QSslSocket::abortOnSslErrors() void tst_QSslSocket::readFromClosedSocket() { QSslSocketPtr socket = newSocket(); +#if QT_CONFIG(schannel) // old certificate not supported with TLS 1.2 + socket->setProtocol(QSsl::SslProtocol::TlsV1_1); +#endif socket->ignoreSslErrors(); socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); socket->ignoreSslErrors(); @@ -3316,10 +3247,10 @@ void tst_QSslSocket::verifyClientCertificate_data() validCerts += QSslCertificate::fromPath(testDataDir + "certs/bogus-ca.crt"); QCOMPARE(validCerts.size(), 2); - QTest::newRow("ValidClientCert:AutoVerifyPeer") << QSslSocket::AutoVerifyPeer << validCerts << validKey << true; - QTest::newRow("ValidClientCert:QueryPeer") << QSslSocket::QueryPeer << validCerts << validKey << true; - QTest::newRow("ValidClientCert:VerifyNone") << QSslSocket::VerifyNone << validCerts << validKey << true; - QTest::newRow("ValidClientCert:VerifyPeer") << QSslSocket::VerifyPeer << validCerts << validKey << true; + QTest::newRow("ValidChainedClientCert:AutoVerifyPeer") << QSslSocket::AutoVerifyPeer << validCerts << validKey << true; + QTest::newRow("ValidChainedClientCert:QueryPeer") << QSslSocket::QueryPeer << validCerts << validKey << true; + QTest::newRow("ValidChainedClientCert:VerifyNone") << QSslSocket::VerifyNone << validCerts << validKey << true; + QTest::newRow("ValidChainedClientCert:VerifyPeer") << QSslSocket::VerifyPeer << validCerts << validKey << true; } void tst_QSslSocket::verifyClientCertificate() @@ -3345,6 +3276,11 @@ void tst_QSslSocket::verifyClientCertificate() return; QFETCH(QSslSocket::PeerVerifyMode, peerVerifyMode); +#if QT_CONFIG(schannel) + if (peerVerifyMode == QSslSocket::QueryPeer || peerVerifyMode == QSslSocket::AutoVerifyPeer) + QSKIP("Schannel doesn't tackle requesting a certificate and not receiving one."); +#endif + SslServer server; server.addCaCertificates = testDataDir + "certs/bogus-ca.crt"; server.ignoreSslErrors = false; @@ -3375,7 +3311,15 @@ void tst_QSslSocket::verifyClientCertificate() // check server socket QVERIFY(server.socket); - QCOMPARE(int(server.socket->state()), int(expectedState)); +#if QT_CONFIG(schannel) + // As additional info to the QEXPECT_FAIL below: + // This is because schannel treats it as an error (client side) if you don't have a certificate + // when asked for one. + QEXPECT_FAIL("NoCert:VerifyPeer", + "The client disconnects first, which causes the event " + "loop to quit before the server disconnects.", Continue); +#endif + QCOMPARE(server.socket->state(), expectedState); QCOMPARE(server.socket->isEncrypted(), works); if (peerVerifyMode == QSslSocket::VerifyNone || clientCerts.isEmpty()) { @@ -3383,17 +3327,24 @@ void tst_QSslSocket::verifyClientCertificate() QVERIFY(server.socket->peerCertificateChain().isEmpty()); } else { QCOMPARE(server.socket->peerCertificate(), clientCerts.first()); +#if QT_CONFIG(schannel) + if (clientCerts.count() == 1 && server.socket->peerCertificateChain().count() == 2) { + QEXPECT_FAIL("", + "Schannel includes the entire chain, not just the leaf and intermediates", + Continue); + } +#endif QCOMPARE(server.socket->peerCertificateChain(), clientCerts); } // check client socket - QCOMPARE(int(client.state()), int(expectedState)); + QCOMPARE(client.state(), expectedState); QCOMPARE(client.isEncrypted(), works); } void tst_QSslSocket::readBufferMaxSize() { -#ifdef QT_SECURETRANSPORT +#if defined(QT_SECURETRANSPORT) || QT_CONFIG(schannel) // QTBUG-55170: // SecureTransport back-end was ignoring read-buffer // size limit, resulting (potentially) in a constantly @@ -3473,6 +3424,51 @@ void tst_QSslSocket::setEmptyDefaultConfiguration() // this test should be last, QSKIP("Skipping flaky test - See QTBUG-29941"); } +void tst_QSslSocket::allowedProtocolNegotiation() +{ +#ifndef ALPN_SUPPORTED + QSKIP("ALPN is unsupported, skipping test"); +#endif + +#if QT_CONFIG(schannel) + if (QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows8_1) + QSKIP("ALPN is not supported on this version of Windows using Schannel."); +#endif + + QFETCH_GLOBAL(bool, setProxy); + if (setProxy) + return; + + + const QByteArray expectedNegotiated("cool-protocol"); + QList<QByteArray> serverProtos; + serverProtos << expectedNegotiated << "not-so-cool-protocol"; + QList<QByteArray> clientProtos; + clientProtos << "uber-cool-protocol" << expectedNegotiated << "not-so-cool-protocol"; + + + SslServer server; + server.config.setAllowedNextProtocols(serverProtos); + QVERIFY(server.listen()); + + QSslSocket clientSocket; + auto configuration = clientSocket.sslConfiguration(); + configuration.setAllowedNextProtocols(clientProtos); + clientSocket.setSslConfiguration(configuration); + + clientSocket.connectToHostEncrypted("127.0.0.1", server.serverPort()); + clientSocket.ignoreSslErrors(); + + QEventLoop loop; + QTimer::singleShot(5000, &loop, SLOT(quit())); + connect(&clientSocket, SIGNAL(encrypted()), &loop, SLOT(quit())); + loop.exec(); + + QVERIFY(server.socket->sslConfiguration().nextNegotiatedProtocol() == + clientSocket.sslConfiguration().nextNegotiatedProtocol()); + QVERIFY(server.socket->sslConfiguration().nextNegotiatedProtocol() == expectedNegotiated); +} + #ifndef QT_NO_OPENSSL class PskProvider : public QObject { @@ -3886,50 +3882,14 @@ void tst_QSslSocket::ephemeralServerKey() QCOMPARE(client->sslConfiguration().ephemeralServerKey().isNull(), emptyKey); } -void tst_QSslSocket::allowedProtocolNegotiation() -{ -#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_TLSEXT) - - QFETCH_GLOBAL(bool, setProxy); - if (setProxy) - return; - - const QByteArray expectedNegotiated("cool-protocol"); - QList<QByteArray> serverProtos; - serverProtos << expectedNegotiated << "not-so-cool-protocol"; - QList<QByteArray> clientProtos; - clientProtos << "uber-cool-protocol" << expectedNegotiated << "not-so-cool-protocol"; - - - SslServer server; - server.config.setAllowedNextProtocols(serverProtos); - QVERIFY(server.listen()); - - QSslSocket clientSocket; - auto configuration = clientSocket.sslConfiguration(); - configuration.setAllowedNextProtocols(clientProtos); - clientSocket.setSslConfiguration(configuration); - - clientSocket.connectToHostEncrypted("127.0.0.1", server.serverPort()); - clientSocket.ignoreSslErrors(); - - QEventLoop loop; - QTimer::singleShot(5000, &loop, SLOT(quit())); - connect(&clientSocket, SIGNAL(encrypted()), &loop, SLOT(quit())); - loop.exec(); - - QVERIFY(server.socket->sslConfiguration().nextNegotiatedProtocol() == - clientSocket.sslConfiguration().nextNegotiatedProtocol()); - QVERIFY(server.socket->sslConfiguration().nextNegotiatedProtocol() == expectedNegotiated); - -#endif // OPENSSL_VERSION_NUMBER -} - void tst_QSslSocket::pskServer() { #ifdef Q_OS_WINRT QSKIP("Server-side encryption is not implemented on WinRT."); #endif +#if QT_CONFIG(schannel) + QSKIP("Schannel does not have PSK support implemented."); +#endif QFETCH_GLOBAL(bool, setProxy); if (!QSslSocket::supportsSsl() || setProxy) return; @@ -4174,6 +4134,74 @@ void tst_QSslSocket::forwardReadChannelFinished() #endif // QT_NO_OPENSSL +void tst_QSslSocket::disabledProtocols_data() +{ + QTest::addColumn<QSsl::SslProtocol>("disabledProtocol"); + QTest::newRow("SslV2") << QSsl::SslV2; + QTest::newRow("SslV3") << QSsl::SslV3; +} + +void tst_QSslSocket::disabledProtocols() +{ + QFETCH_GLOBAL(const bool, setProxy); + if (setProxy) + return; + + QFETCH(const QSsl::SslProtocol, disabledProtocol); + const int timeoutMS = 500; + // Test a client socket. + { + // 0. connectToHostEncrypted: client-side, non-blocking API, error is discovered + // early, preventing any real connection from ever starting. + QSslSocket socket; + socket.setProtocol(disabledProtocol); + QCOMPARE(socket.error(), QAbstractSocket::UnknownSocketError); + socket.connectToHostEncrypted(QStringLiteral("doesnotmatter.org"), 1010); + QCOMPARE(socket.error(), QAbstractSocket::SslInvalidUserDataError); + QCOMPARE(socket.state(), QAbstractSocket::UnconnectedState); + } + { + // 1. startClientEncryption: client-side, non blocking API, but wants a socket in + // the 'connected' state (otherwise just returns false not setting any error code). + SslServer server; + QVERIFY(server.listen()); + + QSslSocket socket; + QCOMPARE(socket.error(), QAbstractSocket::UnknownSocketError); + + socket.connectToHost(QHostAddress::LocalHost, server.serverPort()); + QVERIFY(socket.waitForConnected(timeoutMS)); + + socket.setProtocol(disabledProtocol); + socket.startClientEncryption(); + QCOMPARE(socket.error(), QAbstractSocket::SslInvalidUserDataError); + } + { + // 2. waitForEncrypted: client-side, blocking API plus requires from us + // to call ... connectToHostEncrypted(), which will notice an error and + // will prevent any connect at all. Nothing to test. + } + + // Test a server side, relatively simple: server does not connect, it listens/accepts + // and then calls startServerEncryption() (which must fall). + { + SslServer server; + server.protocol = disabledProtocol; + QVERIFY(server.listen()); + + QTestEventLoop loop; + connect(&server, &SslServer::socketError, [&loop](QAbstractSocket::SocketError) + {loop.exitLoop();}); + + QTcpSocket client; + client.connectToHost(QHostAddress::LocalHost, server.serverPort()); + loop.enterLoopMSecs(timeoutMS); + QVERIFY(!loop.timeout()); + QVERIFY(server.socket); + QCOMPARE(server.socket->error(), QAbstractSocket::SslInvalidUserDataError); + } +} + #endif // QT_NO_SSL QTEST_MAIN(tst_QSslSocket) diff --git a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/BLACKLIST b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/BLACKLIST deleted file mode 100644 index c9b628d79b..0000000000 --- a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[onDemandRootCertLoadingMemberMethods] -linux diff --git a/tests/auto/network/ssl/ssl.pro b/tests/auto/network/ssl/ssl.pro index e89443ef4e..169e9bce83 100644 --- a/tests/auto/network/ssl/ssl.pro +++ b/tests/auto/network/ssl/ssl.pro @@ -21,6 +21,8 @@ qtConfig(ssl) { qdtlscookie \ qdtls } + + qtConfig(ocsp): SUBDIRS += qocsp } } diff --git a/tests/auto/other/gestures/BLACKLIST b/tests/auto/other/gestures/BLACKLIST index 269bac5750..c465ff316e 100644 --- a/tests/auto/other/gestures/BLACKLIST +++ b/tests/auto/other/gestures/BLACKLIST @@ -1,5 +1,6 @@ [] rhel-7.4 +rhel-7.6 ubuntu-18.04 [customGesture] # QTBUG-67254 diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp index 8aa3a035e3..8a2934049e 100644 --- a/tests/auto/other/lancelot/paintcommands.cpp +++ b/tests/auto/other/lancelot/paintcommands.cpp @@ -1200,7 +1200,10 @@ void PaintCommands::command_drawRoundRect(QRegularExpressionMatch re) if (m_verboseMode) printf(" -(lance) drawRoundRect(%d, %d, %d, %d, [%d, %d])\n", x, y, w, h, xs, ys); + QT_WARNING_PUSH + QT_WARNING_DISABLE_DEPRECATED m_painter->drawRoundRect(x, y, w, h, xs, ys); + QT_WARNING_POP } /***************************************************************************************************/ diff --git a/tests/auto/other/other.pro b/tests/auto/other/other.pro index 25ab62a1c3..c5426202e8 100644 --- a/tests/auto/other/other.pro +++ b/tests/auto/other/other.pro @@ -67,3 +67,8 @@ winrt|!qtHaveModule(gui)|!qtConfig(accessibility): SUBDIRS -= qaccessibility android: SUBDIRS += \ android + +qtConfig(xkbcommon): { + SUBDIRS += \ + xkbkeyboard +} diff --git a/tests/auto/other/xkbkeyboard/tst_xkbkeyboard.cpp b/tests/auto/other/xkbkeyboard/tst_xkbkeyboard.cpp new file mode 100644 index 0000000000..65364eddf4 --- /dev/null +++ b/tests/auto/other/xkbkeyboard/tst_xkbkeyboard.cpp @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtCore> +#include <QtGui> +#include <QtTest> + +#include <qpa/qplatforminputcontextfactory_p.h> +#include <qpa/qplatforminputcontext.h> + +class tst_XkbKeyboard : public QObject +{ + Q_OBJECT +private slots: + void verifyComposeInputContextInterface(); +}; + +void tst_XkbKeyboard::verifyComposeInputContextInterface() +{ + QPlatformInputContext *inputContext = QPlatformInputContextFactory::create(QStringLiteral("compose")); + QVERIFY(inputContext); + + const char *const inputContextClassName = "QComposeInputContext"; + const char *const normalizedSignature = "setXkbContext(xkb_context*)"; + + QVERIFY(inputContext->objectName() == QLatin1String(inputContextClassName)); + + int methodIndex = inputContext->metaObject()->indexOfMethod(normalizedSignature); + QMetaMethod method = inputContext->metaObject()->method(methodIndex); + Q_ASSERT(method.isValid()); +} + +QTEST_MAIN(tst_XkbKeyboard) +#include "tst_xkbkeyboard.moc" + diff --git a/tests/auto/other/xkbkeyboard/xkbkeyboard.pro b/tests/auto/other/xkbkeyboard/xkbkeyboard.pro new file mode 100644 index 0000000000..17396ee475 --- /dev/null +++ b/tests/auto/other/xkbkeyboard/xkbkeyboard.pro @@ -0,0 +1,7 @@ +CONFIG += testcase +TARGET = tst_xkbkeyboard + +SOURCES += tst_xkbkeyboard.cpp + +QT = core-private gui-private testlib + diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h index 97397e3159..55875359ff 100644 --- a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h +++ b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h @@ -79,14 +79,14 @@ inline QString fixupTableName(const QString &tableName, QSqlDatabase db) return tbName; } -inline static QString qTableName(const QString& prefix, const char *sourceFileName, QSqlDatabase db) +inline static QString qTableName(const QString &prefix, const char *sourceFileName, + QSqlDatabase db, bool escape = true) { - QString tableStr = QLatin1String("dbtst"); - if (db.driverName().toLower().contains("ODBC")) - tableStr += QLatin1String("_odbc"); - return fixupTableName(QString(QLatin1String("dbtst") + db.driverName() + - QString::number(qHash(QLatin1String(sourceFileName) + - "_" + qGetHostName().replace( "-", "_" )), 16) + "_" + prefix), db); + const auto tableStr = fixupTableName(QString(QLatin1String("dbtst") + db.driverName() + + QString::number(qHash(QLatin1String(sourceFileName) + + "_" + qGetHostName().replace("-", "_")), 16) + + "_" + prefix), db); + return escape ? db.driver()->escapeIdentifier(tableStr, QSqlDriver::TableName) : tableStr; } inline static QString qTableName(const QString& prefix, QSqlDatabase db) diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp index af6b6ca881..f309231b10 100644 --- a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp @@ -199,6 +199,9 @@ private slots: void sqlite_openError(); + void sqlite_check_json1_data() { generic_data("QSQLITE"); } + void sqlite_check_json1(); + private: void createTestTables(QSqlDatabase db); void dropTestTables(QSqlDatabase db); @@ -311,10 +314,8 @@ void tst_QSqlDatabase::createTestTables(QSqlDatabase db) " (id integer not null, t_varchar varchar(40) not null, " "t_char char(40), t_numeric numeric(6, 3), primary key (id, t_varchar))")); } - if (testWhiteSpaceNames(db.driverName())) { - QString qry = "create table " - + db.driver()->escapeIdentifier(tableName + " test", QSqlDriver::TableName) + QString qry = "create table " + qTableName("qtest test", __FILE__, db) + '(' + db.driver()->escapeIdentifier(QLatin1String("test test"), QSqlDriver::FieldName) + " int not null primary key)"; @@ -338,6 +339,7 @@ void tst_QSqlDatabase::dropTestTables(QSqlDatabase db) const QString qtestTable = qTableName("qtest", __FILE__, db); QStringList tableNames; tableNames << qtestTable + << qTableName("qtest test", __FILE__, db) << qTableName("qtestfields", __FILE__, db) << qTableName("qtestalter", __FILE__, db) << qTableName("qtest_temp", __FILE__, db) @@ -510,7 +512,9 @@ void tst_QSqlDatabase::tables() CHECK_DATABASE(db); QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db); - const QString qtest(qTableName("qtest", __FILE__, db)), qtest_view(qTableName("qtest_view", __FILE__, db)), temp_tab(qTableName("test_tab", __FILE__, db)); + const auto qtest(qTableName("qtest", __FILE__, db, false)), + qtest_view(qTableName("qtest_view", __FILE__, db, false)), + temp_tab(qTableName("test_tab", __FILE__, db, false)); bool views = true; bool tempTables = false; @@ -575,10 +579,10 @@ void tst_QSqlDatabase::whitespaceInIdentifiers() const QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db); if (testWhiteSpaceNames(db.driverName())) { - const QString tableName(qTableName("qtest", __FILE__, db) + " test"); + const auto tableName(qTableName("qtest test", __FILE__, db, false)); QVERIFY(db.tables().contains(tableName, Qt::CaseInsensitive)); - QSqlRecord rec = db.record(db.driver()->escapeIdentifier(tableName, QSqlDriver::TableName)); + QSqlRecord rec = db.record(tableName); QCOMPARE(rec.count(), 1); QCOMPARE(rec.fieldName(0), QString("test test")); if (dbType == QSqlDriver::Oracle) @@ -586,7 +590,7 @@ void tst_QSqlDatabase::whitespaceInIdentifiers() else QCOMPARE(rec.field(0).type(), QVariant::Int); - QSqlIndex idx = db.primaryIndex(db.driver()->escapeIdentifier(tableName, QSqlDriver::TableName)); + QSqlIndex idx = db.primaryIndex(tableName); QCOMPARE(idx.count(), 1); QCOMPARE(idx.fieldName(0), QString("test test")); if (dbType == QSqlDriver::Oracle) @@ -604,11 +608,12 @@ void tst_QSqlDatabase::alterTable() QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); const QString qtestalter(qTableName("qtestalter", __FILE__, db)); + const auto noEscapeAlterTable = qTableName("qtestalter", __FILE__, db, false); QSqlQuery q(db); QVERIFY_SQL(q, exec("create table " + qtestalter + " (F1 char(20), F2 char(20), F3 char(20))")); - QSqlRecord rec = db.record(qtestalter); + QSqlRecord rec = db.record(noEscapeAlterTable); QCOMPARE((int)rec.count(), 3); int i; @@ -620,7 +625,7 @@ void tst_QSqlDatabase::alterTable() QSKIP("DBMS doesn't support dropping columns in ALTER TABLE statement"); } - rec = db.record(qtestalter); + rec = db.record(noEscapeAlterTable); QCOMPARE((int)rec.count(), 2); @@ -678,13 +683,16 @@ void tst_QSqlDatabase::testRecord(const FieldDef fieldDefs[], const QSqlRecord& void tst_QSqlDatabase::commonFieldTest(const FieldDef fieldDefs[], QSqlDatabase db, const int fieldCount) { CHECK_DATABASE(db); - const QString tableName = qTableName("qtestfields", __FILE__, db); - QSqlRecord rec = db.record(tableName); - QCOMPARE((int)rec.count(), fieldCount+1); - testRecord(fieldDefs, rec, db); - + const QStringList tableNames = { qTableName("qtestfields", __FILE__, db), + qTableName("qtestfields", __FILE__, db, false) }; + for (const QString table : tableNames) { + QSqlRecord rec = db.record(table); + QCOMPARE(rec.count(), fieldCount + 1); + testRecord(fieldDefs, rec, db); + } QSqlQuery q(db); - QVERIFY_SQL(q, exec("select * from " + tableName)); + // Only check the escaped entry + QVERIFY_SQL(q, exec("select * from " + tableNames.at(0))); } void tst_QSqlDatabase::recordTDS() @@ -843,12 +851,8 @@ void tst_QSqlDatabase::recordPSQL() QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db); if (dbType == QSqlDriver::PostgreSQL) QVERIFY_SQL( q, exec("set client_min_messages='warning'")); - const QString tableName = qTableName("qtestfields", __FILE__, db); - q.exec("drop sequence " + tableName + "_t_bigserial_seq"); - q.exec("drop sequence " + tableName + "_t_serial_seq"); - // older psql cut off the table name - q.exec("drop sequence " + tableName + "_t_bigserial_seq"); - q.exec("drop sequence " + tableName + "_t_serial_seq"); + q.exec("drop sequence " + qTableName("qtestfields_t_bigserial_seq", __FILE__, db)); + q.exec("drop sequence " + qTableName("qtestfields_t_serial_seq", __FILE__, db)); const int fieldCount = createFieldTable(fieldDefs, db); QVERIFY(fieldCount > 0); @@ -1202,27 +1206,40 @@ void tst_QSqlDatabase::caseSensivity() const QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db); bool cs = false; - if (dbType == QSqlDriver::MySqlServer || dbType == QSqlDriver::SQLite || dbType == QSqlDriver::Sybase + if (dbType == QSqlDriver::MySqlServer || dbType == QSqlDriver::SQLite + || dbType == QSqlDriver::Sybase || dbType == QSqlDriver::PostgreSQL || dbType == QSqlDriver::MSSqlServer || db.driverName().startsWith("QODBC")) cs = true; - QSqlRecord rec = db.record(qTableName("qtest", __FILE__, db)); + QSqlRecord rec = db.record(qTableName("qtest", __FILE__, db, false)); QVERIFY((int)rec.count() > 0); if (!cs) { - rec = db.record(qTableName("QTEST", __FILE__, db).toUpper()); + rec = db.record(qTableName("QTEST", __FILE__, db, false).toUpper()); QVERIFY((int)rec.count() > 0); - rec = db.record(qTableName("qTesT", __FILE__, db)); + rec = db.record(qTableName("qTesT", __FILE__, db, false)); QVERIFY((int)rec.count() > 0); } - rec = db.primaryIndex(qTableName("qtest", __FILE__, db)); + rec = db.primaryIndex(qTableName("qtest", __FILE__, db, false)); QVERIFY((int)rec.count() > 0); if (!cs) { - rec = db.primaryIndex(qTableName("QTEST", __FILE__, db).toUpper()); + rec = db.primaryIndex(qTableName("QTEST", __FILE__, db, false).toUpper()); QVERIFY((int)rec.count() > 0); - rec = db.primaryIndex(qTableName("qTesT", __FILE__, db)); + rec = db.primaryIndex(qTableName("qTesT", __FILE__, db, false)); QVERIFY((int)rec.count() > 0); } + + // Explicit test for case sensitive table creation without quoting + QSqlQuery qry(db); + const auto noQuotesTable = qTableName("NoQuotes", __FILE__, db, false); + tst_Databases::safeDropTable(db, noQuotesTable); + QVERIFY_SQL(qry, exec("CREATE TABLE " + noQuotesTable + " (id INTEGER)")); + QVERIFY_SQL(qry, exec("INSERT INTO " + noQuotesTable + " VALUES(1)")); + QVERIFY_SQL(qry, exec("SELECT * FROM " + noQuotesTable)); + QVERIFY_SQL(qry, next()); + QCOMPARE(qry.value(0).toInt(), 1); + rec = db.record(cs ? noQuotesTable.toLower() : noQuotesTable); + QVERIFY(rec.count() > 0); } void tst_QSqlDatabase::noEscapedFieldNamesInRecord() @@ -1257,17 +1274,19 @@ void tst_QSqlDatabase::psql_schemas() const QString schemaName = qTableName("qtestschema", __FILE__, db); QVERIFY_SQL(q, exec("CREATE SCHEMA " + schemaName)); - QString table = schemaName + '.' + qTableName("qtesttable", __FILE__, db); + const auto table = schemaName + '.' + qTableName("qtesttable", __FILE__, db); + const auto noescapeTable = qTableName("qtestschema", __FILE__, db, false) + '.' + + qTableName("qtesttable", __FILE__, db, false); QVERIFY_SQL(q, exec("CREATE TABLE " + table + " (id int primary key, name varchar(20))")); - QVERIFY(db.tables().contains(table, Qt::CaseInsensitive)); + QVERIFY(db.tables().contains(noescapeTable, Qt::CaseInsensitive)); - QSqlRecord rec = db.record(table); + QSqlRecord rec = db.record(noescapeTable); QCOMPARE(rec.count(), 2); QCOMPARE(rec.fieldName(0), QString("id")); QCOMPARE(rec.fieldName(1), QString("name")); - QSqlIndex idx = db.primaryIndex(table); + QSqlIndex idx = db.primaryIndex(noescapeTable); QCOMPARE(idx.count(), 1); QCOMPARE(idx.fieldName(0), QString("id")); } @@ -1285,18 +1304,21 @@ void tst_QSqlDatabase::psql_escapedIdentifiers() QSqlQuery q(db); QVERIFY_SQL( q, exec("set client_min_messages='warning'")); - const QString schemaName(qTableName("qtestScHeMa", __FILE__, db)), + const char bumpyCase[] = "qtestScHeMa"; + const QString schemaName(qTableName(bumpyCase, __FILE__, db)), tableName(qTableName("qtest", __FILE__, db)), field1Name(QLatin1String("fIeLdNaMe")), field2Name(QLatin1String("ZuLu")); - q.exec(QString("DROP SCHEMA \"%1\" CASCADE").arg(schemaName)); - QString createSchema = QString("CREATE SCHEMA \"%1\"").arg(schemaName); + q.exec(QString("DROP SCHEMA %1 CASCADE").arg(schemaName)); + const auto createSchema = QString("CREATE SCHEMA %1").arg(schemaName); QVERIFY_SQL(q, exec(createSchema)); - QString createTable = QString("CREATE TABLE \"%1\".\"%2\" (\"%3\" int PRIMARY KEY, \"%4\" varchar(20))").arg(schemaName).arg(tableName).arg(field1Name).arg(field2Name); + const auto createTable = QString("CREATE TABLE %1.%2 (\"%3\" int PRIMARY KEY, \"%4\" varchar(20))") + .arg(schemaName, tableName, field1Name, field2Name); QVERIFY_SQL(q, exec(createTable)); - QVERIFY(db.tables().contains(schemaName + '.' + tableName, Qt::CaseSensitive)); + QVERIFY(db.tables().contains(qTableName(bumpyCase, __FILE__, db, false) + '.' + + qTableName("qtest", __FILE__, db, false), Qt::CaseSensitive)); QSqlField fld1(field1Name, QVariant::Int); QSqlField fld2(field2Name, QVariant::String); @@ -1304,7 +1326,9 @@ void tst_QSqlDatabase::psql_escapedIdentifiers() rec.append(fld1); rec.append(fld2); - QVERIFY_SQL(q, exec(drv->sqlStatement(QSqlDriver::SelectStatement, db.driver()->escapeIdentifier(schemaName, QSqlDriver::TableName) + '.' + db.driver()->escapeIdentifier(tableName, QSqlDriver::TableName), rec, false))); + QVERIFY_SQL(q, exec(drv->sqlStatement(QSqlDriver::SelectStatement, + schemaName + '.' + tableName, + rec, false))); rec = q.record(); QCOMPARE(rec.count(), 2); @@ -1312,7 +1336,7 @@ void tst_QSqlDatabase::psql_escapedIdentifiers() QCOMPARE(rec.fieldName(1), field2Name); QCOMPARE(rec.field(0).type(), QVariant::Int); - q.exec(QString("DROP SCHEMA \"%1\" CASCADE").arg(schemaName)); + q.exec(QString("DROP SCHEMA %1 CASCADE").arg(schemaName)); } void tst_QSqlDatabase::psql_escapeBytea() @@ -2143,7 +2167,7 @@ void tst_QSqlDatabase::eventNotificationPSQL() CHECK_DATABASE(db); QSqlQuery query(db); - QString procedureName = qTableName("posteventProc", __FILE__, db); + const auto procedureName = qTableName("posteventProc", __FILE__, db, false); QString payload = "payload"; QSqlDriver &driver=*(db.driver()); QVERIFY_SQL(driver, subscribeToNotification(procedureName)); @@ -2167,21 +2191,22 @@ void tst_QSqlDatabase::eventNotificationSQLite() QSKIP("QSQLITE specific test"); } const QString tableName(qTableName("sqlitnotifytest", __FILE__, db)); + const auto noEscapeTableName(qTableName("sqlitnotifytest", __FILE__, db, false)); tst_Databases::safeDropTable(db, tableName); QSignalSpy notificationSpy(db.driver(), SIGNAL(notification(QString))); QSignalSpy notificationSpyExt(db.driver(), SIGNAL(notification(QString,QSqlDriver::NotificationSource,QVariant))); QSqlQuery q(db); QVERIFY_SQL(q, exec("CREATE TABLE " + tableName + " (id INTEGER, realVal REAL)")); - db.driver()->subscribeToNotification(tableName); + db.driver()->subscribeToNotification(noEscapeTableName); QVERIFY_SQL(q, exec("INSERT INTO " + tableName + " (id, realVal) VALUES (1, 2.3)")); QTRY_COMPARE(notificationSpy.count(), 1); QTRY_COMPARE(notificationSpyExt.count(), 1); QList<QVariant> arguments = notificationSpy.takeFirst(); - QCOMPARE(arguments.at(0).toString(), tableName); + QCOMPARE(arguments.at(0).toString(), noEscapeTableName); arguments = notificationSpyExt.takeFirst(); - QCOMPARE(arguments.at(0).toString(), tableName); - db.driver()->unsubscribeFromNotification(tableName); + QCOMPARE(arguments.at(0).toString(), noEscapeTableName); + db.driver()->unsubscribeFromNotification(noEscapeTableName); QVERIFY_SQL(q, exec("INSERT INTO " + tableName + " (id, realVal) VALUES (1, 2.3)")); QTRY_COMPARE(notificationSpy.count(), 0); QTRY_COMPARE(notificationSpyExt.count(), 0); @@ -2350,6 +2375,30 @@ void tst_QSqlDatabase::sqlite_openError() QCOMPARE(error.databaseText(), "unable to open database file"); } +void tst_QSqlDatabase::sqlite_check_json1() +{ + QFETCH(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + const QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db); + if (dbType != QSqlDriver::SQLite) + QSKIP("SQLite3 specific test"); + + QSqlQuery q(db); + const QString json1("{\"id\":1}"); + const QString tableName(qTableName("sqlite_check_json1", __FILE__, db)); + tst_Databases::safeDropTable(db, tableName); + QVERIFY_SQL(q, exec(QString("CREATE TABLE %1(text TEXT)").arg(tableName))); + QVERIFY_SQL(q, exec(QString("INSERT INTO %1 VALUES(json('%2'))").arg(tableName, json1))); + QVERIFY_SQL(q, prepare(QString("INSERT INTO %1 VALUES(?)").arg(tableName))); + q.addBindValue("json('{\"id\":2}')"); + QVERIFY_SQL(q, prepare(QString("SELECT * from %1 WHERE text = json('%2')").arg(tableName, json1))); + QVERIFY_SQL(q, exec()); + QVERIFY_SQL(q, next()); + QCOMPARE(q.value(0).toString(), json1); + QFAIL_SQL(q, next()); +} + void tst_QSqlDatabase::cloneDatabase() { QFETCH(QString, dbName); @@ -2395,6 +2444,16 @@ public slots: QSqlDatabase invalidDb = QSqlDatabase::database("invalid"); QVERIFY(!invalidDb.isValid()); + + { + QSqlDatabase clonedDatabase = QSqlDatabase::cloneDatabase(dbName, "CloneDB"); + QVERIFY(!clonedDatabase.isOpen()); + QVERIFY(clonedDatabase.isValid()); + QVERIFY(clonedDatabase.open()); + QVERIFY(clonedDatabase.isOpen()); + clonedDatabase.close(); + } + QThread::currentThread()->exit(); } private: diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp index 710f26b72d..784d0a70d7 100644 --- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp @@ -1098,7 +1098,7 @@ void tst_QSqlQuery::record() for (int i = 0; i < 3; ++i) QCOMPARE(q.record().field(i).tableName().toLower(), lowerQTest); q.clear(); - const auto tst_record = qTableName("tst_record", __FILE__, db).toLower(); + const auto tst_record = qTableName("tst_record", __FILE__, db, false).toLower(); SETUP_RECORD_TABLE; CHECK_RECORD; q.clear(); @@ -3763,15 +3763,13 @@ void tst_QSqlQuery::QTBUG_5251() const QString timetest(qTableName("timetest", __FILE__, db)); tst_Databases::safeDropTable(db, timetest); QSqlQuery q(db); - QVERIFY_SQL(q, exec(QStringLiteral("CREATE TABLE \"") + timetest + QStringLiteral("\" (t TIME)"))); - QVERIFY_SQL(q, exec(QStringLiteral("INSERT INTO \"") + timetest + - QStringLiteral("\" VALUES ('1:2:3.666')"))); + QVERIFY_SQL(q, exec(QStringLiteral("CREATE TABLE ") + timetest + QStringLiteral(" (t TIME)"))); + QVERIFY_SQL(q, exec(QStringLiteral("INSERT INTO ") + timetest + + QStringLiteral(" VALUES ('1:2:3.666')"))); QSqlTableModel timetestModel(0,db); timetestModel.setEditStrategy(QSqlTableModel::OnManualSubmit); timetestModel.setTable(timetest); - if (tst_Databases::getDatabaseType(db) == QSqlDriver::PostgreSQL) - QEXPECT_FAIL("", "Currently broken for PostgreSQL due to case sensitivity problems - see QTBUG-65788", Abort); QVERIFY_SQL(timetestModel, select()); QCOMPARE(timetestModel.record(0).field(0).value().toTime().toString("HH:mm:ss.zzz"), QString("01:02:03.666")); @@ -3780,8 +3778,8 @@ void tst_QSqlQuery::QTBUG_5251() QVERIFY_SQL(timetestModel, submitAll()); QCOMPARE(timetestModel.record(0).field(0).value().toTime().toString("HH:mm:ss.zzz"), QString("00:12:34.500")); - QVERIFY_SQL(q, exec(QStringLiteral("UPDATE \"") + timetest + - QStringLiteral("\" SET t = '0:11:22.33'"))); + QVERIFY_SQL(q, exec(QStringLiteral("UPDATE ") + timetest + + QStringLiteral(" SET t = '0:11:22.33'"))); QVERIFY_SQL(timetestModel, select()); QCOMPARE(timetestModel.record(0).field(0).value().toTime().toString("HH:mm:ss.zzz"), QString("00:11:22.330")); diff --git a/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp b/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp index e4a277e096..722ef9c570 100644 --- a/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp +++ b/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp @@ -122,13 +122,13 @@ void tst_QSqlRelationalTableModel::recreateTestTables(QSqlDatabase db) QVERIFY_SQL( q, exec("insert into " + reltest5 + " values('mister', 'Mr')")); if (testWhiteSpaceNames(db.driverName())) { - QString reltest6 = db.driver()->escapeIdentifier(qTableName("rel", __FILE__, db) + " test6", QSqlDriver::TableName); + const auto reltest6 = qTableName("rel test6", __FILE__, db); QVERIFY_SQL( q, exec("create table " + reltest6 + " (id int not null primary key, " + db.driver()->escapeIdentifier("city key", QSqlDriver::FieldName) + " int, " + db.driver()->escapeIdentifier("extra field", QSqlDriver::FieldName) + " int)")); QVERIFY_SQL( q, exec("insert into " + reltest6 + " values(1, 1,9)")); QVERIFY_SQL( q, exec("insert into " + reltest6 + " values(2, 2,8)")); - QString reltest7 = db.driver()->escapeIdentifier(qTableName("rel", __FILE__, db) + " test7", QSqlDriver::TableName); + const auto reltest7 = qTableName("rel test7", __FILE__, db); QVERIFY_SQL( q, exec("create table " + reltest7 + " (" + db.driver()->escapeIdentifier("city id", QSqlDriver::TableName) + " int not null primary key, " + db.driver()->escapeIdentifier("city name", QSqlDriver::FieldName) + " varchar(20))")); QVERIFY_SQL( q, exec("insert into " + reltest7 + " values(1, 'New York')")); QVERIFY_SQL( q, exec("insert into " + reltest7 + " values(2, 'Washington')")); @@ -170,8 +170,8 @@ void tst_QSqlRelationalTableModel::dropTestTables( QSqlDatabase db ) << reltest3 << reltest4 << reltest5 - << (qTableName("rel", __FILE__, db) + " test6") - << (qTableName( "rel", __FILE__, db) + " test7") + << qTableName("rel test6", __FILE__, db) + << qTableName("rel test7", __FILE__, db) << qTableName("CASETEST1", db) << qTableName("casetest1", db); tst_Databases::safeDropTables( db, tableNames ); @@ -1379,9 +1379,9 @@ void tst_QSqlRelationalTableModel::whiteSpaceInIdentifiers() if (!testWhiteSpaceNames(db.driverName())) QSKIP("White space test irrelevant for driver"); QSqlRelationalTableModel model(0, db); - model.setTable(db.driver()->escapeIdentifier(qTableName("rel", __FILE__, db) + " test6", QSqlDriver::TableName)); + model.setTable(qTableName("rel test6", __FILE__, db)); model.setSort(0, Qt::DescendingOrder); - model.setRelation(1, QSqlRelation(db.driver()->escapeIdentifier(qTableName("rel", __FILE__, db) + " test7", QSqlDriver::TableName), + model.setRelation(1, QSqlRelation(qTableName("rel test7", __FILE__, db), db.driver()->escapeIdentifier("city id", QSqlDriver::FieldName), db.driver()->escapeIdentifier("city name", QSqlDriver::FieldName))); QVERIFY_SQL(model, select()); @@ -1547,8 +1547,6 @@ void tst_QSqlRelationalTableModel::relationOnFirstColumn() //modify the model data QVERIFY_SQL(model, setData(model.index(0, 0), 40)); - if (tst_Databases::getDatabaseType(db) == QSqlDriver::PostgreSQL) - QEXPECT_FAIL("", "Currently broken for PostgreSQL due to case sensitivity problems - see QTBUG-65788", Abort); QVERIFY_SQL(model, submit()); QVERIFY_SQL(model, setData(model.index(1, 0), 50)); QVERIFY_SQL(model, submit()); diff --git a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp index da31f437d9..b617151a36 100644 --- a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp @@ -383,8 +383,6 @@ void tst_QSqlTableModel::selectRow() q.exec("UPDATE " + tbl + " SET a = 'Qt' WHERE id = 1"); QCOMPARE(model.data(idx).toString(), QString("b")); model.selectRow(1); - if (tst_Databases::getDatabaseType(db) == QSqlDriver::PostgreSQL) - QEXPECT_FAIL("", "Currently broken for PostgreSQL due to case sensitivity problems - see QTBUG-65788", Abort); QCOMPARE(model.data(idx).toString(), QString("Qt")); // Check if selectRow() refreshes a changed row. @@ -441,8 +439,6 @@ void tst_QSqlTableModel::selectRowOverride() // both rows should have changed QCOMPARE(model.data(idx).toString(), QString("Qt")); idx = model.index(2, 1); - if (tst_Databases::getDatabaseType(db) == QSqlDriver::PostgreSQL) - QEXPECT_FAIL("", "Currently broken for PostgreSQL due to case sensitivity problems - see QTBUG-65788", Abort); QCOMPARE(model.data(idx).toString(), QString("Qt")); q.exec("DELETE FROM " + tbl); @@ -854,8 +850,6 @@ void tst_QSqlTableModel::insertRowFailure() // populate 1 row const QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db); - if (dbType == QSqlDriver::PostgreSQL && submitpolicy != QSqlTableModel::OnManualSubmit) - QEXPECT_FAIL("", "Currently broken for PostgreSQL due to case sensitivity problems - see QTBUG-65788", Abort); QVERIFY_SQL(model, insertRecord(0, values)); QVERIFY_SQL(model, submitAll()); QVERIFY_SQL(model, select()); @@ -899,8 +893,6 @@ void tst_QSqlTableModel::insertRowFailure() // restore empty table model.revertAll(); QVERIFY_SQL(model, removeRow(0)); - if (dbType == QSqlDriver::PostgreSQL) - QEXPECT_FAIL("", "Currently broken for PostgreSQL due to case sensitivity problems - see QTBUG-65788", Abort); QVERIFY_SQL(model, submitAll()); QVERIFY_SQL(model, select()); QCOMPARE(model.rowCount(), 0); @@ -2009,8 +2001,6 @@ void tst_QSqlTableModel::tableModifyWithBlank() //Should be equivalent to QSqlQuery INSERT INTO... command) QVERIFY_SQL(model, insertRow(0)); QVERIFY_SQL(model, setData(model.index(0,0),timeString)); - if (tst_Databases::getDatabaseType(db) == QSqlDriver::PostgreSQL) - QEXPECT_FAIL("", "Currently broken for PostgreSQL due to case sensitivity problems - see QTBUG-65788", Abort); QVERIFY_SQL(model, submitAll()); //set a filter on the table so the only record we get is the one we just made diff --git a/tests/auto/testlib/outformat/outformat.pro b/tests/auto/testlib/outformat/outformat.pro new file mode 100644 index 0000000000..ea02f3167f --- /dev/null +++ b/tests/auto/testlib/outformat/outformat.pro @@ -0,0 +1,7 @@ +CONFIG += testcase +QT = core testlib + +SOURCES += tst_outformat.cpp +TARGET = outformat + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/outformat/tst_outformat.cpp b/tests/auto/testlib/outformat/tst_outformat.cpp new file mode 100644 index 0000000000..5d131159a9 --- /dev/null +++ b/tests/auto/testlib/outformat/tst_outformat.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtTest/QtTest> + +class tst_OutFormat : public QObject +{ + Q_OBJECT +private slots: + void toHex_data() const; + void toHex() const; + // other formats of interest ? +}; + +void tst_OutFormat::toHex_data() const +{ + QTest::addColumn<QByteArray>("raw"); + QTest::addColumn<QByteArray>("hex"); + + QTest::newRow("empty") << QByteArray("") << QByteArray(""); + QTest::newRow("long") + << QByteArray("Truncates in ellipsis when more than fifty characters long") + << QByteArray("54 72 75 6E 63 61 74 65 73 20 69 6E 20 65 6C 6C " + "69 70 73 69 73 20 77 68 65 6E 20 6D 6F 72 65 20 " + "74 68 61 6E 20 66 69 66 74 79 20 63 68 61 72 61 " + "63 74 ..."); + QTest::newRow("spaces") + << QByteArray(" \t\n\v\f\r") << QByteArray("20 09 0A 0B 0C 0D"); + QTest::newRow("ASCII-escapes") + << QByteArray("\a\b\\\"'\177") << QByteArray("07 08 5C 22 27 7F"); + // These are the ISO Latin-15 , pound, Euro, ..., y-umlaut + QTest::newRow("8-bit-sampler") + << QByteArray("\240\243\244\261\327\360\377") << QByteArray("A0 A3 A4 B1 D7 F0 FF"); +} + +void tst_OutFormat::toHex() const +{ + QFETCH(QByteArray, raw); + QFETCH(QByteArray, hex); + QScopedArrayPointer<char> repr(QTest::toHexRepresentation(raw.constData(), raw.size())); + QCOMPARE(repr.data(), hex); +} + +QTEST_APPLESS_MAIN(tst_OutFormat) + +#include "tst_outformat.moc" diff --git a/tests/auto/testlib/qabstractitemmodeltester/qabstractitemmodeltester.pro b/tests/auto/testlib/qabstractitemmodeltester/qabstractitemmodeltester.pro index 306e8089f3..1aefc544d1 100644 --- a/tests/auto/testlib/qabstractitemmodeltester/qabstractitemmodeltester.pro +++ b/tests/auto/testlib/qabstractitemmodeltester/qabstractitemmodeltester.pro @@ -11,3 +11,5 @@ SOURCES += \ HEADERS += \ $${mtdir}/dynamictreemodel.h + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/qabstractitemmodeltester/tst_qabstractitemmodeltester.cpp b/tests/auto/testlib/qabstractitemmodeltester/tst_qabstractitemmodeltester.cpp index 0593ae74bf..60aa350145 100644 --- a/tests/auto/testlib/qabstractitemmodeltester/tst_qabstractitemmodeltester.cpp +++ b/tests/auto/testlib/qabstractitemmodeltester/tst_qabstractitemmodeltester.cpp @@ -79,9 +79,9 @@ void tst_QAbstractItemModelTester::treeWidgetModel() root->removeChild(remove); QTreeWidgetItem *parent = new QTreeWidgetItem(&widget, QStringList("parent")); new QTreeWidgetItem(parent, QStringList("child")); - widget.setItemHidden(parent, true); + parent->setHidden(true); - widget.sortByColumn(0); + widget.sortByColumn(0, Qt::AscendingOrder); } void tst_QAbstractItemModelTester::standardItemModel() diff --git a/tests/auto/testlib/qsignalspy/qsignalspy.pro b/tests/auto/testlib/qsignalspy/qsignalspy.pro index 1578802bf8..5343a98c14 100644 --- a/tests/auto/testlib/qsignalspy/qsignalspy.pro +++ b/tests/auto/testlib/qsignalspy/qsignalspy.pro @@ -2,3 +2,5 @@ CONFIG += testcase TARGET = tst_qsignalspy SOURCES += tst_qsignalspy.cpp QT = core testlib + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/alive/alive.pro b/tests/auto/testlib/selftests/alive/alive.pro index d3df09b10d..bda0db2282 100644 --- a/tests/auto/testlib/selftests/alive/alive.pro +++ b/tests/auto/testlib/selftests/alive/alive.pro @@ -6,3 +6,5 @@ CONFIG -= debug_and_release_target TARGET = alive + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/assert/assert.pro b/tests/auto/testlib/selftests/assert/assert.pro index cfc6a0c6b3..0692b6bdf2 100644 --- a/tests/auto/testlib/selftests/assert/assert.pro +++ b/tests/auto/testlib/selftests/assert/assert.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = assert + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/badxml/badxml.pro b/tests/auto/testlib/selftests/badxml/badxml.pro index 7b3b0f701c..4e15886504 100644 --- a/tests/auto/testlib/selftests/badxml/badxml.pro +++ b/tests/auto/testlib/selftests/badxml/badxml.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = badxml + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/benchlibcallgrind/benchlibcallgrind.pro b/tests/auto/testlib/selftests/benchlibcallgrind/benchlibcallgrind.pro index 6cbefe518c..12f068843e 100644 --- a/tests/auto/testlib/selftests/benchlibcallgrind/benchlibcallgrind.pro +++ b/tests/auto/testlib/selftests/benchlibcallgrind/benchlibcallgrind.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = benchlibcallgrind + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp b/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp index 0d3e884a56..fe83ee6608 100644 --- a/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp +++ b/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp @@ -68,9 +68,9 @@ void tst_BenchlibCallgrind::twoHundredMillionInstructions() QBENCHMARK { __asm__ __volatile__( "mov $100000000,%%eax \n" - "LOOPTOP: \n" + "1: \n" "dec %%eax \n" - "jnz LOOPTOP \n" + "jnz 1b \n" : /* no output */ : /* no input */ : /* clobber */ "eax" diff --git a/tests/auto/testlib/selftests/benchlibcounting/benchlibcounting.pro b/tests/auto/testlib/selftests/benchlibcounting/benchlibcounting.pro index b495995eac..786511d057 100644 --- a/tests/auto/testlib/selftests/benchlibcounting/benchlibcounting.pro +++ b/tests/auto/testlib/selftests/benchlibcounting/benchlibcounting.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = benchlibcounting + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/benchlibeventcounter/benchlibeventcounter.pro b/tests/auto/testlib/selftests/benchlibeventcounter/benchlibeventcounter.pro index 5e2b963491..98fa0e4567 100644 --- a/tests/auto/testlib/selftests/benchlibeventcounter/benchlibeventcounter.pro +++ b/tests/auto/testlib/selftests/benchlibeventcounter/benchlibeventcounter.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = benchlibeventcounter + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/benchliboptions/benchliboptions.pro b/tests/auto/testlib/selftests/benchliboptions/benchliboptions.pro index f4bcc92129..0b627ecb10 100644 --- a/tests/auto/testlib/selftests/benchliboptions/benchliboptions.pro +++ b/tests/auto/testlib/selftests/benchliboptions/benchliboptions.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = benchliboptions + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/benchlibtickcounter/benchlibtickcounter.pro b/tests/auto/testlib/selftests/benchlibtickcounter/benchlibtickcounter.pro index ce0ec7012c..f0741d5c26 100644 --- a/tests/auto/testlib/selftests/benchlibtickcounter/benchlibtickcounter.pro +++ b/tests/auto/testlib/selftests/benchlibtickcounter/benchlibtickcounter.pro @@ -6,3 +6,5 @@ CONFIG -= debug_and_release_target TARGET = benchlibtickcounter + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/benchlibwalltime/benchlibwalltime.pro b/tests/auto/testlib/selftests/benchlibwalltime/benchlibwalltime.pro index 0e689871ab..80d97a2422 100644 --- a/tests/auto/testlib/selftests/benchlibwalltime/benchlibwalltime.pro +++ b/tests/auto/testlib/selftests/benchlibwalltime/benchlibwalltime.pro @@ -6,3 +6,5 @@ CONFIG -= debug_and_release_target TARGET = benchlibwalltime + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/blacklisted/BLACKLIST b/tests/auto/testlib/selftests/blacklisted/BLACKLIST index 36b7699cbd..a923c11416 100644 --- a/tests/auto/testlib/selftests/blacklisted/BLACKLIST +++ b/tests/auto/testlib/selftests/blacklisted/BLACKLIST @@ -1,12 +1,20 @@ -[pass] +obscure # no such platform; is ignored * + +[pass] +!* + [skip] * + [fail] * -[xpass] -* + [xfail] * + +[xpass] +* + [messages] * diff --git a/tests/auto/testlib/selftests/blacklisted/blacklisted.pro b/tests/auto/testlib/selftests/blacklisted/blacklisted.pro index 5bd22910b1..a8602ee266 100644 --- a/tests/auto/testlib/selftests/blacklisted/blacklisted.pro +++ b/tests/auto/testlib/selftests/blacklisted/blacklisted.pro @@ -5,3 +5,5 @@ mac: CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = blacklisted + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp b/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp index b25489ca00..2f6d633e9d 100644 --- a/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp +++ b/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp @@ -45,7 +45,8 @@ private slots: void messages(); }; -// All the tests below have been blacklisted in blacklisted/BLACKLIST +// All the tests below except pass() have been blacklisted in blacklisted/BLACKLIST +// Contrast with ../silent/, for the same tests without blacklisting but with -silent void tst_Blacklisted::pass() { diff --git a/tests/auto/testlib/selftests/cmptest/cmptest.pro b/tests/auto/testlib/selftests/cmptest/cmptest.pro index 2d5dd071a9..f38f5ecce1 100644 --- a/tests/auto/testlib/selftests/cmptest/cmptest.pro +++ b/tests/auto/testlib/selftests/cmptest/cmptest.pro @@ -6,3 +6,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = cmptest + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/commandlinedata/commandlinedata.pro b/tests/auto/testlib/selftests/commandlinedata/commandlinedata.pro index 056388333a..8032ba5a02 100644 --- a/tests/auto/testlib/selftests/commandlinedata/commandlinedata.pro +++ b/tests/auto/testlib/selftests/commandlinedata/commandlinedata.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = commandlinedata + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/counting/counting.pro b/tests/auto/testlib/selftests/counting/counting.pro index 8aa2fe5753..be3a5339b0 100644 --- a/tests/auto/testlib/selftests/counting/counting.pro +++ b/tests/auto/testlib/selftests/counting/counting.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = counting + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/crashes/crashes.pro b/tests/auto/testlib/selftests/crashes/crashes.pro index 25e24243d1..00fa07a415 100644 --- a/tests/auto/testlib/selftests/crashes/crashes.pro +++ b/tests/auto/testlib/selftests/crashes/crashes.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = crashes + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/datatable/datatable.pro b/tests/auto/testlib/selftests/datatable/datatable.pro index 72fa851ae6..12a1f697b1 100644 --- a/tests/auto/testlib/selftests/datatable/datatable.pro +++ b/tests/auto/testlib/selftests/datatable/datatable.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = datatable + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/datetime/datetime.pro b/tests/auto/testlib/selftests/datetime/datetime.pro index d65c59354f..1524281090 100644 --- a/tests/auto/testlib/selftests/datetime/datetime.pro +++ b/tests/auto/testlib/selftests/datetime/datetime.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = datetime + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/deleteLater/deleteLater.pro b/tests/auto/testlib/selftests/deleteLater/deleteLater.pro index 6847238b1d..9a10096461 100644 --- a/tests/auto/testlib/selftests/deleteLater/deleteLater.pro +++ b/tests/auto/testlib/selftests/deleteLater/deleteLater.pro @@ -5,3 +5,5 @@ CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = tst_deleteLater + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/deleteLater_noApp/deleteLater_noApp.pro b/tests/auto/testlib/selftests/deleteLater_noApp/deleteLater_noApp.pro index f860a767cd..6f2b253c14 100644 --- a/tests/auto/testlib/selftests/deleteLater_noApp/deleteLater_noApp.pro +++ b/tests/auto/testlib/selftests/deleteLater_noApp/deleteLater_noApp.pro @@ -5,3 +5,5 @@ CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = tst_deleteLater_noApp + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/differentexec/differentexec.pro b/tests/auto/testlib/selftests/differentexec/differentexec.pro index 7f148ba996..339962f609 100644 --- a/tests/auto/testlib/selftests/differentexec/differentexec.pro +++ b/tests/auto/testlib/selftests/differentexec/differentexec.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = differentexec + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/exceptionthrow/exceptionthrow.pro b/tests/auto/testlib/selftests/exceptionthrow/exceptionthrow.pro index fe89f6f3cd..5473ec32c3 100644 --- a/tests/auto/testlib/selftests/exceptionthrow/exceptionthrow.pro +++ b/tests/auto/testlib/selftests/exceptionthrow/exceptionthrow.pro @@ -6,3 +6,5 @@ CONFIG -= debug_and_release_target CONFIG += exceptions TARGET = exceptionthrow + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/expected_blacklisted.tap b/tests/auto/testlib/selftests/expected_blacklisted.tap index 7d3b2b0cc8..35f6d3df50 100644 --- a/tests/auto/testlib/selftests/expected_blacklisted.tap +++ b/tests/auto/testlib/selftests/expected_blacklisted.tap @@ -11,16 +11,16 @@ not ok 4 - fail() # TODO 'false' returned FALSE. (This test should BFAIL) found: false (false) expected: true (false) actual: false (false) - at: tst_Blacklisted::fail() (qtbase/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp:62) + at: tst_Blacklisted::fail() (qtbase/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp:63) file: qtbase/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp - line: 62 + line: 63 ... not ok 4 - xfail() # TODO This test should BXFAIL then BPASS --- # This test should BXFAIL then BPASS - at: tst_Blacklisted::xfail() (qtbase/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp:68) + at: tst_Blacklisted::xfail() (qtbase/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp:69) file: qtbase/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp - line: 68 + line: 69 ... ok 5 - xfail() # TODO ok 6 - xpass() # TODO 'true' returned TRUE unexpectedly. (This test should BXPASS) diff --git a/tests/auto/testlib/selftests/expected_faildatatype.lightxml b/tests/auto/testlib/selftests/expected_faildatatype.lightxml new file mode 100644 index 0000000000..24992b78af --- /dev/null +++ b/tests/auto/testlib/selftests/expected_faildatatype.lightxml @@ -0,0 +1,22 @@ +<Environment> + <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> + <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> +</Environment> +<TestFunction name="initTestCase"> +<Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="value"> +<Message type="qdebug" file="" line="0"> + <Description><![CDATA[expected data of type 'QString', got 'bool' for element 0 of data with tag 'bool-as-string']]></Description> +</Message> +<Message type="qfatal" file="" line="0"> + <Description><![CDATA[ASSERT: "false" in file qtbase/src/testlib/qtestdata.cpp, line 0]]></Description> +</Message> +<Incident type="fail" file="Unknown file" line="0"> + <Description><![CDATA[Received a fatal error.]]></Description> +</Incident> + <Duration msecs="0"/> +</TestFunction> +<Duration msecs="0"/> diff --git a/tests/auto/testlib/selftests/expected_faildatatype.tap b/tests/auto/testlib/selftests/expected_faildatatype.tap new file mode 100644 index 0000000000..684cea4126 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_faildatatype.tap @@ -0,0 +1,16 @@ +TAP version 13 +# tst_FailDataType +ok 1 - initTestCase() +# expected data of type 'QString', got 'bool' for element 0 of data with tag 'bool-as-string' +# ASSERT: "false" in file qtbase/src/testlib/qtestdata.cpp, line 0 +not ok 2 - value() + --- + # Received a fatal error. + at: tst_FailDataType::value() (Unknown file:0) + file: Unknown file + line: 0 + ... +1..2 +# tests 2 +# pass 1 +# fail 1 diff --git a/tests/auto/testlib/selftests/expected_faildatatype.teamcity b/tests/auto/testlib/selftests/expected_faildatatype.teamcity new file mode 100644 index 0000000000..82731ae09e --- /dev/null +++ b/tests/auto/testlib/selftests/expected_faildatatype.teamcity @@ -0,0 +1,8 @@ +##teamcity[testSuiteStarted name='tst_FailDataType' flowId='tst_FailDataType'] +##teamcity[testStarted name='initTestCase()' flowId='tst_FailDataType'] +##teamcity[testFinished name='initTestCase()' flowId='tst_FailDataType'] +##teamcity[testStarted name='value()' flowId='tst_FailDataType'] +##teamcity[testFailed name='value()' message='Failure! |[Loc: Unknown file(0)|]' details='Received a fatal error.' flowId='tst_FailDataType'] +##teamcity[testStdOut name='value()' out='QDEBUG: expected data of type |'QString|', got |'bool|' for element 0 of data with tag |'bool-as-string|'|nQFATAL: ASSERT: "false" in file qtbase/src/testlib/qtestdata.cpp, line 0' flowId='tst_FailDataType'] +##teamcity[testFinished name='value()' flowId='tst_FailDataType'] +##teamcity[testSuiteFinished name='tst_FailDataType' flowId='tst_FailDataType'] diff --git a/tests/auto/testlib/selftests/expected_faildatatype.txt b/tests/auto/testlib/selftests/expected_faildatatype.txt new file mode 100644 index 0000000000..4cfe3b7654 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_faildatatype.txt @@ -0,0 +1,9 @@ +********* Start testing of tst_FailDataType ********* +Config: Using QtTest library +PASS : tst_FailDataType::initTestCase() +QDEBUG : tst_FailDataType::value() expected data of type 'QString', got 'bool' for element 0 of data with tag 'bool-as-string' +QFATAL : tst_FailDataType::value() ASSERT: "false" in file qtbase/src/testlib/qtestdata.cpp, line 0 +FAIL! : tst_FailDataType::value() Received a fatal error. + Loc: [Unknown file(0)] +Totals: 1 passed, 1 failed, 0 skipped, 0 blacklisted, 0ms +********* Finished testing of tst_FailDataType ********* diff --git a/tests/auto/testlib/selftests/expected_faildatatype.xml b/tests/auto/testlib/selftests/expected_faildatatype.xml new file mode 100644 index 0000000000..8812bfab71 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_faildatatype.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<TestCase name="tst_FailDataType"> +<Environment> + <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> + <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> +</Environment> +<TestFunction name="initTestCase"> +<Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="value"> +<Message type="qdebug" file="" line="0"> + <Description><![CDATA[expected data of type 'QString', got 'bool' for element 0 of data with tag 'bool-as-string']]></Description> +</Message> +<Message type="qfatal" file="" line="0"> + <Description><![CDATA[ASSERT: "false" in file qtbase/src/testlib/qtestdata.cpp, line 0]]></Description> +</Message> +<Incident type="fail" file="Unknown file" line="0"> + <Description><![CDATA[Received a fatal error.]]></Description> +</Incident> + <Duration msecs="0"/> +</TestFunction> +<Duration msecs="0"/> +</TestCase> diff --git a/tests/auto/testlib/selftests/expected_faildatatype.xunitxml b/tests/auto/testlib/selftests/expected_faildatatype.xunitxml new file mode 100644 index 0000000000..fcc0db3892 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_faildatatype.xunitxml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<testsuite errors="2" failures="1" tests="2" name="tst_FailDataType"> + <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="value"> + <!-- message="expected data of type 'QString', got 'bool' for element 0 of data with tag 'bool-as-string'" type="qdebug" --> + <!-- message="ASSERT: "false" in file qtbase/src/testlib/qtestdata.cpp, line 92" type="qfatal" --> + <failure message="Received a fatal error." result="fail"/> + </testcase> + <system-err> +<![CDATA[expected data of type 'QString', got 'bool' for element 0 of data with tag 'bool-as-string']]> +<![CDATA[ASSERT: "false" in file qtbase/src/testlib/qtestdata.cpp, line 0]]> + </system-err> +</testsuite> diff --git a/tests/auto/testlib/selftests/expected_failfetchtype.lightxml b/tests/auto/testlib/selftests/expected_failfetchtype.lightxml new file mode 100644 index 0000000000..f7c84a1876 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_failfetchtype.lightxml @@ -0,0 +1,21 @@ +<Environment> + <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> + <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> +</Environment> +<TestFunction name="initTestCase"> +<Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="fetch"> +<Message type="qfatal" file="" line="0"> + <DataTag><![CDATA[bool]]></DataTag> + <Description><![CDATA[Requested type 'QString' does not match available type 'bool'.]]></Description> +</Message> +<Incident type="fail" file="Unknown file" line="0"> + <DataTag><![CDATA[bool]]></DataTag> + <Description><![CDATA[Received a fatal error.]]></Description> +</Incident> + <Duration msecs="0"/> +</TestFunction> +<Duration msecs="0"/> diff --git a/tests/auto/testlib/selftests/expected_failfetchtype.tap b/tests/auto/testlib/selftests/expected_failfetchtype.tap new file mode 100644 index 0000000000..94c3b6e1b2 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_failfetchtype.tap @@ -0,0 +1,15 @@ +TAP version 13 +# tst_FailFetchType +ok 1 - initTestCase() +# Requested type 'QString' does not match available type 'bool'. +not ok 2 - fetch(bool) + --- + # Received a fatal error. + at: tst_FailFetchType::fetch() (Unknown file:0) + file: Unknown file + line: 0 + ... +1..2 +# tests 2 +# pass 1 +# fail 1 diff --git a/tests/auto/testlib/selftests/expected_failfetchtype.teamcity b/tests/auto/testlib/selftests/expected_failfetchtype.teamcity new file mode 100644 index 0000000000..91cf0c6ae8 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_failfetchtype.teamcity @@ -0,0 +1,8 @@ +##teamcity[testSuiteStarted name='tst_FailFetchType' flowId='tst_FailFetchType'] +##teamcity[testStarted name='initTestCase()' flowId='tst_FailFetchType'] +##teamcity[testFinished name='initTestCase()' flowId='tst_FailFetchType'] +##teamcity[testStarted name='fetch(bool)' flowId='tst_FailFetchType'] +##teamcity[testFailed name='fetch(bool)' message='Failure! |[Loc: Unknown file(0)|]' details='Received a fatal error.' flowId='tst_FailFetchType'] +##teamcity[testStdOut name='fetch(bool)' out='QFATAL: Requested type |'QString|' does not match available type |'bool|'.' flowId='tst_FailFetchType'] +##teamcity[testFinished name='fetch(bool)' flowId='tst_FailFetchType'] +##teamcity[testSuiteFinished name='tst_FailFetchType' flowId='tst_FailFetchType'] diff --git a/tests/auto/testlib/selftests/expected_failfetchtype.txt b/tests/auto/testlib/selftests/expected_failfetchtype.txt new file mode 100644 index 0000000000..d12cf0dc7d --- /dev/null +++ b/tests/auto/testlib/selftests/expected_failfetchtype.txt @@ -0,0 +1,8 @@ +********* Start testing of tst_FailFetchType ********* +Config: Using QtTest library +PASS : tst_FailFetchType::initTestCase() +QFATAL : tst_FailFetchType::fetch(bool) Requested type 'QString' does not match available type 'bool'. +FAIL! : tst_FailFetchType::fetch(bool) Received a fatal error. + Loc: [Unknown file(0)] +Totals: 1 passed, 1 failed, 0 skipped, 0 blacklisted, 0ms +********* Finished testing of tst_FailFetchType ********* diff --git a/tests/auto/testlib/selftests/expected_failfetchtype.xml b/tests/auto/testlib/selftests/expected_failfetchtype.xml new file mode 100644 index 0000000000..a349baa710 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_failfetchtype.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<TestCase name="tst_FailFetchType"> +<Environment> + <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> + <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> +</Environment> +<TestFunction name="initTestCase"> +<Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="fetch"> +<Message type="qfatal" file="" line="0"> + <DataTag><![CDATA[bool]]></DataTag> + <Description><![CDATA[Requested type 'QString' does not match available type 'bool'.]]></Description> +</Message> +<Incident type="fail" file="Unknown file" line="0"> + <DataTag><![CDATA[bool]]></DataTag> + <Description><![CDATA[Received a fatal error.]]></Description> +</Incident> + <Duration msecs="0"/> +</TestFunction> +<Duration msecs="0"/> +</TestCase> diff --git a/tests/auto/testlib/selftests/expected_failfetchtype.xunitxml b/tests/auto/testlib/selftests/expected_failfetchtype.xunitxml new file mode 100644 index 0000000000..a54a37a913 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_failfetchtype.xunitxml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<testsuite errors="1" failures="1" tests="2" name="tst_FailFetchType"> + <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="fetch"> + <!-- tag="bool" message="Requested type 'QString' does not match available type 'bool'." type="qfatal" --> + <failure tag="bool" message="Received a fatal error." result="fail"/> + </testcase> + <system-err> +<![CDATA[Requested type 'QString' does not match available type 'bool'.]]> + </system-err> +</testsuite> diff --git a/tests/auto/testlib/selftests/expected_float.lightxml b/tests/auto/testlib/selftests/expected_float.lightxml index 79ce33627d..458f2277e6 100644 --- a/tests/auto/testlib/selftests/expected_float.lightxml +++ b/tests/auto/testlib/selftests/expected_float.lightxml @@ -427,6 +427,33 @@ </Incident> <Duration msecs="0"/> </TestFunction> +<TestFunction name="float16Comparisons"> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[should SUCCEED 1]]></DataTag> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL 1]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 1 + Expected (operandRight): 3]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL 2]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 0.0001 + Expected (operandRight): 0.0003]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL 3]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 98 + Expected (operandRight): 99]]></Description> +</Incident> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[should SUCCEED 2]]></DataTag> +</Incident> + <Duration msecs="0"/> +</TestFunction> <TestFunction name="compareFloatTests"> <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> <DataTag><![CDATA[1e0]]></DataTag> diff --git a/tests/auto/testlib/selftests/expected_float.tap b/tests/auto/testlib/selftests/expected_float.tap index 1896bb2fb3..277dd2b1d4 100644 --- a/tests/auto/testlib/selftests/expected_float.tap +++ b/tests/auto/testlib/selftests/expected_float.tap @@ -10,9 +10,9 @@ not ok 3 - doubleComparisons(should FAIL 1) found: 1 (operandLeft) expected: 3 (operandRight) actual: 1 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... not ok 4 - doubleComparisons(should FAIL 2) --- @@ -22,9 +22,9 @@ not ok 4 - doubleComparisons(should FAIL 2) found: 1e-07 (operandLeft) expected: 3e-07 (operandRight) actual: 1e-07 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... ok 5 - doubleComparisons(should PASS 2) not ok 6 - doubleComparisons(should FAIL 3) @@ -35,9 +35,9 @@ not ok 6 - doubleComparisons(should FAIL 3) found: 999999999999 (operandLeft) expected: 999999999998 (operandRight) actual: 999999999999 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... ok 7 - doubleComparisons(should PASS 3) not ok 8 - doubleComparisons(should FAIL 4) @@ -48,9 +48,9 @@ not ok 8 - doubleComparisons(should FAIL 4) found: 9.99999999999e-311 (operandLeft) expected: 9.99999999997e-311 (operandRight) actual: 9.99999999999e-311 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... ok 9 - doubleComparisons(should PASS 4) not ok 10 - doubleComparisons(should FAIL 5) @@ -61,9 +61,9 @@ not ok 10 - doubleComparisons(should FAIL 5) found: 9.99999999999e+306 (operandLeft) expected: 9.99999999997e+306 (operandRight) actual: 9.99999999999e+306 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... ok 11 - doubleComparisons(should PASS: NaN == NaN) not ok 12 - doubleComparisons(should FAIL: NaN != 0) @@ -74,9 +74,9 @@ not ok 12 - doubleComparisons(should FAIL: NaN != 0) found: nan (operandLeft) expected: 0 (operandRight) actual: nan (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... not ok 13 - doubleComparisons(should FAIL: 0 != NaN) --- @@ -86,9 +86,9 @@ not ok 13 - doubleComparisons(should FAIL: 0 != NaN) found: 0 (operandLeft) expected: nan (operandRight) actual: 0 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... not ok 14 - doubleComparisons(should FAIL: NaN != 1) --- @@ -98,9 +98,9 @@ not ok 14 - doubleComparisons(should FAIL: NaN != 1) found: nan (operandLeft) expected: 1 (operandRight) actual: nan (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... not ok 15 - doubleComparisons(should FAIL: 1 != NaN) --- @@ -110,9 +110,9 @@ not ok 15 - doubleComparisons(should FAIL: 1 != NaN) found: 1 (operandLeft) expected: nan (operandRight) actual: 1 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... ok 16 - doubleComparisons(should PASS: inf == inf) ok 17 - doubleComparisons(should PASS: -inf == -inf) @@ -124,9 +124,9 @@ not ok 18 - doubleComparisons(should FAIL: inf != -inf) found: inf (operandLeft) expected: -inf (operandRight) actual: inf (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... not ok 19 - doubleComparisons(should FAIL: -inf != inf) --- @@ -136,9 +136,9 @@ not ok 19 - doubleComparisons(should FAIL: -inf != inf) found: -inf (operandLeft) expected: inf (operandRight) actual: -inf (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... not ok 20 - doubleComparisons(should FAIL: inf != nan) --- @@ -148,9 +148,9 @@ not ok 20 - doubleComparisons(should FAIL: inf != nan) found: inf (operandLeft) expected: nan (operandRight) actual: inf (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... not ok 21 - doubleComparisons(should FAIL: nan != inf) --- @@ -160,9 +160,9 @@ not ok 21 - doubleComparisons(should FAIL: nan != inf) found: nan (operandLeft) expected: inf (operandRight) actual: nan (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... not ok 22 - doubleComparisons(should FAIL: -inf != nan) --- @@ -172,9 +172,9 @@ not ok 22 - doubleComparisons(should FAIL: -inf != nan) found: -inf (operandLeft) expected: nan (operandRight) actual: -inf (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... not ok 23 - doubleComparisons(should FAIL: nan != -inf) --- @@ -184,9 +184,9 @@ not ok 23 - doubleComparisons(should FAIL: nan != -inf) found: nan (operandLeft) expected: -inf (operandRight) actual: nan (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... not ok 24 - doubleComparisons(should FAIL: inf != 0) --- @@ -196,9 +196,9 @@ not ok 24 - doubleComparisons(should FAIL: inf != 0) found: inf (operandLeft) expected: 0 (operandRight) actual: inf (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... not ok 25 - doubleComparisons(should FAIL: 0 != inf) --- @@ -208,9 +208,9 @@ not ok 25 - doubleComparisons(should FAIL: 0 != inf) found: 0 (operandLeft) expected: inf (operandRight) actual: 0 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... not ok 26 - doubleComparisons(should FAIL: -inf != 0) --- @@ -220,9 +220,9 @@ not ok 26 - doubleComparisons(should FAIL: -inf != 0) found: -inf (operandLeft) expected: 0 (operandRight) actual: -inf (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... not ok 27 - doubleComparisons(should FAIL: 0 != -inf) --- @@ -232,9 +232,9 @@ not ok 27 - doubleComparisons(should FAIL: 0 != -inf) found: 0 (operandLeft) expected: -inf (operandRight) actual: 0 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... not ok 28 - doubleComparisons(should FAIL: inf != 1) --- @@ -244,9 +244,9 @@ not ok 28 - doubleComparisons(should FAIL: inf != 1) found: inf (operandLeft) expected: 1 (operandRight) actual: inf (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... not ok 29 - doubleComparisons(should FAIL: 1 != inf) --- @@ -256,9 +256,9 @@ not ok 29 - doubleComparisons(should FAIL: 1 != inf) found: 1 (operandLeft) expected: inf (operandRight) actual: 1 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... not ok 30 - doubleComparisons(should FAIL: -inf != 1) --- @@ -268,9 +268,9 @@ not ok 30 - doubleComparisons(should FAIL: -inf != 1) found: -inf (operandLeft) expected: 1 (operandRight) actual: -inf (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... not ok 31 - doubleComparisons(should FAIL: 1 != -inf) --- @@ -280,9 +280,9 @@ not ok 31 - doubleComparisons(should FAIL: 1 != -inf) found: 1 (operandLeft) expected: -inf (operandRight) actual: 1 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... not ok 32 - doubleComparisons(should FAIL: inf != max) --- @@ -292,9 +292,9 @@ not ok 32 - doubleComparisons(should FAIL: inf != max) found: inf (operandLeft) expected: 1.79769313486e+308 (operandRight) actual: inf (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... not ok 33 - doubleComparisons(should FAIL: inf != -max) --- @@ -304,9 +304,9 @@ not ok 33 - doubleComparisons(should FAIL: inf != -max) found: inf (operandLeft) expected: -1.79769313486e+308 (operandRight) actual: inf (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... not ok 34 - doubleComparisons(should FAIL: max != inf) --- @@ -316,9 +316,9 @@ not ok 34 - doubleComparisons(should FAIL: max != inf) found: 1.79769313486e+308 (operandLeft) expected: inf (operandRight) actual: 1.79769313486e+308 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... not ok 35 - doubleComparisons(should FAIL: -max != inf) --- @@ -328,9 +328,9 @@ not ok 35 - doubleComparisons(should FAIL: -max != inf) found: -1.79769313486e+308 (operandLeft) expected: inf (operandRight) actual: -1.79769313486e+308 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... not ok 36 - doubleComparisons(should FAIL: -inf != max) --- @@ -340,9 +340,9 @@ not ok 36 - doubleComparisons(should FAIL: -inf != max) found: -inf (operandLeft) expected: 1.79769313486e+308 (operandRight) actual: -inf (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... not ok 37 - doubleComparisons(should FAIL: -inf != -max) --- @@ -352,9 +352,9 @@ not ok 37 - doubleComparisons(should FAIL: -inf != -max) found: -inf (operandLeft) expected: -1.79769313486e+308 (operandRight) actual: -inf (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... not ok 38 - doubleComparisons(should FAIL: max != -inf) --- @@ -364,9 +364,9 @@ not ok 38 - doubleComparisons(should FAIL: max != -inf) found: 1.79769313486e+308 (operandLeft) expected: -inf (operandRight) actual: 1.79769313486e+308 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... not ok 39 - doubleComparisons(should FAIL: -max != -inf) --- @@ -376,9 +376,9 @@ not ok 39 - doubleComparisons(should FAIL: -max != -inf) found: -1.79769313486e+308 (operandLeft) expected: -inf (operandRight) actual: -1.79769313486e+308 (operandLeft) - at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:51) + at: tst_float::doubleComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:54) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 51 + line: 54 ... not ok 40 - floatComparisons(should FAIL 1) --- @@ -388,9 +388,9 @@ not ok 40 - floatComparisons(should FAIL 1) found: 1 (operandLeft) expected: 3 (operandRight) actual: 1 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... ok 41 - floatComparisons(should PASS 1) not ok 42 - floatComparisons(should FAIL 2) @@ -401,9 +401,9 @@ not ok 42 - floatComparisons(should FAIL 2) found: 1e-07 (operandLeft) expected: 3e-07 (operandRight) actual: 1e-07 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... ok 43 - floatComparisons(should PASS 2) not ok 44 - floatComparisons(should FAIL 3) @@ -414,9 +414,9 @@ not ok 44 - floatComparisons(should FAIL 3) found: 99999 (operandLeft) expected: 99998 (operandRight) actual: 99999 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... ok 45 - floatComparisons(should PASS 3) not ok 46 - floatComparisons(should FAIL 4) @@ -427,9 +427,9 @@ not ok 46 - floatComparisons(should FAIL 4) found: 9.9999e-40 (operandLeft) expected: 9.99971e-40 (operandRight) actual: 9.9999e-40 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... ok 47 - floatComparisons(should PASS 4) not ok 48 - floatComparisons(should FAIL 5) @@ -440,9 +440,9 @@ not ok 48 - floatComparisons(should FAIL 5) found: 9.9999e+37 (operandLeft) expected: 9.9997e+37 (operandRight) actual: 9.9999e+37 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... ok 49 - floatComparisons(should PASS: NaN == NaN) not ok 50 - floatComparisons(should FAIL: NaN != 0) @@ -453,9 +453,9 @@ not ok 50 - floatComparisons(should FAIL: NaN != 0) found: nan (operandLeft) expected: 0 (operandRight) actual: nan (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... not ok 51 - floatComparisons(should FAIL: 0 != NaN) --- @@ -465,9 +465,9 @@ not ok 51 - floatComparisons(should FAIL: 0 != NaN) found: 0 (operandLeft) expected: nan (operandRight) actual: 0 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... not ok 52 - floatComparisons(should FAIL: NaN != 1) --- @@ -477,9 +477,9 @@ not ok 52 - floatComparisons(should FAIL: NaN != 1) found: nan (operandLeft) expected: 1 (operandRight) actual: nan (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... not ok 53 - floatComparisons(should FAIL: 1 != NaN) --- @@ -489,9 +489,9 @@ not ok 53 - floatComparisons(should FAIL: 1 != NaN) found: 1 (operandLeft) expected: nan (operandRight) actual: 1 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... ok 54 - floatComparisons(should PASS: inf == inf) ok 55 - floatComparisons(should PASS: -inf == -inf) @@ -503,9 +503,9 @@ not ok 56 - floatComparisons(should FAIL: inf != -inf) found: inf (operandLeft) expected: -inf (operandRight) actual: inf (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... not ok 57 - floatComparisons(should FAIL: -inf != inf) --- @@ -515,9 +515,9 @@ not ok 57 - floatComparisons(should FAIL: -inf != inf) found: -inf (operandLeft) expected: inf (operandRight) actual: -inf (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... not ok 58 - floatComparisons(should FAIL: inf != nan) --- @@ -527,9 +527,9 @@ not ok 58 - floatComparisons(should FAIL: inf != nan) found: inf (operandLeft) expected: nan (operandRight) actual: inf (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... not ok 59 - floatComparisons(should FAIL: nan != inf) --- @@ -539,9 +539,9 @@ not ok 59 - floatComparisons(should FAIL: nan != inf) found: nan (operandLeft) expected: inf (operandRight) actual: nan (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... not ok 60 - floatComparisons(should FAIL: -inf != nan) --- @@ -551,9 +551,9 @@ not ok 60 - floatComparisons(should FAIL: -inf != nan) found: -inf (operandLeft) expected: nan (operandRight) actual: -inf (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... not ok 61 - floatComparisons(should FAIL: nan != -inf) --- @@ -563,9 +563,9 @@ not ok 61 - floatComparisons(should FAIL: nan != -inf) found: nan (operandLeft) expected: -inf (operandRight) actual: nan (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... not ok 62 - floatComparisons(should FAIL: inf != 0) --- @@ -575,9 +575,9 @@ not ok 62 - floatComparisons(should FAIL: inf != 0) found: inf (operandLeft) expected: 0 (operandRight) actual: inf (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... not ok 63 - floatComparisons(should FAIL: 0 != inf) --- @@ -587,9 +587,9 @@ not ok 63 - floatComparisons(should FAIL: 0 != inf) found: 0 (operandLeft) expected: inf (operandRight) actual: 0 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... not ok 64 - floatComparisons(should FAIL: -inf != 0) --- @@ -599,9 +599,9 @@ not ok 64 - floatComparisons(should FAIL: -inf != 0) found: -inf (operandLeft) expected: 0 (operandRight) actual: -inf (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... not ok 65 - floatComparisons(should FAIL: 0 != -inf) --- @@ -611,9 +611,9 @@ not ok 65 - floatComparisons(should FAIL: 0 != -inf) found: 0 (operandLeft) expected: -inf (operandRight) actual: 0 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... not ok 66 - floatComparisons(should FAIL: inf != 1) --- @@ -623,9 +623,9 @@ not ok 66 - floatComparisons(should FAIL: inf != 1) found: inf (operandLeft) expected: 1 (operandRight) actual: inf (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... not ok 67 - floatComparisons(should FAIL: 1 != inf) --- @@ -635,9 +635,9 @@ not ok 67 - floatComparisons(should FAIL: 1 != inf) found: 1 (operandLeft) expected: inf (operandRight) actual: 1 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... not ok 68 - floatComparisons(should FAIL: -inf != 1) --- @@ -647,9 +647,9 @@ not ok 68 - floatComparisons(should FAIL: -inf != 1) found: -inf (operandLeft) expected: 1 (operandRight) actual: -inf (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... not ok 69 - floatComparisons(should FAIL: 1 != -inf) --- @@ -659,9 +659,9 @@ not ok 69 - floatComparisons(should FAIL: 1 != -inf) found: 1 (operandLeft) expected: -inf (operandRight) actual: 1 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... not ok 70 - floatComparisons(should FAIL: inf != max) --- @@ -671,9 +671,9 @@ not ok 70 - floatComparisons(should FAIL: inf != max) found: inf (operandLeft) expected: 3.40282e+38 (operandRight) actual: inf (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... not ok 71 - floatComparisons(should FAIL: inf != -max) --- @@ -683,9 +683,9 @@ not ok 71 - floatComparisons(should FAIL: inf != -max) found: inf (operandLeft) expected: -3.40282e+38 (operandRight) actual: inf (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... not ok 72 - floatComparisons(should FAIL: max != inf) --- @@ -695,9 +695,9 @@ not ok 72 - floatComparisons(should FAIL: max != inf) found: 3.40282e+38 (operandLeft) expected: inf (operandRight) actual: 3.40282e+38 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... not ok 73 - floatComparisons(should FAIL: -max != inf) --- @@ -707,9 +707,9 @@ not ok 73 - floatComparisons(should FAIL: -max != inf) found: -3.40282e+38 (operandLeft) expected: inf (operandRight) actual: -3.40282e+38 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... not ok 74 - floatComparisons(should FAIL: -inf != max) --- @@ -719,9 +719,9 @@ not ok 74 - floatComparisons(should FAIL: -inf != max) found: -inf (operandLeft) expected: 3.40282e+38 (operandRight) actual: -inf (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... not ok 75 - floatComparisons(should FAIL: -inf != -max) --- @@ -731,9 +731,9 @@ not ok 75 - floatComparisons(should FAIL: -inf != -max) found: -inf (operandLeft) expected: -3.40282e+38 (operandRight) actual: -inf (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... not ok 76 - floatComparisons(should FAIL: max != -inf) --- @@ -743,9 +743,9 @@ not ok 76 - floatComparisons(should FAIL: max != -inf) found: 3.40282e+38 (operandLeft) expected: -inf (operandRight) actual: 3.40282e+38 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... not ok 77 - floatComparisons(should FAIL: -max != -inf) --- @@ -755,11 +755,49 @@ not ok 77 - floatComparisons(should FAIL: -max != -inf) found: -3.40282e+38 (operandLeft) expected: -inf (operandRight) actual: -3.40282e+38 (operandLeft) - at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:124) + at: tst_float::floatComparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:127) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 124 + line: 127 ... -not ok 78 - compareFloatTests(1e0) +ok 78 - float16Comparisons(should SUCCEED 1) +not ok 79 - float16Comparisons(should FAIL 1) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: 3 (operandRight) + found: 1 (operandLeft) + expected: 3 (operandRight) + actual: 1 (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:200) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 200 + ... +not ok 80 - float16Comparisons(should FAIL 2) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: 0.0003 (operandRight) + found: 0.0001 (operandLeft) + expected: 0.0003 (operandRight) + actual: 0.0001 (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:200) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 200 + ... +not ok 81 - float16Comparisons(should FAIL 3) + --- + type: QCOMPARE + message: Compared qfloat16s are not the same (fuzzy compare) + wanted: 99 (operandRight) + found: 98 (operandLeft) + expected: 99 (operandRight) + actual: 98 (operandLeft) + at: tst_float::float16Comparisons() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:200) + file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp + line: 200 + ... +ok 82 - float16Comparisons(should SUCCEED 2) +not ok 83 - compareFloatTests(1e0) --- type: QCOMPARE message: Compared floats are not the same (fuzzy compare) @@ -767,11 +805,11 @@ not ok 78 - compareFloatTests(1e0) found: 1 (t1) expected: 3 (t3) actual: 1 (t1) - at: tst_float::compareFloatTests() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:206) + at: tst_float::compareFloatTests() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:245) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 206 + line: 245 ... -not ok 79 - compareFloatTests(1e-7) +not ok 84 - compareFloatTests(1e-7) --- type: QCOMPARE message: Compared floats are not the same (fuzzy compare) @@ -779,11 +817,11 @@ not ok 79 - compareFloatTests(1e-7) found: 1e-07 (t1) expected: 3e-07 (t3) actual: 1e-07 (t1) - at: tst_float::compareFloatTests() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:206) + at: tst_float::compareFloatTests() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:245) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 206 + line: 245 ... -not ok 80 - compareFloatTests(1e+7) +not ok 85 - compareFloatTests(1e+7) --- type: QCOMPARE message: Compared floats are not the same (fuzzy compare) @@ -791,12 +829,12 @@ not ok 80 - compareFloatTests(1e+7) found: 1e+07 (t1) expected: 3e+07 (t3) actual: 1e+07 (t1) - at: tst_float::compareFloatTests() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:206) + at: tst_float::compareFloatTests() (qtbase/tests/auto/testlib/selftests/float/tst_float.cpp:245) file: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp - line: 206 + line: 245 ... -ok 81 - cleanupTestCase() -1..81 -# tests 81 -# pass 16 -# fail 65 +ok 86 - cleanupTestCase() +1..86 +# tests 86 +# pass 18 +# fail 68 diff --git a/tests/auto/testlib/selftests/expected_float.teamcity b/tests/auto/testlib/selftests/expected_float.teamcity index 9166f644af..e23bc722b1 100644 --- a/tests/auto/testlib/selftests/expected_float.teamcity +++ b/tests/auto/testlib/selftests/expected_float.teamcity @@ -215,6 +215,19 @@ ##teamcity[testStarted name='floatComparisons(should FAIL: -max != -inf)' flowId='tst_float'] ##teamcity[testFailed name='floatComparisons(should FAIL: -max != -inf)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared floats are not the same (fuzzy compare)|n Actual (operandLeft) : -3.40282e+38|n Expected (operandRight): -inf' flowId='tst_float'] ##teamcity[testFinished name='floatComparisons(should FAIL: -max != -inf)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should SUCCEED 1)' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should SUCCEED 1)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL 1)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL 1)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : 1|n Expected (operandRight): 3' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL 1)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL 2)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL 2)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : 0.0001|n Expected (operandRight): 0.0003' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL 2)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should FAIL 3)' flowId='tst_float'] +##teamcity[testFailed name='float16Comparisons(should FAIL 3)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared qfloat16s are not the same (fuzzy compare)|n Actual (operandLeft) : 98|n Expected (operandRight): 99' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should FAIL 3)' flowId='tst_float'] +##teamcity[testStarted name='float16Comparisons(should SUCCEED 2)' flowId='tst_float'] +##teamcity[testFinished name='float16Comparisons(should SUCCEED 2)' flowId='tst_float'] ##teamcity[testStarted name='compareFloatTests(1e0)' flowId='tst_float'] ##teamcity[testFailed name='compareFloatTests(1e0)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)|]' details='Compared floats are not the same (fuzzy compare)|n Actual (t1): 1|n Expected (t3): 3' flowId='tst_float'] ##teamcity[testFinished name='compareFloatTests(1e0)' flowId='tst_float'] diff --git a/tests/auto/testlib/selftests/expected_float.txt b/tests/auto/testlib/selftests/expected_float.txt index 3134196a9c..6419a13f86 100644 --- a/tests/auto/testlib/selftests/expected_float.txt +++ b/tests/auto/testlib/selftests/expected_float.txt @@ -263,6 +263,20 @@ FAIL! : tst_float::floatComparisons(should FAIL: -max != -inf) Compared floats Actual (operandLeft) : -3.40282e+38 Expected (operandRight): -inf Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +PASS : tst_float::float16Comparisons(should SUCCEED 1) +FAIL! : tst_float::float16Comparisons(should FAIL 1) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 1 + Expected (operandRight): 3 + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +FAIL! : tst_float::float16Comparisons(should FAIL 2) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 0.0001 + Expected (operandRight): 0.0003 + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +FAIL! : tst_float::float16Comparisons(should FAIL 3) Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 98 + Expected (operandRight): 99 + Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] +PASS : tst_float::float16Comparisons(should SUCCEED 2) FAIL! : tst_float::compareFloatTests(1e0) Compared floats are not the same (fuzzy compare) Actual (t1): 1 Expected (t3): 3 @@ -276,5 +290,5 @@ FAIL! : tst_float::compareFloatTests(1e+7) Compared floats are not the same (fu Expected (t3): 3e+07 Loc: [qtbase/tests/auto/testlib/selftests/float/tst_float.cpp(0)] PASS : tst_float::cleanupTestCase() -Totals: 16 passed, 65 failed, 0 skipped, 0 blacklisted, 0ms +Totals: 18 passed, 68 failed, 0 skipped, 0 blacklisted, 0ms ********* Finished testing of tst_float ********* diff --git a/tests/auto/testlib/selftests/expected_float.xml b/tests/auto/testlib/selftests/expected_float.xml index da934eead3..65d2c5ad96 100644 --- a/tests/auto/testlib/selftests/expected_float.xml +++ b/tests/auto/testlib/selftests/expected_float.xml @@ -429,6 +429,33 @@ </Incident> <Duration msecs="0"/> </TestFunction> +<TestFunction name="float16Comparisons"> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[should SUCCEED 1]]></DataTag> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL 1]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 1 + Expected (operandRight): 3]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL 2]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 0.0001 + Expected (operandRight): 0.0003]]></Description> +</Incident> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> + <DataTag><![CDATA[should FAIL 3]]></DataTag> + <Description><![CDATA[Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 98 + Expected (operandRight): 99]]></Description> +</Incident> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[should SUCCEED 2]]></DataTag> +</Incident> + <Duration msecs="0"/> +</TestFunction> <TestFunction name="compareFloatTests"> <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/float/tst_float.cpp" line="0"> <DataTag><![CDATA[1e0]]></DataTag> diff --git a/tests/auto/testlib/selftests/expected_float.xunitxml b/tests/auto/testlib/selftests/expected_float.xunitxml index ba96b16fe6..9b2af9b616 100644 --- a/tests/auto/testlib/selftests/expected_float.xunitxml +++ b/tests/auto/testlib/selftests/expected_float.xunitxml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<testsuite errors="0" failures="65" tests="5" name="tst_float"> +<testsuite errors="0" failures="68" tests="6" name="tst_float"> <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> @@ -196,6 +196,17 @@ Actual (operandLeft) : -3.40282e+38 Expected (operandRight): -inf" result="fail"/> </testcase> + <testcase result="fail" name="float16Comparisons"> + <failure tag="should FAIL 1" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 1 + Expected (operandRight): 3" result="fail"/> + <failure tag="should FAIL 2" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 0.0001 + Expected (operandRight): 0.0003" result="fail"/> + <failure tag="should FAIL 3" message="Compared qfloat16s are not the same (fuzzy compare) + Actual (operandLeft) : 98 + Expected (operandRight): 99" result="fail"/> + </testcase> <testcase result="fail" name="compareFloatTests"> <failure tag="1e0" message="Compared floats are not the same (fuzzy compare) Actual (t1): 1 diff --git a/tests/auto/testlib/selftests/expected_testlib.lightxml b/tests/auto/testlib/selftests/expected_testlib.lightxml new file mode 100644 index 0000000000..47f5edc07d --- /dev/null +++ b/tests/auto/testlib/selftests/expected_testlib.lightxml @@ -0,0 +1,45 @@ +<Environment> + <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> + <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> +</Environment> +<TestFunction name="initTestCase"> +<Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="basics"> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/testlib/tst_testlib.cpp" line="0"> + <Description><![CDATA[Compared pointers are not the same]]></Description> +</Incident> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="delays"> +<Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="reals"> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[zero]]></DataTag> +</Incident> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[self-qQNaN]]></DataTag> +</Incident> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[self-qInf]]></DataTag> +</Incident> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[infineg]]></DataTag> +</Incident> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[Sin(turn/4)]]></DataTag> +</Incident> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[Cos(turn/2)]]></DataTag> +</Incident> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="cleanupTestCase"> +<Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> +</TestFunction> +<Duration msecs="0"/> diff --git a/tests/auto/testlib/selftests/expected_testlib.tap b/tests/auto/testlib/selftests/expected_testlib.tap new file mode 100644 index 0000000000..d85b23b7d4 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_testlib.tap @@ -0,0 +1,22 @@ +TAP version 13 +# tst_TestLib +ok 1 - initTestCase() +not ok 2 - basics() + --- + # Compared pointers are not the same + at: tst_TestLib::basics() (qtbase/tests/auto/testlib/selftests/testlib/tst_testlib.cpp:54) + file: qtbase/tests/auto/testlib/selftests/testlib/tst_testlib.cpp + line: 54 + ... +ok 3 - delays() +ok 4 - reals(zero) +ok 5 - reals(self-qQNaN) +ok 6 - reals(self-qInf) +ok 7 - reals(infineg) +ok 8 - reals(Sin(turn/4)) +ok 9 - reals(Cos(turn/2)) +ok 10 - cleanupTestCase() +1..10 +# tests 10 +# pass 9 +# fail 1 diff --git a/tests/auto/testlib/selftests/expected_testlib.teamcity b/tests/auto/testlib/selftests/expected_testlib.teamcity new file mode 100644 index 0000000000..11617121e2 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_testlib.teamcity @@ -0,0 +1,23 @@ +##teamcity[testSuiteStarted name='tst_TestLib' flowId='tst_TestLib'] +##teamcity[testStarted name='initTestCase()' flowId='tst_TestLib'] +##teamcity[testFinished name='initTestCase()' flowId='tst_TestLib'] +##teamcity[testStarted name='basics()' flowId='tst_TestLib'] +##teamcity[testFailed name='basics()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/testlib/tst_testlib.cpp(0)|]' details='Compared pointers are not the same' flowId='tst_TestLib'] +##teamcity[testFinished name='basics()' flowId='tst_TestLib'] +##teamcity[testStarted name='delays()' flowId='tst_TestLib'] +##teamcity[testFinished name='delays()' flowId='tst_TestLib'] +##teamcity[testStarted name='reals(zero)' flowId='tst_TestLib'] +##teamcity[testFinished name='reals(zero)' flowId='tst_TestLib'] +##teamcity[testStarted name='reals(self-qQNaN)' flowId='tst_TestLib'] +##teamcity[testFinished name='reals(self-qQNaN)' flowId='tst_TestLib'] +##teamcity[testStarted name='reals(self-qInf)' flowId='tst_TestLib'] +##teamcity[testFinished name='reals(self-qInf)' flowId='tst_TestLib'] +##teamcity[testStarted name='reals(infineg)' flowId='tst_TestLib'] +##teamcity[testFinished name='reals(infineg)' flowId='tst_TestLib'] +##teamcity[testStarted name='reals(Sin(turn/4))' flowId='tst_TestLib'] +##teamcity[testFinished name='reals(Sin(turn/4))' flowId='tst_TestLib'] +##teamcity[testStarted name='reals(Cos(turn/2))' flowId='tst_TestLib'] +##teamcity[testFinished name='reals(Cos(turn/2))' flowId='tst_TestLib'] +##teamcity[testStarted name='cleanupTestCase()' flowId='tst_TestLib'] +##teamcity[testFinished name='cleanupTestCase()' flowId='tst_TestLib'] +##teamcity[testSuiteFinished name='tst_TestLib' flowId='tst_TestLib'] diff --git a/tests/auto/testlib/selftests/expected_testlib.txt b/tests/auto/testlib/selftests/expected_testlib.txt new file mode 100644 index 0000000000..a3f463e7d4 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_testlib.txt @@ -0,0 +1,15 @@ +********* Start testing of tst_TestLib ********* +Config: Using QtTest library +PASS : tst_TestLib::initTestCase() +FAIL! : tst_TestLib::basics() Compared pointers are not the same + Loc: [qtbase/tests/auto/testlib/selftests/testlib/tst_testlib.cpp(0)] +PASS : tst_TestLib::delays() +PASS : tst_TestLib::reals(zero) +PASS : tst_TestLib::reals(self-qQNaN) +PASS : tst_TestLib::reals(self-qInf) +PASS : tst_TestLib::reals(infineg) +PASS : tst_TestLib::reals(Sin(turn/4)) +PASS : tst_TestLib::reals(Cos(turn/2)) +PASS : tst_TestLib::cleanupTestCase() +Totals: 9 passed, 1 failed, 0 skipped, 0 blacklisted, 0ms +********* Finished testing of tst_TestLib ********* diff --git a/tests/auto/testlib/selftests/expected_testlib.xml b/tests/auto/testlib/selftests/expected_testlib.xml new file mode 100644 index 0000000000..3aca904ac1 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_testlib.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<TestCase name="tst_TestLib"> +<Environment> + <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> + <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> +</Environment> +<TestFunction name="initTestCase"> +<Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="basics"> +<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/testlib/tst_testlib.cpp" line="0"> + <Description><![CDATA[Compared pointers are not the same]]></Description> +</Incident> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="delays"> +<Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="reals"> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[zero]]></DataTag> +</Incident> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[self-qQNaN]]></DataTag> +</Incident> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[self-qInf]]></DataTag> +</Incident> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[infineg]]></DataTag> +</Incident> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[Sin(turn/4)]]></DataTag> +</Incident> +<Incident type="pass" file="" line="0"> + <DataTag><![CDATA[Cos(turn/2)]]></DataTag> +</Incident> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="cleanupTestCase"> +<Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> +</TestFunction> +<Duration msecs="0"/> +</TestCase> diff --git a/tests/auto/testlib/selftests/expected_testlib.xunitxml b/tests/auto/testlib/selftests/expected_testlib.xunitxml new file mode 100644 index 0000000000..c9c67c7c9a --- /dev/null +++ b/tests/auto/testlib/selftests/expected_testlib.xunitxml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<testsuite errors="0" failures="1" tests="5" name="tst_TestLib"> + <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="basics"> + <failure message="Compared pointers are not the same" result="fail"/> + </testcase> + <testcase result="pass" name="delays"/> + <testcase result="pass" name="reals"/> + <testcase result="pass" name="cleanupTestCase"/> + <system-err/> +</testsuite> diff --git a/tests/auto/testlib/selftests/expected_watchdog.lightxml b/tests/auto/testlib/selftests/expected_watchdog.lightxml new file mode 100644 index 0000000000..1070324f2a --- /dev/null +++ b/tests/auto/testlib/selftests/expected_watchdog.lightxml @@ -0,0 +1,19 @@ +<Environment> + <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> + <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> +</Environment> +<TestFunction name="initTestCase"> +<Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="delay"> +<Message type="qfatal" file="" line="0"> + <Description><![CDATA[Test function timed out]]></Description> +</Message> +<Incident type="fail" file="Unknown file" line="0"> + <Description><![CDATA[Received a fatal error.]]></Description> +</Incident> + <Duration msecs="0"/> +</TestFunction> +<Duration msecs="0"/> diff --git a/tests/auto/testlib/selftests/expected_watchdog.tap b/tests/auto/testlib/selftests/expected_watchdog.tap new file mode 100644 index 0000000000..3d4890b67e --- /dev/null +++ b/tests/auto/testlib/selftests/expected_watchdog.tap @@ -0,0 +1,15 @@ +TAP version 13 +# tst_Watchdog +ok 1 - initTestCase() +# Test function timed out +not ok 2 - delay() + --- + # Received a fatal error. + at: tst_Watchdog::delay() (Unknown file:0) + file: Unknown file + line: 0 + ... +1..2 +# tests 2 +# pass 1 +# fail 1 diff --git a/tests/auto/testlib/selftests/expected_watchdog.teamcity b/tests/auto/testlib/selftests/expected_watchdog.teamcity new file mode 100644 index 0000000000..0d77bf70d5 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_watchdog.teamcity @@ -0,0 +1,8 @@ +##teamcity[testSuiteStarted name='tst_Watchdog' flowId='tst_Watchdog'] +##teamcity[testStarted name='initTestCase()' flowId='tst_Watchdog'] +##teamcity[testFinished name='initTestCase()' flowId='tst_Watchdog'] +##teamcity[testStarted name='delay()' flowId='tst_Watchdog'] +##teamcity[testFailed name='delay()' message='Failure! |[Loc: Unknown file(0)|]' details='Received a fatal error.' flowId='tst_Watchdog'] +##teamcity[testStdOut name='delay()' out='QFATAL: Test function timed out' flowId='tst_Watchdog'] +##teamcity[testFinished name='delay()' flowId='tst_Watchdog'] +##teamcity[testSuiteFinished name='tst_Watchdog' flowId='tst_Watchdog'] diff --git a/tests/auto/testlib/selftests/expected_watchdog.txt b/tests/auto/testlib/selftests/expected_watchdog.txt new file mode 100644 index 0000000000..4c9cde4ea2 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_watchdog.txt @@ -0,0 +1,8 @@ +********* Start testing of tst_Watchdog ********* +Config: Using QtTest library +PASS : tst_Watchdog::initTestCase() +QFATAL : tst_Watchdog::delay() Test function timed out +FAIL! : tst_Watchdog::delay() Received a fatal error. + Loc: [Unknown file(0)] +Totals: 1 passed, 1 failed, 0 skipped, 0 blacklisted, 0ms +********* Finished testing of tst_Watchdog ********* diff --git a/tests/auto/testlib/selftests/expected_watchdog.xml b/tests/auto/testlib/selftests/expected_watchdog.xml new file mode 100644 index 0000000000..f1642fba79 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_watchdog.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<TestCase name="tst_Watchdog"> +<Environment> + <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion> + <QtBuild/> + <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion> +</Environment> +<TestFunction name="initTestCase"> +<Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="delay"> +<Message type="qfatal" file="" line="0"> + <Description><![CDATA[Test function timed out]]></Description> +</Message> +<Incident type="fail" file="Unknown file" line="0"> + <Description><![CDATA[Received a fatal error.]]></Description> +</Incident> + <Duration msecs="0"/> +</TestFunction> +<Duration msecs="0"/> +</TestCase> diff --git a/tests/auto/testlib/selftests/expected_watchdog.xunitxml b/tests/auto/testlib/selftests/expected_watchdog.xunitxml new file mode 100644 index 0000000000..7e16ab2c34 --- /dev/null +++ b/tests/auto/testlib/selftests/expected_watchdog.xunitxml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<testsuite errors="1" failures="1" tests="2" name="tst_Watchdog"> + <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="delay"> + <!-- message="Test function timed out" type="qfatal" --> + <failure message="Received a fatal error." result="fail"/> + </testcase> + <system-err> +<![CDATA[Test function timed out]]> + </system-err> +</testsuite> diff --git a/tests/auto/testlib/selftests/expectfail/expectfail.pro b/tests/auto/testlib/selftests/expectfail/expectfail.pro index c1849990f2..db383bee6a 100644 --- a/tests/auto/testlib/selftests/expectfail/expectfail.pro +++ b/tests/auto/testlib/selftests/expectfail/expectfail.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = expectfail + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/failcleanup/failcleanup.pro b/tests/auto/testlib/selftests/failcleanup/failcleanup.pro index 426d7cc45b..12da5920fb 100644 --- a/tests/auto/testlib/selftests/failcleanup/failcleanup.pro +++ b/tests/auto/testlib/selftests/failcleanup/failcleanup.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = failcleanup + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/faildatatype/BLACKLIST b/tests/auto/testlib/selftests/faildatatype/BLACKLIST new file mode 100644 index 0000000000..bb1cae98e5 --- /dev/null +++ b/tests/auto/testlib/selftests/faildatatype/BLACKLIST @@ -0,0 +1,4 @@ +# See qtbase/src/testlib/qtestblacklist.cpp for format +# Incidental test: exercise more of the blacklisting code +[value:bool-as-string] +* diff --git a/tests/auto/testlib/selftests/faildatatype/faildatatype.pro b/tests/auto/testlib/selftests/faildatatype/faildatatype.pro new file mode 100644 index 0000000000..4ff7352555 --- /dev/null +++ b/tests/auto/testlib/selftests/faildatatype/faildatatype.pro @@ -0,0 +1,9 @@ +SOURCES += tst_faildatatype.cpp +QT = core testlib + +darwin: CONFIG -= app_bundle +CONFIG -= debug_and_release_target + +TARGET = faildatatype + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/faildatatype/tst_faildatatype.cpp b/tests/auto/testlib/selftests/faildatatype/tst_faildatatype.cpp new file mode 100644 index 0000000000..b49c7723ef --- /dev/null +++ b/tests/auto/testlib/selftests/faildatatype/tst_faildatatype.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include <QtTest/QtTest> + +class tst_FailDataType: public QObject +{ +Q_OBJECT +private slots: + void value_data() const; + void value() const; +}; + +void tst_FailDataType::value_data() const +{ + QTest::addColumn<QString>("value"); + + QTest::newRow("bool-as-string") << true; // assertion should fail here +} + +/*! \internal + This function should never be run because its _data() fails. + */ +void tst_FailDataType::value() const +{ + QFAIL("ERROR: this function is NOT supposed to be run."); +} + +QTEST_APPLESS_MAIN(tst_FailDataType) + +#include "tst_faildatatype.moc" diff --git a/tests/auto/testlib/selftests/failfetchtype/BLACKLIST b/tests/auto/testlib/selftests/failfetchtype/BLACKLIST new file mode 100644 index 0000000000..20a502724a --- /dev/null +++ b/tests/auto/testlib/selftests/failfetchtype/BLACKLIST @@ -0,0 +1,4 @@ +# See qtbase/src/testlib/qtestblacklist.cpp for format +# Incidental test: exercise more of the blacklisting code +[fetch:no-such-dataset] +* diff --git a/tests/auto/testlib/selftests/failfetchtype/failfetchtype.pro b/tests/auto/testlib/selftests/failfetchtype/failfetchtype.pro new file mode 100644 index 0000000000..5821018af4 --- /dev/null +++ b/tests/auto/testlib/selftests/failfetchtype/failfetchtype.pro @@ -0,0 +1,9 @@ +SOURCES += tst_failfetchtype.cpp +QT = core testlib + +darwin: CONFIG -= app_bundle +CONFIG -= debug_and_release_target + +TARGET = failfetchtype + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/failfetchtype/tst_failfetchtype.cpp b/tests/auto/testlib/selftests/failfetchtype/tst_failfetchtype.cpp new file mode 100644 index 0000000000..2dd32a5a5e --- /dev/null +++ b/tests/auto/testlib/selftests/failfetchtype/tst_failfetchtype.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include <QtTest/QtTest> + +class tst_FailFetchType: public QObject +{ +Q_OBJECT +private slots: + void fetch_data() const; + void fetch() const; +}; + +void tst_FailFetchType::fetch_data() const +{ + QTest::addColumn<bool>("value"); + + QTest::newRow("bool") << true; +} + +void tst_FailFetchType::fetch() const +{ + QFETCH(QString, value); // assertion should fail here + QFAIL("ERROR: this function is NOT supposed to be run."); +} + +QTEST_APPLESS_MAIN(tst_FailFetchType) + +#include "tst_failfetchtype.moc" diff --git a/tests/auto/testlib/selftests/failinit/failinit.pro b/tests/auto/testlib/selftests/failinit/failinit.pro index 6a30a5af68..46b1c3a6c4 100644 --- a/tests/auto/testlib/selftests/failinit/failinit.pro +++ b/tests/auto/testlib/selftests/failinit/failinit.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = failinit + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/failinitdata/failinitdata.pro b/tests/auto/testlib/selftests/failinitdata/failinitdata.pro index b608c67dbb..63b32cb6d6 100644 --- a/tests/auto/testlib/selftests/failinitdata/failinitdata.pro +++ b/tests/auto/testlib/selftests/failinitdata/failinitdata.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = failinitdata + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/fetchbogus/fetchbogus.pro b/tests/auto/testlib/selftests/fetchbogus/fetchbogus.pro index 33b306ca75..0fbb5e4c00 100644 --- a/tests/auto/testlib/selftests/fetchbogus/fetchbogus.pro +++ b/tests/auto/testlib/selftests/fetchbogus/fetchbogus.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = fetchbogus + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/findtestdata/findtestdata.pro b/tests/auto/testlib/selftests/findtestdata/findtestdata.pro index f04a640c59..7fbdaea3a3 100644 --- a/tests/auto/testlib/selftests/findtestdata/findtestdata.pro +++ b/tests/auto/testlib/selftests/findtestdata/findtestdata.pro @@ -7,3 +7,5 @@ CONFIG -= debug_and_release_target RESOURCES = findtestdata.qrc TARGET = findtestdata + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/float/float.pro b/tests/auto/testlib/selftests/float/float.pro index 95980eeac8..479eb152c5 100644 --- a/tests/auto/testlib/selftests/float/float.pro +++ b/tests/auto/testlib/selftests/float/float.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = float + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/float/tst_float.cpp b/tests/auto/testlib/selftests/float/tst_float.cpp index babb588f4b..49d00ac0e0 100644 --- a/tests/auto/testlib/selftests/float/tst_float.cpp +++ b/tests/auto/testlib/selftests/float/tst_float.cpp @@ -27,6 +27,7 @@ ****************************************************************************/ #include <QtCore/QCoreApplication> +#include <QtCore/qfloat16.h> #include <QtTest/QtTest> #include <QDebug> @@ -39,6 +40,8 @@ private slots: void doubleComparisons_data() const; void floatComparisons() const; void floatComparisons_data() const; + void float16Comparisons() const; + void float16Comparisons_data() const; void compareFloatTests() const; void compareFloatTests_data() const; }; @@ -189,6 +192,42 @@ void tst_float::floatComparisons_data() const } } +void tst_float::float16Comparisons() const +{ + QFETCH(qfloat16, operandLeft); + QFETCH(qfloat16, operandRight); + + QCOMPARE(operandLeft, operandRight); +} + +void tst_float::float16Comparisons_data() const +{ + QTest::addColumn<qfloat16>("operandLeft"); + QTest::addColumn<qfloat16>("operandRight"); + + QTest::newRow("should SUCCEED 1") + << qfloat16(0) + << qfloat16(0); + + QTest::newRow("should FAIL 1") + << qfloat16(1.000) + << qfloat16(3.000); + + QTest::newRow("should FAIL 2") + << qfloat16(1.000e-4f) + << qfloat16(3.000e-4f); + + // QCOMPARE for qfloat16s uses qFuzzyCompare() + + QTest::newRow("should FAIL 3") + << qfloat16(98) + << qfloat16(99); + + QTest::newRow("should SUCCEED 2") + << qfloat16(1001) + << qfloat16(1002); +} + void tst_float::compareFloatTests() const { QFETCH(float, t1); diff --git a/tests/auto/testlib/selftests/generate_expected_output.py b/tests/auto/testlib/selftests/generate_expected_output.py index 111870b3fb..9ec87c8fc6 100755 --- a/tests/auto/testlib/selftests/generate_expected_output.py +++ b/tests/auto/testlib/selftests/generate_expected_output.py @@ -221,8 +221,71 @@ class Scanner (object): print('tst_selftests.cpp names', d, "as a test, but it doesn't exist") del re +# Keep in sync with tst_selftests.cpp's processEnvironment(): +def baseEnv(platname=None, + keep=('PATH', 'QT_QPA_PLATFORM'), + posix=('HOME', 'USER', 'QEMU_SET_ENV', 'QEMU_LD_PREFIX'), + nonapple=('DISPLAY', 'XAUTHLOCALHOSTNAME'), # and XDG_* + # Don't actually know how to test for QNX, so this is ignored: + qnx=('GRAPHICS_ROOT', 'TZ'), + # Probably not actually relevant + preserveLib=('QT_PLUGIN_PATH', 'LD_LIBRARY_PATH'), + # Shall be modified on first call (a *copy* is returned): + cached={}): + """Lazily-evaluated standard environment for sub-tests to run in. + + This prunes the parent process environment, selecting a only those + variables we chose to keep. The platname passed to the first call + helps select which variables to keep. The environment computed + then is cached: a copy of this is returned on that call and each + subsequent call.\n""" + + if not cached: + xdg = False + # The platform module may be more apt for the platform tests here. + if os.name == 'posix': + keep += posix + if platname != 'darwin': + keep += nonapple + xdg = True + if 'QT_PRESERVE_TESTLIB_PATH' in os.environ: + keep += preserveLib + + cached = dict( + LC_ALL = 'C', # Use standard locale + # Avoid interference from any qtlogging.ini files, e.g. in + # /etc/xdg/QtProject/, (must match tst_selftests.cpp's + # processEnvironment()'s value): + QT_LOGGING_RULES = '*.debug=true;qt.*=false') + + for k, v in os.environ.items(): + if k in keep or (xdg and k.startswith('XDG_')): + cached[k] = v + + return cached.copy() + +def testEnv(testname, + # Make sure this matches tst_Selftests::doRunSubTest(): + extraEnv = { + "crashers": { "QTEST_DISABLE_CORE_DUMP": "1", + "QTEST_DISABLE_STACK_DUMP": "1" }, + "watchdog": { "QTEST_FUNCTION_TIMEOUT": "100" }, + }, + # Must match tst_Selftests::runSubTest_data(): + crashers = ("assert", "blacklisted", "crashes", "crashedterminate", + "exceptionthrow", "faildatatype", "failfetchtype", + "fetchbogus", "silent", "watchdog")): + """Determine the environment in which to run a test.""" + data = baseEnv() + if testname in crashers: + data.update(extraEnv["crashers"]) + if testname in extraEnv: + data.update(extraEnv[testname]) + return data + def generateTestData(testname, clean, formats = ('xml', 'txt', 'xunitxml', 'lightxml', 'teamcity', 'tap'), + # Make sure this matches tst_Selftests::runSubTest_data(): extraArgs = { "commandlinedata": "fiveTablePasses fiveTablePasses:fiveTablePasses_data1 -v2", "benchlibcallgrind": "-callgrind", @@ -249,26 +312,22 @@ def generateTestData(testname, clean, print("Warning: directory", testname, "contains no test executable") return + # Prepare environment in which to run tests: + env = testEnv(testname) + print(" running", testname) for format in formats: cmd = [path, '-' + format] if testname in extraArgs: cmd += extraArgs[testname].split() - data = subprocess.Popen(cmd, stdout=subprocess.PIPE, + data = subprocess.Popen(cmd, stdout=subprocess.PIPE, env=env, universal_newlines=True).communicate()[0] with open('expected_' + testname + '.' + format, 'w') as out: out.write('\n'.join(clean(data))) # write() appends a newline, too def main(name, *args): """Minimal argument parsing and driver for the real work""" - os.environ.update( - LC_ALL = 'C', # Use standard locale - # Avoid interference from any qtlogging.ini files, e.g. in - # /etc/xdg/QtProject/, (must match tst_selftests.cpp's - # processEnvironment()'s value): - QT_LOGGING_RULES = '*.debug=true;qt.*=false') - herePath = os.getcwd() cleaner = Cleaner(herePath, name) @@ -280,6 +339,7 @@ def main(name, *args): if __name__ == '__main__': # Executed when script is run, not when imported (e.g. to debug) import sys + baseEnv(sys.platform) # initializes its cache if sys.platform.startswith('win'): print("This script does not work on Windows.") diff --git a/tests/auto/testlib/selftests/globaldata/globaldata.pro b/tests/auto/testlib/selftests/globaldata/globaldata.pro index c0b1554c0f..621416c5b8 100644 --- a/tests/auto/testlib/selftests/globaldata/globaldata.pro +++ b/tests/auto/testlib/selftests/globaldata/globaldata.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = globaldata + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/keyboard/keyboard.pro b/tests/auto/testlib/selftests/keyboard/keyboard.pro index 0097318797..488c992e62 100644 --- a/tests/auto/testlib/selftests/keyboard/keyboard.pro +++ b/tests/auto/testlib/selftests/keyboard/keyboard.pro @@ -5,3 +5,5 @@ macos:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = keyboard + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/longstring/longstring.pro b/tests/auto/testlib/selftests/longstring/longstring.pro index d16ba85095..d8961203f3 100644 --- a/tests/auto/testlib/selftests/longstring/longstring.pro +++ b/tests/auto/testlib/selftests/longstring/longstring.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = longstring + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/maxwarnings/maxwarnings.pro b/tests/auto/testlib/selftests/maxwarnings/maxwarnings.pro index 79451af1ec..bdca0225d3 100644 --- a/tests/auto/testlib/selftests/maxwarnings/maxwarnings.pro +++ b/tests/auto/testlib/selftests/maxwarnings/maxwarnings.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = maxwarnings + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/mouse/mouse.pro b/tests/auto/testlib/selftests/mouse/mouse.pro index 7c06b8aa64..e5701eee0f 100644 --- a/tests/auto/testlib/selftests/mouse/mouse.pro +++ b/tests/auto/testlib/selftests/mouse/mouse.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = mouse + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/multiexec/multiexec.pro b/tests/auto/testlib/selftests/multiexec/multiexec.pro index 2038acbd31..e9b2b7b587 100644 --- a/tests/auto/testlib/selftests/multiexec/multiexec.pro +++ b/tests/auto/testlib/selftests/multiexec/multiexec.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = multiexec + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/pairdiagnostics/pairdiagnostics.pro b/tests/auto/testlib/selftests/pairdiagnostics/pairdiagnostics.pro index 1c07c93e9d..25f5bfe809 100644 --- a/tests/auto/testlib/selftests/pairdiagnostics/pairdiagnostics.pro +++ b/tests/auto/testlib/selftests/pairdiagnostics/pairdiagnostics.pro @@ -4,3 +4,5 @@ QT = core testlib CONFIG -= app_bundle debug_and_release_target TARGET = pairdiagnostics + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/printdatatags/printdatatags.pro b/tests/auto/testlib/selftests/printdatatags/printdatatags.pro index cd06384835..83f171aac5 100644 --- a/tests/auto/testlib/selftests/printdatatags/printdatatags.pro +++ b/tests/auto/testlib/selftests/printdatatags/printdatatags.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = printdatatags + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro b/tests/auto/testlib/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro index f1cf25d104..00ca4a0e62 100644 --- a/tests/auto/testlib/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro +++ b/tests/auto/testlib/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = printdatatagswithglobaltags + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/qexecstringlist/qexecstringlist.pro b/tests/auto/testlib/selftests/qexecstringlist/qexecstringlist.pro index bd967f32e6..4d7af8ab40 100644 --- a/tests/auto/testlib/selftests/qexecstringlist/qexecstringlist.pro +++ b/tests/auto/testlib/selftests/qexecstringlist/qexecstringlist.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = qexecstringlist + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/selftests.pri b/tests/auto/testlib/selftests/selftests.pri index 05ed6d9905..b4568dd3e1 100644 --- a/tests/auto/testlib/selftests/selftests.pri +++ b/tests/auto/testlib/selftests/selftests.pri @@ -21,6 +21,8 @@ SUBPROGRAMS = \ exceptionthrow \ expectfail \ failcleanup \ + faildatatype \ + failfetchtype \ failinit \ failinitdata \ fetchbogus \ @@ -43,11 +45,13 @@ SUBPROGRAMS = \ sleep \ strcmp \ subtest \ + testlib \ tuplediagnostics \ verbose1 \ verbose2 \ verifyexceptionthrown \ warnings \ + watchdog \ xunit qtHaveModule(gui): SUBPROGRAMS += \ diff --git a/tests/auto/testlib/selftests/silent/silent.pro b/tests/auto/testlib/selftests/silent/silent.pro index 3150f65a5e..3f6325a010 100644 --- a/tests/auto/testlib/selftests/silent/silent.pro +++ b/tests/auto/testlib/selftests/silent/silent.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = silent + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/singleskip/singleskip.pro b/tests/auto/testlib/selftests/singleskip/singleskip.pro index 9f63e62747..a32c22c943 100644 --- a/tests/auto/testlib/selftests/singleskip/singleskip.pro +++ b/tests/auto/testlib/selftests/singleskip/singleskip.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = singleskip + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/skip/skip.pro b/tests/auto/testlib/selftests/skip/skip.pro index 8780d295cf..19a01908af 100644 --- a/tests/auto/testlib/selftests/skip/skip.pro +++ b/tests/auto/testlib/selftests/skip/skip.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = skip + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/skipcleanup/skipcleanup.pro b/tests/auto/testlib/selftests/skipcleanup/skipcleanup.pro index f98cda7596..059132b5a6 100644 --- a/tests/auto/testlib/selftests/skipcleanup/skipcleanup.pro +++ b/tests/auto/testlib/selftests/skipcleanup/skipcleanup.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = skipcleanup + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/skipinit/skipinit.pro b/tests/auto/testlib/selftests/skipinit/skipinit.pro index 7defce9a52..6605226993 100644 --- a/tests/auto/testlib/selftests/skipinit/skipinit.pro +++ b/tests/auto/testlib/selftests/skipinit/skipinit.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = skipinit + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/skipinitdata/skipinitdata.pro b/tests/auto/testlib/selftests/skipinitdata/skipinitdata.pro index cd806c2a43..176955500b 100644 --- a/tests/auto/testlib/selftests/skipinitdata/skipinitdata.pro +++ b/tests/auto/testlib/selftests/skipinitdata/skipinitdata.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = skipinitdata + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/sleep/sleep.pro b/tests/auto/testlib/selftests/sleep/sleep.pro index affcba22ee..b109bf6253 100644 --- a/tests/auto/testlib/selftests/sleep/sleep.pro +++ b/tests/auto/testlib/selftests/sleep/sleep.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = sleep + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/strcmp/strcmp.pro b/tests/auto/testlib/selftests/strcmp/strcmp.pro index f5f6eecc88..35a4c5e858 100644 --- a/tests/auto/testlib/selftests/strcmp/strcmp.pro +++ b/tests/auto/testlib/selftests/strcmp/strcmp.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = strcmp + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/subtest/subtest.pro b/tests/auto/testlib/selftests/subtest/subtest.pro index 09dee1b1b9..b5c294aed6 100644 --- a/tests/auto/testlib/selftests/subtest/subtest.pro +++ b/tests/auto/testlib/selftests/subtest/subtest.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = subtest + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/test/test.pro b/tests/auto/testlib/selftests/test/test.pro index ec1633ebff..fce8e48ca2 100644 --- a/tests/auto/testlib/selftests/test/test.pro +++ b/tests/auto/testlib/selftests/test/test.pro @@ -19,3 +19,4 @@ RESOURCES += expected_files include(../selftests.pri) !android:!winrt: for(file, SUBPROGRAMS): TEST_HELPER_INSTALLS += "../$${file}/$${file}" +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/testlib/testlib.pro b/tests/auto/testlib/selftests/testlib/testlib.pro new file mode 100644 index 0000000000..8798f86b18 --- /dev/null +++ b/tests/auto/testlib/selftests/testlib/testlib.pro @@ -0,0 +1,9 @@ +SOURCES += tst_testlib.cpp +QT = core testlib + +darwin: CONFIG -= app_bundle +CONFIG -= debug_and_release_target + +TARGET = testlib + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/testlib/tst_testlib.cpp b/tests/auto/testlib/selftests/testlib/tst_testlib.cpp new file mode 100644 index 0000000000..38a71be732 --- /dev/null +++ b/tests/auto/testlib/selftests/testlib/tst_testlib.cpp @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtTest/QtTest> +#include <QtCore/QtMath> +#include <QtCore/QtNumeric> + +/* Test QTest functions not covered by other parts of the selftest. Tests that + * involve crashing or exiting should be added as separate tests in their own + * right. Tests that form a coherent group on a related theme should also go in + * their own directory. Tests that fail in order to exercise QTest internals + * are fine. + */ + +class tst_TestLib : public QObject +{ +Q_OBJECT +private slots: + void basics() const; + void delays() const; + void reals_data() const; + void reals() const; +}; + +void tst_TestLib::basics() const +{ + QVERIFY(QByteArray(QTest::currentAppName()).contains("testlib")); + + QCOMPARE(QTest::testObject(), nullptr); // last, because it should fail +} + +QT_BEGIN_NAMESPACE + +namespace QTest { + // Defined; not declared in the public header, but used by qtdeclarative. + int defaultKeyDelay(); + int defaultMouseDelay(); +} + +QT_END_NAMESPACE + +void tst_TestLib::delays() const +{ + QVERIFY(QTest::defaultMouseDelay() >= 0); + QVERIFY(QTest::defaultKeyDelay() >= 0); +} + +void tst_TestLib::reals_data() const +{ + QTest::addColumn<double>("actual"); + QTest::addColumn<double>("expected"); + + QTest::newRow("zero") << 0.0 << 0.0; +#define ADDROW(func) QTest::addRow("self-%s", #func) << func() << func() + ADDROW(qQNaN); + ADDROW(qInf); +#undef ADDROW // Just used so as to exercise addRow() + QTest::newRow("infineg") << -qInf() << -qInf(); + QTest::newRow("Sin(turn/4)") << qSin(9 * M_PI_2) << 1.0; + QTest::newRow("Cos(turn/2)") << qCos(15 * M_PI) << -1.0; +} + +void tst_TestLib::reals() const +{ + QFETCH(double, actual); + QFETCH(double, expected); + QCOMPARE(actual, expected); +} + +QTEST_APPLESS_MAIN(tst_TestLib) + +#include "tst_testlib.moc" diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index 8baca5bdad..3ef15b9261 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -468,10 +468,13 @@ void tst_Selftests::runSubTest_data() #endif << "expectfail" << "failcleanup" +#ifndef Q_OS_WIN // these assert, by design; so same problem as "assert" + << "faildatatype" + << "failfetchtype" +#endif << "failinit" << "failinitdata" -#if !defined(Q_OS_WIN) - // Disable this test on Windows, as the run-time will popup dialogs with warnings +#ifndef Q_OS_WIN // asserts, by design; so same problem as "assert" << "fetchbogus" #endif << "findtestdata" @@ -494,6 +497,7 @@ void tst_Selftests::runSubTest_data() << "sleep" << "strcmp" << "subtest" + << "testlib" << "tuplediagnostics" << "verbose1" << "verbose2" @@ -502,6 +506,7 @@ void tst_Selftests::runSubTest_data() << "verifyexceptionthrown" #endif //!QT_NO_EXCEPTIONS << "warnings" + << "watchdog" << "xunit" ; @@ -520,6 +525,7 @@ void tst_Selftests::runSubTest_data() foreach (QString const& subtest, tests) { QStringList arguments = loggerSet.arguments; + // Keep in sync with generateTestData()'s extraArgs in generate_expected_output.py: if (subtest == "commandlinedata") { arguments << QString("fiveTablePasses fiveTablePasses:fiveTablePasses_data1 -v2").split(' '); } @@ -612,10 +618,12 @@ void tst_Selftests::runSubTest_data() if (loggerSet.name.contains("teamcity") && subtest.startsWith("benchlib")) continue; // Skip benchmark for TeamCity logger + // Keep in sync with generateTestData()'s crashers in generate_expected_output.py: const bool crashes = subtest == QLatin1String("assert") || subtest == QLatin1String("exceptionthrow") || subtest == QLatin1String("fetchbogus") || subtest == QLatin1String("crashedterminate") + || subtest == QLatin1String("faildatatype") || subtest == QLatin1String("failfetchtype") || subtest == QLatin1String("crashes") || subtest == QLatin1String("silent") - || subtest == QLatin1String("blacklisted"); + || subtest == QLatin1String("blacklisted") || subtest == QLatin1String("watchdog"); QTest::newRow(qPrintable(QString("%1 %2").arg(subtest).arg(loggerSet.name))) << subtest << loggers @@ -690,9 +698,12 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge QProcess proc; QProcessEnvironment environment = processEnvironment(); + // Keep in sync with generateTestData()'s extraEnv in generate_expected_output.py: if (crashes) { environment.insert("QTEST_DISABLE_CORE_DUMP", "1"); environment.insert("QTEST_DISABLE_STACK_DUMP", "1"); + if (subdir == QLatin1String("watchdog")) + environment.insert("QTEST_FUNCTION_TIMEOUT", "100"); } proc.setProcessEnvironment(environment); const QString path = subdir + QLatin1Char('/') + subdir; @@ -735,6 +746,7 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge if (subdir != QLatin1String("exceptionthrow") && subdir != QLatin1String("cmptest") // QImage comparison requires QGuiApplication && subdir != QLatin1String("fetchbogus") + && subdir != QLatin1String("watchdog") && subdir != QLatin1String("xunit") #ifdef Q_CC_MINGW && subdir != QLatin1String("blacklisted") // calls qFatal() @@ -742,11 +754,13 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge #endif #ifdef Q_OS_LINUX // QEMU outputs to stderr about uncaught signals - && (!EmulationDetector::isRunningArmOnX86() || - (subdir != QLatin1String("blacklisted") - && subdir != QLatin1String("silent") - && subdir != QLatin1String("assert") - && subdir != QLatin1String("crashes") + && !(EmulationDetector::isRunningArmOnX86() && + (subdir == QLatin1String("assert") + || subdir == QLatin1String("blacklisted") + || subdir == QLatin1String("crashes") + || subdir == QLatin1String("faildatatype") + || subdir == QLatin1String("failfetchtype") + || subdir == QLatin1String("silent") ) ) #endif @@ -887,16 +901,20 @@ bool tst_Selftests::compareLine(const QString &logger, const QString &subdir, const QString &actualLine, const QString &expectedLine, QString *errorMessage) const { - if (subdir == QLatin1String("assert") && actualLine.contains(QLatin1String("ASSERT: ")) - && expectedLine.contains(QLatin1String("ASSERT: ")) && actualLine != expectedLine) { + if (actualLine == expectedLine) + return true; + + if ((subdir == QLatin1String("assert") + || subdir == QLatin1String("faildatatype") || subdir == QLatin1String("failfetchtype")) + && actualLine.contains(QLatin1String("ASSERT: ")) + && expectedLine.contains(QLatin1String("ASSERT: "))) { // Q_ASSERT uses __FILE__, the exact contents of which are // undefined. If have we something that looks like a Q_ASSERT and we // were expecting to see a Q_ASSERT, we'll skip the line. return true; } - if (expectedLine.startsWith(QLatin1String("FAIL! : tst_Exception::throwException() Caught unhandled exce")) - && actualLine != expectedLine) { + if (expectedLine.startsWith(QLatin1String("FAIL! : tst_Exception::throwException() Caught unhandled exce"))) { // On some platforms we compile without RTTI, and as a result we never throw an exception if (actualLine.simplified() != QLatin1String("tst_Exception::throwException()")) { *errorMessage = QString::fromLatin1("'%1' != 'tst_Exception::throwException()'").arg(actualLine); @@ -935,9 +953,6 @@ bool tst_Selftests::compareLine(const QString &logger, const QString &subdir, if (actualLine.startsWith(QLatin1String("Totals:")) && expectedLine.startsWith(QLatin1String("Totals:"))) return true; - if (actualLine == expectedLine) - return true; - *errorMessage = msgMismatch(actualLine, expectedLine); return false; } diff --git a/tests/auto/testlib/selftests/tuplediagnostics/tuplediagnostics.pro b/tests/auto/testlib/selftests/tuplediagnostics/tuplediagnostics.pro index 7a29e0e5e1..f338170b81 100644 --- a/tests/auto/testlib/selftests/tuplediagnostics/tuplediagnostics.pro +++ b/tests/auto/testlib/selftests/tuplediagnostics/tuplediagnostics.pro @@ -4,3 +4,5 @@ QT = core testlib CONFIG -= app_bundle debug_and_release_target TARGET = tuplediagnostics + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/verbose1/verbose1.pro b/tests/auto/testlib/selftests/verbose1/verbose1.pro index f00ae69d17..1f16d70d66 100644 --- a/tests/auto/testlib/selftests/verbose1/verbose1.pro +++ b/tests/auto/testlib/selftests/verbose1/verbose1.pro @@ -8,3 +8,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = verbose1 + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/verbose2/verbose2.pro b/tests/auto/testlib/selftests/verbose2/verbose2.pro index 796cdeb975..bf54904488 100644 --- a/tests/auto/testlib/selftests/verbose2/verbose2.pro +++ b/tests/auto/testlib/selftests/verbose2/verbose2.pro @@ -8,3 +8,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = verbose2 + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/verifyexceptionthrown/verifyexceptionthrown.pro b/tests/auto/testlib/selftests/verifyexceptionthrown/verifyexceptionthrown.pro index 51f108c9d7..198d35dc6c 100644 --- a/tests/auto/testlib/selftests/verifyexceptionthrown/verifyexceptionthrown.pro +++ b/tests/auto/testlib/selftests/verifyexceptionthrown/verifyexceptionthrown.pro @@ -6,3 +6,5 @@ CONFIG -= debug_and_release_target CONFIG += exceptions TARGET = verifyexceptionthrown + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/warnings/warnings.pro b/tests/auto/testlib/selftests/warnings/warnings.pro index 0c6cddcefb..a0bd2c62ba 100644 --- a/tests/auto/testlib/selftests/warnings/warnings.pro +++ b/tests/auto/testlib/selftests/warnings/warnings.pro @@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = warnings + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/watchdog/tst_watchdog.cpp b/tests/auto/testlib/selftests/watchdog/tst_watchdog.cpp new file mode 100644 index 0000000000..2f29609f71 --- /dev/null +++ b/tests/auto/testlib/selftests/watchdog/tst_watchdog.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtTest/QtTest> + +class tst_Watchdog : public QObject +{ + Q_OBJECT +private slots: + void delay() const; +}; + +void tst_Watchdog::delay() const +{ + bool ok = false; + const int fiveMinutes = 5 * 60 * 1000; + // Use the same env.var as the watch-dog and add a little to it: + const int timeout = qEnvironmentVariableIntValue("QTEST_FUNCTION_TIMEOUT", &ok); + QTest::qSleep(5000 + (ok && timeout > 0 ? timeout : fiveMinutes)); + // The watchdog timer should have interrupted us by now. + QFAIL("ERROR: this function should be interrupted."); +} + +QTEST_APPLESS_MAIN(tst_Watchdog) + +#include "tst_watchdog.moc" diff --git a/tests/auto/testlib/selftests/watchdog/watchdog.pro b/tests/auto/testlib/selftests/watchdog/watchdog.pro new file mode 100644 index 0000000000..ddcc3f6ca2 --- /dev/null +++ b/tests/auto/testlib/selftests/watchdog/watchdog.pro @@ -0,0 +1,14 @@ +SOURCES += tst_watchdog.cpp +QT = core testlib + +darwin: CONFIG -= app_bundle +CONFIG -= debug_and_release_target + +TARGET = watchdog + +# The test deliberately times out; so tell it to do so quickly +checkenv.name = QTEST_FUNCTION_TIMEOUT +checkenv.value = 100 +QT_TOOL_ENV += checkenv + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/selftests/xunit/xunit.pro b/tests/auto/testlib/selftests/xunit/xunit.pro index b8c606e828..becb46ce8b 100644 --- a/tests/auto/testlib/selftests/xunit/xunit.pro +++ b/tests/auto/testlib/selftests/xunit/xunit.pro @@ -6,3 +6,5 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target TARGET = xunit + +include($$QT_SOURCE_TREE/src/testlib/selfcover.pri) diff --git a/tests/auto/testlib/testlib.pro b/tests/auto/testlib/testlib.pro index 25ccc591d6..587c76a189 100644 --- a/tests/auto/testlib/testlib.pro +++ b/tests/auto/testlib/testlib.pro @@ -1,6 +1,7 @@ -TEMPLATE=subdirs -SUBDIRS=\ +TEMPLATE = subdirs +SUBDIRS = \ + outformat \ qsignalspy \ selftests \ -qtHaveModule(widgets):SUBDIRS += qabstractitemmodeltester +qtHaveModule(widgets): SUBDIRS += qabstractitemmodeltester diff --git a/tests/auto/testserver.pri b/tests/auto/testserver.pri index b2f593235f..26e7f6ab8a 100644 --- a/tests/auto/testserver.pri +++ b/tests/auto/testserver.pri @@ -51,37 +51,142 @@ # 2. testserver_clean - Clean up server containers/images and tidy away related # files. -TESTSERVER_COMPOSE_FILE = $$dirname(_QMAKE_CONF_)/tests/testserver/docker-compose.yml -TESTSERVER_VERSION = $$system(docker-compose --version) +# The docker test server should only be integrated in the leaf Makefile. +# If debug_and_release option is in use, skip the meta-Makefile except for +# Makefile.Debug and Makefile.Release. +debug_and_release:!build_pass: return() -equals(QMAKE_HOST.os, Windows)|isEmpty(TESTSERVER_VERSION) { +DOCKER_ENABLED = 1 + +equals(QMAKE_HOST.os, Darwin) { + DOCKER_ENABLED = 0 + message("Not using docker network test server on macOS, see QTQAINFRA-2717 and QTQAINFRA-2750") +} + +TESTSERVER_VERSION = "" + +equals(DOCKER_ENABLED, 1) { + TESTSERVER_VERSION = $$system(docker-compose --version) +} + +isEmpty(TESTSERVER_VERSION) { # Make check with server "qt-test-server.qt-test-net" as a fallback - message("testserver: qt-test-server.qt-test-net") } else { - # Make check with test servers - message("testserver:" $$TESTSERVER_VERSION) + # Make check with docker test servers + equals(QMAKE_HOST.os, Linux) { + # For the platform supporting docker bridge network, each container is + # assigned a unique hostname and connected to the same network domain + # to communicate with the others. + DEFINES += QT_TEST_SERVER_NAME + DNSDOMAIN = test-net.qt.local + } else { + # For the others, the containers are deployed into a virtual machine + # using the host network. All the containers share the same hostname of + # the virtual machine, and they are connected to the same network domain. + # NOTE: In Windows, Apple Bonjour only works within a single local domain. + DNSDOMAIN = local + } + + equals(QMAKE_HOST.os, Darwin) { + # There is no docker bridge on macOS. It is impossible to ping a container. + # Docker docs recommends using port mapping to connect to a container; + # but it causes a port conflict if the user is running a service that + # binds the same port on the host. An alternative solution is to deploy + # the docker environment into VirtualBox using docker-machine. + TESTSERVER_COMPOSE_FILE = \ + $$dirname(_QMAKE_CONF_)/tests/testserver/docker-compose-for-macOS.yml + + # The connection configuration for the target machine + MACHINE_CONFIG = $(shell docker-machine config qt-test-server) + + # The environment variables passed to the docker-compose file + TEST_ENV = 'MACHINE_IP=$(shell docker-machine ip qt-test-server)' + TEST_ENV += 'TEST_DOMAIN=$$DNSDOMAIN' + TEST_CMD = env + } else:equals(QMAKE_HOST.os, Windows) { + # There is no docker bridge on Windows. It is impossible to ping a container. + # Use docker-machine to deploy the docker environment into VirtualBox. + TESTSERVER_COMPOSE_FILE = \ + $$dirname(_QMAKE_CONF_)/tests/testserver/docker-compose-for-windows.yml + + # The connection configuration for the target machine + MACHINE_CONFIG = (docker-machine config qt-test-server) + + # The environment variables passed to the docker-compose file + TEST_ENV = '\$\$env:MACHINE_IP = docker-machine ip qt-test-server;' + TEST_ENV += '\$\$env:TEST_DOMAIN = $$shell_quote(\"$$DNSDOMAIN\");' + + # Docker-compose CLI environment variables: + # Enable path conversion from Windows-style to Unix-style in volume definitions. + TEST_ENV += '\$\$env:COMPOSE_CONVERT_WINDOWS_PATHS = $$shell_quote(\"true\");' + + TEST_CMD = 'PowerShell -noprofile' + CONFIG += PowerShell + } else { + TESTSERVER_COMPOSE_FILE = $$dirname(_QMAKE_CONF_)/tests/testserver/docker-compose.yml + + # The environment variables passed to the docker-compose file + TEST_ENV = 'TEST_DOMAIN=$$DNSDOMAIN' + TEST_CMD = env + } + + # The domain name is relevant to https keycert (qnetworkreply/crts/qt-test-net-cacert.pem). + DEFINES += QT_TEST_SERVER QT_TEST_SERVER_DOMAIN=$$shell_quote(\"$${DNSDOMAIN}\") # Ensure that the docker-compose file is provided. It is a configuration # file which is mandatory for all docker-compose commands. You can get more # detail from the description of TESTSERVER_COMPOSE_FILE above. There is # also an example showing how to configure it manually. FILE_PRETEST_MSG = "Project variable 'TESTSERVER_COMPOSE_FILE' is not set" - testserver_pretest.commands = $(if $$TESTSERVER_COMPOSE_FILE,,$(error $$FILE_PRETEST_MSG)) + PowerShell { + testserver_pretest.commands = echo $$TESTSERVER_VERSION && + testserver_pretest.commands += \ + $$TEST_CMD if ([String]::IsNullOrEmpty($$shell_quote(\"$$TESTSERVER_COMPOSE_FILE\"))) \ + {Write-Error $$shell_quote(\"$$FILE_PRETEST_MSG\")} && + } else { + testserver_pretest.commands = $(info "testserver:" $$TESTSERVER_VERSION) + testserver_pretest.commands += $(if $$TESTSERVER_COMPOSE_FILE,,$(error $$FILE_PRETEST_MSG)) + } + + # Make sure docker-machine is both created and running. The docker_machine + # script is used to deploy the docker environment into VirtualBox. + # Example: qt5/coin/provisioning/common/shared/testserver/docker_machine.sh + !isEmpty(MACHINE_CONFIG) { + MACHINE_LIST_CMD = docker-machine ls -q --filter "Name=^qt-test-server\$\$" + MACHINE_LIST_MSG = "Docker machine qt-test-server not found" + PowerShell { + testserver_pretest.commands += $$TEST_CMD if (!($$MACHINE_LIST_CMD)) \ + {Write-Error $$shell_quote(\"$$MACHINE_LIST_MSG\")} && + } else { + testserver_pretest.commands += \ + $(if $(shell $$MACHINE_LIST_CMD),,$(error $$MACHINE_LIST_MSG)) + } + + MACHINE_STATE_CMD = \ + docker-machine ls -q --filter "State=Running" --filter "Name=^qt-test-server\$\$" + MACHINE_START_CMD = docker-machine start qt-test-server + MACHINE_RECERT = docker-machine regenerate-certs -f qt-test-server + PowerShell { + testserver_pretest.commands += \ + $$TEST_CMD if (!($$MACHINE_STATE_CMD)) {$$MACHINE_START_CMD; $$MACHINE_RECERT} && + } else { + testserver_pretest.commands += \ + $(if $(shell $$MACHINE_STATE_CMD),,\ + $(shell $$MACHINE_START_CMD > /dev/null && $$MACHINE_RECERT > /dev/null)) + } + } # Before starting the test servers, it requires the user to run the setup # script (coin/provisioning/.../testserver/docker_testserver.sh) in advance. - IMAGE_PRETEST_CMD = docker images -aq "qt-test-server-*" + IMAGE_PRETEST_CMD = docker $$MACHINE_CONFIG images -aq "qt-test-server-*" IMAGE_PRETEST_MSG = "Docker image qt-test-server-* not found" - testserver_pretest.commands += $(if $(shell $$IMAGE_PRETEST_CMD),,$(error $$IMAGE_PRETEST_MSG)) - - # The domain name is relevant to https keycert (qnetworkreply/crts/qt-test-net-cacert.pem). - DNSDOMAIN = test-net.qt.local - TEST_ENV += TESTSERVER_DOMAIN=$$DNSDOMAIN - DEFINES += QT_TEST_SERVER QT_TEST_SERVER_DOMAIN=$$shell_quote(\"$${DNSDOMAIN}\") - - # There is no docker bridge on macOS. It is impossible to ping a container. - # Docker docs recommends using port mapping to connect to a container. - equals(QMAKE_HOST.os, Darwin): TEST_ENV += TESTSERVER_BIND_LOCAL=1 + PowerShell { + testserver_pretest.commands += $$TEST_CMD if (!($$IMAGE_PRETEST_CMD)) \ + {Write-Error $$shell_quote(\"$$IMAGE_PRETEST_MSG\")} + } else { + testserver_pretest.commands += \ + $(if $(shell $$IMAGE_PRETEST_CMD),,$(error $$IMAGE_PRETEST_MSG)) + } # Rename the check target of testcase feature check.target = check_network @@ -91,18 +196,20 @@ equals(QMAKE_HOST.os, Windows)|isEmpty(TESTSERVER_VERSION) { testserver_test.depends = testserver_pretest # Bring up test servers and make sure the services are ready. - testserver_test.commands = $$TEST_ENV docker-compose -f $$TESTSERVER_COMPOSE_FILE up -d \ - --force-recreate --timeout 1 $${QT_TEST_SERVER_LIST} && + !isEmpty(TEST_CMD): testserver_test.commands = $$TEST_CMD $$TEST_ENV + testserver_test.commands += docker-compose $$MACHINE_CONFIG -f $$TESTSERVER_COMPOSE_FILE up \ + --detach --force-recreate --timeout 1 $${QT_TEST_SERVER_LIST} && # Check test cases with docker-based test servers. - testserver_test.commands += $(MAKE) check_network; + testserver_test.commands += $(MAKE) -f $(MAKEFILE) check_network && # Stop and remove test servers after testing. - testserver_test.commands += $$TEST_ENV docker-compose -f $$TESTSERVER_COMPOSE_FILE down \ + !isEmpty(TEST_CMD): testserver_test.commands += $$TEST_CMD $$TEST_ENV + testserver_test.commands += docker-compose $$MACHINE_CONFIG -f $$TESTSERVER_COMPOSE_FILE down \ --timeout 1 # Destroy test servers and tidy away related files. - testserver_clean.commands = $$TEST_ENV docker-compose -f $$TESTSERVER_COMPOSE_FILE down \ + testserver_clean.commands = docker-compose $$MACHINE_CONFIG -f $$TESTSERVER_COMPOSE_FILE down \ --rmi all QMAKE_EXTRA_TARGETS += testserver_pretest testserver_test testserver_clean diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 41bc4bc73b..50321c322b 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -683,6 +683,7 @@ private slots: void finalClasses(); void explicitOverrideControl_data(); void explicitOverrideControl(); + void overloadedAddressOperator(); void autoPropertyMetaTypeRegistration(); void autoMethodArgumentMetaTypeRegistration(); void autoSignalSpyMetaTypeRegistration(); @@ -2943,6 +2944,34 @@ void tst_Moc::explicitOverrideControl() #endif } +class OverloadedAddressOperator : public QObject +{ + Q_OBJECT +public: + void* operator&() { return nullptr; } +signals: + void self(OverloadedAddressOperator&); +public slots: + void assertSelf(OverloadedAddressOperator &o) + { + QCOMPARE(std::addressof(o), this); + testResult = (std::addressof(o) == this); + } +public: + bool testResult = false; +}; + +void tst_Moc::overloadedAddressOperator() +{ + OverloadedAddressOperator o; + OverloadedAddressOperator *p = std::addressof(o); + QCOMPARE(&o, nullptr); + QVERIFY(p); + QObject::connect(p, &OverloadedAddressOperator::self, p, &OverloadedAddressOperator::assertSelf); + emit o.self(o); + QVERIFY(o.testResult); +} + class CustomQObject : public QObject { Q_OBJECT diff --git a/tests/auto/tools/rcc/data/images/images.expected b/tests/auto/tools/rcc/data/images/images.expected index 45e96dccd0..2af071812e 100644 --- a/tests/auto/tools/rcc/data/images/images.expected +++ b/tests/auto/tools/rcc/data/images/images.expected @@ -115,7 +115,6 @@ namespace QT_NAMESPACE { #endif bool qRegisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *); - bool qUnregisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *); #ifdef QT_NAMESPACE @@ -125,16 +124,18 @@ bool qUnregisterResourceData(int, const unsigned char *, const unsigned char *, int QT_RCC_MANGLE_NAMESPACE(qInitResources)(); int QT_RCC_MANGLE_NAMESPACE(qInitResources)() { + int version = 3; QT_RCC_PREPEND_NAMESPACE(qRegisterResourceData) - (0x2, qt_resource_struct, qt_resource_name, qt_resource_data); + (version, qt_resource_struct, qt_resource_name, qt_resource_data); return 1; } int QT_RCC_MANGLE_NAMESPACE(qCleanupResources)(); int QT_RCC_MANGLE_NAMESPACE(qCleanupResources)() { + int version = 3; QT_RCC_PREPEND_NAMESPACE(qUnregisterResourceData) - (0x2, qt_resource_struct, qt_resource_name, qt_resource_data); + (version, qt_resource_struct, qt_resource_name, qt_resource_data); return 1; } diff --git a/tests/auto/tools/rcc/data/sizes/data/data-0.txt b/tests/auto/tools/rcc/data/sizes/data/data-0.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/auto/tools/rcc/data/sizes/data/data-0.txt diff --git a/tests/auto/tools/rcc/data/sizes/data/data-1.txt b/tests/auto/tools/rcc/data/sizes/data/data-1.txt new file mode 100644 index 0000000000..b516b2c489 --- /dev/null +++ b/tests/auto/tools/rcc/data/sizes/data/data-1.txt @@ -0,0 +1 @@ +@
\ No newline at end of file diff --git a/tests/auto/tools/rcc/data/sizes/data/data-2.txt b/tests/auto/tools/rcc/data/sizes/data/data-2.txt new file mode 100644 index 0000000000..a616ad491b --- /dev/null +++ b/tests/auto/tools/rcc/data/sizes/data/data-2.txt @@ -0,0 +1 @@ +01
\ No newline at end of file diff --git a/tests/auto/tools/rcc/data/sizes/data/data-35.txt b/tests/auto/tools/rcc/data/sizes/data/data-35.txt new file mode 100644 index 0000000000..19a8036a15 --- /dev/null +++ b/tests/auto/tools/rcc/data/sizes/data/data-35.txt @@ -0,0 +1 @@ +0123456789 0123456789 0123456789 12
\ No newline at end of file diff --git a/tests/auto/tools/rcc/data/sizes/size-0.expected b/tests/auto/tools/rcc/data/sizes/size-0.expected new file mode 100644 index 0000000000..2f70a607ab --- /dev/null +++ b/tests/auto/tools/rcc/data/sizes/size-0.expected @@ -0,0 +1,89 @@ +/**************************************************************************** +** Resource object code +** +IGNORE: ** Created by: The Resource Compiler for Qt version 5.11.2 +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +static const unsigned char qt_resource_data[] = { +IGNORE: // /data/dev/qt-5/qtbase/tests/auto/tools/rcc/data/sizes/data/data-0.txt + 0x0,0x0,0x0,0x0, + + +}; + +static const unsigned char qt_resource_name[] = { + // data + 0x0,0x4, + 0x0,0x6,0xa8,0xa1, + 0x0,0x64, + 0x0,0x61,0x0,0x74,0x0,0x61, + // data-0.txt + 0x0,0xa, + 0x4,0xe,0xa,0xb4, + 0x0,0x64, + 0x0,0x61,0x0,0x74,0x0,0x61,0x0,0x2d,0x0,0x30,0x0,0x2e,0x0,0x74,0x0,0x78,0x0,0x74, + +}; + +static const unsigned char qt_resource_struct[] = { + // : + 0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x1, +0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + // :/data + 0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x2, +0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + // :/data/data-0.txt + 0x0,0x0,0x0,0xe,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0, +TIMESTAMP:data/data-0.txt + +}; + +#ifdef QT_NAMESPACE +# define QT_RCC_PREPEND_NAMESPACE(name) ::QT_NAMESPACE::name +# define QT_RCC_MANGLE_NAMESPACE0(x) x +# define QT_RCC_MANGLE_NAMESPACE1(a, b) a##_##b +# define QT_RCC_MANGLE_NAMESPACE2(a, b) QT_RCC_MANGLE_NAMESPACE1(a,b) +# define QT_RCC_MANGLE_NAMESPACE(name) QT_RCC_MANGLE_NAMESPACE2( \ + QT_RCC_MANGLE_NAMESPACE0(name), QT_RCC_MANGLE_NAMESPACE0(QT_NAMESPACE)) +#else +# define QT_RCC_PREPEND_NAMESPACE(name) name +# define QT_RCC_MANGLE_NAMESPACE(name) name +#endif + +#ifdef QT_NAMESPACE +namespace QT_NAMESPACE { +#endif + +bool qRegisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *); +bool qUnregisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *); + +#ifdef QT_NAMESPACE +} +#endif + +int QT_RCC_MANGLE_NAMESPACE(qInitResources)(); +int QT_RCC_MANGLE_NAMESPACE(qInitResources)() +{ + int version = 3; + QT_RCC_PREPEND_NAMESPACE(qRegisterResourceData) + (version, qt_resource_struct, qt_resource_name, qt_resource_data); + return 1; +} + +int QT_RCC_MANGLE_NAMESPACE(qCleanupResources)(); +int QT_RCC_MANGLE_NAMESPACE(qCleanupResources)() +{ + int version = 3; + QT_RCC_PREPEND_NAMESPACE(qUnregisterResourceData) + (version, qt_resource_struct, qt_resource_name, qt_resource_data); + return 1; +} + +namespace { + struct initializer { + initializer() { QT_RCC_MANGLE_NAMESPACE(qInitResources)(); } + ~initializer() { QT_RCC_MANGLE_NAMESPACE(qCleanupResources)(); } + } dummy; +} diff --git a/tests/auto/tools/rcc/data/sizes/size-0.qrc b/tests/auto/tools/rcc/data/sizes/size-0.qrc new file mode 100644 index 0000000000..9f47732fe2 --- /dev/null +++ b/tests/auto/tools/rcc/data/sizes/size-0.qrc @@ -0,0 +1,5 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource> + <file>data/data-0.txt</file> +</qresource> +</RCC> diff --git a/tests/auto/tools/rcc/data/sizes/size-1.expected b/tests/auto/tools/rcc/data/sizes/size-1.expected new file mode 100644 index 0000000000..d1717a9255 --- /dev/null +++ b/tests/auto/tools/rcc/data/sizes/size-1.expected @@ -0,0 +1,90 @@ +/**************************************************************************** +** Resource object code +** +IGNORE:** Created by: The Resource Compiler for Qt version 5.11.2 +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +static const unsigned char qt_resource_data[] = { +IGNORE: // /data/dev/qt-5/qtbase/tests/auto/tools/rcc/data/sizes/data/data-1.txt + 0x0,0x0,0x0,0x1, + 0x40, + + +}; + +static const unsigned char qt_resource_name[] = { + // data + 0x0,0x4, + 0x0,0x6,0xa8,0xa1, + 0x0,0x64, + 0x0,0x61,0x0,0x74,0x0,0x61, + // data-1.txt + 0x0,0xa, + 0x4,0x11,0xa,0xb4, + 0x0,0x64, + 0x0,0x61,0x0,0x74,0x0,0x61,0x0,0x2d,0x0,0x31,0x0,0x2e,0x0,0x74,0x0,0x78,0x0,0x74, + +}; + +static const unsigned char qt_resource_struct[] = { + // : + 0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x1, +0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + // :/data + 0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x2, +0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + // :/data/data-1.txt + 0x0,0x0,0x0,0xe,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0, +TIMESTAMP:data/data-1.txt + +}; + +#ifdef QT_NAMESPACE +# define QT_RCC_PREPEND_NAMESPACE(name) ::QT_NAMESPACE::name +# define QT_RCC_MANGLE_NAMESPACE0(x) x +# define QT_RCC_MANGLE_NAMESPACE1(a, b) a##_##b +# define QT_RCC_MANGLE_NAMESPACE2(a, b) QT_RCC_MANGLE_NAMESPACE1(a,b) +# define QT_RCC_MANGLE_NAMESPACE(name) QT_RCC_MANGLE_NAMESPACE2( \ + QT_RCC_MANGLE_NAMESPACE0(name), QT_RCC_MANGLE_NAMESPACE0(QT_NAMESPACE)) +#else +# define QT_RCC_PREPEND_NAMESPACE(name) name +# define QT_RCC_MANGLE_NAMESPACE(name) name +#endif + +#ifdef QT_NAMESPACE +namespace QT_NAMESPACE { +#endif + +bool qRegisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *); +bool qUnregisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *); + +#ifdef QT_NAMESPACE +} +#endif + +int QT_RCC_MANGLE_NAMESPACE(qInitResources)(); +int QT_RCC_MANGLE_NAMESPACE(qInitResources)() +{ + int version = 3; + QT_RCC_PREPEND_NAMESPACE(qRegisterResourceData) + (version, qt_resource_struct, qt_resource_name, qt_resource_data); + return 1; +} + +int QT_RCC_MANGLE_NAMESPACE(qCleanupResources)(); +int QT_RCC_MANGLE_NAMESPACE(qCleanupResources)() +{ + int version = 3; + QT_RCC_PREPEND_NAMESPACE(qUnregisterResourceData) + (version, qt_resource_struct, qt_resource_name, qt_resource_data); + return 1; +} + +namespace { + struct initializer { + initializer() { QT_RCC_MANGLE_NAMESPACE(qInitResources)(); } + ~initializer() { QT_RCC_MANGLE_NAMESPACE(qCleanupResources)(); } + } dummy; +} diff --git a/tests/auto/tools/rcc/data/sizes/size-1.qrc b/tests/auto/tools/rcc/data/sizes/size-1.qrc new file mode 100644 index 0000000000..9fde9a1722 --- /dev/null +++ b/tests/auto/tools/rcc/data/sizes/size-1.qrc @@ -0,0 +1,5 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource> + <file>data/data-1.txt</file> +</qresource> +</RCC> diff --git a/tests/auto/tools/rcc/data/sizes/size-2-0-35-1.expected b/tests/auto/tools/rcc/data/sizes/size-2-0-35-1.expected new file mode 100644 index 0000000000..7a7cc93df1 --- /dev/null +++ b/tests/auto/tools/rcc/data/sizes/size-2-0-35-1.expected @@ -0,0 +1,127 @@ +/**************************************************************************** +** Resource object code +** +IGNORE: ** Created by: The Resource Compiler for Qt version 5.11.2 +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +static const unsigned char qt_resource_data[] = { +IGNORE: // /data/dev/qt-5/qtbase/tests/auto/tools/rcc/data/sizes/data/data-2.txt + 0x0,0x0,0x0,0x2, + 0x30, + 0x31, +IGNORE: // /data/dev/qt-5/qtbase/tests/auto/tools/rcc/data/sizes/data/data-35.txt + 0x0,0x0,0x0,0x23, + 0x30, + 0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x20,0x30,0x31,0x32,0x33,0x34,0x35, + 0x36,0x37,0x38,0x39,0x20,0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x20, + 0x31,0x32, +IGNORE: // /data/dev/qt-5/qtbase/tests/auto/tools/rcc/data/sizes/data/data-1.txt + 0x0,0x0,0x0,0x1, + 0x40, + +IGNORE: // /data/dev/qt-5/qtbase/tests/auto/tools/rcc/data/sizes/data/data-0.txt + 0x0,0x0,0x0,0x0, + + +}; + +static const unsigned char qt_resource_name[] = { + // data + 0x0,0x4, + 0x0,0x6,0xa8,0xa1, + 0x0,0x64, + 0x0,0x61,0x0,0x74,0x0,0x61, + // data-2.txt + 0x0,0xa, + 0x4,0x8,0xa,0xb4, + 0x0,0x64, + 0x0,0x61,0x0,0x74,0x0,0x61,0x0,0x2d,0x0,0x32,0x0,0x2e,0x0,0x74,0x0,0x78,0x0,0x74, + // data-35.txt + 0x0,0xb, + 0x0,0xb5,0x4f,0x74, + 0x0,0x64, + 0x0,0x61,0x0,0x74,0x0,0x61,0x0,0x2d,0x0,0x33,0x0,0x35,0x0,0x2e,0x0,0x74,0x0,0x78,0x0,0x74, + // data-1.txt + 0x0,0xa, + 0x4,0x11,0xa,0xb4, + 0x0,0x64, + 0x0,0x61,0x0,0x74,0x0,0x61,0x0,0x2d,0x0,0x31,0x0,0x2e,0x0,0x74,0x0,0x78,0x0,0x74, + // data-0.txt + 0x0,0xa, + 0x4,0xe,0xa,0xb4, + 0x0,0x64, + 0x0,0x61,0x0,0x74,0x0,0x61,0x0,0x2d,0x0,0x30,0x0,0x2e,0x0,0x74,0x0,0x78,0x0,0x74, + +}; + +static const unsigned char qt_resource_struct[] = { + // : + 0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x1, +0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + // :/data + 0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x2, +0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + // :/data/data-35.txt + 0x0,0x0,0x0,0x28,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x6, +TIMESTAMP:data/data-35.txt + // :/data/data-2.txt + 0x0,0x0,0x0,0xe,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0, +TIMESTAMP:data/data-2.txt + // :/data/data-0.txt + 0x0,0x0,0x0,0x5e,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x32, +TIMESTAMP:data/data-0.txt + // :/data/data-1.txt + 0x0,0x0,0x0,0x44,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x2d, +TIMESTAMP:data/data-1.txt + +}; + +#ifdef QT_NAMESPACE +# define QT_RCC_PREPEND_NAMESPACE(name) ::QT_NAMESPACE::name +# define QT_RCC_MANGLE_NAMESPACE0(x) x +# define QT_RCC_MANGLE_NAMESPACE1(a, b) a##_##b +# define QT_RCC_MANGLE_NAMESPACE2(a, b) QT_RCC_MANGLE_NAMESPACE1(a,b) +# define QT_RCC_MANGLE_NAMESPACE(name) QT_RCC_MANGLE_NAMESPACE2( \ + QT_RCC_MANGLE_NAMESPACE0(name), QT_RCC_MANGLE_NAMESPACE0(QT_NAMESPACE)) +#else +# define QT_RCC_PREPEND_NAMESPACE(name) name +# define QT_RCC_MANGLE_NAMESPACE(name) name +#endif + +#ifdef QT_NAMESPACE +namespace QT_NAMESPACE { +#endif + +bool qRegisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *); +bool qUnregisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *); + +#ifdef QT_NAMESPACE +} +#endif + +int QT_RCC_MANGLE_NAMESPACE(qInitResources)(); +int QT_RCC_MANGLE_NAMESPACE(qInitResources)() +{ + int version = 3; + QT_RCC_PREPEND_NAMESPACE(qRegisterResourceData) + (version, qt_resource_struct, qt_resource_name, qt_resource_data); + return 1; +} + +int QT_RCC_MANGLE_NAMESPACE(qCleanupResources)(); +int QT_RCC_MANGLE_NAMESPACE(qCleanupResources)() +{ + int version = 3; + QT_RCC_PREPEND_NAMESPACE(qUnregisterResourceData) + (version, qt_resource_struct, qt_resource_name, qt_resource_data); + return 1; +} + +namespace { + struct initializer { + initializer() { QT_RCC_MANGLE_NAMESPACE(qInitResources)(); } + ~initializer() { QT_RCC_MANGLE_NAMESPACE(qCleanupResources)(); } + } dummy; +} diff --git a/tests/auto/tools/rcc/data/sizes/size-2-0-35-1.qrc b/tests/auto/tools/rcc/data/sizes/size-2-0-35-1.qrc new file mode 100644 index 0000000000..039c9203ff --- /dev/null +++ b/tests/auto/tools/rcc/data/sizes/size-2-0-35-1.qrc @@ -0,0 +1,8 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource> + <file>data/data-2.txt</file> + <file>data/data-0.txt</file> + <file>data/data-35.txt</file> + <file>data/data-1.txt</file> +</qresource> +</RCC> diff --git a/tests/auto/tools/rcc/rcc.pro b/tests/auto/tools/rcc/rcc.pro index 264b8ecc66..3fdc4132a7 100644 --- a/tests/auto/tools/rcc/rcc.pro +++ b/tests/auto/tools/rcc/rcc.pro @@ -3,3 +3,10 @@ QT = core testlib TARGET = tst_rcc SOURCES += tst_rcc.cpp + +RESOURCES += \ + $$PWD/data/images/images.qrc \ + $$PWD/data/sizes/size-0.qrc \ + $$PWD/data/sizes/size-2-0-35-1.qrc \ + $$PWD/data/sizes/size-1.qrc + diff --git a/tests/auto/tools/rcc/tst_rcc.cpp b/tests/auto/tools/rcc/tst_rcc.cpp index 54a2854ede..c810c6e364 100644 --- a/tests/auto/tools/rcc/tst_rcc.cpp +++ b/tests/auto/tools/rcc/tst_rcc.cpp @@ -55,9 +55,13 @@ private slots: void rcc_data(); void rcc(); + void binary_data(); void binary(); + void readback_data(); + void readback(); + void cleanupTestCase(); private: @@ -126,6 +130,13 @@ void tst_rcc::rcc_data() if (dataPath.isEmpty()) QFAIL("data path not found"); QTest::newRow("images") << dataPath << "images.qrc" << "images.expected"; + + QString sizesPath = QFINDTESTDATA("data/sizes/"); + if (sizesPath.isEmpty()) + QFAIL("data path not found"); + QTest::newRow("size-0") << sizesPath << "size-0.qrc" << "size-0.expected"; + QTest::newRow("size-1") << sizesPath << "size-1.qrc" << "size-1.expected"; + QTest::newRow("size-2-0-35-1") << sizesPath << "size-2-0-35-1.qrc" << "size-2-0-35-1.expected"; } void tst_rcc::rcc() @@ -148,9 +159,10 @@ void tst_rcc::rcc() return; } - // Launch + // Launch; force no compression, otherwise the output would be different + // depending on the compression algorithm we're using QProcess process; - process.start(m_rcc, QStringList(qrcfile)); + process.start(m_rcc, { "-no-compress", qrcfile }); if (!process.waitForFinished()) { const QString path = QString::fromLocal8Bit(qgetenv("PATH")); QString message = QString::fromLatin1("'%1' could not be found when run from '%2'. Path: '%3' "). @@ -185,8 +197,9 @@ static void createRccBinaryData(const QString &rcc, const QString &baseDir, QString currentDir = QDir::currentPath(); QDir::setCurrent(baseDir); + // same as above: force no compression QProcess rccProcess; - rccProcess.start(rcc, QStringList() << "-binary" << "-o" << rccFileName << qrcFileName); + rccProcess.start(rcc, { "-binary", "-no-compress", "-o", rccFileName, qrcFileName }); bool ok = rccProcess.waitForFinished(); if (!ok) { QString errorString = QString::fromLatin1("Could not start rcc (is it in PATH?): %1").arg(rccProcess.errorString()); @@ -353,6 +366,42 @@ void tst_rcc::binary() QLocale::setDefault(oldDefaultLocale); } +void tst_rcc::readback_data() +{ + QTest::addColumn<QString>("resourceName"); + QTest::addColumn<QString>("fileSystemName"); + + QTest::newRow("data-0") << ":data/data-0.txt" << "sizes/data/data-0.txt"; + QTest::newRow("data-1") << ":data/data-1.txt" << "sizes/data/data-1.txt"; + QTest::newRow("data-2") << ":data/data-2.txt" << "sizes/data/data-2.txt"; + QTest::newRow("data-35") << ":data/data-35.txt" << "sizes/data/data-35.txt"; + QTest::newRow("circle") << ":images/circle.png" << "images/images/circle.png"; + QTest::newRow("square") << ":images/square.png" << "images/images/square.png"; + QTest::newRow("triangle") << ":images/subdir/triangle.png" + << "images/images/subdir/triangle.png"; +} + +void tst_rcc::readback() +{ + QFETCH(QString, resourceName); + QFETCH(QString, fileSystemName); + + QString dataPath = QFINDTESTDATA("data/"); + if (dataPath.isEmpty()) + QFAIL("data path not found"); + + QFile resourceFile(resourceName); + QVERIFY(resourceFile.open(QIODevice::ReadOnly)); + QByteArray resourceData = resourceFile.readAll(); + resourceFile.close(); + + QFile fileSystemFile(dataPath + fileSystemName); + QVERIFY(fileSystemFile.open(QIODevice::ReadOnly)); + QByteArray fileSystemData = fileSystemFile.readAll(); + fileSystemFile.close(); + + QCOMPARE(resourceData, fileSystemData); +} void tst_rcc::cleanupTestCase() { diff --git a/tests/auto/tools/uic/baseline/Dialog_with_Buttons_Bottom.ui.h b/tests/auto/tools/uic/baseline/Dialog_with_Buttons_Bottom.ui.h index 1f5004b2aa..8b17acc1cd 100644 --- a/tests/auto/tools/uic/baseline/Dialog_with_Buttons_Bottom.ui.h +++ b/tests/auto/tools/uic/baseline/Dialog_with_Buttons_Bottom.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'Dialog_with_Buttons_Bottom.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -41,7 +41,7 @@ public: void retranslateUi(QDialog *Dialog) { - Dialog->setWindowTitle(QApplication::translate("Dialog", "Dialog", nullptr)); + Dialog->setWindowTitle(QCoreApplication::translate("Dialog", "Dialog", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/Dialog_with_Buttons_Right.ui.h b/tests/auto/tools/uic/baseline/Dialog_with_Buttons_Right.ui.h index 8dd8b11b62..cdb12ec2b8 100644 --- a/tests/auto/tools/uic/baseline/Dialog_with_Buttons_Right.ui.h +++ b/tests/auto/tools/uic/baseline/Dialog_with_Buttons_Right.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'Dialog_with_Buttons_Right.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -41,7 +41,7 @@ public: void retranslateUi(QDialog *Dialog) { - Dialog->setWindowTitle(QApplication::translate("Dialog", "Dialog", nullptr)); + Dialog->setWindowTitle(QCoreApplication::translate("Dialog", "Dialog", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/Dialog_without_Buttons.ui.h b/tests/auto/tools/uic/baseline/Dialog_without_Buttons.ui.h index 95acabf3f8..abdeb5b823 100644 --- a/tests/auto/tools/uic/baseline/Dialog_without_Buttons.ui.h +++ b/tests/auto/tools/uic/baseline/Dialog_without_Buttons.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'Dialog_without_Buttons.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -32,7 +32,7 @@ public: void retranslateUi(QDialog *Dialog) { - Dialog->setWindowTitle(QApplication::translate("Dialog", "Dialog", nullptr)); + Dialog->setWindowTitle(QCoreApplication::translate("Dialog", "Dialog", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/Main_Window.ui.h b/tests/auto/tools/uic/baseline/Main_Window.ui.h index 9e59e9f2e5..b78a3df8af 100644 --- a/tests/auto/tools/uic/baseline/Main_Window.ui.h +++ b/tests/auto/tools/uic/baseline/Main_Window.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'Main_Window.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -47,7 +47,7 @@ public: void retranslateUi(QMainWindow *MainWindow) { - MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", nullptr)); + MainWindow->setWindowTitle(QCoreApplication::translate("MainWindow", "MainWindow", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/Widget.ui.h b/tests/auto/tools/uic/baseline/Widget.ui.h index 4318c2262f..906f648533 100644 --- a/tests/auto/tools/uic/baseline/Widget.ui.h +++ b/tests/auto/tools/uic/baseline/Widget.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'Widget.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -57,13 +57,13 @@ public: void retranslateUi(QWidget *Form) { - Form->setWindowTitle(QApplication::translate("Form", "Form", nullptr)); - Alabel->setText(QApplication::translate("Form", "A label.\n" + Form->setWindowTitle(QCoreApplication::translate("Form", "Form", nullptr)); + Alabel->setText(QCoreApplication::translate("Form", "A label.\n" "One new line.\n" "Another new line.\n" "Last line.", nullptr)); - groupBox->setTitle(QApplication::translate("Form", "A Group Box", nullptr)); - pushButton->setText(QApplication::translate("Form", "PushButton", nullptr)); + groupBox->setTitle(QCoreApplication::translate("Form", "A Group Box", nullptr)); + pushButton->setText(QCoreApplication::translate("Form", "PushButton", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/addlinkdialog.ui.h b/tests/auto/tools/uic/baseline/addlinkdialog.ui.h index 17f51a92f8..2a0ef18fa7 100644 --- a/tests/auto/tools/uic/baseline/addlinkdialog.ui.h +++ b/tests/auto/tools/uic/baseline/addlinkdialog.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'addlinkdialog.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -97,9 +97,9 @@ public: void retranslateUi(QDialog *AddLinkDialog) { - AddLinkDialog->setWindowTitle(QApplication::translate("AddLinkDialog", "Insert Link", nullptr)); - label->setText(QApplication::translate("AddLinkDialog", "Title:", nullptr)); - label_2->setText(QApplication::translate("AddLinkDialog", "URL:", nullptr)); + AddLinkDialog->setWindowTitle(QCoreApplication::translate("AddLinkDialog", "Insert Link", nullptr)); + label->setText(QCoreApplication::translate("AddLinkDialog", "Title:", nullptr)); + label_2->setText(QCoreApplication::translate("AddLinkDialog", "URL:", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/addtorrentform.ui.h b/tests/auto/tools/uic/baseline/addtorrentform.ui.h index d259a011bf..b357d708d5 100644 --- a/tests/auto/tools/uic/baseline/addtorrentform.ui.h +++ b/tests/auto/tools/uic/baseline/addtorrentform.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'addtorrentform.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -209,23 +209,23 @@ public: void retranslateUi(QDialog *AddTorrentFile) { - AddTorrentFile->setWindowTitle(QApplication::translate("AddTorrentFile", "Add a torrent", nullptr)); - groupBox->setTitle(QApplication::translate("AddTorrentFile", "Select a torrent source", nullptr)); - label_4->setText(QApplication::translate("AddTorrentFile", "Destination:", nullptr)); - label_2->setText(QApplication::translate("AddTorrentFile", "Tracker URL:", nullptr)); - browseTorrents->setText(QApplication::translate("AddTorrentFile", "Browse", nullptr)); - label_5->setText(QApplication::translate("AddTorrentFile", "File(s):", nullptr)); - label_3->setText(QApplication::translate("AddTorrentFile", "Size:", nullptr)); - label_6->setText(QApplication::translate("AddTorrentFile", "Creator:", nullptr)); - announceUrl->setText(QApplication::translate("AddTorrentFile", "<none>", nullptr)); - label->setText(QApplication::translate("AddTorrentFile", "Torrent file:", nullptr)); - browseDestination->setText(QApplication::translate("AddTorrentFile", "Browse", nullptr)); - label_7->setText(QApplication::translate("AddTorrentFile", "Comment:", nullptr)); - commentLabel->setText(QApplication::translate("AddTorrentFile", "<none>", nullptr)); - creatorLabel->setText(QApplication::translate("AddTorrentFile", "<none>", nullptr)); - sizeLabel->setText(QApplication::translate("AddTorrentFile", "0", nullptr)); - okButton->setText(QApplication::translate("AddTorrentFile", "&OK", nullptr)); - cancelButton->setText(QApplication::translate("AddTorrentFile", "&Cancel", nullptr)); + AddTorrentFile->setWindowTitle(QCoreApplication::translate("AddTorrentFile", "Add a torrent", nullptr)); + groupBox->setTitle(QCoreApplication::translate("AddTorrentFile", "Select a torrent source", nullptr)); + label_4->setText(QCoreApplication::translate("AddTorrentFile", "Destination:", nullptr)); + label_2->setText(QCoreApplication::translate("AddTorrentFile", "Tracker URL:", nullptr)); + browseTorrents->setText(QCoreApplication::translate("AddTorrentFile", "Browse", nullptr)); + label_5->setText(QCoreApplication::translate("AddTorrentFile", "File(s):", nullptr)); + label_3->setText(QCoreApplication::translate("AddTorrentFile", "Size:", nullptr)); + label_6->setText(QCoreApplication::translate("AddTorrentFile", "Creator:", nullptr)); + announceUrl->setText(QCoreApplication::translate("AddTorrentFile", "<none>", nullptr)); + label->setText(QCoreApplication::translate("AddTorrentFile", "Torrent file:", nullptr)); + browseDestination->setText(QCoreApplication::translate("AddTorrentFile", "Browse", nullptr)); + label_7->setText(QCoreApplication::translate("AddTorrentFile", "Comment:", nullptr)); + commentLabel->setText(QCoreApplication::translate("AddTorrentFile", "<none>", nullptr)); + creatorLabel->setText(QCoreApplication::translate("AddTorrentFile", "<none>", nullptr)); + sizeLabel->setText(QCoreApplication::translate("AddTorrentFile", "0", nullptr)); + okButton->setText(QCoreApplication::translate("AddTorrentFile", "&OK", nullptr)); + cancelButton->setText(QCoreApplication::translate("AddTorrentFile", "&Cancel", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/authenticationdialog.ui.h b/tests/auto/tools/uic/baseline/authenticationdialog.ui.h index 16c9ce16a8..f8378b9a4e 100644 --- a/tests/auto/tools/uic/baseline/authenticationdialog.ui.h +++ b/tests/auto/tools/uic/baseline/authenticationdialog.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'authenticationdialog.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -103,12 +103,12 @@ public: void retranslateUi(QDialog *Dialog) { - Dialog->setWindowTitle(QApplication::translate("Dialog", "Http authentication required", nullptr)); - label->setText(QApplication::translate("Dialog", "You need to supply a Username and a Password to access this site", nullptr)); - label_2->setText(QApplication::translate("Dialog", "Username:", nullptr)); - label_3->setText(QApplication::translate("Dialog", "Password:", nullptr)); - label_4->setText(QApplication::translate("Dialog", "Site:", nullptr)); - siteDescription->setText(QApplication::translate("Dialog", "%1 at %2", nullptr)); + Dialog->setWindowTitle(QCoreApplication::translate("Dialog", "Http authentication required", nullptr)); + label->setText(QCoreApplication::translate("Dialog", "You need to supply a Username and a Password to access this site", nullptr)); + label_2->setText(QCoreApplication::translate("Dialog", "Username:", nullptr)); + label_3->setText(QCoreApplication::translate("Dialog", "Password:", nullptr)); + label_4->setText(QCoreApplication::translate("Dialog", "Site:", nullptr)); + siteDescription->setText(QCoreApplication::translate("Dialog", "%1 at %2", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/backside.ui.h b/tests/auto/tools/uic/baseline/backside.ui.h index e7053c632f..7f2b3662f3 100644 --- a/tests/auto/tools/uic/baseline/backside.ui.h +++ b/tests/auto/tools/uic/baseline/backside.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'backside.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -144,40 +144,40 @@ public: void retranslateUi(QWidget *BackSide) { - BackSide->setWindowTitle(QApplication::translate("BackSide", "BackSide", nullptr)); - groupBox->setTitle(QApplication::translate("BackSide", "Settings", nullptr)); - label->setText(QApplication::translate("BackSide", "Title:", nullptr)); - hostName->setText(QApplication::translate("BackSide", "Pad Navigator Example", nullptr)); - label_2->setText(QApplication::translate("BackSide", "Modified:", nullptr)); - label_3->setText(QApplication::translate("BackSide", "Extent", nullptr)); - groupBox_2->setTitle(QApplication::translate("BackSide", "Other input", nullptr)); + BackSide->setWindowTitle(QCoreApplication::translate("BackSide", "BackSide", nullptr)); + groupBox->setTitle(QCoreApplication::translate("BackSide", "Settings", nullptr)); + label->setText(QCoreApplication::translate("BackSide", "Title:", nullptr)); + hostName->setText(QCoreApplication::translate("BackSide", "Pad Navigator Example", nullptr)); + label_2->setText(QCoreApplication::translate("BackSide", "Modified:", nullptr)); + label_3->setText(QCoreApplication::translate("BackSide", "Extent", nullptr)); + groupBox_2->setTitle(QCoreApplication::translate("BackSide", "Other input", nullptr)); QTreeWidgetItem *___qtreewidgetitem = treeWidget->headerItem(); - ___qtreewidgetitem->setText(0, QApplication::translate("BackSide", "Widgets On Graphics View", nullptr)); + ___qtreewidgetitem->setText(0, QCoreApplication::translate("BackSide", "Widgets On Graphics View", nullptr)); const bool __sortingEnabled = treeWidget->isSortingEnabled(); treeWidget->setSortingEnabled(false); QTreeWidgetItem *___qtreewidgetitem1 = treeWidget->topLevelItem(0); - ___qtreewidgetitem1->setText(0, QApplication::translate("BackSide", "QGraphicsProxyWidget", nullptr)); + ___qtreewidgetitem1->setText(0, QCoreApplication::translate("BackSide", "QGraphicsProxyWidget", nullptr)); QTreeWidgetItem *___qtreewidgetitem2 = ___qtreewidgetitem1->child(0); - ___qtreewidgetitem2->setText(0, QApplication::translate("BackSide", "QGraphicsWidget", nullptr)); + ___qtreewidgetitem2->setText(0, QCoreApplication::translate("BackSide", "QGraphicsWidget", nullptr)); QTreeWidgetItem *___qtreewidgetitem3 = ___qtreewidgetitem2->child(0); - ___qtreewidgetitem3->setText(0, QApplication::translate("BackSide", "QObject", nullptr)); + ___qtreewidgetitem3->setText(0, QCoreApplication::translate("BackSide", "QObject", nullptr)); QTreeWidgetItem *___qtreewidgetitem4 = ___qtreewidgetitem2->child(1); - ___qtreewidgetitem4->setText(0, QApplication::translate("BackSide", "QGraphicsItem", nullptr)); + ___qtreewidgetitem4->setText(0, QCoreApplication::translate("BackSide", "QGraphicsItem", nullptr)); QTreeWidgetItem *___qtreewidgetitem5 = ___qtreewidgetitem2->child(2); - ___qtreewidgetitem5->setText(0, QApplication::translate("BackSide", "QGraphicsLayoutItem", nullptr)); + ___qtreewidgetitem5->setText(0, QCoreApplication::translate("BackSide", "QGraphicsLayoutItem", nullptr)); QTreeWidgetItem *___qtreewidgetitem6 = treeWidget->topLevelItem(1); - ___qtreewidgetitem6->setText(0, QApplication::translate("BackSide", "QGraphicsGridLayout", nullptr)); + ___qtreewidgetitem6->setText(0, QCoreApplication::translate("BackSide", "QGraphicsGridLayout", nullptr)); QTreeWidgetItem *___qtreewidgetitem7 = ___qtreewidgetitem6->child(0); - ___qtreewidgetitem7->setText(0, QApplication::translate("BackSide", "QGraphicsLayout", nullptr)); + ___qtreewidgetitem7->setText(0, QCoreApplication::translate("BackSide", "QGraphicsLayout", nullptr)); QTreeWidgetItem *___qtreewidgetitem8 = ___qtreewidgetitem7->child(0); - ___qtreewidgetitem8->setText(0, QApplication::translate("BackSide", "QGraphicsLayoutItem", nullptr)); + ___qtreewidgetitem8->setText(0, QCoreApplication::translate("BackSide", "QGraphicsLayoutItem", nullptr)); QTreeWidgetItem *___qtreewidgetitem9 = treeWidget->topLevelItem(2); - ___qtreewidgetitem9->setText(0, QApplication::translate("BackSide", "QGraphicsLinearLayout", nullptr)); + ___qtreewidgetitem9->setText(0, QCoreApplication::translate("BackSide", "QGraphicsLinearLayout", nullptr)); QTreeWidgetItem *___qtreewidgetitem10 = ___qtreewidgetitem9->child(0); - ___qtreewidgetitem10->setText(0, QApplication::translate("BackSide", "QGraphicsLayout", nullptr)); + ___qtreewidgetitem10->setText(0, QCoreApplication::translate("BackSide", "QGraphicsLayout", nullptr)); QTreeWidgetItem *___qtreewidgetitem11 = ___qtreewidgetitem10->child(0); - ___qtreewidgetitem11->setText(0, QApplication::translate("BackSide", "QGraphicsLayoutItem", nullptr)); + ___qtreewidgetitem11->setText(0, QCoreApplication::translate("BackSide", "QGraphicsLayoutItem", nullptr)); treeWidget->setSortingEnabled(__sortingEnabled); } // retranslateUi diff --git a/tests/auto/tools/uic/baseline/batchtranslation.ui.h b/tests/auto/tools/uic/baseline/batchtranslation.ui.h index 8a4dc7a677..5e7278a581 100644 --- a/tests/auto/tools/uic/baseline/batchtranslation.ui.h +++ b/tests/auto/tools/uic/baseline/batchtranslation.ui.h @@ -31,7 +31,7 @@ /******************************************************************************** ** Form generated from reading UI file 'batchtranslation.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -90,7 +90,7 @@ public: vboxLayout->setObjectName(QString::fromUtf8("vboxLayout")); groupBox = new QGroupBox(databaseTranslationDialog); groupBox->setObjectName(QString::fromUtf8("groupBox")); - QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(5), static_cast<QSizePolicy::Policy>(4)); + QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(groupBox->sizePolicy().hasHeightForWidth()); @@ -120,7 +120,7 @@ public: groupBox_2 = new QGroupBox(databaseTranslationDialog); groupBox_2->setObjectName(QString::fromUtf8("groupBox_2")); - QSizePolicy sizePolicy1(static_cast<QSizePolicy::Policy>(5), static_cast<QSizePolicy::Policy>(1)); + QSizePolicy sizePolicy1(QSizePolicy::Preferred, QSizePolicy::Minimum); sizePolicy1.setHorizontalStretch(0); sizePolicy1.setVerticalStretch(0); sizePolicy1.setHeightForWidth(groupBox_2->sizePolicy().hasHeightForWidth()); @@ -213,16 +213,16 @@ public: void retranslateUi(QDialog *databaseTranslationDialog) { - databaseTranslationDialog->setWindowTitle(QApplication::translate("databaseTranslationDialog", "Qt Linguist - Batch Translation", nullptr)); - groupBox->setTitle(QApplication::translate("databaseTranslationDialog", "Options", nullptr)); - ckOnlyUntranslated->setText(QApplication::translate("databaseTranslationDialog", "Only translate entries with no translation", nullptr)); - ckMarkFinished->setText(QApplication::translate("databaseTranslationDialog", "Set translated entries to finished", nullptr)); - groupBox_2->setTitle(QApplication::translate("databaseTranslationDialog", "Phrase book preference", nullptr)); - moveUpButton->setText(QApplication::translate("databaseTranslationDialog", "Move up", nullptr)); - moveDownButton->setText(QApplication::translate("databaseTranslationDialog", "Move down", nullptr)); - label->setText(QApplication::translate("databaseTranslationDialog", "The batch translator will search through the selected phrasebooks in the order given above.", nullptr)); - runButton->setText(QApplication::translate("databaseTranslationDialog", "&Run", nullptr)); - cancelButton->setText(QApplication::translate("databaseTranslationDialog", "&Cancel", nullptr)); + databaseTranslationDialog->setWindowTitle(QCoreApplication::translate("databaseTranslationDialog", "Qt Linguist - Batch Translation", nullptr)); + groupBox->setTitle(QCoreApplication::translate("databaseTranslationDialog", "Options", nullptr)); + ckOnlyUntranslated->setText(QCoreApplication::translate("databaseTranslationDialog", "Only translate entries with no translation", nullptr)); + ckMarkFinished->setText(QCoreApplication::translate("databaseTranslationDialog", "Set translated entries to finished", nullptr)); + groupBox_2->setTitle(QCoreApplication::translate("databaseTranslationDialog", "Phrase book preference", nullptr)); + moveUpButton->setText(QCoreApplication::translate("databaseTranslationDialog", "Move up", nullptr)); + moveDownButton->setText(QCoreApplication::translate("databaseTranslationDialog", "Move down", nullptr)); + label->setText(QCoreApplication::translate("databaseTranslationDialog", "The batch translator will search through the selected phrasebooks in the order given above.", nullptr)); + runButton->setText(QCoreApplication::translate("databaseTranslationDialog", "&Run", nullptr)); + cancelButton->setText(QCoreApplication::translate("databaseTranslationDialog", "&Cancel", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/bookmarkdialog.ui.h b/tests/auto/tools/uic/baseline/bookmarkdialog.ui.h index b5a44998be..11caa3f130 100644 --- a/tests/auto/tools/uic/baseline/bookmarkdialog.ui.h +++ b/tests/auto/tools/uic/baseline/bookmarkdialog.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'bookmarkdialog.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -148,13 +148,13 @@ public: void retranslateUi(QDialog *BookmarkDialog) { - BookmarkDialog->setWindowTitle(QApplication::translate("BookmarkDialog", "Add Bookmark", nullptr)); - label->setText(QApplication::translate("BookmarkDialog", "Bookmark:", nullptr)); - label_2->setText(QApplication::translate("BookmarkDialog", "Add in Folder:", nullptr)); - toolButton->setText(QApplication::translate("BookmarkDialog", "+", nullptr)); + BookmarkDialog->setWindowTitle(QCoreApplication::translate("BookmarkDialog", "Add Bookmark", nullptr)); + label->setText(QCoreApplication::translate("BookmarkDialog", "Bookmark:", nullptr)); + label_2->setText(QCoreApplication::translate("BookmarkDialog", "Add in Folder:", nullptr)); + toolButton->setText(QCoreApplication::translate("BookmarkDialog", "+", nullptr)); QTreeWidgetItem *___qtreewidgetitem = bookmarkWidget->headerItem(); - ___qtreewidgetitem->setText(0, QApplication::translate("BookmarkDialog", "1", nullptr)); - newFolderButton->setText(QApplication::translate("BookmarkDialog", "New Folder", nullptr)); + ___qtreewidgetitem->setText(0, QCoreApplication::translate("BookmarkDialog", "1", nullptr)); + newFolderButton->setText(QCoreApplication::translate("BookmarkDialog", "New Folder", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/bookwindow.ui.h b/tests/auto/tools/uic/baseline/bookwindow.ui.h index 8fe5f000e2..fbdcb17bd2 100644 --- a/tests/auto/tools/uic/baseline/bookwindow.ui.h +++ b/tests/auto/tools/uic/baseline/bookwindow.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'bookwindow.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -157,15 +157,15 @@ public: void retranslateUi(QMainWindow *BookWindow) { - BookWindow->setWindowTitle(QApplication::translate("BookWindow", "Books", nullptr)); - groupBox->setTitle(QApplication::translate("BookWindow", "Books", nullptr)); - groupBox_2->setTitle(QApplication::translate("BookWindow", "Details", nullptr)); - label_5->setText(QApplication::translate("BookWindow", "<b>Title:</b>", nullptr)); - label_2_2_2_2->setText(QApplication::translate("BookWindow", "<b>Author: </b>", nullptr)); - label_3->setText(QApplication::translate("BookWindow", "<b>Genre:</b>", nullptr)); - label_4->setText(QApplication::translate("BookWindow", "<b>Year:</b>", nullptr)); + BookWindow->setWindowTitle(QCoreApplication::translate("BookWindow", "Books", nullptr)); + groupBox->setTitle(QCoreApplication::translate("BookWindow", "Books", nullptr)); + groupBox_2->setTitle(QCoreApplication::translate("BookWindow", "Details", nullptr)); + label_5->setText(QCoreApplication::translate("BookWindow", "<b>Title:</b>", nullptr)); + label_2_2_2_2->setText(QCoreApplication::translate("BookWindow", "<b>Author: </b>", nullptr)); + label_3->setText(QCoreApplication::translate("BookWindow", "<b>Genre:</b>", nullptr)); + label_4->setText(QCoreApplication::translate("BookWindow", "<b>Year:</b>", nullptr)); yearEdit->setPrefix(QString()); - label->setText(QApplication::translate("BookWindow", "<b>Rating:</b>", nullptr)); + label->setText(QCoreApplication::translate("BookWindow", "<b>Rating:</b>", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/browserwidget.ui.h b/tests/auto/tools/uic/baseline/browserwidget.ui.h index 3db93c34cf..7dcfb290f7 100644 --- a/tests/auto/tools/uic/baseline/browserwidget.ui.h +++ b/tests/auto/tools/uic/baseline/browserwidget.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'browserwidget.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -62,7 +62,7 @@ public: vboxLayout->setObjectName(QString::fromUtf8("vboxLayout")); splitter_2 = new QSplitter(Browser); splitter_2->setObjectName(QString::fromUtf8("splitter_2")); - QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(7), static_cast<QSizePolicy::Policy>(7)); + QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(splitter_2->sizePolicy().hasHeightForWidth()); @@ -70,7 +70,7 @@ public: splitter_2->setOrientation(Qt::Horizontal); connectionWidget = new ConnectionWidget(splitter_2); connectionWidget->setObjectName(QString::fromUtf8("connectionWidget")); - QSizePolicy sizePolicy1(static_cast<QSizePolicy::Policy>(13), static_cast<QSizePolicy::Policy>(7)); + QSizePolicy sizePolicy1(QSizePolicy::Ignored, QSizePolicy::Expanding); sizePolicy1.setHorizontalStretch(1); sizePolicy1.setVerticalStretch(0); sizePolicy1.setHeightForWidth(connectionWidget->sizePolicy().hasHeightForWidth()); @@ -78,7 +78,7 @@ public: splitter_2->addWidget(connectionWidget); table = new QTableView(splitter_2); table->setObjectName(QString::fromUtf8("table")); - QSizePolicy sizePolicy2(static_cast<QSizePolicy::Policy>(7), static_cast<QSizePolicy::Policy>(7)); + QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Expanding); sizePolicy2.setHorizontalStretch(2); sizePolicy2.setVerticalStretch(0); sizePolicy2.setHeightForWidth(table->sizePolicy().hasHeightForWidth()); @@ -91,7 +91,7 @@ public: groupBox = new QGroupBox(Browser); groupBox->setObjectName(QString::fromUtf8("groupBox")); - QSizePolicy sizePolicy3(static_cast<QSizePolicy::Policy>(5), static_cast<QSizePolicy::Policy>(3)); + QSizePolicy sizePolicy3(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); sizePolicy3.setHorizontalStretch(0); sizePolicy3.setVerticalStretch(0); sizePolicy3.setHeightForWidth(groupBox->sizePolicy().hasHeightForWidth()); @@ -107,7 +107,7 @@ public: vboxLayout1->setObjectName(QString::fromUtf8("vboxLayout1")); sqlEdit = new QTextEdit(groupBox); sqlEdit->setObjectName(QString::fromUtf8("sqlEdit")); - QSizePolicy sizePolicy4(static_cast<QSizePolicy::Policy>(7), static_cast<QSizePolicy::Policy>(3)); + QSizePolicy sizePolicy4(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding); sizePolicy4.setHorizontalStretch(0); sizePolicy4.setVerticalStretch(0); sizePolicy4.setHeightForWidth(sqlEdit->sizePolicy().hasHeightForWidth()); @@ -155,18 +155,18 @@ public: void retranslateUi(QWidget *Browser) { - Browser->setWindowTitle(QApplication::translate("Browser", "Qt SQL Browser", nullptr)); - insertRowAction->setText(QApplication::translate("Browser", "&Insert Row", nullptr)); -#ifndef QT_NO_STATUSTIP - insertRowAction->setStatusTip(QApplication::translate("Browser", "Inserts a new Row", nullptr)); -#endif // QT_NO_STATUSTIP - deleteRowAction->setText(QApplication::translate("Browser", "&Delete Row", nullptr)); -#ifndef QT_NO_STATUSTIP - deleteRowAction->setStatusTip(QApplication::translate("Browser", "Deletes the current Row", nullptr)); -#endif // QT_NO_STATUSTIP - groupBox->setTitle(QApplication::translate("Browser", "SQL Query", nullptr)); - clearButton->setText(QApplication::translate("Browser", "&Clear", nullptr)); - submitButton->setText(QApplication::translate("Browser", "&Submit", nullptr)); + Browser->setWindowTitle(QCoreApplication::translate("Browser", "Qt SQL Browser", nullptr)); + insertRowAction->setText(QCoreApplication::translate("Browser", "&Insert Row", nullptr)); +#if QT_CONFIG(statustip) + insertRowAction->setStatusTip(QCoreApplication::translate("Browser", "Inserts a new Row", nullptr)); +#endif // QT_CONFIG(statustip) + deleteRowAction->setText(QCoreApplication::translate("Browser", "&Delete Row", nullptr)); +#if QT_CONFIG(statustip) + deleteRowAction->setStatusTip(QCoreApplication::translate("Browser", "Deletes the current Row", nullptr)); +#endif // QT_CONFIG(statustip) + groupBox->setTitle(QCoreApplication::translate("Browser", "SQL Query", nullptr)); + clearButton->setText(QCoreApplication::translate("Browser", "&Clear", nullptr)); + submitButton->setText(QCoreApplication::translate("Browser", "&Submit", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/bug18156QTreeWidget.ui.h b/tests/auto/tools/uic/baseline/bug18156QTreeWidget.ui.h index 47f8f22132..4e7186041e 100644 --- a/tests/auto/tools/uic/baseline/bug18156QTreeWidget.ui.h +++ b/tests/auto/tools/uic/baseline/bug18156QTreeWidget.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'bug18156QTreeWidget.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -57,9 +57,9 @@ public: void retranslateUi(QDialog *Dialog) { - Dialog->setWindowTitle(QApplication::translate("Dialog", "Dialog", nullptr)); + Dialog->setWindowTitle(QCoreApplication::translate("Dialog", "Dialog", nullptr)); QTreeWidgetItem *___qtreewidgetitem = treeWidget->headerItem(); - ___qtreewidgetitem->setText(1, QApplication::translate("Dialog", "4", nullptr)); + ___qtreewidgetitem->setText(1, QCoreApplication::translate("Dialog", "4", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/buttongroup.ui.h b/tests/auto/tools/uic/baseline/buttongroup.ui.h index 87814dcba1..f48db1d593 100644 --- a/tests/auto/tools/uic/baseline/buttongroup.ui.h +++ b/tests/auto/tools/uic/baseline/buttongroup.ui.h @@ -195,14 +195,14 @@ public: void retranslateUi(QWidget *Form) { - Form->setWindowTitle(QApplication::translate("Form", "Easing curves", nullptr)); - groupBox_2->setTitle(QApplication::translate("Form", "Path type", nullptr)); - lineRadio->setText(QApplication::translate("Form", "Line", nullptr)); - circleRadio->setText(QApplication::translate("Form", "Circle", nullptr)); - groupBox->setTitle(QApplication::translate("Form", "Properties", nullptr)); - label->setText(QApplication::translate("Form", "Period", nullptr)); - label_3->setText(QApplication::translate("Form", "Overshoot", nullptr)); - label_2->setText(QApplication::translate("Form", "Amplitude", nullptr)); + Form->setWindowTitle(QCoreApplication::translate("Form", "Easing curves", nullptr)); + groupBox_2->setTitle(QCoreApplication::translate("Form", "Path type", nullptr)); + lineRadio->setText(QCoreApplication::translate("Form", "Line", nullptr)); + circleRadio->setText(QCoreApplication::translate("Form", "Circle", nullptr)); + groupBox->setTitle(QCoreApplication::translate("Form", "Properties", nullptr)); + label->setText(QCoreApplication::translate("Form", "Period", nullptr)); + label_3->setText(QCoreApplication::translate("Form", "Overshoot", nullptr)); + label_2->setText(QCoreApplication::translate("Form", "Amplitude", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/calculator.ui.h b/tests/auto/tools/uic/baseline/calculator.ui.h index 0387ee472b..bfe272f8ea 100644 --- a/tests/auto/tools/uic/baseline/calculator.ui.h +++ b/tests/auto/tools/uic/baseline/calculator.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'calculator.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -156,34 +156,34 @@ public: void retranslateUi(QWidget *Calculator) { - Calculator->setWindowTitle(QApplication::translate("Calculator", "Calculator", nullptr)); - backspaceButton->setText(QApplication::translate("Calculator", "Backspace", nullptr)); - clearButton->setText(QApplication::translate("Calculator", "Clear", nullptr)); - clearAllButton->setText(QApplication::translate("Calculator", "Clear All", nullptr)); - clearMemoryButton->setText(QApplication::translate("Calculator", "MC", nullptr)); - readMemoryButton->setText(QApplication::translate("Calculator", "MR", nullptr)); - setMemoryButton->setText(QApplication::translate("Calculator", "MS", nullptr)); - addToMemoryButton->setText(QApplication::translate("Calculator", "M+", nullptr)); - sevenButton->setText(QApplication::translate("Calculator", "7", nullptr)); - eightButton->setText(QApplication::translate("Calculator", "8", nullptr)); - nineButton->setText(QApplication::translate("Calculator", "9", nullptr)); - fourButton->setText(QApplication::translate("Calculator", "4", nullptr)); - fiveButton->setText(QApplication::translate("Calculator", "5", nullptr)); - sixButton->setText(QApplication::translate("Calculator", "6", nullptr)); - oneButton->setText(QApplication::translate("Calculator", "1", nullptr)); - twoButton->setText(QApplication::translate("Calculator", "2", nullptr)); - threeButton->setText(QApplication::translate("Calculator", "3", nullptr)); - zeroButton->setText(QApplication::translate("Calculator", "0", nullptr)); - pointButton->setText(QApplication::translate("Calculator", ".", nullptr)); - changeSignButton->setText(QApplication::translate("Calculator", "+-", nullptr)); - plusButton->setText(QApplication::translate("Calculator", "+", nullptr)); - divisionButton->setText(QApplication::translate("Calculator", "/", nullptr)); - timesButton->setText(QApplication::translate("Calculator", "*", nullptr)); - minusButton->setText(QApplication::translate("Calculator", "-", nullptr)); - squareRootButton->setText(QApplication::translate("Calculator", "Sqrt", nullptr)); - powerButton->setText(QApplication::translate("Calculator", "x^2", nullptr)); - reciprocalButton->setText(QApplication::translate("Calculator", "1/x", nullptr)); - equalButton->setText(QApplication::translate("Calculator", "=", nullptr)); + Calculator->setWindowTitle(QCoreApplication::translate("Calculator", "Calculator", nullptr)); + backspaceButton->setText(QCoreApplication::translate("Calculator", "Backspace", nullptr)); + clearButton->setText(QCoreApplication::translate("Calculator", "Clear", nullptr)); + clearAllButton->setText(QCoreApplication::translate("Calculator", "Clear All", nullptr)); + clearMemoryButton->setText(QCoreApplication::translate("Calculator", "MC", nullptr)); + readMemoryButton->setText(QCoreApplication::translate("Calculator", "MR", nullptr)); + setMemoryButton->setText(QCoreApplication::translate("Calculator", "MS", nullptr)); + addToMemoryButton->setText(QCoreApplication::translate("Calculator", "M+", nullptr)); + sevenButton->setText(QCoreApplication::translate("Calculator", "7", nullptr)); + eightButton->setText(QCoreApplication::translate("Calculator", "8", nullptr)); + nineButton->setText(QCoreApplication::translate("Calculator", "9", nullptr)); + fourButton->setText(QCoreApplication::translate("Calculator", "4", nullptr)); + fiveButton->setText(QCoreApplication::translate("Calculator", "5", nullptr)); + sixButton->setText(QCoreApplication::translate("Calculator", "6", nullptr)); + oneButton->setText(QCoreApplication::translate("Calculator", "1", nullptr)); + twoButton->setText(QCoreApplication::translate("Calculator", "2", nullptr)); + threeButton->setText(QCoreApplication::translate("Calculator", "3", nullptr)); + zeroButton->setText(QCoreApplication::translate("Calculator", "0", nullptr)); + pointButton->setText(QCoreApplication::translate("Calculator", ".", nullptr)); + changeSignButton->setText(QCoreApplication::translate("Calculator", "+-", nullptr)); + plusButton->setText(QCoreApplication::translate("Calculator", "+", nullptr)); + divisionButton->setText(QCoreApplication::translate("Calculator", "/", nullptr)); + timesButton->setText(QCoreApplication::translate("Calculator", "*", nullptr)); + minusButton->setText(QCoreApplication::translate("Calculator", "-", nullptr)); + squareRootButton->setText(QCoreApplication::translate("Calculator", "Sqrt", nullptr)); + powerButton->setText(QCoreApplication::translate("Calculator", "x^2", nullptr)); + reciprocalButton->setText(QCoreApplication::translate("Calculator", "1/x", nullptr)); + equalButton->setText(QCoreApplication::translate("Calculator", "=", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/calculatorform.ui.h b/tests/auto/tools/uic/baseline/calculatorform.ui.h index f4661c6237..ab55c8ad97 100644 --- a/tests/auto/tools/uic/baseline/calculatorform.ui.h +++ b/tests/auto/tools/uic/baseline/calculatorform.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'calculatorform.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -45,7 +45,7 @@ public: if (CalculatorForm->objectName().isEmpty()) CalculatorForm->setObjectName(QString::fromUtf8("CalculatorForm")); CalculatorForm->resize(276, 98); - QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(5), static_cast<QSizePolicy::Policy>(5)); + QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(CalculatorForm->sizePolicy().hasHeightForWidth()); @@ -170,13 +170,13 @@ public: void retranslateUi(QWidget *CalculatorForm) { - CalculatorForm->setWindowTitle(QApplication::translate("CalculatorForm", "Calculator Builder", nullptr)); - label->setText(QApplication::translate("CalculatorForm", "Input 1", nullptr)); - label_3->setText(QApplication::translate("CalculatorForm", "+", nullptr)); - label_2->setText(QApplication::translate("CalculatorForm", "Input 2", nullptr)); - label_3_2->setText(QApplication::translate("CalculatorForm", "=", nullptr)); - label_2_2_2->setText(QApplication::translate("CalculatorForm", "Output", nullptr)); - outputWidget->setText(QApplication::translate("CalculatorForm", "0", nullptr)); + CalculatorForm->setWindowTitle(QCoreApplication::translate("CalculatorForm", "Calculator Builder", nullptr)); + label->setText(QCoreApplication::translate("CalculatorForm", "Input 1", nullptr)); + label_3->setText(QCoreApplication::translate("CalculatorForm", "+", nullptr)); + label_2->setText(QCoreApplication::translate("CalculatorForm", "Input 2", nullptr)); + label_3_2->setText(QCoreApplication::translate("CalculatorForm", "=", nullptr)); + label_2_2_2->setText(QCoreApplication::translate("CalculatorForm", "Output", nullptr)); + outputWidget->setText(QCoreApplication::translate("CalculatorForm", "0", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/certificateinfo.ui.h b/tests/auto/tools/uic/baseline/certificateinfo.ui.h index 2aa47d40ad..4a70f86c3b 100644 --- a/tests/auto/tools/uic/baseline/certificateinfo.ui.h +++ b/tests/auto/tools/uic/baseline/certificateinfo.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'certificateinfo.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -90,9 +90,9 @@ public: void retranslateUi(QDialog *CertificateInfo) { - CertificateInfo->setWindowTitle(QApplication::translate("CertificateInfo", "Display Certificate Information", nullptr)); - groupBox->setTitle(QApplication::translate("CertificateInfo", "Certification Path", nullptr)); - groupBox_2->setTitle(QApplication::translate("CertificateInfo", "Certificate Information", nullptr)); + CertificateInfo->setWindowTitle(QCoreApplication::translate("CertificateInfo", "Display Certificate Information", nullptr)); + groupBox->setTitle(QCoreApplication::translate("CertificateInfo", "Certification Path", nullptr)); + groupBox_2->setTitle(QCoreApplication::translate("CertificateInfo", "Certificate Information", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/chatdialog.ui.h b/tests/auto/tools/uic/baseline/chatdialog.ui.h index ace6951669..2a1ba2e84c 100644 --- a/tests/auto/tools/uic/baseline/chatdialog.ui.h +++ b/tests/auto/tools/uic/baseline/chatdialog.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'chatdialog.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -97,8 +97,8 @@ public: void retranslateUi(QDialog *ChatDialog) { - ChatDialog->setWindowTitle(QApplication::translate("ChatDialog", "Chat", nullptr)); - label->setText(QApplication::translate("ChatDialog", "Message:", nullptr)); + ChatDialog->setWindowTitle(QCoreApplication::translate("ChatDialog", "Chat", nullptr)); + label->setText(QCoreApplication::translate("ChatDialog", "Message:", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/chatmainwindow.ui.h b/tests/auto/tools/uic/baseline/chatmainwindow.ui.h index 8d4ccd53ae..220d44300b 100644 --- a/tests/auto/tools/uic/baseline/chatmainwindow.ui.h +++ b/tests/auto/tools/uic/baseline/chatmainwindow.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'chatmainwindow.ui' ** -** Created by: Qt User Interface Compiler version 5.9.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -99,7 +99,7 @@ public: sendButton = new QPushButton(centralwidget); sendButton->setObjectName(QString::fromUtf8("sendButton")); - QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(1), static_cast<QSizePolicy::Policy>(0)); + QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(sendButton->sizePolicy().hasHeightForWidth()); @@ -125,9 +125,9 @@ public: statusbar = new QStatusBar(ChatMainWindow); statusbar->setObjectName(QString::fromUtf8("statusbar")); ChatMainWindow->setStatusBar(statusbar); -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) label->setBuddy(messageLineEdit); -#endif // QT_NO_SHORTCUT +#endif // QT_CONFIG(shortcut) QWidget::setTabOrder(chatHistory, messageLineEdit); QWidget::setTabOrder(messageLineEdit, sendButton); @@ -147,29 +147,29 @@ public: void retranslateUi(QMainWindow *ChatMainWindow) { - ChatMainWindow->setWindowTitle(QApplication::translate("ChatMainWindow", "Qt D-Bus Chat", nullptr)); - actionQuit->setText(QApplication::translate("ChatMainWindow", "Quit", nullptr)); -#ifndef QT_NO_SHORTCUT - actionQuit->setShortcut(QApplication::translate("ChatMainWindow", "Ctrl+Q", nullptr)); -#endif // QT_NO_SHORTCUT - actionAboutQt->setText(QApplication::translate("ChatMainWindow", "About Qt...", nullptr)); - actionChangeNickname->setText(QApplication::translate("ChatMainWindow", "Change nickname...", nullptr)); -#ifndef QT_NO_SHORTCUT - actionChangeNickname->setShortcut(QApplication::translate("ChatMainWindow", "Ctrl+N", nullptr)); -#endif // QT_NO_SHORTCUT -#ifndef QT_NO_TOOLTIP - chatHistory->setToolTip(QApplication::translate("ChatMainWindow", "Messages sent and received from other users", nullptr)); -#endif // QT_NO_TOOLTIP - label->setText(QApplication::translate("ChatMainWindow", "Message:", nullptr)); -#ifndef QT_NO_TOOLTIP - sendButton->setToolTip(QApplication::translate("ChatMainWindow", "Sends a message to other people", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_WHATSTHIS + ChatMainWindow->setWindowTitle(QCoreApplication::translate("ChatMainWindow", "Qt D-Bus Chat", nullptr)); + actionQuit->setText(QCoreApplication::translate("ChatMainWindow", "Quit", nullptr)); +#if QT_CONFIG(shortcut) + actionQuit->setShortcut(QCoreApplication::translate("ChatMainWindow", "Ctrl+Q", nullptr)); +#endif // QT_CONFIG(shortcut) + actionAboutQt->setText(QCoreApplication::translate("ChatMainWindow", "About Qt...", nullptr)); + actionChangeNickname->setText(QCoreApplication::translate("ChatMainWindow", "Change nickname...", nullptr)); +#if QT_CONFIG(shortcut) + actionChangeNickname->setShortcut(QCoreApplication::translate("ChatMainWindow", "Ctrl+N", nullptr)); +#endif // QT_CONFIG(shortcut) +#if QT_CONFIG(tooltip) + chatHistory->setToolTip(QCoreApplication::translate("ChatMainWindow", "Messages sent and received from other users", nullptr)); +#endif // QT_CONFIG(tooltip) + label->setText(QCoreApplication::translate("ChatMainWindow", "Message:", nullptr)); +#if QT_CONFIG(tooltip) + sendButton->setToolTip(QCoreApplication::translate("ChatMainWindow", "Sends a message to other people", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(whatsthis) sendButton->setWhatsThis(QString()); -#endif // QT_NO_WHATSTHIS - sendButton->setText(QApplication::translate("ChatMainWindow", "Send", nullptr)); - menuQuit->setTitle(QApplication::translate("ChatMainWindow", "Help", nullptr)); - menuFile->setTitle(QApplication::translate("ChatMainWindow", "File", nullptr)); +#endif // QT_CONFIG(whatsthis) + sendButton->setText(QCoreApplication::translate("ChatMainWindow", "Send", nullptr)); + menuQuit->setTitle(QCoreApplication::translate("ChatMainWindow", "Help", nullptr)); + menuFile->setTitle(QCoreApplication::translate("ChatMainWindow", "File", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/chatsetnickname.ui.h b/tests/auto/tools/uic/baseline/chatsetnickname.ui.h index c73dfb2c6e..0e93828c90 100644 --- a/tests/auto/tools/uic/baseline/chatsetnickname.ui.h +++ b/tests/auto/tools/uic/baseline/chatsetnickname.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'chatsetnickname.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -39,7 +39,7 @@ public: if (NicknameDialog->objectName().isEmpty()) NicknameDialog->setObjectName(QString::fromUtf8("NicknameDialog")); NicknameDialog->resize(396, 105); - QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(1), static_cast<QSizePolicy::Policy>(1)); + QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(NicknameDialog->sizePolicy().hasHeightForWidth()); @@ -112,10 +112,10 @@ public: void retranslateUi(QDialog *NicknameDialog) { - NicknameDialog->setWindowTitle(QApplication::translate("NicknameDialog", "Set nickname", nullptr)); - label->setText(QApplication::translate("NicknameDialog", "New nickname:", nullptr)); - okButton->setText(QApplication::translate("NicknameDialog", "OK", nullptr)); - cancelButton->setText(QApplication::translate("NicknameDialog", "Cancel", nullptr)); + NicknameDialog->setWindowTitle(QCoreApplication::translate("NicknameDialog", "Set nickname", nullptr)); + label->setText(QCoreApplication::translate("NicknameDialog", "New nickname:", nullptr)); + okButton->setText(QCoreApplication::translate("NicknameDialog", "OK", nullptr)); + cancelButton->setText(QCoreApplication::translate("NicknameDialog", "Cancel", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/config.ui.h b/tests/auto/tools/uic/baseline/config.ui.h index 8287e0b1ac..153718aca1 100644 --- a/tests/auto/tools/uic/baseline/config.ui.h +++ b/tests/auto/tools/uic/baseline/config.ui.h @@ -31,7 +31,7 @@ /******************************************************************************** ** Form generated from reading UI file 'config.ui' ** -** Created by: Qt User Interface Compiler version 5.10.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -706,44 +706,44 @@ public: void retranslateUi(QDialog *Config) { - Config->setWindowTitle(QApplication::translate("Config", "Configure", nullptr)); - ButtonGroup1->setTitle(QApplication::translate("Config", "Size", nullptr)); - size_176_220->setText(QApplication::translate("Config", "176x220 \"SmartPhone\"", nullptr)); - size_240_320->setText(QApplication::translate("Config", "240x320 \"PDA\"", nullptr)); - size_320_240->setText(QApplication::translate("Config", "320x240 \"TV\" / \"QVGA\"", nullptr)); - size_640_480->setText(QApplication::translate("Config", "640x480 \"VGA\"", nullptr)); - size_800_600->setText(QApplication::translate("Config", "800x600", nullptr)); - size_1024_768->setText(QApplication::translate("Config", "1024x768", nullptr)); - size_custom->setText(QApplication::translate("Config", "Custom", nullptr)); - ButtonGroup2->setTitle(QApplication::translate("Config", "Depth", nullptr)); - depth_1->setText(QApplication::translate("Config", "1 bit monochrome", nullptr)); - depth_4gray->setText(QApplication::translate("Config", "4 bit grayscale", nullptr)); - depth_8->setText(QApplication::translate("Config", "8 bit", nullptr)); - depth_12->setText(QApplication::translate("Config", "12 (16) bit", nullptr)); - depth_15->setText(QApplication::translate("Config", "15 bit", nullptr)); - depth_16->setText(QApplication::translate("Config", "16 bit", nullptr)); - depth_18->setText(QApplication::translate("Config", "18 bit", nullptr)); - depth_24->setText(QApplication::translate("Config", "24 bit", nullptr)); - depth_32->setText(QApplication::translate("Config", "32 bit", nullptr)); - depth_32_argb->setText(QApplication::translate("Config", "32 bit ARGB", nullptr)); - TextLabel1_3->setText(QApplication::translate("Config", "Skin", nullptr)); - skin->setItemText(0, QApplication::translate("Config", "None", nullptr)); - - touchScreen->setText(QApplication::translate("Config", "Emulate touch screen (no mouse move)", nullptr)); - lcdScreen->setText(QApplication::translate("Config", "Emulate LCD screen (Only with fixed zoom of 3.0 times magnification)", nullptr)); - TextLabel1->setText(QApplication::translate("Config", "<p>Note that any applications using the virtual framebuffer will be terminated if you change the Size or Depth <i>above</i>. You may freely modify the Gamma <i>below</i>.", nullptr)); - GroupBox1->setTitle(QApplication::translate("Config", "Gamma", nullptr)); - TextLabel3->setText(QApplication::translate("Config", "Blue", nullptr)); - blabel->setText(QApplication::translate("Config", "1.0", nullptr)); - TextLabel2->setText(QApplication::translate("Config", "Green", nullptr)); - glabel->setText(QApplication::translate("Config", "1.0", nullptr)); - TextLabel7->setText(QApplication::translate("Config", "All", nullptr)); - TextLabel8->setText(QApplication::translate("Config", "1.0", nullptr)); - TextLabel1_2->setText(QApplication::translate("Config", "Red", nullptr)); - rlabel->setText(QApplication::translate("Config", "1.0", nullptr)); - PushButton3->setText(QApplication::translate("Config", "Set all to 1.0", nullptr)); - buttonOk->setText(QApplication::translate("Config", "&OK", nullptr)); - buttonCancel->setText(QApplication::translate("Config", "&Cancel", nullptr)); + Config->setWindowTitle(QCoreApplication::translate("Config", "Configure", nullptr)); + ButtonGroup1->setTitle(QCoreApplication::translate("Config", "Size", nullptr)); + size_176_220->setText(QCoreApplication::translate("Config", "176x220 \"SmartPhone\"", nullptr)); + size_240_320->setText(QCoreApplication::translate("Config", "240x320 \"PDA\"", nullptr)); + size_320_240->setText(QCoreApplication::translate("Config", "320x240 \"TV\" / \"QVGA\"", nullptr)); + size_640_480->setText(QCoreApplication::translate("Config", "640x480 \"VGA\"", nullptr)); + size_800_600->setText(QCoreApplication::translate("Config", "800x600", nullptr)); + size_1024_768->setText(QCoreApplication::translate("Config", "1024x768", nullptr)); + size_custom->setText(QCoreApplication::translate("Config", "Custom", nullptr)); + ButtonGroup2->setTitle(QCoreApplication::translate("Config", "Depth", nullptr)); + depth_1->setText(QCoreApplication::translate("Config", "1 bit monochrome", nullptr)); + depth_4gray->setText(QCoreApplication::translate("Config", "4 bit grayscale", nullptr)); + depth_8->setText(QCoreApplication::translate("Config", "8 bit", nullptr)); + depth_12->setText(QCoreApplication::translate("Config", "12 (16) bit", nullptr)); + depth_15->setText(QCoreApplication::translate("Config", "15 bit", nullptr)); + depth_16->setText(QCoreApplication::translate("Config", "16 bit", nullptr)); + depth_18->setText(QCoreApplication::translate("Config", "18 bit", nullptr)); + depth_24->setText(QCoreApplication::translate("Config", "24 bit", nullptr)); + depth_32->setText(QCoreApplication::translate("Config", "32 bit", nullptr)); + depth_32_argb->setText(QCoreApplication::translate("Config", "32 bit ARGB", nullptr)); + TextLabel1_3->setText(QCoreApplication::translate("Config", "Skin", nullptr)); + skin->setItemText(0, QCoreApplication::translate("Config", "None", nullptr)); + + touchScreen->setText(QCoreApplication::translate("Config", "Emulate touch screen (no mouse move)", nullptr)); + lcdScreen->setText(QCoreApplication::translate("Config", "Emulate LCD screen (Only with fixed zoom of 3.0 times magnification)", nullptr)); + TextLabel1->setText(QCoreApplication::translate("Config", "<p>Note that any applications using the virtual framebuffer will be terminated if you change the Size or Depth <i>above</i>. You may freely modify the Gamma <i>below</i>.", nullptr)); + GroupBox1->setTitle(QCoreApplication::translate("Config", "Gamma", nullptr)); + TextLabel3->setText(QCoreApplication::translate("Config", "Blue", nullptr)); + blabel->setText(QCoreApplication::translate("Config", "1.0", nullptr)); + TextLabel2->setText(QCoreApplication::translate("Config", "Green", nullptr)); + glabel->setText(QCoreApplication::translate("Config", "1.0", nullptr)); + TextLabel7->setText(QCoreApplication::translate("Config", "All", nullptr)); + TextLabel8->setText(QCoreApplication::translate("Config", "1.0", nullptr)); + TextLabel1_2->setText(QCoreApplication::translate("Config", "Red", nullptr)); + rlabel->setText(QCoreApplication::translate("Config", "1.0", nullptr)); + PushButton3->setText(QCoreApplication::translate("Config", "Set all to 1.0", nullptr)); + buttonOk->setText(QCoreApplication::translate("Config", "&OK", nullptr)); + buttonCancel->setText(QCoreApplication::translate("Config", "&Cancel", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/connectdialog.ui.h b/tests/auto/tools/uic/baseline/connectdialog.ui.h index a470a6705d..1e91b498f4 100644 --- a/tests/auto/tools/uic/baseline/connectdialog.ui.h +++ b/tests/auto/tools/uic/baseline/connectdialog.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'connectdialog.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -126,12 +126,12 @@ public: void retranslateUi(QDialog *ConnectDialog) { - ConnectDialog->setWindowTitle(QApplication::translate("ConnectDialog", "Configure Connection", nullptr)); - signalGroupBox->setTitle(QApplication::translate("ConnectDialog", "GroupBox", nullptr)); - editSignalsButton->setText(QApplication::translate("ConnectDialog", "Edit...", nullptr)); - slotGroupBox->setTitle(QApplication::translate("ConnectDialog", "GroupBox", nullptr)); - editSlotsButton->setText(QApplication::translate("ConnectDialog", "Edit...", nullptr)); - showAllCheckBox->setText(QApplication::translate("ConnectDialog", "Show signals and slots inherited from QWidget", nullptr)); + ConnectDialog->setWindowTitle(QCoreApplication::translate("ConnectDialog", "Configure Connection", nullptr)); + signalGroupBox->setTitle(QCoreApplication::translate("ConnectDialog", "GroupBox", nullptr)); + editSignalsButton->setText(QCoreApplication::translate("ConnectDialog", "Edit...", nullptr)); + slotGroupBox->setTitle(QCoreApplication::translate("ConnectDialog", "GroupBox", nullptr)); + editSlotsButton->setText(QCoreApplication::translate("ConnectDialog", "Edit...", nullptr)); + showAllCheckBox->setText(QCoreApplication::translate("ConnectDialog", "Show signals and slots inherited from QWidget", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/controller.ui.h b/tests/auto/tools/uic/baseline/controller.ui.h index 72b0956472..3ebfad187f 100644 --- a/tests/auto/tools/uic/baseline/controller.ui.h +++ b/tests/auto/tools/uic/baseline/controller.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'controller.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -75,12 +75,12 @@ public: void retranslateUi(QWidget *Controller) { - Controller->setWindowTitle(QApplication::translate("Controller", "Controller", nullptr)); - label->setText(QApplication::translate("Controller", "Controller", nullptr)); - decelerate->setText(QApplication::translate("Controller", "Decelerate", nullptr)); - accelerate->setText(QApplication::translate("Controller", "Accelerate", nullptr)); - right->setText(QApplication::translate("Controller", "Right", nullptr)); - left->setText(QApplication::translate("Controller", "Left", nullptr)); + Controller->setWindowTitle(QCoreApplication::translate("Controller", "Controller", nullptr)); + label->setText(QCoreApplication::translate("Controller", "Controller", nullptr)); + decelerate->setText(QCoreApplication::translate("Controller", "Decelerate", nullptr)); + accelerate->setText(QCoreApplication::translate("Controller", "Accelerate", nullptr)); + right->setText(QCoreApplication::translate("Controller", "Right", nullptr)); + left->setText(QCoreApplication::translate("Controller", "Left", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/cookies.ui.h b/tests/auto/tools/uic/baseline/cookies.ui.h index 144c306874..2cc21888b1 100644 --- a/tests/auto/tools/uic/baseline/cookies.ui.h +++ b/tests/auto/tools/uic/baseline/cookies.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'cookies.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -91,9 +91,9 @@ public: void retranslateUi(QDialog *CookiesDialog) { - CookiesDialog->setWindowTitle(QApplication::translate("CookiesDialog", "Cookies", nullptr)); - removeButton->setText(QApplication::translate("CookiesDialog", "&Remove", nullptr)); - removeAllButton->setText(QApplication::translate("CookiesDialog", "Remove &All Cookies", nullptr)); + CookiesDialog->setWindowTitle(QCoreApplication::translate("CookiesDialog", "Cookies", nullptr)); + removeButton->setText(QCoreApplication::translate("CookiesDialog", "&Remove", nullptr)); + removeAllButton->setText(QCoreApplication::translate("CookiesDialog", "Remove &All Cookies", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/cookiesexceptions.ui.h b/tests/auto/tools/uic/baseline/cookiesexceptions.ui.h index a3bf7a449e..77212cf2f3 100644 --- a/tests/auto/tools/uic/baseline/cookiesexceptions.ui.h +++ b/tests/auto/tools/uic/baseline/cookiesexceptions.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'cookiesexceptions.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -158,15 +158,15 @@ public: void retranslateUi(QDialog *CookiesExceptionsDialog) { - CookiesExceptionsDialog->setWindowTitle(QApplication::translate("CookiesExceptionsDialog", "Cookie Exceptions", nullptr)); - newExceptionGroupBox->setTitle(QApplication::translate("CookiesExceptionsDialog", "New Exception", nullptr)); - label->setText(QApplication::translate("CookiesExceptionsDialog", "Domain:", nullptr)); - blockButton->setText(QApplication::translate("CookiesExceptionsDialog", "Block", nullptr)); - allowForSessionButton->setText(QApplication::translate("CookiesExceptionsDialog", "Allow For Session", nullptr)); - allowButton->setText(QApplication::translate("CookiesExceptionsDialog", "Allow", nullptr)); - ExceptionsGroupBox->setTitle(QApplication::translate("CookiesExceptionsDialog", "Exceptions", nullptr)); - removeButton->setText(QApplication::translate("CookiesExceptionsDialog", "&Remove", nullptr)); - removeAllButton->setText(QApplication::translate("CookiesExceptionsDialog", "Remove &All", nullptr)); + CookiesExceptionsDialog->setWindowTitle(QCoreApplication::translate("CookiesExceptionsDialog", "Cookie Exceptions", nullptr)); + newExceptionGroupBox->setTitle(QCoreApplication::translate("CookiesExceptionsDialog", "New Exception", nullptr)); + label->setText(QCoreApplication::translate("CookiesExceptionsDialog", "Domain:", nullptr)); + blockButton->setText(QCoreApplication::translate("CookiesExceptionsDialog", "Block", nullptr)); + allowForSessionButton->setText(QCoreApplication::translate("CookiesExceptionsDialog", "Allow For Session", nullptr)); + allowButton->setText(QCoreApplication::translate("CookiesExceptionsDialog", "Allow", nullptr)); + ExceptionsGroupBox->setTitle(QCoreApplication::translate("CookiesExceptionsDialog", "Exceptions", nullptr)); + removeButton->setText(QCoreApplication::translate("CookiesExceptionsDialog", "&Remove", nullptr)); + removeAllButton->setText(QCoreApplication::translate("CookiesExceptionsDialog", "Remove &All", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/default.ui.h b/tests/auto/tools/uic/baseline/default.ui.h index fafff9d728..fbbe81d0b8 100644 --- a/tests/auto/tools/uic/baseline/default.ui.h +++ b/tests/auto/tools/uic/baseline/default.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'default.ui' ** -** Created by: Qt User Interface Compiler version 5.10.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -192,13 +192,13 @@ public: statusbar = new QStatusBar(MainWindow); statusbar->setObjectName(QString::fromUtf8("statusbar")); MainWindow->setStatusBar(statusbar); -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) nameLabel->setBuddy(nameCombo); ageLabel->setBuddy(ageSpinBox); passwordLabel->setBuddy(passwordEdit); label->setBuddy(professionList); countryLabel->setBuddy(professionList); -#endif // QT_NO_SHORTCUT +#endif // QT_CONFIG(shortcut) QWidget::setTabOrder(maleRadioButton, femaleRadioButton); QWidget::setTabOrder(femaleRadioButton, ageSpinBox); QWidget::setTabOrder(ageSpinBox, passwordEdit); @@ -226,84 +226,84 @@ public: void retranslateUi(QMainWindow *MainWindow) { - MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", nullptr)); - exitAction->setText(QApplication::translate("MainWindow", "&Exit", nullptr)); - aboutQtAction->setText(QApplication::translate("MainWindow", "About Qt", nullptr)); - editStyleAction->setText(QApplication::translate("MainWindow", "Edit &Style", nullptr)); - aboutAction->setText(QApplication::translate("MainWindow", "About", nullptr)); - nameLabel->setText(QApplication::translate("MainWindow", "&Name:", nullptr)); - nameCombo->setItemText(0, QApplication::translate("MainWindow", "Girish", nullptr)); - nameCombo->setItemText(1, QApplication::translate("MainWindow", "Jasmin", nullptr)); - nameCombo->setItemText(2, QApplication::translate("MainWindow", "Simon", nullptr)); - nameCombo->setItemText(3, QApplication::translate("MainWindow", "Zack", nullptr)); - -#ifndef QT_NO_TOOLTIP - nameCombo->setToolTip(QApplication::translate("MainWindow", "Specify your name", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_TOOLTIP - femaleRadioButton->setToolTip(QApplication::translate("MainWindow", "Check this if you are female", nullptr)); -#endif // QT_NO_TOOLTIP - femaleRadioButton->setText(QApplication::translate("MainWindow", "&Female", nullptr)); -#ifndef QT_NO_TOOLTIP - agreeCheckBox->setToolTip(QApplication::translate("MainWindow", "Please read the license before checking this", nullptr)); -#endif // QT_NO_TOOLTIP - agreeCheckBox->setText(QApplication::translate("MainWindow", "I &accept the terms and conditions", nullptr)); -#ifndef QT_NO_TOOLTIP - maleRadioButton->setToolTip(QApplication::translate("MainWindow", "Check this if you are male", nullptr)); -#endif // QT_NO_TOOLTIP - maleRadioButton->setText(QApplication::translate("MainWindow", "&Male", nullptr)); - genderLabel->setText(QApplication::translate("MainWindow", "Gender:", nullptr)); -#ifndef QT_NO_TOOLTIP - ageSpinBox->setToolTip(QApplication::translate("MainWindow", "Specify your age", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_STATUSTIP - ageSpinBox->setStatusTip(QApplication::translate("MainWindow", "Specify your age here", nullptr)); -#endif // QT_NO_STATUSTIP - ageLabel->setText(QApplication::translate("MainWindow", "&Age:", nullptr)); - passwordLabel->setText(QApplication::translate("MainWindow", "&Password:", nullptr)); -#ifndef QT_NO_TOOLTIP - passwordEdit->setToolTip(QApplication::translate("MainWindow", "Specify your password", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_STATUSTIP - passwordEdit->setStatusTip(QApplication::translate("MainWindow", "Specify your password here", nullptr)); -#endif // QT_NO_STATUSTIP - passwordEdit->setText(QApplication::translate("MainWindow", "Password", nullptr)); - label->setText(QApplication::translate("MainWindow", "Profession", nullptr)); - countryLabel->setText(QApplication::translate("MainWindow", "&Country", nullptr)); + MainWindow->setWindowTitle(QCoreApplication::translate("MainWindow", "MainWindow", nullptr)); + exitAction->setText(QCoreApplication::translate("MainWindow", "&Exit", nullptr)); + aboutQtAction->setText(QCoreApplication::translate("MainWindow", "About Qt", nullptr)); + editStyleAction->setText(QCoreApplication::translate("MainWindow", "Edit &Style", nullptr)); + aboutAction->setText(QCoreApplication::translate("MainWindow", "About", nullptr)); + nameLabel->setText(QCoreApplication::translate("MainWindow", "&Name:", nullptr)); + nameCombo->setItemText(0, QCoreApplication::translate("MainWindow", "Girish", nullptr)); + nameCombo->setItemText(1, QCoreApplication::translate("MainWindow", "Jasmin", nullptr)); + nameCombo->setItemText(2, QCoreApplication::translate("MainWindow", "Simon", nullptr)); + nameCombo->setItemText(3, QCoreApplication::translate("MainWindow", "Zack", nullptr)); + +#if QT_CONFIG(tooltip) + nameCombo->setToolTip(QCoreApplication::translate("MainWindow", "Specify your name", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(tooltip) + femaleRadioButton->setToolTip(QCoreApplication::translate("MainWindow", "Check this if you are female", nullptr)); +#endif // QT_CONFIG(tooltip) + femaleRadioButton->setText(QCoreApplication::translate("MainWindow", "&Female", nullptr)); +#if QT_CONFIG(tooltip) + agreeCheckBox->setToolTip(QCoreApplication::translate("MainWindow", "Please read the license before checking this", nullptr)); +#endif // QT_CONFIG(tooltip) + agreeCheckBox->setText(QCoreApplication::translate("MainWindow", "I &accept the terms and conditions", nullptr)); +#if QT_CONFIG(tooltip) + maleRadioButton->setToolTip(QCoreApplication::translate("MainWindow", "Check this if you are male", nullptr)); +#endif // QT_CONFIG(tooltip) + maleRadioButton->setText(QCoreApplication::translate("MainWindow", "&Male", nullptr)); + genderLabel->setText(QCoreApplication::translate("MainWindow", "Gender:", nullptr)); +#if QT_CONFIG(tooltip) + ageSpinBox->setToolTip(QCoreApplication::translate("MainWindow", "Specify your age", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(statustip) + ageSpinBox->setStatusTip(QCoreApplication::translate("MainWindow", "Specify your age here", nullptr)); +#endif // QT_CONFIG(statustip) + ageLabel->setText(QCoreApplication::translate("MainWindow", "&Age:", nullptr)); + passwordLabel->setText(QCoreApplication::translate("MainWindow", "&Password:", nullptr)); +#if QT_CONFIG(tooltip) + passwordEdit->setToolTip(QCoreApplication::translate("MainWindow", "Specify your password", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(statustip) + passwordEdit->setStatusTip(QCoreApplication::translate("MainWindow", "Specify your password here", nullptr)); +#endif // QT_CONFIG(statustip) + passwordEdit->setText(QCoreApplication::translate("MainWindow", "Password", nullptr)); + label->setText(QCoreApplication::translate("MainWindow", "Profession", nullptr)); + countryLabel->setText(QCoreApplication::translate("MainWindow", "&Country", nullptr)); const bool __sortingEnabled = professionList->isSortingEnabled(); professionList->setSortingEnabled(false); QListWidgetItem *___qlistwidgetitem = professionList->item(0); - ___qlistwidgetitem->setText(QApplication::translate("MainWindow", "Developer", nullptr)); + ___qlistwidgetitem->setText(QCoreApplication::translate("MainWindow", "Developer", nullptr)); QListWidgetItem *___qlistwidgetitem1 = professionList->item(1); - ___qlistwidgetitem1->setText(QApplication::translate("MainWindow", "Student", nullptr)); + ___qlistwidgetitem1->setText(QCoreApplication::translate("MainWindow", "Student", nullptr)); QListWidgetItem *___qlistwidgetitem2 = professionList->item(2); - ___qlistwidgetitem2->setText(QApplication::translate("MainWindow", "Fisherman", nullptr)); + ___qlistwidgetitem2->setText(QCoreApplication::translate("MainWindow", "Fisherman", nullptr)); professionList->setSortingEnabled(__sortingEnabled); -#ifndef QT_NO_TOOLTIP - professionList->setToolTip(QApplication::translate("MainWindow", "Select your profession", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_STATUSTIP - professionList->setStatusTip(QApplication::translate("MainWindow", "Select your profession", nullptr)); -#endif // QT_NO_STATUSTIP -#ifndef QT_NO_WHATSTHIS - professionList->setWhatsThis(QApplication::translate("MainWindow", "Select your profession", nullptr)); -#endif // QT_NO_WHATSTHIS - countryCombo->setItemText(0, QApplication::translate("MainWindow", "Germany", nullptr)); - countryCombo->setItemText(1, QApplication::translate("MainWindow", "India", nullptr)); - countryCombo->setItemText(2, QApplication::translate("MainWindow", "Norway", nullptr)); - countryCombo->setItemText(3, QApplication::translate("MainWindow", "United States Of America", nullptr)); - countryCombo->setItemText(4, QApplication::translate("MainWindow", "United Kingdom", nullptr)); - -#ifndef QT_NO_TOOLTIP - countryCombo->setToolTip(QApplication::translate("MainWindow", "Specify your country", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_STATUSTIP - countryCombo->setStatusTip(QApplication::translate("MainWindow", "Specify your country here", nullptr)); -#endif // QT_NO_STATUSTIP - menu_File->setTitle(QApplication::translate("MainWindow", "&File", nullptr)); - menu_Help->setTitle(QApplication::translate("MainWindow", "&Help", nullptr)); +#if QT_CONFIG(tooltip) + professionList->setToolTip(QCoreApplication::translate("MainWindow", "Select your profession", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(statustip) + professionList->setStatusTip(QCoreApplication::translate("MainWindow", "Select your profession", nullptr)); +#endif // QT_CONFIG(statustip) +#if QT_CONFIG(whatsthis) + professionList->setWhatsThis(QCoreApplication::translate("MainWindow", "Select your profession", nullptr)); +#endif // QT_CONFIG(whatsthis) + countryCombo->setItemText(0, QCoreApplication::translate("MainWindow", "Germany", nullptr)); + countryCombo->setItemText(1, QCoreApplication::translate("MainWindow", "India", nullptr)); + countryCombo->setItemText(2, QCoreApplication::translate("MainWindow", "Norway", nullptr)); + countryCombo->setItemText(3, QCoreApplication::translate("MainWindow", "United States Of America", nullptr)); + countryCombo->setItemText(4, QCoreApplication::translate("MainWindow", "United Kingdom", nullptr)); + +#if QT_CONFIG(tooltip) + countryCombo->setToolTip(QCoreApplication::translate("MainWindow", "Specify your country", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(statustip) + countryCombo->setStatusTip(QCoreApplication::translate("MainWindow", "Specify your country here", nullptr)); +#endif // QT_CONFIG(statustip) + menu_File->setTitle(QCoreApplication::translate("MainWindow", "&File", nullptr)); + menu_Help->setTitle(QCoreApplication::translate("MainWindow", "&Help", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/dialog.ui.h b/tests/auto/tools/uic/baseline/dialog.ui.h index 2a159312b9..aeed71d058 100644 --- a/tests/auto/tools/uic/baseline/dialog.ui.h +++ b/tests/auto/tools/uic/baseline/dialog.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'dialog.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -58,10 +58,10 @@ public: void retranslateUi(QDialog *Dialog) { - Dialog->setWindowTitle(QApplication::translate("Dialog", "Dialog", nullptr)); - loadFromFileButton->setText(QApplication::translate("Dialog", "Load Image From File...", nullptr)); - label->setText(QApplication::translate("Dialog", "Launch two of these dialogs. In the first, press the top button and load an image from a file. In the second, press the bottom button and display the loaded image from shared memory.", nullptr)); - loadFromSharedMemoryButton->setText(QApplication::translate("Dialog", "Display Image From Shared Memory", nullptr)); + Dialog->setWindowTitle(QCoreApplication::translate("Dialog", "Dialog", nullptr)); + loadFromFileButton->setText(QCoreApplication::translate("Dialog", "Load Image From File...", nullptr)); + label->setText(QCoreApplication::translate("Dialog", "Launch two of these dialogs. In the first, press the top button and load an image from a file. In the second, press the bottom button and display the loaded image from shared memory.", nullptr)); + loadFromSharedMemoryButton->setText(QCoreApplication::translate("Dialog", "Display Image From Shared Memory", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/downloaditem.ui.h b/tests/auto/tools/uic/baseline/downloaditem.ui.h index f0e8e88307..31d938f0eb 100644 --- a/tests/auto/tools/uic/baseline/downloaditem.ui.h +++ b/tests/auto/tools/uic/baseline/downloaditem.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'downloaditem.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -124,13 +124,13 @@ public: void retranslateUi(QWidget *DownloadItem) { - DownloadItem->setWindowTitle(QApplication::translate("DownloadItem", "Form", nullptr)); - fileIcon->setText(QApplication::translate("DownloadItem", "Ico", nullptr)); - fileNameLabel->setProperty("text", QVariant(QApplication::translate("DownloadItem", "Filename", nullptr))); + DownloadItem->setWindowTitle(QCoreApplication::translate("DownloadItem", "Form", nullptr)); + fileIcon->setText(QCoreApplication::translate("DownloadItem", "Ico", nullptr)); + fileNameLabel->setProperty("text", QVariant(QCoreApplication::translate("DownloadItem", "Filename", nullptr))); downloadInfoLabel->setProperty("text", QVariant(QString())); - tryAgainButton->setText(QApplication::translate("DownloadItem", "Try Again", nullptr)); - stopButton->setText(QApplication::translate("DownloadItem", "Stop", nullptr)); - openButton->setText(QApplication::translate("DownloadItem", "Open", nullptr)); + tryAgainButton->setText(QCoreApplication::translate("DownloadItem", "Try Again", nullptr)); + stopButton->setText(QCoreApplication::translate("DownloadItem", "Stop", nullptr)); + openButton->setText(QCoreApplication::translate("DownloadItem", "Open", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/downloads.ui.h b/tests/auto/tools/uic/baseline/downloads.ui.h index 1df992d30f..1b5b825792 100644 --- a/tests/auto/tools/uic/baseline/downloads.ui.h +++ b/tests/auto/tools/uic/baseline/downloads.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'downloads.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -79,9 +79,9 @@ public: void retranslateUi(QDialog *DownloadDialog) { - DownloadDialog->setWindowTitle(QApplication::translate("DownloadDialog", "Downloads", nullptr)); - cleanupButton->setText(QApplication::translate("DownloadDialog", "Clean up", nullptr)); - itemCount->setText(QApplication::translate("DownloadDialog", "0 Items", nullptr)); + DownloadDialog->setWindowTitle(QCoreApplication::translate("DownloadDialog", "Downloads", nullptr)); + cleanupButton->setText(QCoreApplication::translate("DownloadDialog", "Clean up", nullptr)); + itemCount->setText(QCoreApplication::translate("DownloadDialog", "0 Items", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/embeddeddialog.ui.h b/tests/auto/tools/uic/baseline/embeddeddialog.ui.h index 194ff578e8..20d6567576 100644 --- a/tests/auto/tools/uic/baseline/embeddeddialog.ui.h +++ b/tests/auto/tools/uic/baseline/embeddeddialog.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'embeddeddialog.ui' ** -** Created by: Qt User Interface Compiler version 5.10.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -83,12 +83,12 @@ public: formLayout->setWidget(3, QFormLayout::FieldRole, spacing); -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) label->setBuddy(layoutDirection); label_2->setBuddy(fontComboBox); label_3->setBuddy(style); label_4->setBuddy(spacing); -#endif // QT_NO_SHORTCUT +#endif // QT_CONFIG(shortcut) retranslateUi(embeddedDialog); @@ -97,14 +97,14 @@ public: void retranslateUi(QDialog *embeddedDialog) { - embeddedDialog->setWindowTitle(QApplication::translate("embeddedDialog", "Embedded Dialog", nullptr)); - label->setText(QApplication::translate("embeddedDialog", "Layout Direction:", nullptr)); - layoutDirection->setItemText(0, QApplication::translate("embeddedDialog", "Left to Right", nullptr)); - layoutDirection->setItemText(1, QApplication::translate("embeddedDialog", "Right to Left", nullptr)); - - label_2->setText(QApplication::translate("embeddedDialog", "Select Font:", nullptr)); - label_3->setText(QApplication::translate("embeddedDialog", "Style:", nullptr)); - label_4->setText(QApplication::translate("embeddedDialog", "Layout spacing:", nullptr)); + embeddedDialog->setWindowTitle(QCoreApplication::translate("embeddedDialog", "Embedded Dialog", nullptr)); + label->setText(QCoreApplication::translate("embeddedDialog", "Layout Direction:", nullptr)); + layoutDirection->setItemText(0, QCoreApplication::translate("embeddedDialog", "Left to Right", nullptr)); + layoutDirection->setItemText(1, QCoreApplication::translate("embeddedDialog", "Right to Left", nullptr)); + + label_2->setText(QCoreApplication::translate("embeddedDialog", "Select Font:", nullptr)); + label_3->setText(QCoreApplication::translate("embeddedDialog", "Style:", nullptr)); + label_4->setText(QCoreApplication::translate("embeddedDialog", "Layout spacing:", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/enumnostdset.ui.h b/tests/auto/tools/uic/baseline/enumnostdset.ui.h index 233fc616ac..54ec7c4161 100644 --- a/tests/auto/tools/uic/baseline/enumnostdset.ui.h +++ b/tests/auto/tools/uic/baseline/enumnostdset.ui.h @@ -38,7 +38,7 @@ public: void retranslateUi(QWidget *Form) { - Form->setWindowTitle(QApplication::translate("Form", "Form", nullptr)); + Form->setWindowTitle(QCoreApplication::translate("Form", "Form", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/filespage.ui.h b/tests/auto/tools/uic/baseline/filespage.ui.h index 29ed981a8a..327b2c571b 100644 --- a/tests/auto/tools/uic/baseline/filespage.ui.h +++ b/tests/auto/tools/uic/baseline/filespage.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'filespage.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -80,10 +80,10 @@ public: void retranslateUi(QWidget *FilesPage) { - FilesPage->setWindowTitle(QApplication::translate("FilesPage", "Form", nullptr)); - fileLabel->setText(QApplication::translate("FilesPage", "Files:", nullptr)); - removeButton->setText(QApplication::translate("FilesPage", "Remove", nullptr)); - removeAllButton->setText(QApplication::translate("FilesPage", "Remove All", nullptr)); + FilesPage->setWindowTitle(QCoreApplication::translate("FilesPage", "Form", nullptr)); + fileLabel->setText(QCoreApplication::translate("FilesPage", "Files:", nullptr)); + removeButton->setText(QCoreApplication::translate("FilesPage", "Remove", nullptr)); + removeAllButton->setText(QCoreApplication::translate("FilesPage", "Remove All", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/filternamedialog.ui.h b/tests/auto/tools/uic/baseline/filternamedialog.ui.h index 716c291fdd..0098282d59 100644 --- a/tests/auto/tools/uic/baseline/filternamedialog.ui.h +++ b/tests/auto/tools/uic/baseline/filternamedialog.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'filternamedialog.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -76,8 +76,8 @@ public: void retranslateUi(QDialog *FilterNameDialogClass) { - FilterNameDialogClass->setWindowTitle(QApplication::translate("FilterNameDialogClass", "FilterNameDialog", nullptr)); - label->setText(QApplication::translate("FilterNameDialogClass", "Filter Name:", nullptr)); + FilterNameDialogClass->setWindowTitle(QCoreApplication::translate("FilterNameDialogClass", "FilterNameDialog", nullptr)); + label->setText(QCoreApplication::translate("FilterNameDialogClass", "Filter Name:", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/filterpage.ui.h b/tests/auto/tools/uic/baseline/filterpage.ui.h index f6610fdc4d..1581c6554d 100644 --- a/tests/auto/tools/uic/baseline/filterpage.ui.h +++ b/tests/auto/tools/uic/baseline/filterpage.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'filterpage.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -103,14 +103,14 @@ public: void retranslateUi(QWidget *FilterPage) { - FilterPage->setWindowTitle(QApplication::translate("FilterPage", "Form", nullptr)); - label->setText(QApplication::translate("FilterPage", "Filter attributes for current documentation (comma separated list):", nullptr)); - groupBox->setTitle(QApplication::translate("FilterPage", "Custom Filters", nullptr)); + FilterPage->setWindowTitle(QCoreApplication::translate("FilterPage", "Form", nullptr)); + label->setText(QCoreApplication::translate("FilterPage", "Filter attributes for current documentation (comma separated list):", nullptr)); + groupBox->setTitle(QCoreApplication::translate("FilterPage", "Custom Filters", nullptr)); QTreeWidgetItem *___qtreewidgetitem = customFilterWidget->headerItem(); - ___qtreewidgetitem->setText(1, QApplication::translate("FilterPage", "2", nullptr)); - ___qtreewidgetitem->setText(0, QApplication::translate("FilterPage", "1", nullptr)); - addButton->setText(QApplication::translate("FilterPage", "Add", nullptr)); - removeButton->setText(QApplication::translate("FilterPage", "Remove", nullptr)); + ___qtreewidgetitem->setText(1, QCoreApplication::translate("FilterPage", "2", nullptr)); + ___qtreewidgetitem->setText(0, QCoreApplication::translate("FilterPage", "1", nullptr)); + addButton->setText(QCoreApplication::translate("FilterPage", "Add", nullptr)); + removeButton->setText(QCoreApplication::translate("FilterPage", "Remove", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/finddialog.ui.h b/tests/auto/tools/uic/baseline/finddialog.ui.h index a427be3614..f335eee2e4 100644 --- a/tests/auto/tools/uic/baseline/finddialog.ui.h +++ b/tests/auto/tools/uic/baseline/finddialog.ui.h @@ -31,7 +31,7 @@ /******************************************************************************** ** Form generated from reading UI file 'finddialog.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -172,9 +172,9 @@ public: hboxLayout->addLayout(vboxLayout1); -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) findWhat->setBuddy(led); -#endif // QT_NO_SHORTCUT +#endif // QT_CONFIG(shortcut) QWidget::setTabOrder(led, findNxt); QWidget::setTabOrder(findNxt, cancel); QWidget::setTabOrder(cancel, comments); @@ -193,40 +193,40 @@ public: void retranslateUi(QDialog *FindDialog) { - FindDialog->setWindowTitle(QApplication::translate("FindDialog", "Find", nullptr)); -#ifndef QT_NO_WHATSTHIS - FindDialog->setWhatsThis(QApplication::translate("FindDialog", "This window allows you to search for some text in the translation source file.", nullptr)); -#endif // QT_NO_WHATSTHIS - findWhat->setText(QApplication::translate("FindDialog", "&Find what:", nullptr)); -#ifndef QT_NO_WHATSTHIS - led->setWhatsThis(QApplication::translate("FindDialog", "Type in the text to search for.", nullptr)); -#endif // QT_NO_WHATSTHIS - groupBox->setTitle(QApplication::translate("FindDialog", "Options", nullptr)); -#ifndef QT_NO_WHATSTHIS - sourceText->setWhatsThis(QApplication::translate("FindDialog", "Source texts are searched when checked.", nullptr)); -#endif // QT_NO_WHATSTHIS - sourceText->setText(QApplication::translate("FindDialog", "&Source texts", nullptr)); -#ifndef QT_NO_WHATSTHIS - translations->setWhatsThis(QApplication::translate("FindDialog", "Translations are searched when checked.", nullptr)); -#endif // QT_NO_WHATSTHIS - translations->setText(QApplication::translate("FindDialog", "&Translations", nullptr)); -#ifndef QT_NO_WHATSTHIS - matchCase->setWhatsThis(QApplication::translate("FindDialog", "Texts such as 'TeX' and 'tex' are considered as different when checked.", nullptr)); -#endif // QT_NO_WHATSTHIS - matchCase->setText(QApplication::translate("FindDialog", "&Match case", nullptr)); -#ifndef QT_NO_WHATSTHIS - comments->setWhatsThis(QApplication::translate("FindDialog", "Comments and contexts are searched when checked.", nullptr)); -#endif // QT_NO_WHATSTHIS - comments->setText(QApplication::translate("FindDialog", "&Comments", nullptr)); - ignoreAccelerators->setText(QApplication::translate("FindDialog", "Ignore &accelerators", nullptr)); -#ifndef QT_NO_WHATSTHIS - findNxt->setWhatsThis(QApplication::translate("FindDialog", "Click here to find the next occurrence of the text you typed in.", nullptr)); -#endif // QT_NO_WHATSTHIS - findNxt->setText(QApplication::translate("FindDialog", "Find Next", nullptr)); -#ifndef QT_NO_WHATSTHIS - cancel->setWhatsThis(QApplication::translate("FindDialog", "Click here to close this window.", nullptr)); -#endif // QT_NO_WHATSTHIS - cancel->setText(QApplication::translate("FindDialog", "Cancel", nullptr)); + FindDialog->setWindowTitle(QCoreApplication::translate("FindDialog", "Find", nullptr)); +#if QT_CONFIG(whatsthis) + FindDialog->setWhatsThis(QCoreApplication::translate("FindDialog", "This window allows you to search for some text in the translation source file.", nullptr)); +#endif // QT_CONFIG(whatsthis) + findWhat->setText(QCoreApplication::translate("FindDialog", "&Find what:", nullptr)); +#if QT_CONFIG(whatsthis) + led->setWhatsThis(QCoreApplication::translate("FindDialog", "Type in the text to search for.", nullptr)); +#endif // QT_CONFIG(whatsthis) + groupBox->setTitle(QCoreApplication::translate("FindDialog", "Options", nullptr)); +#if QT_CONFIG(whatsthis) + sourceText->setWhatsThis(QCoreApplication::translate("FindDialog", "Source texts are searched when checked.", nullptr)); +#endif // QT_CONFIG(whatsthis) + sourceText->setText(QCoreApplication::translate("FindDialog", "&Source texts", nullptr)); +#if QT_CONFIG(whatsthis) + translations->setWhatsThis(QCoreApplication::translate("FindDialog", "Translations are searched when checked.", nullptr)); +#endif // QT_CONFIG(whatsthis) + translations->setText(QCoreApplication::translate("FindDialog", "&Translations", nullptr)); +#if QT_CONFIG(whatsthis) + matchCase->setWhatsThis(QCoreApplication::translate("FindDialog", "Texts such as 'TeX' and 'tex' are considered as different when checked.", nullptr)); +#endif // QT_CONFIG(whatsthis) + matchCase->setText(QCoreApplication::translate("FindDialog", "&Match case", nullptr)); +#if QT_CONFIG(whatsthis) + comments->setWhatsThis(QCoreApplication::translate("FindDialog", "Comments and contexts are searched when checked.", nullptr)); +#endif // QT_CONFIG(whatsthis) + comments->setText(QCoreApplication::translate("FindDialog", "&Comments", nullptr)); + ignoreAccelerators->setText(QCoreApplication::translate("FindDialog", "Ignore &accelerators", nullptr)); +#if QT_CONFIG(whatsthis) + findNxt->setWhatsThis(QCoreApplication::translate("FindDialog", "Click here to find the next occurrence of the text you typed in.", nullptr)); +#endif // QT_CONFIG(whatsthis) + findNxt->setText(QCoreApplication::translate("FindDialog", "Find Next", nullptr)); +#if QT_CONFIG(whatsthis) + cancel->setWhatsThis(QCoreApplication::translate("FindDialog", "Click here to close this window.", nullptr)); +#endif // QT_CONFIG(whatsthis) + cancel->setText(QCoreApplication::translate("FindDialog", "Cancel", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/form.ui.h b/tests/auto/tools/uic/baseline/form.ui.h index ecc63e339b..df8163f726 100644 --- a/tests/auto/tools/uic/baseline/form.ui.h +++ b/tests/auto/tools/uic/baseline/form.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'form.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -123,9 +123,9 @@ public: void retranslateUi(QWidget *WorldTimeForm) { - WorldTimeForm->setWindowTitle(QApplication::translate("WorldTimeForm", "World Time Clock", nullptr)); - label->setText(QApplication::translate("WorldTimeForm", "Current time:", nullptr)); - label_2->setText(QApplication::translate("WorldTimeForm", "Set time zone:", nullptr)); + WorldTimeForm->setWindowTitle(QCoreApplication::translate("WorldTimeForm", "World Time Clock", nullptr)); + label->setText(QCoreApplication::translate("WorldTimeForm", "Current time:", nullptr)); + label_2->setText(QCoreApplication::translate("WorldTimeForm", "Set time zone:", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/formwindowsettings.ui.h b/tests/auto/tools/uic/baseline/formwindowsettings.ui.h index d2cfa03edb..17c301e959 100644 --- a/tests/auto/tools/uic/baseline/formwindowsettings.ui.h +++ b/tests/auto/tools/uic/baseline/formwindowsettings.ui.h @@ -31,7 +31,7 @@ /******************************************************************************** ** Form generated from reading UI file 'formwindowsettings.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -250,12 +250,12 @@ public: gridLayout->addWidget(gridPanel, 1, 0, 1, 2); -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) label_2->setBuddy(defaultSpacingSpinBox); label->setBuddy(defaultMarginSpinBox); label_3->setBuddy(marginFunctionLineEdit); label_3_2->setBuddy(spacingFunctionLineEdit); -#endif // QT_NO_SHORTCUT +#endif // QT_CONFIG(shortcut) QWidget::setTabOrder(authorLineEdit, defaultMarginSpinBox); QWidget::setTabOrder(defaultMarginSpinBox, defaultSpacingSpinBox); QWidget::setTabOrder(defaultSpacingSpinBox, marginFunctionLineEdit); @@ -271,17 +271,17 @@ public: void retranslateUi(QDialog *FormWindowSettings) { - FormWindowSettings->setWindowTitle(QApplication::translate("FormWindowSettings", "Form Settings", nullptr)); - layoutDefaultGroupBox->setTitle(QApplication::translate("FormWindowSettings", "Layout &Default", nullptr)); - label_2->setText(QApplication::translate("FormWindowSettings", "&Spacing:", nullptr)); - label->setText(QApplication::translate("FormWindowSettings", "&Margin:", nullptr)); - layoutFunctionGroupBox->setTitle(QApplication::translate("FormWindowSettings", "&Layout Function", nullptr)); - label_3->setText(QApplication::translate("FormWindowSettings", "Ma&rgin:", nullptr)); - label_3_2->setText(QApplication::translate("FormWindowSettings", "Spa&cing:", nullptr)); - pixmapFunctionGroupBox_2->setTitle(QApplication::translate("FormWindowSettings", "&Author", nullptr)); - includeHintsGroupBox->setTitle(QApplication::translate("FormWindowSettings", "&Include Hints", nullptr)); - pixmapFunctionGroupBox->setTitle(QApplication::translate("FormWindowSettings", "&Pixmap Function", nullptr)); - gridPanel->setTitle(QApplication::translate("FormWindowSettings", "Grid", nullptr)); + FormWindowSettings->setWindowTitle(QCoreApplication::translate("FormWindowSettings", "Form Settings", nullptr)); + layoutDefaultGroupBox->setTitle(QCoreApplication::translate("FormWindowSettings", "Layout &Default", nullptr)); + label_2->setText(QCoreApplication::translate("FormWindowSettings", "&Spacing:", nullptr)); + label->setText(QCoreApplication::translate("FormWindowSettings", "&Margin:", nullptr)); + layoutFunctionGroupBox->setTitle(QCoreApplication::translate("FormWindowSettings", "&Layout Function", nullptr)); + label_3->setText(QCoreApplication::translate("FormWindowSettings", "Ma&rgin:", nullptr)); + label_3_2->setText(QCoreApplication::translate("FormWindowSettings", "Spa&cing:", nullptr)); + pixmapFunctionGroupBox_2->setTitle(QCoreApplication::translate("FormWindowSettings", "&Author", nullptr)); + includeHintsGroupBox->setTitle(QCoreApplication::translate("FormWindowSettings", "&Include Hints", nullptr)); + pixmapFunctionGroupBox->setTitle(QCoreApplication::translate("FormWindowSettings", "&Pixmap Function", nullptr)); + gridPanel->setTitle(QCoreApplication::translate("FormWindowSettings", "Grid", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/generalpage.ui.h b/tests/auto/tools/uic/baseline/generalpage.ui.h index bd04285d28..6488bfc061 100644 --- a/tests/auto/tools/uic/baseline/generalpage.ui.h +++ b/tests/auto/tools/uic/baseline/generalpage.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'generalpage.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -73,9 +73,9 @@ public: void retranslateUi(QWidget *GeneralPage) { - GeneralPage->setWindowTitle(QApplication::translate("GeneralPage", "Form", nullptr)); - label->setText(QApplication::translate("GeneralPage", "Namespace:", nullptr)); - label_2->setText(QApplication::translate("GeneralPage", "Virtual Folder:", nullptr)); + GeneralPage->setWindowTitle(QCoreApplication::translate("GeneralPage", "Form", nullptr)); + label->setText(QCoreApplication::translate("GeneralPage", "Namespace:", nullptr)); + label_2->setText(QCoreApplication::translate("GeneralPage", "Virtual Folder:", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/gridalignment.ui.h b/tests/auto/tools/uic/baseline/gridalignment.ui.h index 421f257c9a..f85ed818f7 100644 --- a/tests/auto/tools/uic/baseline/gridalignment.ui.h +++ b/tests/auto/tools/uic/baseline/gridalignment.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'gridalignment.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -61,11 +61,11 @@ public: void retranslateUi(QWidget *Form) { - Form->setWindowTitle(QApplication::translate("Form", "Form", nullptr)); - pushButton->setText(QApplication::translate("Form", "Left", nullptr)); - pushButton_3->setText(QApplication::translate("Form", "Top", nullptr)); - pushButton_2->setText(QApplication::translate("Form", "Right", nullptr)); - pushButton_4->setText(QApplication::translate("Form", "Bottom", nullptr)); + Form->setWindowTitle(QCoreApplication::translate("Form", "Form", nullptr)); + pushButton->setText(QCoreApplication::translate("Form", "Left", nullptr)); + pushButton_3->setText(QCoreApplication::translate("Form", "Top", nullptr)); + pushButton_2->setText(QCoreApplication::translate("Form", "Right", nullptr)); + pushButton_4->setText(QCoreApplication::translate("Form", "Bottom", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/gridpanel.ui.h b/tests/auto/tools/uic/baseline/gridpanel.ui.h index 858b71d0cc..54c9a3b5de 100644 --- a/tests/auto/tools/uic/baseline/gridpanel.ui.h +++ b/tests/auto/tools/uic/baseline/gridpanel.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'gridpanel.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -120,10 +120,10 @@ public: vboxLayout->addWidget(m_gridGroupBox); -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) label->setBuddy(m_deltaXSpinBox); label_2->setBuddy(m_deltaYSpinBox); -#endif // QT_NO_SHORTCUT +#endif // QT_CONFIG(shortcut) retranslateUi(qdesigner_internal__GridPanel); @@ -132,14 +132,14 @@ public: void retranslateUi(QWidget *qdesigner_internal__GridPanel) { - qdesigner_internal__GridPanel->setWindowTitle(QApplication::translate("qdesigner_internal::GridPanel", "Form", nullptr)); - m_gridGroupBox->setTitle(QApplication::translate("qdesigner_internal::GridPanel", "Grid", nullptr)); - m_visibleCheckBox->setText(QApplication::translate("qdesigner_internal::GridPanel", "Visible", nullptr)); - label->setText(QApplication::translate("qdesigner_internal::GridPanel", "Grid &X", nullptr)); - m_snapXCheckBox->setText(QApplication::translate("qdesigner_internal::GridPanel", "Snap", nullptr)); - m_resetButton->setText(QApplication::translate("qdesigner_internal::GridPanel", "Reset", nullptr)); - label_2->setText(QApplication::translate("qdesigner_internal::GridPanel", "Grid &Y", nullptr)); - m_snapYCheckBox->setText(QApplication::translate("qdesigner_internal::GridPanel", "Snap", nullptr)); + qdesigner_internal__GridPanel->setWindowTitle(QCoreApplication::translate("qdesigner_internal::GridPanel", "Form", nullptr)); + m_gridGroupBox->setTitle(QCoreApplication::translate("qdesigner_internal::GridPanel", "Grid", nullptr)); + m_visibleCheckBox->setText(QCoreApplication::translate("qdesigner_internal::GridPanel", "Visible", nullptr)); + label->setText(QCoreApplication::translate("qdesigner_internal::GridPanel", "Grid &X", nullptr)); + m_snapXCheckBox->setText(QCoreApplication::translate("qdesigner_internal::GridPanel", "Snap", nullptr)); + m_resetButton->setText(QCoreApplication::translate("qdesigner_internal::GridPanel", "Reset", nullptr)); + label_2->setText(QCoreApplication::translate("qdesigner_internal::GridPanel", "Grid &Y", nullptr)); + m_snapYCheckBox->setText(QCoreApplication::translate("qdesigner_internal::GridPanel", "Snap", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/helpdialog.ui b/tests/auto/tools/uic/baseline/helpdialog.ui index 8c3178183c..91b81c75d5 100644 --- a/tests/auto/tools/uic/baseline/helpdialog.ui +++ b/tests/auto/tools/uic/baseline/helpdialog.ui @@ -57,6 +57,9 @@ <string>Displays help topics organized by category, index or bookmarks. Another tab inherits the full text search.</string> </property> <widget class="QWidget" name="contentPage" > + <attribute name="icon"> + <iconset theme="edit-copy"/> + </attribute> <attribute name="title" > <string>Con&tents</string> </attribute> diff --git a/tests/auto/tools/uic/baseline/helpdialog.ui.h b/tests/auto/tools/uic/baseline/helpdialog.ui.h index abcf280cf9..dd28041a3e 100644 --- a/tests/auto/tools/uic/baseline/helpdialog.ui.h +++ b/tests/auto/tools/uic/baseline/helpdialog.ui.h @@ -31,7 +31,7 @@ /******************************************************************************** ** Form generated from reading UI file 'helpdialog.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -124,7 +124,8 @@ public: vboxLayout1->addWidget(listContents); - tabWidget->addTab(contentPage, QString()); + QIcon icon(QIcon::fromTheme(QString::fromUtf8("edit-copy"))); + tabWidget->addTab(contentPage, icon, QString()); indexPage = new QWidget(); indexPage->setObjectName(QString::fromUtf8("indexPage")); vboxLayout2 = new QVBoxLayout(indexPage); @@ -273,11 +274,11 @@ public: vboxLayout->addWidget(framePrepare); -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) TextLabel1->setBuddy(editIndex); TextLabel1_2->setBuddy(termsEdit); TextLabel2->setBuddy(resultBox); -#endif // QT_NO_SHORTCUT +#endif // QT_CONFIG(shortcut) QWidget::setTabOrder(tabWidget, listContents); QWidget::setTabOrder(listContents, editIndex); QWidget::setTabOrder(editIndex, listIndex); @@ -296,77 +297,77 @@ public: void retranslateUi(QWidget *HelpDialog) { - HelpDialog->setWindowTitle(QApplication::translate("HelpDialog", "Help", nullptr)); -#ifndef QT_NO_WHATSTHIS - HelpDialog->setWhatsThis(QApplication::translate("HelpDialog", "<b>Help</b><p>Choose the topic you want help on from the contents list, or search the index for keywords.</p>", nullptr)); -#endif // QT_NO_WHATSTHIS -#ifndef QT_NO_WHATSTHIS - tabWidget->setWhatsThis(QApplication::translate("HelpDialog", "Displays help topics organized by category, index or bookmarks. Another tab inherits the full text search.", nullptr)); -#endif // QT_NO_WHATSTHIS + HelpDialog->setWindowTitle(QCoreApplication::translate("HelpDialog", "Help", nullptr)); +#if QT_CONFIG(whatsthis) + HelpDialog->setWhatsThis(QCoreApplication::translate("HelpDialog", "<b>Help</b><p>Choose the topic you want help on from the contents list, or search the index for keywords.</p>", nullptr)); +#endif // QT_CONFIG(whatsthis) +#if QT_CONFIG(whatsthis) + tabWidget->setWhatsThis(QCoreApplication::translate("HelpDialog", "Displays help topics organized by category, index or bookmarks. Another tab inherits the full text search.", nullptr)); +#endif // QT_CONFIG(whatsthis) QTreeWidgetItem *___qtreewidgetitem = listContents->headerItem(); - ___qtreewidgetitem->setText(0, QApplication::translate("HelpDialog", "column 1", nullptr)); -#ifndef QT_NO_WHATSTHIS - listContents->setWhatsThis(QApplication::translate("HelpDialog", "<b>Help topics organized by category.</b><p>Double-click an item to see the topics in that category. To view a topic, just double-click it.</p>", nullptr)); -#endif // QT_NO_WHATSTHIS - tabWidget->setTabText(tabWidget->indexOf(contentPage), QApplication::translate("HelpDialog", "Con&tents", nullptr)); - TextLabel1->setText(QApplication::translate("HelpDialog", "&Look For:", nullptr)); -#ifndef QT_NO_TOOLTIP - editIndex->setToolTip(QApplication::translate("HelpDialog", "Enter keyword", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_WHATSTHIS - editIndex->setWhatsThis(QApplication::translate("HelpDialog", "<b>Enter a keyword.</b><p>The list will select an item that matches the entered string best.</p>", nullptr)); -#endif // QT_NO_WHATSTHIS -#ifndef QT_NO_WHATSTHIS - listIndex->setWhatsThis(QApplication::translate("HelpDialog", "<b>List of available help topics.</b><p>Double-click on an item to open its help page. If more than one is found, you must specify which page you want.</p>", nullptr)); -#endif // QT_NO_WHATSTHIS - tabWidget->setTabText(tabWidget->indexOf(indexPage), QApplication::translate("HelpDialog", "&Index", nullptr)); + ___qtreewidgetitem->setText(0, QCoreApplication::translate("HelpDialog", "column 1", nullptr)); +#if QT_CONFIG(whatsthis) + listContents->setWhatsThis(QCoreApplication::translate("HelpDialog", "<b>Help topics organized by category.</b><p>Double-click an item to see the topics in that category. To view a topic, just double-click it.</p>", nullptr)); +#endif // QT_CONFIG(whatsthis) + tabWidget->setTabText(tabWidget->indexOf(contentPage), QCoreApplication::translate("HelpDialog", "Con&tents", nullptr)); + TextLabel1->setText(QCoreApplication::translate("HelpDialog", "&Look For:", nullptr)); +#if QT_CONFIG(tooltip) + editIndex->setToolTip(QCoreApplication::translate("HelpDialog", "Enter keyword", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(whatsthis) + editIndex->setWhatsThis(QCoreApplication::translate("HelpDialog", "<b>Enter a keyword.</b><p>The list will select an item that matches the entered string best.</p>", nullptr)); +#endif // QT_CONFIG(whatsthis) +#if QT_CONFIG(whatsthis) + listIndex->setWhatsThis(QCoreApplication::translate("HelpDialog", "<b>List of available help topics.</b><p>Double-click on an item to open its help page. If more than one is found, you must specify which page you want.</p>", nullptr)); +#endif // QT_CONFIG(whatsthis) + tabWidget->setTabText(tabWidget->indexOf(indexPage), QCoreApplication::translate("HelpDialog", "&Index", nullptr)); QTreeWidgetItem *___qtreewidgetitem1 = listBookmarks->headerItem(); - ___qtreewidgetitem1->setText(0, QApplication::translate("HelpDialog", "column 1", nullptr)); -#ifndef QT_NO_WHATSTHIS - listBookmarks->setWhatsThis(QApplication::translate("HelpDialog", "Displays the list of bookmarks.", nullptr)); -#endif // QT_NO_WHATSTHIS -#ifndef QT_NO_TOOLTIP - buttonAdd->setToolTip(QApplication::translate("HelpDialog", "Add new bookmark", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_WHATSTHIS - buttonAdd->setWhatsThis(QApplication::translate("HelpDialog", "Add the currently displayed page as a new bookmark.", nullptr)); -#endif // QT_NO_WHATSTHIS - buttonAdd->setText(QApplication::translate("HelpDialog", "&New", nullptr)); -#ifndef QT_NO_TOOLTIP - buttonRemove->setToolTip(QApplication::translate("HelpDialog", "Delete bookmark", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_WHATSTHIS - buttonRemove->setWhatsThis(QApplication::translate("HelpDialog", "Delete the selected bookmark.", nullptr)); -#endif // QT_NO_WHATSTHIS - buttonRemove->setText(QApplication::translate("HelpDialog", "&Delete", nullptr)); - tabWidget->setTabText(tabWidget->indexOf(bookmarkPage), QApplication::translate("HelpDialog", "&Bookmarks", nullptr)); - TextLabel1_2->setText(QApplication::translate("HelpDialog", "Searching f&or:", nullptr)); -#ifndef QT_NO_TOOLTIP - termsEdit->setToolTip(QApplication::translate("HelpDialog", "Enter searchword(s).", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_WHATSTHIS - termsEdit->setWhatsThis(QApplication::translate("HelpDialog", "<b>Enter search word(s).</b><p>Enter here the word(s) you are looking for. The words may contain wildcards (*). For a sequence of words quote them.</p>", nullptr)); -#endif // QT_NO_WHATSTHIS -#ifndef QT_NO_WHATSTHIS - resultBox->setWhatsThis(QApplication::translate("HelpDialog", "<b>Found documents</b><p>This list contains all found documents from the last search. The documents are ordered, i.e. the first document has the most matches.</p>", nullptr)); -#endif // QT_NO_WHATSTHIS - TextLabel2->setText(QApplication::translate("HelpDialog", "Found &Documents:", nullptr)); -#ifndef QT_NO_TOOLTIP - helpButton->setToolTip(QApplication::translate("HelpDialog", "Display the help page.", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_WHATSTHIS - helpButton->setWhatsThis(QApplication::translate("HelpDialog", "Display the help page for the full text search.", nullptr)); -#endif // QT_NO_WHATSTHIS - helpButton->setText(QApplication::translate("HelpDialog", "He&lp", nullptr)); -#ifndef QT_NO_TOOLTIP - searchButton->setToolTip(QApplication::translate("HelpDialog", "Start searching.", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_WHATSTHIS - searchButton->setWhatsThis(QApplication::translate("HelpDialog", "Pressing this button starts the search.", nullptr)); -#endif // QT_NO_WHATSTHIS - searchButton->setText(QApplication::translate("HelpDialog", "&Search", nullptr)); - tabWidget->setTabText(tabWidget->indexOf(searchPage), QApplication::translate("HelpDialog", "&Search", nullptr)); - labelPrepare->setText(QApplication::translate("HelpDialog", "Preparing...", nullptr)); + ___qtreewidgetitem1->setText(0, QCoreApplication::translate("HelpDialog", "column 1", nullptr)); +#if QT_CONFIG(whatsthis) + listBookmarks->setWhatsThis(QCoreApplication::translate("HelpDialog", "Displays the list of bookmarks.", nullptr)); +#endif // QT_CONFIG(whatsthis) +#if QT_CONFIG(tooltip) + buttonAdd->setToolTip(QCoreApplication::translate("HelpDialog", "Add new bookmark", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(whatsthis) + buttonAdd->setWhatsThis(QCoreApplication::translate("HelpDialog", "Add the currently displayed page as a new bookmark.", nullptr)); +#endif // QT_CONFIG(whatsthis) + buttonAdd->setText(QCoreApplication::translate("HelpDialog", "&New", nullptr)); +#if QT_CONFIG(tooltip) + buttonRemove->setToolTip(QCoreApplication::translate("HelpDialog", "Delete bookmark", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(whatsthis) + buttonRemove->setWhatsThis(QCoreApplication::translate("HelpDialog", "Delete the selected bookmark.", nullptr)); +#endif // QT_CONFIG(whatsthis) + buttonRemove->setText(QCoreApplication::translate("HelpDialog", "&Delete", nullptr)); + tabWidget->setTabText(tabWidget->indexOf(bookmarkPage), QCoreApplication::translate("HelpDialog", "&Bookmarks", nullptr)); + TextLabel1_2->setText(QCoreApplication::translate("HelpDialog", "Searching f&or:", nullptr)); +#if QT_CONFIG(tooltip) + termsEdit->setToolTip(QCoreApplication::translate("HelpDialog", "Enter searchword(s).", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(whatsthis) + termsEdit->setWhatsThis(QCoreApplication::translate("HelpDialog", "<b>Enter search word(s).</b><p>Enter here the word(s) you are looking for. The words may contain wildcards (*). For a sequence of words quote them.</p>", nullptr)); +#endif // QT_CONFIG(whatsthis) +#if QT_CONFIG(whatsthis) + resultBox->setWhatsThis(QCoreApplication::translate("HelpDialog", "<b>Found documents</b><p>This list contains all found documents from the last search. The documents are ordered, i.e. the first document has the most matches.</p>", nullptr)); +#endif // QT_CONFIG(whatsthis) + TextLabel2->setText(QCoreApplication::translate("HelpDialog", "Found &Documents:", nullptr)); +#if QT_CONFIG(tooltip) + helpButton->setToolTip(QCoreApplication::translate("HelpDialog", "Display the help page.", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(whatsthis) + helpButton->setWhatsThis(QCoreApplication::translate("HelpDialog", "Display the help page for the full text search.", nullptr)); +#endif // QT_CONFIG(whatsthis) + helpButton->setText(QCoreApplication::translate("HelpDialog", "He&lp", nullptr)); +#if QT_CONFIG(tooltip) + searchButton->setToolTip(QCoreApplication::translate("HelpDialog", "Start searching.", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(whatsthis) + searchButton->setWhatsThis(QCoreApplication::translate("HelpDialog", "Pressing this button starts the search.", nullptr)); +#endif // QT_CONFIG(whatsthis) + searchButton->setText(QCoreApplication::translate("HelpDialog", "&Search", nullptr)); + tabWidget->setTabText(tabWidget->indexOf(searchPage), QCoreApplication::translate("HelpDialog", "&Search", nullptr)); + labelPrepare->setText(QCoreApplication::translate("HelpDialog", "Preparing...", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/history.ui.h b/tests/auto/tools/uic/baseline/history.ui.h index 715312d11a..7f48fb9f54 100644 --- a/tests/auto/tools/uic/baseline/history.ui.h +++ b/tests/auto/tools/uic/baseline/history.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'history.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -91,9 +91,9 @@ public: void retranslateUi(QDialog *HistoryDialog) { - HistoryDialog->setWindowTitle(QApplication::translate("HistoryDialog", "History", nullptr)); - removeButton->setText(QApplication::translate("HistoryDialog", "&Remove", nullptr)); - removeAllButton->setText(QApplication::translate("HistoryDialog", "Remove &All", nullptr)); + HistoryDialog->setWindowTitle(QCoreApplication::translate("HistoryDialog", "History", nullptr)); + removeButton->setText(QCoreApplication::translate("HistoryDialog", "&Remove", nullptr)); + removeAllButton->setText(QCoreApplication::translate("HistoryDialog", "Remove &All", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/icontheme.ui.h b/tests/auto/tools/uic/baseline/icontheme.ui.h index 936d6b5cf7..f1f6e42a02 100644 --- a/tests/auto/tools/uic/baseline/icontheme.ui.h +++ b/tests/auto/tools/uic/baseline/icontheme.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'icontheme.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -75,10 +75,10 @@ public: void retranslateUi(QWidget *Form) { - Form->setWindowTitle(QApplication::translate("Form", "Form", nullptr)); - fileicon->setText(QApplication::translate("Form", "fileicon", nullptr)); - fileandthemeicon->setText(QApplication::translate("Form", "PushButton", nullptr)); - themeicon->setText(QApplication::translate("Form", "PushButton", nullptr)); + Form->setWindowTitle(QCoreApplication::translate("Form", "Form", nullptr)); + fileicon->setText(QCoreApplication::translate("Form", "fileicon", nullptr)); + fileandthemeicon->setText(QCoreApplication::translate("Form", "PushButton", nullptr)); + themeicon->setText(QCoreApplication::translate("Form", "PushButton", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/idbased.ui.h b/tests/auto/tools/uic/baseline/idbased.ui.h index e246313e11..0209895a3c 100644 --- a/tests/auto/tools/uic/baseline/idbased.ui.h +++ b/tests/auto/tools/uic/baseline/idbased.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'idbased.ui' ** -** Created by: Qt User Interface Compiler version 5.11.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -44,15 +44,15 @@ public: void retranslateUi(QWidget *Form) { Form->setWindowTitle(qtTrId("windowTitleId")); -#ifndef QT_NO_TOOLTIP +#if QT_CONFIG(tooltip) pushButton->setToolTip(qtTrId("buttonToolTipId")); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_STATUSTIP +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(statustip) pushButton->setStatusTip(qtTrId("buttonStatusTipId")); -#endif // QT_NO_STATUSTIP -#ifndef QT_NO_WHATSTHIS +#endif // QT_CONFIG(statustip) +#if QT_CONFIG(whatsthis) pushButton->setWhatsThis(qtTrId("buttonWhatsThisId")); -#endif // QT_NO_WHATSTHIS +#endif // QT_CONFIG(whatsthis) pushButton->setText(qtTrId("buttonTextId")); } // retranslateUi diff --git a/tests/auto/tools/uic/baseline/identifierpage.ui.h b/tests/auto/tools/uic/baseline/identifierpage.ui.h index 322a9cf30a..420d668fe9 100644 --- a/tests/auto/tools/uic/baseline/identifierpage.ui.h +++ b/tests/auto/tools/uic/baseline/identifierpage.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'identifierpage.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -89,10 +89,10 @@ public: void retranslateUi(QWidget *IdentifierPage) { - IdentifierPage->setWindowTitle(QApplication::translate("IdentifierPage", "Form", nullptr)); - identifierCheckBox->setText(QApplication::translate("IdentifierPage", "Create identifiers", nullptr)); - globalButton->setText(QApplication::translate("IdentifierPage", "Global prefix:", nullptr)); - fileNameButton->setText(QApplication::translate("IdentifierPage", "Inherit prefix from file names", nullptr)); + IdentifierPage->setWindowTitle(QCoreApplication::translate("IdentifierPage", "Form", nullptr)); + identifierCheckBox->setText(QCoreApplication::translate("IdentifierPage", "Create identifiers", nullptr)); + globalButton->setText(QCoreApplication::translate("IdentifierPage", "Global prefix:", nullptr)); + fileNameButton->setText(QCoreApplication::translate("IdentifierPage", "Inherit prefix from file names", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/imagedialog.ui.h b/tests/auto/tools/uic/baseline/imagedialog.ui.h index e32e7639fa..eea8b6ee03 100644 --- a/tests/auto/tools/uic/baseline/imagedialog.ui.h +++ b/tests/auto/tools/uic/baseline/imagedialog.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'imagedialog.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -86,7 +86,7 @@ public: colorDepthCombo = new QComboBox(dialog); colorDepthCombo->setObjectName(QString::fromUtf8("colorDepthCombo")); colorDepthCombo->setGeometry(QRect(74, 83, 227, 22)); - QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(5), static_cast<QSizePolicy::Policy>(0)); + QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(colorDepthCombo->sizePolicy().hasHeightForWidth()); @@ -98,7 +98,7 @@ public: nameLineEdit = new QLineEdit(dialog); nameLineEdit->setObjectName(QString::fromUtf8("nameLineEdit")); nameLineEdit->setGeometry(QRect(74, 83, 227, 22)); - QSizePolicy sizePolicy1(static_cast<QSizePolicy::Policy>(5), static_cast<QSizePolicy::Policy>(0)); + QSizePolicy sizePolicy1(QSizePolicy::Preferred, QSizePolicy::Fixed); sizePolicy1.setHorizontalStretch(1); sizePolicy1.setVerticalStretch(0); sizePolicy1.setHeightForWidth(nameLineEdit->sizePolicy().hasHeightForWidth()); @@ -196,14 +196,14 @@ public: void retranslateUi(QDialog *dialog) { - dialog->setWindowTitle(QApplication::translate("ImageDialog", "Create Image", nullptr)); - widthLabel->setText(QApplication::translate("ImageDialog", "Width:", nullptr)); - heightLabel->setText(QApplication::translate("ImageDialog", "Height:", nullptr)); - nameLineEdit->setText(QApplication::translate("ImageDialog", "Untitled image", nullptr)); - nameLabel->setText(QApplication::translate("ImageDialog", "Name:", nullptr)); - colorDepthLabel->setText(QApplication::translate("ImageDialog", "Color depth:", nullptr)); - okButton->setText(QApplication::translate("ImageDialog", "OK", nullptr)); - cancelButton->setText(QApplication::translate("ImageDialog", "Cancel", nullptr)); + dialog->setWindowTitle(QCoreApplication::translate("ImageDialog", "Create Image", nullptr)); + widthLabel->setText(QCoreApplication::translate("ImageDialog", "Width:", nullptr)); + heightLabel->setText(QCoreApplication::translate("ImageDialog", "Height:", nullptr)); + nameLineEdit->setText(QCoreApplication::translate("ImageDialog", "Untitled image", nullptr)); + nameLabel->setText(QCoreApplication::translate("ImageDialog", "Name:", nullptr)); + colorDepthLabel->setText(QCoreApplication::translate("ImageDialog", "Color depth:", nullptr)); + okButton->setText(QCoreApplication::translate("ImageDialog", "OK", nullptr)); + cancelButton->setText(QCoreApplication::translate("ImageDialog", "Cancel", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/inputpage.ui.h b/tests/auto/tools/uic/baseline/inputpage.ui.h index 9367dec6df..0cb4cce4f2 100644 --- a/tests/auto/tools/uic/baseline/inputpage.ui.h +++ b/tests/auto/tools/uic/baseline/inputpage.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'inputpage.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -81,9 +81,9 @@ public: void retranslateUi(QWidget *InputPage) { - InputPage->setWindowTitle(QApplication::translate("InputPage", "Form", nullptr)); - label->setText(QApplication::translate("InputPage", "File name:", nullptr)); - browseButton->setText(QApplication::translate("InputPage", "...", nullptr)); + InputPage->setWindowTitle(QCoreApplication::translate("InputPage", "Form", nullptr)); + label->setText(QCoreApplication::translate("InputPage", "File name:", nullptr)); + browseButton->setText(QCoreApplication::translate("InputPage", "...", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/installdialog.ui.h b/tests/auto/tools/uic/baseline/installdialog.ui.h index 3ec7f69b76..b452971f19 100644 --- a/tests/auto/tools/uic/baseline/installdialog.ui.h +++ b/tests/auto/tools/uic/baseline/installdialog.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'installdialog.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -120,13 +120,13 @@ public: void retranslateUi(QDialog *InstallDialog) { - InstallDialog->setWindowTitle(QApplication::translate("InstallDialog", "Install Documentation", nullptr)); - label->setText(QApplication::translate("InstallDialog", "Available Documentation:", nullptr)); - installButton->setText(QApplication::translate("InstallDialog", "Install", nullptr)); - cancelButton->setText(QApplication::translate("InstallDialog", "Cancel", nullptr)); - closeButton->setText(QApplication::translate("InstallDialog", "Close", nullptr)); - label_4->setText(QApplication::translate("InstallDialog", "Installation Path:", nullptr)); - browseButton->setText(QApplication::translate("InstallDialog", "...", nullptr)); + InstallDialog->setWindowTitle(QCoreApplication::translate("InstallDialog", "Install Documentation", nullptr)); + label->setText(QCoreApplication::translate("InstallDialog", "Available Documentation:", nullptr)); + installButton->setText(QCoreApplication::translate("InstallDialog", "Install", nullptr)); + cancelButton->setText(QCoreApplication::translate("InstallDialog", "Cancel", nullptr)); + closeButton->setText(QCoreApplication::translate("InstallDialog", "Close", nullptr)); + label_4->setText(QCoreApplication::translate("InstallDialog", "Installation Path:", nullptr)); + browseButton->setText(QCoreApplication::translate("InstallDialog", "...", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/languagesdialog.ui.h b/tests/auto/tools/uic/baseline/languagesdialog.ui.h index cf2599fd07..f605d942d4 100644 --- a/tests/auto/tools/uic/baseline/languagesdialog.ui.h +++ b/tests/auto/tools/uic/baseline/languagesdialog.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'languagesdialog.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -108,39 +108,39 @@ public: void retranslateUi(QDialog *LanguagesDialog) { - LanguagesDialog->setWindowTitle(QApplication::translate("LanguagesDialog", "Auxiliary Languages", nullptr)); + LanguagesDialog->setWindowTitle(QCoreApplication::translate("LanguagesDialog", "Auxiliary Languages", nullptr)); QTreeWidgetItem *___qtreewidgetitem = languagesList->headerItem(); - ___qtreewidgetitem->setText(1, QApplication::translate("LanguagesDialog", "File", nullptr)); - ___qtreewidgetitem->setText(0, QApplication::translate("LanguagesDialog", "Locale", nullptr)); -#ifndef QT_NO_TOOLTIP - upButton->setToolTip(QApplication::translate("LanguagesDialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" + ___qtreewidgetitem->setText(1, QCoreApplication::translate("LanguagesDialog", "File", nullptr)); + ___qtreewidgetitem->setText(0, QCoreApplication::translate("LanguagesDialog", "Locale", nullptr)); +#if QT_CONFIG(tooltip) + upButton->setToolTip(QCoreApplication::translate("LanguagesDialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Move selected language up</p></body></html>", nullptr)); -#endif // QT_NO_TOOLTIP - upButton->setText(QApplication::translate("LanguagesDialog", "up", nullptr)); -#ifndef QT_NO_TOOLTIP - downButton->setToolTip(QApplication::translate("LanguagesDialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" +#endif // QT_CONFIG(tooltip) + upButton->setText(QCoreApplication::translate("LanguagesDialog", "up", nullptr)); +#if QT_CONFIG(tooltip) + downButton->setToolTip(QCoreApplication::translate("LanguagesDialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;\">Move selected language down</p></body></html>", nullptr)); -#endif // QT_NO_TOOLTIP - downButton->setText(QApplication::translate("LanguagesDialog", "down", nullptr)); -#ifndef QT_NO_TOOLTIP - removeButton->setToolTip(QApplication::translate("LanguagesDialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" +#endif // QT_CONFIG(tooltip) + downButton->setText(QCoreApplication::translate("LanguagesDialog", "down", nullptr)); +#if QT_CONFIG(tooltip) + removeButton->setToolTip(QCoreApplication::translate("LanguagesDialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Remove selected language</p></body></html>", nullptr)); -#endif // QT_NO_TOOLTIP - removeButton->setText(QApplication::translate("LanguagesDialog", "remove", nullptr)); -#ifndef QT_NO_TOOLTIP - openFileButton->setToolTip(QApplication::translate("LanguagesDialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" +#endif // QT_CONFIG(tooltip) + removeButton->setText(QCoreApplication::translate("LanguagesDialog", "remove", nullptr)); +#if QT_CONFIG(tooltip) + openFileButton->setToolTip(QCoreApplication::translate("LanguagesDialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Open auxiliary language files</p></body></html>", nullptr)); -#endif // QT_NO_TOOLTIP - openFileButton->setText(QApplication::translate("LanguagesDialog", "...", nullptr)); - okButton->setText(QApplication::translate("LanguagesDialog", "OK", nullptr)); +#endif // QT_CONFIG(tooltip) + openFileButton->setText(QCoreApplication::translate("LanguagesDialog", "...", nullptr)); + okButton->setText(QCoreApplication::translate("LanguagesDialog", "OK", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/listwidgeteditor.ui.h b/tests/auto/tools/uic/baseline/listwidgeteditor.ui.h index 14067ced18..721d4c9950 100644 --- a/tests/auto/tools/uic/baseline/listwidgeteditor.ui.h +++ b/tests/auto/tools/uic/baseline/listwidgeteditor.ui.h @@ -31,7 +31,7 @@ /******************************************************************************** ** Form generated from reading UI file 'listwidgeteditor.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -172,28 +172,28 @@ public: void retranslateUi(QDialog *qdesigner_internal__ListWidgetEditor) { - qdesigner_internal__ListWidgetEditor->setWindowTitle(QApplication::translate("qdesigner_internal::ListWidgetEditor", "Dialog", nullptr)); - groupBox->setTitle(QApplication::translate("qdesigner_internal::ListWidgetEditor", "Items List", nullptr)); -#ifndef QT_NO_TOOLTIP - listWidget->setToolTip(QApplication::translate("qdesigner_internal::ListWidgetEditor", "Items List", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_TOOLTIP - newItemButton->setToolTip(QApplication::translate("qdesigner_internal::ListWidgetEditor", "New Item", nullptr)); -#endif // QT_NO_TOOLTIP - newItemButton->setText(QApplication::translate("qdesigner_internal::ListWidgetEditor", "&New", nullptr)); -#ifndef QT_NO_TOOLTIP - deleteItemButton->setToolTip(QApplication::translate("qdesigner_internal::ListWidgetEditor", "Delete Item", nullptr)); -#endif // QT_NO_TOOLTIP - deleteItemButton->setText(QApplication::translate("qdesigner_internal::ListWidgetEditor", "&Delete", nullptr)); -#ifndef QT_NO_TOOLTIP - moveItemUpButton->setToolTip(QApplication::translate("qdesigner_internal::ListWidgetEditor", "Move Item Up", nullptr)); -#endif // QT_NO_TOOLTIP - moveItemUpButton->setText(QApplication::translate("qdesigner_internal::ListWidgetEditor", "U", nullptr)); -#ifndef QT_NO_TOOLTIP - moveItemDownButton->setToolTip(QApplication::translate("qdesigner_internal::ListWidgetEditor", "Move Item Down", nullptr)); -#endif // QT_NO_TOOLTIP - moveItemDownButton->setText(QApplication::translate("qdesigner_internal::ListWidgetEditor", "D", nullptr)); - label->setText(QApplication::translate("qdesigner_internal::ListWidgetEditor", "Icon", nullptr)); + qdesigner_internal__ListWidgetEditor->setWindowTitle(QCoreApplication::translate("qdesigner_internal::ListWidgetEditor", "Dialog", nullptr)); + groupBox->setTitle(QCoreApplication::translate("qdesigner_internal::ListWidgetEditor", "Items List", nullptr)); +#if QT_CONFIG(tooltip) + listWidget->setToolTip(QCoreApplication::translate("qdesigner_internal::ListWidgetEditor", "Items List", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(tooltip) + newItemButton->setToolTip(QCoreApplication::translate("qdesigner_internal::ListWidgetEditor", "New Item", nullptr)); +#endif // QT_CONFIG(tooltip) + newItemButton->setText(QCoreApplication::translate("qdesigner_internal::ListWidgetEditor", "&New", nullptr)); +#if QT_CONFIG(tooltip) + deleteItemButton->setToolTip(QCoreApplication::translate("qdesigner_internal::ListWidgetEditor", "Delete Item", nullptr)); +#endif // QT_CONFIG(tooltip) + deleteItemButton->setText(QCoreApplication::translate("qdesigner_internal::ListWidgetEditor", "&Delete", nullptr)); +#if QT_CONFIG(tooltip) + moveItemUpButton->setToolTip(QCoreApplication::translate("qdesigner_internal::ListWidgetEditor", "Move Item Up", nullptr)); +#endif // QT_CONFIG(tooltip) + moveItemUpButton->setText(QCoreApplication::translate("qdesigner_internal::ListWidgetEditor", "U", nullptr)); +#if QT_CONFIG(tooltip) + moveItemDownButton->setToolTip(QCoreApplication::translate("qdesigner_internal::ListWidgetEditor", "Move Item Down", nullptr)); +#endif // QT_CONFIG(tooltip) + moveItemDownButton->setText(QCoreApplication::translate("qdesigner_internal::ListWidgetEditor", "D", nullptr)); + label->setText(QCoreApplication::translate("qdesigner_internal::ListWidgetEditor", "Icon", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/mainwindow.ui.h b/tests/auto/tools/uic/baseline/mainwindow.ui.h index fe84d0baa3..df61d57ceb 100644 --- a/tests/auto/tools/uic/baseline/mainwindow.ui.h +++ b/tests/auto/tools/uic/baseline/mainwindow.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'mainwindow.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -361,30 +361,30 @@ public: void retranslateUi(QMainWindow *MainWindow) { - MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MakeQPF", nullptr)); - actionAdd_Custom_Font->setText(QApplication::translate("MainWindow", "&Add Custom Font...", nullptr)); - action_Exit->setText(QApplication::translate("MainWindow", "&Exit", nullptr)); - groupBox->setTitle(QApplication::translate("MainWindow", "Font Properties", nullptr)); - label->setText(QApplication::translate("MainWindow", "Family:", nullptr)); - label_2->setText(QApplication::translate("MainWindow", "Pixel Size:", nullptr)); - label_7->setText(QApplication::translate("MainWindow", "Weight:", nullptr)); - italic->setText(QApplication::translate("MainWindow", "Italic", nullptr)); - groupBox_2->setTitle(QApplication::translate("MainWindow", "Glyph Coverage", nullptr)); - chooseFromCodePoints->setText(QApplication::translate("MainWindow", "Choose from Unicode Codepoints:", nullptr)); - selectAll->setText(QApplication::translate("MainWindow", "Select &All", nullptr)); - deselectAll->setText(QApplication::translate("MainWindow", "&Deselect All", nullptr)); - invertSelection->setText(QApplication::translate("MainWindow", "&Invert Selection", nullptr)); - chooseFromSampleFile->setText(QApplication::translate("MainWindow", "Choose from Sample Text File (UTF-8 Encoded):", nullptr)); - label_5->setText(QApplication::translate("MainWindow", "Path:", nullptr)); - browseSampleFile->setText(QApplication::translate("MainWindow", "Browse...", nullptr)); - charCount->setText(QApplication::translate("MainWindow", "TextLabel", nullptr)); - groupBox_3->setTitle(QApplication::translate("MainWindow", "Preview", nullptr)); - groupBox_4->setTitle(QApplication::translate("MainWindow", "Output Options", nullptr)); - label_3->setText(QApplication::translate("MainWindow", "Path:", nullptr)); - browsePath->setText(QApplication::translate("MainWindow", "Browse...", nullptr)); - label_4->setText(QApplication::translate("MainWindow", "Filename:", nullptr)); - generate->setText(QApplication::translate("MainWindow", "Generate Pre-Rendered Font...", nullptr)); - menuFile->setTitle(QApplication::translate("MainWindow", "File", nullptr)); + MainWindow->setWindowTitle(QCoreApplication::translate("MainWindow", "MakeQPF", nullptr)); + actionAdd_Custom_Font->setText(QCoreApplication::translate("MainWindow", "&Add Custom Font...", nullptr)); + action_Exit->setText(QCoreApplication::translate("MainWindow", "&Exit", nullptr)); + groupBox->setTitle(QCoreApplication::translate("MainWindow", "Font Properties", nullptr)); + label->setText(QCoreApplication::translate("MainWindow", "Family:", nullptr)); + label_2->setText(QCoreApplication::translate("MainWindow", "Pixel Size:", nullptr)); + label_7->setText(QCoreApplication::translate("MainWindow", "Weight:", nullptr)); + italic->setText(QCoreApplication::translate("MainWindow", "Italic", nullptr)); + groupBox_2->setTitle(QCoreApplication::translate("MainWindow", "Glyph Coverage", nullptr)); + chooseFromCodePoints->setText(QCoreApplication::translate("MainWindow", "Choose from Unicode Codepoints:", nullptr)); + selectAll->setText(QCoreApplication::translate("MainWindow", "Select &All", nullptr)); + deselectAll->setText(QCoreApplication::translate("MainWindow", "&Deselect All", nullptr)); + invertSelection->setText(QCoreApplication::translate("MainWindow", "&Invert Selection", nullptr)); + chooseFromSampleFile->setText(QCoreApplication::translate("MainWindow", "Choose from Sample Text File (UTF-8 Encoded):", nullptr)); + label_5->setText(QCoreApplication::translate("MainWindow", "Path:", nullptr)); + browseSampleFile->setText(QCoreApplication::translate("MainWindow", "Browse...", nullptr)); + charCount->setText(QCoreApplication::translate("MainWindow", "TextLabel", nullptr)); + groupBox_3->setTitle(QCoreApplication::translate("MainWindow", "Preview", nullptr)); + groupBox_4->setTitle(QCoreApplication::translate("MainWindow", "Output Options", nullptr)); + label_3->setText(QCoreApplication::translate("MainWindow", "Path:", nullptr)); + browsePath->setText(QCoreApplication::translate("MainWindow", "Browse...", nullptr)); + label_4->setText(QCoreApplication::translate("MainWindow", "Filename:", nullptr)); + generate->setText(QCoreApplication::translate("MainWindow", "Generate Pre-Rendered Font...", nullptr)); + menuFile->setTitle(QCoreApplication::translate("MainWindow", "File", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/mydialog.ui.h b/tests/auto/tools/uic/baseline/mydialog.ui.h index 1a784d1b0a..e71927092f 100644 --- a/tests/auto/tools/uic/baseline/mydialog.ui.h +++ b/tests/auto/tools/uic/baseline/mydialog.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'mydialog.ui' ** -** Created by: Qt User Interface Compiler version 5.9.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -56,12 +56,12 @@ public: void retranslateUi(QDialog *MyDialog) { - MyDialog->setWindowTitle(QApplication::translate("MyDialog", "Mach 2!", nullptr)); - aLabel->setText(QApplication::translate("MyDialog", "Join the life in the fastlane; - PCH enable your project today! -", nullptr)); - aButton->setText(QApplication::translate("MyDialog", "&Quit", nullptr)); -#ifndef QT_NO_SHORTCUT - aButton->setShortcut(QApplication::translate("MyDialog", "Alt+Q", nullptr)); -#endif // QT_NO_SHORTCUT + MyDialog->setWindowTitle(QCoreApplication::translate("MyDialog", "Mach 2!", nullptr)); + aLabel->setText(QCoreApplication::translate("MyDialog", "Join the life in the fastlane; - PCH enable your project today! -", nullptr)); + aButton->setText(QCoreApplication::translate("MyDialog", "&Quit", nullptr)); +#if QT_CONFIG(shortcut) + aButton->setShortcut(QCoreApplication::translate("MyDialog", "Alt+Q", nullptr)); +#endif // QT_CONFIG(shortcut) } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/myform.ui.h b/tests/auto/tools/uic/baseline/myform.ui.h index d3a08e04c9..87d88e8246 100644 --- a/tests/auto/tools/uic/baseline/myform.ui.h +++ b/tests/auto/tools/uic/baseline/myform.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'myform.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -120,17 +120,17 @@ public: void retranslateUi(QWidget *Form) { - Form->setWindowTitle(QApplication::translate("Form", "Export Document", nullptr)); - groupBox->setTitle(QApplication::translate("Form", "Export Options", nullptr)); - radioButton_2->setText(QApplication::translate("Form", "&DocBook", nullptr)); - radioButton->setText(QApplication::translate("Form", "&LaTeX", nullptr)); - checkBox_2->setText(QApplication::translate("Form", "Include p&ictures", nullptr)); - checkBox->setText(QApplication::translate("Form", "&Compress", nullptr)); - radioButton_2_2->setText(QApplication::translate("Form", "&HTML", nullptr)); - radioButton_3->setText(QApplication::translate("Form", "&PostScript", nullptr)); - radioButton_4->setText(QApplication::translate("Form", "PD&F", nullptr)); - checkBox_3->setText(QApplication::translate("Form", "Include &metadata", nullptr)); - checkBox_4->setText(QApplication::translate("Form", "Create inde&x", nullptr)); + Form->setWindowTitle(QCoreApplication::translate("Form", "Export Document", nullptr)); + groupBox->setTitle(QCoreApplication::translate("Form", "Export Options", nullptr)); + radioButton_2->setText(QCoreApplication::translate("Form", "&DocBook", nullptr)); + radioButton->setText(QCoreApplication::translate("Form", "&LaTeX", nullptr)); + checkBox_2->setText(QCoreApplication::translate("Form", "Include p&ictures", nullptr)); + checkBox->setText(QCoreApplication::translate("Form", "&Compress", nullptr)); + radioButton_2_2->setText(QCoreApplication::translate("Form", "&HTML", nullptr)); + radioButton_3->setText(QCoreApplication::translate("Form", "&PostScript", nullptr)); + radioButton_4->setText(QCoreApplication::translate("Form", "PD&F", nullptr)); + checkBox_3->setText(QCoreApplication::translate("Form", "Include &metadata", nullptr)); + checkBox_4->setText(QCoreApplication::translate("Form", "Create inde&x", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/newactiondialog.ui.h b/tests/auto/tools/uic/baseline/newactiondialog.ui.h index ca99ab8356..4b3b6bcf1a 100644 --- a/tests/auto/tools/uic/baseline/newactiondialog.ui.h +++ b/tests/auto/tools/uic/baseline/newactiondialog.ui.h @@ -31,7 +31,7 @@ /******************************************************************************** ** Form generated from reading UI file 'newactiondialog.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -143,11 +143,11 @@ public: verticalLayout->addWidget(buttonBox); -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) label->setBuddy(editActionText); label_3->setBuddy(editObjectName); label_2->setBuddy(iconSelector); -#endif // QT_NO_SHORTCUT +#endif // QT_CONFIG(shortcut) QWidget::setTabOrder(editActionText, editObjectName); retranslateUi(qdesigner_internal__NewActionDialog); @@ -159,10 +159,10 @@ public: void retranslateUi(QDialog *qdesigner_internal__NewActionDialog) { - qdesigner_internal__NewActionDialog->setWindowTitle(QApplication::translate("qdesigner_internal::NewActionDialog", "New Action...", nullptr)); - label->setText(QApplication::translate("qdesigner_internal::NewActionDialog", "&Text:", nullptr)); - label_3->setText(QApplication::translate("qdesigner_internal::NewActionDialog", "Object &name:", nullptr)); - label_2->setText(QApplication::translate("qdesigner_internal::NewActionDialog", "&Icon:", nullptr)); + qdesigner_internal__NewActionDialog->setWindowTitle(QCoreApplication::translate("qdesigner_internal::NewActionDialog", "New Action...", nullptr)); + label->setText(QCoreApplication::translate("qdesigner_internal::NewActionDialog", "&Text:", nullptr)); + label_3->setText(QCoreApplication::translate("qdesigner_internal::NewActionDialog", "Object &name:", nullptr)); + label_2->setText(QCoreApplication::translate("qdesigner_internal::NewActionDialog", "&Icon:", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/newdynamicpropertydialog.ui.h b/tests/auto/tools/uic/baseline/newdynamicpropertydialog.ui.h index f5fd6f1fa4..406f8bc1a3 100644 --- a/tests/auto/tools/uic/baseline/newdynamicpropertydialog.ui.h +++ b/tests/auto/tools/uic/baseline/newdynamicpropertydialog.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'newdynamicpropertydialog.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -108,9 +108,9 @@ public: void retranslateUi(QDialog *qdesigner_internal__NewDynamicPropertyDialog) { - qdesigner_internal__NewDynamicPropertyDialog->setWindowTitle(QApplication::translate("qdesigner_internal::NewDynamicPropertyDialog", "Create Dynamic Property", nullptr)); - label->setText(QApplication::translate("qdesigner_internal::NewDynamicPropertyDialog", "Property Name", nullptr)); - label_2->setText(QApplication::translate("qdesigner_internal::NewDynamicPropertyDialog", "Property Type", nullptr)); + qdesigner_internal__NewDynamicPropertyDialog->setWindowTitle(QCoreApplication::translate("qdesigner_internal::NewDynamicPropertyDialog", "Create Dynamic Property", nullptr)); + label->setText(QCoreApplication::translate("qdesigner_internal::NewDynamicPropertyDialog", "Property Name", nullptr)); + label_2->setText(QCoreApplication::translate("qdesigner_internal::NewDynamicPropertyDialog", "Property Type", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/newform.ui.h b/tests/auto/tools/uic/baseline/newform.ui.h index 80e70dcf66..e0b5baef81 100644 --- a/tests/auto/tools/uic/baseline/newform.ui.h +++ b/tests/auto/tools/uic/baseline/newform.ui.h @@ -31,7 +31,7 @@ /******************************************************************************** ** Form generated from reading UI file 'newform.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -93,7 +93,7 @@ public: lblPreview = new QLabel(NewForm); lblPreview->setObjectName(QString::fromUtf8("lblPreview")); - QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(7), static_cast<QSizePolicy::Policy>(5)); + QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(lblPreview->sizePolicy().hasHeightForWidth()); @@ -132,11 +132,11 @@ public: void retranslateUi(QDialog *NewForm) { - NewForm->setWindowTitle(QApplication::translate("NewForm", "New Form", nullptr)); + NewForm->setWindowTitle(QCoreApplication::translate("NewForm", "New Form", nullptr)); QTreeWidgetItem *___qtreewidgetitem = treeWidget->headerItem(); - ___qtreewidgetitem->setText(0, QApplication::translate("NewForm", "0", nullptr)); - lblPreview->setText(QApplication::translate("NewForm", "Choose a template for a preview", nullptr)); - chkShowOnStartup->setText(QApplication::translate("NewForm", "Show this Dialog on Startup", nullptr)); + ___qtreewidgetitem->setText(0, QCoreApplication::translate("NewForm", "0", nullptr)); + lblPreview->setText(QCoreApplication::translate("NewForm", "Choose a template for a preview", nullptr)); + chkShowOnStartup->setText(QCoreApplication::translate("NewForm", "Show this Dialog on Startup", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/orderdialog.ui.h b/tests/auto/tools/uic/baseline/orderdialog.ui.h index 0ee08257f4..532ec2d41c 100644 --- a/tests/auto/tools/uic/baseline/orderdialog.ui.h +++ b/tests/auto/tools/uic/baseline/orderdialog.ui.h @@ -31,7 +31,7 @@ /******************************************************************************** ** Form generated from reading UI file 'orderdialog.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -130,14 +130,14 @@ public: void retranslateUi(QDialog *qdesigner_internal__OrderDialog) { - qdesigner_internal__OrderDialog->setWindowTitle(QApplication::translate("qdesigner_internal::OrderDialog", "Change Page Order", nullptr)); - groupBox->setTitle(QApplication::translate("qdesigner_internal::OrderDialog", "Page Order", nullptr)); -#ifndef QT_NO_TOOLTIP - upButton->setToolTip(QApplication::translate("qdesigner_internal::OrderDialog", "Move page up", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_TOOLTIP - downButton->setToolTip(QApplication::translate("qdesigner_internal::OrderDialog", "Move page down", nullptr)); -#endif // QT_NO_TOOLTIP + qdesigner_internal__OrderDialog->setWindowTitle(QCoreApplication::translate("qdesigner_internal::OrderDialog", "Change Page Order", nullptr)); + groupBox->setTitle(QCoreApplication::translate("qdesigner_internal::OrderDialog", "Page Order", nullptr)); +#if QT_CONFIG(tooltip) + upButton->setToolTip(QCoreApplication::translate("qdesigner_internal::OrderDialog", "Move page up", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(tooltip) + downButton->setToolTip(QCoreApplication::translate("qdesigner_internal::OrderDialog", "Move page down", nullptr)); +#endif // QT_CONFIG(tooltip) } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/outputpage.ui.h b/tests/auto/tools/uic/baseline/outputpage.ui.h index 00491bb3d8..9d2593dc77 100644 --- a/tests/auto/tools/uic/baseline/outputpage.ui.h +++ b/tests/auto/tools/uic/baseline/outputpage.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'outputpage.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -87,9 +87,9 @@ public: void retranslateUi(QWidget *OutputPage) { - OutputPage->setWindowTitle(QApplication::translate("OutputPage", "Form", nullptr)); - label->setText(QApplication::translate("OutputPage", "Project file name:", nullptr)); - label_2->setText(QApplication::translate("OutputPage", "Collection file name:", nullptr)); + OutputPage->setWindowTitle(QCoreApplication::translate("OutputPage", "Form", nullptr)); + label->setText(QCoreApplication::translate("OutputPage", "Project file name:", nullptr)); + label_2->setText(QCoreApplication::translate("OutputPage", "Collection file name:", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/pagefold.ui.h b/tests/auto/tools/uic/baseline/pagefold.ui.h index c1ff03648d..a0594b7ec7 100644 --- a/tests/auto/tools/uic/baseline/pagefold.ui.h +++ b/tests/auto/tools/uic/baseline/pagefold.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'pagefold.ui' ** -** Created by: Qt User Interface Compiler version 5.10.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -213,13 +213,13 @@ public: statusbar = new QStatusBar(MainWindow); statusbar->setObjectName(QString::fromUtf8("statusbar")); MainWindow->setStatusBar(statusbar); -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) ageLabel->setBuddy(ageSpinBox); nameLabel->setBuddy(nameCombo); passwordLabel->setBuddy(passwordEdit); label->setBuddy(professionList); countryLabel->setBuddy(professionList); -#endif // QT_NO_SHORTCUT +#endif // QT_CONFIG(shortcut) menubar->addAction(menu_File->menuAction()); menubar->addAction(menu_Help->menuAction()); @@ -242,84 +242,84 @@ public: void retranslateUi(QMainWindow *MainWindow) { - MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", nullptr)); - exitAction->setText(QApplication::translate("MainWindow", "&Exit", nullptr)); - aboutQtAction->setText(QApplication::translate("MainWindow", "About Qt", nullptr)); - editStyleAction->setText(QApplication::translate("MainWindow", "Edit &Style", nullptr)); - aboutAction->setText(QApplication::translate("MainWindow", "About", nullptr)); - nameCombo->setItemText(0, QApplication::translate("MainWindow", "Girish", nullptr)); - nameCombo->setItemText(1, QApplication::translate("MainWindow", "Jasmin", nullptr)); - nameCombo->setItemText(2, QApplication::translate("MainWindow", "Simon", nullptr)); - nameCombo->setItemText(3, QApplication::translate("MainWindow", "Zack", nullptr)); - -#ifndef QT_NO_TOOLTIP - nameCombo->setToolTip(QApplication::translate("MainWindow", "Specify your name", nullptr)); -#endif // QT_NO_TOOLTIP - femaleRadioButton->setStyleSheet(QApplication::translate("MainWindow", "Check this if you are female", nullptr)); - femaleRadioButton->setText(QApplication::translate("MainWindow", "&Female", nullptr)); - genderLabel->setText(QApplication::translate("MainWindow", "Gender:", nullptr)); - ageLabel->setText(QApplication::translate("MainWindow", "&Age:", nullptr)); -#ifndef QT_NO_TOOLTIP - maleRadioButton->setToolTip(QApplication::translate("MainWindow", "Check this if you are male", nullptr)); -#endif // QT_NO_TOOLTIP - maleRadioButton->setText(QApplication::translate("MainWindow", "&Male", nullptr)); - nameLabel->setText(QApplication::translate("MainWindow", "&Name:", nullptr)); - passwordLabel->setText(QApplication::translate("MainWindow", "&Password:", nullptr)); -#ifndef QT_NO_TOOLTIP - ageSpinBox->setToolTip(QApplication::translate("MainWindow", "Specify your age", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_STATUSTIP - ageSpinBox->setStatusTip(QApplication::translate("MainWindow", "Specify your age", nullptr)); -#endif // QT_NO_STATUSTIP -#ifndef QT_NO_TOOLTIP - agreeCheckBox->setToolTip(QApplication::translate("MainWindow", "Please read the LICENSE file before checking", nullptr)); -#endif // QT_NO_TOOLTIP - agreeCheckBox->setText(QApplication::translate("MainWindow", "I &accept the terms and &conditions", nullptr)); -#ifndef QT_NO_TOOLTIP - passwordEdit->setToolTip(QApplication::translate("MainWindow", "Specify your password", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_STATUSTIP - passwordEdit->setStatusTip(QApplication::translate("MainWindow", "Specify your password", nullptr)); -#endif // QT_NO_STATUSTIP - passwordEdit->setText(QApplication::translate("MainWindow", "Password", nullptr)); + MainWindow->setWindowTitle(QCoreApplication::translate("MainWindow", "MainWindow", nullptr)); + exitAction->setText(QCoreApplication::translate("MainWindow", "&Exit", nullptr)); + aboutQtAction->setText(QCoreApplication::translate("MainWindow", "About Qt", nullptr)); + editStyleAction->setText(QCoreApplication::translate("MainWindow", "Edit &Style", nullptr)); + aboutAction->setText(QCoreApplication::translate("MainWindow", "About", nullptr)); + nameCombo->setItemText(0, QCoreApplication::translate("MainWindow", "Girish", nullptr)); + nameCombo->setItemText(1, QCoreApplication::translate("MainWindow", "Jasmin", nullptr)); + nameCombo->setItemText(2, QCoreApplication::translate("MainWindow", "Simon", nullptr)); + nameCombo->setItemText(3, QCoreApplication::translate("MainWindow", "Zack", nullptr)); + +#if QT_CONFIG(tooltip) + nameCombo->setToolTip(QCoreApplication::translate("MainWindow", "Specify your name", nullptr)); +#endif // QT_CONFIG(tooltip) + femaleRadioButton->setStyleSheet(QCoreApplication::translate("MainWindow", "Check this if you are female", nullptr)); + femaleRadioButton->setText(QCoreApplication::translate("MainWindow", "&Female", nullptr)); + genderLabel->setText(QCoreApplication::translate("MainWindow", "Gender:", nullptr)); + ageLabel->setText(QCoreApplication::translate("MainWindow", "&Age:", nullptr)); +#if QT_CONFIG(tooltip) + maleRadioButton->setToolTip(QCoreApplication::translate("MainWindow", "Check this if you are male", nullptr)); +#endif // QT_CONFIG(tooltip) + maleRadioButton->setText(QCoreApplication::translate("MainWindow", "&Male", nullptr)); + nameLabel->setText(QCoreApplication::translate("MainWindow", "&Name:", nullptr)); + passwordLabel->setText(QCoreApplication::translate("MainWindow", "&Password:", nullptr)); +#if QT_CONFIG(tooltip) + ageSpinBox->setToolTip(QCoreApplication::translate("MainWindow", "Specify your age", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(statustip) + ageSpinBox->setStatusTip(QCoreApplication::translate("MainWindow", "Specify your age", nullptr)); +#endif // QT_CONFIG(statustip) +#if QT_CONFIG(tooltip) + agreeCheckBox->setToolTip(QCoreApplication::translate("MainWindow", "Please read the LICENSE file before checking", nullptr)); +#endif // QT_CONFIG(tooltip) + agreeCheckBox->setText(QCoreApplication::translate("MainWindow", "I &accept the terms and &conditions", nullptr)); +#if QT_CONFIG(tooltip) + passwordEdit->setToolTip(QCoreApplication::translate("MainWindow", "Specify your password", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(statustip) + passwordEdit->setStatusTip(QCoreApplication::translate("MainWindow", "Specify your password", nullptr)); +#endif // QT_CONFIG(statustip) + passwordEdit->setText(QCoreApplication::translate("MainWindow", "Password", nullptr)); const bool __sortingEnabled = professionList->isSortingEnabled(); professionList->setSortingEnabled(false); QListWidgetItem *___qlistwidgetitem = professionList->item(0); - ___qlistwidgetitem->setText(QApplication::translate("MainWindow", "Developer", nullptr)); + ___qlistwidgetitem->setText(QCoreApplication::translate("MainWindow", "Developer", nullptr)); QListWidgetItem *___qlistwidgetitem1 = professionList->item(1); - ___qlistwidgetitem1->setText(QApplication::translate("MainWindow", "Student", nullptr)); + ___qlistwidgetitem1->setText(QCoreApplication::translate("MainWindow", "Student", nullptr)); QListWidgetItem *___qlistwidgetitem2 = professionList->item(2); - ___qlistwidgetitem2->setText(QApplication::translate("MainWindow", "Fisherman", nullptr)); + ___qlistwidgetitem2->setText(QCoreApplication::translate("MainWindow", "Fisherman", nullptr)); professionList->setSortingEnabled(__sortingEnabled); -#ifndef QT_NO_TOOLTIP - professionList->setToolTip(QApplication::translate("MainWindow", "Select your profession", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_STATUSTIP - professionList->setStatusTip(QApplication::translate("MainWindow", "Specify your name here", nullptr)); -#endif // QT_NO_STATUSTIP -#ifndef QT_NO_WHATSTHIS - professionList->setWhatsThis(QApplication::translate("MainWindow", "Specify your name here", nullptr)); -#endif // QT_NO_WHATSTHIS - label->setText(QApplication::translate("MainWindow", "Profession:", nullptr)); - countryCombo->setItemText(0, QApplication::translate("MainWindow", "Egypt", nullptr)); - countryCombo->setItemText(1, QApplication::translate("MainWindow", "France", nullptr)); - countryCombo->setItemText(2, QApplication::translate("MainWindow", "Germany", nullptr)); - countryCombo->setItemText(3, QApplication::translate("MainWindow", "India", nullptr)); - countryCombo->setItemText(4, QApplication::translate("MainWindow", "Italy", nullptr)); - countryCombo->setItemText(5, QApplication::translate("MainWindow", "Korea", nullptr)); - countryCombo->setItemText(6, QApplication::translate("MainWindow", "Norway", nullptr)); - -#ifndef QT_NO_TOOLTIP - countryCombo->setToolTip(QApplication::translate("MainWindow", "Specify country of origin", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_STATUSTIP - countryCombo->setStatusTip(QApplication::translate("MainWindow", "Specify country of origin", nullptr)); -#endif // QT_NO_STATUSTIP - countryLabel->setText(QApplication::translate("MainWindow", "Pro&fession", nullptr)); - menu_File->setTitle(QApplication::translate("MainWindow", "&File", nullptr)); - menu_Help->setTitle(QApplication::translate("MainWindow", "&Help", nullptr)); +#if QT_CONFIG(tooltip) + professionList->setToolTip(QCoreApplication::translate("MainWindow", "Select your profession", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(statustip) + professionList->setStatusTip(QCoreApplication::translate("MainWindow", "Specify your name here", nullptr)); +#endif // QT_CONFIG(statustip) +#if QT_CONFIG(whatsthis) + professionList->setWhatsThis(QCoreApplication::translate("MainWindow", "Specify your name here", nullptr)); +#endif // QT_CONFIG(whatsthis) + label->setText(QCoreApplication::translate("MainWindow", "Profession:", nullptr)); + countryCombo->setItemText(0, QCoreApplication::translate("MainWindow", "Egypt", nullptr)); + countryCombo->setItemText(1, QCoreApplication::translate("MainWindow", "France", nullptr)); + countryCombo->setItemText(2, QCoreApplication::translate("MainWindow", "Germany", nullptr)); + countryCombo->setItemText(3, QCoreApplication::translate("MainWindow", "India", nullptr)); + countryCombo->setItemText(4, QCoreApplication::translate("MainWindow", "Italy", nullptr)); + countryCombo->setItemText(5, QCoreApplication::translate("MainWindow", "Korea", nullptr)); + countryCombo->setItemText(6, QCoreApplication::translate("MainWindow", "Norway", nullptr)); + +#if QT_CONFIG(tooltip) + countryCombo->setToolTip(QCoreApplication::translate("MainWindow", "Specify country of origin", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(statustip) + countryCombo->setStatusTip(QCoreApplication::translate("MainWindow", "Specify country of origin", nullptr)); +#endif // QT_CONFIG(statustip) + countryLabel->setText(QCoreApplication::translate("MainWindow", "Pro&fession", nullptr)); + menu_File->setTitle(QCoreApplication::translate("MainWindow", "&File", nullptr)); + menu_Help->setTitle(QCoreApplication::translate("MainWindow", "&Help", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/paletteeditor.ui.h b/tests/auto/tools/uic/baseline/paletteeditor.ui.h index 0061164960..eb1cad8c3a 100644 --- a/tests/auto/tools/uic/baseline/paletteeditor.ui.h +++ b/tests/auto/tools/uic/baseline/paletteeditor.ui.h @@ -31,7 +31,7 @@ /******************************************************************************** ** Form generated from reading UI file 'paletteeditor.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -81,7 +81,7 @@ public: if (qdesigner_internal__PaletteEditor->objectName().isEmpty()) qdesigner_internal__PaletteEditor->setObjectName(QString::fromUtf8("qdesigner_internal__PaletteEditor")); qdesigner_internal__PaletteEditor->resize(365, 409); - QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(7), static_cast<QSizePolicy::Policy>(7)); + QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(qdesigner_internal__PaletteEditor->sizePolicy().hasHeightForWidth()); @@ -108,7 +108,7 @@ public: gridLayout->setObjectName(QString::fromUtf8("gridLayout")); buildButton = new QtColorButton(advancedBox); buildButton->setObjectName(QString::fromUtf8("buildButton")); - QSizePolicy sizePolicy1(static_cast<QSizePolicy::Policy>(7), static_cast<QSizePolicy::Policy>(13)); + QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Ignored); sizePolicy1.setHorizontalStretch(0); sizePolicy1.setVerticalStretch(0); sizePolicy1.setHeightForWidth(buildButton->sizePolicy().hasHeightForWidth()); @@ -143,7 +143,7 @@ public: GroupBox126 = new QGroupBox(qdesigner_internal__PaletteEditor); GroupBox126->setObjectName(QString::fromUtf8("GroupBox126")); - QSizePolicy sizePolicy2(static_cast<QSizePolicy::Policy>(5), static_cast<QSizePolicy::Policy>(7)); + QSizePolicy sizePolicy2(QSizePolicy::Preferred, QSizePolicy::Expanding); sizePolicy2.setHorizontalStretch(0); sizePolicy2.setVerticalStretch(0); sizePolicy2.setHeightForWidth(GroupBox126->sizePolicy().hasHeightForWidth()); @@ -197,16 +197,16 @@ public: void retranslateUi(QDialog *qdesigner_internal__PaletteEditor) { - qdesigner_internal__PaletteEditor->setWindowTitle(QApplication::translate("qdesigner_internal::PaletteEditor", "Edit Palette", nullptr)); - advancedBox->setTitle(QApplication::translate("qdesigner_internal::PaletteEditor", "Tune Palette", nullptr)); + qdesigner_internal__PaletteEditor->setWindowTitle(QCoreApplication::translate("qdesigner_internal::PaletteEditor", "Edit Palette", nullptr)); + advancedBox->setTitle(QCoreApplication::translate("qdesigner_internal::PaletteEditor", "Tune Palette", nullptr)); buildButton->setText(QString()); - detailsRadio->setText(QApplication::translate("qdesigner_internal::PaletteEditor", "Show Details", nullptr)); - computeRadio->setText(QApplication::translate("qdesigner_internal::PaletteEditor", "Compute Details", nullptr)); - label->setText(QApplication::translate("qdesigner_internal::PaletteEditor", "Quick", nullptr)); - GroupBox126->setTitle(QApplication::translate("qdesigner_internal::PaletteEditor", "Preview", nullptr)); - disabledRadio->setText(QApplication::translate("qdesigner_internal::PaletteEditor", "Disabled", nullptr)); - inactiveRadio->setText(QApplication::translate("qdesigner_internal::PaletteEditor", "Inactive", nullptr)); - activeRadio->setText(QApplication::translate("qdesigner_internal::PaletteEditor", "Active", nullptr)); + detailsRadio->setText(QCoreApplication::translate("qdesigner_internal::PaletteEditor", "Show Details", nullptr)); + computeRadio->setText(QCoreApplication::translate("qdesigner_internal::PaletteEditor", "Compute Details", nullptr)); + label->setText(QCoreApplication::translate("qdesigner_internal::PaletteEditor", "Quick", nullptr)); + GroupBox126->setTitle(QCoreApplication::translate("qdesigner_internal::PaletteEditor", "Preview", nullptr)); + disabledRadio->setText(QCoreApplication::translate("qdesigner_internal::PaletteEditor", "Disabled", nullptr)); + inactiveRadio->setText(QCoreApplication::translate("qdesigner_internal::PaletteEditor", "Inactive", nullptr)); + activeRadio->setText(QCoreApplication::translate("qdesigner_internal::PaletteEditor", "Active", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/passworddialog.ui.h b/tests/auto/tools/uic/baseline/passworddialog.ui.h index 9ab95c4de9..0542098ec2 100644 --- a/tests/auto/tools/uic/baseline/passworddialog.ui.h +++ b/tests/auto/tools/uic/baseline/passworddialog.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'passworddialog.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -98,11 +98,11 @@ public: void retranslateUi(QDialog *PasswordDialog) { - PasswordDialog->setWindowTitle(QApplication::translate("PasswordDialog", "Authentication Required", nullptr)); - iconLabel->setText(QApplication::translate("PasswordDialog", "DUMMY ICON", nullptr)); - introLabel->setText(QApplication::translate("PasswordDialog", "INTRO TEXT DUMMY", nullptr)); - label->setText(QApplication::translate("PasswordDialog", "Username:", nullptr)); - lblPassword->setText(QApplication::translate("PasswordDialog", "Password:", nullptr)); + PasswordDialog->setWindowTitle(QCoreApplication::translate("PasswordDialog", "Authentication Required", nullptr)); + iconLabel->setText(QCoreApplication::translate("PasswordDialog", "DUMMY ICON", nullptr)); + introLabel->setText(QCoreApplication::translate("PasswordDialog", "INTRO TEXT DUMMY", nullptr)); + label->setText(QCoreApplication::translate("PasswordDialog", "Username:", nullptr)); + lblPassword->setText(QCoreApplication::translate("PasswordDialog", "Password:", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/pathpage.ui.h b/tests/auto/tools/uic/baseline/pathpage.ui.h index eb151f9550..bc9f254965 100644 --- a/tests/auto/tools/uic/baseline/pathpage.ui.h +++ b/tests/auto/tools/uic/baseline/pathpage.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'pathpage.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -104,11 +104,11 @@ public: void retranslateUi(QWidget *PathPage) { - PathPage->setWindowTitle(QApplication::translate("PathPage", "Form", nullptr)); - label_2->setText(QApplication::translate("PathPage", "File filters:", nullptr)); - label->setText(QApplication::translate("PathPage", "Documentation source file paths:", nullptr)); - addButton->setText(QApplication::translate("PathPage", "Add", nullptr)); - removeButton->setText(QApplication::translate("PathPage", "Remove", nullptr)); + PathPage->setWindowTitle(QCoreApplication::translate("PathPage", "Form", nullptr)); + label_2->setText(QCoreApplication::translate("PathPage", "File filters:", nullptr)); + label->setText(QCoreApplication::translate("PathPage", "Documentation source file paths:", nullptr)); + addButton->setText(QCoreApplication::translate("PathPage", "Add", nullptr)); + removeButton->setText(QCoreApplication::translate("PathPage", "Remove", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/phrasebookbox.ui.h b/tests/auto/tools/uic/baseline/phrasebookbox.ui.h index 27a0fa79ed..25989c4bd3 100644 --- a/tests/auto/tools/uic/baseline/phrasebookbox.ui.h +++ b/tests/auto/tools/uic/baseline/phrasebookbox.ui.h @@ -31,7 +31,7 @@ /******************************************************************************** ** Form generated from reading UI file 'phrasebookbox.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -165,11 +165,11 @@ public: unnamed->addLayout(buttonLayout); -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) target->setBuddy(targetLed); source->setBuddy(sourceLed); definition->setBuddy(definitionLed); -#endif // QT_NO_SHORTCUT +#endif // QT_CONFIG(shortcut) QWidget::setTabOrder(sourceLed, targetLed); QWidget::setTabOrder(targetLed, definitionLed); QWidget::setTabOrder(definitionLed, newBut); @@ -184,38 +184,38 @@ public: void retranslateUi(QDialog *PhraseBookBox) { - PhraseBookBox->setWindowTitle(QApplication::translate("PhraseBookBox", "Edit Phrase Book", nullptr)); -#ifndef QT_NO_WHATSTHIS - PhraseBookBox->setWhatsThis(QApplication::translate("PhraseBookBox", "This window allows you to add, modify, or delete phrases in a phrase book.", nullptr)); -#endif // QT_NO_WHATSTHIS - target->setText(QApplication::translate("PhraseBookBox", "&Translation:", nullptr)); -#ifndef QT_NO_WHATSTHIS - targetLed->setWhatsThis(QApplication::translate("PhraseBookBox", "This is the phrase in the target language corresponding to the source phrase.", nullptr)); -#endif // QT_NO_WHATSTHIS - source->setText(QApplication::translate("PhraseBookBox", "S&ource phrase:", nullptr)); -#ifndef QT_NO_WHATSTHIS - definitionLed->setWhatsThis(QApplication::translate("PhraseBookBox", "This is a definition for the source phrase.", nullptr)); -#endif // QT_NO_WHATSTHIS -#ifndef QT_NO_WHATSTHIS - sourceLed->setWhatsThis(QApplication::translate("PhraseBookBox", "This is the phrase in the source language.", nullptr)); -#endif // QT_NO_WHATSTHIS - definition->setText(QApplication::translate("PhraseBookBox", "&Definition:", nullptr)); -#ifndef QT_NO_WHATSTHIS - newBut->setWhatsThis(QApplication::translate("PhraseBookBox", "Click here to add the phrase to the phrase book.", nullptr)); -#endif // QT_NO_WHATSTHIS - newBut->setText(QApplication::translate("PhraseBookBox", "&New Phrase", nullptr)); -#ifndef QT_NO_WHATSTHIS - removeBut->setWhatsThis(QApplication::translate("PhraseBookBox", "Click here to remove the phrase from the phrase book.", nullptr)); -#endif // QT_NO_WHATSTHIS - removeBut->setText(QApplication::translate("PhraseBookBox", "&Remove Phrase", nullptr)); -#ifndef QT_NO_WHATSTHIS - saveBut->setWhatsThis(QApplication::translate("PhraseBookBox", "Click here to save the changes made.", nullptr)); -#endif // QT_NO_WHATSTHIS - saveBut->setText(QApplication::translate("PhraseBookBox", "&Save", nullptr)); -#ifndef QT_NO_WHATSTHIS - closeBut->setWhatsThis(QApplication::translate("PhraseBookBox", "Click here to close this window.", nullptr)); -#endif // QT_NO_WHATSTHIS - closeBut->setText(QApplication::translate("PhraseBookBox", "Close", nullptr)); + PhraseBookBox->setWindowTitle(QCoreApplication::translate("PhraseBookBox", "Edit Phrase Book", nullptr)); +#if QT_CONFIG(whatsthis) + PhraseBookBox->setWhatsThis(QCoreApplication::translate("PhraseBookBox", "This window allows you to add, modify, or delete phrases in a phrase book.", nullptr)); +#endif // QT_CONFIG(whatsthis) + target->setText(QCoreApplication::translate("PhraseBookBox", "&Translation:", nullptr)); +#if QT_CONFIG(whatsthis) + targetLed->setWhatsThis(QCoreApplication::translate("PhraseBookBox", "This is the phrase in the target language corresponding to the source phrase.", nullptr)); +#endif // QT_CONFIG(whatsthis) + source->setText(QCoreApplication::translate("PhraseBookBox", "S&ource phrase:", nullptr)); +#if QT_CONFIG(whatsthis) + definitionLed->setWhatsThis(QCoreApplication::translate("PhraseBookBox", "This is a definition for the source phrase.", nullptr)); +#endif // QT_CONFIG(whatsthis) +#if QT_CONFIG(whatsthis) + sourceLed->setWhatsThis(QCoreApplication::translate("PhraseBookBox", "This is the phrase in the source language.", nullptr)); +#endif // QT_CONFIG(whatsthis) + definition->setText(QCoreApplication::translate("PhraseBookBox", "&Definition:", nullptr)); +#if QT_CONFIG(whatsthis) + newBut->setWhatsThis(QCoreApplication::translate("PhraseBookBox", "Click here to add the phrase to the phrase book.", nullptr)); +#endif // QT_CONFIG(whatsthis) + newBut->setText(QCoreApplication::translate("PhraseBookBox", "&New Phrase", nullptr)); +#if QT_CONFIG(whatsthis) + removeBut->setWhatsThis(QCoreApplication::translate("PhraseBookBox", "Click here to remove the phrase from the phrase book.", nullptr)); +#endif // QT_CONFIG(whatsthis) + removeBut->setText(QCoreApplication::translate("PhraseBookBox", "&Remove Phrase", nullptr)); +#if QT_CONFIG(whatsthis) + saveBut->setWhatsThis(QCoreApplication::translate("PhraseBookBox", "Click here to save the changes made.", nullptr)); +#endif // QT_CONFIG(whatsthis) + saveBut->setText(QCoreApplication::translate("PhraseBookBox", "&Save", nullptr)); +#if QT_CONFIG(whatsthis) + closeBut->setWhatsThis(QCoreApplication::translate("PhraseBookBox", "Click here to close this window.", nullptr)); +#endif // QT_CONFIG(whatsthis) + closeBut->setText(QCoreApplication::translate("PhraseBookBox", "Close", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/pixmapfunction.ui.h b/tests/auto/tools/uic/baseline/pixmapfunction.ui.h index 1644380c15..5a24aeeded 100644 --- a/tests/auto/tools/uic/baseline/pixmapfunction.ui.h +++ b/tests/auto/tools/uic/baseline/pixmapfunction.ui.h @@ -58,9 +58,9 @@ public: void retranslateUi(QWidget *Form) { - Form->setWindowTitle(QApplication::translate("Form", "Form", nullptr)); + Form->setWindowTitle(QCoreApplication::translate("Form", "Form", nullptr)); label->setText(QString()); - pushButton->setText(QApplication::translate("Form", "PushButton", nullptr)); + pushButton->setText(QCoreApplication::translate("Form", "PushButton", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/plugindialog.ui.h b/tests/auto/tools/uic/baseline/plugindialog.ui.h index 3634b8436f..72e4d22b78 100644 --- a/tests/auto/tools/uic/baseline/plugindialog.ui.h +++ b/tests/auto/tools/uic/baseline/plugindialog.ui.h @@ -31,7 +31,7 @@ /******************************************************************************** ** Form generated from reading UI file 'plugindialog.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -111,11 +111,11 @@ public: void retranslateUi(QDialog *PluginDialog) { - PluginDialog->setWindowTitle(QApplication::translate("PluginDialog", "Plugin Information", nullptr)); - label->setText(QApplication::translate("PluginDialog", "TextLabel", nullptr)); + PluginDialog->setWindowTitle(QCoreApplication::translate("PluginDialog", "Plugin Information", nullptr)); + label->setText(QCoreApplication::translate("PluginDialog", "TextLabel", nullptr)); QTreeWidgetItem *___qtreewidgetitem = treeWidget->headerItem(); - ___qtreewidgetitem->setText(0, QApplication::translate("PluginDialog", "1", nullptr)); - message->setText(QApplication::translate("PluginDialog", "TextLabel", nullptr)); + ___qtreewidgetitem->setText(0, QCoreApplication::translate("PluginDialog", "1", nullptr)); + message->setText(QCoreApplication::translate("PluginDialog", "TextLabel", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/preferencesdialog.ui.h b/tests/auto/tools/uic/baseline/preferencesdialog.ui.h index 289e6775b4..c4002eaff7 100644 --- a/tests/auto/tools/uic/baseline/preferencesdialog.ui.h +++ b/tests/auto/tools/uic/baseline/preferencesdialog.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'preferencesdialog.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -150,11 +150,11 @@ public: void retranslateUi(QDialog *PreferencesDialog) { - PreferencesDialog->setWindowTitle(QApplication::translate("PreferencesDialog", "Preferences", nullptr)); - m_uiModeGroupBox->setTitle(QApplication::translate("PreferencesDialog", "User Interface Mode", nullptr)); - m_templatePathGroupBox->setTitle(QApplication::translate("PreferencesDialog", "Additional Template Paths", nullptr)); - m_addTemplatePathButton->setText(QApplication::translate("PreferencesDialog", "...", nullptr)); - m_removeTemplatePathButton->setText(QApplication::translate("PreferencesDialog", "...", nullptr)); + PreferencesDialog->setWindowTitle(QCoreApplication::translate("PreferencesDialog", "Preferences", nullptr)); + m_uiModeGroupBox->setTitle(QCoreApplication::translate("PreferencesDialog", "User Interface Mode", nullptr)); + m_templatePathGroupBox->setTitle(QCoreApplication::translate("PreferencesDialog", "Additional Template Paths", nullptr)); + m_addTemplatePathButton->setText(QCoreApplication::translate("PreferencesDialog", "...", nullptr)); + m_removeTemplatePathButton->setText(QCoreApplication::translate("PreferencesDialog", "...", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/previewconfigurationwidget.ui.h b/tests/auto/tools/uic/baseline/previewconfigurationwidget.ui.h index 3c729b9c65..71e8605832 100644 --- a/tests/auto/tools/uic/baseline/previewconfigurationwidget.ui.h +++ b/tests/auto/tools/uic/baseline/previewconfigurationwidget.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'previewconfigurationwidget.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -108,14 +108,14 @@ public: void retranslateUi(QGroupBox *PreviewConfigurationWidget) { - PreviewConfigurationWidget->setWindowTitle(QApplication::translate("PreviewConfigurationWidget", "Form", nullptr)); - PreviewConfigurationWidget->setTitle(QApplication::translate("PreviewConfigurationWidget", "Print/Preview Configuration", nullptr)); - m_styleLabel->setText(QApplication::translate("PreviewConfigurationWidget", "Style", nullptr)); - m_appStyleSheetLabel->setText(QApplication::translate("PreviewConfigurationWidget", "Style sheet", nullptr)); - m_appStyleSheetChangeButton->setText(QApplication::translate("PreviewConfigurationWidget", "...", nullptr)); - m_appStyleSheetClearButton->setText(QApplication::translate("PreviewConfigurationWidget", "...", nullptr)); - m_skinLabel->setText(QApplication::translate("PreviewConfigurationWidget", "Device skin", nullptr)); - m_skinRemoveButton->setText(QApplication::translate("PreviewConfigurationWidget", "...", nullptr)); + PreviewConfigurationWidget->setWindowTitle(QCoreApplication::translate("PreviewConfigurationWidget", "Form", nullptr)); + PreviewConfigurationWidget->setTitle(QCoreApplication::translate("PreviewConfigurationWidget", "Print/Preview Configuration", nullptr)); + m_styleLabel->setText(QCoreApplication::translate("PreviewConfigurationWidget", "Style", nullptr)); + m_appStyleSheetLabel->setText(QCoreApplication::translate("PreviewConfigurationWidget", "Style sheet", nullptr)); + m_appStyleSheetChangeButton->setText(QCoreApplication::translate("PreviewConfigurationWidget", "...", nullptr)); + m_appStyleSheetClearButton->setText(QCoreApplication::translate("PreviewConfigurationWidget", "...", nullptr)); + m_skinLabel->setText(QCoreApplication::translate("PreviewConfigurationWidget", "Device skin", nullptr)); + m_skinRemoveButton->setText(QCoreApplication::translate("PreviewConfigurationWidget", "...", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/previewdialogbase.ui.h b/tests/auto/tools/uic/baseline/previewdialogbase.ui.h index 8d4c0dae9f..5ff155de13 100644 --- a/tests/auto/tools/uic/baseline/previewdialogbase.ui.h +++ b/tests/auto/tools/uic/baseline/previewdialogbase.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'previewdialogbase.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -70,7 +70,7 @@ public: paperSizeCombo = new QComboBox(PreviewDialogBase); paperSizeCombo->setObjectName(QString::fromUtf8("paperSizeCombo")); - QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(1), static_cast<QSizePolicy::Policy>(0)); + QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(paperSizeCombo->sizePolicy().hasHeightForWidth()); @@ -115,7 +115,7 @@ public: previewArea = new QScrollArea(PreviewDialogBase); previewArea->setObjectName(QString::fromUtf8("previewArea")); - QSizePolicy sizePolicy1(static_cast<QSizePolicy::Policy>(5), static_cast<QSizePolicy::Policy>(5)); + QSizePolicy sizePolicy1(QSizePolicy::Preferred, QSizePolicy::Preferred); sizePolicy1.setHorizontalStretch(1); sizePolicy1.setVerticalStretch(0); sizePolicy1.setHeightForWidth(previewArea->sizePolicy().hasHeightForWidth()); @@ -135,7 +135,7 @@ public: progressBar = new QProgressBar(PreviewDialogBase); progressBar->setObjectName(QString::fromUtf8("progressBar")); progressBar->setEnabled(false); - QSizePolicy sizePolicy2(static_cast<QSizePolicy::Policy>(7), static_cast<QSizePolicy::Policy>(0)); + QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Fixed); sizePolicy2.setHorizontalStretch(1); sizePolicy2.setVerticalStretch(0); sizePolicy2.setHeightForWidth(progressBar->sizePolicy().hasHeightForWidth()); @@ -156,10 +156,10 @@ public: vboxLayout->addLayout(hboxLayout2); -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) label->setBuddy(paperSizeCombo); label_2->setBuddy(paperOrientationCombo); -#endif // QT_NO_SHORTCUT +#endif // QT_CONFIG(shortcut) retranslateUi(PreviewDialogBase); QObject::connect(buttonBox, SIGNAL(accepted()), PreviewDialogBase, SLOT(accept())); @@ -170,11 +170,11 @@ public: void retranslateUi(QDialog *PreviewDialogBase) { - PreviewDialogBase->setWindowTitle(QApplication::translate("PreviewDialogBase", "Print Preview", nullptr)); - label->setText(QApplication::translate("PreviewDialogBase", "&Paper Size:", nullptr)); - label_2->setText(QApplication::translate("PreviewDialogBase", "&Orientation:", nullptr)); + PreviewDialogBase->setWindowTitle(QCoreApplication::translate("PreviewDialogBase", "Print Preview", nullptr)); + label->setText(QCoreApplication::translate("PreviewDialogBase", "&Paper Size:", nullptr)); + label_2->setText(QCoreApplication::translate("PreviewDialogBase", "&Orientation:", nullptr)); QTreeWidgetItem *___qtreewidgetitem = pageList->headerItem(); - ___qtreewidgetitem->setText(0, QApplication::translate("PreviewDialogBase", "1", nullptr)); + ___qtreewidgetitem->setText(0, QCoreApplication::translate("PreviewDialogBase", "1", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/previewwidget.ui.h b/tests/auto/tools/uic/baseline/previewwidget.ui.h index 6e359416c8..47563587fb 100644 --- a/tests/auto/tools/uic/baseline/previewwidget.ui.h +++ b/tests/auto/tools/uic/baseline/previewwidget.ui.h @@ -31,7 +31,7 @@ /******************************************************************************** ** Form generated from reading UI file 'previewwidget.ui' ** -** Created by: Qt User Interface Compiler version 5.10.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -92,7 +92,7 @@ public: if (qdesigner_internal__PreviewWidget->objectName().isEmpty()) qdesigner_internal__PreviewWidget->setObjectName(QString::fromUtf8("qdesigner_internal__PreviewWidget")); qdesigner_internal__PreviewWidget->resize(471, 251); - QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(1), static_cast<QSizePolicy::Policy>(1)); + QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(qdesigner_internal__PreviewWidget->sizePolicy().hasHeightForWidth()); @@ -235,18 +235,18 @@ public: void retranslateUi(QWidget *qdesigner_internal__PreviewWidget) { - qdesigner_internal__PreviewWidget->setWindowTitle(QApplication::translate("qdesigner_internal::PreviewWidget", "Preview Window", nullptr)); - LineEdit1->setText(QApplication::translate("qdesigner_internal::PreviewWidget", "LineEdit", nullptr)); - ComboBox1->setItemText(0, QApplication::translate("qdesigner_internal::PreviewWidget", "ComboBox", nullptr)); - - PushButton1->setText(QApplication::translate("qdesigner_internal::PreviewWidget", "PushButton", nullptr)); - ButtonGroup2->setTitle(QApplication::translate("qdesigner_internal::PreviewWidget", "ButtonGroup2", nullptr)); - CheckBox1->setText(QApplication::translate("qdesigner_internal::PreviewWidget", "CheckBox1", nullptr)); - CheckBox2->setText(QApplication::translate("qdesigner_internal::PreviewWidget", "CheckBox2", nullptr)); - ButtonGroup1->setTitle(QApplication::translate("qdesigner_internal::PreviewWidget", "ButtonGroup", nullptr)); - RadioButton1->setText(QApplication::translate("qdesigner_internal::PreviewWidget", "RadioButton1", nullptr)); - RadioButton2->setText(QApplication::translate("qdesigner_internal::PreviewWidget", "RadioButton2", nullptr)); - RadioButton3->setText(QApplication::translate("qdesigner_internal::PreviewWidget", "RadioButton3", nullptr)); + qdesigner_internal__PreviewWidget->setWindowTitle(QCoreApplication::translate("qdesigner_internal::PreviewWidget", "Preview Window", nullptr)); + LineEdit1->setText(QCoreApplication::translate("qdesigner_internal::PreviewWidget", "LineEdit", nullptr)); + ComboBox1->setItemText(0, QCoreApplication::translate("qdesigner_internal::PreviewWidget", "ComboBox", nullptr)); + + PushButton1->setText(QCoreApplication::translate("qdesigner_internal::PreviewWidget", "PushButton", nullptr)); + ButtonGroup2->setTitle(QCoreApplication::translate("qdesigner_internal::PreviewWidget", "ButtonGroup2", nullptr)); + CheckBox1->setText(QCoreApplication::translate("qdesigner_internal::PreviewWidget", "CheckBox1", nullptr)); + CheckBox2->setText(QCoreApplication::translate("qdesigner_internal::PreviewWidget", "CheckBox2", nullptr)); + ButtonGroup1->setTitle(QCoreApplication::translate("qdesigner_internal::PreviewWidget", "ButtonGroup", nullptr)); + RadioButton1->setText(QCoreApplication::translate("qdesigner_internal::PreviewWidget", "RadioButton1", nullptr)); + RadioButton2->setText(QCoreApplication::translate("qdesigner_internal::PreviewWidget", "RadioButton2", nullptr)); + RadioButton3->setText(QCoreApplication::translate("qdesigner_internal::PreviewWidget", "RadioButton3", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/proxy.ui.h b/tests/auto/tools/uic/baseline/proxy.ui.h index a1bc287190..1ecea389f3 100644 --- a/tests/auto/tools/uic/baseline/proxy.ui.h +++ b/tests/auto/tools/uic/baseline/proxy.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'proxy.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -87,11 +87,11 @@ public: void retranslateUi(QDialog *ProxyDialog) { - ProxyDialog->setWindowTitle(QApplication::translate("ProxyDialog", "Proxy Authentication", nullptr)); - iconLabel->setText(QApplication::translate("ProxyDialog", "ICON", nullptr)); - introLabel->setText(QApplication::translate("ProxyDialog", "Connect to proxy", nullptr)); - usernameLabel->setText(QApplication::translate("ProxyDialog", "Username:", nullptr)); - passwordLabel->setText(QApplication::translate("ProxyDialog", "Password:", nullptr)); + ProxyDialog->setWindowTitle(QCoreApplication::translate("ProxyDialog", "Proxy Authentication", nullptr)); + iconLabel->setText(QCoreApplication::translate("ProxyDialog", "ICON", nullptr)); + introLabel->setText(QCoreApplication::translate("ProxyDialog", "Connect to proxy", nullptr)); + usernameLabel->setText(QCoreApplication::translate("ProxyDialog", "Username:", nullptr)); + passwordLabel->setText(QCoreApplication::translate("ProxyDialog", "Password:", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/qfiledialog.ui.h b/tests/auto/tools/uic/baseline/qfiledialog.ui.h index 53607db449..9e51ee6a7c 100644 --- a/tests/auto/tools/uic/baseline/qfiledialog.ui.h +++ b/tests/auto/tools/uic/baseline/qfiledialog.ui.h @@ -31,7 +31,7 @@ /******************************************************************************** ** Form generated from reading UI file 'qfiledialog.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -271,26 +271,26 @@ public: void retranslateUi(QDialog *QFileDialog) { - lookInLabel->setText(QApplication::translate("QFileDialog", "Look in:", nullptr)); -#ifndef QT_NO_TOOLTIP - backButton->setToolTip(QApplication::translate("QFileDialog", "Back", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_TOOLTIP - forwardButton->setToolTip(QApplication::translate("QFileDialog", "Forward", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_TOOLTIP - toParentButton->setToolTip(QApplication::translate("QFileDialog", "Parent Directory", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_TOOLTIP - newFolderButton->setToolTip(QApplication::translate("QFileDialog", "Create New Folder", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_TOOLTIP - listModeButton->setToolTip(QApplication::translate("QFileDialog", "List View", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_TOOLTIP - detailModeButton->setToolTip(QApplication::translate("QFileDialog", "Detail View", nullptr)); -#endif // QT_NO_TOOLTIP - fileTypeLabel->setText(QApplication::translate("QFileDialog", "Files of type:", nullptr)); + lookInLabel->setText(QCoreApplication::translate("QFileDialog", "Look in:", nullptr)); +#if QT_CONFIG(tooltip) + backButton->setToolTip(QCoreApplication::translate("QFileDialog", "Back", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(tooltip) + forwardButton->setToolTip(QCoreApplication::translate("QFileDialog", "Forward", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(tooltip) + toParentButton->setToolTip(QCoreApplication::translate("QFileDialog", "Parent Directory", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(tooltip) + newFolderButton->setToolTip(QCoreApplication::translate("QFileDialog", "Create New Folder", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(tooltip) + listModeButton->setToolTip(QCoreApplication::translate("QFileDialog", "List View", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(tooltip) + detailModeButton->setToolTip(QCoreApplication::translate("QFileDialog", "Detail View", nullptr)); +#endif // QT_CONFIG(tooltip) + fileTypeLabel->setText(QCoreApplication::translate("QFileDialog", "Files of type:", nullptr)); Q_UNUSED(QFileDialog); } // retranslateUi diff --git a/tests/auto/tools/uic/baseline/qpagesetupwidget.ui.h b/tests/auto/tools/uic/baseline/qpagesetupwidget.ui.h index a5379bc468..d21d6da972 100644 --- a/tests/auto/tools/uic/baseline/qpagesetupwidget.ui.h +++ b/tests/auto/tools/uic/baseline/qpagesetupwidget.ui.h @@ -290,12 +290,12 @@ public: gridLayout_3->addItem(verticalSpacer, 6, 0, 1, 1); -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) pageSizeLabel->setBuddy(pageSizeCombo); widthLabel->setBuddy(pageWidth); heightLabel->setBuddy(pageHeight); paperSourceLabel->setBuddy(paperSource); -#endif // QT_NO_SHORTCUT +#endif // QT_CONFIG(shortcut) retranslateUi(QPageSetupWidget); @@ -304,45 +304,45 @@ public: void retranslateUi(QWidget *QPageSetupWidget) { - QPageSetupWidget->setWindowTitle(QApplication::translate("QPageSetupWidget", "Form", nullptr)); - groupBox_2->setTitle(QApplication::translate("QPageSetupWidget", "Paper", nullptr)); - pageSizeLabel->setText(QApplication::translate("QPageSetupWidget", "Page size:", nullptr)); - widthLabel->setText(QApplication::translate("QPageSetupWidget", "Width:", nullptr)); - heightLabel->setText(QApplication::translate("QPageSetupWidget", "Height:", nullptr)); - paperSourceLabel->setText(QApplication::translate("QPageSetupWidget", "Paper source:", nullptr)); - groupBox_3->setTitle(QApplication::translate("QPageSetupWidget", "Orientation", nullptr)); - portrait->setText(QApplication::translate("QPageSetupWidget", "Portrait", nullptr)); - landscape->setText(QApplication::translate("QPageSetupWidget", "Landscape", nullptr)); - reverseLandscape->setText(QApplication::translate("QPageSetupWidget", "Reverse landscape", nullptr)); - reversePortrait->setText(QApplication::translate("QPageSetupWidget", "Reverse portrait", nullptr)); - groupBox->setTitle(QApplication::translate("QPageSetupWidget", "Margins", nullptr)); -#ifndef QT_NO_TOOLTIP - topMargin->setToolTip(QApplication::translate("QPageSetupWidget", "top margin", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_ACCESSIBILITY - topMargin->setAccessibleName(QApplication::translate("QPageSetupWidget", "top margin", nullptr)); -#endif // QT_NO_ACCESSIBILITY -#ifndef QT_NO_TOOLTIP - leftMargin->setToolTip(QApplication::translate("QPageSetupWidget", "left margin", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_ACCESSIBILITY - leftMargin->setAccessibleName(QApplication::translate("QPageSetupWidget", "left margin", nullptr)); -#endif // QT_NO_ACCESSIBILITY -#ifndef QT_NO_TOOLTIP - rightMargin->setToolTip(QApplication::translate("QPageSetupWidget", "right margin", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_ACCESSIBILITY - rightMargin->setAccessibleName(QApplication::translate("QPageSetupWidget", "right margin", nullptr)); -#endif // QT_NO_ACCESSIBILITY -#ifndef QT_NO_TOOLTIP - bottomMargin->setToolTip(QApplication::translate("QPageSetupWidget", "bottom margin", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_ACCESSIBILITY - bottomMargin->setAccessibleName(QApplication::translate("QPageSetupWidget", "bottom margin", nullptr)); -#endif // QT_NO_ACCESSIBILITY - pagesPerSheetButtonGroup->setTitle(QApplication::translate("QPageSetupWidget", "Page Layout", nullptr)); - label->setText(QApplication::translate("QPageSetupWidget", "Page order:", nullptr)); - label_2->setText(QApplication::translate("QPageSetupWidget", "Pages per sheet:", nullptr)); + QPageSetupWidget->setWindowTitle(QCoreApplication::translate("QPageSetupWidget", "Form", nullptr)); + groupBox_2->setTitle(QCoreApplication::translate("QPageSetupWidget", "Paper", nullptr)); + pageSizeLabel->setText(QCoreApplication::translate("QPageSetupWidget", "Page size:", nullptr)); + widthLabel->setText(QCoreApplication::translate("QPageSetupWidget", "Width:", nullptr)); + heightLabel->setText(QCoreApplication::translate("QPageSetupWidget", "Height:", nullptr)); + paperSourceLabel->setText(QCoreApplication::translate("QPageSetupWidget", "Paper source:", nullptr)); + groupBox_3->setTitle(QCoreApplication::translate("QPageSetupWidget", "Orientation", nullptr)); + portrait->setText(QCoreApplication::translate("QPageSetupWidget", "Portrait", nullptr)); + landscape->setText(QCoreApplication::translate("QPageSetupWidget", "Landscape", nullptr)); + reverseLandscape->setText(QCoreApplication::translate("QPageSetupWidget", "Reverse landscape", nullptr)); + reversePortrait->setText(QCoreApplication::translate("QPageSetupWidget", "Reverse portrait", nullptr)); + groupBox->setTitle(QCoreApplication::translate("QPageSetupWidget", "Margins", nullptr)); +#if QT_CONFIG(tooltip) + topMargin->setToolTip(QCoreApplication::translate("QPageSetupWidget", "top margin", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(accessibility) + topMargin->setAccessibleName(QCoreApplication::translate("QPageSetupWidget", "top margin", nullptr)); +#endif // QT_CONFIG(accessibility) +#if QT_CONFIG(tooltip) + leftMargin->setToolTip(QCoreApplication::translate("QPageSetupWidget", "left margin", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(accessibility) + leftMargin->setAccessibleName(QCoreApplication::translate("QPageSetupWidget", "left margin", nullptr)); +#endif // QT_CONFIG(accessibility) +#if QT_CONFIG(tooltip) + rightMargin->setToolTip(QCoreApplication::translate("QPageSetupWidget", "right margin", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(accessibility) + rightMargin->setAccessibleName(QCoreApplication::translate("QPageSetupWidget", "right margin", nullptr)); +#endif // QT_CONFIG(accessibility) +#if QT_CONFIG(tooltip) + bottomMargin->setToolTip(QCoreApplication::translate("QPageSetupWidget", "bottom margin", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(accessibility) + bottomMargin->setAccessibleName(QCoreApplication::translate("QPageSetupWidget", "bottom margin", nullptr)); +#endif // QT_CONFIG(accessibility) + pagesPerSheetButtonGroup->setTitle(QCoreApplication::translate("QPageSetupWidget", "Page Layout", nullptr)); + label->setText(QCoreApplication::translate("QPageSetupWidget", "Page order:", nullptr)); + label_2->setText(QCoreApplication::translate("QPageSetupWidget", "Pages per sheet:", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/qprintpropertieswidget.ui.h b/tests/auto/tools/uic/baseline/qprintpropertieswidget.ui.h index 8626a9fc3c..f0e06548b5 100644 --- a/tests/auto/tools/uic/baseline/qprintpropertieswidget.ui.h +++ b/tests/auto/tools/uic/baseline/qprintpropertieswidget.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'qprintpropertieswidget.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -79,9 +79,9 @@ public: void retranslateUi(QWidget *QPrintPropertiesWidget) { - QPrintPropertiesWidget->setWindowTitle(QApplication::translate("QPrintPropertiesWidget", "Form", nullptr)); - tabs->setTabText(tabs->indexOf(tabPage), QApplication::translate("QPrintPropertiesWidget", "Page", nullptr)); - tabs->setTabText(tabs->indexOf(cupsPropertiesPage), QApplication::translate("QPrintPropertiesWidget", "Advanced", nullptr)); + QPrintPropertiesWidget->setWindowTitle(QCoreApplication::translate("QPrintPropertiesWidget", "Form", nullptr)); + tabs->setTabText(tabs->indexOf(tabPage), QCoreApplication::translate("QPrintPropertiesWidget", "Page", nullptr)); + tabs->setTabText(tabs->indexOf(cupsPropertiesPage), QCoreApplication::translate("QPrintPropertiesWidget", "Advanced", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/qprintsettingsoutput.ui.h b/tests/auto/tools/uic/baseline/qprintsettingsoutput.ui.h index 656b5f9deb..3d37a55548 100644 --- a/tests/auto/tools/uic/baseline/qprintsettingsoutput.ui.h +++ b/tests/auto/tools/uic/baseline/qprintsettingsoutput.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'qprintsettingsoutput.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -260,9 +260,9 @@ public: horizontalLayout_2->addWidget(tabs); -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) label->setBuddy(copies); -#endif // QT_NO_SHORTCUT +#endif // QT_CONFIG(shortcut) retranslateUi(QPrintSettingsOutput); QObject::connect(printRange, SIGNAL(toggled(bool)), from, SLOT(setEnabled(bool))); @@ -276,25 +276,25 @@ public: void retranslateUi(QWidget *QPrintSettingsOutput) { - QPrintSettingsOutput->setWindowTitle(QApplication::translate("QPrintSettingsOutput", "Form", nullptr)); - gbPrintRange->setTitle(QApplication::translate("QPrintSettingsOutput", "Print range", nullptr)); - printAll->setText(QApplication::translate("QPrintSettingsOutput", "Print all", nullptr)); - printRange->setText(QApplication::translate("QPrintSettingsOutput", "Pages from", nullptr)); - label_3->setText(QApplication::translate("QPrintSettingsOutput", "to", nullptr)); - printSelection->setText(QApplication::translate("QPrintSettingsOutput", "Selection", nullptr)); - groupBox->setTitle(QApplication::translate("QPrintSettingsOutput", "Output Settings", nullptr)); - label->setText(QApplication::translate("QPrintSettingsOutput", "Copies:", nullptr)); - collate->setText(QApplication::translate("QPrintSettingsOutput", "Collate", nullptr)); - reverse->setText(QApplication::translate("QPrintSettingsOutput", "Reverse", nullptr)); - tabs->setTabText(tabs->indexOf(copiesTab), QApplication::translate("QPrintSettingsOutput", "Copies", nullptr)); - colorMode->setTitle(QApplication::translate("QPrintSettingsOutput", "Color Mode", nullptr)); - color->setText(QApplication::translate("QPrintSettingsOutput", "Color", nullptr)); - grayscale->setText(QApplication::translate("QPrintSettingsOutput", "Grayscale", nullptr)); - duplex->setTitle(QApplication::translate("QPrintSettingsOutput", "Duplex Printing", nullptr)); - noDuplex->setText(QApplication::translate("QPrintSettingsOutput", "None", nullptr)); - duplexLong->setText(QApplication::translate("QPrintSettingsOutput", "Long side", nullptr)); - duplexShort->setText(QApplication::translate("QPrintSettingsOutput", "Short side", nullptr)); - tabs->setTabText(tabs->indexOf(optionsTab), QApplication::translate("QPrintSettingsOutput", "Options", nullptr)); + QPrintSettingsOutput->setWindowTitle(QCoreApplication::translate("QPrintSettingsOutput", "Form", nullptr)); + gbPrintRange->setTitle(QCoreApplication::translate("QPrintSettingsOutput", "Print range", nullptr)); + printAll->setText(QCoreApplication::translate("QPrintSettingsOutput", "Print all", nullptr)); + printRange->setText(QCoreApplication::translate("QPrintSettingsOutput", "Pages from", nullptr)); + label_3->setText(QCoreApplication::translate("QPrintSettingsOutput", "to", nullptr)); + printSelection->setText(QCoreApplication::translate("QPrintSettingsOutput", "Selection", nullptr)); + groupBox->setTitle(QCoreApplication::translate("QPrintSettingsOutput", "Output Settings", nullptr)); + label->setText(QCoreApplication::translate("QPrintSettingsOutput", "Copies:", nullptr)); + collate->setText(QCoreApplication::translate("QPrintSettingsOutput", "Collate", nullptr)); + reverse->setText(QCoreApplication::translate("QPrintSettingsOutput", "Reverse", nullptr)); + tabs->setTabText(tabs->indexOf(copiesTab), QCoreApplication::translate("QPrintSettingsOutput", "Copies", nullptr)); + colorMode->setTitle(QCoreApplication::translate("QPrintSettingsOutput", "Color Mode", nullptr)); + color->setText(QCoreApplication::translate("QPrintSettingsOutput", "Color", nullptr)); + grayscale->setText(QCoreApplication::translate("QPrintSettingsOutput", "Grayscale", nullptr)); + duplex->setTitle(QCoreApplication::translate("QPrintSettingsOutput", "Duplex Printing", nullptr)); + noDuplex->setText(QCoreApplication::translate("QPrintSettingsOutput", "None", nullptr)); + duplexLong->setText(QCoreApplication::translate("QPrintSettingsOutput", "Long side", nullptr)); + duplexShort->setText(QCoreApplication::translate("QPrintSettingsOutput", "Short side", nullptr)); + tabs->setTabText(tabs->indexOf(optionsTab), QCoreApplication::translate("QPrintSettingsOutput", "Options", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/qprintwidget.ui.h b/tests/auto/tools/uic/baseline/qprintwidget.ui.h index 04b05143c6..5b1d921173 100644 --- a/tests/auto/tools/uic/baseline/qprintwidget.ui.h +++ b/tests/auto/tools/uic/baseline/qprintwidget.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'qprintwidget.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -128,10 +128,10 @@ public: horizontalLayout_2->addWidget(printerGroup); -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) label->setBuddy(printers); lOutput->setBuddy(filename); -#endif // QT_NO_SHORTCUT +#endif // QT_CONFIG(shortcut) retranslateUi(QPrintWidget); @@ -140,15 +140,15 @@ public: void retranslateUi(QWidget *QPrintWidget) { - QPrintWidget->setWindowTitle(QApplication::translate("QPrintWidget", "Form", nullptr)); - printerGroup->setTitle(QApplication::translate("QPrintWidget", "Printer", nullptr)); - label->setText(QApplication::translate("QPrintWidget", "&Name:", nullptr)); - properties->setText(QApplication::translate("QPrintWidget", "P&roperties", nullptr)); - label_2->setText(QApplication::translate("QPrintWidget", "Location:", nullptr)); - preview->setText(QApplication::translate("QPrintWidget", "Preview", nullptr)); - label_3->setText(QApplication::translate("QPrintWidget", "Type:", nullptr)); - lOutput->setText(QApplication::translate("QPrintWidget", "Output &file:", nullptr)); - fileBrowser->setText(QApplication::translate("QPrintWidget", "...", nullptr)); + QPrintWidget->setWindowTitle(QCoreApplication::translate("QPrintWidget", "Form", nullptr)); + printerGroup->setTitle(QCoreApplication::translate("QPrintWidget", "Printer", nullptr)); + label->setText(QCoreApplication::translate("QPrintWidget", "&Name:", nullptr)); + properties->setText(QCoreApplication::translate("QPrintWidget", "P&roperties", nullptr)); + label_2->setText(QCoreApplication::translate("QPrintWidget", "Location:", nullptr)); + preview->setText(QCoreApplication::translate("QPrintWidget", "Preview", nullptr)); + label_3->setText(QCoreApplication::translate("QPrintWidget", "Type:", nullptr)); + lOutput->setText(QCoreApplication::translate("QPrintWidget", "Output &file:", nullptr)); + fileBrowser->setText(QCoreApplication::translate("QPrintWidget", "...", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/qsqlconnectiondialog.ui.h b/tests/auto/tools/uic/baseline/qsqlconnectiondialog.ui.h index 2131bc6d9b..681c1f97da 100644 --- a/tests/auto/tools/uic/baseline/qsqlconnectiondialog.ui.h +++ b/tests/auto/tools/uic/baseline/qsqlconnectiondialog.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'qsqlconnectiondialog.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -179,14 +179,14 @@ public: vboxLayout->addLayout(hboxLayout1); -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) textLabel4->setBuddy(editUsername); textLabel2->setBuddy(comboDriver); textLabel3->setBuddy(editDatabase); textLabel5->setBuddy(editHostname); textLabel5_2->setBuddy(portSpinBox); textLabel4_2->setBuddy(editPassword); -#endif // QT_NO_SHORTCUT +#endif // QT_CONFIG(shortcut) QWidget::setTabOrder(comboDriver, editDatabase); QWidget::setTabOrder(editDatabase, editUsername); QWidget::setTabOrder(editUsername, editPassword); @@ -206,18 +206,18 @@ public: void retranslateUi(QDialog *QSqlConnectionDialogUi) { - QSqlConnectionDialogUi->setWindowTitle(QApplication::translate("QSqlConnectionDialogUi", "Connect...", nullptr)); - connGroupBox->setTitle(QApplication::translate("QSqlConnectionDialogUi", "Connection settings", nullptr)); - textLabel4->setText(QApplication::translate("QSqlConnectionDialogUi", "&Username:", nullptr)); - textLabel2->setText(QApplication::translate("QSqlConnectionDialogUi", "D&river", nullptr)); - portSpinBox->setSpecialValueText(QApplication::translate("QSqlConnectionDialogUi", "Default", nullptr)); - textLabel3->setText(QApplication::translate("QSqlConnectionDialogUi", "Database Name:", nullptr)); - textLabel5->setText(QApplication::translate("QSqlConnectionDialogUi", "&Hostname:", nullptr)); - textLabel5_2->setText(QApplication::translate("QSqlConnectionDialogUi", "P&ort:", nullptr)); - textLabel4_2->setText(QApplication::translate("QSqlConnectionDialogUi", "&Password:", nullptr)); - dbCheckBox->setText(QApplication::translate("QSqlConnectionDialogUi", "Us&e predefined in-memory database", nullptr)); - okButton->setText(QApplication::translate("QSqlConnectionDialogUi", "&OK", nullptr)); - cancelButton->setText(QApplication::translate("QSqlConnectionDialogUi", "&Cancel", nullptr)); + QSqlConnectionDialogUi->setWindowTitle(QCoreApplication::translate("QSqlConnectionDialogUi", "Connect...", nullptr)); + connGroupBox->setTitle(QCoreApplication::translate("QSqlConnectionDialogUi", "Connection settings", nullptr)); + textLabel4->setText(QCoreApplication::translate("QSqlConnectionDialogUi", "&Username:", nullptr)); + textLabel2->setText(QCoreApplication::translate("QSqlConnectionDialogUi", "D&river", nullptr)); + portSpinBox->setSpecialValueText(QCoreApplication::translate("QSqlConnectionDialogUi", "Default", nullptr)); + textLabel3->setText(QCoreApplication::translate("QSqlConnectionDialogUi", "Database Name:", nullptr)); + textLabel5->setText(QCoreApplication::translate("QSqlConnectionDialogUi", "&Hostname:", nullptr)); + textLabel5_2->setText(QCoreApplication::translate("QSqlConnectionDialogUi", "P&ort:", nullptr)); + textLabel4_2->setText(QCoreApplication::translate("QSqlConnectionDialogUi", "&Password:", nullptr)); + dbCheckBox->setText(QCoreApplication::translate("QSqlConnectionDialogUi", "Us&e predefined in-memory database", nullptr)); + okButton->setText(QCoreApplication::translate("QSqlConnectionDialogUi", "&OK", nullptr)); + cancelButton->setText(QCoreApplication::translate("QSqlConnectionDialogUi", "&Cancel", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/qtgradientdialog.ui.h b/tests/auto/tools/uic/baseline/qtgradientdialog.ui.h index 805f70e60d..5c09962572 100644 --- a/tests/auto/tools/uic/baseline/qtgradientdialog.ui.h +++ b/tests/auto/tools/uic/baseline/qtgradientdialog.ui.h @@ -31,7 +31,7 @@ /******************************************************************************** ** Form generated from reading UI file 'qtgradientdialog.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -89,7 +89,7 @@ public: void retranslateUi(QDialog *QtGradientDialog) { - QtGradientDialog->setWindowTitle(QApplication::translate("QtGradientDialog", "Edit Gradient", nullptr)); + QtGradientDialog->setWindowTitle(QCoreApplication::translate("QtGradientDialog", "Edit Gradient", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/qtgradienteditor.ui.h b/tests/auto/tools/uic/baseline/qtgradienteditor.ui.h index 9db07f35ac..7ca14d6ef4 100644 --- a/tests/auto/tools/uic/baseline/qtgradienteditor.ui.h +++ b/tests/auto/tools/uic/baseline/qtgradienteditor.ui.h @@ -583,119 +583,119 @@ public: void retranslateUi(QWidget *QtGradientEditor) { - QtGradientEditor->setWindowTitle(QApplication::translate("QtGradientEditor", "Form", nullptr)); -#ifndef QT_NO_TOOLTIP - gradientWidget->setToolTip(QApplication::translate("QtGradientEditor", "Gradient Editor", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_WHATSTHIS - gradientWidget->setWhatsThis(QApplication::translate("QtGradientEditor", "This area shows a preview of the gradient being edited. It also allows you to edit parameters specific to the gradient's type such as start and final point, radius, etc. by drag & drop.", nullptr)); -#endif // QT_NO_WHATSTHIS - label1->setText(QApplication::translate("QtGradientEditor", "1", nullptr)); - label2->setText(QApplication::translate("QtGradientEditor", "2", nullptr)); - label3->setText(QApplication::translate("QtGradientEditor", "3", nullptr)); - label4->setText(QApplication::translate("QtGradientEditor", "4", nullptr)); - label5->setText(QApplication::translate("QtGradientEditor", "5", nullptr)); -#ifndef QT_NO_TOOLTIP - gradientStopsWidget->setToolTip(QApplication::translate("QtGradientEditor", "Gradient Stops Editor", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_WHATSTHIS - gradientStopsWidget->setWhatsThis(QApplication::translate("QtGradientEditor", "This area allows you to edit gradient stops. Double click on the existing stop handle to duplicate it. Double click outside of the existing stop handles to create a new stop. Drag & drop the handle to reposition it. Use right mouse button to popup context menu with extra actions.", nullptr)); -#endif // QT_NO_WHATSTHIS - zoomLabel->setText(QApplication::translate("QtGradientEditor", "Zoom", nullptr)); -#ifndef QT_NO_TOOLTIP - zoomAllButton->setToolTip(QApplication::translate("QtGradientEditor", "Reset Zoom", nullptr)); -#endif // QT_NO_TOOLTIP - zoomAllButton->setText(QApplication::translate("QtGradientEditor", "Reset Zoom", nullptr)); - positionLabel->setText(QApplication::translate("QtGradientEditor", "Position", nullptr)); -#ifndef QT_NO_TOOLTIP - hLabel->setToolTip(QApplication::translate("QtGradientEditor", "Hue", nullptr)); -#endif // QT_NO_TOOLTIP - hLabel->setText(QApplication::translate("QtGradientEditor", "H", nullptr)); -#ifndef QT_NO_TOOLTIP - hueColorLine->setToolTip(QApplication::translate("QtGradientEditor", "Hue", nullptr)); -#endif // QT_NO_TOOLTIP - hueLabel->setText(QApplication::translate("QtGradientEditor", "Hue", nullptr)); -#ifndef QT_NO_TOOLTIP - sLabel->setToolTip(QApplication::translate("QtGradientEditor", "Saturation", nullptr)); -#endif // QT_NO_TOOLTIP - sLabel->setText(QApplication::translate("QtGradientEditor", "S", nullptr)); -#ifndef QT_NO_TOOLTIP - saturationColorLine->setToolTip(QApplication::translate("QtGradientEditor", "Saturation", nullptr)); -#endif // QT_NO_TOOLTIP - saturationLabel->setText(QApplication::translate("QtGradientEditor", "Sat", nullptr)); -#ifndef QT_NO_TOOLTIP - vLabel->setToolTip(QApplication::translate("QtGradientEditor", "Value", nullptr)); -#endif // QT_NO_TOOLTIP - vLabel->setText(QApplication::translate("QtGradientEditor", "V", nullptr)); -#ifndef QT_NO_TOOLTIP - valueColorLine->setToolTip(QApplication::translate("QtGradientEditor", "Value", nullptr)); -#endif // QT_NO_TOOLTIP - valueLabel->setText(QApplication::translate("QtGradientEditor", "Val", nullptr)); -#ifndef QT_NO_TOOLTIP - aLabel->setToolTip(QApplication::translate("QtGradientEditor", "Alpha", nullptr)); -#endif // QT_NO_TOOLTIP - aLabel->setText(QApplication::translate("QtGradientEditor", "A", nullptr)); -#ifndef QT_NO_TOOLTIP - alphaColorLine->setToolTip(QApplication::translate("QtGradientEditor", "Alpha", nullptr)); -#endif // QT_NO_TOOLTIP - alphaLabel->setText(QApplication::translate("QtGradientEditor", "Alpha", nullptr)); -#ifndef QT_NO_TOOLTIP - typeComboBox->setToolTip(QApplication::translate("QtGradientEditor", "Type", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_TOOLTIP - spreadComboBox->setToolTip(QApplication::translate("QtGradientEditor", "Spread", nullptr)); -#endif // QT_NO_TOOLTIP - colorLabel->setText(QApplication::translate("QtGradientEditor", "Color", nullptr)); -#ifndef QT_NO_TOOLTIP - colorButton->setToolTip(QApplication::translate("QtGradientEditor", "Current stop's color", nullptr)); -#endif // QT_NO_TOOLTIP + QtGradientEditor->setWindowTitle(QCoreApplication::translate("QtGradientEditor", "Form", nullptr)); +#if QT_CONFIG(tooltip) + gradientWidget->setToolTip(QCoreApplication::translate("QtGradientEditor", "Gradient Editor", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(whatsthis) + gradientWidget->setWhatsThis(QCoreApplication::translate("QtGradientEditor", "This area shows a preview of the gradient being edited. It also allows you to edit parameters specific to the gradient's type such as start and final point, radius, etc. by drag & drop.", nullptr)); +#endif // QT_CONFIG(whatsthis) + label1->setText(QCoreApplication::translate("QtGradientEditor", "1", nullptr)); + label2->setText(QCoreApplication::translate("QtGradientEditor", "2", nullptr)); + label3->setText(QCoreApplication::translate("QtGradientEditor", "3", nullptr)); + label4->setText(QCoreApplication::translate("QtGradientEditor", "4", nullptr)); + label5->setText(QCoreApplication::translate("QtGradientEditor", "5", nullptr)); +#if QT_CONFIG(tooltip) + gradientStopsWidget->setToolTip(QCoreApplication::translate("QtGradientEditor", "Gradient Stops Editor", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(whatsthis) + gradientStopsWidget->setWhatsThis(QCoreApplication::translate("QtGradientEditor", "This area allows you to edit gradient stops. Double click on the existing stop handle to duplicate it. Double click outside of the existing stop handles to create a new stop. Drag & drop the handle to reposition it. Use right mouse button to popup context menu with extra actions.", nullptr)); +#endif // QT_CONFIG(whatsthis) + zoomLabel->setText(QCoreApplication::translate("QtGradientEditor", "Zoom", nullptr)); +#if QT_CONFIG(tooltip) + zoomAllButton->setToolTip(QCoreApplication::translate("QtGradientEditor", "Reset Zoom", nullptr)); +#endif // QT_CONFIG(tooltip) + zoomAllButton->setText(QCoreApplication::translate("QtGradientEditor", "Reset Zoom", nullptr)); + positionLabel->setText(QCoreApplication::translate("QtGradientEditor", "Position", nullptr)); +#if QT_CONFIG(tooltip) + hLabel->setToolTip(QCoreApplication::translate("QtGradientEditor", "Hue", nullptr)); +#endif // QT_CONFIG(tooltip) + hLabel->setText(QCoreApplication::translate("QtGradientEditor", "H", nullptr)); +#if QT_CONFIG(tooltip) + hueColorLine->setToolTip(QCoreApplication::translate("QtGradientEditor", "Hue", nullptr)); +#endif // QT_CONFIG(tooltip) + hueLabel->setText(QCoreApplication::translate("QtGradientEditor", "Hue", nullptr)); +#if QT_CONFIG(tooltip) + sLabel->setToolTip(QCoreApplication::translate("QtGradientEditor", "Saturation", nullptr)); +#endif // QT_CONFIG(tooltip) + sLabel->setText(QCoreApplication::translate("QtGradientEditor", "S", nullptr)); +#if QT_CONFIG(tooltip) + saturationColorLine->setToolTip(QCoreApplication::translate("QtGradientEditor", "Saturation", nullptr)); +#endif // QT_CONFIG(tooltip) + saturationLabel->setText(QCoreApplication::translate("QtGradientEditor", "Sat", nullptr)); +#if QT_CONFIG(tooltip) + vLabel->setToolTip(QCoreApplication::translate("QtGradientEditor", "Value", nullptr)); +#endif // QT_CONFIG(tooltip) + vLabel->setText(QCoreApplication::translate("QtGradientEditor", "V", nullptr)); +#if QT_CONFIG(tooltip) + valueColorLine->setToolTip(QCoreApplication::translate("QtGradientEditor", "Value", nullptr)); +#endif // QT_CONFIG(tooltip) + valueLabel->setText(QCoreApplication::translate("QtGradientEditor", "Val", nullptr)); +#if QT_CONFIG(tooltip) + aLabel->setToolTip(QCoreApplication::translate("QtGradientEditor", "Alpha", nullptr)); +#endif // QT_CONFIG(tooltip) + aLabel->setText(QCoreApplication::translate("QtGradientEditor", "A", nullptr)); +#if QT_CONFIG(tooltip) + alphaColorLine->setToolTip(QCoreApplication::translate("QtGradientEditor", "Alpha", nullptr)); +#endif // QT_CONFIG(tooltip) + alphaLabel->setText(QCoreApplication::translate("QtGradientEditor", "Alpha", nullptr)); +#if QT_CONFIG(tooltip) + typeComboBox->setToolTip(QCoreApplication::translate("QtGradientEditor", "Type", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(tooltip) + spreadComboBox->setToolTip(QCoreApplication::translate("QtGradientEditor", "Spread", nullptr)); +#endif // QT_CONFIG(tooltip) + colorLabel->setText(QCoreApplication::translate("QtGradientEditor", "Color", nullptr)); +#if QT_CONFIG(tooltip) + colorButton->setToolTip(QCoreApplication::translate("QtGradientEditor", "Current stop's color", nullptr)); +#endif // QT_CONFIG(tooltip) colorButton->setText(QString()); -#ifndef QT_NO_TOOLTIP - hsvRadioButton->setToolTip(QApplication::translate("QtGradientEditor", "Show HSV specification", nullptr)); -#endif // QT_NO_TOOLTIP - hsvRadioButton->setText(QApplication::translate("QtGradientEditor", "HSV", nullptr)); -#ifndef QT_NO_TOOLTIP - rgbRadioButton->setToolTip(QApplication::translate("QtGradientEditor", "Show RGB specification", nullptr)); -#endif // QT_NO_TOOLTIP - rgbRadioButton->setText(QApplication::translate("QtGradientEditor", "RGB", nullptr)); -#ifndef QT_NO_TOOLTIP - positionSpinBox->setToolTip(QApplication::translate("QtGradientEditor", "Current stop's position", nullptr)); -#endif // QT_NO_TOOLTIP - zoomSpinBox->setSuffix(QApplication::translate("QtGradientEditor", "%", nullptr)); -#ifndef QT_NO_TOOLTIP - zoomInButton->setToolTip(QApplication::translate("QtGradientEditor", "Zoom In", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_TOOLTIP - zoomOutButton->setToolTip(QApplication::translate("QtGradientEditor", "Zoom Out", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_TOOLTIP - detailsButton->setToolTip(QApplication::translate("QtGradientEditor", "Toggle details extension", nullptr)); -#endif // QT_NO_TOOLTIP - detailsButton->setText(QApplication::translate("QtGradientEditor", ">", nullptr)); -#ifndef QT_NO_TOOLTIP - linearButton->setToolTip(QApplication::translate("QtGradientEditor", "Linear Type", nullptr)); -#endif // QT_NO_TOOLTIP - linearButton->setText(QApplication::translate("QtGradientEditor", "...", nullptr)); -#ifndef QT_NO_TOOLTIP - radialButton->setToolTip(QApplication::translate("QtGradientEditor", "Radial Type", nullptr)); -#endif // QT_NO_TOOLTIP - radialButton->setText(QApplication::translate("QtGradientEditor", "...", nullptr)); -#ifndef QT_NO_TOOLTIP - conicalButton->setToolTip(QApplication::translate("QtGradientEditor", "Conical Type", nullptr)); -#endif // QT_NO_TOOLTIP - conicalButton->setText(QApplication::translate("QtGradientEditor", "...", nullptr)); -#ifndef QT_NO_TOOLTIP - padButton->setToolTip(QApplication::translate("QtGradientEditor", "Pad Spread", nullptr)); -#endif // QT_NO_TOOLTIP - padButton->setText(QApplication::translate("QtGradientEditor", "...", nullptr)); -#ifndef QT_NO_TOOLTIP - repeatButton->setToolTip(QApplication::translate("QtGradientEditor", "Repeat Spread", nullptr)); -#endif // QT_NO_TOOLTIP - repeatButton->setText(QApplication::translate("QtGradientEditor", "...", nullptr)); -#ifndef QT_NO_TOOLTIP - reflectButton->setToolTip(QApplication::translate("QtGradientEditor", "Reflect Spread", nullptr)); -#endif // QT_NO_TOOLTIP - reflectButton->setText(QApplication::translate("QtGradientEditor", "...", nullptr)); +#if QT_CONFIG(tooltip) + hsvRadioButton->setToolTip(QCoreApplication::translate("QtGradientEditor", "Show HSV specification", nullptr)); +#endif // QT_CONFIG(tooltip) + hsvRadioButton->setText(QCoreApplication::translate("QtGradientEditor", "HSV", nullptr)); +#if QT_CONFIG(tooltip) + rgbRadioButton->setToolTip(QCoreApplication::translate("QtGradientEditor", "Show RGB specification", nullptr)); +#endif // QT_CONFIG(tooltip) + rgbRadioButton->setText(QCoreApplication::translate("QtGradientEditor", "RGB", nullptr)); +#if QT_CONFIG(tooltip) + positionSpinBox->setToolTip(QCoreApplication::translate("QtGradientEditor", "Current stop's position", nullptr)); +#endif // QT_CONFIG(tooltip) + zoomSpinBox->setSuffix(QCoreApplication::translate("QtGradientEditor", "%", nullptr)); +#if QT_CONFIG(tooltip) + zoomInButton->setToolTip(QCoreApplication::translate("QtGradientEditor", "Zoom In", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(tooltip) + zoomOutButton->setToolTip(QCoreApplication::translate("QtGradientEditor", "Zoom Out", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(tooltip) + detailsButton->setToolTip(QCoreApplication::translate("QtGradientEditor", "Toggle details extension", nullptr)); +#endif // QT_CONFIG(tooltip) + detailsButton->setText(QCoreApplication::translate("QtGradientEditor", ">", nullptr)); +#if QT_CONFIG(tooltip) + linearButton->setToolTip(QCoreApplication::translate("QtGradientEditor", "Linear Type", nullptr)); +#endif // QT_CONFIG(tooltip) + linearButton->setText(QCoreApplication::translate("QtGradientEditor", "...", nullptr)); +#if QT_CONFIG(tooltip) + radialButton->setToolTip(QCoreApplication::translate("QtGradientEditor", "Radial Type", nullptr)); +#endif // QT_CONFIG(tooltip) + radialButton->setText(QCoreApplication::translate("QtGradientEditor", "...", nullptr)); +#if QT_CONFIG(tooltip) + conicalButton->setToolTip(QCoreApplication::translate("QtGradientEditor", "Conical Type", nullptr)); +#endif // QT_CONFIG(tooltip) + conicalButton->setText(QCoreApplication::translate("QtGradientEditor", "...", nullptr)); +#if QT_CONFIG(tooltip) + padButton->setToolTip(QCoreApplication::translate("QtGradientEditor", "Pad Spread", nullptr)); +#endif // QT_CONFIG(tooltip) + padButton->setText(QCoreApplication::translate("QtGradientEditor", "...", nullptr)); +#if QT_CONFIG(tooltip) + repeatButton->setToolTip(QCoreApplication::translate("QtGradientEditor", "Repeat Spread", nullptr)); +#endif // QT_CONFIG(tooltip) + repeatButton->setText(QCoreApplication::translate("QtGradientEditor", "...", nullptr)); +#if QT_CONFIG(tooltip) + reflectButton->setToolTip(QCoreApplication::translate("QtGradientEditor", "Reflect Spread", nullptr)); +#endif // QT_CONFIG(tooltip) + reflectButton->setText(QCoreApplication::translate("QtGradientEditor", "...", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/qtgradientview.ui.h b/tests/auto/tools/uic/baseline/qtgradientview.ui.h index aa3c03b02f..494324b00f 100644 --- a/tests/auto/tools/uic/baseline/qtgradientview.ui.h +++ b/tests/auto/tools/uic/baseline/qtgradientview.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'qtgradientview.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -105,11 +105,11 @@ public: void retranslateUi(QWidget *QtGradientView) { - QtGradientView->setWindowTitle(QApplication::translate("QtGradientView", "Gradient View", nullptr)); - newButton->setText(QApplication::translate("QtGradientView", "New...", nullptr)); - editButton->setText(QApplication::translate("QtGradientView", "Edit...", nullptr)); - renameButton->setText(QApplication::translate("QtGradientView", "Rename", nullptr)); - removeButton->setText(QApplication::translate("QtGradientView", "Remove", nullptr)); + QtGradientView->setWindowTitle(QCoreApplication::translate("QtGradientView", "Gradient View", nullptr)); + newButton->setText(QCoreApplication::translate("QtGradientView", "New...", nullptr)); + editButton->setText(QCoreApplication::translate("QtGradientView", "Edit...", nullptr)); + renameButton->setText(QCoreApplication::translate("QtGradientView", "Rename", nullptr)); + removeButton->setText(QCoreApplication::translate("QtGradientView", "Remove", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/qtgradientviewdialog.ui.h b/tests/auto/tools/uic/baseline/qtgradientviewdialog.ui.h index e6d98ed4f0..f6369c8c5f 100644 --- a/tests/auto/tools/uic/baseline/qtgradientviewdialog.ui.h +++ b/tests/auto/tools/uic/baseline/qtgradientviewdialog.ui.h @@ -31,7 +31,7 @@ /******************************************************************************** ** Form generated from reading UI file 'qtgradientviewdialog.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -89,7 +89,7 @@ public: void retranslateUi(QDialog *QtGradientViewDialog) { - QtGradientViewDialog->setWindowTitle(QApplication::translate("QtGradientViewDialog", "Select Gradient", nullptr)); + QtGradientViewDialog->setWindowTitle(QCoreApplication::translate("QtGradientViewDialog", "Select Gradient", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/qtresourceeditordialog.ui.h b/tests/auto/tools/uic/baseline/qtresourceeditordialog.ui.h index 6a8c9c7172..7428778a9c 100644 --- a/tests/auto/tools/uic/baseline/qtresourceeditordialog.ui.h +++ b/tests/auto/tools/uic/baseline/qtresourceeditordialog.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'qtresourceeditordialog.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -141,25 +141,25 @@ public: void retranslateUi(QDialog *QtResourceEditorDialog) { - QtResourceEditorDialog->setWindowTitle(QApplication::translate("QtResourceEditorDialog", "Dialog", nullptr)); -#ifndef QT_NO_TOOLTIP - newQrcButton->setToolTip(QApplication::translate("QtResourceEditorDialog", "New File", nullptr)); -#endif // QT_NO_TOOLTIP - newQrcButton->setText(QApplication::translate("QtResourceEditorDialog", "N", nullptr)); -#ifndef QT_NO_TOOLTIP - removeQrcButton->setToolTip(QApplication::translate("QtResourceEditorDialog", "Remove File", nullptr)); -#endif // QT_NO_TOOLTIP - removeQrcButton->setText(QApplication::translate("QtResourceEditorDialog", "R", nullptr)); - importQrcButton->setText(QApplication::translate("QtResourceEditorDialog", "I", nullptr)); -#ifndef QT_NO_TOOLTIP - newResourceButton->setToolTip(QApplication::translate("QtResourceEditorDialog", "New Resource", nullptr)); -#endif // QT_NO_TOOLTIP - newResourceButton->setText(QApplication::translate("QtResourceEditorDialog", "N", nullptr)); - addResourceButton->setText(QApplication::translate("QtResourceEditorDialog", "A", nullptr)); -#ifndef QT_NO_TOOLTIP - removeResourceButton->setToolTip(QApplication::translate("QtResourceEditorDialog", "Remove Resource or File", nullptr)); -#endif // QT_NO_TOOLTIP - removeResourceButton->setText(QApplication::translate("QtResourceEditorDialog", "R", nullptr)); + QtResourceEditorDialog->setWindowTitle(QCoreApplication::translate("QtResourceEditorDialog", "Dialog", nullptr)); +#if QT_CONFIG(tooltip) + newQrcButton->setToolTip(QCoreApplication::translate("QtResourceEditorDialog", "New File", nullptr)); +#endif // QT_CONFIG(tooltip) + newQrcButton->setText(QCoreApplication::translate("QtResourceEditorDialog", "N", nullptr)); +#if QT_CONFIG(tooltip) + removeQrcButton->setToolTip(QCoreApplication::translate("QtResourceEditorDialog", "Remove File", nullptr)); +#endif // QT_CONFIG(tooltip) + removeQrcButton->setText(QCoreApplication::translate("QtResourceEditorDialog", "R", nullptr)); + importQrcButton->setText(QCoreApplication::translate("QtResourceEditorDialog", "I", nullptr)); +#if QT_CONFIG(tooltip) + newResourceButton->setToolTip(QCoreApplication::translate("QtResourceEditorDialog", "New Resource", nullptr)); +#endif // QT_CONFIG(tooltip) + newResourceButton->setText(QCoreApplication::translate("QtResourceEditorDialog", "N", nullptr)); + addResourceButton->setText(QCoreApplication::translate("QtResourceEditorDialog", "A", nullptr)); +#if QT_CONFIG(tooltip) + removeResourceButton->setToolTip(QCoreApplication::translate("QtResourceEditorDialog", "Remove Resource or File", nullptr)); +#endif // QT_CONFIG(tooltip) + removeResourceButton->setText(QCoreApplication::translate("QtResourceEditorDialog", "R", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/qttoolbardialog.ui.h b/tests/auto/tools/uic/baseline/qttoolbardialog.ui.h index e893386d9b..bfaeb99af2 100644 --- a/tests/auto/tools/uic/baseline/qttoolbardialog.ui.h +++ b/tests/auto/tools/uic/baseline/qttoolbardialog.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'qttoolbardialog.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -178,40 +178,40 @@ public: void retranslateUi(QDialog *QtToolBarDialog) { - QtToolBarDialog->setWindowTitle(QApplication::translate("QtToolBarDialog", "Customize Toolbars", nullptr)); + QtToolBarDialog->setWindowTitle(QCoreApplication::translate("QtToolBarDialog", "Customize Toolbars", nullptr)); QTreeWidgetItem *___qtreewidgetitem = actionTree->headerItem(); - ___qtreewidgetitem->setText(0, QApplication::translate("QtToolBarDialog", "1", nullptr)); - label->setText(QApplication::translate("QtToolBarDialog", "Actions", nullptr)); - label_2->setText(QApplication::translate("QtToolBarDialog", "Toolbars", nullptr)); -#ifndef QT_NO_TOOLTIP - newButton->setToolTip(QApplication::translate("QtToolBarDialog", "Add new toolbar", nullptr)); -#endif // QT_NO_TOOLTIP - newButton->setText(QApplication::translate("QtToolBarDialog", "New", nullptr)); -#ifndef QT_NO_TOOLTIP - removeButton->setToolTip(QApplication::translate("QtToolBarDialog", "Remove selected toolbar", nullptr)); -#endif // QT_NO_TOOLTIP - removeButton->setText(QApplication::translate("QtToolBarDialog", "Remove", nullptr)); -#ifndef QT_NO_TOOLTIP - renameButton->setToolTip(QApplication::translate("QtToolBarDialog", "Rename toolbar", nullptr)); -#endif // QT_NO_TOOLTIP - renameButton->setText(QApplication::translate("QtToolBarDialog", "Rename", nullptr)); -#ifndef QT_NO_TOOLTIP - upButton->setToolTip(QApplication::translate("QtToolBarDialog", "Move action up", nullptr)); -#endif // QT_NO_TOOLTIP - upButton->setText(QApplication::translate("QtToolBarDialog", "Up", nullptr)); -#ifndef QT_NO_TOOLTIP - leftButton->setToolTip(QApplication::translate("QtToolBarDialog", "Remove action from toolbar", nullptr)); -#endif // QT_NO_TOOLTIP - leftButton->setText(QApplication::translate("QtToolBarDialog", "<-", nullptr)); -#ifndef QT_NO_TOOLTIP - rightButton->setToolTip(QApplication::translate("QtToolBarDialog", "Add action to toolbar", nullptr)); -#endif // QT_NO_TOOLTIP - rightButton->setText(QApplication::translate("QtToolBarDialog", "->", nullptr)); -#ifndef QT_NO_TOOLTIP - downButton->setToolTip(QApplication::translate("QtToolBarDialog", "Move action down", nullptr)); -#endif // QT_NO_TOOLTIP - downButton->setText(QApplication::translate("QtToolBarDialog", "Down", nullptr)); - label_3->setText(QApplication::translate("QtToolBarDialog", "Current Toolbar Actions", nullptr)); + ___qtreewidgetitem->setText(0, QCoreApplication::translate("QtToolBarDialog", "1", nullptr)); + label->setText(QCoreApplication::translate("QtToolBarDialog", "Actions", nullptr)); + label_2->setText(QCoreApplication::translate("QtToolBarDialog", "Toolbars", nullptr)); +#if QT_CONFIG(tooltip) + newButton->setToolTip(QCoreApplication::translate("QtToolBarDialog", "Add new toolbar", nullptr)); +#endif // QT_CONFIG(tooltip) + newButton->setText(QCoreApplication::translate("QtToolBarDialog", "New", nullptr)); +#if QT_CONFIG(tooltip) + removeButton->setToolTip(QCoreApplication::translate("QtToolBarDialog", "Remove selected toolbar", nullptr)); +#endif // QT_CONFIG(tooltip) + removeButton->setText(QCoreApplication::translate("QtToolBarDialog", "Remove", nullptr)); +#if QT_CONFIG(tooltip) + renameButton->setToolTip(QCoreApplication::translate("QtToolBarDialog", "Rename toolbar", nullptr)); +#endif // QT_CONFIG(tooltip) + renameButton->setText(QCoreApplication::translate("QtToolBarDialog", "Rename", nullptr)); +#if QT_CONFIG(tooltip) + upButton->setToolTip(QCoreApplication::translate("QtToolBarDialog", "Move action up", nullptr)); +#endif // QT_CONFIG(tooltip) + upButton->setText(QCoreApplication::translate("QtToolBarDialog", "Up", nullptr)); +#if QT_CONFIG(tooltip) + leftButton->setToolTip(QCoreApplication::translate("QtToolBarDialog", "Remove action from toolbar", nullptr)); +#endif // QT_CONFIG(tooltip) + leftButton->setText(QCoreApplication::translate("QtToolBarDialog", "<-", nullptr)); +#if QT_CONFIG(tooltip) + rightButton->setToolTip(QCoreApplication::translate("QtToolBarDialog", "Add action to toolbar", nullptr)); +#endif // QT_CONFIG(tooltip) + rightButton->setText(QCoreApplication::translate("QtToolBarDialog", "->", nullptr)); +#if QT_CONFIG(tooltip) + downButton->setToolTip(QCoreApplication::translate("QtToolBarDialog", "Move action down", nullptr)); +#endif // QT_CONFIG(tooltip) + downButton->setText(QCoreApplication::translate("QtToolBarDialog", "Down", nullptr)); + label_3->setText(QCoreApplication::translate("QtToolBarDialog", "Current Toolbar Actions", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/querywidget.ui.h b/tests/auto/tools/uic/baseline/querywidget.ui.h index 81516722d5..a92c60f4fe 100644 --- a/tests/auto/tools/uic/baseline/querywidget.ui.h +++ b/tests/auto/tools/uic/baseline/querywidget.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'querywidget.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -153,10 +153,10 @@ public: void retranslateUi(QMainWindow *QueryWidget) { - QueryWidget->setWindowTitle(QApplication::translate("QueryWidget", "Recipes XQuery Example", nullptr)); - inputGroupBox->setTitle(QApplication::translate("QueryWidget", "Input Document", nullptr)); - queryGroupBox->setTitle(QApplication::translate("QueryWidget", "Select your query:", nullptr)); - outputGroupBox->setTitle(QApplication::translate("QueryWidget", "Output Document", nullptr)); + QueryWidget->setWindowTitle(QCoreApplication::translate("QueryWidget", "Recipes XQuery Example", nullptr)); + inputGroupBox->setTitle(QCoreApplication::translate("QueryWidget", "Input Document", nullptr)); + queryGroupBox->setTitle(QCoreApplication::translate("QueryWidget", "Select your query:", nullptr)); + outputGroupBox->setTitle(QCoreApplication::translate("QueryWidget", "Output Document", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/remotecontrol.ui.h b/tests/auto/tools/uic/baseline/remotecontrol.ui.h index 5893ff42af..5b7c6c42c2 100644 --- a/tests/auto/tools/uic/baseline/remotecontrol.ui.h +++ b/tests/auto/tools/uic/baseline/remotecontrol.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'remotecontrol.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -222,22 +222,22 @@ public: void retranslateUi(QMainWindow *RemoteControlClass) { - RemoteControlClass->setWindowTitle(QApplication::translate("RemoteControlClass", "RemoteControl", nullptr)); - actionQuit->setText(QApplication::translate("RemoteControlClass", "Quit", nullptr)); - label->setText(QApplication::translate("RemoteControlClass", "Start URL:", nullptr)); - launchButton->setText(QApplication::translate("RemoteControlClass", "Launch Qt HelpViewer", nullptr)); - actionGroupBox->setTitle(QApplication::translate("RemoteControlClass", "Actions", nullptr)); - label_2->setText(QApplication::translate("RemoteControlClass", "Search in Index:", nullptr)); + RemoteControlClass->setWindowTitle(QCoreApplication::translate("RemoteControlClass", "RemoteControl", nullptr)); + actionQuit->setText(QCoreApplication::translate("RemoteControlClass", "Quit", nullptr)); + label->setText(QCoreApplication::translate("RemoteControlClass", "Start URL:", nullptr)); + launchButton->setText(QCoreApplication::translate("RemoteControlClass", "Launch Qt HelpViewer", nullptr)); + actionGroupBox->setTitle(QCoreApplication::translate("RemoteControlClass", "Actions", nullptr)); + label_2->setText(QCoreApplication::translate("RemoteControlClass", "Search in Index:", nullptr)); indexButton->setText(QString()); - label_4->setText(QApplication::translate("RemoteControlClass", "Identifier:", nullptr)); + label_4->setText(QCoreApplication::translate("RemoteControlClass", "Identifier:", nullptr)); identifierButton->setText(QString()); - label_3->setText(QApplication::translate("RemoteControlClass", "Show URL:", nullptr)); + label_3->setText(QCoreApplication::translate("RemoteControlClass", "Show URL:", nullptr)); urlButton->setText(QString()); - syncContentsButton->setText(QApplication::translate("RemoteControlClass", "Sync Contents", nullptr)); - contentsCheckBox->setText(QApplication::translate("RemoteControlClass", "Show Contents", nullptr)); - indexCheckBox->setText(QApplication::translate("RemoteControlClass", "Show Index", nullptr)); - bookmarksCheckBox->setText(QApplication::translate("RemoteControlClass", "Show Bookmarks", nullptr)); - menuFile->setTitle(QApplication::translate("RemoteControlClass", "File", nullptr)); + syncContentsButton->setText(QCoreApplication::translate("RemoteControlClass", "Sync Contents", nullptr)); + contentsCheckBox->setText(QCoreApplication::translate("RemoteControlClass", "Show Contents", nullptr)); + indexCheckBox->setText(QCoreApplication::translate("RemoteControlClass", "Show Index", nullptr)); + bookmarksCheckBox->setText(QCoreApplication::translate("RemoteControlClass", "Show Bookmarks", nullptr)); + menuFile->setTitle(QCoreApplication::translate("RemoteControlClass", "File", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/saveformastemplate.ui.h b/tests/auto/tools/uic/baseline/saveformastemplate.ui.h index 9ef6eedb4c..6829958463 100644 --- a/tests/auto/tools/uic/baseline/saveformastemplate.ui.h +++ b/tests/auto/tools/uic/baseline/saveformastemplate.ui.h @@ -31,7 +31,7 @@ /******************************************************************************** ** Form generated from reading UI file 'saveformastemplate.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -117,10 +117,10 @@ public: vboxLayout->addWidget(buttonBox); -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) label->setBuddy(templateNameEdit); label_2->setBuddy(categoryCombo); -#endif // QT_NO_SHORTCUT +#endif // QT_CONFIG(shortcut) retranslateUi(SaveFormAsTemplate); QObject::connect(buttonBox, SIGNAL(accepted()), SaveFormAsTemplate, SLOT(accept())); @@ -131,10 +131,10 @@ public: void retranslateUi(QDialog *SaveFormAsTemplate) { - SaveFormAsTemplate->setWindowTitle(QApplication::translate("SaveFormAsTemplate", "Save Form As Template", nullptr)); - label->setText(QApplication::translate("SaveFormAsTemplate", "&Name:", nullptr)); + SaveFormAsTemplate->setWindowTitle(QCoreApplication::translate("SaveFormAsTemplate", "Save Form As Template", nullptr)); + label->setText(QCoreApplication::translate("SaveFormAsTemplate", "&Name:", nullptr)); templateNameEdit->setText(QString()); - label_2->setText(QApplication::translate("SaveFormAsTemplate", "&Category:", nullptr)); + label_2->setText(QCoreApplication::translate("SaveFormAsTemplate", "&Category:", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/settings.ui.h b/tests/auto/tools/uic/baseline/settings.ui.h index cc680c8033..6a1adb2d2c 100644 --- a/tests/auto/tools/uic/baseline/settings.ui.h +++ b/tests/auto/tools/uic/baseline/settings.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'settings.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -182,13 +182,13 @@ public: void retranslateUi(QDialog *Dialog) { - Dialog->setWindowTitle(QApplication::translate("Dialog", "Dialog", nullptr)); - label->setText(QApplication::translate("Dialog", "Audio device:", nullptr)); - label_6->setText(QApplication::translate("Dialog", "Audio effect:", nullptr)); - crossFadeLabel->setText(QApplication::translate("Dialog", "Cross fade:", nullptr)); - label_3->setText(QApplication::translate("Dialog", "-10 Sec", nullptr)); - label_5->setText(QApplication::translate("Dialog", "0", nullptr)); - label_4->setText(QApplication::translate("Dialog", "10 Sec", nullptr)); + Dialog->setWindowTitle(QCoreApplication::translate("Dialog", "Dialog", nullptr)); + label->setText(QCoreApplication::translate("Dialog", "Audio device:", nullptr)); + label_6->setText(QCoreApplication::translate("Dialog", "Audio effect:", nullptr)); + crossFadeLabel->setText(QCoreApplication::translate("Dialog", "Cross fade:", nullptr)); + label_3->setText(QCoreApplication::translate("Dialog", "-10 Sec", nullptr)); + label_5->setText(QCoreApplication::translate("Dialog", "0", nullptr)); + label_4->setText(QCoreApplication::translate("Dialog", "10 Sec", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/signalslotdialog.ui.h b/tests/auto/tools/uic/baseline/signalslotdialog.ui.h index 5833a25a8b..143e281a24 100644 --- a/tests/auto/tools/uic/baseline/signalslotdialog.ui.h +++ b/tests/auto/tools/uic/baseline/signalslotdialog.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'signalslotdialog.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -133,25 +133,25 @@ public: void retranslateUi(QDialog *SignalSlotDialogClass) { - SignalSlotDialogClass->setWindowTitle(QApplication::translate("SignalSlotDialogClass", "Signals and slots", nullptr)); - slotGroupBox->setTitle(QApplication::translate("SignalSlotDialogClass", "Slots", nullptr)); -#ifndef QT_NO_TOOLTIP - addSlotButton->setToolTip(QApplication::translate("SignalSlotDialogClass", "Add", nullptr)); -#endif // QT_NO_TOOLTIP - addSlotButton->setText(QApplication::translate("SignalSlotDialogClass", "...", nullptr)); -#ifndef QT_NO_TOOLTIP - removeSlotButton->setToolTip(QApplication::translate("SignalSlotDialogClass", "Delete", nullptr)); -#endif // QT_NO_TOOLTIP - removeSlotButton->setText(QApplication::translate("SignalSlotDialogClass", "...", nullptr)); - signalGroupBox->setTitle(QApplication::translate("SignalSlotDialogClass", "Signals", nullptr)); -#ifndef QT_NO_TOOLTIP - addSignalButton->setToolTip(QApplication::translate("SignalSlotDialogClass", "Add", nullptr)); -#endif // QT_NO_TOOLTIP - addSignalButton->setText(QApplication::translate("SignalSlotDialogClass", "...", nullptr)); -#ifndef QT_NO_TOOLTIP - removeSignalButton->setToolTip(QApplication::translate("SignalSlotDialogClass", "Delete", nullptr)); -#endif // QT_NO_TOOLTIP - removeSignalButton->setText(QApplication::translate("SignalSlotDialogClass", "...", nullptr)); + SignalSlotDialogClass->setWindowTitle(QCoreApplication::translate("SignalSlotDialogClass", "Signals and slots", nullptr)); + slotGroupBox->setTitle(QCoreApplication::translate("SignalSlotDialogClass", "Slots", nullptr)); +#if QT_CONFIG(tooltip) + addSlotButton->setToolTip(QCoreApplication::translate("SignalSlotDialogClass", "Add", nullptr)); +#endif // QT_CONFIG(tooltip) + addSlotButton->setText(QCoreApplication::translate("SignalSlotDialogClass", "...", nullptr)); +#if QT_CONFIG(tooltip) + removeSlotButton->setToolTip(QCoreApplication::translate("SignalSlotDialogClass", "Delete", nullptr)); +#endif // QT_CONFIG(tooltip) + removeSlotButton->setText(QCoreApplication::translate("SignalSlotDialogClass", "...", nullptr)); + signalGroupBox->setTitle(QCoreApplication::translate("SignalSlotDialogClass", "Signals", nullptr)); +#if QT_CONFIG(tooltip) + addSignalButton->setToolTip(QCoreApplication::translate("SignalSlotDialogClass", "Add", nullptr)); +#endif // QT_CONFIG(tooltip) + addSignalButton->setText(QCoreApplication::translate("SignalSlotDialogClass", "...", nullptr)); +#if QT_CONFIG(tooltip) + removeSignalButton->setToolTip(QCoreApplication::translate("SignalSlotDialogClass", "Delete", nullptr)); +#endif // QT_CONFIG(tooltip) + removeSignalButton->setText(QCoreApplication::translate("SignalSlotDialogClass", "...", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/sslclient.ui.h b/tests/auto/tools/uic/baseline/sslclient.ui.h index 382889648e..755ea7827b 100644 --- a/tests/auto/tools/uic/baseline/sslclient.ui.h +++ b/tests/auto/tools/uic/baseline/sslclient.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'sslclient.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -155,20 +155,20 @@ public: void retranslateUi(QWidget *Form) { - Form->setWindowTitle(QApplication::translate("Form", "Secure Socket Client", nullptr)); - hostNameLabel->setText(QApplication::translate("Form", "Host name:", nullptr)); - hostNameEdit->setText(QApplication::translate("Form", "imap.example.com", nullptr)); - portLabel->setText(QApplication::translate("Form", "Port:", nullptr)); - connectButton->setText(QApplication::translate("Form", "Connect to host", nullptr)); - sessionBox->setTitle(QApplication::translate("Form", "Active session", nullptr)); - cipherText->setText(QApplication::translate("Form", "Cryptographic Cipher:", nullptr)); - cipherLabel->setText(QApplication::translate("Form", "<none>", nullptr)); - sessionOutput->setHtml(QApplication::translate("Form", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" + Form->setWindowTitle(QCoreApplication::translate("Form", "Secure Socket Client", nullptr)); + hostNameLabel->setText(QCoreApplication::translate("Form", "Host name:", nullptr)); + hostNameEdit->setText(QCoreApplication::translate("Form", "imap.example.com", nullptr)); + portLabel->setText(QCoreApplication::translate("Form", "Port:", nullptr)); + connectButton->setText(QCoreApplication::translate("Form", "Connect to host", nullptr)); + sessionBox->setTitle(QCoreApplication::translate("Form", "Active session", nullptr)); + cipherText->setText(QCoreApplication::translate("Form", "Cryptographic Cipher:", nullptr)); + cipherLabel->setText(QCoreApplication::translate("Form", "<none>", nullptr)); + sessionOutput->setHtml(QCoreApplication::translate("Form", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;\">\n" "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p></body></html>", nullptr)); - sessionInputLabel->setText(QApplication::translate("Form", "Input:", nullptr)); - sendButton->setText(QApplication::translate("Form", "&Send", nullptr)); + sessionInputLabel->setText(QCoreApplication::translate("Form", "Input:", nullptr)); + sendButton->setText(QCoreApplication::translate("Form", "&Send", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/sslerrors.ui.h b/tests/auto/tools/uic/baseline/sslerrors.ui.h index 04f21ded43..ac40fe8244 100644 --- a/tests/auto/tools/uic/baseline/sslerrors.ui.h +++ b/tests/auto/tools/uic/baseline/sslerrors.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'sslerrors.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -86,14 +86,14 @@ public: void retranslateUi(QDialog *SslErrors) { - SslErrors->setWindowTitle(QApplication::translate("SslErrors", "Unable To Validate The Connection", nullptr)); - label->setText(QApplication::translate("SslErrors", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" + SslErrors->setWindowTitle(QCoreApplication::translate("SslErrors", "Unable To Validate The Connection", nullptr)); + label->setText(QCoreApplication::translate("SslErrors", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;\">\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600; color:#ff0000;\">Warning</span><span style=\" color:#ff0000;\">:</span><span style=\" color:#000000;\"> One or more errors with this connection prevent validating the authenticity of the host you are connecting to. Please review the following list of errors, and click </span><span style=\" color:#000000;\">Ignore</span><span style=\" color:#000000;\"> to continue, or </span><span style=\" color:#000000;\">Cancel</span><span style=\" color:#000000;\"> to abort the connection.</span></p></body></html>", nullptr)); - certificateChainButton->setText(QApplication::translate("SslErrors", "View Certificate Chain", nullptr)); - pushButton->setText(QApplication::translate("SslErrors", "Ignore", nullptr)); - pushButton_2->setText(QApplication::translate("SslErrors", "Cancel", nullptr)); + certificateChainButton->setText(QCoreApplication::translate("SslErrors", "View Certificate Chain", nullptr)); + pushButton->setText(QCoreApplication::translate("SslErrors", "Ignore", nullptr)); + pushButton_2->setText(QCoreApplication::translate("SslErrors", "Cancel", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/statistics.ui.h b/tests/auto/tools/uic/baseline/statistics.ui.h index 0b508836f2..6bbb6dbc32 100644 --- a/tests/auto/tools/uic/baseline/statistics.ui.h +++ b/tests/auto/tools/uic/baseline/statistics.ui.h @@ -31,7 +31,7 @@ /******************************************************************************** ** Form generated from reading UI file 'statistics.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -179,19 +179,19 @@ public: void retranslateUi(QDialog *Statistics) { - Statistics->setWindowTitle(QApplication::translate("Statistics", "Statistics", nullptr)); - closeBtn->setText(QApplication::translate("Statistics", "&Close", nullptr)); - textLabel4->setText(QApplication::translate("Statistics", "Translation", nullptr)); - textLabel5->setText(QApplication::translate("Statistics", "Source", nullptr)); - untrWords->setText(QApplication::translate("Statistics", "0", nullptr)); - trWords->setText(QApplication::translate("Statistics", "0", nullptr)); - textLabel1->setText(QApplication::translate("Statistics", "Words:", nullptr)); - trChars->setText(QApplication::translate("Statistics", "0", nullptr)); - untrChars->setText(QApplication::translate("Statistics", "0", nullptr)); - textLabel3->setText(QApplication::translate("Statistics", "Characters:", nullptr)); - textLabel6->setText(QApplication::translate("Statistics", "Characters (with spaces):", nullptr)); - trCharsSpc->setText(QApplication::translate("Statistics", "0", nullptr)); - untrCharsSpc->setText(QApplication::translate("Statistics", "0", nullptr)); + Statistics->setWindowTitle(QCoreApplication::translate("Statistics", "Statistics", nullptr)); + closeBtn->setText(QCoreApplication::translate("Statistics", "&Close", nullptr)); + textLabel4->setText(QCoreApplication::translate("Statistics", "Translation", nullptr)); + textLabel5->setText(QCoreApplication::translate("Statistics", "Source", nullptr)); + untrWords->setText(QCoreApplication::translate("Statistics", "0", nullptr)); + trWords->setText(QCoreApplication::translate("Statistics", "0", nullptr)); + textLabel1->setText(QCoreApplication::translate("Statistics", "Words:", nullptr)); + trChars->setText(QCoreApplication::translate("Statistics", "0", nullptr)); + untrChars->setText(QCoreApplication::translate("Statistics", "0", nullptr)); + textLabel3->setText(QCoreApplication::translate("Statistics", "Characters:", nullptr)); + textLabel6->setText(QCoreApplication::translate("Statistics", "Characters (with spaces):", nullptr)); + trCharsSpc->setText(QCoreApplication::translate("Statistics", "0", nullptr)); + untrCharsSpc->setText(QCoreApplication::translate("Statistics", "0", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/stringlisteditor.ui.h b/tests/auto/tools/uic/baseline/stringlisteditor.ui.h index fd78ce91c1..91e7198793 100644 --- a/tests/auto/tools/uic/baseline/stringlisteditor.ui.h +++ b/tests/auto/tools/uic/baseline/stringlisteditor.ui.h @@ -31,7 +31,7 @@ /******************************************************************************** ** Form generated from reading UI file 'stringlisteditor.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -201,9 +201,9 @@ public: vboxLayout->addWidget(buttonBox); -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) label->setBuddy(valueEdit); -#endif // QT_NO_SHORTCUT +#endif // QT_CONFIG(shortcut) retranslateUi(qdesigner_internal__Dialog); QObject::connect(buttonBox, SIGNAL(accepted()), qdesigner_internal__Dialog, SLOT(accept())); @@ -214,25 +214,25 @@ public: void retranslateUi(QDialog *qdesigner_internal__Dialog) { - qdesigner_internal__Dialog->setWindowTitle(QApplication::translate("qdesigner_internal::Dialog", "Dialog", nullptr)); - groupBox->setTitle(QApplication::translate("qdesigner_internal::Dialog", "StringList", nullptr)); -#ifndef QT_NO_TOOLTIP - newButton->setToolTip(QApplication::translate("qdesigner_internal::Dialog", "New String", nullptr)); -#endif // QT_NO_TOOLTIP - newButton->setText(QApplication::translate("qdesigner_internal::Dialog", "&New", nullptr)); -#ifndef QT_NO_TOOLTIP - deleteButton->setToolTip(QApplication::translate("qdesigner_internal::Dialog", "Delete String", nullptr)); -#endif // QT_NO_TOOLTIP - deleteButton->setText(QApplication::translate("qdesigner_internal::Dialog", "&Delete", nullptr)); - label->setText(QApplication::translate("qdesigner_internal::Dialog", "&Value:", nullptr)); -#ifndef QT_NO_TOOLTIP - upButton->setToolTip(QApplication::translate("qdesigner_internal::Dialog", "Move String Up", nullptr)); -#endif // QT_NO_TOOLTIP - upButton->setText(QApplication::translate("qdesigner_internal::Dialog", "Up", nullptr)); -#ifndef QT_NO_TOOLTIP - downButton->setToolTip(QApplication::translate("qdesigner_internal::Dialog", "Move String Down", nullptr)); -#endif // QT_NO_TOOLTIP - downButton->setText(QApplication::translate("qdesigner_internal::Dialog", "Down", nullptr)); + qdesigner_internal__Dialog->setWindowTitle(QCoreApplication::translate("qdesigner_internal::Dialog", "Dialog", nullptr)); + groupBox->setTitle(QCoreApplication::translate("qdesigner_internal::Dialog", "StringList", nullptr)); +#if QT_CONFIG(tooltip) + newButton->setToolTip(QCoreApplication::translate("qdesigner_internal::Dialog", "New String", nullptr)); +#endif // QT_CONFIG(tooltip) + newButton->setText(QCoreApplication::translate("qdesigner_internal::Dialog", "&New", nullptr)); +#if QT_CONFIG(tooltip) + deleteButton->setToolTip(QCoreApplication::translate("qdesigner_internal::Dialog", "Delete String", nullptr)); +#endif // QT_CONFIG(tooltip) + deleteButton->setText(QCoreApplication::translate("qdesigner_internal::Dialog", "&Delete", nullptr)); + label->setText(QCoreApplication::translate("qdesigner_internal::Dialog", "&Value:", nullptr)); +#if QT_CONFIG(tooltip) + upButton->setToolTip(QCoreApplication::translate("qdesigner_internal::Dialog", "Move String Up", nullptr)); +#endif // QT_CONFIG(tooltip) + upButton->setText(QCoreApplication::translate("qdesigner_internal::Dialog", "Up", nullptr)); +#if QT_CONFIG(tooltip) + downButton->setToolTip(QCoreApplication::translate("qdesigner_internal::Dialog", "Move String Down", nullptr)); +#endif // QT_CONFIG(tooltip) + downButton->setText(QCoreApplication::translate("qdesigner_internal::Dialog", "Down", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/stylesheeteditor.ui.h b/tests/auto/tools/uic/baseline/stylesheeteditor.ui.h index 5ae254ebab..ecca62c867 100644 --- a/tests/auto/tools/uic/baseline/stylesheeteditor.ui.h +++ b/tests/auto/tools/uic/baseline/stylesheeteditor.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'stylesheeteditor.ui' ** -** Created by: Qt User Interface Compiler version 5.10.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -73,7 +73,7 @@ public: styleCombo = new QComboBox(StyleSheetEditor); styleCombo->setObjectName(QString::fromUtf8("styleCombo")); - QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(5), static_cast<QSizePolicy::Policy>(0)); + QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(styleCombo->sizePolicy().hasHeightForWidth()); @@ -83,7 +83,7 @@ public: label_7 = new QLabel(StyleSheetEditor); label_7->setObjectName(QString::fromUtf8("label_7")); - QSizePolicy sizePolicy1(static_cast<QSizePolicy::Policy>(0), static_cast<QSizePolicy::Policy>(5)); + QSizePolicy sizePolicy1(QSizePolicy::Fixed, QSizePolicy::Preferred); sizePolicy1.setHorizontalStretch(0); sizePolicy1.setVerticalStretch(0); sizePolicy1.setHeightForWidth(label_7->sizePolicy().hasHeightForWidth()); @@ -130,14 +130,14 @@ public: void retranslateUi(QWidget *StyleSheetEditor) { - StyleSheetEditor->setWindowTitle(QApplication::translate("StyleSheetEditor", "Style Editor", nullptr)); - styleSheetCombo->setItemText(0, QApplication::translate("StyleSheetEditor", "Default", nullptr)); - styleSheetCombo->setItemText(1, QApplication::translate("StyleSheetEditor", "Coffee", nullptr)); - styleSheetCombo->setItemText(2, QApplication::translate("StyleSheetEditor", "Pagefold", nullptr)); - - label_7->setText(QApplication::translate("StyleSheetEditor", "Style:", nullptr)); - applyButton->setText(QApplication::translate("StyleSheetEditor", "&Apply", nullptr)); - label_8->setText(QApplication::translate("StyleSheetEditor", "Style Sheet:", nullptr)); + StyleSheetEditor->setWindowTitle(QCoreApplication::translate("StyleSheetEditor", "Style Editor", nullptr)); + styleSheetCombo->setItemText(0, QCoreApplication::translate("StyleSheetEditor", "Default", nullptr)); + styleSheetCombo->setItemText(1, QCoreApplication::translate("StyleSheetEditor", "Coffee", nullptr)); + styleSheetCombo->setItemText(2, QCoreApplication::translate("StyleSheetEditor", "Pagefold", nullptr)); + + label_7->setText(QCoreApplication::translate("StyleSheetEditor", "Style:", nullptr)); + applyButton->setText(QCoreApplication::translate("StyleSheetEditor", "&Apply", nullptr)); + label_8->setText(QCoreApplication::translate("StyleSheetEditor", "Style Sheet:", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/tabbedbrowser.ui.h b/tests/auto/tools/uic/baseline/tabbedbrowser.ui.h index 09b230f5df..4be294af37 100644 --- a/tests/auto/tools/uic/baseline/tabbedbrowser.ui.h +++ b/tests/auto/tools/uic/baseline/tabbedbrowser.ui.h @@ -31,7 +31,7 @@ /******************************************************************************** ** Form generated from reading UI file 'tabbedbrowser.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -117,7 +117,7 @@ public: editFind = new QLineEdit(frameFind); editFind->setObjectName(QString::fromUtf8("editFind")); - QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(0), static_cast<QSizePolicy::Policy>(0)); + QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(editFind->sizePolicy().hasHeightForWidth()); @@ -181,14 +181,14 @@ public: void retranslateUi(QWidget *TabbedBrowser) { - TabbedBrowser->setWindowTitle(QApplication::translate("TabbedBrowser", "TabbedBrowser", nullptr)); - tab->setTabText(tab->indexOf(frontpage), QApplication::translate("TabbedBrowser", "Untitled", nullptr)); + TabbedBrowser->setWindowTitle(QCoreApplication::translate("TabbedBrowser", "TabbedBrowser", nullptr)); + tab->setTabText(tab->indexOf(frontpage), QCoreApplication::translate("TabbedBrowser", "Untitled", nullptr)); toolClose->setText(QString()); - toolPrevious->setText(QApplication::translate("TabbedBrowser", "Previous", nullptr)); - toolNext->setText(QApplication::translate("TabbedBrowser", "Next", nullptr)); - checkCase->setText(QApplication::translate("TabbedBrowser", "Case Sensitive", nullptr)); - checkWholeWords->setText(QApplication::translate("TabbedBrowser", "Whole words", nullptr)); - labelWrapped->setText(QApplication::translate("TabbedBrowser", "<img src=\":/qt-project.org/assistant/images/wrap.png\"> Search wrapped", nullptr)); + toolPrevious->setText(QCoreApplication::translate("TabbedBrowser", "Previous", nullptr)); + toolNext->setText(QCoreApplication::translate("TabbedBrowser", "Next", nullptr)); + checkCase->setText(QCoreApplication::translate("TabbedBrowser", "Case Sensitive", nullptr)); + checkWholeWords->setText(QCoreApplication::translate("TabbedBrowser", "Whole words", nullptr)); + labelWrapped->setText(QCoreApplication::translate("TabbedBrowser", "<img src=\":/qt-project.org/assistant/images/wrap.png\"> Search wrapped", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/tablewidgeteditor.ui.h b/tests/auto/tools/uic/baseline/tablewidgeteditor.ui.h index e3ba00095e..4559bd910b 100644 --- a/tests/auto/tools/uic/baseline/tablewidgeteditor.ui.h +++ b/tests/auto/tools/uic/baseline/tablewidgeteditor.ui.h @@ -31,7 +31,7 @@ /******************************************************************************** ** Form generated from reading UI file 'tablewidgeteditor.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -311,54 +311,54 @@ public: void retranslateUi(QDialog *qdesigner_internal__TableWidgetEditor) { - qdesigner_internal__TableWidgetEditor->setWindowTitle(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Edit Table Widget", nullptr)); - itemsBox->setTitle(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Table Items", nullptr)); -#ifndef QT_NO_TOOLTIP - tableWidget->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Table Items", nullptr)); -#endif // QT_NO_TOOLTIP - label_3->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Icon", nullptr)); - columnsBox->setTitle(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Columns", nullptr)); -#ifndef QT_NO_TOOLTIP - columnsListWidget->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Table Columns", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_TOOLTIP - newColumnButton->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "New Column", nullptr)); -#endif // QT_NO_TOOLTIP - newColumnButton->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "New", nullptr)); -#ifndef QT_NO_TOOLTIP - deleteColumnButton->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Delete Column", nullptr)); -#endif // QT_NO_TOOLTIP - deleteColumnButton->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Delete", nullptr)); -#ifndef QT_NO_TOOLTIP - moveColumnUpButton->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Move Column Up", nullptr)); -#endif // QT_NO_TOOLTIP - moveColumnUpButton->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "U", nullptr)); -#ifndef QT_NO_TOOLTIP - moveColumnDownButton->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Move Column Down", nullptr)); -#endif // QT_NO_TOOLTIP - moveColumnDownButton->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "D", nullptr)); - label->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Icon", nullptr)); - rowsBox->setTitle(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Rows", nullptr)); -#ifndef QT_NO_TOOLTIP - rowsListWidget->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Table Rows", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_TOOLTIP - newRowButton->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "New Row", nullptr)); -#endif // QT_NO_TOOLTIP - newRowButton->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "New", nullptr)); -#ifndef QT_NO_TOOLTIP - deleteRowButton->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Delete Row", nullptr)); -#endif // QT_NO_TOOLTIP - deleteRowButton->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Delete", nullptr)); -#ifndef QT_NO_TOOLTIP - moveRowUpButton->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Move Row Up", nullptr)); -#endif // QT_NO_TOOLTIP - moveRowUpButton->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "U", nullptr)); -#ifndef QT_NO_TOOLTIP - moveRowDownButton->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Move Row Down", nullptr)); -#endif // QT_NO_TOOLTIP - moveRowDownButton->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "D", nullptr)); - label_2->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Icon", nullptr)); + qdesigner_internal__TableWidgetEditor->setWindowTitle(QCoreApplication::translate("qdesigner_internal::TableWidgetEditor", "Edit Table Widget", nullptr)); + itemsBox->setTitle(QCoreApplication::translate("qdesigner_internal::TableWidgetEditor", "Table Items", nullptr)); +#if QT_CONFIG(tooltip) + tableWidget->setToolTip(QCoreApplication::translate("qdesigner_internal::TableWidgetEditor", "Table Items", nullptr)); +#endif // QT_CONFIG(tooltip) + label_3->setText(QCoreApplication::translate("qdesigner_internal::TableWidgetEditor", "Icon", nullptr)); + columnsBox->setTitle(QCoreApplication::translate("qdesigner_internal::TableWidgetEditor", "Columns", nullptr)); +#if QT_CONFIG(tooltip) + columnsListWidget->setToolTip(QCoreApplication::translate("qdesigner_internal::TableWidgetEditor", "Table Columns", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(tooltip) + newColumnButton->setToolTip(QCoreApplication::translate("qdesigner_internal::TableWidgetEditor", "New Column", nullptr)); +#endif // QT_CONFIG(tooltip) + newColumnButton->setText(QCoreApplication::translate("qdesigner_internal::TableWidgetEditor", "New", nullptr)); +#if QT_CONFIG(tooltip) + deleteColumnButton->setToolTip(QCoreApplication::translate("qdesigner_internal::TableWidgetEditor", "Delete Column", nullptr)); +#endif // QT_CONFIG(tooltip) + deleteColumnButton->setText(QCoreApplication::translate("qdesigner_internal::TableWidgetEditor", "Delete", nullptr)); +#if QT_CONFIG(tooltip) + moveColumnUpButton->setToolTip(QCoreApplication::translate("qdesigner_internal::TableWidgetEditor", "Move Column Up", nullptr)); +#endif // QT_CONFIG(tooltip) + moveColumnUpButton->setText(QCoreApplication::translate("qdesigner_internal::TableWidgetEditor", "U", nullptr)); +#if QT_CONFIG(tooltip) + moveColumnDownButton->setToolTip(QCoreApplication::translate("qdesigner_internal::TableWidgetEditor", "Move Column Down", nullptr)); +#endif // QT_CONFIG(tooltip) + moveColumnDownButton->setText(QCoreApplication::translate("qdesigner_internal::TableWidgetEditor", "D", nullptr)); + label->setText(QCoreApplication::translate("qdesigner_internal::TableWidgetEditor", "Icon", nullptr)); + rowsBox->setTitle(QCoreApplication::translate("qdesigner_internal::TableWidgetEditor", "Rows", nullptr)); +#if QT_CONFIG(tooltip) + rowsListWidget->setToolTip(QCoreApplication::translate("qdesigner_internal::TableWidgetEditor", "Table Rows", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(tooltip) + newRowButton->setToolTip(QCoreApplication::translate("qdesigner_internal::TableWidgetEditor", "New Row", nullptr)); +#endif // QT_CONFIG(tooltip) + newRowButton->setText(QCoreApplication::translate("qdesigner_internal::TableWidgetEditor", "New", nullptr)); +#if QT_CONFIG(tooltip) + deleteRowButton->setToolTip(QCoreApplication::translate("qdesigner_internal::TableWidgetEditor", "Delete Row", nullptr)); +#endif // QT_CONFIG(tooltip) + deleteRowButton->setText(QCoreApplication::translate("qdesigner_internal::TableWidgetEditor", "Delete", nullptr)); +#if QT_CONFIG(tooltip) + moveRowUpButton->setToolTip(QCoreApplication::translate("qdesigner_internal::TableWidgetEditor", "Move Row Up", nullptr)); +#endif // QT_CONFIG(tooltip) + moveRowUpButton->setText(QCoreApplication::translate("qdesigner_internal::TableWidgetEditor", "U", nullptr)); +#if QT_CONFIG(tooltip) + moveRowDownButton->setToolTip(QCoreApplication::translate("qdesigner_internal::TableWidgetEditor", "Move Row Down", nullptr)); +#endif // QT_CONFIG(tooltip) + moveRowDownButton->setText(QCoreApplication::translate("qdesigner_internal::TableWidgetEditor", "D", nullptr)); + label_2->setText(QCoreApplication::translate("qdesigner_internal::TableWidgetEditor", "Icon", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/tetrixwindow.ui.h b/tests/auto/tools/uic/baseline/tetrixwindow.ui.h index dc1033ce3a..340acbd9f2 100644 --- a/tests/auto/tools/uic/baseline/tetrixwindow.ui.h +++ b/tests/auto/tools/uic/baseline/tetrixwindow.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'tetrixwindow.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -147,15 +147,15 @@ public: void retranslateUi(QWidget *TetrixWindow) { - TetrixWindow->setWindowTitle(QApplication::translate("TetrixWindow", "Tetrix", nullptr)); - startButton->setText(QApplication::translate("TetrixWindow", "&Start", nullptr)); - linesRemovedLabel->setText(QApplication::translate("TetrixWindow", "LINES REMOVED", nullptr)); - pauseButton->setText(QApplication::translate("TetrixWindow", "&Pause", nullptr)); - levelLabel->setText(QApplication::translate("TetrixWindow", "LEVEL", nullptr)); - nextLabel->setText(QApplication::translate("TetrixWindow", "NEXT", nullptr)); - scoreLabel->setText(QApplication::translate("TetrixWindow", "SCORE", nullptr)); + TetrixWindow->setWindowTitle(QCoreApplication::translate("TetrixWindow", "Tetrix", nullptr)); + startButton->setText(QCoreApplication::translate("TetrixWindow", "&Start", nullptr)); + linesRemovedLabel->setText(QCoreApplication::translate("TetrixWindow", "LINES REMOVED", nullptr)); + pauseButton->setText(QCoreApplication::translate("TetrixWindow", "&Pause", nullptr)); + levelLabel->setText(QCoreApplication::translate("TetrixWindow", "LEVEL", nullptr)); + nextLabel->setText(QCoreApplication::translate("TetrixWindow", "NEXT", nullptr)); + scoreLabel->setText(QCoreApplication::translate("TetrixWindow", "SCORE", nullptr)); nextPieceLabel->setText(QString()); - quitButton->setText(QApplication::translate("TetrixWindow", "&Quit", nullptr)); + quitButton->setText(QCoreApplication::translate("TetrixWindow", "&Quit", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/textfinder.ui.h b/tests/auto/tools/uic/baseline/textfinder.ui.h index 2f6bfebf98..38bdf756c2 100644 --- a/tests/auto/tools/uic/baseline/textfinder.ui.h +++ b/tests/auto/tools/uic/baseline/textfinder.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'textfinder.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -81,9 +81,9 @@ public: vboxLayout->addItem(spacerItem); -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) searchLabel->setBuddy(lineEdit); -#endif // QT_NO_SHORTCUT +#endif // QT_CONFIG(shortcut) retranslateUi(Form); QObject::connect(lineEdit, SIGNAL(returnPressed()), findButton, SLOT(animateClick())); @@ -93,9 +93,9 @@ public: void retranslateUi(QWidget *Form) { - Form->setWindowTitle(QApplication::translate("Form", "Find Text", nullptr)); - searchLabel->setText(QApplication::translate("Form", "&Keyword:", nullptr)); - findButton->setText(QApplication::translate("Form", "&Find", nullptr)); + Form->setWindowTitle(QCoreApplication::translate("Form", "Find Text", nullptr)); + searchLabel->setText(QCoreApplication::translate("Form", "&Keyword:", nullptr)); + findButton->setText(QCoreApplication::translate("Form", "&Find", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/topicchooser.ui.h b/tests/auto/tools/uic/baseline/topicchooser.ui.h index 90ec485e39..a89f62c4b5 100644 --- a/tests/auto/tools/uic/baseline/topicchooser.ui.h +++ b/tests/auto/tools/uic/baseline/topicchooser.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'topicchooser.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -86,9 +86,9 @@ public: vboxLayout->addWidget(Layout16); -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) label->setBuddy(listWidget); -#endif // QT_NO_SHORTCUT +#endif // QT_CONFIG(shortcut) retranslateUi(TopicChooser); @@ -100,10 +100,10 @@ public: void retranslateUi(QDialog *TopicChooser) { - TopicChooser->setWindowTitle(QApplication::translate("TopicChooser", "Choose Topic", nullptr)); - label->setText(QApplication::translate("TopicChooser", "&Topics", nullptr)); - buttonDisplay->setText(QApplication::translate("TopicChooser", "&Display", nullptr)); - buttonCancel->setText(QApplication::translate("TopicChooser", "&Close", nullptr)); + TopicChooser->setWindowTitle(QCoreApplication::translate("TopicChooser", "Choose Topic", nullptr)); + label->setText(QCoreApplication::translate("TopicChooser", "&Topics", nullptr)); + buttonDisplay->setText(QCoreApplication::translate("TopicChooser", "&Display", nullptr)); + buttonCancel->setText(QCoreApplication::translate("TopicChooser", "&Close", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/translatedialog.ui.h b/tests/auto/tools/uic/baseline/translatedialog.ui.h index 5bea11f9f2..10390c62df 100644 --- a/tests/auto/tools/uic/baseline/translatedialog.ui.h +++ b/tests/auto/tools/uic/baseline/translatedialog.ui.h @@ -31,7 +31,7 @@ /******************************************************************************** ** Form generated from reading UI file 'translatedialog.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -182,10 +182,10 @@ public: hboxLayout->addLayout(vboxLayout2); -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) findWhat->setBuddy(ledFindWhat); translateTo->setBuddy(ledTranslateTo); -#endif // QT_NO_SHORTCUT +#endif // QT_CONFIG(shortcut) QWidget::setTabOrder(ledFindWhat, ledTranslateTo); QWidget::setTabOrder(ledTranslateTo, findNxt); QWidget::setTabOrder(findNxt, translate); @@ -205,34 +205,34 @@ public: void retranslateUi(QDialog *TranslateDialog) { - TranslateDialog->setWindowTitle(QApplication::translate("TranslateDialog", "Qt Linguist", nullptr)); -#ifndef QT_NO_WHATSTHIS - TranslateDialog->setWhatsThis(QApplication::translate("TranslateDialog", "This window allows you to search for some text in the translation source file.", nullptr)); -#endif // QT_NO_WHATSTHIS -#ifndef QT_NO_WHATSTHIS - ledTranslateTo->setWhatsThis(QApplication::translate("TranslateDialog", "Type in the text to search for.", nullptr)); -#endif // QT_NO_WHATSTHIS - findWhat->setText(QApplication::translate("TranslateDialog", "Find &source text:", nullptr)); - translateTo->setText(QApplication::translate("TranslateDialog", "&Translate to:", nullptr)); -#ifndef QT_NO_WHATSTHIS - ledFindWhat->setWhatsThis(QApplication::translate("TranslateDialog", "Type in the text to search for.", nullptr)); -#endif // QT_NO_WHATSTHIS - groupBox->setTitle(QApplication::translate("TranslateDialog", "Search options", nullptr)); -#ifndef QT_NO_WHATSTHIS - ckMatchCase->setWhatsThis(QApplication::translate("TranslateDialog", "Texts such as 'TeX' and 'tex' are considered as different when checked.", nullptr)); -#endif // QT_NO_WHATSTHIS - ckMatchCase->setText(QApplication::translate("TranslateDialog", "Match &case", nullptr)); - ckMarkFinished->setText(QApplication::translate("TranslateDialog", "Mark new translation as &finished", nullptr)); -#ifndef QT_NO_WHATSTHIS - findNxt->setWhatsThis(QApplication::translate("TranslateDialog", "Click here to find the next occurrence of the text you typed in.", nullptr)); -#endif // QT_NO_WHATSTHIS - findNxt->setText(QApplication::translate("TranslateDialog", "Find Next", nullptr)); - translate->setText(QApplication::translate("TranslateDialog", "Translate", nullptr)); - translateAll->setText(QApplication::translate("TranslateDialog", "Translate All", nullptr)); -#ifndef QT_NO_WHATSTHIS - cancel->setWhatsThis(QApplication::translate("TranslateDialog", "Click here to close this window.", nullptr)); -#endif // QT_NO_WHATSTHIS - cancel->setText(QApplication::translate("TranslateDialog", "Cancel", nullptr)); + TranslateDialog->setWindowTitle(QCoreApplication::translate("TranslateDialog", "Qt Linguist", nullptr)); +#if QT_CONFIG(whatsthis) + TranslateDialog->setWhatsThis(QCoreApplication::translate("TranslateDialog", "This window allows you to search for some text in the translation source file.", nullptr)); +#endif // QT_CONFIG(whatsthis) +#if QT_CONFIG(whatsthis) + ledTranslateTo->setWhatsThis(QCoreApplication::translate("TranslateDialog", "Type in the text to search for.", nullptr)); +#endif // QT_CONFIG(whatsthis) + findWhat->setText(QCoreApplication::translate("TranslateDialog", "Find &source text:", nullptr)); + translateTo->setText(QCoreApplication::translate("TranslateDialog", "&Translate to:", nullptr)); +#if QT_CONFIG(whatsthis) + ledFindWhat->setWhatsThis(QCoreApplication::translate("TranslateDialog", "Type in the text to search for.", nullptr)); +#endif // QT_CONFIG(whatsthis) + groupBox->setTitle(QCoreApplication::translate("TranslateDialog", "Search options", nullptr)); +#if QT_CONFIG(whatsthis) + ckMatchCase->setWhatsThis(QCoreApplication::translate("TranslateDialog", "Texts such as 'TeX' and 'tex' are considered as different when checked.", nullptr)); +#endif // QT_CONFIG(whatsthis) + ckMatchCase->setText(QCoreApplication::translate("TranslateDialog", "Match &case", nullptr)); + ckMarkFinished->setText(QCoreApplication::translate("TranslateDialog", "Mark new translation as &finished", nullptr)); +#if QT_CONFIG(whatsthis) + findNxt->setWhatsThis(QCoreApplication::translate("TranslateDialog", "Click here to find the next occurrence of the text you typed in.", nullptr)); +#endif // QT_CONFIG(whatsthis) + findNxt->setText(QCoreApplication::translate("TranslateDialog", "Find Next", nullptr)); + translate->setText(QCoreApplication::translate("TranslateDialog", "Translate", nullptr)); + translateAll->setText(QCoreApplication::translate("TranslateDialog", "Translate All", nullptr)); +#if QT_CONFIG(whatsthis) + cancel->setWhatsThis(QCoreApplication::translate("TranslateDialog", "Click here to close this window.", nullptr)); +#endif // QT_CONFIG(whatsthis) + cancel->setText(QCoreApplication::translate("TranslateDialog", "Cancel", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/translationsettings.ui.h b/tests/auto/tools/uic/baseline/translationsettings.ui.h index 764e3a85b6..5e0f1520a0 100644 --- a/tests/auto/tools/uic/baseline/translationsettings.ui.h +++ b/tests/auto/tools/uic/baseline/translationsettings.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'translationsettings.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -86,9 +86,9 @@ public: vboxLayout->addWidget(buttonBox); -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) label->setBuddy(cbLanguageList); -#endif // QT_NO_SHORTCUT +#endif // QT_CONFIG(shortcut) retranslateUi(TranslationSettings); QObject::connect(buttonBox, SIGNAL(accepted()), TranslationSettings, SLOT(accept())); @@ -99,10 +99,10 @@ public: void retranslateUi(QDialog *TranslationSettings) { - TranslationSettings->setWindowTitle(QApplication::translate("TranslationSettings", "Qt Linguist - Translation file settings", nullptr)); - groupBox->setTitle(QApplication::translate("TranslationSettings", "Target language", nullptr)); - label->setText(QApplication::translate("TranslationSettings", "Language", nullptr)); - lblCountry->setText(QApplication::translate("TranslationSettings", "Country/Region", nullptr)); + TranslationSettings->setWindowTitle(QCoreApplication::translate("TranslationSettings", "Qt Linguist - Translation file settings", nullptr)); + groupBox->setTitle(QCoreApplication::translate("TranslationSettings", "Target language", nullptr)); + label->setText(QCoreApplication::translate("TranslationSettings", "Language", nullptr)); + lblCountry->setText(QCoreApplication::translate("TranslationSettings", "Country/Region", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/treewidgeteditor.ui.h b/tests/auto/tools/uic/baseline/treewidgeteditor.ui.h index d432195648..395d66a999 100644 --- a/tests/auto/tools/uic/baseline/treewidgeteditor.ui.h +++ b/tests/auto/tools/uic/baseline/treewidgeteditor.ui.h @@ -31,7 +31,7 @@ /******************************************************************************** ** Form generated from reading UI file 'treewidgeteditor.ui' ** -** Created by: Qt User Interface Compiler version 5.0.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -276,63 +276,63 @@ public: void retranslateUi(QDialog *qdesigner_internal__TreeWidgetEditor) { - qdesigner_internal__TreeWidgetEditor->setWindowTitle(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Edit Tree Widget", nullptr)); - itemsBox->setTitle(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Tree Items", nullptr)); + qdesigner_internal__TreeWidgetEditor->setWindowTitle(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "Edit Tree Widget", nullptr)); + itemsBox->setTitle(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "Tree Items", nullptr)); QTreeWidgetItem *___qtreewidgetitem = treeWidget->headerItem(); - ___qtreewidgetitem->setText(0, QApplication::translate("qdesigner_internal::TreeWidgetEditor", "1", nullptr)); -#ifndef QT_NO_TOOLTIP - treeWidget->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Tree Items", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_TOOLTIP - newItemButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "New Item", nullptr)); -#endif // QT_NO_TOOLTIP - newItemButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "&New", nullptr)); -#ifndef QT_NO_TOOLTIP - newSubItemButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "New Subitem", nullptr)); -#endif // QT_NO_TOOLTIP - newSubItemButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "New &Subitem", nullptr)); -#ifndef QT_NO_TOOLTIP - deleteItemButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Delete Item", nullptr)); -#endif // QT_NO_TOOLTIP - deleteItemButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "&Delete", nullptr)); -#ifndef QT_NO_TOOLTIP - moveItemLeftButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Move Item Left (before Parent Item)", nullptr)); -#endif // QT_NO_TOOLTIP - moveItemLeftButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "L", nullptr)); -#ifndef QT_NO_TOOLTIP - moveItemRightButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Move Item Right (as a First Subitem of the Next Sibling Item)", nullptr)); -#endif // QT_NO_TOOLTIP - moveItemRightButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "R", nullptr)); -#ifndef QT_NO_TOOLTIP - moveItemUpButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Move Item Up", nullptr)); -#endif // QT_NO_TOOLTIP - moveItemUpButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "U", nullptr)); -#ifndef QT_NO_TOOLTIP - moveItemDownButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Move Item Down", nullptr)); -#endif // QT_NO_TOOLTIP - moveItemDownButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "D", nullptr)); - label_2->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Icon", nullptr)); - columnsBox->setTitle(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Columns", nullptr)); -#ifndef QT_NO_TOOLTIP - listWidget->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Tree Columns", nullptr)); -#endif // QT_NO_TOOLTIP -#ifndef QT_NO_TOOLTIP - newColumnButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "New Column", nullptr)); -#endif // QT_NO_TOOLTIP - newColumnButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "New", nullptr)); -#ifndef QT_NO_TOOLTIP - deleteColumnButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Delete Column", nullptr)); -#endif // QT_NO_TOOLTIP - deleteColumnButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Delete", nullptr)); -#ifndef QT_NO_TOOLTIP - moveColumnUpButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Move Column Up", nullptr)); -#endif // QT_NO_TOOLTIP - moveColumnUpButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "U", nullptr)); -#ifndef QT_NO_TOOLTIP - moveColumnDownButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Move Column Down", nullptr)); -#endif // QT_NO_TOOLTIP - moveColumnDownButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "D", nullptr)); - label->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Icon", nullptr)); + ___qtreewidgetitem->setText(0, QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "1", nullptr)); +#if QT_CONFIG(tooltip) + treeWidget->setToolTip(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "Tree Items", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(tooltip) + newItemButton->setToolTip(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "New Item", nullptr)); +#endif // QT_CONFIG(tooltip) + newItemButton->setText(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "&New", nullptr)); +#if QT_CONFIG(tooltip) + newSubItemButton->setToolTip(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "New Subitem", nullptr)); +#endif // QT_CONFIG(tooltip) + newSubItemButton->setText(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "New &Subitem", nullptr)); +#if QT_CONFIG(tooltip) + deleteItemButton->setToolTip(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "Delete Item", nullptr)); +#endif // QT_CONFIG(tooltip) + deleteItemButton->setText(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "&Delete", nullptr)); +#if QT_CONFIG(tooltip) + moveItemLeftButton->setToolTip(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "Move Item Left (before Parent Item)", nullptr)); +#endif // QT_CONFIG(tooltip) + moveItemLeftButton->setText(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "L", nullptr)); +#if QT_CONFIG(tooltip) + moveItemRightButton->setToolTip(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "Move Item Right (as a First Subitem of the Next Sibling Item)", nullptr)); +#endif // QT_CONFIG(tooltip) + moveItemRightButton->setText(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "R", nullptr)); +#if QT_CONFIG(tooltip) + moveItemUpButton->setToolTip(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "Move Item Up", nullptr)); +#endif // QT_CONFIG(tooltip) + moveItemUpButton->setText(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "U", nullptr)); +#if QT_CONFIG(tooltip) + moveItemDownButton->setToolTip(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "Move Item Down", nullptr)); +#endif // QT_CONFIG(tooltip) + moveItemDownButton->setText(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "D", nullptr)); + label_2->setText(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "Icon", nullptr)); + columnsBox->setTitle(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "Columns", nullptr)); +#if QT_CONFIG(tooltip) + listWidget->setToolTip(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "Tree Columns", nullptr)); +#endif // QT_CONFIG(tooltip) +#if QT_CONFIG(tooltip) + newColumnButton->setToolTip(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "New Column", nullptr)); +#endif // QT_CONFIG(tooltip) + newColumnButton->setText(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "New", nullptr)); +#if QT_CONFIG(tooltip) + deleteColumnButton->setToolTip(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "Delete Column", nullptr)); +#endif // QT_CONFIG(tooltip) + deleteColumnButton->setText(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "Delete", nullptr)); +#if QT_CONFIG(tooltip) + moveColumnUpButton->setToolTip(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "Move Column Up", nullptr)); +#endif // QT_CONFIG(tooltip) + moveColumnUpButton->setText(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "U", nullptr)); +#if QT_CONFIG(tooltip) + moveColumnDownButton->setToolTip(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "Move Column Down", nullptr)); +#endif // QT_CONFIG(tooltip) + moveColumnDownButton->setText(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "D", nullptr)); + label->setText(QCoreApplication::translate("qdesigner_internal::TreeWidgetEditor", "Icon", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/trpreviewtool.ui.h b/tests/auto/tools/uic/baseline/trpreviewtool.ui.h index 3fbf125a1f..612d7ad427 100644 --- a/tests/auto/tools/uic/baseline/trpreviewtool.ui.h +++ b/tests/auto/tools/uic/baseline/trpreviewtool.ui.h @@ -31,7 +31,7 @@ /******************************************************************************** ** Form generated from reading UI file 'trpreviewtool.ui' ** -** Created by: Qt User Interface Compiler version 5.9.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -117,7 +117,7 @@ public: mainToolBar = new QToolBar(TrPreviewToolClass); mainToolBar->setObjectName(QString::fromUtf8("mainToolBar")); mainToolBar->setOrientation(Qt::Horizontal); - TrPreviewToolClass->addToolBar(static_cast<Qt::ToolBarArea>(4), mainToolBar); + TrPreviewToolClass->addToolBar(Qt::TopToolBarArea, mainToolBar); statusBar = new QStatusBar(TrPreviewToolClass); statusBar->setObjectName(QString::fromUtf8("statusBar")); TrPreviewToolClass->setStatusBar(statusBar); @@ -138,7 +138,7 @@ public: vboxLayout->addWidget(viewForms); dwForms->setWidget(dockWidgetContents); - TrPreviewToolClass->addDockWidget(static_cast<Qt::DockWidgetArea>(1), dwForms); + TrPreviewToolClass->addDockWidget(Qt::LeftDockWidgetArea, dwForms); menuBar->addAction(menuFile->menuAction()); menuBar->addAction(menuView->menuAction()); @@ -162,21 +162,21 @@ public: void retranslateUi(QMainWindow *TrPreviewToolClass) { - TrPreviewToolClass->setWindowTitle(QApplication::translate("TrPreviewToolClass", "Qt Translation Preview Tool", nullptr)); - actionOpenForm->setText(QApplication::translate("TrPreviewToolClass", "&Open Form...", nullptr)); - actionLoadTranslation->setText(QApplication::translate("TrPreviewToolClass", "&Load Translation...", nullptr)); - actionReloadTranslations->setText(QApplication::translate("TrPreviewToolClass", "&Reload Translations", nullptr)); -#ifndef QT_NO_SHORTCUT - actionReloadTranslations->setShortcut(QApplication::translate("TrPreviewToolClass", "F5", nullptr)); -#endif // QT_NO_SHORTCUT - actionClose->setText(QApplication::translate("TrPreviewToolClass", "&Close", nullptr)); - actionAbout->setText(QApplication::translate("TrPreviewToolClass", "About", nullptr)); - actionAbout_Qt->setText(QApplication::translate("TrPreviewToolClass", "About Qt", nullptr)); - menuView->setTitle(QApplication::translate("TrPreviewToolClass", "&View", nullptr)); - menuViewViews->setTitle(QApplication::translate("TrPreviewToolClass", "&Views", nullptr)); - menuHelp->setTitle(QApplication::translate("TrPreviewToolClass", "&Help", nullptr)); - menuFile->setTitle(QApplication::translate("TrPreviewToolClass", "&File", nullptr)); - dwForms->setWindowTitle(QApplication::translate("TrPreviewToolClass", "Forms", nullptr)); + TrPreviewToolClass->setWindowTitle(QCoreApplication::translate("TrPreviewToolClass", "Qt Translation Preview Tool", nullptr)); + actionOpenForm->setText(QCoreApplication::translate("TrPreviewToolClass", "&Open Form...", nullptr)); + actionLoadTranslation->setText(QCoreApplication::translate("TrPreviewToolClass", "&Load Translation...", nullptr)); + actionReloadTranslations->setText(QCoreApplication::translate("TrPreviewToolClass", "&Reload Translations", nullptr)); +#if QT_CONFIG(shortcut) + actionReloadTranslations->setShortcut(QCoreApplication::translate("TrPreviewToolClass", "F5", nullptr)); +#endif // QT_CONFIG(shortcut) + actionClose->setText(QCoreApplication::translate("TrPreviewToolClass", "&Close", nullptr)); + actionAbout->setText(QCoreApplication::translate("TrPreviewToolClass", "About", nullptr)); + actionAbout_Qt->setText(QCoreApplication::translate("TrPreviewToolClass", "About Qt", nullptr)); + menuView->setTitle(QCoreApplication::translate("TrPreviewToolClass", "&View", nullptr)); + menuViewViews->setTitle(QCoreApplication::translate("TrPreviewToolClass", "&Views", nullptr)); + menuHelp->setTitle(QCoreApplication::translate("TrPreviewToolClass", "&Help", nullptr)); + menuFile->setTitle(QCoreApplication::translate("TrPreviewToolClass", "&File", nullptr)); + dwForms->setWindowTitle(QCoreApplication::translate("TrPreviewToolClass", "Forms", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/validators.ui.h b/tests/auto/tools/uic/baseline/validators.ui.h index d0ae777f65..45d9c5aac6 100644 --- a/tests/auto/tools/uic/baseline/validators.ui.h +++ b/tests/auto/tools/uic/baseline/validators.ui.h @@ -375,22 +375,22 @@ public: void retranslateUi(QWidget *ValidatorsForm) { - ValidatorsForm->setWindowTitle(QApplication::translate("ValidatorsForm", "Form", nullptr)); - groupBox->setTitle(QApplication::translate("ValidatorsForm", "QIntValidator", nullptr)); - label->setText(QApplication::translate("ValidatorsForm", "Min:", nullptr)); - label_2->setText(QApplication::translate("ValidatorsForm", "Max:", nullptr)); - label_7->setText(QApplication::translate("ValidatorsForm", "editingFinished()", nullptr)); - groupBox_2->setTitle(QApplication::translate("ValidatorsForm", "QDoubleValidator", nullptr)); - label_3->setText(QApplication::translate("ValidatorsForm", "Min:", nullptr)); - label_5->setText(QApplication::translate("ValidatorsForm", "Format:", nullptr)); - doubleFormat->setItemText(0, QApplication::translate("ValidatorsForm", "Standard", nullptr)); - doubleFormat->setItemText(1, QApplication::translate("ValidatorsForm", "Scientific", nullptr)); - - label_4->setText(QApplication::translate("ValidatorsForm", "Max:", nullptr)); - label_6->setText(QApplication::translate("ValidatorsForm", "Decimals:", nullptr)); + ValidatorsForm->setWindowTitle(QCoreApplication::translate("ValidatorsForm", "Form", nullptr)); + groupBox->setTitle(QCoreApplication::translate("ValidatorsForm", "QIntValidator", nullptr)); + label->setText(QCoreApplication::translate("ValidatorsForm", "Min:", nullptr)); + label_2->setText(QCoreApplication::translate("ValidatorsForm", "Max:", nullptr)); + label_7->setText(QCoreApplication::translate("ValidatorsForm", "editingFinished()", nullptr)); + groupBox_2->setTitle(QCoreApplication::translate("ValidatorsForm", "QDoubleValidator", nullptr)); + label_3->setText(QCoreApplication::translate("ValidatorsForm", "Min:", nullptr)); + label_5->setText(QCoreApplication::translate("ValidatorsForm", "Format:", nullptr)); + doubleFormat->setItemText(0, QCoreApplication::translate("ValidatorsForm", "Standard", nullptr)); + doubleFormat->setItemText(1, QCoreApplication::translate("ValidatorsForm", "Scientific", nullptr)); + + label_4->setText(QCoreApplication::translate("ValidatorsForm", "Max:", nullptr)); + label_6->setText(QCoreApplication::translate("ValidatorsForm", "Decimals:", nullptr)); doubleLedWidget->setText(QString()); - label_8->setText(QApplication::translate("ValidatorsForm", "editingFinished()", nullptr)); - pushButton->setText(QApplication::translate("ValidatorsForm", "Quit", nullptr)); + label_8->setText(QCoreApplication::translate("ValidatorsForm", "editingFinished()", nullptr)); + pushButton->setText(QCoreApplication::translate("ValidatorsForm", "Quit", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/baseline/wateringconfigdialog.ui.h b/tests/auto/tools/uic/baseline/wateringconfigdialog.ui.h index d6f7ff5526..aa005593c0 100644 --- a/tests/auto/tools/uic/baseline/wateringconfigdialog.ui.h +++ b/tests/auto/tools/uic/baseline/wateringconfigdialog.ui.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'wateringconfigdialog.ui' ** -** Created by: Qt User Interface Compiler version 5.10.0 +** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ @@ -250,34 +250,34 @@ public: void retranslateUi(QDialog *WateringConfigDialog) { - WateringConfigDialog->setWindowTitle(QApplication::translate("WateringConfigDialog", "Watering Configuration", nullptr)); - label_3->setText(QApplication::translate("WateringConfigDialog", "Plant:", nullptr)); - plantComboBox->setItemText(0, QApplication::translate("WateringConfigDialog", "Squash", nullptr)); - plantComboBox->setItemText(1, QApplication::translate("WateringConfigDialog", "Bean", nullptr)); - plantComboBox->setItemText(2, QApplication::translate("WateringConfigDialog", "Carrot", nullptr)); - plantComboBox->setItemText(3, QApplication::translate("WateringConfigDialog", "Strawberry", nullptr)); - plantComboBox->setItemText(4, QApplication::translate("WateringConfigDialog", "Raspberry", nullptr)); - plantComboBox->setItemText(5, QApplication::translate("WateringConfigDialog", "Blueberry", nullptr)); - - label_2->setText(QApplication::translate("WateringConfigDialog", "Water when:", nullptr)); - temperatureCheckBox->setText(QApplication::translate("WateringConfigDialog", "Temperature is higher than:", nullptr)); + WateringConfigDialog->setWindowTitle(QCoreApplication::translate("WateringConfigDialog", "Watering Configuration", nullptr)); + label_3->setText(QCoreApplication::translate("WateringConfigDialog", "Plant:", nullptr)); + plantComboBox->setItemText(0, QCoreApplication::translate("WateringConfigDialog", "Squash", nullptr)); + plantComboBox->setItemText(1, QCoreApplication::translate("WateringConfigDialog", "Bean", nullptr)); + plantComboBox->setItemText(2, QCoreApplication::translate("WateringConfigDialog", "Carrot", nullptr)); + plantComboBox->setItemText(3, QCoreApplication::translate("WateringConfigDialog", "Strawberry", nullptr)); + plantComboBox->setItemText(4, QCoreApplication::translate("WateringConfigDialog", "Raspberry", nullptr)); + plantComboBox->setItemText(5, QCoreApplication::translate("WateringConfigDialog", "Blueberry", nullptr)); + + label_2->setText(QCoreApplication::translate("WateringConfigDialog", "Water when:", nullptr)); + temperatureCheckBox->setText(QCoreApplication::translate("WateringConfigDialog", "Temperature is higher than:", nullptr)); temperatureSpinBox->setSpecialValueText(QString()); - temperatureSpinBox->setSuffix(QApplication::translate("WateringConfigDialog", "C", nullptr)); - rainCheckBox->setText(QApplication::translate("WateringConfigDialog", "Rain less than:", nullptr)); + temperatureSpinBox->setSuffix(QCoreApplication::translate("WateringConfigDialog", "C", nullptr)); + rainCheckBox->setText(QCoreApplication::translate("WateringConfigDialog", "Rain less than:", nullptr)); rainSpinBox->setSpecialValueText(QString()); - rainSpinBox->setSuffix(QApplication::translate("WateringConfigDialog", "mm", nullptr)); - label->setText(QApplication::translate("WateringConfigDialog", "Starting Time:", nullptr)); - label_4->setText(QApplication::translate("WateringConfigDialog", "Amount:", nullptr)); - amountSpinBox->setSuffix(QApplication::translate("WateringConfigDialog", "l", nullptr)); - label_5->setText(QApplication::translate("WateringConfigDialog", "Source:", nullptr)); - sourceComboBox->setItemText(0, QApplication::translate("WateringConfigDialog", "Foundain", nullptr)); - sourceComboBox->setItemText(1, QApplication::translate("WateringConfigDialog", "River", nullptr)); - sourceComboBox->setItemText(2, QApplication::translate("WateringConfigDialog", "Lake", nullptr)); - sourceComboBox->setItemText(3, QApplication::translate("WateringConfigDialog", "Public Water System", nullptr)); - - label_6->setText(QApplication::translate("WateringConfigDialog", "Filter:", nullptr)); + rainSpinBox->setSuffix(QCoreApplication::translate("WateringConfigDialog", "mm", nullptr)); + label->setText(QCoreApplication::translate("WateringConfigDialog", "Starting Time:", nullptr)); + label_4->setText(QCoreApplication::translate("WateringConfigDialog", "Amount:", nullptr)); + amountSpinBox->setSuffix(QCoreApplication::translate("WateringConfigDialog", "l", nullptr)); + label_5->setText(QCoreApplication::translate("WateringConfigDialog", "Source:", nullptr)); + sourceComboBox->setItemText(0, QCoreApplication::translate("WateringConfigDialog", "Foundain", nullptr)); + sourceComboBox->setItemText(1, QCoreApplication::translate("WateringConfigDialog", "River", nullptr)); + sourceComboBox->setItemText(2, QCoreApplication::translate("WateringConfigDialog", "Lake", nullptr)); + sourceComboBox->setItemText(3, QCoreApplication::translate("WateringConfigDialog", "Public Water System", nullptr)); + + label_6->setText(QCoreApplication::translate("WateringConfigDialog", "Filter:", nullptr)); filterCheckBox->setText(QString()); - helpLabel->setText(QApplication::translate("WateringConfigDialog", "<a href=\"test\">Show Details</a>", nullptr)); + helpLabel->setText(QCoreApplication::translate("WateringConfigDialog", "<a href=\"test\">Show Details</a>", nullptr)); } // retranslateUi }; diff --git a/tests/auto/tools/uic/tst_uic.cpp b/tests/auto/tools/uic/tst_uic.cpp index 85668c96d4..f9553028fe 100644 --- a/tests/auto/tools/uic/tst_uic.cpp +++ b/tests/auto/tools/uic/tst_uic.cpp @@ -37,6 +37,11 @@ #include <QtCore/QRegularExpression> #include <QtCore/QStandardPaths> +#include <cstdio> + +static const char keepEnvVar[] = "UIC_KEEP_GENERATED_FILES"; +static const char diffToStderrEnvVar[] = "UIC_STDERR_DIFF"; + class tst_uic : public QObject { Q_OBJECT @@ -69,7 +74,7 @@ private: tst_uic::tst_uic() : m_command(QLibraryInfo::location(QLibraryInfo::BinariesPath) + QLatin1String("/uic")) - , m_versionRegexp(QLatin1String("\\*\\* Created by: Qt User Interface Compiler version \\d{1,2}\\.\\d{1,2}\\.\\d{1,2}")) + , m_versionRegexp(QLatin1String(R"(\*\* Created by: Qt User Interface Compiler version \d{1,2}\.\d{1,2}\.\d{1,2})")) { } @@ -103,14 +108,19 @@ void tst_uic::initTestCase() qDebug("%s", qPrintable(msg)); } +static const char helpFormat[] = R"( +Note: The environment variable '%s' can be set to keep the temporary files +for error analysis. +The environment variable '%s' can be set to redirect the diff output to +stderr.)"; + void tst_uic::cleanupTestCase() { - static const char envVar[] = "UIC_KEEP_GENERATED_FILES"; - if (qgetenv(envVar).isEmpty()) { - qDebug("Note: The environment variable '%s' can be set to keep the temporary files for error analysis.", envVar); - } else { + if (qEnvironmentVariableIsSet(keepEnvVar)) { m_generated.setAutoRemove(false); qDebug("Keeping generated files in '%s'", qPrintable(QDir::toNativeSeparators(m_generated.path()))); + } else { + qDebug(helpFormat, keepEnvVar, diffToStderrEnvVar); } } @@ -152,7 +162,7 @@ void tst_uic::run() QVERIFY(process.waitForFinished()); QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); - QCOMPARE(QFileInfo(generatedFile).exists(), true); + QVERIFY(QFileInfo::exists(generatedFile)); } void tst_uic::run_data() const @@ -212,6 +222,16 @@ static QByteArray msgCannotReadFile(const QFile &file) return result.toLocal8Bit(); } +static void outputDiff(const QString &diff) +{ + // Use patch -p3 < diff to apply the obtained diff output in the baseline directory. + static const bool diffToStderr = qEnvironmentVariableIsSet(diffToStderrEnvVar); + if (diffToStderr) + std::fputs(qPrintable(diff), stderr); + else + qWarning("Difference:\n%s", qPrintable(diff)); +} + void tst_uic::compare() { QFETCH(QString, originalFile); @@ -233,7 +253,7 @@ void tst_uic::compare() if (generatedFileContents != originalFileContents) { const QString diff = generateDiff(originalFile, generatedFile); if (!diff.isEmpty()) - qWarning().noquote().nospace() << "Difference:\n" << diff; + outputDiff(diff); } QCOMPARE(generatedFileContents, originalFileContents); @@ -274,7 +294,7 @@ void tst_uic::runTranslation() QVERIFY(process.waitForFinished()); QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); - QCOMPARE(QFileInfo(generatedFile).exists(), true); + QVERIFY(QFileInfo::exists(generatedFile)); } @@ -301,7 +321,7 @@ void tst_uic::runCompare() if (generatedFileContents != originalFileContents) { const QString diff = generateDiff(originalFile, generatedFile); if (!diff.isEmpty()) - qWarning().noquote().nospace() << "Difference:\n" << diff; + outputDiff(diff); } QCOMPARE(generatedFileContents, originalFileContents); diff --git a/tests/auto/widgets/dialogs/qcolordialog/tst_qcolordialog.cpp b/tests/auto/widgets/dialogs/qcolordialog/tst_qcolordialog.cpp index 6a0ad4b3a4..413b865f04 100644 --- a/tests/auto/widgets/dialogs/qcolordialog/tst_qcolordialog.cpp +++ b/tests/auto/widgets/dialogs/qcolordialog/tst_qcolordialog.cpp @@ -116,10 +116,10 @@ void tst_QColorDialog::testGetRgba() #ifdef Q_OS_MAC QEXPECT_FAIL("", "Sending QTest::keyClick to OSX color dialog helper fails, see QTBUG-24320", Continue); #endif - bool ok = false; - QTimer::singleShot(500, this, SLOT(postKeyReturn())); - QColorDialog::getRgba(0xffffffff, &ok); - QVERIFY(ok); + QTimer::singleShot(500, this, &tst_QColorDialog::postKeyReturn); + const QColor color = QColorDialog::getColor(QColor::fromRgba(0xffffffff), nullptr, QString(), + QColorDialog::ShowAlphaChannel); + QVERIFY(color.isValid()); } void tst_QColorDialog::defaultOkButton() diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp index ae8e4f7e04..748c8aaa84 100644 --- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp @@ -620,13 +620,13 @@ void tst_QFiledialog::acceptMode() void tst_QFiledialog::confirmOverwrite() { QFileDialog fd; - QCOMPARE(fd.confirmOverwrite(), true); - fd.setConfirmOverwrite(true); - QCOMPARE(fd.confirmOverwrite(), true); - fd.setConfirmOverwrite(false); - QCOMPARE(fd.confirmOverwrite(), false); - fd.setConfirmOverwrite(true); - QCOMPARE(fd.confirmOverwrite(), true); + QCOMPARE(fd.testOption(QFileDialog::DontConfirmOverwrite), false); + fd.setOption(QFileDialog::DontConfirmOverwrite, false); + QCOMPARE(fd.testOption(QFileDialog::DontConfirmOverwrite), false); + fd.setOption(QFileDialog::DontConfirmOverwrite, true); + QCOMPARE(fd.testOption(QFileDialog::DontConfirmOverwrite), true); + fd.setOption(QFileDialog::DontConfirmOverwrite, false); + QCOMPARE(fd.testOption(QFileDialog::DontConfirmOverwrite), false); } void tst_QFiledialog::defaultSuffix() @@ -808,8 +808,8 @@ void tst_QFiledialog::isReadOnly() //QCOMPARE(renameAction && renameAction->isEnabled(), true); //QCOMPARE(deleteAction && deleteAction->isEnabled(), true); - fd.setReadOnly(true); - QCOMPARE(fd.isReadOnly(), true); + fd.setOption(QFileDialog::ReadOnly, true); + QCOMPARE(fd.testOption(QFileDialog::ReadOnly), true); QCOMPARE(newButton && newButton->isEnabled(), false); QCOMPARE(renameAction && renameAction->isEnabled(), false); @@ -853,11 +853,11 @@ void tst_QFiledialog::resolveSymlinks() QFileDialog fd; // default - QCOMPARE(fd.resolveSymlinks(), true); - fd.setResolveSymlinks(false); - QCOMPARE(fd.resolveSymlinks(), false); - fd.setResolveSymlinks(true); - QCOMPARE(fd.resolveSymlinks(), true); + QCOMPARE(fd.testOption(QFileDialog::DontResolveSymlinks), false); + fd.setOption(QFileDialog::DontResolveSymlinks, true); + QCOMPARE(fd.testOption(QFileDialog::DontResolveSymlinks), true); + fd.setOption(QFileDialog::DontResolveSymlinks, false); + QCOMPARE(fd.testOption(QFileDialog::DontResolveSymlinks), false); // the file dialog doesn't do anything based upon this, just passes it to the model // the model should fully test it, don't test it here @@ -1119,7 +1119,7 @@ void tst_QFiledialog::setNameFilter() QFileDialog fd; fd.setNameFilters(filters); - fd.setNameFilterDetailsVisible(nameFilterDetailsVisible); + fd.setOption(QFileDialog::HideNameFilterDetails, !nameFilterDetailsVisible); fd.selectNameFilter(selectFilter); QCOMPARE(fd.selectedNameFilter(), expectedSelectedFilter); } diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp index 24ce598279..869418371c 100644 --- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp @@ -252,7 +252,7 @@ void tst_QFileDialog2::showNameFilterDetails() QFileDialog fd; QComboBox *filters = fd.findChild<QComboBox*>("fileTypeCombo"); QVERIFY(filters); - QVERIFY(fd.isNameFilterDetailsVisible()); + QVERIFY(!fd.testOption(QFileDialog::HideNameFilterDetails)); QStringList filterChoices; @@ -261,12 +261,12 @@ void tst_QFileDialog2::showNameFilterDetails() << "Any files (*.*)"; fd.setNameFilters(filterChoices); - fd.setNameFilterDetailsVisible(false); + fd.setOption(QFileDialog::HideNameFilterDetails, true); QCOMPARE(filters->itemText(0), QString("Image files")); QCOMPARE(filters->itemText(1), QString("Text files")); QCOMPARE(filters->itemText(2), QString("Any files")); - fd.setNameFilterDetailsVisible(true); + fd.setOption(QFileDialog::HideNameFilterDetails, false); QCOMPARE(filters->itemText(0), filterChoices.at(0)); QCOMPARE(filters->itemText(1), filterChoices.at(1)); QCOMPARE(filters->itemText(2), filterChoices.at(2)); @@ -486,7 +486,7 @@ protected: parentIndex = source_parent; QString path; - path = parentIndex.child(source_row,0).data(Qt::DisplayRole).toString(); + path = sourceModel()->index(source_row, 0, parentIndex).data(Qt::DisplayRole).toString(); do { path = parentIndex.data(Qt::DisplayRole).toString() + QLatin1Char('/') + path; diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/BLACKLIST b/tests/auto/widgets/dialogs/qfilesystemmodel/BLACKLIST index 01679eb6ee..f78d23c6b1 100644 --- a/tests/auto/widgets/dialogs/qfilesystemmodel/BLACKLIST +++ b/tests/auto/widgets/dialogs/qfilesystemmodel/BLACKLIST @@ -9,3 +9,5 @@ b2qt ubuntu b2qt windows +rhel +suse-leap diff --git a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index 67e1f9ce30..2f5fc597dc 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -91,7 +91,7 @@ public: { Q_UNUSED(option); Q_UNUSED(widget); - painter->drawRoundRect(rect()); + painter->drawRoundedRect(rect(), 25, 25, Qt::RelativeSize); painter->drawLine(rect().topLeft(), rect().bottomRight()); painter->drawLine(rect().bottomLeft(), rect().topRight()); } diff --git a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp index 34646a9074..2f0c43552f 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp @@ -125,7 +125,7 @@ public: { Q_UNUSED(option); Q_UNUSED(widget); - painter->drawRoundRect(rect()); + painter->drawRoundedRect(rect(), 25, 25, Qt::RelativeSize); painter->drawLine(rect().topLeft(), rect().bottomRight()); painter->drawLine(rect().bottomLeft(), rect().topRight()); } diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 9a75774927..bca664c05b 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -301,8 +301,8 @@ private slots: void pos(); void scenePos(); void matrix(); - void sceneMatrix(); - void setMatrix(); + void sceneTransform(); + void setTransform(); void zValue(); void shape(); void contains(); @@ -552,8 +552,8 @@ void tst_QGraphicsItem::construction() QVERIFY(!item->acceptHoverEvents()); QVERIFY(!item->hasFocus()); QCOMPARE(item->pos(), QPointF()); - QCOMPARE(item->matrix(), QMatrix()); - QCOMPARE(item->sceneMatrix(), QMatrix()); + QCOMPARE(item->transform(), QTransform()); + QCOMPARE(item->sceneTransform(), QTransform()); QCOMPARE(item->zValue(), qreal(0)); QCOMPARE(item->sceneBoundingRect(), QRectF()); QCOMPARE(item->shape(), QPainterPath()); @@ -2116,68 +2116,68 @@ void tst_QGraphicsItem::scenePos() void tst_QGraphicsItem::matrix() { QGraphicsLineItem line; - QCOMPARE(line.matrix(), QMatrix()); - line.setMatrix(QMatrix().rotate(90)); - QCOMPARE(line.matrix(), QMatrix().rotate(90)); - line.setMatrix(QMatrix().rotate(90)); - QCOMPARE(line.matrix(), QMatrix().rotate(90)); - line.setMatrix(QMatrix().rotate(90), true); - QCOMPARE(line.matrix(), QMatrix().rotate(180)); - line.setMatrix(QMatrix().rotate(-90), true); - QCOMPARE(line.matrix(), QMatrix().rotate(90)); - line.resetMatrix(); - QCOMPARE(line.matrix(), QMatrix()); + QCOMPARE(line.transform(), QTransform()); + line.setTransform(QTransform().rotate(90)); + QCOMPARE(line.transform(), QTransform().rotate(90)); + line.setTransform(QTransform().rotate(90)); + QCOMPARE(line.transform(), QTransform().rotate(90)); + line.setTransform(QTransform().rotate(90), true); + QCOMPARE(line.transform(), QTransform().rotate(180)); + line.setTransform(QTransform().rotate(-90), true); + QCOMPARE(line.transform(), QTransform().rotate(90)); + line.resetTransform(); + QCOMPARE(line.transform(), QTransform()); line.setTransform(QTransform().rotate(90), true); - QCOMPARE(line.matrix(), QMatrix().rotate(90)); + QCOMPARE(line.transform(), QTransform().rotate(90)); line.setTransform(QTransform().rotate(90), true); - QCOMPARE(line.matrix(), QMatrix().rotate(90).rotate(90)); - line.resetMatrix(); + QCOMPARE(line.transform(), QTransform().rotate(90).rotate(90)); + line.resetTransform(); line.setTransform(QTransform::fromScale(2, 4), true); - QCOMPARE(line.matrix(), QMatrix().scale(2, 4)); + QCOMPARE(line.transform(), QTransform::fromScale(2, 4)); line.setTransform(QTransform::fromScale(2, 4), true); - QCOMPARE(line.matrix(), QMatrix().scale(2, 4).scale(2, 4)); - line.resetMatrix(); + QCOMPARE(line.transform(), QTransform::fromScale(2, 4).scale(2, 4)); + line.resetTransform(); line.setTransform(QTransform().shear(2, 4), true); - QCOMPARE(line.matrix(), QMatrix().shear(2, 4)); + QCOMPARE(line.transform(), QTransform().shear(2, 4)); line.setTransform(QTransform().shear(2, 4), true); - QCOMPARE(line.matrix(), QMatrix().shear(2, 4).shear(2, 4)); - line.resetMatrix(); + QCOMPARE(line.transform(), QTransform().shear(2, 4).shear(2, 4)); + line.resetTransform(); line.setTransform(QTransform::fromTranslate(10, 10), true); - QCOMPARE(line.matrix(), QMatrix().translate(10, 10)); + QCOMPARE(line.transform(), QTransform::fromTranslate(10, 10)); line.setTransform(QTransform::fromTranslate(10, 10), true); - QCOMPARE(line.matrix(), QMatrix().translate(10, 10).translate(10, 10)); - line.resetMatrix(); + QCOMPARE(line.transform(), QTransform::fromTranslate(10, 10).translate(10, 10)); + line.resetTransform(); } -void tst_QGraphicsItem::sceneMatrix() +void tst_QGraphicsItem::sceneTransform() { QGraphicsLineItem *parent = new QGraphicsLineItem; QGraphicsLineItem *child = new QGraphicsLineItem(QLineF(), parent); - QCOMPARE(parent->sceneMatrix(), QMatrix()); - QCOMPARE(child->sceneMatrix(), QMatrix()); + QCOMPARE(parent->sceneTransform(), QTransform()); + QCOMPARE(child->sceneTransform(), QTransform()); parent->setTransform(QTransform::fromTranslate(10, 10), true); - QCOMPARE(parent->sceneMatrix(), QMatrix().translate(10, 10)); - QCOMPARE(child->sceneMatrix(), QMatrix().translate(10, 10)); + QCOMPARE(parent->sceneTransform(), QTransform().translate(10, 10)); + QCOMPARE(child->sceneTransform(), QTransform().translate(10, 10)); child->setTransform(QTransform::fromTranslate(10, 10), true); - QCOMPARE(parent->sceneMatrix(), QMatrix().translate(10, 10)); - QCOMPARE(child->sceneMatrix(), QMatrix().translate(20, 20)); + QCOMPARE(parent->sceneTransform(), QTransform().translate(10, 10)); + QCOMPARE(child->sceneTransform(), QTransform().translate(20, 20)); parent->setTransform(QTransform().rotate(90), true); - QCOMPARE(parent->sceneMatrix(), QMatrix().translate(10, 10).rotate(90)); - QCOMPARE(child->sceneMatrix(), QMatrix().translate(10, 10).rotate(90).translate(10, 10)); + QCOMPARE(parent->sceneTransform(), QTransform().translate(10, 10).rotate(90)); + QCOMPARE(child->sceneTransform(), QTransform().translate(10, 10).rotate(90).translate(10, 10)); delete child; delete parent; } -void tst_QGraphicsItem::setMatrix() +void tst_QGraphicsItem::setTransform() { QGraphicsScene scene; QSignalSpy spy(&scene, SIGNAL(changed(QList<QRectF>))); @@ -2190,7 +2190,7 @@ void tst_QGraphicsItem::setMatrix() QCOMPARE(spy.count(), 1); - item.setMatrix(QMatrix().rotate(qreal(12.34))); + item.setTransform(QTransform().rotate(qreal(12.34))); QRectF rotatedRect = scene.sceneRect(); QVERIFY(unrotatedRect != rotatedRect); scene.update(scene.sceneRect()); @@ -2198,7 +2198,7 @@ void tst_QGraphicsItem::setMatrix() QCOMPARE(spy.count(), 2); - item.setMatrix(QMatrix()); + item.setTransform(QTransform()); scene.update(scene.sceneRect()); QApplication::instance()->processEvents(); @@ -2485,25 +2485,25 @@ void tst_QGraphicsItem::collidesWith_item() void tst_QGraphicsItem::collidesWith_path_data() { QTest::addColumn<QPointF>("pos"); - QTest::addColumn<QMatrix>("matrix"); + QTest::addColumn<QTransform>("transform"); QTest::addColumn<QPainterPath>("shape"); QTest::addColumn<bool>("rectCollides"); QTest::addColumn<bool>("ellipseCollides"); - QTest::newRow("nothing") << QPointF(0, 0) << QMatrix() << QPainterPath() << false << false; + QTest::newRow("nothing") << QPointF(0, 0) << QTransform() << QPainterPath() << false << false; QPainterPath rect; rect.addRect(0, 0, 20, 20); - QTest::newRow("rect1") << QPointF(0, 0) << QMatrix() << rect << true << true; - QTest::newRow("rect2") << QPointF(0, 0) << QMatrix().translate(21, 21) << rect << false << false; - QTest::newRow("rect3") << QPointF(21, 21) << QMatrix() << rect << false << false; + QTest::newRow("rect1") << QPointF(0, 0) << QTransform() << rect << true << true; + QTest::newRow("rect2") << QPointF(0, 0) << QTransform::fromTranslate(21, 21) << rect << false << false; + QTest::newRow("rect3") << QPointF(21, 21) << QTransform() << rect << false << false; } void tst_QGraphicsItem::collidesWith_path() { QFETCH(QPointF, pos); - QFETCH(QMatrix, matrix); + QFETCH(QTransform, transform); QFETCH(QPainterPath, shape); QFETCH(bool, rectCollides); QFETCH(bool, ellipseCollides); @@ -2512,12 +2512,12 @@ void tst_QGraphicsItem::collidesWith_path() QGraphicsEllipseItem ellipse(QRectF(0, 0, 20, 20)); rect.setPos(pos); - rect.setMatrix(matrix); + rect.setTransform(transform); ellipse.setPos(pos); - ellipse.setMatrix(matrix); + ellipse.setTransform(transform); - QPainterPath mappedShape = rect.sceneMatrix().inverted().map(shape); + QPainterPath mappedShape = rect.sceneTransform().inverted().map(shape); if (rectCollides) QVERIFY(rect.collidesWithPath(mappedShape)); @@ -2742,35 +2742,35 @@ void tst_QGraphicsItem::mapFromToParent() item4->setPos(10, 10); for (int i = 0; i < 4; ++i) { - QMatrix matrix; - matrix.rotate(i * 90); - matrix.translate(i * 100, -i * 100); - matrix.scale(2, 4); - item1->setMatrix(matrix); + QTransform transform; + transform.rotate(i * 90); + transform.translate(i * 100, -i * 100); + transform.scale(2, 4); + item1->setTransform(transform); - QCOMPARE(item1->mapToParent(QPointF(0, 0)), item1->pos() + matrix.map(QPointF(0, 0))); + QCOMPARE(item1->mapToParent(QPointF(0, 0)), item1->pos() + transform.map(QPointF(0, 0))); QCOMPARE(item2->mapToParent(QPointF(0, 0)), item2->pos()); QCOMPARE(item3->mapToParent(QPointF(0, 0)), item3->pos()); QCOMPARE(item4->mapToParent(QPointF(0, 0)), item4->pos()); - QCOMPARE(item1->mapToParent(QPointF(10, -10)), item1->pos() + matrix.map(QPointF(10, -10))); + QCOMPARE(item1->mapToParent(QPointF(10, -10)), item1->pos() + transform.map(QPointF(10, -10))); QCOMPARE(item2->mapToParent(QPointF(10, -10)), item2->pos() + QPointF(10, -10)); QCOMPARE(item3->mapToParent(QPointF(10, -10)), item3->pos() + QPointF(10, -10)); QCOMPARE(item4->mapToParent(QPointF(10, -10)), item4->pos() + QPointF(10, -10)); - QCOMPARE(item1->mapToParent(QPointF(-10, 10)), item1->pos() + matrix.map(QPointF(-10, 10))); + QCOMPARE(item1->mapToParent(QPointF(-10, 10)), item1->pos() + transform.map(QPointF(-10, 10))); QCOMPARE(item2->mapToParent(QPointF(-10, 10)), item2->pos() + QPointF(-10, 10)); QCOMPARE(item3->mapToParent(QPointF(-10, 10)), item3->pos() + QPointF(-10, 10)); QCOMPARE(item4->mapToParent(QPointF(-10, 10)), item4->pos() + QPointF(-10, 10)); - QCOMPARE(item1->mapFromParent(item1->pos()), matrix.inverted().map(QPointF(0, 0))); + QCOMPARE(item1->mapFromParent(item1->pos()), transform.inverted().map(QPointF(0, 0))); QCOMPARE(item2->mapFromParent(item2->pos()), QPointF(0, 0)); QCOMPARE(item3->mapFromParent(item3->pos()), QPointF(0, 0)); QCOMPARE(item4->mapFromParent(item4->pos()), QPointF(0, 0)); QCOMPARE(item1->mapFromParent(item1->pos() + QPointF(10, -10)), - matrix.inverted().map(QPointF(10, -10))); + transform.inverted().map(QPointF(10, -10))); QCOMPARE(item2->mapFromParent(item2->pos() + QPointF(10, -10)), QPointF(10, -10)); QCOMPARE(item3->mapFromParent(item3->pos() + QPointF(10, -10)), QPointF(10, -10)); QCOMPARE(item4->mapFromParent(item4->pos() + QPointF(10, -10)), QPointF(10, -10)); QCOMPARE(item1->mapFromParent(item1->pos() + QPointF(-10, 10)), - matrix.inverted().map(QPointF(-10, 10))); + transform.inverted().map(QPointF(-10, 10))); QCOMPARE(item2->mapFromParent(item2->pos() + QPointF(-10, 10)), QPointF(-10, 10)); QCOMPARE(item3->mapFromParent(item3->pos() + QPointF(-10, 10)), QPointF(-10, 10)); QCOMPARE(item4->mapFromParent(item4->pos() + QPointF(-10, 10)), QPointF(-10, 10)); @@ -2820,8 +2820,8 @@ void tst_QGraphicsItem::mapFromToScene() QCOMPARE(item4->mapFromScene(410, 400), QPointF(10, 0)); // Rotate item1 90 degrees clockwise - QMatrix matrix; matrix.rotate(90); - item1->setMatrix(matrix); + QTransform transform; transform.rotate(90); + item1->setTransform(transform); QCOMPARE(item1->pos(), item1->mapToParent(0, 0)); QCOMPARE(item2->pos(), item2->mapToParent(0, 0)); QCOMPARE(item3->pos(), item3->mapToParent(0, 0)); @@ -2848,7 +2848,7 @@ void tst_QGraphicsItem::mapFromToScene() QCOMPARE(item4->mapFromScene(-200, 410), QPointF(10, 0)); // Rotate item2 90 degrees clockwise - item2->setMatrix(matrix); + item2->setTransform(transform); QCOMPARE(item1->pos(), item1->mapToParent(0, 0)); QCOMPARE(item2->pos(), item2->mapToParent(0, 0)); QCOMPARE(item3->pos(), item3->mapToParent(0, 0)); @@ -2875,10 +2875,10 @@ void tst_QGraphicsItem::mapFromToScene() QCOMPARE(item4->mapFromScene(-210, 0), QPointF(10, 0)); // Translate item3 50 points, then rotate 90 degrees counterclockwise - QMatrix matrix2; - matrix2.translate(50, 0); - matrix2.rotate(-90); - item3->setMatrix(matrix2); + QTransform transform2; + transform2.translate(50, 0); + transform2.rotate(-90); + item3->setTransform(transform2); QCOMPARE(item1->pos(), item1->mapToParent(0, 0)); QCOMPARE(item2->pos(), item2->mapToParent(0, 0)); QCOMPARE(item3->pos(), item3->mapToParent(0, 0) - QPointF(50, 0)); @@ -2928,9 +2928,9 @@ void tst_QGraphicsItem::mapFromToItem() QCOMPARE(item3->mapFromItem(item2, 0, 0), QPointF(0, -200)); QCOMPARE(item4->mapFromItem(item3, 0, 0), QPointF(200, 0)); - QMatrix matrix; - matrix.translate(100, 100); - item1->setMatrix(matrix); + QTransform transform; + transform.translate(100, 100); + item1->setTransform(transform); QCOMPARE(item1->mapFromItem(item2, 0, 0), QPointF(100, -100)); QCOMPARE(item2->mapFromItem(item3, 0, 0), QPointF(0, 200)); @@ -2941,11 +2941,11 @@ void tst_QGraphicsItem::mapFromToItem() QCOMPARE(item3->mapFromItem(item2, 0, 0), QPointF(0, -200)); QCOMPARE(item4->mapFromItem(item3, 0, 0), QPointF(200, 0)); - matrix.rotate(90); - item1->setMatrix(matrix); - item2->setMatrix(matrix); - item3->setMatrix(matrix); - item4->setMatrix(matrix); + transform.rotate(90); + item1->setTransform(transform); + item2->setTransform(transform); + item3->setTransform(transform); + item4->setTransform(transform); QCOMPARE(item1->mapFromItem(item2, 0, 0), QPointF(0, -200)); QCOMPARE(item2->mapFromItem(item3, 0, 0), QPointF(200, 0)); @@ -4433,9 +4433,12 @@ protected: case QGraphicsItem::ItemPositionHasChanged: break; case QGraphicsItem::ItemMatrixChange: { +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED QVariant variant; variant.setValue<QMatrix>(matrix()); oldValues << variant; +QT_WARNING_POP } break; case QGraphicsItem::ItemTransformChange: { @@ -4556,6 +4559,8 @@ void tst_QGraphicsItem::itemChange() QCOMPARE(tester.isEnabled(), true); } { +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED // QDesktopWidget::screen() // ItemMatrixChange / ItemTransformHasChanged tester.itemChangeReturnValue.setValue<QMatrix>(QMatrix().rotate(90)); tester.setMatrix(QMatrix().translate(50, 0), true); @@ -4570,6 +4575,7 @@ void tst_QGraphicsItem::itemChange() variant.setValue<QMatrix>(QMatrix()); QCOMPARE(tester.oldValues.last(), variant); QCOMPARE(tester.matrix(), QMatrix().rotate(90)); +QT_WARNING_POP } { tester.resetTransform(); diff --git a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp index f9b6fe3ebd..9369470ce5 100644 --- a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp @@ -150,7 +150,7 @@ public: Q_UNUSED(option); Q_UNUSED(widget); painter->setBrush(m_brush); - painter->drawRoundRect(rect()); + painter->drawRoundedRect(rect(), 25, 25, Qt::RelativeSize); } void setSizeHint(Qt::SizeHint which, const QSizeF &size) { diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index 48488abfb8..46f1d5df5c 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -112,14 +112,14 @@ protected: painter->setOpacity(0.75); painter->setPen(Qt::NoPen); painter->setBrush(Qt::darkGray); - painter->drawRoundRect(boundingRect().adjusted(3, 3, -3, -3), Qt::darkGray); + painter->drawRoundedRect(boundingRect().adjusted(3, 3, -3, -3), 25, 25, Qt::RelativeSize); painter->setPen(Qt::black); if (isHovered) { - painter->setBrush(QColor(Qt::blue).light(120)); + painter->setBrush(QColor(Qt::blue).lighter(120)); } else { painter->setBrush(Qt::gray); } - painter->drawRoundRect(boundingRect().adjusted(0, 0, -5, -5)); + painter->drawRoundedRect(boundingRect().adjusted(0, 0, -5, -5), 25, 25, Qt::RelativeSize); } }; @@ -233,7 +233,6 @@ private slots: void tabFocus_sceneWithFocusWidgets(); void tabFocus_sceneWithNestedFocusWidgets(); void style(); - void sorting_data(); void sorting(); void insertionOrder(); void changedSignal_data(); @@ -459,41 +458,41 @@ void tst_QGraphicsScene::items() void tst_QGraphicsScene::itemsBoundingRect_data() { QTest::addColumn<QList<QRectF> >("rects"); - QTest::addColumn<QMatrix>("matrix"); + QTest::addColumn<QTransform>("transform"); QTest::addColumn<QRectF>("boundingRect"); - QMatrix transformationMatrix; - transformationMatrix.translate(50, -50); - transformationMatrix.scale(2, 2); - transformationMatrix.rotate(90); + QTransform transformation; + transformation.translate(50, -50); + transformation.scale(2, 2); + transformation.rotate(90); QTest::newRow("none") << QList<QRectF>() - << QMatrix() + << QTransform() << QRectF(); QTest::newRow("{{0, 0, 10, 10}}") << (QList<QRectF>() << QRectF(0, 0, 10, 10)) - << QMatrix() + << QTransform() << QRectF(0, 0, 10, 10); QTest::newRow("{{-10, -10, 10, 10}}") << (QList<QRectF>() << QRectF(-10, -10, 10, 10)) - << QMatrix() + << QTransform() << QRectF(-10, -10, 10, 10); QTest::newRow("{{-1000, -1000, 1, 1}, {-10, -10, 10, 10}}") << (QList<QRectF>() << QRectF(-1000, -1000, 1, 1) << QRectF(-10, -10, 10, 10)) - << QMatrix() + << QTransform() << QRectF(-1000, -1000, 1000, 1000); QTest::newRow("transformed {{0, 0, 10, 10}}") << (QList<QRectF>() << QRectF(0, 0, 10, 10)) - << transformationMatrix + << transformation << QRectF(30, -50, 20, 20); QTest::newRow("transformed {{-10, -10, 10, 10}}") << (QList<QRectF>() << QRectF(-10, -10, 10, 10)) - << transformationMatrix + << transformation << QRectF(50, -70, 20, 20); QTest::newRow("transformed {{-1000, -1000, 1, 1}, {-10, -10, 10, 10}}") << (QList<QRectF>() << QRectF(-1000, -1000, 1, 1) << QRectF(-10, -10, 10, 10)) - << transformationMatrix + << transformation << QRectF(50, -2050, 2000, 2000); QList<QRectF> all; @@ -501,18 +500,18 @@ void tst_QGraphicsScene::itemsBoundingRect_data() all << QRectF(randomX[i], randomY[i], 10, 10); QTest::newRow("all") << all - << QMatrix() + << QTransform() << QRectF(-980, -994, 1988, 1983); QTest::newRow("transformed all") << all - << transformationMatrix + << transformation << QRectF(-1928, -2010, 3966, 3976); } void tst_QGraphicsScene::itemsBoundingRect() { QFETCH(QList<QRectF>, rects); - QFETCH(QMatrix, matrix); + QFETCH(QTransform, transform); QFETCH(QRectF, boundingRect); QGraphicsScene scene; @@ -522,7 +521,7 @@ void tst_QGraphicsScene::itemsBoundingRect() path.addRect(rect); QGraphicsPathItem *item = scene.addPath(path); item->setPen(QPen(Qt::black, 0)); - item->setMatrix(matrix); + item->setTransform(transform); } QCOMPARE(scene.itemsBoundingRect(), boundingRect); @@ -2502,7 +2501,7 @@ void tst_QGraphicsScene::render_data() QTest::addColumn<QRectF>("targetRect"); QTest::addColumn<QRectF>("sourceRect"); QTest::addColumn<Qt::AspectRatioMode>("aspectRatioMode"); - QTest::addColumn<QMatrix>("matrix"); + QTest::addColumn<QTransform>("transform"); QTest::addColumn<QPainterPath>("clip"); QPainterPath clip_rect; @@ -2512,61 +2511,61 @@ void tst_QGraphicsScene::render_data() clip_ellipse.addEllipse(100,50,150,200); QTest::newRow("all-all-untransformed") << QRectF() << QRectF() - << Qt::IgnoreAspectRatio << QMatrix() << QPainterPath(); + << Qt::IgnoreAspectRatio << QTransform() << QPainterPath(); QTest::newRow("all-topleft-untransformed") << QRectF(0, 0, 150, 150) - << QRectF() << Qt::IgnoreAspectRatio << QMatrix() << QPainterPath(); + << QRectF() << Qt::IgnoreAspectRatio << QTransform() << QPainterPath(); QTest::newRow("all-topright-untransformed") << QRectF(150, 0, 150, 150) - << QRectF() << Qt::IgnoreAspectRatio << QMatrix() << QPainterPath(); + << QRectF() << Qt::IgnoreAspectRatio << QTransform() << QPainterPath(); QTest::newRow("all-bottomleft-untransformed") << QRectF(0, 150, 150, 150) - << QRectF() << Qt::IgnoreAspectRatio << QMatrix() << QPainterPath(); + << QRectF() << Qt::IgnoreAspectRatio << QTransform() << QPainterPath(); QTest::newRow("all-bottomright-untransformed") << QRectF(150, 150, 150, 150) - << QRectF() << Qt::IgnoreAspectRatio << QMatrix() << QPainterPath(); + << QRectF() << Qt::IgnoreAspectRatio << QTransform() << QPainterPath(); QTest::newRow("topleft-all-untransformed") << QRectF() << QRectF(-10, -10, 10, 10) - << Qt::IgnoreAspectRatio << QMatrix() << QPainterPath(); + << Qt::IgnoreAspectRatio << QTransform() << QPainterPath(); QTest::newRow("topright-all-untransformed") << QRectF() << QRectF(0, -10, 10, 10) - << Qt::IgnoreAspectRatio << QMatrix() << QPainterPath(); + << Qt::IgnoreAspectRatio << QTransform() << QPainterPath(); QTest::newRow("bottomleft-all-untransformed") << QRectF() << QRectF(-10, 0, 10, 10) - << Qt::IgnoreAspectRatio << QMatrix() << QPainterPath(); + << Qt::IgnoreAspectRatio << QTransform() << QPainterPath(); QTest::newRow("bottomright-all-untransformed") << QRectF() << QRectF(0, 0, 10, 10) - << Qt::IgnoreAspectRatio << QMatrix() << QPainterPath(); + << Qt::IgnoreAspectRatio << QTransform() << QPainterPath(); QTest::newRow("topleft-topleft-untransformed") << QRectF(0, 0, 150, 150) << QRectF(-10, -10, 10, 10) - << Qt::IgnoreAspectRatio << QMatrix() << QPainterPath(); + << Qt::IgnoreAspectRatio << QTransform() << QPainterPath(); QTest::newRow("topright-topleft-untransformed") << QRectF(150, 0, 150, 150) << QRectF(-10, -10, 10, 10) - << Qt::IgnoreAspectRatio << QMatrix() << QPainterPath(); + << Qt::IgnoreAspectRatio << QTransform() << QPainterPath(); QTest::newRow("bottomleft-topleft-untransformed") << QRectF(0, 150, 150, 150) << QRectF(-10, -10, 10, 10) - << Qt::IgnoreAspectRatio << QMatrix() << QPainterPath(); + << Qt::IgnoreAspectRatio << QTransform() << QPainterPath(); QTest::newRow("bottomright-topleft-untransformed") << QRectF(150, 150, 150, 150) << QRectF(-10, -10, 10, 10) - << Qt::IgnoreAspectRatio << QMatrix() << QPainterPath(); + << Qt::IgnoreAspectRatio << QTransform() << QPainterPath(); QTest::newRow("top-topleft-untransformed") << QRectF(0, 0, 300, 150) << QRectF(-10, -10, 10, 10) - << Qt::IgnoreAspectRatio << QMatrix() << QPainterPath(); + << Qt::IgnoreAspectRatio << QTransform() << QPainterPath(); QTest::newRow("bottom-topleft-untransformed") << QRectF(0, 150, 300, 150) << QRectF(-10, -10, 10, 10) - << Qt::IgnoreAspectRatio << QMatrix() << QPainterPath(); + << Qt::IgnoreAspectRatio << QTransform() << QPainterPath(); QTest::newRow("left-topleft-untransformed") << QRectF(0, 0, 150, 300) << QRectF(-10, -10, 10, 10) - << Qt::IgnoreAspectRatio << QMatrix() << QPainterPath(); + << Qt::IgnoreAspectRatio << QTransform() << QPainterPath(); QTest::newRow("right-topleft-untransformed") << QRectF(150, 0, 150, 300) << QRectF(-10, -10, 10, 10) - << Qt::IgnoreAspectRatio << QMatrix() << QPainterPath(); + << Qt::IgnoreAspectRatio << QTransform() << QPainterPath(); QTest::newRow("top-bottomright-untransformed") << QRectF(0, 0, 300, 150) << QRectF(0, 0, 10, 10) - << Qt::IgnoreAspectRatio << QMatrix() << QPainterPath(); + << Qt::IgnoreAspectRatio << QTransform() << QPainterPath(); QTest::newRow("bottom-bottomright-untransformed") << QRectF(0, 150, 300, 150) << QRectF(0, 0, 10, 10) - << Qt::IgnoreAspectRatio << QMatrix() << QPainterPath(); + << Qt::IgnoreAspectRatio << QTransform() << QPainterPath(); QTest::newRow("left-bottomright-untransformed") << QRectF(0, 0, 150, 300) << QRectF(0, 0, 10, 10) - << Qt::IgnoreAspectRatio << QMatrix() << QPainterPath(); + << Qt::IgnoreAspectRatio << QTransform() << QPainterPath(); QTest::newRow("right-bottomright-untransformed") << QRectF(150, 0, 150, 300) << QRectF(0, 0, 10, 10) - << Qt::IgnoreAspectRatio << QMatrix() << QPainterPath(); + << Qt::IgnoreAspectRatio << QTransform() << QPainterPath(); QTest::newRow("all-all-45-deg-right") << QRectF() << QRectF() - << Qt::IgnoreAspectRatio << QMatrix().rotate(-45) << QPainterPath(); + << Qt::IgnoreAspectRatio << QTransform().rotate(-45) << QPainterPath(); QTest::newRow("all-all-45-deg-left") << QRectF() << QRectF() - << Qt::IgnoreAspectRatio << QMatrix().rotate(45) << QPainterPath(); + << Qt::IgnoreAspectRatio << QTransform().rotate(45) << QPainterPath(); QTest::newRow("all-all-scale-2x") << QRectF() << QRectF() - << Qt::IgnoreAspectRatio << QMatrix().scale(2, 2) << QPainterPath(); + << Qt::IgnoreAspectRatio << QTransform::fromScale(2, 2) << QPainterPath(); QTest::newRow("all-all-translate-50-0") << QRectF() << QRectF() - << Qt::IgnoreAspectRatio << QMatrix().translate(50, 0) << QPainterPath(); + << Qt::IgnoreAspectRatio << QTransform::fromTranslate(50, 0) << QPainterPath(); QTest::newRow("all-all-translate-0-50") << QRectF() << QRectF() - << Qt::IgnoreAspectRatio << QMatrix().translate(0, 50) << QPainterPath(); + << Qt::IgnoreAspectRatio << QTransform::fromTranslate(0, 50) << QPainterPath(); QTest::newRow("all-all-untransformed-clip-rect") << QRectF() << QRectF() - << Qt::IgnoreAspectRatio << QMatrix() << clip_rect; + << Qt::IgnoreAspectRatio << QTransform() << clip_rect; QTest::newRow("all-all-untransformed-clip-ellipse") << QRectF() << QRectF() - << Qt::IgnoreAspectRatio << QMatrix() << clip_ellipse; + << Qt::IgnoreAspectRatio << QTransform() << clip_ellipse; } void tst_QGraphicsScene::render() @@ -2574,7 +2573,7 @@ void tst_QGraphicsScene::render() QFETCH(QRectF, targetRect); QFETCH(QRectF, sourceRect); QFETCH(Qt::AspectRatioMode, aspectRatioMode); - QFETCH(QMatrix, matrix); + QFETCH(QTransform, transform); QFETCH(QPainterPath, clip); QPixmap pix(30, 30); @@ -2602,7 +2601,7 @@ void tst_QGraphicsScene::render() painter.setPen(QPen(Qt::darkGray, 2)); painter.drawLine(0, 150, 300, 150); painter.drawLine(150, 0, 150, 300); - painter.setMatrix(matrix); + painter.setTransform(transform); if (!clip.isEmpty()) painter.setClipPath(clip); scene.render(&painter, targetRect, sourceRect, aspectRatioMode); painter.end(); @@ -3519,20 +3518,9 @@ void tst_QGraphicsScene::task250680_childClip() QCOMPARE(scene.items(QRectF(320, 240, 5, 5)).size(), 2); } -void tst_QGraphicsScene::sorting_data() -{ - QTest::addColumn<bool>("cache"); - - QTest::newRow("Normal sorting") << false; - QTest::newRow("Cached sorting") << true; -} - void tst_QGraphicsScene::sorting() { - QFETCH(bool, cache); - QGraphicsScene scene; - scene.setSortCacheEnabled(cache); QGraphicsRectItem *t_1 = new QGraphicsRectItem(0, 0, 50, 50); QGraphicsRectItem *c_1 = new QGraphicsRectItem(0, 0, 40, 40, t_1); diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp index 45c86800d6..6f7dca86eb 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp @@ -502,11 +502,6 @@ void tst_QAbstractItemView::basic_tests(QAbstractItemView *view) view->commitData(0); view->editorDestroyed(0); - view->setHorizontalStepsPerItem(2); - view->horizontalStepsPerItem(); - view->setVerticalStepsPerItem(2); - view->verticalStepsPerItem(); - // Will assert as it should // view->setIndexWidget(QModelIndex(), 0); diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index 12e458c669..1b3e1e1f34 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -85,7 +85,8 @@ class XResetModel : public QStandardItemModel blockSignals(true); bool r = QStandardItemModel::removeRows(row, count, parent); blockSignals(false); - emit reset(); + emit beginResetModel(); + emit endResetModel(); return r; } virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) @@ -93,7 +94,8 @@ class XResetModel : public QStandardItemModel blockSignals(true); bool r = QStandardItemModel::insertRows(row, count, parent); blockSignals(false); - emit reset(); + emit beginResetModel(); + emit endResetModel(); return r; } }; @@ -246,6 +248,7 @@ private slots: void sizeHintCrash(); void testResetCachedSizeHint(); void statusTips(); + void testRemovingColumnsViaLayoutChanged(); protected: void setupTestData(bool use_reset_model = false); @@ -253,11 +256,12 @@ protected: void calculateAndCheck(int cppline, const int precalced_comparedata[]); void testMinMaxSectionSize(bool stretchLastSection); - QWidget *topLevel; - QHeaderView *view; - QStandardItemModel *model; - QTableView *m_tableview; - bool m_using_reset_model; + QWidget *topLevel = nullptr; + QHeaderView *view = nullptr; + QStandardItemModel *model = nullptr; + QTableView *m_tableview = nullptr; + bool m_using_reset_model = false; + bool m_special_prepare = false; QElapsedTimer timer; }; @@ -350,6 +354,7 @@ public: void cleanup() { + emit layoutAboutToBeChanged(); cols = 3; rows = 3; emit layoutChanged(); @@ -620,6 +625,27 @@ void tst_QHeaderView::hidden() view->setSectionHidden(1, false); QCOMPARE(view->isSectionHidden(0), false); QCOMPARE(view->sectionSize(0), view->defaultSectionSize()); + + // d->hiddenSectionSize could go out of sync when a new model + // was set which has fewer sections than before and some of them + // were hidden + QStandardItemModel model2(model->rowCount() - 1, model->columnCount()); + + for (int i = 0; i < model->rowCount(); ++i) + view->setSectionHidden(i, true); + view->setModel(&model2); + QVERIFY(view->sectionsHidden()); + for (int i = 0; i < model2.rowCount(); ++i) { + QVERIFY(view->isSectionHidden(i)); + } + + view->setModel(model); + for (int i = 0; i < model2.rowCount(); ++i) { + QVERIFY(view->isSectionHidden(i)); + } + QCOMPARE(view->isSectionHidden(model->rowCount() - 1), false); + for (int i = 0; i < model->rowCount(); ++i) + view->setSectionHidden(i, false); } void tst_QHeaderView::stretch() @@ -2833,6 +2859,7 @@ void tst_QHeaderView::additionalInit() QFETCH(bool, reset_model); m_using_reset_model = reset_model; + m_special_prepare = special_prepare; if (m_using_reset_model) { XResetModel *m = new XResetModel(); @@ -3046,18 +3073,34 @@ void tst_QHeaderView::mixedTests() view->moveSection(0, 5); for (int u = model->rowCount(); u >= 0; --u) { - if (u % 5 != 0) + if (u % 5 != 0) { view->hideSection(u); - if (u % 3 != 0) + QVERIFY(view->isSectionHidden(u)); + } + if (u % 3 != 0) { view->showSection(u); + QVERIFY(!view->isSectionHidden(u)); + } } model->insertRows(3, 7); model->removeRows(8, 3); model->setRowCount(model->rowCount() - 10); + // the upper is not visible (when m_using_reset_model is true) + // the lower 11 are modified due to insert/removeRows + for (int u = model->rowCount() - 1; u >= 11; --u) { + // when using reset, the hidden rows will *not* move + const int calcMod = m_using_reset_model ? u : u - 4; // 7 added, 3 removed + if (calcMod % 5 != 0 && calcMod % 3 == 0) { + QVERIFY(view->isSectionHidden(u)); + } + if (calcMod % 3 != 0) { + QVERIFY(!view->isSectionHidden(u)); + } + } if (m_using_reset_model) { - const int precalced_results[] = { 898296472, 337096378, -543340640, 1, -1251526424, -568618976, 9250 }; + const int precalced_results[] = { 898296472, 337096378, -543340640, -1964432121, -1251526424, -568618976, 9250 }; calculateAndCheck(__LINE__, precalced_results); } else { const int precalced_results[] = { 1911338224, 1693514365, -613398968, -1912534953, 1582159424, -1851079000, 9300 }; @@ -3448,5 +3491,20 @@ void tst_QHeaderView::statusTips() QCOMPARE(headerView.statusTipText, QLatin1String("[0,1,0] -- Header")); } +void tst_QHeaderView::testRemovingColumnsViaLayoutChanged() +{ + const int persistentSectionSize = 101; + + QtTestModel model; + model.rows = model.cols = 5; + view->setModel(&model); + for (int i = 0; i < model.cols; ++i) + view->resizeSection(i, persistentSectionSize + i); + model.cleanup(); // down to 3 via layoutChanged (not columnsRemoved) + for (int j = 0; j < model.cols; ++j) + QCOMPARE(view->sectionSize(j), persistentSectionSize + j); + // The main point of this test is that the section-size restoring code didn't go out of bounds. +} + QTEST_MAIN(tst_QHeaderView) #include "tst_qheaderview.moc" diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp index aa11ed709f..7fd1822295 100644 --- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp +++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp @@ -1228,7 +1228,7 @@ void tst_QItemDelegate::editorEvent() option.checkState = Qt::CheckState(checkState); const int checkMargin = qApp->style()->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, 0) + 1; - QPoint pos = inCheck ? qApp->style()->subElementRect(QStyle::SE_ViewItemCheckIndicator, &option, 0).center() + QPoint(checkMargin, 0) : QPoint(200,200); + QPoint pos = inCheck ? qApp->style()->subElementRect(QStyle::SE_ItemViewItemCheckIndicator, &option, 0).center() + QPoint(checkMargin, 0) : QPoint(200,200); QEvent *event = new QMouseEvent((QEvent::Type)type, pos, @@ -1384,7 +1384,7 @@ void tst_QItemDelegate::QTBUG4435_keepSelectionOnCheck() option.features = QStyleOptionViewItem::HasDisplay | QStyleOptionViewItem::HasCheckIndicator; option.checkState = Qt::CheckState(model.index(0, 0).data(Qt::CheckStateRole).toInt()); const int checkMargin = qApp->style()->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, 0) + 1; - QPoint pos = qApp->style()->subElementRect(QStyle::SE_ViewItemCheckIndicator, &option, 0).center() + QPoint pos = qApp->style()->subElementRect(QStyle::SE_ItemViewItemCheckIndicator, &option, 0).center() + QPoint(checkMargin, 0); QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::ControlModifier, pos); QTRY_VERIFY(view.selectionModel()->isColumnSelected(0, QModelIndex())); diff --git a/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp b/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp index bbdaac5c6f..071665a5e3 100644 --- a/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp +++ b/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp @@ -249,7 +249,7 @@ void tst_QItemView::populate() for (int y = 0; y < treeModel->columnCount(); ++y) { QModelIndex index = treeModel->index(x, y, parent); treeModel->setData(index, xS + QLatin1Char('_') + QString::number(y) + QLatin1Char('_') + iS); - treeModel->setData(index, QVariant(QColor(Qt::blue)), Qt::TextColorRole); + treeModel->setData(index, QVariant(QColor(Qt::blue)), Qt::ForegroundRole); } } } diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp index 9511654110..0b828b8484 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -891,6 +891,10 @@ void tst_QListView::setCurrentIndex() } } } + while (model.rowCount()) { + view.setCurrentIndex(model.index(model.rowCount() - 1, 0)); + model.removeRow(model.rowCount() - 1); + } } class PublicListView : public QListView diff --git a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp index 98b44fe8aa..91088aeeca 100644 --- a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp +++ b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp @@ -31,6 +31,7 @@ #include <QtGui/QtGui> #include <QtWidgets/QtWidgets> #include <qlist.h> +#include <QSignalSpy> #include <qlistwidget.h> #include <private/qlistwidget_p.h> @@ -116,6 +117,14 @@ private slots: void QTBUG14363_completerWithAnyKeyPressedEditTriggers(); void mimeData(); void QTBUG50891_ensureSelectionModelSignalConnectionsAreSet(); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + void clearItemData(); +#endif + + void moveRows_data(); + void moveRows(); + void moveRowsInvalid_data(); + void moveRowsInvalid(); protected slots: void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last) @@ -148,6 +157,108 @@ private: }; +void tst_QListWidget::moveRowsInvalid_data() +{ + QTest::addColumn<QListWidget*>("baseWidget"); + QTest::addColumn<QModelIndex>("startParent"); + QTest::addColumn<int>("startRow"); + QTest::addColumn<int>("count"); + QTest::addColumn<QModelIndex>("destinationParent"); + QTest::addColumn<int>("destination"); + + const auto createWidget = []() -> QListWidget* { + QListWidget* result = new QListWidget; + result->addItems(QStringList{"A", "B", "C", "D", "E", "F"}); + return result; + }; + + QTest::addRow("destination_equal_source") << createWidget() << QModelIndex() << 0 << 1 << QModelIndex() << 1; + QTest::addRow("count_equal_0") << createWidget() << QModelIndex() << 0 << 0 << QModelIndex() << 2; + QListWidget* tempWidget = createWidget(); + QTest::addRow("move_child") << tempWidget << tempWidget->model()->index(0, 0) << 0 << 1 << QModelIndex() << 2; + tempWidget = createWidget(); + QTest::addRow("move_to_child") << tempWidget << QModelIndex() << 0 << 1 << tempWidget->model()->index(0, 0) << 2; + QTest::addRow("negative_count") << createWidget() << QModelIndex() << 0 << -1 << QModelIndex() << 2; + QTest::addRow("negative_source_row") << createWidget() << QModelIndex() << -1 << 1 << QModelIndex() << 2; + QTest::addRow("negative_destination_row") << createWidget() << QModelIndex() << 0 << 1 << QModelIndex() << -1; + QTest::addRow("source_row_equal_rowCount") << createWidget() << QModelIndex() << 6 << 1 << QModelIndex() << 1; + QTest::addRow("destination_row_greater_rowCount") << createWidget() << QModelIndex() << 0 << 1 << QModelIndex() << 6 + 1; + QTest::addRow("move_row_within_source_range") << createWidget() << QModelIndex() << 0 << 3 << QModelIndex() << 2; + QTest::addRow("destination_row_before_0") << createWidget() << QModelIndex() << 1 << 1 << QModelIndex() << 0; +} + +void tst_QListWidget::moveRowsInvalid() +{ + QFETCH(QListWidget* const, baseWidget); + QFETCH(const QModelIndex, startParent); + QFETCH(const int, startRow); + QFETCH(const int, count); + QFETCH(const QModelIndex, destinationParent); + QFETCH(const int, destination); + QAbstractItemModel *baseModel = baseWidget->model(); + QSignalSpy rowMovedSpy(baseModel, &QAbstractItemModel::rowsMoved); + QSignalSpy rowAboutMovedSpy(baseModel, &QAbstractItemModel::rowsAboutToBeMoved); + QVERIFY(rowMovedSpy.isValid()); + QVERIFY(rowAboutMovedSpy.isValid()); + QVERIFY(!baseModel->moveRows(startParent, startRow, count, destinationParent, destination)); + QCOMPARE(rowMovedSpy.size(), 0); + QCOMPARE(rowAboutMovedSpy.size(), 0); + delete baseWidget; +} + +void tst_QListWidget::moveRows_data() +{ + QTest::addColumn<int>("startRow"); + QTest::addColumn<int>("count"); + QTest::addColumn<int>("destination"); + QTest::addColumn<QStringList>("expected"); + + QTest::newRow("1_Item_from_top_to_middle") << 0 << 1 << 3 << QStringList{"B", "C", "A", "D", "E", "F"}; + QTest::newRow("1_Item_from_top_to_bottom") << 0 << 1 << 6 << QStringList{"B", "C", "D", "E", "F", "A"}; + QTest::newRow("1_Item_from_middle_to_top") << 2 << 1 << 1 << QStringList{"C", "A", "B", "D", "E", "F"}; + QTest::newRow("1_Item_from_bottom_to_middle") << 5 << 1 << 3 << QStringList{"A", "B", "F", "C", "D", "E"}; + QTest::newRow("1_Item_from_bottom to_top") << 5 << 1 << 1 << QStringList{"F", "A", "B", "C", "D", "E"}; + QTest::newRow("1_Item_from_middle_to_bottom") << 2 << 1 << 6 << QStringList{"A", "B", "D", "E", "F", "C"}; + QTest::newRow("1_Item_from_middle_to_middle_before") << 2 << 1 << 1 << QStringList{"C", "A", "B", "D", "E", "F"}; + QTest::newRow("1_Item_from_middle_to_middle_after") << 2 << 1 << 4 << QStringList{"A", "B", "D", "C", "E", "F"}; + + QTest::newRow("2_Items_from_top_to_middle") << 0 << 2 << 3 << QStringList{"C", "A", "B", "D", "E", "F"}; + QTest::newRow("2_Items_from_top_to_bottom") << 0 << 2 << 6 << QStringList{"C", "D", "E", "F", "A", "B"}; + QTest::newRow("2_Items_from_middle_to_top") << 2 << 2 << 1 << QStringList{"C", "D", "A", "B", "E", "F"}; + QTest::newRow("2_Items_from_bottom_to_middle") << 4 << 2 << 3 << QStringList{"A", "B", "E", "F", "C", "D"}; + QTest::newRow("2_Items_from_bottom_to_top") << 4 << 2 << 1 << QStringList{"E", "F", "A", "B", "C", "D"}; + QTest::newRow("2_Items_from_middle_to_bottom") << 2 << 2 << 6 << QStringList{"A", "B", "E", "F", "C", "D"}; + QTest::newRow("2_Items_from_middle_to_middle_before") << 3 << 2 << 2 << QStringList{"A", "D", "E", "B", "C", "F"}; + QTest::newRow("2_Items_from_middle_to_middle_after") << 1 << 2 << 5 << QStringList{"A", "D", "E", "B", "C", "F"}; +} + +void tst_QListWidget::moveRows() +{ + QFETCH(const int, startRow); + QFETCH(const int, count); + QFETCH(const int, destination); + QFETCH(const QStringList, expected); + QListWidget baseWidget; + baseWidget.addItems(QStringList{"A", "B", "C", "D", "E", "F"}); + QAbstractItemModel *baseModel = baseWidget.model(); + QSignalSpy rowMovedSpy(baseModel, &QAbstractItemModel::rowsMoved); + QSignalSpy rowAboutMovedSpy(baseModel, &QAbstractItemModel::rowsAboutToBeMoved); + QVERIFY(baseModel->moveRows(QModelIndex(), startRow, count, QModelIndex(), destination)); + QCOMPARE(baseModel->rowCount(), expected.size()); + for (int i = 0; i < expected.size(); ++i) + QCOMPARE(baseModel->index(i, 0).data().toString(), expected.at(i)); + QCOMPARE(rowMovedSpy.size(), 1); + QCOMPARE(rowAboutMovedSpy.size(), 1); + for (const QList<QVariant> &signalArgs : {rowMovedSpy.first(), rowAboutMovedSpy.first()}){ + QVERIFY(!signalArgs.at(0).value<QModelIndex>().isValid()); + QCOMPARE(signalArgs.at(1).toInt(), startRow); + QCOMPARE(signalArgs.at(2).toInt(), startRow + count - 1); + QVERIFY(!signalArgs.at(3).value<QModelIndex>().isValid()); + QCOMPARE(signalArgs.at(4).toInt(), destination); + } +} + + typedef QList<int> IntList; tst_QListWidget::tst_QListWidget(): testWidget(0), rcParent(8), rcFirst(8,0), rcLast(8,0) @@ -156,6 +267,7 @@ tst_QListWidget::tst_QListWidget(): testWidget(0), rcParent(8), rcFirst(8,0), rc void tst_QListWidget::initTestCase() { + qRegisterMetaType<QListWidgetItem*>("QListWidgetItem*"); testWidget = new QListWidget(); testWidget->show(); @@ -233,7 +345,7 @@ void tst_QListWidget::addItem2() testWidget->addItem(item); QCOMPARE(testWidget->count(), ++count); QCOMPARE(testWidget->item(testWidget->count()-1), item); - QCOMPARE(testWidget->isItemHidden(item), false); + QCOMPARE(item->isHidden(), false); } void tst_QListWidget::addItems() @@ -291,13 +403,18 @@ void tst_QListWidget::closePersistentEditor() void tst_QListWidget::setItemHidden() { +#if QT_DEPRECATED_SINCE(5, 13) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED // Boundary checking - testWidget->setItemHidden(0, true); - testWidget->setItemHidden(0, false); + testWidget->setItemHidden(nullptr, true); + testWidget->setItemHidden(nullptr, false); +QT_WARNING_POP +#endif int totalHidden = 0; for (int i = 0; i < testWidget->model()->rowCount(); ++i) - if (testWidget->isItemHidden(testWidget->item(i))) + if (testWidget->item(i)->isHidden()) totalHidden++; QListWidgetItem *item = new QListWidgetItem(QString::number(testWidget->count())); @@ -306,31 +423,31 @@ void tst_QListWidget::setItemHidden() // Check that nothing else changed int newTotal = 0; for (int i = 0; i < testWidget->model()->rowCount(); ++i) - if (testWidget->isItemHidden(testWidget->item(i))) + if (testWidget->item(i)->isHidden()) newTotal++; QCOMPARE(newTotal, totalHidden); - testWidget->setItemHidden(item, true); - QCOMPARE(testWidget->isItemHidden(item), true); + item->setHidden(true); + QCOMPARE(item->isHidden(), true); // Check that nothing else changed newTotal = 0; for (int i = 0; i < testWidget->model()->rowCount(); ++i) - if (testWidget->isItemHidden(testWidget->item(i))) + if (testWidget->item(i)->isHidden()) newTotal++; QCOMPARE(newTotal, totalHidden + 1); - testWidget->setItemHidden(item, false); - QCOMPARE(testWidget->isItemHidden(item), false); + item->setHidden(false); + QCOMPARE(item->isHidden(), false); // Check that nothing else changed newTotal = 0; for (int i = 0; i < testWidget->model()->rowCount(); ++i) - if (testWidget->isItemHidden(testWidget->item(i))) + if (testWidget->item(i)->isHidden()) newTotal++; QCOMPARE(newTotal, totalHidden); - testWidget->setItemHidden(item, true); + item->setHidden(true); } void tst_QListWidget::setCurrentItem_data() @@ -547,6 +664,9 @@ void tst_QListWidget::insertItems() QFETCH(int, rowCount); QFETCH(int, insertType); + QSignalSpy itemChangedSpy(testWidget, &QListWidget::itemChanged); + QSignalSpy dataChangedSpy(testWidget->model(), &QAbstractItemModel::dataChanged); + if (insertType == 3) { QStringList strings; for (int i=0; i<rowCount; ++i) @@ -584,6 +704,9 @@ void tst_QListWidget::insertItems() // make sure all items have view set correctly for (int i=0; i<testWidget->count(); ++i) QCOMPARE(testWidget->item(i)->listWidget(), testWidget); + + QCOMPARE(itemChangedSpy.count(), 0); + QCOMPARE(dataChangedSpy.count(), 0); } void tst_QListWidget::itemAssignment() @@ -736,7 +859,7 @@ void tst_QListWidget::selectedItems() testWidget->setSelectionMode(QListWidget::SingleSelection); for (int i=0; i<itemCount; ++i) { QListWidgetItem *item = testWidget->item(i); - testWidget->setItemSelected(item, true); + item->setSelected(true); QVERIFY(item->isSelected()); QCOMPARE(testWidget->selectedItems().count(), 1); } @@ -749,10 +872,10 @@ void tst_QListWidget::selectedItems() QCOMPARE(testWidget->count(), itemCount); // hide items foreach (int row, hiddenRows) - testWidget->setItemHidden(testWidget->item(row), true); + testWidget->item(row)->setHidden(true); // select items foreach (int row, selectedRows) - testWidget->setItemSelected(testWidget->item(row), true); + testWidget->item(row)->setSelected(true); // check that the correct number of items and the expected items are there QList<QListWidgetItem *> selectedItems = testWidget->selectedItems(); @@ -763,7 +886,7 @@ void tst_QListWidget::selectedItems() //check that isSelected agrees with selectedItems for (int i=0; i<itemCount; ++i) { QListWidgetItem *item = testWidget->item(i); - if (testWidget->isItemSelected(item)) + if (item->isSelected()) QVERIFY(selectedItems.contains(item)); } } @@ -1141,7 +1264,6 @@ void tst_QListWidget::setData() QFETCH(IntList, roles); QFETCH(QVariantList, values); QFETCH(int, expectedSignalCount); - qRegisterMetaType<QListWidgetItem *>("QListWidgetItem*"); QCOMPARE(roles.count(), values.count()); @@ -1599,7 +1721,6 @@ void tst_QListWidget::task258949_keypressHangup() void tst_QListWidget::QTBUG8086_currentItemChangedOnClick() { - qRegisterMetaType<QListWidgetItem*>("QListWidgetItem*"); QWidget win; QHBoxLayout layout(&win); QListWidget list; @@ -1721,7 +1842,6 @@ void tst_QListWidget::mimeData() void tst_QListWidget::QTBUG50891_ensureSelectionModelSignalConnectionsAreSet() { - qRegisterMetaType<QListWidgetItem*>("QListWidgetItem*"); QListWidget list; for (int i = 0 ; i < 4; ++i) new QListWidgetItem(QString::number(i), &list); @@ -1743,5 +1863,27 @@ void tst_QListWidget::QTBUG50891_ensureSelectionModelSignalConnectionsAreSet() } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +void tst_QListWidget::clearItemData() +{ + QListWidget list; + for (int i = 0 ; i < 4; ++i) + new QListWidgetItem(QString::number(i), &list); + QSignalSpy dataChangeSpy(list.model(), &QAbstractItemModel::dataChanged); + QVERIFY(dataChangeSpy.isValid()); + QVERIFY(!list.model()->clearItemData(QModelIndex())); + QCOMPARE(dataChangeSpy.size(), 0); + QVERIFY(list.model()->clearItemData(list.model()->index(0, 0))); + QVERIFY(!list.model()->index(0, 0).data().isValid()); + QCOMPARE(dataChangeSpy.size(), 1); + const QList<QVariant> dataChangeArgs = dataChangeSpy.takeFirst(); + QCOMPARE(dataChangeArgs.at(0).value<QModelIndex>(), list.model()->index(0, 0)); + QCOMPARE(dataChangeArgs.at(1).value<QModelIndex>(), list.model()->index(0, 0)); + QVERIFY(dataChangeArgs.at(2).value<QVector<int>>().isEmpty()); + QVERIFY(list.model()->clearItemData(list.model()->index(0, 0))); + QCOMPARE(dataChangeSpy.size(), 0); +} +#endif + QTEST_MAIN(tst_QListWidget) #include "tst_qlistwidget.moc" diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp index 1b95b5a3ca..b1ddc6e7a2 100644 --- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp +++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp @@ -2534,7 +2534,6 @@ void tst_QTableView::columnViewportPosition() view.horizontalScrollBar()->setValue(horizontalScrollValue); #ifdef Q_OS_WINRT - QEXPECT_FAIL("column 1, scroll per item, 1", "Fails on WinRT - QTBUG-68297", Abort); QEXPECT_FAIL("column 5, scroll per item, 5", "Fails on WinRT - QTBUG-68297", Abort); QEXPECT_FAIL("column 9, scroll per item, 5", "Fails on WinRT - QTBUG-68297", Abort); QEXPECT_FAIL("column 1, scroll per pixel 1", "Fails on WinRT - QTBUG-68297", Abort); @@ -4254,7 +4253,7 @@ void tst_QTableView::task234926_setHeaderSorting() QStringList sortedDataA = data; QStringList sortedDataD = data; std::sort(sortedDataA.begin(), sortedDataA.end()); - std::sort(sortedDataD.begin(), sortedDataD.end(), qGreater<QString>()); + std::sort(sortedDataD.begin(), sortedDataD.end(), std::greater<QString>()); model.setStringList(data); QTableView view; view.setModel(&model); diff --git a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp index 4155ff1ec6..c2de5c2761 100644 --- a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp +++ b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp @@ -83,12 +83,18 @@ private slots: void setItemData(); void cellWidget(); void cellWidgetGeometry(); + void sizeHint_data(); + void sizeHint(); void task231094(); void task219380_removeLastRow(); void task262056_sortDuplicate(); void itemWithHeaderItems(); void mimeData(); void selectedRowAfterSorting(); + void search(); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + void clearItemData(); +#endif private: QTableWidget *testWidget; @@ -159,6 +165,7 @@ void tst_QTableWidget::initTestCase() { testWidget = new QTableWidget(); testWidget->show(); + QApplication::setKeyboardInputInterval(100); } void tst_QTableWidget::cleanupTestCase() @@ -191,10 +198,10 @@ void tst_QTableWidget::clear() { QTableWidgetItem *item = new QTableWidgetItem("foo"); testWidget->setItem(0, 0, item); - testWidget->setItemSelected(item, true); + item->setSelected(true); QVERIFY(testWidget->item(0, 0) == item); - QVERIFY(testWidget->isItemSelected(item)); + QVERIFY(item->isSelected()); QPointer<QObjectTableItem> bla = new QObjectTableItem(); @@ -578,7 +585,7 @@ void tst_QTableWidget::selectedItems() continue; QTableWidgetItem *item = testWidget->item(row, column); - if (item && testWidget->isItemSelected(item)) + if (item && item->isSelected()) QVERIFY(selectedItems.contains(item)); } } @@ -1454,6 +1461,56 @@ void tst_QTableWidget::cellWidgetGeometry() QCOMPARE(tw.visualItemRect(item).top(), le->geometry().top()); } +void tst_QTableWidget::sizeHint_data() +{ + QTest::addColumn<int>("scrollBarPolicy"); + QTest::addColumn<QSize>("viewSize"); + QTest::newRow("ScrollBarAlwaysOn") << static_cast<int>(Qt::ScrollBarAlwaysOn) << QSize(); + QTest::newRow("ScrollBarAlwaysOff") << static_cast<int>(Qt::ScrollBarAlwaysOff) << QSize(); + // make sure the scrollbars are shown by resizing the view to 40x40 + QTest::newRow("ScrollBarAsNeeded (40x40)") << static_cast<int>(Qt::ScrollBarAsNeeded) << QSize(40, 40); + QTest::newRow("ScrollBarAsNeeded (1000x1000)") << static_cast<int>(Qt::ScrollBarAsNeeded) << QSize(1000, 1000); +} + +void tst_QTableWidget::sizeHint() +{ + QFETCH(int, scrollBarPolicy); + QFETCH(QSize, viewSize); + + QTableWidget view(2, 2); + view.setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents); + view.setVerticalScrollBarPolicy(static_cast<Qt::ScrollBarPolicy>(scrollBarPolicy)); + view.setHorizontalScrollBarPolicy(static_cast<Qt::ScrollBarPolicy>(scrollBarPolicy)); + for (int r = 0 ; r < view.rowCount(); ++r) + for (int c = 0 ; c < view.columnCount(); ++c) + view.setItem(r, c, new QTableWidgetItem(QString("%1/%2").arg(r).arg(c))); + + view.show(); + QVERIFY(QTest::qWaitForWindowExposed(&view)); + if (viewSize.isValid()) { + view.resize(viewSize); + view.setColumnWidth(0, 100); + view.setRowHeight(0, 100); + QTRY_COMPARE(view.size(), viewSize); + } + + auto sizeHint = view.sizeHint(); + view.hide(); + QCOMPARE(view.sizeHint(), sizeHint); + + view.horizontalHeader()->hide(); + view.show(); + sizeHint = view.sizeHint(); + view.hide(); + QCOMPARE(view.sizeHint(), sizeHint); + + view.verticalHeader()->hide(); + view.show(); + sizeHint = view.sizeHint(); + view.hide(); + QCOMPARE(view.sizeHint(), sizeHint); +} + void tst_QTableWidget::task231094() { QTableWidget tw(5, 3); @@ -1510,7 +1567,7 @@ void tst_QTableWidget::task262056_sortDuplicate() } testWidget->sortItems(0, Qt::AscendingOrder); QSignalSpy layoutChangedSpy(testWidget->model(), SIGNAL(layoutChanged())); - testWidget->item(3,0)->setBackgroundColor(Qt::red); + testWidget->item(3,0)->setBackground(Qt::red); QCOMPARE(layoutChangedSpy.count(),0); @@ -1543,6 +1600,7 @@ public: using QTableWidget::mimeData; using QTableWidget::indexFromItem; + using QTableWidget::keyPressEvent; }; void tst_QTableWidget::mimeData() @@ -1617,5 +1675,67 @@ void tst_QTableWidget::selectedRowAfterSorting() } } +void tst_QTableWidget::search() +{ + auto createItem = [](const QString &txt) + { + auto item = new QTableWidgetItem(txt); + item->setFlags(item->flags().setFlag(Qt::ItemIsEditable, false)); + return item; + }; + + auto checkSeries = [](TestTableWidget &tw, const QVector<QPair<QKeyEvent, int>> &series) + { + for (const auto &p : series) { + QKeyEvent e = p.first; + tw.keyPressEvent(&e); + QVERIFY(tw.selectionModel()->isSelected(tw.model()->index(p.second, 0))); + } + }; + TestTableWidget tw(5, 1); + tw.setItem(0, 0, createItem("12")); + tw.setItem(1, 0, createItem("123")); + tw.setItem(2, 0, createItem("123 4")); + tw.setItem(3, 0, createItem("123 5")); + tw.setItem(4, 0, createItem(" ")); + tw.show(); + + QKeyEvent evSpace(QEvent::KeyPress, Qt::Key_Space, Qt::NoModifier, " "); + QKeyEvent ev1(QEvent::KeyPress, Qt::Key_1, Qt::NoModifier, "1"); + QKeyEvent ev2(QEvent::KeyPress, Qt::Key_2, Qt::NoModifier, "2"); + QKeyEvent ev3(QEvent::KeyPress, Qt::Key_3, Qt::NoModifier, "3"); + QKeyEvent ev4(QEvent::KeyPress, Qt::Key_4, Qt::NoModifier, "4"); + QKeyEvent ev5(QEvent::KeyPress, Qt::Key_5, Qt::NoModifier, "5"); + + checkSeries(tw, {{evSpace, 4}, {ev1, 4}}); + QTest::qWait(QApplication::keyboardInputInterval() * 2); + checkSeries(tw, {{ev1, 0}, {ev2, 0}, {ev3, 1}, {evSpace, 2}, {ev5, 3}}); + QTest::qWait(QApplication::keyboardInputInterval() * 2); + checkSeries(tw, {{ev1, 0}, {ev2, 0}, {ev3, 1}, {evSpace, 2}, {ev4, 2}}); +} + +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +void tst_QTableWidget::clearItemData() +{ + QTableWidget table(3,3); + for (int r = 0; r < 3; r++) + for (int c = 0; c < 3; c++) + table.setItem(r,c,new QTableWidgetItem(QStringLiteral("0"))); + QSignalSpy dataChangeSpy(table.model(), &QAbstractItemModel::dataChanged); + QVERIFY(dataChangeSpy.isValid()); + QVERIFY(!table.model()->clearItemData(QModelIndex())); + QCOMPARE(dataChangeSpy.size(), 0); + QVERIFY(table.model()->clearItemData(table.model()->index(0, 0))); + QVERIFY(!table.model()->index(0, 0).data().isValid()); + QCOMPARE(dataChangeSpy.size(), 1); + const QList<QVariant> dataChangeArgs = dataChangeSpy.takeFirst(); + QCOMPARE(dataChangeArgs.at(0).value<QModelIndex>(), table.model()->index(0, 0)); + QCOMPARE(dataChangeArgs.at(1).value<QModelIndex>(), table.model()->index(0, 0)); + QVERIFY(dataChangeArgs.at(2).value<QVector<int>>().isEmpty()); + QVERIFY(table.model()->clearItemData(table.model()->index(0, 0))); + QCOMPARE(dataChangeSpy.size(), 0); +} +#endif + QTEST_MAIN(tst_QTableWidget) #include "tst_qtablewidget.moc" diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index a9858ae420..c31de2ba22 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -69,6 +69,7 @@ public slots: void selectionOrderTest(); private slots: + void initTestCase() { QApplication::setKeyboardInputInterval(100); } void getSetCheck(); // one test per QTreeView property @@ -1648,50 +1649,96 @@ void tst_QTreeView::expandAndCollapse() } } +static void checkExpandState(const QAbstractItemModel &model, const QTreeView &view, + const QModelIndex &startIdx, bool bIsExpanded, int *count) +{ + *count = 0; + QStack<QModelIndex> parents; + parents.push(startIdx); + if (startIdx.isValid()) { + QCOMPARE(view.isExpanded(startIdx), bIsExpanded); + *count += 1; + } + while (!parents.isEmpty()) { + const QModelIndex p = parents.pop(); + const int rows = model.rowCount(p); + for (int r = 0; r < rows; ++r) { + const QModelIndex c = model.index(r, 0, p); + QCOMPARE(view.isExpanded(c), bIsExpanded); + parents.push(c); + } + *count += rows; + } +} + void tst_QTreeView::expandAndCollapseAll() { - QtTestModel model(3, 2); - model.levels = 2; + QStandardItemModel model; + // QtTestModel has a broken parent/child handling which will break the test + for (int i1 = 0; i1 < 3; ++i1) { + QStandardItem *s1 = new QStandardItem; + s1->setText(QString::number(i1)); + model.appendRow(s1); + for (int i2 = 0; i2 < 3; ++i2) { + QStandardItem *s2 = new QStandardItem; + s2->setText(QStringLiteral("%1 - %2").arg(i1).arg(i2)); + s1->appendRow(s2); + for (int i3 = 0; i3 < 3; ++i3) { + QStandardItem *s3 = new QStandardItem; + s3->setText(QStringLiteral("%1 - %2 - %3").arg(i1).arg(i2).arg(i3)); + s2->appendRow(s3); + } + } + } QTreeView view; view.setUniformRowHeights(true); view.setModel(&model); + view.show(); + QVERIFY(QTest::qWaitForWindowExposed(&view)); - QSignalSpy expandedSpy(&view, SIGNAL(expanded(QModelIndex))); - QSignalSpy collapsedSpy(&view, SIGNAL(collapsed(QModelIndex))); + QSignalSpy expandedSpy(&view, &QTreeView::expanded); + QSignalSpy collapsedSpy(&view, &QTreeView::collapsed); + int count; view.expandAll(); - view.show(); - + checkExpandState(model, view, QModelIndex(), true, &count); QCOMPARE(collapsedSpy.count(), 0); + QCOMPARE(expandedSpy.count(), 39); // == 3 (first) + 9 (second) + 27 (third level) + QCOMPARE(count, 39); - QStack<QModelIndex> parents; - parents.push(QModelIndex()); - int count = 0; - while (!parents.isEmpty()) { - QModelIndex p = parents.pop(); - int rows = model.rowCount(p); - for (int r = 0; r < rows; ++r) - QVERIFY(view.isExpanded(model.index(r, 0, p))); - count += rows; - for (int r = 0; r < rows; ++r) - parents.push(model.index(r, 0, p)); - } - QCOMPARE(expandedSpy.count(), 12); // == (3+1)*(2+1) from QtTestModel model(3, 2); - + collapsedSpy.clear(); + expandedSpy.clear(); view.collapseAll(); - - parents.push(QModelIndex()); - count = 0; - while (!parents.isEmpty()) { - QModelIndex p = parents.pop(); - int rows = model.rowCount(p); - for (int r = 0; r < rows; ++r) - QVERIFY(!view.isExpanded(model.index(r, 0, p))); - count += rows; - for (int r = 0; r < rows; ++r) - parents.push(model.index(r, 0, p)); - } - QCOMPARE(collapsedSpy.count(), 12); + checkExpandState(model, view, QModelIndex(), false, &count); + QCOMPARE(collapsedSpy.count(), 39); + QCOMPARE(expandedSpy.count(), 0); + QCOMPARE(count, 39); + + collapsedSpy.clear(); + expandedSpy.clear(); + view.expandRecursively(model.index(0, 0)); + QCOMPARE(expandedSpy.count(), 13); // 1 + 3 + 9 + + checkExpandState(model, view, model.index(0, 0), true, &count); + QCOMPARE(count, 13); + checkExpandState(model, view, model.index(1, 0), false, &count); + QCOMPARE(count, 13); + checkExpandState(model, view, model.index(2, 0), false, &count); + QCOMPARE(count, 13); + + expandedSpy.clear(); + view.collapseAll(); + view.expandRecursively(model.index(0, 0), 1); + QCOMPARE(expandedSpy.count(), 4); // 1 + 3 + view.expandRecursively(model.index(0, 0), 2); + QCOMPARE(expandedSpy.count(), 13); // (1 + 3) + 9 + + checkExpandState(model, view, model.index(0, 0), true, &count); + QCOMPARE(count, 13); + checkExpandState(model, view, model.index(1, 0), false, &count); + QCOMPARE(count, 13); + checkExpandState(model, view, model.index(2, 0), false, &count); + QCOMPARE(count, 13); } void tst_QTreeView::expandWithNoChildren() @@ -1750,7 +1797,7 @@ void tst_QTreeView::keyboardNavigation() case Qt::Key_Down: if (view.isExpanded(index)) { row = 0; - index = index.child(row, column); + index = model.index(row, column, index); } else { row = qMin(rows - 1, row + 1); index = index.sibling(row, column); @@ -2436,6 +2483,8 @@ void tst_QTreeView::selection() for (int i = 0;i < 10; ++i) m.setData(m.index(i, 0), i); treeView.setModel(&m); + treeView.show(); + QVERIFY(QTest::qWaitForWindowExposed(&treeView)); treeView.setSelectionBehavior(QAbstractItemView::SelectRows); treeView.setSelectionMode(QAbstractItemView::ExtendedSelection); @@ -2447,6 +2496,13 @@ void tst_QTreeView::selection() QTest::mousePress(treeView.viewport(), Qt::LeftButton, 0, treeView.visualRect(m.index(1, 0)).center()); QTest::keyPress(treeView.viewport(), Qt::Key_Down); + auto selectedRows = treeView.selectionModel()->selectedRows(); + QCOMPARE(selectedRows.size(), 1); + QCOMPARE(selectedRows.first(), m.index(2, 0, QModelIndex())); + QTest::keyPress(treeView.viewport(), Qt::Key_5); + selectedRows = treeView.selectionModel()->selectedRows(); + QCOMPARE(selectedRows.size(), 1); + QCOMPARE(selectedRows.first(), m.index(5, 0, QModelIndex())); } //From task 151686 QTreeView ExtendedSelection selects hidden rows @@ -2738,7 +2794,7 @@ void tst_QTreeView::sortByColumn() view.setSortingEnabled(sortingEnabled); view.setModel(&model); - view.sortByColumn(1); + view.sortByColumn(1, Qt::DescendingOrder); QCOMPARE(view.header()->sortIndicatorSection(), 1); QCOMPARE(view.model()->data(view.model()->index(0,1)).toString(), QString::fromLatin1("h")); QCOMPARE(view.model()->data(view.model()->index(1,1)).toString(), QString::fromLatin1("g")); @@ -3048,7 +3104,7 @@ void tst_QTreeView::evilModel() view.resizeColumnToContents(1); model.change(); - view.sortByColumn(1); + view.sortByColumn(1, Qt::DescendingOrder); model.change(); view.selectAll(); @@ -3892,7 +3948,7 @@ void tst_QTreeView::task254234_proxySort() model.setItem(2,1,new QStandardItem("h")); model.setItem(3,1,new QStandardItem("f")); - view.sortByColumn(1); + view.sortByColumn(1, Qt::DescendingOrder); view.setSortingEnabled(true); QSortFilterProxyModel proxy; @@ -4080,6 +4136,30 @@ void tst_QTreeView::keyboardNavigationWithDisabled() QCOMPARE(view.currentIndex(), model.index(12, 0)); QTest::keyClick(view.viewport(), Qt::Key_Up); QCOMPARE(view.currentIndex(), model.index(6, 0)); + // QTBUG-44746 - when first/last item is disabled, + // Key_PageUp/Down/Home/End will not work as expected. + model.item(0)->setEnabled(false); + model.item(1)->setEnabled(true); + model.item(2)->setEnabled(true); + model.item(model.rowCount() - 1)->setEnabled(false); + model.item(model.rowCount() - 2)->setEnabled(true); + model.item(model.rowCount() - 3)->setEnabled(true); + // PageUp + view.setCurrentIndex(model.index(2, 0)); + QCOMPARE(view.currentIndex(), model.index(2, 0)); + QTest::keyClick(view.viewport(), Qt::Key_PageUp); + QCOMPARE(view.currentIndex(), model.index(1, 0)); + // PageDown + view.setCurrentIndex(model.index(model.rowCount() - 3, 0)); + QCOMPARE(view.currentIndex(), model.index(model.rowCount() - 3, 0)); + QTest::keyClick(view.viewport(), Qt::Key_PageDown); + QCOMPARE(view.currentIndex(), model.index(model.rowCount() - 2, 0)); + // Key_Home + QTest::keyClick(view.viewport(), Qt::Key_Home); + QCOMPARE(view.currentIndex(), model.index(1, 0)); + // Key_End + QTest::keyClick(view.viewport(), Qt::Key_End); + QCOMPARE(view.currentIndex(), model.index(model.rowCount() - 2, 0)); } class RemoveColumnOne : public QSortFilterProxyModel diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp index adb2c54751..33d4f3bf91 100644 --- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp @@ -99,6 +99,7 @@ private slots: void insertTopLevelItems_data(); void insertTopLevelItems(); void keyboardNavigation(); + void keyboardNavigationWithHidden(); void scrollToItem(); void setSortingEnabled(); void match(); @@ -115,6 +116,8 @@ private slots: void changeDataWithSorting(); void changeDataWithStableSorting_data(); void changeDataWithStableSorting(); + void sizeHint_data(); + void sizeHint(); void sortedIndexOfChild_data(); void sortedIndexOfChild(); @@ -138,6 +141,7 @@ private slots: void expandAndCallapse(); void itemData(); void setDisabled(); + void setSpanned(); void removeSelectedItem(); void removeCurrentItem(); void removeCurrentItem_task186451(); @@ -161,6 +165,9 @@ private slots: void getMimeDataWithInvalidItem(); void testVisualItemRect(); void reparentHiddenItem(); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + void clearItemData(); +#endif public slots: void itemSelectionChanged(); @@ -603,31 +610,31 @@ void tst_QTreeWidget::setItemHidden() QVERIFY(testWidget->visualItemRect(child).isValid() && testWidget->viewport()->rect().intersects(testWidget->visualItemRect(child))); - QVERIFY(!testWidget->isItemHidden(parent)); - QVERIFY(!testWidget->isItemHidden(child)); + QVERIFY(!parent->isHidden()); + QVERIFY(!child->isHidden()); - testWidget->setItemHidden(parent, true); + parent->setHidden(true); QVERIFY(!(testWidget->visualItemRect(parent).isValid() && testWidget->viewport()->rect().intersects(testWidget->visualItemRect(parent)))); QVERIFY(!(testWidget->visualItemRect(child).isValid() && testWidget->viewport()->rect().intersects(testWidget->visualItemRect(child)))); - QVERIFY(testWidget->isItemHidden(parent)); - QVERIFY(!testWidget->isItemHidden(child)); + QVERIFY(parent->isHidden()); + QVERIFY(!child->isHidden()); // From task 78670 (This caused an core dump) // Check if we can set an item visible if it already is visible. - testWidget->setItemHidden(parent, false); - testWidget->setItemHidden(parent, false); - QVERIFY(!testWidget->isItemHidden(parent)); + parent->setHidden(false); + parent->setHidden(false); + QVERIFY(!parent->isHidden()); // hide, hide and then unhide. - testWidget->setItemHidden(parent, true); - testWidget->setItemHidden(parent, true); - testWidget->setItemHidden(parent, false); - QVERIFY(!testWidget->isItemHidden(parent)); + parent->setHidden(true); + parent->setHidden(true); + parent->setHidden(false); + QVERIFY(!parent->isHidden()); } @@ -653,7 +660,7 @@ void tst_QTreeWidget::setItemHidden2() if (testWidget->topLevelItemCount() > 0) { top = testWidget->topLevelItem(0); - testWidget->setItemExpanded(top, true); + top->setExpanded(true); } if (testWidget->topLevelItemCount() > 0) { @@ -661,8 +668,8 @@ void tst_QTreeWidget::setItemHidden2() for (int i = 0; i < top->childCount(); i++) { leaf = top->child(i); if (leaf->text(0).toInt() % 2 == 0) { - if (!testWidget->isItemHidden(leaf)) { - testWidget->setItemHidden(leaf, true); + if (!leaf->isHidden()) { + leaf->setHidden(true); } } } @@ -816,7 +823,7 @@ void tst_QTreeWidget::selectedItems() else item = item->child(index); } - testWidget->setItemSelected(item, true); + item->setSelected(true); } // hide rows @@ -828,7 +835,7 @@ void tst_QTreeWidget::selectedItems() else item = item->child(index); } - testWidget->setItemHidden(item, true); + item->setHidden(true); } // open/close toplevel @@ -857,18 +864,23 @@ void tst_QTreeWidget::selectedItems() // compare isSelected for (int t=0; t<testWidget->topLevelItemCount(); ++t) { QTreeWidgetItem *top = testWidget->topLevelItem(t); - if (testWidget->isItemSelected(top) && !testWidget->isItemHidden(top)) + if (top->isSelected() && !top->isHidden()) QVERIFY(sel.contains(top)); for (int c=0; c<top->childCount(); ++c) { QTreeWidgetItem *child = top->child(c); - if (testWidget->isItemSelected(child) && !testWidget->isItemHidden(child)) + if (child->isSelected() && !child->isHidden()) QVERIFY(sel.contains(child)); } } +#if QT_DEPRECATED_SINCE(5, 13) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED // Possible to select null without crashing? - testWidget->setItemSelected(0, true); - QVERIFY(!testWidget->isItemSelected(0)); + testWidget->setItemSelected(nullptr, true); + QVERIFY(!testWidget->isItemSelected(nullptr)); +QT_WARNING_POP +#endif // unselect foreach (IntList itemPath, selectedItems) { @@ -879,7 +891,7 @@ void tst_QTreeWidget::selectedItems() else item = item->child(index); } - testWidget->setItemSelected(item, false); + item->setSelected(false); } QCOMPARE(testWidget->selectedItems().count(), 0); } @@ -1005,21 +1017,21 @@ void tst_QTreeWidget::expand() QTreeWidgetItem *topLevelItem = testWidget->topLevelItem(topLevelIndex); QTreeWidgetItem *childItem = topLevelItem->child(childIndex); - QVERIFY(!testWidget->isItemExpanded(topLevelItem)); - testWidget->setItemExpanded(topLevelItem, true); - QVERIFY(testWidget->isItemExpanded(topLevelItem)); + QVERIFY(!topLevelItem->isExpanded()); + topLevelItem->setExpanded(true); + QVERIFY(topLevelItem->isExpanded()); - QVERIFY(!testWidget->isItemExpanded(childItem)); - testWidget->setItemExpanded(childItem, true); - QVERIFY(testWidget->isItemExpanded(childItem)); + QVERIFY(!childItem->isExpanded()); + childItem->setExpanded(true); + QVERIFY(childItem->isExpanded()); - QVERIFY(testWidget->isItemExpanded(topLevelItem)); - testWidget->setItemExpanded(topLevelItem, false); - QVERIFY(!testWidget->isItemExpanded(topLevelItem)); + QVERIFY(topLevelItem->isExpanded()); + topLevelItem->setExpanded(false); + QVERIFY(!topLevelItem->isExpanded()); - QVERIFY(testWidget->isItemExpanded(childItem)); - testWidget->setItemExpanded(childItem, false); - QVERIFY(!testWidget->isItemExpanded(childItem)); + QVERIFY(childItem->isExpanded()); + childItem->setExpanded(false); + QVERIFY(!childItem->isExpanded()); } void tst_QTreeWidget::checkState_data() @@ -1520,7 +1532,7 @@ void tst_QTreeWidget::keyboardNavigation() } break; case Qt::Key_Down: - if (testWidget->isItemExpanded(item)) { + if (item->isExpanded()) { row = 0; item = item->child(row); } else { @@ -1533,7 +1545,7 @@ void tst_QTreeWidget::keyboardNavigation() break; case Qt::Key_Left: if (checkScroll) { - QVERIFY(testWidget->isItemExpanded(item)); + QVERIFY(item->isExpanded()); QCOMPARE(scrollBar->value(), valueBeforeClick - scrollBar->singleStep()); } // windows style right will walk to the parent @@ -1567,6 +1579,33 @@ void tst_QTreeWidget::keyboardNavigation() } } +void tst_QTreeWidget::keyboardNavigationWithHidden() +{ + QTreeWidget tw; + for (int i = 0; i < 1000; ++i) + tw.addTopLevelItem(new QTreeWidgetItem({QString::number(i), QStringLiteral("second col")})); + // QTBUG-34832 - when first/last item is hidden, + // Key_PageUp/Down/Home/End will not work as expected. + tw.topLevelItem(0)->setHidden(true); + tw.topLevelItem(tw.model()->rowCount() - 1)->setHidden(true); + // PageUp + tw.setCurrentIndex(tw.model()->index(2, 0)); + QCOMPARE(tw.currentIndex(), tw.model()->index(2, 0)); + QTest::keyClick(tw.viewport(), Qt::Key_PageUp); + QCOMPARE(tw.currentIndex(), tw.model()->index(1, 0)); + // PageDown + tw.setCurrentIndex(tw.model()->index(tw.model()->rowCount() - 3, 0)); + QCOMPARE(tw.currentIndex(), tw.model()->index(tw.model()->rowCount() - 3, 0)); + QTest::keyClick(tw.viewport(), Qt::Key_PageDown); + QCOMPARE(tw.currentIndex(), tw.model()->index(tw.model()->rowCount() - 2, 0)); + // Key_Home + QTest::keyClick(tw.viewport(), Qt::Key_Home); + QCOMPARE(tw.currentIndex(), tw.model()->index(1, 0)); + // Key_End + QTest::keyClick(tw.viewport(), Qt::Key_End); + QCOMPARE(tw.currentIndex(), tw.model()->index(tw.model()->rowCount() - 2, 0)); +} + void tst_QTreeWidget::scrollToItem() { // Check if all parent nodes of the item found are expanded. @@ -1592,9 +1631,9 @@ void tst_QTreeWidget::scrollToItem() QCOMPARE(search->text(0), QLatin1String("111")); QTreeWidgetItem *par = search->parent(); - QVERIFY(testWidget->isItemExpanded(par)); + QVERIFY(par->isExpanded()); par = par->parent(); - QVERIFY(testWidget->isItemExpanded(par)); + QVERIFY(par->isExpanded()); } // From task #85413 @@ -1840,14 +1879,14 @@ void tst_QTreeWidget::setData() item->setBackground(j, backgroundColor); QCOMPARE(itemChangedSpy.count(), 0); - QColor textColor((i == 1) ? Qt::green : Qt::cyan); - item->setTextColor(j, textColor); - QCOMPARE(item->textColor(j), textColor); + const QColor foregroundColor((i == 1) ? Qt::green : Qt::cyan); + item->setForeground(j, foregroundColor); + QCOMPARE(item->foreground(j), foregroundColor); QCOMPARE(itemChangedSpy.count(), 1); args = itemChangedSpy.takeFirst(); QCOMPARE(qvariant_cast<QTreeWidgetItem*>(args.at(0)), item); QCOMPARE(qvariant_cast<int>(args.at(1)), j); - item->setTextColor(j, textColor); + item->setForeground(j, foregroundColor); QCOMPARE(itemChangedSpy.count(), 0); Qt::CheckState checkState((i == 1) ? Qt::PartiallyChecked : Qt::Checked); @@ -1869,7 +1908,7 @@ void tst_QTreeWidget::setData() QCOMPARE(item->font(j), font); QCOMPARE(item->textAlignment(j), int(textAlignment)); QCOMPARE(item->background(j).color(), backgroundColor); - QCOMPARE(item->textColor(j), textColor); + QCOMPARE(item->foreground(j), foregroundColor); QCOMPARE(item->checkState(j), checkState); QCOMPARE(qvariant_cast<QString>(item->data(j, Qt::DisplayRole)), text); @@ -1880,9 +1919,8 @@ void tst_QTreeWidget::setData() QCOMPARE(qvariant_cast<QSize>(item->data(j, Qt::SizeHintRole)), sizeHint); QCOMPARE(qvariant_cast<QFont>(item->data(j, Qt::FontRole)), font); QCOMPARE(qvariant_cast<int>(item->data(j, Qt::TextAlignmentRole)), int(textAlignment)); - QCOMPARE(qvariant_cast<QBrush>(item->data(j, Qt::BackgroundColorRole)), QBrush(backgroundColor)); QCOMPARE(qvariant_cast<QBrush>(item->data(j, Qt::BackgroundRole)), QBrush(backgroundColor)); - QCOMPARE(qvariant_cast<QColor>(item->data(j, Qt::TextColorRole)), textColor); + QCOMPARE(qvariant_cast<QColor>(item->data(j, Qt::ForegroundRole)), foregroundColor); QCOMPARE(qvariant_cast<int>(item->data(j, Qt::CheckStateRole)), int(checkState)); item->setBackground(j, pixmap); @@ -1902,8 +1940,8 @@ void tst_QTreeWidget::setData() item->setData(j, Qt::SizeHintRole, QVariant()); item->setData(j, Qt::FontRole, QVariant()); item->setData(j, Qt::TextAlignmentRole, QVariant()); - item->setData(j, Qt::BackgroundColorRole, QVariant()); - item->setData(j, Qt::TextColorRole, QVariant()); + item->setData(j, Qt::BackgroundRole, QVariant()); + item->setData(j, Qt::ForegroundRole, QVariant()); item->setData(j, Qt::CheckStateRole, QVariant()); QCOMPARE(itemChangedSpy.count(), 11); itemChangedSpy.clear(); @@ -1916,9 +1954,8 @@ void tst_QTreeWidget::setData() QCOMPARE(item->data(j, Qt::SizeHintRole), QVariant()); QCOMPARE(item->data(j, Qt::FontRole), QVariant()); QCOMPARE(item->data(j, Qt::TextAlignmentRole), QVariant()); - QCOMPARE(item->data(j, Qt::BackgroundColorRole), QVariant()); QCOMPARE(item->data(j, Qt::BackgroundRole), QVariant()); - QCOMPARE(item->data(j, Qt::TextColorRole), QVariant()); + QCOMPARE(item->data(j, Qt::ForegroundRole), QVariant()); QCOMPARE(item->data(j, Qt::CheckStateRole), QVariant()); } } @@ -2618,6 +2655,50 @@ void tst_QTreeWidget::changeDataWithStableSorting() QCOMPARE(layoutChangedSpy.count(), reorderingExpected ? 1 : 0); } +void tst_QTreeWidget::sizeHint_data() +{ + QTest::addColumn<int>("scrollBarPolicy"); + QTest::addColumn<QSize>("viewSize"); + QTest::newRow("ScrollBarAlwaysOn") << static_cast<int>(Qt::ScrollBarAlwaysOn) << QSize(); + QTest::newRow("ScrollBarAlwaysOff") << static_cast<int>(Qt::ScrollBarAlwaysOff) << QSize(); + // make sure the scrollbars are shown by resizing the view to 40x40 + QTest::newRow("ScrollBarAsNeeded (40x40)") << static_cast<int>(Qt::ScrollBarAsNeeded) << QSize(40, 40); + QTest::newRow("ScrollBarAsNeeded (1000x1000)") << static_cast<int>(Qt::ScrollBarAsNeeded) << QSize(1000, 1000); +} + +void tst_QTreeWidget::sizeHint() +{ + QFETCH(int, scrollBarPolicy); + QFETCH(QSize, viewSize); + + QTreeWidget view; + view.setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents); + view.setVerticalScrollBarPolicy(static_cast<Qt::ScrollBarPolicy>(scrollBarPolicy)); + view.setHorizontalScrollBarPolicy(static_cast<Qt::ScrollBarPolicy>(scrollBarPolicy)); + view.setColumnCount(2); + for (int i = 0 ; i < view.columnCount(); ++i) + view.addTopLevelItem(new QTreeWidgetItem(QStringList{"foo","bar"})); + + view.show(); + QVERIFY(QTest::qWaitForWindowExposed(&view)); + + if (viewSize.isValid()) { + view.resize(viewSize); + view.setColumnWidth(0, 100); + QTRY_COMPARE(view.size(), viewSize); + } + + auto sizeHint = view.sizeHint(); + view.hide(); + QCOMPARE(view.sizeHint(), sizeHint); + + view.header()->hide(); + view.show(); + sizeHint = view.sizeHint(); + view.hide(); + QCOMPARE(view.sizeHint(), sizeHint); +} + void tst_QTreeWidget::itemOperatorLessThan() { QTreeWidget tw; @@ -2769,6 +2850,28 @@ void tst_QTreeWidget::setDisabled() QCOMPARE(takenChildren.items[1]->isDisabled(), false); } +void tst_QTreeWidget::setSpanned() +{ + QTreeWidget w; + QTreeWidgetItem *i1 = new QTreeWidgetItem(); + QScopedPointer<QTreeWidgetItem> i2(new QTreeWidgetItem()); + + QTreeWidgetItem *top = new QTreeWidgetItem(&w); + top->addChild(i1); + + top->setFirstColumnSpanned(true); + QCOMPARE(top->isFirstColumnSpanned(), true); + QCOMPARE(i1->isFirstColumnSpanned(), false); + QCOMPARE(i2->isFirstColumnSpanned(), false); + + top->setFirstColumnSpanned(false); + i1->setFirstColumnSpanned(true); + i2->setFirstColumnSpanned(true); + QCOMPARE(top->isFirstColumnSpanned(), false); + QCOMPARE(i1->isFirstColumnSpanned(), true); + QCOMPARE(i2->isFirstColumnSpanned(), false); +} + void tst_QTreeWidget::removeSelectedItem() { const QScopedPointer <QTreeWidget> w(new QTreeWidget); @@ -2870,14 +2973,14 @@ void tst_QTreeWidget::randomExpand() QTreeWidgetItem *newItem1 = 0; for (int i = 0; i < 100; i++) { newItem1 = new QTreeWidgetItem(&tree, item1); - tree.setItemExpanded(newItem1, true); - QCOMPARE(tree.isItemExpanded(newItem1), true); + newItem1->setExpanded(true); + QCOMPARE(newItem1->isExpanded(), true); QTreeWidgetItem *x = new QTreeWidgetItem(); - QCOMPARE(tree.isItemExpanded(newItem1), true); + QCOMPARE(newItem1->isExpanded(), true); newItem1->addChild(x); - QCOMPARE(tree.isItemExpanded(newItem1), true); + QCOMPARE(newItem1->isExpanded(), true); } } @@ -2890,19 +2993,19 @@ void tst_QTreeWidget::crashTest() QTreeWidgetItem *item1 = new QTreeWidgetItem(tree); item1->setText(0, "item1"); - tree->setItemExpanded(item1, true); + item1->setExpanded(true); QTreeWidgetItem *item2 = new QTreeWidgetItem(item1); item2->setText(0, "item2"); QTreeWidgetItem *item3 = new QTreeWidgetItem(tree, item1); item3->setText(0, "item3"); - tree->setItemExpanded(item3, true); + item3->setExpanded(true); QTreeWidgetItem *item4 = new QTreeWidgetItem(item3); item4->setText(0, "item4"); QTreeWidgetItem *item5 = new QTreeWidgetItem(tree, item3); item5->setText(0, "item5"); - tree->setItemExpanded(item5, true); + item5->setExpanded(true); QTreeWidgetItem *item6 = new QTreeWidgetItem(item5); item6->setText(0, "item6"); @@ -3004,7 +3107,7 @@ void tst_QTreeWidget::task191552_rtl() opt.features = QStyleOptionViewItem::HasDisplay | QStyleOptionViewItem::HasCheckIndicator; opt.checkState = Qt::Checked; opt.widget = &tw; - const QRect checkRect = tw.style()->subElementRect(QStyle::SE_ViewItemCheckIndicator, &opt, &tw); + const QRect checkRect = tw.style()->subElementRect(QStyle::SE_ItemViewItemCheckIndicator, &opt, &tw); QTest::mouseClick(tw.viewport(), Qt::LeftButton, Qt::NoModifier, checkRect.center()); QCOMPARE(item->checkState(0), Qt::Unchecked); @@ -3218,7 +3321,7 @@ void tst_QTreeWidget::nonEditableTristate() option.checkState = item->checkState(0); const int checkMargin = qApp->style()->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, 0) + 1; - QPoint pos = qApp->style()->subElementRect(QStyle::SE_ViewItemCheckIndicator, &option, 0).center() + QPoint(checkMargin, 0); + QPoint pos = qApp->style()->subElementRect(QStyle::SE_ItemViewItemCheckIndicator, &option, 0).center() + QPoint(checkMargin, 0); QTest::mouseClick(tree->viewport(), Qt::LeftButton, Qt::NoModifier, pos); QCOMPARE(int(item->checkState(0)), int(Qt::Checked)); @@ -3530,5 +3633,43 @@ void tst_QTreeWidget::reparentHiddenItem() QVERIFY(grandChild->isHidden()); } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +void tst_QTreeWidget::clearItemData() +{ + QTreeWidget tree; + QAbstractItemModel* model = tree.model(); + QVERIFY(model->insertColumn(0)); + QVERIFY(model->insertRow(0)); + const QModelIndex parentIdx = model->index(0, 0); + QVERIFY(model->insertColumn(0, parentIdx)); + QVERIFY(model->insertRow(0, parentIdx)); + const QModelIndex childIdx = model->index(0, 0, parentIdx); + model->setData(parentIdx, QStringLiteral("parent")); + model->setData(parentIdx, QStringLiteral("parent"), Qt::UserRole); + model->setData(childIdx, QStringLiteral("child")); + QSignalSpy dataChangeSpy(model, &QAbstractItemModel::dataChanged); + QVERIFY(dataChangeSpy.isValid()); + QVERIFY(!model->clearItemData(QModelIndex())); + QCOMPARE(dataChangeSpy.size(), 0); + QVERIFY(model->clearItemData(parentIdx)); + QVERIFY(!model->data(parentIdx).isValid()); + QVERIFY(!model->data(parentIdx, Qt::UserRole).isValid()); + QCOMPARE(dataChangeSpy.size(), 1); + QList<QVariant> dataChangeArgs = dataChangeSpy.takeFirst(); + QCOMPARE(dataChangeArgs.at(0).value<QModelIndex>(), parentIdx); + QCOMPARE(dataChangeArgs.at(1).value<QModelIndex>(), parentIdx); + QVERIFY(dataChangeArgs.at(2).value<QVector<int>>().isEmpty()); + QVERIFY(model->clearItemData(parentIdx)); + QCOMPARE(dataChangeSpy.size(), 0); + QVERIFY(model->clearItemData(childIdx)); + QVERIFY(!model->data(childIdx).isValid()); + QCOMPARE(dataChangeSpy.size(), 1); + dataChangeArgs = dataChangeSpy.takeFirst(); + QCOMPARE(dataChangeArgs.at(0).value<QModelIndex>(), childIdx); + QCOMPARE(dataChangeArgs.at(1).value<QModelIndex>(), childIdx); + QVERIFY(dataChangeArgs.at(2).value<QVector<int>>().isEmpty()); +} +#endif + QTEST_MAIN(tst_QTreeWidget) #include "tst_qtreewidget.moc" diff --git a/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp b/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp index c2c02f3766..76ca148d3f 100644 --- a/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp +++ b/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp @@ -95,11 +95,11 @@ void tst_QTreeWidgetItemIterator::initTestCase() const QString topS = QLatin1String("top") + QString::number(i); top->setText(0, topS); switch (i) { - case 0: testWidget->setItemHidden(top, true);break; - case 1: testWidget->setItemHidden(top, false);break; + case 0: top->setHidden(true);break; + case 1: top->setHidden(false);break; - case 2: testWidget->setItemSelected(top, true);break; - case 3: testWidget->setItemSelected(top, false);break; + case 2: top->setSelected(true);break; + case 3: top->setSelected(false);break; case 4: top->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);break; case 5: top->setFlags(Qt::ItemIsEnabled);break; @@ -126,11 +126,11 @@ void tst_QTreeWidgetItemIterator::initTestCase() QTreeWidgetItem *child = new QTreeWidgetItem(top); child->setText(0, topS + QLatin1String(",child") + QString::number(j)); switch (j) { - case 0: testWidget->setItemHidden(child, true);break; - case 1: testWidget->setItemHidden(child, false);break; + case 0: child->setHidden(true);break; + case 1: child->setHidden(false);break; - case 2: testWidget->setItemSelected(child, true);break; - case 3: testWidget->setItemSelected(child, false);break; + case 2: child->setSelected(true);break; + case 3: child->setSelected(false);break; case 4: child->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);break; case 5: child->setFlags(Qt::ItemIsEnabled);break; diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index 5b4a5d30a5..3b387c9235 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -200,6 +200,7 @@ void tst_QApplication::staticSetup() QVERIFY(style); QApplication::setStyle(style); + bool palette_changed = false; QPalette pal; QApplication::setPalette(pal); @@ -208,6 +209,10 @@ void tst_QApplication::staticSetup() int argc = 0; QApplication app(argc, nullptr); + QObject::connect(&app, &QApplication::paletteChanged, [&palette_changed]{ palette_changed = true; }); + QVERIFY(!palette_changed); + qApp->setPalette(QPalette(Qt::red)); + QVERIFY(palette_changed); } @@ -2166,8 +2171,6 @@ void tst_QApplication::abortQuitOnShow() void tst_QApplication::staticFunctions() { QApplication::setStyle(QStringLiteral("blub")); - QApplication::colorSpec(); - QApplication::setColorSpec(42); QApplication::allWidgets(); QApplication::topLevelWidgets(); QApplication::desktop(); diff --git a/tests/auto/widgets/kernel/qdesktopwidget/tst_qdesktopwidget.cpp b/tests/auto/widgets/kernel/qdesktopwidget/tst_qdesktopwidget.cpp index 6f2847974f..90776dfcb2 100644 --- a/tests/auto/widgets/kernel/qdesktopwidget/tst_qdesktopwidget.cpp +++ b/tests/auto/widgets/kernel/qdesktopwidget/tst_qdesktopwidget.cpp @@ -32,6 +32,9 @@ #include <QtGui/QWindow> #include <QDebug> +// the complete class is deprecated +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED class tst_QDesktopWidget : public QObject { Q_OBJECT @@ -163,7 +166,7 @@ void tst_QDesktopWidget::topLevels() QCOMPARE(topLevelDesktopWidgets, 0); QCOMPARE(topLevelDesktopWindows, 0); } +QT_WARNING_POP QTEST_MAIN(tst_QDesktopWidget) #include "tst_qdesktopwidget.moc" - diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST index 1f68308bbe..03bec4286b 100644 --- a/tests/auto/widgets/kernel/qwidget/BLACKLIST +++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST @@ -10,6 +10,7 @@ osx ubuntu-16.04 ubuntu-18.04 rhel-7.4 +rhel-7.6 osx [focusProxyAndInputMethods] linux @@ -45,3 +46,6 @@ osx osx-10.12 ci [multipleToplevelFocusCheck] linux +[windowState] +# QTBUG-75270 +winrt diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index bbaed67a36..11c3336748 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -323,7 +323,9 @@ private slots: void setMaskInResizeEvent(); void moveInResizeEvent(); - void immediateRepaintAfterInvalidateBuffer(); +#ifdef QT_BUILD_INTERNAL + void immediateRepaintAfterInvalidateBackingStore(); +#endif void effectiveWinId(); void effectiveWinId2(); @@ -7669,9 +7671,6 @@ void tst_QWidget::updateWhileMinimized() // Restore window. widget.showNormal(); - QTest::qWait(30); - if (m_platform == QStringLiteral("xcb")) - QSKIP("QTBUG-26424"); QTRY_COMPARE(widget.numPaintEvents, 1); QCOMPARE(widget.paintedRegion, QRegion(0, 0, 50, 50)); } @@ -8223,7 +8222,7 @@ void tst_QWidget::resizeInPaintEvent() widget.resizeInPaintEvent = true; // This will call resize in the paintEvent, which in turn will call - // invalidateBuffer() and a new update request should be posted. + // invalidateBackingStore() and a new update request should be posted. widget.repaint(); QCOMPARE(widget.numPaintEvents, 1); widget.numPaintEvents = 0; @@ -8376,7 +8375,8 @@ void tst_QWidget::moveInResizeEvent() QTRY_COMPARE(testWidget.geometry(), expectedGeometry); } -void tst_QWidget::immediateRepaintAfterInvalidateBuffer() +#ifdef QT_BUILD_INTERNAL +void tst_QWidget::immediateRepaintAfterInvalidateBackingStore() { if (m_platform != QStringLiteral("xcb") && m_platform != QStringLiteral("windows")) QSKIP("We don't support immediate repaint right after show on other platforms."); @@ -8391,7 +8391,7 @@ void tst_QWidget::immediateRepaintAfterInvalidateBuffer() // Marks the area covered by the widget as dirty in the backing store and // posts an UpdateRequest event. - qt_widget_private(widget.data())->invalidateBuffer(widget->rect()); + qt_widget_private(widget.data())->invalidateBackingStore(widget->rect()); QCOMPARE(widget->numPaintEvents, 0); // The entire widget is already dirty, but this time we want to update immediately @@ -8400,6 +8400,7 @@ void tst_QWidget::immediateRepaintAfterInvalidateBuffer() widget->repaint(); QCOMPARE(widget->numPaintEvents, 1); } +#endif void tst_QWidget::effectiveWinId() { @@ -9457,7 +9458,7 @@ QWidgetBackingStore* backingStore(QWidget &widget) void tst_QWidget::rectOutsideCoordinatesLimit_task144779() { #ifndef QT_NO_CURSOR - QApplication::setOverrideCursor(Qt::BlankCursor); //keep the cursor out of screen grabs + QGuiApplication::setOverrideCursor(Qt::BlankCursor); //keep the cursor out of screen grabs #endif QWidget main(nullptr, Qt::FramelessWindowHint); //don't get confused by the size of the window frame main.setWindowTitle(QLatin1String(QTest::currentTestFunction())); @@ -9495,7 +9496,7 @@ void tst_QWidget::rectOutsideCoordinatesLimit_task144779() QTRY_COMPARE(mainPixmap.toImage().convertToFormat(QImage::Format_RGB32), correct.toImage().convertToFormat(QImage::Format_RGB32)); #ifndef QT_NO_CURSOR - QApplication::restoreOverrideCursor(); + QGuiApplication::restoreOverrideCursor(); #endif } @@ -9654,7 +9655,7 @@ public: { if (!static_cast<QWidgetPrivate*>(d_ptr.data())->maybeBackingStore()) { static_cast<QWidgetPrivate*>(d_ptr.data())->topData()->backingStoreTracker.create(this); - static_cast<QWidgetPrivate*>(d_ptr.data())->invalidateBuffer(this->rect()); + static_cast<QWidgetPrivate*>(d_ptr.data())->invalidateBackingStore(this->rect()); repaint(); } } diff --git a/tests/auto/widgets/kernel/qwidgetmetatype/tst_qwidgetmetatype.cpp b/tests/auto/widgets/kernel/qwidgetmetatype/tst_qwidgetmetatype.cpp index 077e8de328..06522b2bd3 100644 --- a/tests/auto/widgets/kernel/qwidgetmetatype/tst_qwidgetmetatype.cpp +++ b/tests/auto/widgets/kernel/qwidgetmetatype/tst_qwidgetmetatype.cpp @@ -41,6 +41,8 @@ public: private slots: void metaObject(); + void saveAndLoadBuiltin_data(); + void saveAndLoadBuiltin(); }; class CustomWidget : public QWidget @@ -68,5 +70,50 @@ void tst_QWidgetMetaType::metaObject() QCOMPARE(QMetaType::metaObjectForType(qMetaTypeId<QSizePolicy>()), &QSizePolicy::staticMetaObject); } +template <typename T> +struct StreamingTraits +{ + // Streamable by default, as currently all widgets built-in types are streamable + enum { isStreamable = 1 }; +}; + +void tst_QWidgetMetaType::saveAndLoadBuiltin_data() +{ + QTest::addColumn<int>("type"); + QTest::addColumn<bool>("isStreamable"); + +#define ADD_METATYPE_TEST_ROW(MetaTypeName, MetaTypeId, RealType) \ + QTest::newRow(#RealType) << MetaTypeId << bool(StreamingTraits<RealType>::isStreamable); + QT_FOR_EACH_STATIC_WIDGETS_CLASS(ADD_METATYPE_TEST_ROW) +#undef ADD_METATYPE_TEST_ROW +} + +void tst_QWidgetMetaType::saveAndLoadBuiltin() +{ + QFETCH(int, type); + QFETCH(bool, isStreamable); + + void *value = QMetaType::create(type); + + QByteArray ba; + QDataStream stream(&ba, QIODevice::ReadWrite); + QCOMPARE(QMetaType::save(stream, type, value), isStreamable); + QCOMPARE(stream.status(), QDataStream::Ok); + + if (isStreamable) + QVERIFY(QMetaType::load(stream, type, value)); + + stream.device()->seek(0); + stream.resetStatus(); + QCOMPARE(QMetaType::load(stream, type, value), isStreamable); + QCOMPARE(stream.status(), QDataStream::Ok); + + if (isStreamable) + QVERIFY(QMetaType::load(stream, type, value)); + + QMetaType::destroy(type, value); +} + + QTEST_MAIN(tst_QWidgetMetaType) #include "tst_qwidgetmetatype.moc" diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp index 587e8a080d..a552c91928 100644 --- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp +++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp @@ -197,7 +197,7 @@ void tst_QStyle::drawItemPixmap() const QRgb green = QColor(Qt::green).rgb(); QVERIFY(image.reinterpretAsFormat(QImage::Format_RGB32)); const QRgb *bits = reinterpret_cast<const QRgb *>(image.constBits()); - const QRgb *end = bits + image.byteCount() / sizeof(QRgb); + const QRgb *end = bits + image.sizeInBytes() / sizeof(QRgb); #ifdef Q_OS_WINRT QEXPECT_FAIL("", "QWidget::resize does not work on WinRT", Continue); #endif diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp index 8760ed0373..a671a6c4d8 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -160,7 +160,7 @@ void tst_QStyleSheetStyle::numinstances() QCOMPARE(QStyleSheetStyle::numinstances, 0); qApp->setStyleSheet("* { color: red; }"); QCOMPARE(QStyleSheetStyle::numinstances, 1); - qApp->setStyleSheet(""); + qApp->setStyleSheet(QString()); QCOMPARE(QStyleSheetStyle::numinstances, 0); // set and unset application stylesheet+widget @@ -169,9 +169,9 @@ void tst_QStyleSheetStyle::numinstances() QCOMPARE(QStyleSheetStyle::numinstances, 2); w.setStyle(style); QCOMPARE(QStyleSheetStyle::numinstances, 2); - qApp->setStyleSheet(""); + qApp->setStyleSheet(QString()); QCOMPARE(QStyleSheetStyle::numinstances, 1); - w.setStyleSheet(""); + w.setStyleSheet(QString()); QCOMPARE(QStyleSheetStyle::numinstances, 0); // set and unset widget stylesheet @@ -180,7 +180,7 @@ void tst_QStyleSheetStyle::numinstances() QCOMPARE(QStyleSheetStyle::numinstances, 1); c.setStyle(style); QCOMPARE(QStyleSheetStyle::numinstances, 2); - w.setStyleSheet(""); + w.setStyleSheet(QString()); QCOMPARE(QStyleSheetStyle::numinstances, 0); } @@ -193,9 +193,9 @@ void tst_QStyleSheetStyle::widgetsBeforeAppStyleSheet() QCOMPARE(COLOR(w1), red); w1.setStyleSheet("color: white"); QCOMPARE(COLOR(w1), white); - qApp->setStyleSheet(""); + qApp->setStyleSheet(QString()); QCOMPARE(COLOR(w1), white); - w1.setStyleSheet(""); + w1.setStyleSheet(QString()); QCOMPARE(COLOR(w1), APPCOLOR(w1)); } @@ -218,17 +218,17 @@ void tst_QStyleSheetStyle::widgetsAfterAppStyleSheet() QCOMPARE(COLOR(w1), white); QCOMPARE(COLOR(spin), red); QCOMPARE(COLOR(*spin.lineEdit()), red); - w1.setStyleSheet(""); + w1.setStyleSheet(QString()); QCOMPARE(COLOR(w1), red); QCOMPARE(COLOR(spin), red); QCOMPARE(COLOR(*spin.lineEdit()), red); w1.setStyleSheet("color: white"); QCOMPARE(COLOR(w1), white); - qApp->setStyleSheet(""); + qApp->setStyleSheet(QString()); QCOMPARE(COLOR(w1), white); QCOMPARE(COLOR(spin), APPCOLOR(spin)); QCOMPARE(COLOR(*spin.lineEdit()), APPCOLOR(*spin.lineEdit())); - w1.setStyleSheet(""); + w1.setStyleSheet(QString()); QCOMPARE(COLOR(w1), APPCOLOR(w1)); // QCOMPARE(FONTSIZE(w1), APPFONTSIZE(w1)); //### task 244261 QCOMPARE(FONTSIZE(spin), APPFONTSIZE(spin)); @@ -244,7 +244,7 @@ void tst_QStyleSheetStyle::applicationStyleSheet() QCOMPARE(COLOR(w1), red); qApp->setStyleSheet("* { color: white; }"); QCOMPARE(COLOR(w1), white); - qApp->setStyleSheet(""); + qApp->setStyleSheet(QString()); QCOMPARE(COLOR(w1), APPCOLOR(w1)); qApp->setStyleSheet("* { color: red }"); QCOMPARE(COLOR(w1), red); @@ -255,21 +255,21 @@ void tst_QStyleSheetStyle::windowStyleSheet() const QColor red(Qt::red); const QColor white(Qt::white); QPushButton w1; - qApp->setStyleSheet(""); + qApp->setStyleSheet(QString()); w1.setStyleSheet("* { color: red; }"); QCOMPARE(COLOR(w1), red); w1.setStyleSheet("* { color: white; }"); QCOMPARE(COLOR(w1), white); - w1.setStyleSheet(""); + w1.setStyleSheet(QString()); QCOMPARE(COLOR(w1), APPCOLOR(w1)); w1.setStyleSheet("* { color: red }"); QCOMPARE(COLOR(w1), red); qApp->setStyleSheet("* { color: green }"); QCOMPARE(COLOR(w1), red); - w1.setStyleSheet(""); + w1.setStyleSheet(QString()); QCOMPARE(COLOR(w1), QColor("green")); - qApp->setStyleSheet(""); + qApp->setStyleSheet(QString()); QCOMPARE(COLOR(w1), APPCOLOR(w1)); } @@ -282,7 +282,7 @@ void tst_QStyleSheetStyle::widgetStyleSheet() QPushButton *pb = new QPushButton(&w1); QPushButton &w2 = *pb; - qApp->setStyleSheet(""); + qApp->setStyleSheet(QString()); w1.setStyleSheet("* { color: red }"); QCOMPARE(COLOR(w1), red); QCOMPARE(COLOR(w2), red); @@ -294,11 +294,11 @@ void tst_QStyleSheetStyle::widgetStyleSheet() QCOMPARE(COLOR(w1), blue); QCOMPARE(COLOR(w2), white); - w1.setStyleSheet(""); + w1.setStyleSheet(QString()); QCOMPARE(COLOR(w1), APPCOLOR(w1)); QCOMPARE(COLOR(w2), white); - w2.setStyleSheet(""); + w2.setStyleSheet(QString()); QCOMPARE(COLOR(w1), APPCOLOR(w1)); QCOMPARE(COLOR(w2), APPCOLOR(w2)); } @@ -312,7 +312,7 @@ void tst_QStyleSheetStyle::reparentWithNoChildStyleSheet() QPushButton *pb = new QPushButton(&p1); QPushButton &c1 = *pb; // child with no stylesheet - qApp->setStyleSheet(""); + qApp->setStyleSheet(QString()); p1.setStyleSheet("* { color: red }"); QCOMPARE(COLOR(c1), red); c1.setParent(&p2); @@ -334,7 +334,7 @@ void tst_QStyleSheetStyle::reparentWithChildStyleSheet() { const QColor gray("gray"); const QColor white(Qt::white); - qApp->setStyleSheet(""); + qApp->setStyleSheet(QString()); QPushButton p1, p2; QPushButton *pb = new QPushButton(&p1); QPushButton &c1 = *pb; @@ -354,7 +354,7 @@ void tst_QStyleSheetStyle::repolish() { const QColor red(Qt::red); const QColor white(Qt::white); - qApp->setStyleSheet(""); + qApp->setStyleSheet(QString()); QPushButton p1; p1.setStyleSheet("color: red; background: white"); QCOMPARE(BACKGROUND(p1), white); @@ -363,7 +363,7 @@ void tst_QStyleSheetStyle::repolish() p1.setStyleSheet("color: red"); QCOMPARE(COLOR(p1), red); QCOMPARE(BACKGROUND(p1), APPBACKGROUND(p1)); - p1.setStyleSheet(""); + p1.setStyleSheet(QString()); QCOMPARE(COLOR(p1), APPCOLOR(p1)); QCOMPARE(BACKGROUND(p1), APPBACKGROUND(p1)); } @@ -390,7 +390,7 @@ void tst_QStyleSheetStyle::repolish_without_crashing() void tst_QStyleSheetStyle::widgetStyle() { - qApp->setStyleSheet(""); + qApp->setStyleSheet(QString()); QWidget *window1 = new QWidget; window1->setObjectName("window1"); @@ -450,7 +450,7 @@ void tst_QStyleSheetStyle::widgetStyle() // Remove the stylesheet proxy = (QStyleSheetStyle *)window1->style(); - window1->setStyleSheet(""); + window1->setStyleSheet(QString()); QVERIFY(proxy.isNull()); // should have disappeared QCOMPARE(window1->style(), style1.data()); // its restored @@ -478,7 +478,7 @@ void tst_QStyleSheetStyle::widgetStyle() QCOMPARE(proxy->baseStyle(), style1.data()); // Style Sheet propagation on a child widget with a custom style already set - window2->setStyleSheet(""); + window2->setStyleSheet(QString()); QCOMPARE(window2->style(), style2.data()); QCOMPARE(widget2->style(), style1.data()); widget2->setStyle(0); @@ -491,9 +491,9 @@ void tst_QStyleSheetStyle::widgetStyle() // clean everything out window1->setStyle(0); - window1->setStyleSheet(""); + window1->setStyleSheet(QString()); window2->setStyle(0); - window2->setStyleSheet(""); + window2->setStyleSheet(QString()); qApp->setStyle(0); qApp->setStyleSheet("may_insanity_prevail { }"); // app has stylesheet @@ -510,14 +510,14 @@ void tst_QStyleSheetStyle::widgetStyle() QCOMPARE(proxy->baseStyle(), newStyle); // magic ;) the widget still follows the application QCOMPARE(static_cast<QStyle *>(proxy), widget1->style()); // child still follows... - window1->setStyleSheet(""); // remove stylesheet + window1->setStyleSheet(QString()); // remove stylesheet QCOMPARE(window1->style(), qApp->style()); // is this cool or what QCOMPARE(widget1->style(), qApp->style()); // annoying child follows... QScopedPointer<QStyle> wndStyle(QStyleFactory::create("Windows")); window1->setStyle(wndStyle.data()); QCOMPARE(window1->style()->metaObject()->className(), "QStyleSheetStyle"); // auto wraps it QCOMPARE(widget1->style(), window1->style()); // and auto propagates to child - qApp->setStyleSheet(""); // remove the app stylesheet + qApp->setStyleSheet(QString()); // remove the app stylesheet QCOMPARE(window1->style(), wndStyle.data()); // auto dewrap QCOMPARE(widget1->style(), qApp->style()); // and child state is restored window1->setStyle(0); // let sanity prevail @@ -532,7 +532,7 @@ void tst_QStyleSheetStyle::widgetStyle() void tst_QStyleSheetStyle::appStyle() { - qApp->setStyleSheet(""); + qApp->setStyleSheet(QString()); // qApp style can never be 0 QVERIFY(QApplication::style() != 0); QPointer<QStyle> style1 = QStyleFactory::create("Windows"); @@ -565,11 +565,11 @@ void tst_QStyleSheetStyle::appStyle() QCOMPARE(sss->baseStyle(), style1.data()); // Revert the stylesheet - qApp->setStyleSheet(""); + qApp->setStyleSheet(QString()); QVERIFY(sss.isNull()); // should have disappeared QCOMPARE(QApplication::style(), style1.data()); - qApp->setStyleSheet(""); + qApp->setStyleSheet(QString()); QCOMPARE(QApplication::style(), style1.data()); } @@ -765,7 +765,7 @@ void tst_QStyleSheetStyle::fontPropagation() window.setStyleSheet("* { font-size: 9pt }"); pb.setParent(&window); QCOMPARE(FONTSIZE(pb), 9); - window.setStyleSheet(""); + window.setStyleSheet(QString()); QCOMPARE(FONTSIZE(pb), buttonFontSize); QTabWidget tw; @@ -778,7 +778,7 @@ void tst_QStyleSheetStyle::fontPropagation() void tst_QStyleSheetStyle::onWidgetDestroyed() { - qApp->setStyleSheet(""); + qApp->setStyleSheet(QString()); QLabel *l = new QLabel; l->setStyleSheet("QLabel { color: red }"); QPointer<QStyleSheetStyle> ss = (QStyleSheetStyle *) l->style(); @@ -799,14 +799,14 @@ void tst_QStyleSheetStyle::fontPrecedence() font.setPointSize(16); edit.setFont(font); QCOMPARE(FONTSIZE(edit), 22); - edit.setStyleSheet(""); + edit.setStyleSheet(QString()); QCOMPARE(FONTSIZE(edit), 16); font.setPointSize(18); edit.setFont(font); QCOMPARE(FONTSIZE(edit), 18); edit.setStyleSheet("QLineEdit { font-size: 20pt; }"); QCOMPARE(FONTSIZE(edit), 20); - edit.setStyleSheet(""); + edit.setStyleSheet(QString()); QCOMPARE(FONTSIZE(edit), 18); edit.hide(); @@ -1210,7 +1210,7 @@ void tst_QStyleSheetStyle::transparent() QPushButton *p3=new QPushButton(&w); p1->setStyleSheet("background:transparent"); p2->setStyleSheet("background-color:transparent"); - p3->setStyleSheet("background:rgb(0,0,0,0)"); + p3->setStyleSheet("background:rgba(0,0,0,0)"); QCOMPARE(BACKGROUND(*p1) , QColor(0,0,0,0)); QCOMPARE(BACKGROUND(*p2) , QColor(0,0,0,0)); QCOMPARE(BACKGROUND(*p3) , QColor(0,0,0,0)); @@ -2072,7 +2072,7 @@ void tst_QStyleSheetStyle::styleSheetTargetAttribute() QCOMPARE(lb.testAttribute(Qt::WA_StyleSheetTarget), true); QCOMPARE(pb.testAttribute(Qt::WA_StyleSheetTarget), false); - qApp->setStyleSheet(""); + qApp->setStyleSheet(QString()); gb.ensurePolished(); lb.ensurePolished(); pb.ensurePolished(); QCOMPARE(gb.testAttribute(Qt::WA_StyleSheetTarget), false); @@ -2087,7 +2087,7 @@ void tst_QStyleSheetStyle::unpolish() w.setStyleSheet("QWidget { min-width: 100; }"); w.ensurePolished(); QCOMPARE(w.minimumWidth(), 100); - w.setStyleSheet(""); + w.setStyleSheet(QString()); QCOMPARE(w.minimumWidth(), 0); } diff --git a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp index ad64f1aef7..8bb16cc9d1 100644 --- a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp @@ -1595,27 +1595,16 @@ void tst_QCompleter::task247560_keyboardNavigation() } // Helpers for QTBUG_14292_filesystem: Recursion helper for below recurseTreeModel -template <class Function> -bool recurseTreeModelIndex(const QModelIndex &idx, Function f, int depth = 0) -{ - if (f(idx, depth)) - return true; - const int rowCount = idx.model()->rowCount(idx); - for (int row = 0; row < rowCount; ++row) - if (recurseTreeModelIndex(idx.child(row, 0), f, depth + 1)) - return true; - return false; -} - // Function to recurse over a tree model applying a function // taking index and depth, returning true to terminate recursion. - template <class Function> -bool recurseTreeModel(const QAbstractItemModel &m, Function f) +bool recurseTreeModel(const QAbstractItemModel &m, const QModelIndex &idx, Function f, int depth = 0) { - const int rowCount = m.rowCount(QModelIndex()); + if (idx.isValid() && f(idx, depth)) + return true; + const int rowCount = m.rowCount(idx); for (int row = 0; row < rowCount; ++row) - if (recurseTreeModelIndex(m.index(row, 0, QModelIndex()), f)) + if (recurseTreeModel(m, m.index(row, 0, idx), f, depth + 1)) return true; return false; } @@ -1658,7 +1647,7 @@ QDebug operator<<(QDebug d, const QAbstractItemModel &m) { QDebug dns = d.nospace(); dns << '\n'; - recurseTreeModel(m, DebugFunction(dns)); + recurseTreeModel(m, QModelIndex(), DebugFunction(dns)); return d; } @@ -1671,8 +1660,8 @@ static const char testDir2[] = "holla"; static inline bool testFileSystemReady(const QAbstractItemModel &model) { - return recurseTreeModel(model, SearchFunction(QLatin1String(testDir1), QFileSystemModel::FileNameRole)) - && recurseTreeModel(model, SearchFunction(QLatin1String(testDir2), QFileSystemModel::FileNameRole)); + return recurseTreeModel(model, QModelIndex(), SearchFunction(QLatin1String(testDir1), QFileSystemModel::FileNameRole)) + && recurseTreeModel(model, QModelIndex(), SearchFunction(QLatin1String(testDir2), QFileSystemModel::FileNameRole)); } void tst_QCompleter::QTBUG_14292_filesystem() diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp index 20aad6ba97..b5ef454b14 100644 --- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp +++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp @@ -823,7 +823,7 @@ void tst_QDateTimeEdit::displayFormat_data() << QString("31 12 2999::59:59:03") << dt; QTest::newRow("valid-2") << QString("hh-dd-mm-MM-yy") << true << QString("03-31-59-12-99") << dt; QTest::newRow("valid-3") << QString("ddd MM d yyyy::ss:mm:hh") << true - << QDate::shortDayName(2) + " 12 31 2999::59:59:03" << dt; + << QLocale::system().dayName(2, QLocale::ShortFormat) + " 12 31 2999::59:59:03" << dt; QTest::newRow("valid-4") << QString("hh-dd-mm-MM-yyyy") << true << QString("03-31-59-12-2999") << dt; QTest::newRow("invalid-0") << QString("yyyy.MM.yy") << true << QString("2999.12.99") << dt; QTest::newRow("invalid-1") << QString("y") << false << QString() << dt; @@ -2611,9 +2611,13 @@ void tst_QDateTimeEdit::weirdCase() void tst_QDateTimeEdit::newCase() { - if (QDate::shortMonthName(6) != "Jun" || QDate::shortMonthName(7) != "Jul" || - QDate::longMonthName(6) != "June" || QDate::longMonthName(7) != "July") + const auto locale = QLocale::system(); + if (locale.monthName(6, QLocale::ShortFormat) != "Jun" || + locale.monthName(7, QLocale::ShortFormat) != "Jul" || + locale.monthName(6, QLocale::LongFormat) != "June" || + locale.monthName(7, QLocale::LongFormat) != "July") { QSKIP("This test only works in English"); + } testWidget->setDisplayFormat("MMMM'a'MbMMMcMM"); testWidget->setDate(QDate(2005, 6, 1)); @@ -2656,12 +2660,12 @@ void tst_QDateTimeEdit::newCase2() testWidget->setDate(QDate(2005, 8, 8)); QTest::keyClick(testWidget, Qt::Key_Return); QTest::keyClick(testWidget, Qt::Key_Backspace); - QCOMPARE(testWidget->text(), QString(" 2005-08-08 ") + QDate::longMonthName(8)); + QCOMPARE(testWidget->text(), QString(" 2005-08-08 ") + QLocale::system().monthName(8, QLocale::LongFormat)); } void tst_QDateTimeEdit::newCase3() { - if (!QDate::longMonthName(1).startsWith("Januar")) + if (!QLocale::system().monthName(1, QLocale::LongFormat).startsWith("Januar")) QSKIP("This test does not work in this locale"); testWidget->setDisplayFormat("dd MMMM yyyy"); @@ -2681,7 +2685,7 @@ void tst_QDateTimeEdit::newCase3() void tst_QDateTimeEdit::cursorPos() { - if (QDate::longMonthName(1) != "January") + if (QLocale::system().monthName(1, QLocale::LongFormat) != "January") QSKIP("This test only works in English"); testWidget->setDisplayFormat("dd MMMM yyyy"); @@ -3017,7 +3021,7 @@ void tst_QDateTimeEdit::yyTest() testWidget->setDate(testWidget->minimumDate()); testWidget->setCurrentSection(QDateTimeEdit::YearSection); - QString jan = QDate::shortMonthName(1); + QString jan = QLocale::system().monthName(1, QLocale::ShortFormat); QCOMPARE(testWidget->lineEdit()->displayText(), "01-" + jan + "-05"); QTest::keyClick(testWidget, Qt::Key_Up); QCOMPARE(testWidget->lineEdit()->displayText(), "01-" + jan + "-06"); @@ -3130,7 +3134,7 @@ void tst_QDateTimeEdit::ddMMMMyyyy() #ifdef Q_OS_MAC QEXPECT_FAIL("", "QTBUG-23674", Abort); #endif - QCOMPARE(testWidget->lineEdit()->text(), "01." + QDate::longMonthName(1) + ".200"); + QCOMPARE(testWidget->lineEdit()->text(), "01." + QLocale::system().monthName(1, QLocale::LongFormat) + ".200"); } void tst_QDateTimeEdit::wheelEvent_data() diff --git a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp index 078a3215fd..f8ce6a2c0a 100644 --- a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp +++ b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp @@ -71,6 +71,7 @@ private slots: void restoreStateOfFloating(); void restoreDockWidget(); void restoreStateWhileStillFloating(); + void setWindowTitle(); // task specific tests: void task165177_deleteFocusWidget(); void task169808_setFloating(); @@ -993,7 +994,54 @@ void tst_QDockWidget::taskQTBUG_9758_undockedGeometry() QVERIFY(dock1.y() >= 0); } +void tst_QDockWidget::setWindowTitle() +{ + QMainWindow window; + QDockWidget dock1(&window); + QDockWidget dock2(&window); + const QString dock1Title = QStringLiteral("&Window"); + const QString dock2Title = QStringLiteral("&Modifiable Window [*]"); + + dock1.setWindowTitle(dock1Title); + dock2.setWindowTitle(dock2Title); + window.addDockWidget(Qt::RightDockWidgetArea, &dock1); + window.addDockWidget(Qt::RightDockWidgetArea, &dock2); + window.show(); + QVERIFY(QTest::qWaitForWindowExposed(&window)); + QCOMPARE(dock1.windowTitle(), dock1Title); + QCOMPARE(dock2.windowTitle(), dock2Title); + + dock1.setFloating(true); + dock1.show(); + QVERIFY(QTest::qWaitForWindowExposed(&dock1)); + QCOMPARE(dock1.windowTitle(), dock1Title); + dock1.setFloating(false); + QCOMPARE(dock1.windowTitle(), dock1Title); + dock1.setFloating(true); + dock1.show(); + QVERIFY(QTest::qWaitForWindowExposed(&dock1)); + const QString changed = QStringLiteral("Changed "); + dock1.setWindowTitle(QString(changed + dock1Title)); + QCOMPARE(dock1.windowTitle(), QString(changed + dock1Title)); + dock1.setFloating(false); + QCOMPARE(dock1.windowTitle(), QString(changed + dock1Title)); + + dock2.setWindowModified(true); + QCOMPARE(dock2.windowTitle(), dock2Title); + dock2.setFloating(true); + dock2.show(); + QVERIFY(QTest::qWaitForWindowExposed(&dock2)); + QCOMPARE(dock2.windowTitle(), dock2Title); + dock2.setWindowModified(false); + QCOMPARE(dock2.windowTitle(), dock2Title); + dock2.setFloating(false); + QCOMPARE(dock2.windowTitle(), dock2Title); + dock2.setFloating(true); + dock2.show(); + QVERIFY(QTest::qWaitForWindowExposed(&dock2)); + QCOMPARE(dock2.windowTitle(), dock2Title); +} QTEST_MAIN(tst_QDockWidget) #include "tst_qdockwidget.moc" diff --git a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp index b1610c297d..954ee6471d 100644 --- a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp +++ b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp @@ -324,16 +324,30 @@ void tst_QDoubleSpinBox::setPrefixSuffix() QFETCH(QString, expectedCleanText); QFETCH(bool, show); - QDoubleSpinBox spin(0); + QDoubleSpinBox spin; + if (show) + spin.show(); spin.setDecimals(decimals); + const QSize size1 = spin.sizeHint(); spin.setPrefix(prefix); + const QSize size2 = spin.sizeHint(); spin.setSuffix(suffix); + const QSize size3 = spin.sizeHint(); spin.setValue(value); - if (show) - spin.show(); QCOMPARE(spin.text(), expectedText); QCOMPARE(spin.cleanText(), expectedCleanText); + + if (!suffix.isEmpty()) { + QVERIFY(size2.width() < size3.width()); + spin.setSuffix(QString()); + QCOMPARE(spin.sizeHint(), size2); + } + if (!prefix.isEmpty()) { + QVERIFY(size1.width() < size2.width()); + spin.setPrefix(QString()); + QCOMPARE(spin.sizeHint(), size1); + } } void tst_QDoubleSpinBox::valueChangedHelper(const QString &text) diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp index 6cc19051d2..67b79e3faf 100644 --- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp @@ -1689,14 +1689,16 @@ void tst_QMdiArea::tileSubWindows() workspace.setActiveSubWindow(0); QVERIFY(workspace.viewport()->childrenRect() != workspace.viewport()->rect()); - // Make sure the active window is placed in top left corner regardless + // Make sure the active window does not move position after a tile regardless // of whether we have any windows with staysOnTopHint or not. + workspace.tileSubWindows(); windows.at(3)->setWindowFlags(windows.at(3)->windowFlags() | Qt::WindowStaysOnTopHint); QMdiSubWindow *activeSubWindow = windows.at(6); workspace.setActiveSubWindow(activeSubWindow); QCOMPARE(workspace.activeSubWindow(), activeSubWindow); + QPoint pos = activeSubWindow->geometry().topLeft(); workspace.tileSubWindows(); - QCOMPARE(activeSubWindow->geometry().topLeft(), QPoint(0, 0)); + QCOMPARE(activeSubWindow->geometry().topLeft(), pos); // Verify that we try to resize the area such that all sub-windows are visible. // It's important that tiled windows are NOT overlapping. @@ -1713,6 +1715,8 @@ void tst_QMdiArea::tileSubWindows() // Prevent scrollbars from messing up the expected viewport calculation below workspace.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); workspace.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + QCOMPARE(workspace.horizontalScrollBarPolicy(), Qt::ScrollBarAlwaysOff); + QCOMPARE(workspace.verticalScrollBarPolicy(), Qt::ScrollBarAlwaysOff); workspace.tileSubWindows(); // The sub-windows are now tiled like this: @@ -1731,9 +1735,11 @@ void tst_QMdiArea::tileSubWindows() const QSize expectedViewportSize(3 * minSize.width() + spacing, 3 * minSize.height() + spacing); QTRY_COMPARE(workspace.viewport()->rect().size(), expectedViewportSize); - // Restore original scrollbar behavior for test below + // Enable scroll bar for test below (default property for QMdiArea is Qt::ScrollBarAlwaysOff) workspace.setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); workspace.setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); + QCOMPARE(workspace.horizontalScrollBarPolicy(), Qt::ScrollBarAsNeeded); + QCOMPARE(workspace.verticalScrollBarPolicy(), Qt::ScrollBarAsNeeded); // Not enough space for all sub-windows to be visible -> provide scroll bars. workspace.resize(160, 150); @@ -1754,13 +1760,16 @@ void tst_QMdiArea::tileSubWindows() QCOMPARE(vBar->value(), 0); QCOMPARE(vBar->minimum(), 0); + // Tile windows with scroll bars enabled. workspace.tileSubWindows(); QVERIFY(QTest::qWaitForWindowExposed(&workspace)); qApp->processEvents(); - QTRY_VERIFY(workspace.size() != QSize(150, 150)); - QTRY_VERIFY(!vBar->isVisible()); - QTRY_VERIFY(!hBar->isVisible()); + // Workspace should not have changed size after tile. + QTRY_VERIFY(workspace.size() == QSize(160, 150)); + // Scroll bars should be visible. + QTRY_VERIFY(vBar->isVisible()); + QTRY_VERIFY(hBar->isVisible()); } void tst_QMdiArea::cascadeAndTileSubWindows() @@ -2180,7 +2189,7 @@ void tst_QMdiArea::setActivationOrder_data() list << 2 << 1 << 0 << 1 << 2 << 3 << 4; list2 << 0 << 1 << 2 << 3 << 4; - list3 << 1 << 4 << 3 << 1 << 2 << 0; + list3 << 4 << 3 << 2 << 4 << 1 << 0; // Most recently created window is in top-left position QTest::newRow("CreationOrder") << QMdiArea::CreationOrder << 5 << 3 << 1 << list << list2 << list3; list = QList<int>(); @@ -2188,7 +2197,7 @@ void tst_QMdiArea::setActivationOrder_data() list2 = QList<int>(); list2 << 0 << 2 << 4 << 1 << 3; list3 = QList<int>(); - list3 << 1 << 3 << 4 << 1 << 2 << 0; + list3 << 3 << 1 << 4 << 3 << 2 << 0; // Window with "stays-on-top" flag set will be in the top-left position QTest::newRow("StackingOrder") << QMdiArea::StackingOrder << 5 << 3 << 1 << list << list2 << list3; list = QList<int>(); diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index a88fd8d19c..3bfbe754ef 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -1001,7 +1001,7 @@ void tst_QMenu::task258920_mouseBorder() menu.setMouseTracking(true); QAction *action = menu.addAction("test"); - const QPoint center = QApplication::desktop()->availableGeometry().center(); + const QPoint center = QGuiApplication::primaryScreen()->availableGeometry().center(); menu.popup(center); QVERIFY(QTest::qWaitForWindowExposed(&menu)); QRect actionRect = menu.actionGeometry(action); @@ -1073,9 +1073,9 @@ void tst_QMenu::pushButtonPopulateOnAboutToShow() QMenu *buttonMenu= new PopulateOnAboutToShowTestMenu(&b); b.setMenu(buttonMenu); - const int scrNumber = QApplication::desktop()->screenNumber(&b); + const QScreen *scr = QGuiApplication::screenAt(b.pos()); b.show(); - const QRect screen = QApplication::desktop()->screenGeometry(scrNumber); + const QRect screen = scr->geometry(); QRect desiredGeometry = b.geometry(); desiredGeometry.moveTopLeft(QPoint(screen.x() + 10, screen.bottom() - b.height() - 5)); @@ -1143,8 +1143,16 @@ void tst_QMenu::QTBUG7411_submenus_activate() QTRY_VERIFY(sub1.isVisible()); } +static bool isPlatformWayland() +{ + return !QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive); +} + void tst_QMenu::QTBUG30595_rtl_submenu() { + if (isPlatformWayland()) + QSKIP("Creating xdg_popups on Wayland requires real input events. Positions would be off."); + QMenu menu("Test Menu"); menu.setLayoutDirection(Qt::RightToLeft); QMenu sub("&sub"); @@ -1179,6 +1187,9 @@ void tst_QMenu::QTBUG20403_nested_popup_on_shortcut_trigger() #ifndef Q_OS_MACOS void tst_QMenu::click_while_dismissing_submenu() { + if (isPlatformWayland()) + QSKIP("Wayland: Creating (grabbing) popups requires real mouse events."); + QMenu menu("Test Menu"); QAction *action = menu.addAction("action"); QMenu sub("&sub"); @@ -1439,13 +1450,14 @@ void tst_QMenu::QTBUG_56917_wideMenuScreenNumber() QString longString; longString.fill(QLatin1Char('Q'), 3000); - for (int i = 0; i < QApplication::desktop()->screenCount(); i++) { + const QList<QScreen *> screens = QGuiApplication::screens(); + for (QScreen *screen : screens) { QMenu menu; menu.addAction(longString); - menu.popup(QApplication::desktop()->screen(i)->geometry().center()); + menu.popup(screen->geometry().center()); QVERIFY(QTest::qWaitForWindowExposed(&menu)); QVERIFY(menu.isVisible()); - QCOMPARE(QApplication::desktop()->screenNumber(&menu), i); + QCOMPARE(QGuiApplication::screenAt(menu.pos()), screen); } } @@ -1457,19 +1469,20 @@ void tst_QMenu::QTBUG_56917_wideSubmenuScreenNumber() QString longString; longString.fill(QLatin1Char('Q'), 3000); - for (int i = 0; i < QApplication::desktop()->screenCount(); i++) { + const QList<QScreen *> screens = QGuiApplication::screens(); + for (QScreen *screen : screens) { QMenu menu; QMenu submenu("Submenu"); submenu.addAction(longString); QAction *action = menu.addMenu(&submenu); - menu.popup(QApplication::desktop()->screen(i)->geometry().center()); + menu.popup(screen->geometry().center()); QVERIFY(QTest::qWaitForWindowExposed(&menu)); QVERIFY(menu.isVisible()); QTest::mouseClick(&menu, Qt::LeftButton, 0, menu.actionGeometry(action).center()); QTest::qWait(100); QVERIFY(QTest::qWaitForWindowExposed(&submenu)); QVERIFY(submenu.isVisible()); - QCOMPARE(QApplication::desktop()->screenNumber(&submenu), i); + QCOMPARE(QGuiApplication::screenAt(submenu.pos()), screen); } } @@ -1566,6 +1579,13 @@ void tst_QMenu::menuSize_Scrolling() #ifdef Q_OS_WINRT QEXPECT_FAIL("", "Broken on WinRT - QTBUG-68297", Abort); #endif + if (!QGuiApplication::platformName().compare(QLatin1String("minimal"), Qt::CaseInsensitive) + || !QGuiApplication::platformName().compare(QLatin1String("offscreen"), Qt::CaseInsensitive)) { + QWARN("Skipping test on minimal/offscreen platforms - QTBUG-73522"); + QMenu::showEvent(e); + return; + } + QCOMPARE( s.width(), lastItem.right() + fw + hmargin + rightMargin + 1); QMenu::showEvent(e); } diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp index 3063d43aa6..cb829c81a6 100644 --- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp @@ -326,7 +326,7 @@ TestMenu tst_QMenuBar::initComplexMenuBar(QMenuBar *mb) connect(action, SIGNAL(triggered()), this, SLOT(onComplexActionTriggered())); result.actions << action; - qFill(m_complexTriggerCount, m_complexTriggerCount + sizeof(m_complexTriggerCount) / sizeof(int), 0); + std::fill(m_complexTriggerCount, m_complexTriggerCount + sizeof(m_complexTriggerCount) / sizeof(int), 0); return result; } diff --git a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp index cfa2ddc4cc..2ce75620cf 100644 --- a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp +++ b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp @@ -140,6 +140,11 @@ private slots: void findBackwardWithRegExp(); void findWithRegExpReturnsFalseIfNoMoreResults(); #endif +#if QT_CONFIG(regularexpression) + void findWithRegularExpression(); + void findBackwardWithRegularExpression(); + void findWithRegularExpressionReturnsFalseIfNoMoreResults(); +#endif void layoutAfterMultiLineRemove(); void undoCommandRemovesAndReinsertsBlock(); void taskQTBUG_43562_lineCountCrash(); @@ -147,6 +152,9 @@ private slots: void contextMenu(); #endif void inputMethodCursorRect(); +#if QT_CONFIG(scrollbar) + void updateAfterChangeCenterOnScroll(); +#endif private: void createSelection(); @@ -201,12 +209,12 @@ void tst_QPlainTextEdit::getSetCheck() // int QPlainTextEdit::tabStopWidth() // void QPlainTextEdit::setTabStopWidth(int) - obj1.setTabStopWidth(0); - QCOMPARE(0, obj1.tabStopWidth()); - obj1.setTabStopWidth(INT_MIN); - QCOMPARE(0, obj1.tabStopWidth()); // Makes no sense to set a negative tabstop value - obj1.setTabStopWidth(INT_MAX); - QCOMPARE(INT_MAX, obj1.tabStopWidth()); + obj1.setTabStopDistance(0); + QCOMPARE(0, obj1.tabStopDistance()); + obj1.setTabStopDistance(-1); + QCOMPARE(0, obj1.tabStopDistance()); // Makes no sense to set a negative tabstop value + obj1.setTabStopDistance(std::numeric_limits<qreal>::max()); + QCOMPARE(std::numeric_limits<qreal>::max(), obj1.tabStopDistance()); } class QtTestDocumentLayout : public QAbstractTextDocumentLayout @@ -1579,6 +1587,45 @@ void tst_QPlainTextEdit::findWithRegExpReturnsFalseIfNoMoreResults() } #endif +#if QT_CONFIG(regularexpression) +void tst_QPlainTextEdit::findWithRegularExpression() +{ + ed->setPlainText(QStringLiteral("arbitrary text")); + QRegularExpression rx("\\w{2}xt"); + + bool found = ed->find(rx); + + QVERIFY(found); + QCOMPARE(ed->textCursor().selectedText(), QStringLiteral("text")); +} + +void tst_QPlainTextEdit::findBackwardWithRegularExpression() +{ + ed->setPlainText(QStringLiteral("arbitrary text")); + QTextCursor cursor = ed->textCursor(); + cursor.movePosition(QTextCursor::End); + ed->setTextCursor(cursor); + QRegularExpression rx("a\\w*t"); + + bool found = ed->find(rx, QTextDocument::FindBackward); + + QVERIFY(found); + QCOMPARE(ed->textCursor().selectedText(), QStringLiteral("arbit")); +} + +void tst_QPlainTextEdit::findWithRegularExpressionReturnsFalseIfNoMoreResults() +{ + ed->setPlainText(QStringLiteral("arbitrary text")); + QRegularExpression rx("t.xt"); + ed->find(rx); + + bool found = ed->find(rx); + + QVERIFY(!found); + QCOMPARE(ed->textCursor().selectedText(), QStringLiteral("text")); +} +#endif + void tst_QPlainTextEdit::layoutAfterMultiLineRemove() { ed->setVisible(true); // The widget must be visible to reproduce this bug. @@ -1727,5 +1774,20 @@ void tst_QPlainTextEdit::inputMethodCursorRect() QCOMPARE(cursorRectV.toRect(), cursorRect.toRect()); } +#if QT_CONFIG(scrollbar) +// QTBUG-64730: Verify that the scrollbar is updated after center on scroll was set +void tst_QPlainTextEdit::updateAfterChangeCenterOnScroll() +{ + ed->setPlainText("Line1\nLine2Line3\nLine3"); + ed->show(); + ed->setCenterOnScroll(true); + const int maxWithCenterOnScroll = ed->verticalScrollBar()->maximum(); + ed->setCenterOnScroll(false); + const int maxWithoutCenterOnScroll = ed->verticalScrollBar()->maximum(); + QVERIFY(maxWithCenterOnScroll > maxWithoutCenterOnScroll); +} + +#endif + QTEST_MAIN(tst_QPlainTextEdit) #include "tst_qplaintextedit.moc" diff --git a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp index 1d106f94f3..52d7dad7cf 100644 --- a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp @@ -461,17 +461,33 @@ void tst_QSpinBox::setPrefixSuffix() QFETCH(QString, expectedCleanText); QFETCH(bool, show); - QSpinBox spin(0); + QSpinBox spin; + if (show) { + spin.show(); + spin.setPrefix(QString()); // trigger a recalc of sizeHint + } + const QSize size1 = spin.sizeHint(); spin.setPrefix(prefix); + const QSize size2 = spin.sizeHint(); spin.setSuffix(suffix); + const QSize size3 = spin.sizeHint(); spin.setValue(value); - if (show) - spin.show(); QCOMPARE(spin.prefix(), prefix); QCOMPARE(spin.suffix(), suffix); QCOMPARE(spin.text(), expectedText); QCOMPARE(spin.cleanText(), expectedCleanText); + + if (!suffix.isEmpty()) { + QVERIFY(size2.width() < size3.width()); + spin.setSuffix(QString()); + QCOMPARE(spin.sizeHint(), size2); + } + if (!prefix.isEmpty()) { + QVERIFY(size1.width() < size2.width()); + spin.setPrefix(QString()); + QCOMPARE(spin.sizeHint(), size1); + } } void tst_QSpinBox::valueChangedHelper(const QString &text) diff --git a/tests/auto/widgets/widgets/qsplitter/BLACKLIST b/tests/auto/widgets/widgets/qsplitter/BLACKLIST deleted file mode 100644 index 1352805cd7..0000000000 --- a/tests/auto/widgets/widgets/qsplitter/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[replaceWidget:visible, not collapsed] -xcb diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp index 6a2ae4951b..3669935823 100644 --- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp @@ -199,6 +199,12 @@ private slots: void findWithRegExpReturnsFalseIfNoMoreResults(); #endif +#if QT_CONFIG(regularexpression) + void findWithRegularExpression(); + void findBackwardWithRegularExpression(); + void findWithRegularExpressionReturnsFalseIfNoMoreResults(); +#endif + #if QT_CONFIG(wheelevent) void wheelEvent(); #endif @@ -276,12 +282,12 @@ void tst_QTextEdit::getSetCheck() // int QTextEdit::tabStopWidth() // void QTextEdit::setTabStopWidth(int) - obj1.setTabStopWidth(0); - QCOMPARE(0, obj1.tabStopWidth()); - obj1.setTabStopWidth(INT_MIN); - QCOMPARE(0, obj1.tabStopWidth()); // Makes no sense to set a negative tabstop value - obj1.setTabStopWidth(INT_MAX); - QCOMPARE(INT_MAX, obj1.tabStopWidth()); + obj1.setTabStopDistance(0); + QCOMPARE(0, obj1.tabStopDistance()); + obj1.setTabStopDistance(-1); + QCOMPARE(0, obj1.tabStopDistance()); // Makes no sense to set a negative tabstop value + obj1.setTabStopDistance(std::numeric_limits<qreal>::max()); + QCOMPARE(std::numeric_limits<qreal>::max(), obj1.tabStopDistance()); // bool QTextEdit::acceptRichText() // void QTextEdit::setAcceptRichText(bool) @@ -2572,6 +2578,45 @@ void tst_QTextEdit::findWithRegExpReturnsFalseIfNoMoreResults() } #endif +#if QT_CONFIG(regularexpression) +void tst_QTextEdit::findWithRegularExpression() +{ + ed->setHtml(QStringLiteral("arbitrary te<span style=\"color:#ff0000\">xt</span>")); + QRegularExpression rx("\\w{2}xt"); + + bool found = ed->find(rx); + + QVERIFY(found); + QCOMPARE(ed->textCursor().selectedText(), QStringLiteral("text")); +} + +void tst_QTextEdit::findBackwardWithRegularExpression() +{ + ed->setPlainText(QStringLiteral("arbitrary text")); + QTextCursor cursor = ed->textCursor(); + cursor.movePosition(QTextCursor::End); + ed->setTextCursor(cursor); + QRegularExpression rx("a\\w*t"); + + bool found = ed->find(rx, QTextDocument::FindBackward); + + QVERIFY(found); + QCOMPARE(ed->textCursor().selectedText(), QStringLiteral("arbit")); +} + +void tst_QTextEdit::findWithRegularExpressionReturnsFalseIfNoMoreResults() +{ + ed->setPlainText(QStringLiteral("arbitrary text")); + QRegularExpression rx("t.xt"); + ed->find(rx); + + bool found = ed->find(rx); + + QVERIFY(!found); + QCOMPARE(ed->textCursor().selectedText(), QStringLiteral("text")); +} +#endif + #if QT_CONFIG(wheelevent) class TextEdit : public QTextEdit diff --git a/tests/benchmarks/corelib/io/qfileinfo/main.cpp b/tests/benchmarks/corelib/io/qfileinfo/main.cpp index 5180e7c29e..6cc96777a1 100644 --- a/tests/benchmarks/corelib/io/qfileinfo/main.cpp +++ b/tests/benchmarks/corelib/io/qfileinfo/main.cpp @@ -81,7 +81,7 @@ void qfileinfo::symLinkTargetPerformanceLNK() QString linkTarget; QBENCHMARK { for(int i=0; i<100; i++) - linkTarget = info.readLink(); + linkTarget = info.symLinkTarget(); } QVERIFY(QFile::remove("link.lnk")); } @@ -94,7 +94,9 @@ void qfileinfo::symLinkTargetPerformanceMounpoint() QString rootVolume = QString::fromWCharArray(buffer); QString mountpoint = "mountpoint"; rootVolume.replace("\\\\?\\","\\??\\"); - FileSystem::createNtfsJunction(rootVolume, mountpoint); + QString errorMessage; + QVERIFY2(FileSystem::createNtfsJunction(rootVolume, mountpoint, &errorMessage) == ERROR_SUCCESS, + qPrintable(errorMessage)); QFileInfo info(mountpoint); info.setCaching(false); @@ -102,7 +104,7 @@ void qfileinfo::symLinkTargetPerformanceMounpoint() QString linkTarget; QBENCHMARK { for(int i=0; i<100; i++) - linkTarget = info.readLink(); + linkTarget = info.symLinkTarget(); } QVERIFY(QDir().rmdir(mountpoint)); } diff --git a/tests/benchmarks/corelib/io/qtextstream/qtextstream.pro b/tests/benchmarks/corelib/io/qtextstream/qtextstream.pro index 758930c139..e8170319f2 100644 --- a/tests/benchmarks/corelib/io/qtextstream/qtextstream.pro +++ b/tests/benchmarks/corelib/io/qtextstream/qtextstream.pro @@ -1,5 +1,5 @@ TEMPLATE = app -TARGET = tst_bench_qtemporaryfile +TARGET = tst_bench_qtextstream QT = core testlib diff --git a/tests/benchmarks/corelib/mimetypes/qmimedatabase/main.cpp b/tests/benchmarks/corelib/mimetypes/qmimedatabase/main.cpp index 704119b921..1b432f3b3e 100644 --- a/tests/benchmarks/corelib/mimetypes/qmimedatabase/main.cpp +++ b/tests/benchmarks/corelib/mimetypes/qmimedatabase/main.cpp @@ -35,6 +35,7 @@ class tst_QMimeDatabase: public QObject private slots: void inheritsPerformance(); + void benchMimeTypeForName(); }; void tst_QMimeDatabase::inheritsPerformance() @@ -70,5 +71,15 @@ void tst_QMimeDatabase::inheritsPerformance() // parsing XML, and then keeps being around 4.5 MB for all the in-memory hashes. } +void tst_QMimeDatabase::benchMimeTypeForName() +{ + QMimeDatabase db; + + QBENCHMARK { + const auto s = db.mimeTypeForName(QStringLiteral("text/plain")); + QVERIFY(s.isValid()); + } +} + QTEST_MAIN(tst_QMimeDatabase) #include "main.moc" diff --git a/tests/benchmarks/corelib/tools/qmap/qmap.pro b/tests/benchmarks/corelib/tools/qmap/qmap.pro index 6a0c8d62bd..6c9bf5e8d6 100644 --- a/tests/benchmarks/corelib/tools/qmap/qmap.pro +++ b/tests/benchmarks/corelib/tools/qmap/qmap.pro @@ -1,4 +1,4 @@ -TARGET = tst_qmap +TARGET = tst_bench_qmap QT = core testlib INCLUDEPATH += . SOURCES += main.cpp diff --git a/tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp b/tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp index e0f69bee11..605df100ee 100644 --- a/tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp +++ b/tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp @@ -200,6 +200,8 @@ void tst_QImageConversion::convertRgb32_data() QTest::newRow("argb32 -> argb8565pm") << argb32 << QImage::Format_ARGB8565_Premultiplied; QTest::newRow("argb32 -> argb4444pm") << argb32 << QImage::Format_ARGB4444_Premultiplied; QTest::newRow("argb32 -> argb6666pm") << argb32 << QImage::Format_ARGB6666_Premultiplied; + QTest::newRow("argb32 -> rgba64") << argb32 << QImage::Format_RGBA64; + QTest::newRow("argb32 -> rgba64pm") << argb32 << QImage::Format_RGBA64_Premultiplied; QTest::newRow("argb32pm -> rgb16") << argb32pm << QImage::Format_RGB16; QTest::newRow("argb32pm -> rgb32") << argb32pm << QImage::Format_RGB32; @@ -239,6 +241,7 @@ void tst_QImageConversion::convertGeneric_data() QImage a2rgb30 = argb32.convertToFormat(QImage::Format_A2RGB30_Premultiplied); QImage rgb666 = rgb32.convertToFormat(QImage::Format_RGB666); QImage argb4444 = argb32.convertToFormat(QImage::Format_ARGB4444_Premultiplied); + QImage rgba64pm = argb32.convertToFormat(QImage::Format_RGBA64_Premultiplied); QTest::newRow("indexed8 -> rgb32") << i8 << QImage::Format_RGB32; QTest::newRow("indexed8 -> argb32") << i8 << QImage::Format_ARGB32; @@ -289,6 +292,13 @@ void tst_QImageConversion::convertGeneric_data() QTest::newRow("argb4444pm -> rgba8888pm") << argb4444 << QImage::Format_RGBA8888_Premultiplied; QTest::newRow("argb4444pm -> rgb30") << argb4444 << QImage::Format_RGB30; QTest::newRow("argb4444pm -> a2bgr30") << argb4444 << QImage::Format_A2BGR30_Premultiplied; + + QTest::newRow("rgba64pm -> argb32") << rgba64pm << QImage::Format_ARGB32; + QTest::newRow("rgba64pm -> rgbx8888") << rgba64pm << QImage::Format_RGBX8888; + QTest::newRow("rgba64pm -> rgba8888pm") << rgba64pm << QImage::Format_RGBA8888_Premultiplied; + QTest::newRow("rgba64pm -> rgb30") << rgba64pm << QImage::Format_RGB30; + QTest::newRow("rgba64pm -> a2bgr30") << rgba64pm << QImage::Format_A2BGR30_Premultiplied; + QTest::newRow("rgba64pm -> rgba64") << rgba64pm << QImage::Format_RGBA64; } void tst_QImageConversion::convertGeneric() diff --git a/tests/benchmarks/widgets/itemviews/itemviews.pro b/tests/benchmarks/widgets/itemviews/itemviews.pro index a23cdf7b97..0c3256f307 100644 --- a/tests/benchmarks/widgets/itemviews/itemviews.pro +++ b/tests/benchmarks/widgets/itemviews/itemviews.pro @@ -1,4 +1,5 @@ TEMPLATE = subdirs SUBDIRS = \ qtableview \ - qheaderview + qheaderview \ + qlistview diff --git a/tests/benchmarks/widgets/itemviews/qlistview/qlistview.pro b/tests/benchmarks/widgets/itemviews/qlistview/qlistview.pro new file mode 100644 index 0000000000..68537d09ea --- /dev/null +++ b/tests/benchmarks/widgets/itemviews/qlistview/qlistview.pro @@ -0,0 +1,7 @@ +QT += widgets testlib + +TEMPLATE = app +TARGET = tst_bench_qlistview + +SOURCES += tst_qlistview.cpp + diff --git a/tests/benchmarks/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/benchmarks/widgets/itemviews/qlistview/tst_qlistview.cpp new file mode 100644 index 0000000000..01496743c2 --- /dev/null +++ b/tests/benchmarks/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <qtest.h> +#include <QListView> +#include <QStandardItemModel> + + +class tst_QListView : public QObject +{ + Q_OBJECT + +public: + tst_QListView() = default; + virtual ~tst_QListView() = default; + +private slots: + void benchSetCurrentIndex(); +}; + +void tst_QListView::benchSetCurrentIndex() +{ + QStandardItemModel sm(50000, 1); + QListView lv; + lv.setModel(&sm); + const int rc = lv.model()->rowCount(); + for (int i = 0; i < rc; i+= 100) + lv.setRowHidden(i, true); + lv.setCurrentIndex(lv.model()->index(0, 0, QModelIndex())); + lv.show(); + QVERIFY(QTest::qWaitForWindowExposed(&lv)); + + QBENCHMARK_ONCE { + while (lv.currentIndex().row() < rc - 20) + lv.setCurrentIndex(lv.model()->index(lv.currentIndex().row() + 17, + lv.currentIndex().column(), + QModelIndex())); + } +} + + +QTEST_MAIN(tst_QListView) +#include "tst_qlistview.moc" diff --git a/tests/libfuzzer/README b/tests/libfuzzer/README new file mode 100644 index 0000000000..7327e76eff --- /dev/null +++ b/tests/libfuzzer/README @@ -0,0 +1,39 @@ +This directory contains tests to be run with clang's libFuzzer. It will generate data, pass this +data to the function + + LLVMFuzzerTestOneInput(const char *Data, size_t Size) + +of the test and track the code execution. Should the test crash, libFuzzer will provide you with the +data which triggered the crash. You can then use this to debug and fix the called code. + +! Please note: The purpose of fuzz testing is to find unexpected code paths. Running fuzz tests may! +! result in unforeseen bevavior, including loss of data. Consider running the tests in an isolated ! +! environment, e.g. on a virtual machine. You have been warned. ! + +To run a test with libFuzzer: + +1. Install clang 5.0 or later, e.g. from the repositories of the Linux distribution you are using. + Depending on the version of clang and the source you are installing from, you might have to + install libFuzzer for this version of clang explicitly. +2. Make sure clang and clang++ from this version of clang are found in PATH. +3. Configure Qt with + -platform linux-clang -coverage trace-pc-guard + to add the needed code coverage instrumentation. Since speed of execution is crucial for fuzz + testing, it's recommendable to also use the switches + -release -static + It might also make sense to add sanitzers by passing + -sanitize <...> +4. Build Qt. +5. Build one of the tests using this Qt build. +6. Execute the resulting executable. + Depending on the expected input format of the tested function, you will get results faster if + you: + * provide a set of interesting input data by passing the path of a directory which contains + these data, each in one file. You can find such datasets in the subdirectory "testcases". + * pass a so-called dictionary listing keywords of the input format using + -dict=<dictionary file> + A couple of such dictionaries are provided by AFL (http://lcamtuf.coredump.cx/afl/) + * tell libFuzzer to generate only ASCII data using + -only_ascii=1 + +For further info, see https://llvm.org/docs/LibFuzzer.html diff --git a/tests/libfuzzer/corelib/serialization/qxmlstream/qxmlstreamreader/readnext/main.cpp b/tests/libfuzzer/corelib/serialization/qxmlstream/qxmlstreamreader/readnext/main.cpp new file mode 100644 index 0000000000..5a60c78cb5 --- /dev/null +++ b/tests/libfuzzer/corelib/serialization/qxmlstream/qxmlstreamreader/readnext/main.cpp @@ -0,0 +1,36 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QXmlStreamReader> + +extern "C" int LLVMFuzzerTestOneInput(const char *Data, size_t Size) { + QXmlStreamReader reader(QByteArray(Data, Size)); + while (!reader.atEnd()) + reader.readNext(); + return 0; +} diff --git a/tests/libfuzzer/corelib/serialization/qxmlstream/qxmlstreamreader/readnext/readnext.pro b/tests/libfuzzer/corelib/serialization/qxmlstream/qxmlstreamreader/readnext/readnext.pro new file mode 100644 index 0000000000..2fda3ecefd --- /dev/null +++ b/tests/libfuzzer/corelib/serialization/qxmlstream/qxmlstreamreader/readnext/readnext.pro @@ -0,0 +1,5 @@ +QT -= gui +CONFIG += console +CONFIG -= app_bundle +SOURCES += main.cpp +LIBS += -fsanitize=fuzzer diff --git a/tests/libfuzzer/gui/text/qtextdocument/setHtml/main.cpp b/tests/libfuzzer/gui/text/qtextdocument/setHtml/main.cpp new file mode 100644 index 0000000000..c9b33d0f88 --- /dev/null +++ b/tests/libfuzzer/gui/text/qtextdocument/setHtml/main.cpp @@ -0,0 +1,37 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QApplication> +#include <QTextDocument> + +extern "C" int LLVMFuzzerTestOneInput(const char *Data, size_t Size) { + static int c = 0; + static QApplication a(c, nullptr); + QTextDocument().setHtml(QByteArray(Data, Size)); + return 0; +} diff --git a/tests/libfuzzer/gui/text/qtextdocument/setHtml/setHtml.pro b/tests/libfuzzer/gui/text/qtextdocument/setHtml/setHtml.pro new file mode 100644 index 0000000000..c9b14f6caf --- /dev/null +++ b/tests/libfuzzer/gui/text/qtextdocument/setHtml/setHtml.pro @@ -0,0 +1,3 @@ +QT += widgets +SOURCES += main.cpp +LIBS += -fsanitize=fuzzer diff --git a/tests/manual/dialogs/filedialogpanel.cpp b/tests/manual/dialogs/filedialogpanel.cpp index 62d03e735d..25c1e44b8c 100644 --- a/tests/manual/dialogs/filedialogpanel.cpp +++ b/tests/manual/dialogs/filedialogpanel.cpp @@ -438,9 +438,9 @@ void FileDialogPanel::restoreDefaults() setComboBoxValue(m_viewMode, d.viewMode()); m_showDirsOnly->setChecked(d.testOption(QFileDialog::ShowDirsOnly)); m_allowedSchemes->setText(QString()); - m_confirmOverWrite->setChecked(d.confirmOverwrite()); - m_nameFilterDetailsVisible->setChecked(d.isNameFilterDetailsVisible()); - m_resolveSymLinks->setChecked(d.resolveSymlinks()); + m_confirmOverWrite->setChecked(!d.testOption(QFileDialog::DontConfirmOverwrite)); + m_nameFilterDetailsVisible->setChecked(!d.testOption(QFileDialog::HideNameFilterDetails)); + m_resolveSymLinks->setChecked(!d.testOption(QFileDialog::DontResolveSymlinks)); m_readOnly->setChecked(d.isReadOnly()); m_native->setChecked(true); m_customDirIcons->setChecked(d.testOption(QFileDialog::DontUseCustomDirectoryIcons)); diff --git a/tests/manual/dialogs/printdialogpanel.cpp b/tests/manual/dialogs/printdialogpanel.cpp index d999dbc30c..8d64d2f6a6 100644 --- a/tests/manual/dialogs/printdialogpanel.cpp +++ b/tests/manual/dialogs/printdialogpanel.cpp @@ -55,6 +55,10 @@ #include <QTextStream> #include <QDir> +#if QT_VERSION >= 0x050000 +# include <QScreen> +#endif + const FlagData printerModeComboData[] = { {"ScreenResolution", QPrinter::ScreenResolution}, @@ -705,7 +709,13 @@ void PrintDialogPanel::showPreviewDialog() { applySettings(m_printer.data()); PrintPreviewDialog dialog(m_printer.data(), this); - dialog.resize(QApplication::desktop()->availableGeometry().size() * 4/ 5); +#if QT_VERSION >= 0x050000 + const int screenNumber = QApplication::desktop()->screenNumber(this); + const QSize availableSize = QGuiApplication::screens().at(screenNumber)->availableSize(); +#else + const QSize availableSize = QApplication::desktop()->availableGeometry().size(); +#endif + dialog.resize(availableSize * 4/ 5); if (dialog.exec() == QDialog::Accepted) retrieveSettings(m_printer.data()); } diff --git a/tests/manual/foreignwindows/main.cpp b/tests/manual/foreignwindows/main.cpp index 74c6d8c376..44aff54773 100644 --- a/tests/manual/foreignwindows/main.cpp +++ b/tests/manual/foreignwindows/main.cpp @@ -195,6 +195,9 @@ static QString description(const QString &appName) "tests embedding foreign windows into Qt.\n\nUse cases:\n\n" << appName << " -a Dump a list of all native window ids.\n" << appName << " <winid> Dump information on the window.\n" + << appName << " -m <winid> Move window to top left corner\n" + << QByteArray(appName.size(), ' ') + << " (recover lost windows after changing monitor setups).\n" << appName << " -c <winid> Dump information on the window continuously.\n" << appName << " -e <winid> Embed window into a Qt widget.\n" << "\nOn Windows, class names of well known controls (EDIT, BUTTON...) can be\n" @@ -245,6 +248,10 @@ int main(int argc, char *argv[]) parser.addOption(outputAllOption); QCommandLineOption continuousOption(QStringList() << QStringLiteral("c") << QStringLiteral("continuous"), QStringLiteral("Output continuously.")); + parser.addOption(outputAllOption); + QCommandLineOption moveOption(QStringList() << QStringLiteral("m") << QStringLiteral("move"), + QStringLiteral("Move window to top left corner.")); + parser.addOption(moveOption); parser.addOption(continuousOption); QCommandLineOption embedOption(QStringList() << QStringLiteral("e") << QStringLiteral("embed"), QStringLiteral("Embed a foreign window into a Qt widget.")); @@ -274,8 +281,12 @@ int main(int argc, char *argv[]) return -1; } QWindow *foreignWindow = QWindow::fromWinId(wid); + if (!foreignWindow) + return -1; foreignWindow->setObjectName("ForeignWindow" + QString::number(wid, 16)); windows.append(foreignWindow); + if (parser.isSet(moveOption)) + foreignWindow->setFramePosition(QGuiApplication::primaryScreen()->availableGeometry().topLeft()); } if (windows.isEmpty()) diff --git a/tests/manual/lance/interactivewidget.cpp b/tests/manual/lance/interactivewidget.cpp index 8ac3881af7..d172fac900 100644 --- a/tests/manual/lance/interactivewidget.cpp +++ b/tests/manual/lance/interactivewidget.cpp @@ -45,7 +45,7 @@ InteractiveWidget::InteractiveWidget() // create and populate the command toolbox m_commandsToolBox = new QToolBox(); - QListWidget *currentListWidget = 0; + QListWidget *currentListWidget = nullptr; foreach (PaintCommands::PaintCommandInfos paintCommandInfo, PaintCommands::s_commandInfoTable) { if (paintCommandInfo.isSectionHeader()) { currentListWidget = new QListWidget(); diff --git a/tests/manual/lance/main.cpp b/tests/manual/lance/main.cpp index 749a4b1943..7f5af2d908 100644 --- a/tests/manual/lance/main.cpp +++ b/tests/manual/lance/main.cpp @@ -185,7 +185,7 @@ static void displayCommands() " pixmap_load filename name_in_script\n" " image_load filename name_in_script\n"); } -static InteractiveWidget *interactive_widget = 0; +static InteractiveWidget *interactive_widget = nullptr; static void runInteractive() { @@ -350,15 +350,15 @@ int main(int argc, char **argv) #endif } } - scaledWidth = width * scalefactor; - scaledHeight = height * scalefactor; + scaledWidth = int(width * scalefactor); + scaledHeight = int(height * scalefactor); PaintCommands pcmd(QStringList(), 800, 800, imageFormat); pcmd.setVerboseMode(verboseMode); pcmd.setType(type); pcmd.setCheckersBackground(checkers_background); - QWidget *activeWidget = 0; + QWidget *activeWidget = nullptr; if (interactive) { runInteractive(); @@ -610,7 +610,7 @@ int main(int argc, char **argv) QPrinter p(highres ? QPrinter::HighResolution : QPrinter::ScreenResolution); if (printdlg) { - QPrintDialog printDialog(&p, 0); + QPrintDialog printDialog(&p, nullptr); if (printDialog.exec() != QDialog::Accepted) break; } else { diff --git a/tests/manual/lance/widgets.h b/tests/manual/lance/widgets.h index 583d9e2455..46c55f4c16 100644 --- a/tests/manual/lance/widgets.h +++ b/tests/manual/lance/widgets.h @@ -45,31 +45,12 @@ #include <QPaintEngine> #include <QSignalMapper> #include <QAction> +#include <QDebug> #include <qmath.h> const int CP_RADIUS = 10; -class StupidWorkaround : public QObject -{ - Q_OBJECT -public: - StupidWorkaround(QWidget *widget, int *value) - : QObject(widget), w(widget), mode(value) - { - } - -public slots: - void setViewMode(int m) { - *mode = m; - w->update(); - } - -private: - QWidget *w; - int *mode; -}; - template <class T> class OnScreenWidget : public T { @@ -81,7 +62,7 @@ public: DifferenceView }; - OnScreenWidget(const QString &file, QWidget *parent = 0) + OnScreenWidget(const QString &file, QWidget *parent = nullptr) : T(parent), m_filename(file), m_view_mode(RenderView) @@ -108,33 +89,20 @@ public: } else { T::setWindowTitle("Rendering: '" + file + "'. Shortcuts: 1=render, 2=baseline, 3=difference"); - StupidWorkaround *workaround = new StupidWorkaround(this, &m_view_mode); - - QSignalMapper *mapper = new QSignalMapper(this); - T::connect(mapper, SIGNAL(mapped(int)), workaround, SLOT(setViewMode(int))); - T::connect(mapper, SIGNAL(mapped(QString)), this, SLOT(setWindowTitle(QString))); - QAction *renderViewAction = new QAction("Render View", this); renderViewAction->setShortcut(Qt::Key_1); - T::connect(renderViewAction, SIGNAL(triggered()), mapper, SLOT(map())); - mapper->setMapping(renderViewAction, RenderView); - mapper->setMapping(renderViewAction, "Render View: " + file); + T::connect(renderViewAction, &QAction::triggered, [&] { setMode(RenderView); }); T::addAction(renderViewAction); QAction *baselineAction = new QAction("Baseline", this); baselineAction->setShortcut(Qt::Key_2); - T::connect(baselineAction, SIGNAL(triggered()), mapper, SLOT(map())); - mapper->setMapping(baselineAction, BaselineView); - mapper->setMapping(baselineAction, "Baseline View: " + file); + T::connect(baselineAction, &QAction::triggered, [&] { setMode(BaselineView); }); T::addAction(baselineAction); - QAction *differenceAction = new QAction("Differenfe View", this); + QAction *differenceAction = new QAction("Difference View", this); differenceAction->setShortcut(Qt::Key_3); - T::connect(differenceAction, SIGNAL(triggered()), mapper, SLOT(map())); - mapper->setMapping(differenceAction, DifferenceView); - mapper->setMapping(differenceAction, "Difference View" + file); + T::connect(differenceAction, &QAction::triggered, [&] { setMode(DifferenceView); }); T::addAction(differenceAction); - } } @@ -148,6 +116,18 @@ public: settings.sync(); } + void setMode(ViewMode mode) { + m_view_mode = mode; + QString title; + switch (m_view_mode) { + case RenderView: title = "Render"; break; + case BaselineView: title = "Baseline"; break; + case DifferenceView: title = "Difference"; break; + } + T::setWindowTitle(title + " View: " + m_filename); + T::update(); + } + void setVerboseMode(bool v) { m_verboseMode = v; } void setCheckersBackground(bool b) { m_checkersBackground = b; } void setType(DeviceType t) { m_deviceType = t; } @@ -205,7 +185,7 @@ public: pt.begin(this); pt.setRenderHint(QPainter::Antialiasing); pt.setFont(this->font()); - pt.resetMatrix(); + pt.resetTransform(); pt.setPen(QColor(127, 127, 127, 191)); pt.setBrush(QColor(191, 191, 255, 63)); for (int i=0; i<m_controlPoints.size(); ++i) { @@ -239,7 +219,7 @@ public: p.drawPixmap(0, 0, m_baseline); - p.setPen(QColor::fromRgb(0, 0, 0, 0.1)); + p.setPen(QColor::fromRgbF(0, 0, 0, 0.1)); p.setFont(QFont("Arial", 128)); p.rotate(45); p.drawText(100, 0, "BASELINE"); @@ -251,7 +231,7 @@ public: img.fill(0); QPainter p(&img); - p.drawPixmap(0, 0, m_render_view); + p.drawImage(0, 0, m_image); p.setCompositionMode(QPainter::RasterOp_SourceXorDestination); p.drawPixmap(0, 0, m_baseline); diff --git a/tests/manual/qcursor/grab_override/mainwindow.cpp b/tests/manual/qcursor/grab_override/mainwindow.cpp index d2b7311846..087ee8d1d8 100644 --- a/tests/manual/qcursor/grab_override/mainwindow.cpp +++ b/tests/manual/qcursor/grab_override/mainwindow.cpp @@ -79,10 +79,10 @@ void MainWindow::toggleOverrideCursor() { switch (override) { case 0: - QApplication::setOverrideCursor(Qt::BusyCursor); + QGuiApplication::setOverrideCursor(Qt::BusyCursor); break; case 1: - QApplication::restoreOverrideCursor(); + QGuiApplication::restoreOverrideCursor(); break; case 2: ui->label->grabMouse(Qt::ForbiddenCursor); diff --git a/tests/manual/qsslsocket/main.cpp b/tests/manual/qsslsocket/main.cpp index b2cc1b5f23..58da520c07 100644 --- a/tests/manual/qsslsocket/main.cpp +++ b/tests/manual/qsslsocket/main.cpp @@ -91,21 +91,21 @@ void tst_QSslSocket::nextProtocolNegotiation_data() << QSslConfiguration::NextProtocolNegotiationNegotiated; tag = host.toLocal8Bit(); - tag.append("-spdy/3"); + tag.append("-h2"); QTest::newRow(tag) << true << host - << (QList<QByteArray>() << QSslConfiguration::NextProtocolSpdy3_0) - << QByteArray(QSslConfiguration::NextProtocolSpdy3_0) + << (QList<QByteArray>() << QSslConfiguration::ALPNProtocolHTTP2) + << QByteArray(QSslConfiguration::ALPNProtocolHTTP2) << QSslConfiguration::NextProtocolNegotiationNegotiated; tag = host.toLocal8Bit(); - tag.append("-spdy/3-and-http/1.1"); + tag.append("-h2-and-http/1.1"); QTest::newRow(tag) << true << host - << (QList<QByteArray>() << QSslConfiguration::NextProtocolSpdy3_0 << QSslConfiguration::NextProtocolHttp1_1) - << QByteArray(QSslConfiguration::NextProtocolSpdy3_0) + << (QList<QByteArray>() << QSslConfiguration::ALPNProtocolHTTP2 << QSslConfiguration::NextProtocolHttp1_1) + << QByteArray(QSslConfiguration::ALPNProtocolHTTP2) << QSslConfiguration::NextProtocolNegotiationNegotiated; } } diff --git a/tests/manual/shortcuts/main.cpp b/tests/manual/shortcuts/main.cpp index acc2a2525c..289e8526f0 100644 --- a/tests/manual/shortcuts/main.cpp +++ b/tests/manual/shortcuts/main.cpp @@ -108,6 +108,7 @@ void ShortcutTester::setupLayout() Qt::ControlModifier + Qt::Key_5, Qt::AltModifier + Qt::Key_5, Qt::ControlModifier + Qt::Key_Plus, Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_Plus, + Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_Equal, Qt::ControlModifier + Qt::Key_Y, Qt::ShiftModifier + Qt::Key_Comma, Qt::ControlModifier + Qt::Key_Comma, Qt::ControlModifier + Qt::Key_Slash, Qt::ControlModifier + Qt::Key_Backslash @@ -121,6 +122,8 @@ void ShortcutTester::setupLayout() const int keys3[] = { Qt::MetaModifier + Qt::ShiftModifier + Qt::Key_A, + Qt::MetaModifier + Qt::Key_A, + Qt::MetaModifier + Qt::Key_Q, Qt::MetaModifier + Qt::ShiftModifier + Qt::Key_5, Qt::ControlModifier + Qt::Key_BracketRight, Qt::ShiftModifier + Qt::Key_F3, diff --git a/tests/manual/widgets/itemviews/itemviews.pro b/tests/manual/widgets/itemviews/itemviews.pro index 53f658d54d..8884cc3aae 100644 --- a/tests/manual/widgets/itemviews/itemviews.pro +++ b/tests/manual/widgets/itemviews/itemviews.pro @@ -1,2 +1,8 @@ TEMPLATE = subdirs -SUBDIRS = delegate qheaderview qtreeview qtreewidget tableview-span-navigation +SUBDIRS = delegate \ + qconcatenatetablesproxymodel \ + qheaderview \ + qtreeview \ + qtreewidget \ + tableview-span-navigation \ + diff --git a/tests/manual/widgets/itemviews/qconcatenatetablesproxymodel/main.cpp b/tests/manual/widgets/itemviews/qconcatenatetablesproxymodel/main.cpp new file mode 100644 index 0000000000..2c1825f29f --- /dev/null +++ b/tests/manual/widgets/itemviews/qconcatenatetablesproxymodel/main.cpp @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure <david.faure@kdab.com> +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QApplication> +#include <QConcatenateTablesProxyModel> +#include <QStandardItemModel> +#include <QTableView> +#include <QTreeView> + +static void prepareModel(const QString &prefix, QStandardItemModel *model) +{ + for (int row = 0; row < model->rowCount(); ++row) { + for (int column = 0; column < model->columnCount(); ++column) { + QStandardItem *item = new QStandardItem(prefix + QString(" %1,%2").arg(row).arg(column)); + item->setDragEnabled(true); + item->setDropEnabled(true); + model->setItem(row, column, item); + } + } +} + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QStandardItemModel firstModel(4, 4); + prepareModel("First", &firstModel); + QStandardItemModel secondModel(2, 2); + + QConcatenateTablesProxyModel proxy; + proxy.addSourceModel(&firstModel); + proxy.addSourceModel(&secondModel); + + prepareModel("Second", &secondModel); + + QTableView tableView; + tableView.setWindowTitle("concat proxy, in QTableView"); + tableView.setDragDropMode(QAbstractItemView::DragDrop); + tableView.setModel(&proxy); + tableView.show(); + + QTreeView treeView; + treeView.setWindowTitle("concat proxy, in QTreeView"); + treeView.setDragDropMode(QAbstractItemView::DragDrop); + treeView.setModel(&proxy); + treeView.show(); + + // For comparison, views on top on QStandardItemModel + + QTableView tableViewTest; + tableViewTest.setWindowTitle("first model, in QTableView"); + tableViewTest.setDragDropMode(QAbstractItemView::DragDrop); + tableViewTest.setModel(&firstModel); + tableViewTest.show(); + + QTreeView treeViewTest; + treeViewTest.setWindowTitle("first model, in QTreeView"); + treeViewTest.setDragDropMode(QAbstractItemView::DragDrop); + treeViewTest.setModel(&firstModel); + treeViewTest.show(); + + return app.exec(); +} diff --git a/tests/manual/widgets/itemviews/qconcatenatetablesproxymodel/qconcatenatetablesproxymodel.pro b/tests/manual/widgets/itemviews/qconcatenatetablesproxymodel/qconcatenatetablesproxymodel.pro new file mode 100644 index 0000000000..19904212a7 --- /dev/null +++ b/tests/manual/widgets/itemviews/qconcatenatetablesproxymodel/qconcatenatetablesproxymodel.pro @@ -0,0 +1,8 @@ + +TEMPLATE = app +TARGET = qconcatenatetablesproxymodel +INCLUDEPATH += . + +QT += widgets + +SOURCES += main.cpp diff --git a/tests/manual/widgets/widgets/qmainwindow/saveStateSize/main.cpp b/tests/manual/widgets/widgets/qmainwindow/saveStateSize/main.cpp new file mode 100644 index 0000000000..dbca6df454 --- /dev/null +++ b/tests/manual/widgets/widgets/qmainwindow/saveStateSize/main.cpp @@ -0,0 +1,111 @@ +/**************************************************************************** + ** + ** Copyright (C) 2019 The Qt Company Ltd. + ** Contact: https://www.qt.io/licensing/ + ** + ** This file is part of the test suite of the Qt Toolkit. + ** + ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ + ** 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 The Qt Company. For licensing terms + ** and conditions see https://www.qt.io/terms-conditions. For further + ** information use the contact form at https://www.qt.io/contact-us. + ** + ** GNU General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU + ** General Public License version 3 as published by the Free Software + ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT + ** included in the packaging of this file. Please review the following + ** information to ensure the GNU General Public License requirements will + ** be met: https://www.gnu.org/licenses/gpl-3.0.html. + ** + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + +// Test that the size of the saved state bytearray does not change due to moving a +// toolbar from one area to another. It should stay the same size as the first time +// it had that toolbar in it + +#include <QApplication> +#include <QMainWindow> +#include <QToolBar> +#include <QPushButton> +#include <QLabel> +#include <QVBoxLayout> +#include <QMessageBox> + +class MainWindow : public QMainWindow +{ + Q_OBJECT +public: + MainWindow() : QMainWindow() + { + auto *tb = new QToolBar(this); + tb->setObjectName("Toolbar"); + tb->addAction("Test action"); + tb->addAction("Test action"); + addToolBar(Qt::TopToolBarArea, tb); + auto *movableTb = new QToolBar(this); + movableTb->setObjectName("Movable Toolbar"); + movableTb->addAction("Test action"); + movableTb->addAction("Test action"); + addToolBar(Qt::TopToolBarArea, movableTb); + auto *widget = new QWidget; + auto *vbox = new QVBoxLayout; + auto *label = new QLabel; + label->setText("1. Click on check state size to save initial state\n" + "2. Drag the movable toolbar in the top dock area to the left area." + " Click on check state size to save moved state\n" + "3. Drag the movable toolbar from the left dock area to the top area." + " Click on check state size to compare the state sizes.\n" + "4. Drag the movable toolbar in the top dock area to the left area." + " Click on check state size to compare the state sizes.\n" + "5. Drag the movable toolbar from the left dock area to the top area." + " Click on check state size to compare the state sizes.\n"); + vbox->addWidget(label); + auto *pushButton = new QPushButton("Check state size"); + connect(pushButton, &QPushButton::clicked, this, &MainWindow::checkState); + vbox->addWidget(pushButton); + widget->setLayout(vbox); + setCentralWidget(widget); + } +public slots: + void checkState() + { + stepCounter++; + QString messageText; + if (stepCounter == 1) { + beforeMoveStateData = saveState(); + messageText = QLatin1String("Initial state saved"); + } else if (stepCounter == 2) { + afterMoveStateData = saveState(); + messageText = QLatin1String("Moved state saved"); + } else { + const int currentSaveSize = saveState().size(); + const int compareValue = (stepCounter == 4) ? afterMoveStateData.size() : beforeMoveStateData.size(); + messageText = QString::fromLatin1("%1 step %2") + .arg((currentSaveSize == compareValue) ? QLatin1String("SUCCESS") : QLatin1String("FAIL")) + .arg(stepCounter); + } + QMessageBox::information(this, "Step done", messageText); + } +private: + int stepCounter = 0; + QByteArray beforeMoveStateData; + QByteArray afterMoveStateData; +}; + +#include "main.moc" + +int main(int argc, char **argv) +{ + QApplication a(argc, argv); + MainWindow mw; + mw.show(); + return a.exec(); +} + diff --git a/tests/manual/widgets/widgets/qmainwindow/saveStateSize/saveStateSize.pro b/tests/manual/widgets/widgets/qmainwindow/saveStateSize/saveStateSize.pro new file mode 100644 index 0000000000..6ee128ed3b --- /dev/null +++ b/tests/manual/widgets/widgets/qmainwindow/saveStateSize/saveStateSize.pro @@ -0,0 +1,4 @@ +QT += widgets +TEMPLATE = app +TARGET = saveStateSize +SOURCES += main.cpp diff --git a/tests/shared/filesystem.h b/tests/shared/filesystem.h index 73d7d6523c..9f4527a992 100644 --- a/tests/shared/filesystem.h +++ b/tests/shared/filesystem.h @@ -80,7 +80,7 @@ public: } #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) - static void createNtfsJunction(QString target, QString linkName) + static DWORD createNtfsJunction(QString target, QString linkName, QString *errorMessage) { typedef struct { DWORD ReparseTag; @@ -97,14 +97,22 @@ public: DWORD returnedLength; wchar_t fileSystem[MAX_PATH] = L""; PREPARSE_MOUNTPOINT_DATA_BUFFER reparseInfo = (PREPARSE_MOUNTPOINT_DATA_BUFFER) reparseBuffer; + DWORD result = ERROR_SUCCESS; QFileInfo junctionInfo(linkName); linkName = QDir::toNativeSeparators(junctionInfo.absoluteFilePath()); - - GetVolumeInformationW( (wchar_t*)linkName.left(3).utf16(), NULL, 0, NULL, NULL, NULL, - fileSystem, sizeof(fileSystem)/sizeof(WCHAR)); - if(QString().fromWCharArray(fileSystem) != "NTFS") - QSKIP("This seems not to be an NTFS volume. Junctions are not allowed."); + const QString drive = linkName.left(3); + if (GetVolumeInformationW(reinterpret_cast<const wchar_t *>(drive.utf16()), + NULL, 0, NULL, NULL, NULL, + fileSystem, sizeof(fileSystem)/sizeof(WCHAR)) == FALSE) { + result = GetLastError(); + *errorMessage = "GetVolumeInformationW() failed: " + qt_error_string(int(result)); + return result; + } + if (QString::fromWCharArray(fileSystem) != "NTFS") { + *errorMessage = "This seems not to be an NTFS volume. Junctions are not allowed."; + return ERROR_NOT_SUPPORTED; + } if (!target.startsWith("\\??\\") && !target.startsWith("\\\\?\\")) { QFileInfo targetInfo(target); @@ -116,7 +124,11 @@ public: QDir().mkdir(linkName); hFile = CreateFileW( (wchar_t*)linkName.utf16(), GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT|FILE_FLAG_BACKUP_SEMANTICS, NULL ); - QVERIFY(hFile != INVALID_HANDLE_VALUE ); + if (hFile == INVALID_HANDLE_VALUE) { + result = GetLastError(); + *errorMessage = "CreateFileW(" + linkName + ") failed: " + qt_error_string(int(result)); + return result; + } memset( reparseInfo, 0, sizeof( *reparseInfo )); reparseInfo->ReparseTag = IO_REPARSE_TAG_MOUNT_POINT; @@ -128,8 +140,12 @@ public: bool ioc = DeviceIoControl(hFile, FSCTL_SET_REPARSE_POINT, reparseInfo, reparseInfo->ReparseDataLength + REPARSE_MOUNTPOINT_HEADER_SIZE, NULL, 0, &returnedLength, NULL); + if (!ioc) { + result = GetLastError(); + *errorMessage = "DeviceIoControl() failed: " + qt_error_string(int(result)); + } CloseHandle( hFile ); - QVERIFY(ioc); + return result; } #endif diff --git a/tests/testserver/apache2/.gitattributes b/tests/testserver/apache2/.gitattributes new file mode 100644 index 0000000000..67af4c73e8 --- /dev/null +++ b/tests/testserver/apache2/.gitattributes @@ -0,0 +1,2 @@ +* text eol=lf +*.gif -text diff --git a/tests/testserver/common/.gitattributes b/tests/testserver/common/.gitattributes new file mode 100644 index 0000000000..21f6efbe14 --- /dev/null +++ b/tests/testserver/common/.gitattributes @@ -0,0 +1,2 @@ +*.sh text eol=lf +*.conf text eol=lf diff --git a/tests/testserver/common/ssl.sh b/tests/testserver/common/ssl.sh index 8a4728ad4d..2593a22979 100755 --- a/tests/testserver/common/ssl.sh +++ b/tests/testserver/common/ssl.sh @@ -35,5 +35,6 @@ set -ex # install ssl_certs and test data su $USER -c "mkdir -p -m 700 ~/ssl-certs/private" -su $USER -c "cp $CONFIG/ssl/qt-test-server-cert.pem ~/ssl-certs/" +su $USER -c \ + "cp $CONFIG/ssl/${test_cert:-qt-test-server-cert.pem} ~/ssl-certs/qt-test-server-cert.pem" su $USER -c "cp $CONFIG/ssl/private/qt-test-server-key.pem ~/ssl-certs/private/" diff --git a/tests/testserver/common/startup.sh b/tests/testserver/common/startup.sh index 84d4003f86..74990a47f6 100755 --- a/tests/testserver/common/startup.sh +++ b/tests/testserver/common/startup.sh @@ -49,7 +49,9 @@ do $RUN_CMD done # start multicast DNS service discovery (mDNS) -sed -i "s,#domain-name=local,domain-name=test-net.qt.local," /etc/avahi/avahi-daemon.conf +sed -i -e "s,#domain-name=local,domain-name=${test_domain:-test-net.qt.local}," \ + -e "s,#publish-aaaa-on-ipv4=yes,publish-aaaa-on-ipv4=no," \ + /etc/avahi/avahi-daemon.conf service dbus restart service avahi-daemon restart diff --git a/tests/testserver/common/testdata/ssl/qt-test-server-host-network-cacert.pem b/tests/testserver/common/testdata/ssl/qt-test-server-host-network-cacert.pem new file mode 100644 index 0000000000..5bdce3a3f9 --- /dev/null +++ b/tests/testserver/common/testdata/ssl/qt-test-server-host-network-cacert.pem @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE----- +MIIClzCCAgACCQDeuuUc2HkfKDANBgkqhkiG9w0BAQQFADCBjzELMAkGA1UEChMC +UXQxGTAXBgNVBAsTEENvcmUgQW5kIE5ldHdvcmsxGzAZBgkqhkiG9w0BCQEWDG5v +Ym9keS5xdC5pbzENMAsGA1UEBxMET3NsbzENMAsGA1UECBMET3NsbzELMAkGA1UE +BhMCTk8xHTAbBgNVBAMTFHF0LXRlc3Qtc2VydmVyLmxvY2FsMB4XDTE5MDEyNTE1 +NDE0N1oXDTQ5MDExNzE1NDE0N1owgY8xCzAJBgNVBAoTAlF0MRkwFwYDVQQLExBD +b3JlIEFuZCBOZXR3b3JrMRswGQYJKoZIhvcNAQkBFgxub2JvZHkucXQuaW8xDTAL +BgNVBAcTBE9zbG8xDTALBgNVBAgTBE9zbG8xCzAJBgNVBAYTAk5PMR0wGwYDVQQD +ExRxdC10ZXN0LXNlcnZlci5sb2NhbDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC +gYEAzarbb9Y0yafxwL7kQRgZ4gLJIuan1boDLp4oevRfGndfd6kRO49+8C7Gnus6 +2RLXwQxR6CRSPyPDQgwRxvIcoUL+tMJpg633cLEYFcwgKGIw8CwV5jMZr8PrHMCR +9xFolFD4STcIMtc+dd+jvGkAFd7Nhw9cAmuCyAF9avAd3HMCAwEAATANBgkqhkiG +9w0BAQQFAAOBgQB1dxK3Ia4sCpvSikKLaf1ZXu+9GKaNWKJe9bWex9/RmNOla9N2 +FIh6/CfaPFDy/OXCkyEiGg78iyg/DgqVoa9JJGV3diI6berisHMPJpv1syyz9YEU +G3RQUClPcPV6EcedyqCdpbnIFtiSZbtJ0ZBGef4KzBN3rTmPucKb+bhMPg== +-----END CERTIFICATE----- diff --git a/tests/testserver/danted/.gitattributes b/tests/testserver/danted/.gitattributes new file mode 100644 index 0000000000..21f6efbe14 --- /dev/null +++ b/tests/testserver/danted/.gitattributes @@ -0,0 +1,2 @@ +*.sh text eol=lf +*.conf text eol=lf diff --git a/tests/testserver/danted/danted.sh b/tests/testserver/danted/danted.sh index bf3d154f33..97e2142401 100755 --- a/tests/testserver/danted/danted.sh +++ b/tests/testserver/danted/danted.sh @@ -39,6 +39,25 @@ useradd -d /dev/null -s /bin/false qsockstest; echo "qsockstest:$PASS" | chpassw # install configurations and test data cp $TESTDATA/danted{,-authenticating}.conf /etc/ +# Use the input environment variables to overwrite the default value of internal interfaces. +if [ "$danted_internal" -a "$danted_internal" != eth0 ] +then sed -i "s,internal: eth0 port = 1080,internal: $danted_internal port = 1080," /etc/danted.conf +fi + +if [ "$danted_auth_internal" -a "$danted_auth_internal" != eth0 ] +then sed -i "s,internal: eth0 port = 1081,internal: $danted_auth_internal port = 1081," \ + /etc/danted-authenticating.conf +fi + +# Use the input environment variables to overwrite the default value of external interfaces. +if [ "$danted_external" -a "$danted_external" != eth0 ] +then sed -i "s,external: eth0,external: $danted_external," /etc/danted.conf +fi + +if [ "$danted_auth_external" -a "$danted_auth_external" != eth0 ] +then sed -i "s,external: eth0,external: $danted_auth_external," /etc/danted-authenticating.conf +fi + # enable service with installed configurations service danted start service danted-authenticating start diff --git a/tests/testserver/docker-compose-for-macOS.yml b/tests/testserver/docker-compose-for-macOS.yml new file mode 100644 index 0000000000..aa610dfb88 --- /dev/null +++ b/tests/testserver/docker-compose-for-macOS.yml @@ -0,0 +1,100 @@ +version: '3.4' + +# The tag of images is used by docker compose file to launch the corresponding +# docker containers. The value of tag comes from the provisioning script +# (coin/provisioning/.../testserver/docker_testserver.sh). The script gets SHA-1 +# of each server context as the tag of docker images. If one of the server +# contexts gets changes, please make sure to update this compose file as well. +# You can run command 'docker images' to list all the tags of test server images. +# For example: +# REPOSITORY TAG +# qt-test-server-apache2 537fe302f61851d1663f41495230d8e3554a4a13 + +services: + apache2: + image: qt-test-server-apache2:537fe302f61851d1663f41495230d8e3554a4a13 + container_name: qt-test-server-apache2 + domainname: ${TEST_DOMAIN} + volumes: + - ./common:/common:ro + - ./apache2:/service:ro + entrypoint: common/startup.sh + command: [common/ssl.sh, service/apache2.sh] + network_mode: "host" + extra_hosts: + - "qt-test-server.${TEST_DOMAIN}:${MACHINE_IP}" + environment: + - test_domain=${TEST_DOMAIN} + - test_cert="qt-test-server-host-network-cacert.pem" + + squid: + image: qt-test-server-squid:9c32f41b19aca3d778733c4d8fb0ecc5955e893c + container_name: qt-test-server-squid + domainname: ${TEST_DOMAIN} + depends_on: + - apache2 + volumes: + - ./common:/common:ro + - ./squid:/service:ro + entrypoint: common/startup.sh + command: service/squid.sh + network_mode: "host" + extra_hosts: + - "qt-test-server.${TEST_DOMAIN}:${MACHINE_IP}" + environment: + - test_domain=${TEST_DOMAIN} + + vsftpd: + image: qt-test-server-vsftpd:f3a9c8d793a77cc007c0e4e481bec01f9e3eeb7e + container_name: qt-test-server-vsftpd + domainname: ${TEST_DOMAIN} + volumes: + - ./common:/common:ro + - ./vsftpd:/service:ro + entrypoint: common/startup.sh + command: service/vsftpd.sh + network_mode: "host" + extra_hosts: + - "qt-test-server.${TEST_DOMAIN}:${MACHINE_IP}" + environment: + - test_domain=${TEST_DOMAIN} + + ftp-proxy: + image: qt-test-server-ftp-proxy:d7de8b28392d173db512a558ccc84ead8bece2ae + container_name: qt-test-server-ftp-proxy + domainname: ${TEST_DOMAIN} + depends_on: + - vsftpd + volumes: + - ./common:/common:ro + - ./ftp-proxy:/service:ro + entrypoint: common/startup.sh + command: service/ftp-proxy.sh + network_mode: "host" + extra_hosts: + - "qt-test-server.${TEST_DOMAIN}:${MACHINE_IP}" + environment: + - test_domain=${TEST_DOMAIN} + + danted: + image: qt-test-server-danted:35607f9b790524cf9690c7d12a9a401696b7b6b5 + container_name: qt-test-server-danted + domainname: ${TEST_DOMAIN} + depends_on: + - apache2 + - vsftpd + - ftp-proxy + volumes: + - ./common:/common:ro + - ./danted:/service:ro + entrypoint: common/startup.sh + command: service/danted.sh + network_mode: "host" + extra_hosts: + - "qt-test-server.${TEST_DOMAIN}:${MACHINE_IP}" + environment: + - danted_internal=${MACHINE_IP} + - danted_external=${MACHINE_IP} + - danted_auth_internal=${MACHINE_IP} + - danted_auth_external=${MACHINE_IP} + - test_domain=${TEST_DOMAIN} diff --git a/tests/testserver/docker-compose-for-windows.yml b/tests/testserver/docker-compose-for-windows.yml new file mode 100644 index 0000000000..aa610dfb88 --- /dev/null +++ b/tests/testserver/docker-compose-for-windows.yml @@ -0,0 +1,100 @@ +version: '3.4' + +# The tag of images is used by docker compose file to launch the corresponding +# docker containers. The value of tag comes from the provisioning script +# (coin/provisioning/.../testserver/docker_testserver.sh). The script gets SHA-1 +# of each server context as the tag of docker images. If one of the server +# contexts gets changes, please make sure to update this compose file as well. +# You can run command 'docker images' to list all the tags of test server images. +# For example: +# REPOSITORY TAG +# qt-test-server-apache2 537fe302f61851d1663f41495230d8e3554a4a13 + +services: + apache2: + image: qt-test-server-apache2:537fe302f61851d1663f41495230d8e3554a4a13 + container_name: qt-test-server-apache2 + domainname: ${TEST_DOMAIN} + volumes: + - ./common:/common:ro + - ./apache2:/service:ro + entrypoint: common/startup.sh + command: [common/ssl.sh, service/apache2.sh] + network_mode: "host" + extra_hosts: + - "qt-test-server.${TEST_DOMAIN}:${MACHINE_IP}" + environment: + - test_domain=${TEST_DOMAIN} + - test_cert="qt-test-server-host-network-cacert.pem" + + squid: + image: qt-test-server-squid:9c32f41b19aca3d778733c4d8fb0ecc5955e893c + container_name: qt-test-server-squid + domainname: ${TEST_DOMAIN} + depends_on: + - apache2 + volumes: + - ./common:/common:ro + - ./squid:/service:ro + entrypoint: common/startup.sh + command: service/squid.sh + network_mode: "host" + extra_hosts: + - "qt-test-server.${TEST_DOMAIN}:${MACHINE_IP}" + environment: + - test_domain=${TEST_DOMAIN} + + vsftpd: + image: qt-test-server-vsftpd:f3a9c8d793a77cc007c0e4e481bec01f9e3eeb7e + container_name: qt-test-server-vsftpd + domainname: ${TEST_DOMAIN} + volumes: + - ./common:/common:ro + - ./vsftpd:/service:ro + entrypoint: common/startup.sh + command: service/vsftpd.sh + network_mode: "host" + extra_hosts: + - "qt-test-server.${TEST_DOMAIN}:${MACHINE_IP}" + environment: + - test_domain=${TEST_DOMAIN} + + ftp-proxy: + image: qt-test-server-ftp-proxy:d7de8b28392d173db512a558ccc84ead8bece2ae + container_name: qt-test-server-ftp-proxy + domainname: ${TEST_DOMAIN} + depends_on: + - vsftpd + volumes: + - ./common:/common:ro + - ./ftp-proxy:/service:ro + entrypoint: common/startup.sh + command: service/ftp-proxy.sh + network_mode: "host" + extra_hosts: + - "qt-test-server.${TEST_DOMAIN}:${MACHINE_IP}" + environment: + - test_domain=${TEST_DOMAIN} + + danted: + image: qt-test-server-danted:35607f9b790524cf9690c7d12a9a401696b7b6b5 + container_name: qt-test-server-danted + domainname: ${TEST_DOMAIN} + depends_on: + - apache2 + - vsftpd + - ftp-proxy + volumes: + - ./common:/common:ro + - ./danted:/service:ro + entrypoint: common/startup.sh + command: service/danted.sh + network_mode: "host" + extra_hosts: + - "qt-test-server.${TEST_DOMAIN}:${MACHINE_IP}" + environment: + - danted_internal=${MACHINE_IP} + - danted_external=${MACHINE_IP} + - danted_auth_internal=${MACHINE_IP} + - danted_auth_external=${MACHINE_IP} + - test_domain=${TEST_DOMAIN} diff --git a/tests/testserver/docker-compose.yml b/tests/testserver/docker-compose.yml index a151d6bfb0..be65e5a26a 100644 --- a/tests/testserver/docker-compose.yml +++ b/tests/testserver/docker-compose.yml @@ -7,14 +7,14 @@ version: '3.4' # contexts gets changes, please make sure to update this compose file as well. # You can run command 'docker images' to list all the tag of test server images. # For example: -# REPOSITORY TAG IMAGE ID -# qt-test-server-apache2 e2a70c8b169c204e762b375885bd3a26cc40ba48 2ad5c8720317 +# REPOSITORY TAG +# qt-test-server-apache2 537fe302f61851d1663f41495230d8e3554a4a13 services: apache2: - image: qt-test-server-apache2:cc9ea678b92bdda33acb9fa0159bb4ad0f3cd947 + image: qt-test-server-apache2:537fe302f61851d1663f41495230d8e3554a4a13 container_name: qt-test-server-apache2 - domainname: test-net.qt.local + domainname: ${TEST_DOMAIN} hostname: apache2 volumes: - ./common:/common:ro @@ -23,14 +23,14 @@ services: command: [common/ssl.sh, service/apache2.sh] squid: - image: qt-test-server-squid:577d99307eea9a8cccfec944d25be2bce2fe99cc + image: qt-test-server-squid:9c32f41b19aca3d778733c4d8fb0ecc5955e893c container_name: qt-test-server-squid - domainname: test-net.qt.local + domainname: ${TEST_DOMAIN} hostname: squid depends_on: - apache2 external_links: - - apache2:apache2.test-net.qt.local + - apache2:apache2.${TEST_DOMAIN} volumes: - ./common:/common:ro - ./squid:/service:ro @@ -38,9 +38,9 @@ services: command: service/squid.sh vsftpd: - image: qt-test-server-vsftpd:18896604c7e90b543e56d80c8a8aabdb65a590d0 + image: qt-test-server-vsftpd:f3a9c8d793a77cc007c0e4e481bec01f9e3eeb7e container_name: qt-test-server-vsftpd - domainname: test-net.qt.local + domainname: ${TEST_DOMAIN} hostname: vsftpd volumes: - ./common:/common:ro @@ -49,14 +49,14 @@ services: command: service/vsftpd.sh ftp-proxy: - image: qt-test-server-ftp-proxy:2c6c8f1ab6a364b540c43d705fb6f15a585cb2af + image: qt-test-server-ftp-proxy:d7de8b28392d173db512a558ccc84ead8bece2ae container_name: qt-test-server-ftp-proxy - domainname: test-net.qt.local + domainname: ${TEST_DOMAIN} hostname: ftp-proxy depends_on: - vsftpd external_links: - - vsftpd:vsftpd.test-net.qt.local + - vsftpd:vsftpd.${TEST_DOMAIN} volumes: - ./common:/common:ro - ./ftp-proxy:/service:ro @@ -64,18 +64,18 @@ services: command: service/ftp-proxy.sh danted: - image: qt-test-server-danted:327dd56c3c35db85b26fac93213a5a1918475bc7 + image: qt-test-server-danted:35607f9b790524cf9690c7d12a9a401696b7b6b5 container_name: qt-test-server-danted - domainname: test-net.qt.local + domainname: ${TEST_DOMAIN} hostname: danted depends_on: - apache2 - vsftpd - ftp-proxy external_links: - - apache2:apache2.test-net.qt.local - - vsftpd:vsftpd.test-net.qt.local - - ftp-proxy:ftp-proxy.test-net.qt.local + - apache2:apache2.${TEST_DOMAIN} + - vsftpd:vsftpd.${TEST_DOMAIN} + - ftp-proxy:ftp-proxy.${TEST_DOMAIN} volumes: - ./common:/common:ro - ./danted:/service:ro diff --git a/tests/testserver/ftp-proxy/.gitattributes b/tests/testserver/ftp-proxy/.gitattributes new file mode 100644 index 0000000000..21f6efbe14 --- /dev/null +++ b/tests/testserver/ftp-proxy/.gitattributes @@ -0,0 +1,2 @@ +*.sh text eol=lf +*.conf text eol=lf diff --git a/tests/testserver/squid/.gitattributes b/tests/testserver/squid/.gitattributes new file mode 100644 index 0000000000..21f6efbe14 --- /dev/null +++ b/tests/testserver/squid/.gitattributes @@ -0,0 +1,2 @@ +*.sh text eol=lf +*.conf text eol=lf diff --git a/tests/testserver/vsftpd/.gitattributes b/tests/testserver/vsftpd/.gitattributes new file mode 100644 index 0000000000..67af4c73e8 --- /dev/null +++ b/tests/testserver/vsftpd/.gitattributes @@ -0,0 +1,2 @@ +* text eol=lf +*.gif -text diff --git a/tests/testserver/vsftpd/vsftpd.sh b/tests/testserver/vsftpd/vsftpd.sh index 1ba1a8c347..14364f94c2 100755 --- a/tests/testserver/vsftpd/vsftpd.sh +++ b/tests/testserver/vsftpd/vsftpd.sh @@ -41,9 +41,10 @@ useradd -d "/home/$USER/ftp" -s /bin/bash ftptest; echo "ftptest:$PASS" | chpass cp $TESTDATA/vsftpd.{conf,user_list} /etc/ # Resolve error message "vsftpd failed - probably invalid config" during boot -command='start-stop-daemon --start --background -m --oknodo --pidfile /var/run/vsftpd/vsftpd.pid' -command+=' --exec ${DAEMON}' -sed -i "s,$command.*$,$command; sleep 1," /etc/init.d/vsftpd +# This bug has been reported to Debian bug tracking system (ID #911396) +command='ps -C vsftpd | grep -qs "${_PID}"' +sed -i -e 's,while [ ${n} -le 5 ].*$,while true,' \ + -e "s,\t\t\tif ! $command.*$,\t\t\tif $command," /etc/init.d/vsftpd # Populate the FTP sites: su $USER -c "cp -r $TESTDATA/ftp ~/ftp" |