diff options
author | Ivan Solovev <ivan.solovev@qt.io> | 2022-04-13 14:15:27 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-04-20 09:38:14 +0000 |
commit | 9212e4ab7ba7b38a0f88b5fd25aa1e15236308ab (patch) | |
tree | 79272d631c583b313f04c4bc9558b7d43d09cbe6 /tests/auto/qml | |
parent | a914b3475225e44addbf1bd5fbf38e7e363a67ce (diff) |
Android: enable tst_qqmlextensionplugin
The test was extracting plugins from the installation directory.
However on Android plugins can be read only from APK's libs subdir.
By default no plugins are copied into the APK, because they are not used.
So add a dummy.qml file which uses some basic stuff from Qt.Quick and
Qt.Quick.Controls. This will force the plugins to be copied into the APK.
Fixes: QTBUG-100169
Change-Id: I31d7a407c655e19f147d461a083f27d6f6cbda72
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit d141804e6fb9dd3ea22de2fedf7a75174da25f03)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests/auto/qml')
-rw-r--r-- | tests/auto/qml/CMakeLists.txt | 3 | ||||
-rw-r--r-- | tests/auto/qml/qqmlextensionplugin/CMakeLists.txt | 12 | ||||
-rw-r--r-- | tests/auto/qml/qqmlextensionplugin/data/dummy.qml | 57 | ||||
-rw-r--r-- | tests/auto/qml/qqmlextensionplugin/tst_qqmlextensionplugin.cpp | 10 |
4 files changed, 80 insertions, 2 deletions
diff --git a/tests/auto/qml/CMakeLists.txt b/tests/auto/qml/CMakeLists.txt index f694f3e267..29a1a2b011 100644 --- a/tests/auto/qml/CMakeLists.txt +++ b/tests/auto/qml/CMakeLists.txt @@ -75,8 +75,7 @@ if(QT_FEATURE_process AND NOT CMAKE_CROSSCOMPILING) add_subdirectory(qmltc_qprocess) add_subdirectory(qmlplugindump) endif() -if(QT_FEATURE_library AND NOT ANDROID) - # QTBUG-100169 +if(QT_FEATURE_library) add_subdirectory(qqmlextensionplugin) endif() if(QT_FEATURE_private_tests) diff --git a/tests/auto/qml/qqmlextensionplugin/CMakeLists.txt b/tests/auto/qml/qqmlextensionplugin/CMakeLists.txt index 16d884f66b..86d5f9e4d1 100644 --- a/tests/auto/qml/qqmlextensionplugin/CMakeLists.txt +++ b/tests/auto/qml/qqmlextensionplugin/CMakeLists.txt @@ -12,5 +12,17 @@ qt_internal_add_test(tst_qqmlextensionplugin Qt::Qml ) +# On Android we need to have some QML file, so that plugins are actually copied +# into the APK +if(ANDROID) + add_compile_definitions(ANDROID_ARCH="${CMAKE_ANDROID_ARCH_ABI}") + qt_add_resources(tst_qqmlextensionplugin "dummy_resources" + PREFIX + "/" + FILES + "./data/dummy.qml" + ) +endif() + ## Scopes: ##################################################################### diff --git a/tests/auto/qml/qqmlextensionplugin/data/dummy.qml b/tests/auto/qml/qqmlextensionplugin/data/dummy.qml new file mode 100644 index 0000000000..72d2556ad7 --- /dev/null +++ b/tests/auto/qml/qqmlextensionplugin/data/dummy.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2022 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:BSD$ +** 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. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick + +Item { + width: 640 + height: 480 + visible: true +} diff --git a/tests/auto/qml/qqmlextensionplugin/tst_qqmlextensionplugin.cpp b/tests/auto/qml/qqmlextensionplugin/tst_qqmlextensionplugin.cpp index e3c8151884..d122b1f0c6 100644 --- a/tests/auto/qml/qqmlextensionplugin/tst_qqmlextensionplugin.cpp +++ b/tests/auto/qml/qqmlextensionplugin/tst_qqmlextensionplugin.cpp @@ -76,7 +76,17 @@ private Q_SLOTS: void tst_qqmlextensionplugin::iidCheck_data() { QList<QString> files; + // On Android the plugins are located in the APK's libs subdir. They can + // be distinguished by the name, which starts from "libqml_" and ends with + // "plugin_${ARCH}.so" +#ifdef Q_OS_ANDROID + const QStringList libraryPaths = QCoreApplication::libraryPaths(); + QVERIFY(!libraryPaths.isEmpty()); + const QLatin1String nameFilters("libqml_*plugin_" ANDROID_ARCH "*"); + for (QDirIterator it(libraryPaths.front(), { nameFilters }, QDir::Files); it.hasNext(); ) { +#else for (QDirIterator it(QLibraryInfo::path(QLibraryInfo::QmlImportsPath), QDirIterator::Subdirectories); it.hasNext(); ) { +#endif QString file = it.next(); #if defined(Q_OS_DARWIN) if (file.contains(QLatin1String(".dSYM/"))) |