diff options
Diffstat (limited to 'tests/auto/corelib/plugin')
26 files changed, 124 insertions, 34 deletions
diff --git a/tests/auto/corelib/plugin/plugin.pro b/tests/auto/corelib/plugin/plugin.pro index 506f6abaeb..e6b748e4f4 100644 --- a/tests/auto/corelib/plugin/plugin.pro +++ b/tests/auto/corelib/plugin/plugin.pro @@ -1,7 +1,10 @@ TEMPLATE=subdirs SUBDIRS=\ qfactoryloader \ - qlibrary \ - qplugin \ - qpluginloader \ quuid + +load(qfeatures) +!contains(QT_DISABLED_FEATURES, library): SUBDIRS += \ + qpluginloader \ + qplugin \ + qlibrary diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro b/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro index 2496cd2f1e..b7a641959a 100644 --- a/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro +++ b/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro @@ -9,4 +9,3 @@ DESTDIR = ../bin # This is testdata for the tst_qpluginloader test. target.path = $$[QT_INSTALL_TESTS]/tst_qfactoryloader/bin INSTALLS += target -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro b/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro index e70ed4fb25..b536aff486 100644 --- a/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro +++ b/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro @@ -9,4 +9,3 @@ DESTDIR = ../bin # This is testdata for the tst_qpluginloader test. target.path = $$[QT_INSTALL_TESTS]/tst_qfactoryloader/bin INSTALLS += target -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/qfactoryloader/qfactoryloader.pro b/tests/auto/corelib/plugin/qfactoryloader/qfactoryloader.pro index 42bc01e2ed..ace9fe8fd0 100644 --- a/tests/auto/corelib/plugin/qfactoryloader/qfactoryloader.pro +++ b/tests/auto/corelib/plugin/qfactoryloader/qfactoryloader.pro @@ -12,4 +12,3 @@ TARGET = tst_qpluginloader INSTALLS = -CONFIG += parallel_test diff --git a/tests/auto/corelib/plugin/qfactoryloader/test/test.pro b/tests/auto/corelib/plugin/qfactoryloader/test/test.pro index d8dfaac29e..f1e76c31bf 100644 --- a/tests/auto/corelib/plugin/qfactoryloader/test/test.pro +++ b/tests/auto/corelib/plugin/qfactoryloader/test/test.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = ../tst_qfactoryloader QT = core-private testlib @@ -19,4 +18,8 @@ win32 { } mac: CONFIG -= app_bundle -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +load(qfeatures) +contains(QT_DISABLED_FEATURES, library) { + LIBS += -L ../bin/ -lplugin1 -lplugin2 +} diff --git a/tests/auto/corelib/plugin/qfactoryloader/tst_qfactoryloader.cpp b/tests/auto/corelib/plugin/qfactoryloader/tst_qfactoryloader.cpp index 474f4e9868..92a4dda252 100644 --- a/tests/auto/corelib/plugin/qfactoryloader/tst_qfactoryloader.cpp +++ b/tests/auto/corelib/plugin/qfactoryloader/tst_qfactoryloader.cpp @@ -38,6 +38,11 @@ #include "plugin1/plugininterface1.h" #include "plugin2/plugininterface2.h" +#ifdef QT_NO_LIBRARY +Q_IMPORT_PLUGIN(Plugin1) +Q_IMPORT_PLUGIN(Plugin2) +#endif + class tst_QFactoryLoader : public QObject { Q_OBJECT @@ -54,8 +59,9 @@ void tst_QFactoryLoader::initTestCase() { const QString binFolder = QFINDTESTDATA(binFolderC); QVERIFY2(!binFolder.isEmpty(), "Unable to locate 'bin' folder"); - +#ifndef QT_NO_LIBRARY QCoreApplication::setLibraryPaths(QStringList(QFileInfo(binFolder).absolutePath())); +#endif } void tst_QFactoryLoader::usingTwoFactoriesFromSameDir() diff --git a/tests/auto/corelib/plugin/qlibrary/lib/lib.pro b/tests/auto/corelib/plugin/qlibrary/lib/lib.pro index 195e48da93..44bd0be14e 100644 --- a/tests/auto/corelib/plugin/qlibrary/lib/lib.pro +++ b/tests/auto/corelib/plugin/qlibrary/lib/lib.pro @@ -20,4 +20,3 @@ win32 { DESTDIR = ../release/ } } -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro b/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro index 52dd8b9679..d55747501c 100644 --- a/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro +++ b/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro @@ -46,4 +46,3 @@ renamed_target.extra = $$member(renamed_target.extra, 0, -2) QMAKE_POST_LINK = $$member(QMAKE_POST_LINK, 0, -2) INSTALLS += target renamed_target -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/qlibrary/qlibrary.pro b/tests/auto/corelib/plugin/qlibrary/qlibrary.pro index 5bdf780fc0..ec58838e71 100644 --- a/tests/auto/corelib/plugin/qlibrary/qlibrary.pro +++ b/tests/auto/corelib/plugin/qlibrary/qlibrary.pro @@ -9,4 +9,3 @@ TARGET = tst_qlibrary # no special install rule for subdir INSTALLS = -CONFIG += parallel_test diff --git a/tests/auto/corelib/plugin/qlibrary/tst/tst.pro b/tests/auto/corelib/plugin/qlibrary/tst/tst.pro index 27433d59c0..d59cd738bf 100644 --- a/tests/auto/corelib/plugin/qlibrary/tst/tst.pro +++ b/tests/auto/corelib/plugin/qlibrary/tst/tst.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test CONFIG -= app_bundle TARGET = ../tst_qlibrary QT = core testlib @@ -14,4 +13,3 @@ win32 { } TESTDATA += ../library_path/invalid.so -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp index f31a7af6dd..8ac4125145 100644 --- a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp +++ b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp @@ -96,7 +96,7 @@ static QString sys_qualifiedLibraryName(const QString &fileName) { QString appDir = QCoreApplication::applicationDirPath(); - return appDir + "/" + PREFIX + fileName + SUFFIX; + return appDir + QLatin1Char('/') + PREFIX + fileName + SUFFIX; } QT_FORWARD_DECLARE_CLASS(QLibrary) diff --git a/tests/auto/corelib/plugin/qplugin/debugplugin/debugplugin.pro b/tests/auto/corelib/plugin/qplugin/debugplugin/debugplugin.pro index a4db0eccf6..ca47df22bd 100644 --- a/tests/auto/corelib/plugin/qplugin/debugplugin/debugplugin.pro +++ b/tests/auto/corelib/plugin/qplugin/debugplugin/debugplugin.pro @@ -4,4 +4,3 @@ CONFIG -= release debug_and_release SOURCES = main.cpp QT = core DESTDIR = ../plugins -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/qplugin/qplugin.pro b/tests/auto/corelib/plugin/qplugin/qplugin.pro index e8840a0fb2..918ffb44bd 100644 --- a/tests/auto/corelib/plugin/qplugin/qplugin.pro +++ b/tests/auto/corelib/plugin/qplugin/qplugin.pro @@ -25,4 +25,3 @@ mac { SUBDIRS += tst_qplugin.pro -CONFIG += parallel_test diff --git a/tests/auto/corelib/plugin/qplugin/releaseplugin/releaseplugin.pro b/tests/auto/corelib/plugin/qplugin/releaseplugin/releaseplugin.pro index 0f698312bd..b7dea67894 100644 --- a/tests/auto/corelib/plugin/qplugin/releaseplugin/releaseplugin.pro +++ b/tests/auto/corelib/plugin/qplugin/releaseplugin/releaseplugin.pro @@ -4,4 +4,3 @@ CONFIG -= debug debug_and_release SOURCES = main.cpp QT = core DESTDIR = ../plugins -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/qplugin/tst_qplugin.pro b/tests/auto/corelib/plugin/qplugin/tst_qplugin.pro index d1ffff9c4e..8c6540fe87 100644 --- a/tests/auto/corelib/plugin/qplugin/tst_qplugin.pro +++ b/tests/auto/corelib/plugin/qplugin/tst_qplugin.pro @@ -1,8 +1,6 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qplugin QT = core testlib SOURCES = tst_qplugin.cpp TESTDATA += plugins/* -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.pro b/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.pro index 70ab54a964..abfc70883e 100644 --- a/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.pro +++ b/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.pro @@ -10,4 +10,3 @@ QT = core # This is testdata for the tst_qpluginloader test. target.path = $$[QT_INSTALL_TESTS]/tst_qpluginloader/bin INSTALLS += target -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/qpluginloader/lib/lib.pro b/tests/auto/corelib/plugin/qpluginloader/lib/lib.pro index c74a00e9a6..bd6f19cb4f 100644 --- a/tests/auto/corelib/plugin/qpluginloader/lib/lib.pro +++ b/tests/auto/corelib/plugin/qpluginloader/lib/lib.pro @@ -11,4 +11,3 @@ win32-msvc: DEFINES += WIN32_MSVC # This is testdata for the tst_qpluginloader test. target.path = $$[QT_INSTALL_TESTS]/tst_qpluginloader/bin INSTALLS += target -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/qpluginloader/qpluginloader.pro b/tests/auto/corelib/plugin/qpluginloader/qpluginloader.pro index 5c6c56e389..83d00f7cd8 100644 --- a/tests/auto/corelib/plugin/qpluginloader/qpluginloader.pro +++ b/tests/auto/corelib/plugin/qpluginloader/qpluginloader.pro @@ -12,4 +12,3 @@ TARGET = tst_qpluginloader INSTALLS = -CONFIG += parallel_test diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.pro b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.pro index 2ea9c27cc9..6ec4a8de05 100644 --- a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.pro +++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.pro @@ -11,4 +11,3 @@ QT = core # This is testdata for the tst_qpluginloader test. target.path = $$[QT_INSTALL_TESTS]/tst_qpluginloader/bin INSTALLS += target -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/qpluginloader/tst/tst.pro b/tests/auto/corelib/plugin/qpluginloader/tst/tst.pro index 3894c90ae3..101392927c 100644 --- a/tests/auto/corelib/plugin/qpluginloader/tst/tst.pro +++ b/tests/auto/corelib/plugin/qpluginloader/tst/tst.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = ../tst_qpluginloader QT = core testlib contains(QT_CONFIG, private_tests): QT += core-private @@ -16,4 +15,3 @@ win32 { } TESTDATA += ../elftest ../machtest -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp index 72bd38d116..9640c52623 100644 --- a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp +++ b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp @@ -95,7 +95,8 @@ static QString sys_qualifiedLibraryName(const QString &fileName) { - QString libname = QFINDTESTDATA(QString("bin/%1%2%3").arg(PREFIX).arg(fileName).arg(SUFFIX)); + QString name = QLatin1String("bin/") + QLatin1String(PREFIX) + fileName + QLatin1String(SUFFIX); + const QString libname = QFINDTESTDATA(name); QFileInfo fi(libname); if (fi.exists()) return fi.canonicalFilePath(); @@ -386,7 +387,8 @@ void tst_QPluginLoader::loadMachO() void tst_QPluginLoader::loadGarbage() { for (int i=0; i<5; i++) { - QPluginLoader lib(QFINDTESTDATA(QString("elftest/garbage%1.so").arg(i+1))); + const QString name = QLatin1String("elftest/garbage") + QString::number(i + 1) + QLatin1String(".so"); + QPluginLoader lib(QFINDTESTDATA(name)); QCOMPARE(lib.load(), false); QVERIFY(lib.errorString() != QString("Unknown error")); } diff --git a/tests/auto/corelib/plugin/quuid/quuid.pro b/tests/auto/corelib/plugin/quuid/quuid.pro index 461956f313..25e24561ae 100644 --- a/tests/auto/corelib/plugin/quuid/quuid.pro +++ b/tests/auto/corelib/plugin/quuid/quuid.pro @@ -4,4 +4,3 @@ SUBDIRS = testProcessUniqueness SUBDIRS += test -CONFIG += parallel_test diff --git a/tests/auto/corelib/plugin/quuid/test/test.pro b/tests/auto/corelib/plugin/quuid/test/test.pro index c8312c0985..562bfbdc25 100644 --- a/tests/auto/corelib/plugin/quuid/test/test.pro +++ b/tests/auto/corelib/plugin/quuid/test/test.pro @@ -1,9 +1,13 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_quuid QT = core testlib SOURCES = ../tst_quuid.cpp +darwin { + OBJECTIVE_SOURCES = ../tst_quuid_darwin.mm + LIBS += -framework Foundation +} + CONFIG(debug_and_release_target) { CONFIG(debug, debug|release) { DESTDIR = ../debug @@ -13,4 +17,3 @@ CONFIG(debug_and_release_target) { } else { DESTDIR = .. } -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/quuid/testProcessUniqueness/testProcessUniqueness.pro b/tests/auto/corelib/plugin/quuid/testProcessUniqueness/testProcessUniqueness.pro index b2f7aaf2d3..5ee7b1a21f 100644 --- a/tests/auto/corelib/plugin/quuid/testProcessUniqueness/testProcessUniqueness.pro +++ b/tests/auto/corelib/plugin/quuid/testProcessUniqueness/testProcessUniqueness.pro @@ -7,4 +7,3 @@ DESTDIR = ./ # This app is testdata for tst_quuid target.path = $$[QT_INSTALL_TESTS]/tst_quuid/$$TARGET INSTALLS += target -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp index f31aed6976..ed549907d2 100644 --- a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp +++ b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp @@ -73,6 +73,8 @@ private slots: void qvariant(); void qvariant_conversion(); + void darwinTypes(); + public: // Variables QUuid uuidNS; @@ -223,11 +225,11 @@ void tst_QUuid::equal() QVERIFY( !(uuidA == uuidB) ); QUuid copy(uuidA); - QVERIFY(uuidA == copy); + QCOMPARE(uuidA, copy); QUuid assigned; assigned = uuidA; - QVERIFY(uuidA == assigned); + QCOMPARE(uuidA, assigned); } @@ -406,5 +408,15 @@ void tst_QUuid::qvariant_conversion() QCOMPARE(sv.value<QUuid>(), uuid); } +void tst_QUuid::darwinTypes() +{ +#ifndef Q_OS_DARWIN + QSKIP("This is a Darwin-only test"); +#else + extern void tst_QUuid_darwinTypes(); // in tst_quuid_darwin.mm + tst_QUuid_darwinTypes(); +#endif +} + QTEST_MAIN(tst_QUuid) #include "tst_quuid.moc" diff --git a/tests/auto/corelib/plugin/quuid/tst_quuid_darwin.mm b/tests/auto/corelib/plugin/quuid/tst_quuid_darwin.mm new file mode 100644 index 0000000000..251250d4ce --- /dev/null +++ b/tests/auto/corelib/plugin/quuid/tst_quuid_darwin.mm @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtCore/QUuid> +#include <QtTest/QtTest> + +#include <CoreFoundation/CoreFoundation.h> +#include <Foundation/Foundation.h> + +void tst_QUuid_darwinTypes() +{ + // QUuid <-> CFUUID + { + QUuid qtUuid(QByteArrayLiteral("0f7169cc-5711-4af9-99d9-fecb2329fdef")); + const CFUUIDRef cfuuid = qtUuid.toCFUUID(); + QCOMPARE(QUuid::fromCFUUID(cfuuid), qtUuid); + CFStringRef cfstring = CFUUIDCreateString(0, cfuuid); + QCOMPARE(QString::fromCFString(cfstring), qtUuid.toString().mid(1, 36).toUpper()); + CFRelease(cfstring); + CFRelease(cfuuid); + } + { + QUuid qtUuid(QByteArrayLiteral("0f7169cc-5711-4af9-99d9-fecb2329fdef")); + const CFUUIDRef cfuuid = qtUuid.toCFUUID(); + QUuid qtUuidCopy(qtUuid); + qtUuid = QUuid(QByteArrayLiteral("93eec131-13c5-4d13-aaea-e456b4c57efa")); // modify + QCOMPARE(QUuid::fromCFUUID(cfuuid), qtUuidCopy); + CFStringRef cfstring = CFUUIDCreateString(0, cfuuid); + QCOMPARE(QString::fromCFString(cfstring), qtUuidCopy.toString().mid(1, 36).toUpper()); + CFRelease(cfstring); + CFRelease(cfuuid); + } + // QUuid <-> NSUUID + { + QMacAutoReleasePool pool; + + QUuid qtUuid(QByteArrayLiteral("0f7169cc-5711-4af9-99d9-fecb2329fdef")); + const NSUUID *nsuuid = qtUuid.toNSUUID(); + QCOMPARE(QUuid::fromNSUUID(nsuuid), qtUuid); + QCOMPARE(QString::fromNSString([nsuuid UUIDString]), qtUuid.toString().mid(1, 36).toUpper()); + } + { + QMacAutoReleasePool pool; + + QUuid qtUuid(QByteArrayLiteral("0f7169cc-5711-4af9-99d9-fecb2329fdef")); + const NSUUID *nsuuid = qtUuid.toNSUUID(); + QUuid qtUuidCopy(qtUuid); + qtUuid = QUuid(QByteArrayLiteral("93eec131-13c5-4d13-aaea-e456b4c57efa")); // modify + QCOMPARE(QUuid::fromNSUUID(nsuuid), qtUuidCopy); + QCOMPARE(QString::fromNSString([nsuuid UUIDString]), qtUuidCopy.toString().mid(1, 36).toUpper()); + } +} |