From 52e031b1280f7f6d0a60542593a6e6e51edce65e Mon Sep 17 00:00:00 2001 From: Andrew Wason Date: Fri, 21 Jun 2024 18:10:09 -0400 Subject: [PATCH] splitscreen demo. reorg fixtures. --- tests/CMakeLists.txt | 1 + tests/fixtures | 2 +- tests/qml/splitscreen.qml | 46 +++++++++++++++++++++++++++++++++++++++ tests/qmltest.sh | 3 ++- tests/tst_encoder.cpp | 2 +- 5 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 tests/qml/splitscreen.qml diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 14614ef..bc30de8 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -66,6 +66,7 @@ add_qml_test(NAME tst_qml_demo OUTPUTSPEC 15:320x180 QMLFILE demo.qml OUTPUTFILE add_qml_test(NAME tst_qml_async OUTPUTSPEC 15:320x180 QMLFILE async.qml OUTPUTFILE async.nut THRESHOLD 99.999) add_qml_test(NAME tst_qml_gl_transitions OUTPUTSPEC 15:320x240 QMLFILE gl-transitions.qml OUTPUTFILE gl-transitions.nut THRESHOLD 98.999) add_qml_test(NAME tst_qml_transformer OUTPUTSPEC 15:320x240 QMLFILE transformer.qml OUTPUTFILE transformer.nut THRESHOLD 99.999) +add_qml_test(NAME tst_qml_splitscreen OUTPUTSPEC 15:160x450 QMLFILE splitscreen.qml OUTPUTFILE splitscreen.nut THRESHOLD 99.999) # Label tests that require a GPU set_tests_properties(tst_qml_static tst_qml_animated tst_qml_video_clipstart tst_qml_multisink tst_qml_video_ad_insertion tst_qml_video_multieffect tst_qml_video_shadereffect tst_qml_sequence tst_qml_gl_transitions PROPERTIES LABELS GPU) \ No newline at end of file diff --git a/tests/fixtures b/tests/fixtures index c737deb..3e239aa 160000 --- a/tests/fixtures +++ b/tests/fixtures @@ -1 +1 @@ -Subproject commit c737debc0fbd080b1b587057d07dd872091cf686 +Subproject commit 3e239aa2c424a19e4b011b08882bd0a4925f57fa diff --git a/tests/qml/splitscreen.qml b/tests/qml/splitscreen.qml new file mode 100644 index 0000000..c24a949 --- /dev/null +++ b/tests/qml/splitscreen.qml @@ -0,0 +1,46 @@ +import QtQuick +import MediaFX + +Item { + id: root + + MediaClip { + id: videoClip + + source: Qt.resolvedUrl("../fixtures/assets/tr-subtitles-320x180-29.97fps-8s.mp4") + audioRenderer: AudioRenderer {} + + Component.onCompleted: { + videoClip.clipEnded.connect(root.RenderSession.session.endSession); + } + } + + VideoRenderer { + id: topLeftVideo + anchors.left: parent.left + mediaClip: videoClip + } + VideoRenderer { + id: bottomRightVideo + anchors.right: parent.right + anchors.top: topLeftVideo.bottom + mediaClip: videoClip + } + VideoRenderer { + id: fullVideo + transform: [ + Translate { + y: -fullVideo.height / 2 + }, + Scale { + origin.x: fullVideo.width / 2 + origin.y: fullVideo.height / 2 + xScale: 0.5 + yScale: 0.5 + } + ] + anchors.horizontalCenter: root.horizontalCenter + anchors.top: bottomRightVideo.bottom + mediaClip: videoClip + } +} diff --git a/tests/qmltest.sh b/tests/qmltest.sh index eb91e4d..e2a1f62 100755 --- a/tests/qmltest.sh +++ b/tests/qmltest.sh @@ -9,6 +9,7 @@ usage="$0 : " BASE=${BASH_SOURCE%/*} FIXTURES=${BASE}/fixtures +FIXTURES_OUTPUT=${FIXTURES}/output/mediafx-qt ASSETS=${FIXTURES}/assets MEDIAFX=${1:?$usage} @@ -39,7 +40,7 @@ function stream_hashes { # If framehash is different, then pixel difference each frame. # threshold=2 is how much each pixel can differ # https://superuser.com/questions/1615310/how-to-use-ffmpeg-blend-difference-filter-mode-to-identify-frame-differences-bet -FIXTURE=${FIXTURES}/$(basename "${OUTPUT}") +FIXTURE=${FIXTURES_OUTPUT}/$(basename "${OUTPUT}") [ -f "${FIXTURE}.framehash" ] || exit 1 diff <(stream_hashes "${FIXTURE}.framehash" audio) <(stream_hashes "${OUTPUT}.framehash" audio) diff --git a/tests/tst_encoder.cpp b/tests/tst_encoder.cpp index f2b6bdc..1534869 100644 --- a/tests/tst_encoder.cpp +++ b/tests/tst_encoder.cpp @@ -105,7 +105,7 @@ private slots: QByteArray encodedData(encodedFile.readAll()); encodedFile.close(); - QString fixturePath = QFINDTESTDATA("fixtures/encoder.nut"); + QString fixturePath = QFINDTESTDATA("fixtures/output/mediafx-qt/encoder.nut"); QFile fixtureFile(fixturePath); QVERIFY(fixtureFile.open(QIODevice::ReadOnly)); QByteArray fixtureData(fixtureFile.readAll());