From e06c207c066b4a5b469945ae9a8a7cc79682103e Mon Sep 17 00:00:00 2001 From: Val Doroshchuk Date: Thu, 28 Mar 2019 13:21:32 +0100 Subject: Android: Fix tst_QCameraBackend to wait for imageCaptured QCameraImageCapture::imageCaptured is also async and could be delivered after QCameraImageCapture::imageSaved. Fixes tst_QCameraBackend::testCameraCapture and tst_QCameraBackend::testCaptureToBuffer Change-Id: I47ee22c39cd2570f20a3e75a80249ed16ca52d0e Fixes: QTBUG-73582 Reviewed-by: Oliver Wolff Reviewed-by: Andy Shaw --- tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp b/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp index b568f38fc..f5a947a6e 100644 --- a/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp +++ b/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp @@ -378,7 +378,7 @@ void tst_QCameraBackend::testCameraCapture() QTRY_VERIFY(!savedSignal.isEmpty()); - QCOMPARE(capturedSignal.size(), 1); + QTRY_COMPARE(capturedSignal.size(), 1); QCOMPARE(capturedSignal.last().first().toInt(), id); QCOMPARE(errorSignal.size(), 0); QCOMPARE(imageCapture.error(), QCameraImageCapture::NoError); @@ -436,7 +436,7 @@ void tst_QCameraBackend::testCaptureToBuffer() QTRY_VERIFY(!imageAvailableSignal.isEmpty()); QVERIFY(errorSignal.isEmpty()); - QVERIFY(!capturedSignal.isEmpty()); + QTRY_VERIFY(!capturedSignal.isEmpty()); QVERIFY(!imageAvailableSignal.isEmpty()); QTest::qWait(2000); -- cgit v1.2.3 From ff67f0e8ddbf23354f5ee0ecd9328af1373433c7 Mon Sep 17 00:00:00 2001 From: Val Doroshchuk Date: Wed, 3 Apr 2019 10:02:55 +0200 Subject: Android: Move test files to qrc in tst_QSoundEffect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since TESTDATA files are not deployed to device, need to add them to qrc. Task-number: QTBUG-73583 Change-Id: Ie0b934b1d9bd46f8748ca93a3502ef1643271217 Reviewed-by: Christian Strømme --- tests/auto/integration/qsoundeffect/qsoundeffect.pro | 3 +++ tests/auto/integration/qsoundeffect/resources.qrc | 8 ++++++++ 2 files changed, 11 insertions(+) create mode 100644 tests/auto/integration/qsoundeffect/resources.qrc (limited to 'tests/auto') diff --git a/tests/auto/integration/qsoundeffect/qsoundeffect.pro b/tests/auto/integration/qsoundeffect/qsoundeffect.pro index 8ec2e458a..868346a2e 100644 --- a/tests/auto/integration/qsoundeffect/qsoundeffect.pro +++ b/tests/auto/integration/qsoundeffect/qsoundeffect.pro @@ -14,3 +14,6 @@ unix:!mac { } TESTDATA += test.wav + +RESOURCES += \ + resources.qrc diff --git a/tests/auto/integration/qsoundeffect/resources.qrc b/tests/auto/integration/qsoundeffect/resources.qrc new file mode 100644 index 000000000..24700560d --- /dev/null +++ b/tests/auto/integration/qsoundeffect/resources.qrc @@ -0,0 +1,8 @@ + + + test.wav + test_corrupted.wav + test_tone.wav + test24.wav + + -- cgit v1.2.3 From 82601d8b43faf560373b73674087955dcf427ead Mon Sep 17 00:00:00 2001 From: Val Doroshchuk Date: Fri, 29 Mar 2019 13:50:15 +0100 Subject: Android: Move inline qml to separate file in tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since androiddeployqt is looking for qml modules in qml/js files only, it is unable to deploy qml plugins for inline qml from cpp. Hence modules are never found while compiling inline qml. Fixes tst_QDeclarativeVideoOutputWindow and tst_QDeclarativeVideoOutput Fixes: QTBUG-73597 Fixes: QTBUG-73598 Change-Id: I43dc1ac38522779ff37f04b055a41b2c05eb7619 Reviewed-by: Christian Strømme --- .../auto/integration/qdeclarativevideooutput/main.qml | 7 +++++++ .../qdeclarativevideooutput.pro | 2 ++ .../auto/integration/qdeclarativevideooutput/qml.qrc | 5 +++++ .../tst_qdeclarativevideooutput.cpp | 19 +++++-------------- .../qdeclarativevideooutput_window/main.qml | 13 +++++++++++++ .../qdeclarativevideooutput_window.pro | 2 ++ .../qdeclarativevideooutput_window/qml.qrc | 5 +++++ .../tst_qdeclarativevideooutput_window.cpp | 16 +--------------- 8 files changed, 40 insertions(+), 29 deletions(-) create mode 100644 tests/auto/integration/qdeclarativevideooutput/main.qml create mode 100644 tests/auto/integration/qdeclarativevideooutput/qml.qrc create mode 100644 tests/auto/integration/qdeclarativevideooutput_window/main.qml create mode 100644 tests/auto/integration/qdeclarativevideooutput_window/qml.qrc (limited to 'tests/auto') diff --git a/tests/auto/integration/qdeclarativevideooutput/main.qml b/tests/auto/integration/qdeclarativevideooutput/main.qml new file mode 100644 index 000000000..e456adf6c --- /dev/null +++ b/tests/auto/integration/qdeclarativevideooutput/main.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 +import QtMultimedia 5.0 + +VideoOutput { + width: 150 + height: 100 +} diff --git a/tests/auto/integration/qdeclarativevideooutput/qdeclarativevideooutput.pro b/tests/auto/integration/qdeclarativevideooutput/qdeclarativevideooutput.pro index e68e87f79..1f3a00b42 100644 --- a/tests/auto/integration/qdeclarativevideooutput/qdeclarativevideooutput.pro +++ b/tests/auto/integration/qdeclarativevideooutput/qdeclarativevideooutput.pro @@ -3,6 +3,8 @@ TARGET = tst_qdeclarativevideooutput QT += multimedia-private qml testlib quick CONFIG += testcase +RESOURCES += qml.qrc + SOURCES += \ tst_qdeclarativevideooutput.cpp diff --git a/tests/auto/integration/qdeclarativevideooutput/qml.qrc b/tests/auto/integration/qdeclarativevideooutput/qml.qrc new file mode 100644 index 000000000..5f6483ac3 --- /dev/null +++ b/tests/auto/integration/qdeclarativevideooutput/qml.qrc @@ -0,0 +1,5 @@ + + + main.qml + + diff --git a/tests/auto/integration/qdeclarativevideooutput/tst_qdeclarativevideooutput.cpp b/tests/auto/integration/qdeclarativevideooutput/tst_qdeclarativevideooutput.cpp index 707a01512..0e9cf6aa3 100644 --- a/tests/auto/integration/qdeclarativevideooutput/tst_qdeclarativevideooutput.cpp +++ b/tests/auto/integration/qdeclarativevideooutput/tst_qdeclarativevideooutput.cpp @@ -123,7 +123,6 @@ private slots: private: QQmlEngine m_engine; - QByteArray m_plainQML; // Variables used for the mapping test QQmlComponent *m_mappingComponent; @@ -138,17 +137,9 @@ private: void tst_QDeclarativeVideoOutput::initTestCase() { - m_plainQML = \ - "import QtQuick 2.0\n" \ - "import QtMultimedia 5.0\n" \ - "VideoOutput {" \ - " width: 150;" \ - " height: 100;" \ - "}"; - // We initialize the mapping vars here m_mappingComponent = new QQmlComponent(&m_engine); - m_mappingComponent->setData(m_plainQML, QUrl()); + m_mappingComponent->loadUrl(QUrl("qrc:/main.qml")); m_mappingSurface = new SurfaceHolder(this); m_mappingOutput = m_mappingComponent->create(); @@ -173,7 +164,7 @@ tst_QDeclarativeVideoOutput::tst_QDeclarativeVideoOutput() void tst_QDeclarativeVideoOutput::fillMode() { QQmlComponent component(&m_engine); - component.setData(m_plainQML, QUrl()); + component.loadUrl(QUrl("qrc:/main.qml")); QObject *videoOutput = component.create(); QVERIFY(videoOutput != 0); @@ -202,7 +193,7 @@ void tst_QDeclarativeVideoOutput::fillMode() void tst_QDeclarativeVideoOutput::orientation() { QQmlComponent component(&m_engine); - component.setData(m_plainQML, QUrl()); + component.loadUrl(QUrl("qrc:/main.qml")); QObject *videoOutput = component.create(); QVERIFY(videoOutput != 0); @@ -255,7 +246,7 @@ void tst_QDeclarativeVideoOutput::orientation() void tst_QDeclarativeVideoOutput::surfaceSource() { QQmlComponent component(&m_engine); - component.setData(m_plainQML, QUrl()); + component.loadUrl(QUrl("qrc:/main.qml")); QObject *videoOutput = component.create(); QVERIFY(videoOutput != 0); @@ -341,7 +332,7 @@ void tst_QDeclarativeVideoOutput::surfaceSource() void tst_QDeclarativeVideoOutput::sourceRect() { QQmlComponent component(&m_engine); - component.setData(m_plainQML, QUrl()); + component.loadUrl(QUrl("qrc:/main.qml")); QObject *videoOutput = component.create(); QVERIFY(videoOutput != 0); diff --git a/tests/auto/integration/qdeclarativevideooutput_window/main.qml b/tests/auto/integration/qdeclarativevideooutput_window/main.qml new file mode 100644 index 000000000..8866be147 --- /dev/null +++ b/tests/auto/integration/qdeclarativevideooutput_window/main.qml @@ -0,0 +1,13 @@ +import QtQuick 2.0 +import QtMultimedia 5.0 + +Item { + width: 200 + height: 200 + VideoOutput { + objectName: "videoOutput" + x: 25; y: 50 + width: 150 + height: 100 + } +} diff --git a/tests/auto/integration/qdeclarativevideooutput_window/qdeclarativevideooutput_window.pro b/tests/auto/integration/qdeclarativevideooutput_window/qdeclarativevideooutput_window.pro index 975c1d6d0..82108d220 100644 --- a/tests/auto/integration/qdeclarativevideooutput_window/qdeclarativevideooutput_window.pro +++ b/tests/auto/integration/qdeclarativevideooutput_window/qdeclarativevideooutput_window.pro @@ -3,6 +3,8 @@ TARGET = tst_qdeclarativevideooutput_window QT += multimedia-private qml testlib quick CONFIG += testcase +RESOURCES += qml.qrc + SOURCES += \ tst_qdeclarativevideooutput_window.cpp diff --git a/tests/auto/integration/qdeclarativevideooutput_window/qml.qrc b/tests/auto/integration/qdeclarativevideooutput_window/qml.qrc new file mode 100644 index 000000000..5f6483ac3 --- /dev/null +++ b/tests/auto/integration/qdeclarativevideooutput_window/qml.qrc @@ -0,0 +1,5 @@ + + + main.qml + + diff --git a/tests/auto/integration/qdeclarativevideooutput_window/tst_qdeclarativevideooutput_window.cpp b/tests/auto/integration/qdeclarativevideooutput_window/tst_qdeclarativevideooutput_window.cpp index dd739d0e3..645b5d3c6 100644 --- a/tests/auto/integration/qdeclarativevideooutput_window/tst_qdeclarativevideooutput_window.cpp +++ b/tests/auto/integration/qdeclarativevideooutput_window/tst_qdeclarativevideooutput_window.cpp @@ -193,22 +193,8 @@ void tst_QDeclarativeVideoOutputWindow::initTestCase() { qRegisterMetaType(); - const QByteArray qmlSource = - "import QtQuick 2.0\n" - "import QtMultimedia 5.0\n\n" - "Item {" - " width: 200;" - " height: 200;" - " VideoOutput {" - " objectName: \"videoOutput\";" - " x: 25; y: 50;" - " width: 150;" - " height: 100;" - " }" - "}"; - QQmlComponent component(&m_engine); - component.setData(qmlSource, QUrl()); + component.loadUrl(QUrl("qrc:/main.qml")); m_rootItem.reset(qobject_cast(component.create())); m_videoItem = m_rootItem->findChild("videoOutput"); -- cgit v1.2.3 From 49cd7b16b2ae77246da10993958a989753abecb8 Mon Sep 17 00:00:00 2001 From: Val Doroshchuk Date: Thu, 28 Mar 2019 14:19:53 +0100 Subject: Android: Fix tst_QCameraBackend to find FinalizingStatus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes tst_QCameraBackend::testVideoRecording. Since QMediaRecorder::FinalizingStatus could be sent immediately, it is sane to wait for final QMediaRecorder::LoadedStatus only. But added a fix to check if the FinalizingStatus has been emitted. Task-number: QTBUG-73582 Change-Id: I63fc6b1951a712215ee5d982233924a79ac1c124 Reviewed-by: Oliver Wolff Reviewed-by: Andy Shaw Reviewed-by: Christian Strømme --- tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp b/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp index f5a947a6e..b8d501c12 100644 --- a/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp +++ b/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp @@ -672,9 +672,16 @@ void tst_QCameraBackend::testVideoRecording() QTRY_COMPARE(recorder.status(), QMediaRecorder::RecordingStatus); QCOMPARE(recorderStatusSignal.last().first().value(), recorder.status()); QTest::qWait(5000); + recorderStatusSignal.clear(); recorder.stop(); - QCOMPARE(recorder.status(), QMediaRecorder::FinalizingStatus); - QCOMPARE(recorderStatusSignal.last().first().value(), recorder.status()); + bool foundFinalizingStatus = false; + for (auto &list : recorderStatusSignal) { + if (list.contains(QVariant(QMediaRecorder::FinalizingStatus))) { + foundFinalizingStatus = true; + break; + } + } + QVERIFY(foundFinalizingStatus); QTRY_COMPARE(recorder.status(), QMediaRecorder::LoadedStatus); QCOMPARE(recorderStatusSignal.last().first().value(), recorder.status()); -- cgit v1.2.3