Skip to content

Commit

Permalink
splitscreen demo. reorg fixtures.
Browse files Browse the repository at this point in the history
  • Loading branch information
rectalogic committed Jul 24, 2024
1 parent f1e774d commit 52e031b
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 3 deletions.
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
46 changes: 46 additions & 0 deletions tests/qml/splitscreen.qml
Original file line number Diff line number Diff line change
@@ -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
}
}
3 changes: 2 additions & 1 deletion tests/qmltest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ usage="$0 <mediafxpath> <framerate>:<WxH> <qml-file> <output-file> <threshold>"
BASE=${BASH_SOURCE%/*}

FIXTURES=${BASE}/fixtures
FIXTURES_OUTPUT=${FIXTURES}/output/mediafx-qt
ASSETS=${FIXTURES}/assets

MEDIAFX=${1:?$usage}
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/tst_encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 52e031b

Please sign in to comment.