diff options
Diffstat (limited to 'tests/auto/cmake/qmlimportscanner')
-rw-r--r-- | tests/auto/cmake/qmlimportscanner/CMakeLists.txt | 18 | ||||
-rw-r--r-- | tests/auto/cmake/qmlimportscanner/main.cpp | 53 | ||||
-rw-r--r-- | tests/auto/cmake/qmlimportscanner/main.qml | 5 | ||||
-rw-r--r-- | tests/auto/cmake/qmlimportscanner/qis_test.qrc | 6 |
4 files changed, 82 insertions, 0 deletions
diff --git a/tests/auto/cmake/qmlimportscanner/CMakeLists.txt b/tests/auto/cmake/qmlimportscanner/CMakeLists.txt new file mode 100644 index 0000000000..354b0f8dfc --- /dev/null +++ b/tests/auto/cmake/qmlimportscanner/CMakeLists.txt @@ -0,0 +1,18 @@ + +cmake_minimum_required(VERSION 3.1) +project(qis_test) + +find_package(Qt5Qml 5.0.0 REQUIRED) +find_package(Qt5Gui 5.0.0 REQUIRED) +find_package(Qt5Test 5.0.0 REQUIRED) +find_package(Qt5QmlImportScanner REQUIRED) + +set(CMAKE_CXXFLAGS "${CMAKE_CXXFLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}") + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) + +add_executable(qis_test "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/qis_test.qrc") +target_link_libraries(qis_test PRIVATE Qt5::Gui Qt5::Qml Qt5::Test) +qt5_import_qml_plugins(qis_test) diff --git a/tests/auto/cmake/qmlimportscanner/main.cpp b/tests/auto/cmake/qmlimportscanner/main.cpp new file mode 100644 index 0000000000..370b10e113 --- /dev/null +++ b/tests/auto/cmake/qmlimportscanner/main.cpp @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** 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 <QtQml> +#include <QtTest> + +class tst_QQC : public QObject +{ + Q_OBJECT +private slots: + void staticBuildTest(); +}; + +void tst_QQC::staticBuildTest() +{ +#ifdef QT_STATIC + QQmlEngine engine; + QQmlComponent component(&engine, QUrl("qrc:/main.qml")); + QScopedPointer<QObject> obj(component.create()); + QVERIFY(!obj.isNull()); + QCOMPARE(obj->property("success").toInt(), 42); +#endif +} + +QTEST_MAIN(tst_QQC) + +#include "main.moc" diff --git a/tests/auto/cmake/qmlimportscanner/main.qml b/tests/auto/cmake/qmlimportscanner/main.qml new file mode 100644 index 0000000000..e0101958ea --- /dev/null +++ b/tests/auto/cmake/qmlimportscanner/main.qml @@ -0,0 +1,5 @@ +import QtQml 2.0 +import QtQuick 2.0 +QtObject { + property int success: 42 +} diff --git a/tests/auto/cmake/qmlimportscanner/qis_test.qrc b/tests/auto/cmake/qmlimportscanner/qis_test.qrc new file mode 100644 index 0000000000..1f88fc4e71 --- /dev/null +++ b/tests/auto/cmake/qmlimportscanner/qis_test.qrc @@ -0,0 +1,6 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource> +<file>./main.qml</file> +<file alias="main.cpp">./main.cpp</file> +</qresource> +</RCC> |