diff options
Diffstat (limited to 'tests/auto/tools/qt_cmake_create/testdata/qml_project')
4 files changed, 65 insertions, 0 deletions
diff --git a/tests/auto/tools/qt_cmake_create/testdata/qml_project/CMakeLists.txt.expected b/tests/auto/tools/qt_cmake_create/testdata/qml_project/CMakeLists.txt.expected new file mode 100644 index 0000000000..1187b0e54a --- /dev/null +++ b/tests/auto/tools/qt_cmake_create/testdata/qml_project/CMakeLists.txt.expected @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 3.16) +project(qml_project LANGUAGES CXX) + +find_package(Qt6 REQUIRED COMPONENTS Gui Qml Quick Core) +qt_standard_project_setup() + +qt_add_executable(qml_project + main.cpp +) + +qt_add_qml_module(qml_project + URI qml_project + OUTPUT_DIRECTORY qml + VERSION 1.0 + RESOURCE_PREFIX /qt/qml + QML_FILES + TestComponent.qml + main.qml +) + +target_link_libraries(qml_project + PRIVATE + Qt::Gui + Qt::Qml + Qt::Quick + Qt::Core +) diff --git a/tests/auto/tools/qt_cmake_create/testdata/qml_project/TestComponent.qml b/tests/auto/tools/qt_cmake_create/testdata/qml_project/TestComponent.qml new file mode 100644 index 0000000000..f97cbcf115 --- /dev/null +++ b/tests/auto/tools/qt_cmake_create/testdata/qml_project/TestComponent.qml @@ -0,0 +1,4 @@ +import QtQuick + +Item { +} diff --git a/tests/auto/tools/qt_cmake_create/testdata/qml_project/main.cpp b/tests/auto/tools/qt_cmake_create/testdata/qml_project/main.cpp new file mode 100644 index 0000000000..13c7014d8c --- /dev/null +++ b/tests/auto/tools/qt_cmake_create/testdata/qml_project/main.cpp @@ -0,0 +1,18 @@ +#include <QGuiApplication> +#include <QQmlApplicationEngine> + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + + QQmlApplicationEngine engine; + const QUrl url(QStringLiteral("qrc:/qt/qml/qml_project/main.qml")); + QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, + &app, [url](QObject *obj, const QUrl &objUrl) { + if (!obj && url == objUrl) + QCoreApplication::exit(-1); + }, Qt::QueuedConnection); + engine.load(url); + + return app.exec(); +} diff --git a/tests/auto/tools/qt_cmake_create/testdata/qml_project/main.qml b/tests/auto/tools/qt_cmake_create/testdata/qml_project/main.qml new file mode 100644 index 0000000000..b42c9e7897 --- /dev/null +++ b/tests/auto/tools/qt_cmake_create/testdata/qml_project/main.qml @@ -0,0 +1,16 @@ +import QtQuick +import QtQuick.Window + +Window { + width: 640 + height: 480 + visible: true + title: "Hello World" + Text { + anchors.centerIn: parent + font.pointSize: 16 + text: "Now I have CMakeLists.txt. Thanks!" + } + TestComponent { + } +} |