summaryrefslogtreecommitdiff
path: root/tests/auto/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/cmake')
-rw-r--r--tests/auto/cmake/qmlquery/CMakeLists.txt1
-rw-r--r--tests/auto/cmake/qmlquery/My/OtherThings/CMakeLists.txt28
-rw-r--r--tests/auto/cmake/qmlquery/My/OtherThings/test.cpp3
-rw-r--r--tests/auto/cmake/qmlquery/My/OtherThings/test.h18
4 files changed, 50 insertions, 0 deletions
diff --git a/tests/auto/cmake/qmlquery/CMakeLists.txt b/tests/auto/cmake/qmlquery/CMakeLists.txt
index 5baac4f967..bafabe70f2 100644
--- a/tests/auto/cmake/qmlquery/CMakeLists.txt
+++ b/tests/auto/cmake/qmlquery/CMakeLists.txt
@@ -8,3 +8,4 @@ find_package(Qt6 REQUIRED COMPONENTS Qml)
set(CMAKE_AUTOMOC TRUE)
add_subdirectory(My/Things)
+add_subdirectory(My/OtherThings)
diff --git a/tests/auto/cmake/qmlquery/My/OtherThings/CMakeLists.txt b/tests/auto/cmake/qmlquery/My/OtherThings/CMakeLists.txt
new file mode 100644
index 0000000000..5d2bbc4fdd
--- /dev/null
+++ b/tests/auto/cmake/qmlquery/My/OtherThings/CMakeLists.txt
@@ -0,0 +1,28 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_policy(SET QTP0001 NEW)
+
+function(verify_result keyword expected actual)
+ if(NOT "${actual}" STREQUAL "${expected}")
+ message(SEND_ERROR
+ " Expected ${keyword}: ${expected}\n"
+ " Actual ${keyword}: ${actual}"
+ )
+ endif()
+endfunction()
+
+qt_add_qml_module(MyOtherThings
+ URI My.OtherThings
+ SOURCES
+ test.h test.cpp
+)
+
+qt_query_qml_module(MyOtherThings
+ QML_FILES qml_files2
+ RESOURCES resources2
+)
+
+# empty resources and files
+verify_result(RESOURCES "${resources2}" "")
+verify_result(QML_FILES "${qml_files2}" "")
diff --git a/tests/auto/cmake/qmlquery/My/OtherThings/test.cpp b/tests/auto/cmake/qmlquery/My/OtherThings/test.cpp
new file mode 100644
index 0000000000..b9dde77775
--- /dev/null
+++ b/tests/auto/cmake/qmlquery/My/OtherThings/test.cpp
@@ -0,0 +1,3 @@
+#include "test.h"
+
+Test::Test() {}
diff --git a/tests/auto/cmake/qmlquery/My/OtherThings/test.h b/tests/auto/cmake/qmlquery/My/OtherThings/test.h
new file mode 100644
index 0000000000..274de043a1
--- /dev/null
+++ b/tests/auto/cmake/qmlquery/My/OtherThings/test.h
@@ -0,0 +1,18 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#ifndef TEST_H
+#define TEST_H
+
+#include <QtQml/qqml.h>
+#include <QObject>
+
+class Test : public QObject
+{
+ Q_OBJECT
+ QML_ELEMENT
+public:
+ Test();
+};
+
+#endif // TEST_H