summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Blechmann <tim@klingt.org>2024-03-11 12:18:50 +0800
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-03-19 13:37:01 +0000
commitedec1f8a4dbe6ed26f5996b1fbe24c4ee51c5585 (patch)
tree08a18733306c5fba022b2df6a32ce315ea4eaba6
parent2e2dd0020e2c7e92b7c85774c3a834e1d9d7a49c (diff)
tests: add minimal qml camera/player test
Pick-to: 6.5 Change-Id: Ia768592fe580eb86632931e637a49d8770c98ea4 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit ab46c20b65cd07efd83076c682297bb9b084f728) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit dae8637c5ea4b83e80b4c1e33f762658f94642c5)
-rw-r--r--tests/manual/CMakeLists.txt5
-rw-r--r--tests/manual/qml-minimal-camera/CMakeLists.txt42
-rw-r--r--tests/manual/qml-minimal-camera/Info.plist.in46
-rw-r--r--tests/manual/qml-minimal-camera/qml-minimal-camera.cpp17
-rw-r--r--tests/manual/qml-minimal-camera/qml-minimal-camera.qml34
-rw-r--r--tests/manual/qml-minimal-player/CMakeLists.txt42
-rw-r--r--tests/manual/qml-minimal-player/Info.plist.in46
-rw-r--r--tests/manual/qml-minimal-player/qml-minimal-player.cpp17
-rw-r--r--tests/manual/qml-minimal-player/qml-minimal-player.qml42
9 files changed, 291 insertions, 0 deletions
diff --git a/tests/manual/CMakeLists.txt b/tests/manual/CMakeLists.txt
index 2fc8f746b..66aea171e 100644
--- a/tests/manual/CMakeLists.txt
+++ b/tests/manual/CMakeLists.txt
@@ -4,3 +4,8 @@
add_subdirectory(audiodecoder)
add_subdirectory(devices)
add_subdirectory(wasm)
+
+if(TARGET Qt::Quick)
+ add_subdirectory(qml-minimal-camera)
+ add_subdirectory(qml-minimal-player)
+endif()
diff --git a/tests/manual/qml-minimal-camera/CMakeLists.txt b/tests/manual/qml-minimal-camera/CMakeLists.txt
new file mode 100644
index 000000000..fcd4676b3
--- /dev/null
+++ b/tests/manual/qml-minimal-camera/CMakeLists.txt
@@ -0,0 +1,42 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(sidepanel LANGUAGES CXX)
+
+set(CMAKE_AUTOMOC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/multimedia/qml-minimal-camera")
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Multimedia Qml Quick)
+
+qt_add_executable( qml-minimal-camera WIN32 MACOSX_BUNDLE
+ qml-minimal-camera.cpp
+)
+
+qt_add_qml_module( qml-minimal-camera
+ URI QmlMinimalCamera
+ NO_RESOURCE_TARGET_PATH
+ QML_FILES
+ "qml-minimal-camera.qml"
+)
+
+target_link_libraries( qml-minimal-camera PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Quick
+)
+
+install(TARGETS qml-minimal-camera
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
+
+set_target_properties( qml-minimal-camera PROPERTIES
+ MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in
+)
diff --git a/tests/manual/qml-minimal-camera/Info.plist.in b/tests/manual/qml-minimal-camera/Info.plist.in
new file mode 100644
index 000000000..46a9ecf2d
--- /dev/null
+++ b/tests/manual/qml-minimal-camera/Info.plist.in
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+
+ <key>CFBundleName</key>
+ <string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
+ <key>CFBundleIdentifier</key>
+ <string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
+ <key>CFBundleExecutable</key>
+ <string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
+
+ <key>CFBundleVersion</key>
+ <string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
+ <key>CFBundleShortVersionString</key>
+ <string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
+ <key>CFBundleLongVersionString</key>
+ <string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
+
+ <key>LSMinimumSystemVersion</key>
+ <string>${CMAKE_OSX_DEPLOYMENT_TARGET}</string>
+
+ <key>CFBundleGetInfoString</key>
+ <string>${MACOSX_BUNDLE_INFO_STRING}</string>
+ <key>NSHumanReadableCopyright</key>
+ <string>${MACOSX_BUNDLE_COPYRIGHT}</string>
+
+ <key>CFBundleIconFile</key>
+ <string>${MACOSX_BUNDLE_ICON_FILE}</string>
+
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+
+ <key>NSCameraUsageDescription</key>
+ <string>Qt Multimedia Example</string>
+ <key>NSMicrophoneUsageDescription</key>
+ <string>Qt Multimedia Example</string>
+
+ <key>NSSupportsAutomaticGraphicsSwitching</key>
+ <true/>
+</dict>
+</plist>
diff --git a/tests/manual/qml-minimal-camera/qml-minimal-camera.cpp b/tests/manual/qml-minimal-camera/qml-minimal-camera.cpp
new file mode 100644
index 000000000..afc839f56
--- /dev/null
+++ b/tests/manual/qml-minimal-camera/qml-minimal-camera.cpp
@@ -0,0 +1,17 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QQmlApplicationEngine engine;
+ engine.load(QUrl("qrc:/qml-minimal-camera.qml"));
+ if (engine.rootObjects().isEmpty())
+ return -1;
+
+ return app.exec();
+}
diff --git a/tests/manual/qml-minimal-camera/qml-minimal-camera.qml b/tests/manual/qml-minimal-camera/qml-minimal-camera.qml
new file mode 100644
index 000000000..919517876
--- /dev/null
+++ b/tests/manual/qml-minimal-camera/qml-minimal-camera.qml
@@ -0,0 +1,34 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtQuick.Controls
+import QtMultimedia
+
+ApplicationWindow {
+ id: window
+ width: 800
+ height: 600
+ visible: true
+ title: qsTr("QmlMinimalCamera")
+
+ MediaDevices {
+ id: mediaDevices
+ }
+
+ CaptureSession {
+ id: captureSession
+ videoOutput: output
+ camera: Camera {
+ id: camera
+ cameraDevice: mediaDevices.defaultVideoInput
+ }
+
+ Component.onCompleted: camera.start()
+ }
+
+ VideoOutput {
+ id: output
+ visible: true
+ }
+}
diff --git a/tests/manual/qml-minimal-player/CMakeLists.txt b/tests/manual/qml-minimal-player/CMakeLists.txt
new file mode 100644
index 000000000..be8f61861
--- /dev/null
+++ b/tests/manual/qml-minimal-player/CMakeLists.txt
@@ -0,0 +1,42 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(sidepanel LANGUAGES CXX)
+
+set(CMAKE_AUTOMOC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/multimedia/qml-minimal-player")
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Multimedia Qml Quick)
+
+qt_add_executable( qml-minimal-player WIN32 MACOSX_BUNDLE
+ qml-minimal-player.cpp
+)
+
+qt_add_qml_module( qml-minimal-player
+ URI QmlMinimalplayer
+ NO_RESOURCE_TARGET_PATH
+ QML_FILES
+ "qml-minimal-player.qml"
+)
+
+target_link_libraries( qml-minimal-player PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Quick
+)
+
+install(TARGETS qml-minimal-player
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
+
+set_target_properties( qml-minimal-player PROPERTIES
+ MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in
+)
diff --git a/tests/manual/qml-minimal-player/Info.plist.in b/tests/manual/qml-minimal-player/Info.plist.in
new file mode 100644
index 000000000..46a9ecf2d
--- /dev/null
+++ b/tests/manual/qml-minimal-player/Info.plist.in
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+
+ <key>CFBundleName</key>
+ <string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
+ <key>CFBundleIdentifier</key>
+ <string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
+ <key>CFBundleExecutable</key>
+ <string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
+
+ <key>CFBundleVersion</key>
+ <string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
+ <key>CFBundleShortVersionString</key>
+ <string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
+ <key>CFBundleLongVersionString</key>
+ <string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
+
+ <key>LSMinimumSystemVersion</key>
+ <string>${CMAKE_OSX_DEPLOYMENT_TARGET}</string>
+
+ <key>CFBundleGetInfoString</key>
+ <string>${MACOSX_BUNDLE_INFO_STRING}</string>
+ <key>NSHumanReadableCopyright</key>
+ <string>${MACOSX_BUNDLE_COPYRIGHT}</string>
+
+ <key>CFBundleIconFile</key>
+ <string>${MACOSX_BUNDLE_ICON_FILE}</string>
+
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+
+ <key>NSCameraUsageDescription</key>
+ <string>Qt Multimedia Example</string>
+ <key>NSMicrophoneUsageDescription</key>
+ <string>Qt Multimedia Example</string>
+
+ <key>NSSupportsAutomaticGraphicsSwitching</key>
+ <true/>
+</dict>
+</plist>
diff --git a/tests/manual/qml-minimal-player/qml-minimal-player.cpp b/tests/manual/qml-minimal-player/qml-minimal-player.cpp
new file mode 100644
index 000000000..5dbef5c87
--- /dev/null
+++ b/tests/manual/qml-minimal-player/qml-minimal-player.cpp
@@ -0,0 +1,17 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QQmlApplicationEngine engine;
+ engine.load(QUrl("qrc:/qml-minimal-player.qml"));
+ if (engine.rootObjects().isEmpty())
+ return -1;
+
+ return app.exec();
+}
diff --git a/tests/manual/qml-minimal-player/qml-minimal-player.qml b/tests/manual/qml-minimal-player/qml-minimal-player.qml
new file mode 100644
index 000000000..2c5d7cfd2
--- /dev/null
+++ b/tests/manual/qml-minimal-player/qml-minimal-player.qml
@@ -0,0 +1,42 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+import QtQuick
+import QtQuick.Controls
+import QtMultimedia
+
+ApplicationWindow {
+ id: window
+ width: 800
+ height: 600
+ visible: true
+ title: qsTr("QmlMinimalPlayer")
+
+ MediaPlayer {
+ id: player
+ audioOutput: AudioOutput {
+ onMutedChanged: {
+ console.log("muted", player.audioOutput.muted)
+ }
+ }
+ videoOutput: output
+
+ onMediaStatusChanged: {
+ console.log("status", player.mediaStatus);
+
+ if (player.mediaStatus === MediaPlayer.LoadedMedia)
+ player.play()
+ }
+ }
+
+ Component.onCompleted: {
+ if (Qt.application.arguments.length > 1)
+ player.setSource(Qt.application.arguments[1])
+ else
+ console.log("Please specify a video source")
+ }
+
+ VideoOutput {
+ id: output
+ visible: true
+ }
+}