summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Mira <samuel.mira@qt.io>2021-12-10 17:08:45 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-12-10 19:33:48 +0000
commitf91c2dbc95e52262a44d102d23ae1ab49ae85575 (patch)
tree3c1fceb235f50a8c5d49249445eddb714039afcc
parent1ee2cdc39f341fd1bc2b9bd216c4ed27b069bc64 (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 Change-Id: I7d1505654474c392d84f7189da8ec2da2b88682a Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit f9d8ed9e5d8172d0197eaf06ff0361332a8697f5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--tests/auto/unit/mockbackend/qmockmediaencoder.h10
-rw-r--r--tests/auto/unit/multimedia/qmediarecorder/tst_qmediarecorder.cpp4
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()