diff options
author | Samuel Mira <samuel.mira@qt.io> | 2021-12-10 17:08:45 +0200 |
---|---|---|
committer | Samuel Mira <samuel.mira@qt.io> | 2021-12-10 15:57:43 +0000 |
commit | f9d8ed9e5d8172d0197eaf06ff0361332a8697f5 (patch) | |
tree | 363100ebdd1ee7ca23b39156d054b83c18c9cece /tests | |
parent | e9b56cf4d1a2bfb6bcaa00a208cb216b7b20d2e1 (diff) |
Fix tst_qmediarecorder autotest
The auto test depended on a member variable that was changed but not
reset before the test. Added a reset function and a call to reset.
Fixes: QTBUG-99092
Pick-to: 6.2
Change-Id: I7d1505654474c392d84f7189da8ec2da2b88682a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/unit/mockbackend/qmockmediaencoder.h | 10 | ||||
-rw-r--r-- | tests/auto/unit/multimedia/qmediarecorder/tst_qmediarecorder.cpp | 4 |
2 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/unit/mockbackend/qmockmediaencoder.h b/tests/auto/unit/mockbackend/qmockmediaencoder.h index 06e10c24a..88ef5b3f9 100644 --- a/tests/auto/unit/mockbackend/qmockmediaencoder.h +++ b/tests/auto/unit/mockbackend/qmockmediaencoder.h @@ -100,6 +100,16 @@ public: emit stateChanged(m_state); } + void reset() + { + m_state = QMediaRecorder::StoppedState; + m_settings = QMediaEncoderSettings(); + m_position = 0; + emit stateChanged(m_state); + emit durationChanged(m_position); + clearActualLocation(); + } + public: QMediaMetaData m_metaData; QMediaRecorder::RecorderState m_state; diff --git a/tests/auto/unit/multimedia/qmediarecorder/tst_qmediarecorder.cpp b/tests/auto/unit/multimedia/qmediarecorder/tst_qmediarecorder.cpp index 30ba55c33..9808d065d 100644 --- a/tests/auto/unit/multimedia/qmediarecorder/tst_qmediarecorder.cpp +++ b/tests/auto/unit/multimedia/qmediarecorder/tst_qmediarecorder.cpp @@ -226,6 +226,8 @@ void tst_QMediaRecorder::testSink() QCOMPARE(encoder->actualLocation(), QUrl::fromLocalFile("default_name.mp4")); encoder->stop(); QCOMPARE(encoder->actualLocation(), QUrl::fromLocalFile("default_name.mp4")); + + mock->reset(); } void tst_QMediaRecorder::testRecord() @@ -261,6 +263,8 @@ void tst_QMediaRecorder::testRecord() mock->stop(); QCOMPARE(stateSignal.count(), 3); + + mock->reset(); } void tst_QMediaRecorder::testEncodingSettings() |