diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-10-11 16:21:42 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-10-11 16:21:42 +0200 |
commit | 6a0bb9a7d6a6473920da74bb48c52a4eaed990b0 (patch) | |
tree | 3a32c56b1fe21c96d5982511e0b4815c1c07dfbb /tests/auto/cmake | |
parent | f0d23d3ff9da26a71295a6abd356c8d366d17439 (diff) | |
parent | 2746518c76e02c642ff29faf568de4de90216e58 (diff) |
Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
Change-Id: I4a91928610f79c8e21a05781953ffa41508c828a
Diffstat (limited to 'tests/auto/cmake')
-rw-r--r-- | tests/auto/cmake/CMakeLists.txt | 14 | ||||
-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 |
5 files changed, 93 insertions, 3 deletions
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt index c61105418f..de776e9dd1 100644 --- a/tests/auto/cmake/CMakeLists.txt +++ b/tests/auto/cmake/CMakeLists.txt @@ -1,5 +1,3 @@ -# Generated from cmake.pro. -# special case begin cmake_minimum_required(VERSION 2.8) project(qmake_cmake_files) @@ -30,4 +28,14 @@ add_test(qtquickcompiler ${CMAKE_CTEST_COMMAND} ) -# special case end +add_test(qmlimportscanner ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMAKE_CURRENT_SOURCE_DIR}/qmlimportscanner/" + "${CMAKE_CURRENT_BINARY_DIR}/qmlimportscanner" + --build-config "${CMAKE_BUILD_TYPE}" + --build-generator ${CMAKE_GENERATOR} + --build-makeprogram ${CMAKE_MAKE_PROGRAM} + --build-project qis_test + --build-options "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" ${BUILD_OPTIONS_LIST} + --test-command qis_test +) 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> |