From 23a9a04935c28110c2cff0d71873573d8f8f51c3 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 4 Mar 2019 07:57:34 +0100 Subject: Android: Fix autotest First of all, we need to include a dummy.qml which imports the graphical effects, otherwise it will be ignored by qmlimportscanner, since all the QML code is generated programmatically. Second of all, using the Qml2ImportPath to look up the imports is not sufficient on Android, where the QML2_IMPORT_PATH environment variable is used instead. So we just add code to check this first, based on the order of precedence actually used by Qt. Task-number: QTBUG-73574 Change-Id: I7b140dcac758ff37340fd7539f5cacb2982ff7aa Reviewed-by: Daniel Smith Reviewed-by: BogDan Vatra --- tests/auto/auto.pro | 3 +++ tests/auto/dummy.qml | 6 ++++++ tests/auto/tst_qtgraphicaleffects.cpp | 6 +++++- 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 tests/auto/dummy.qml diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 711d2ac..df22767 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -6,3 +6,6 @@ QT += qml testlib quick TARGET = tst_qtgraphicaleffects SOURCES += tst_qtgraphicaleffects.cpp + +DISTFILES += \ + dummy.qml diff --git a/tests/auto/dummy.qml b/tests/auto/dummy.qml new file mode 100644 index 0000000..17ba150 --- /dev/null +++ b/tests/auto/dummy.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 +import QtGraphicalEffects 1.0 + +Item { + +} diff --git a/tests/auto/tst_qtgraphicaleffects.cpp b/tests/auto/tst_qtgraphicaleffects.cpp index 0f0e1df..7f26b01 100644 --- a/tests/auto/tst_qtgraphicaleffects.cpp +++ b/tests/auto/tst_qtgraphicaleffects.cpp @@ -89,8 +89,12 @@ void tst_qtgraphicaleffects::initTestCase() { QString import; + QString qmlImportPath = qgetenv("QML2_IMPORT_PATH"); + if (qmlImportPath.isEmpty() || !QFile::exists(qmlImportPath)) + qmlImportPath = QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath); + // Allow the test to work whether or not the module is yet installed. - if (QFile::exists(QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath) + "/QtGraphicalEffects")) { + if (QFile::exists(qmlImportPath + "/QtGraphicalEffects")) { // Module is installed - import it the nice way import = "QtGraphicalEffects"; } -- cgit v1.2.3