summaryrefslogtreecommitdiffstats
path: root/tests/auto/unit/qmediarecorder/tst_qmediarecorder.cpp
diff options
context:
space:
mode:
authorDmytro Poplavskiy <dmytro.poplavskiy@nokia.com>2012-05-01 13:10:33 +1000
committerQt by Nokia <qt-info@nokia.com>2012-05-02 03:15:01 +0200
commitb7935a84d71b479f5320e5b062274d344835ba26 (patch)
treee72ac1774590d91f621ed9b21cf0c0ab2c87903b /tests/auto/unit/qmediarecorder/tst_qmediarecorder.cpp
parentaf932e8653b024c93ed49ba30d6f06839ecfced6 (diff)
Added QMediaRecorder::status property
QMediaRecorder::state property represents the user request and changed synchronously during record(), pause() or stop() calls. Recorder status is changed asynchronously and represents the actual status of media recorder. This also makes API more consistent with QMediaPlayer and QCamera. Change-Id: I80b4aaa70bb88e555c492908da8c29d0fc5ed5ea Reviewed-by: Ling Hu <ling.hu@nokia.com>
Diffstat (limited to 'tests/auto/unit/qmediarecorder/tst_qmediarecorder.cpp')
-rw-r--r--tests/auto/unit/qmediarecorder/tst_qmediarecorder.cpp32
1 files changed, 28 insertions, 4 deletions
diff --git a/tests/auto/unit/qmediarecorder/tst_qmediarecorder.cpp b/tests/auto/unit/qmediarecorder/tst_qmediarecorder.cpp
index b26164d0c..aad7b873d 100644
--- a/tests/auto/unit/qmediarecorder/tst_qmediarecorder.cpp
+++ b/tests/auto/unit/qmediarecorder/tst_qmediarecorder.cpp
@@ -307,26 +307,50 @@ void tst_QMediaRecorder::testSink()
void tst_QMediaRecorder::testRecord()
{
QSignalSpy stateSignal(capture,SIGNAL(stateChanged(QMediaRecorder::State)));
+ QSignalSpy statusSignal(capture,SIGNAL(statusChanged(QMediaRecorder::Status)));
QSignalSpy progressSignal(capture, SIGNAL(durationChanged(qint64)));
capture->record();
QCOMPARE(capture->state(), QMediaRecorder::RecordingState);
QCOMPARE(capture->error(), QMediaRecorder::NoError);
QCOMPARE(capture->errorString(), QString());
- QTestEventLoop::instance().enterLoop(1);
+
QCOMPARE(stateSignal.count(), 1);
QCOMPARE(stateSignal.last()[0].value<QMediaRecorder::State>(), QMediaRecorder::RecordingState);
+
+ QTestEventLoop::instance().enterLoop(1);
+
+ QCOMPARE(capture->status(), QMediaRecorder::RecordingStatus);
+ QVERIFY(!statusSignal.isEmpty());
+ QCOMPARE(statusSignal.last()[0].value<QMediaRecorder::Status>(), QMediaRecorder::RecordingStatus);
+ statusSignal.clear();
+
QVERIFY(progressSignal.count() > 0);
+
capture->pause();
+
QCOMPARE(capture->state(), QMediaRecorder::PausedState);
- QTestEventLoop::instance().enterLoop(1);
+
QCOMPARE(stateSignal.count(), 2);
+
+ QTestEventLoop::instance().enterLoop(1);
+ QCOMPARE(capture->status(), QMediaRecorder::PausedStatus);
+ QVERIFY(!statusSignal.isEmpty());
+ QCOMPARE(statusSignal.last()[0].value<QMediaRecorder::Status>(), QMediaRecorder::PausedStatus);
+ statusSignal.clear();
+
capture->stop();
+
QCOMPARE(capture->state(), QMediaRecorder::StoppedState);
- QTestEventLoop::instance().enterLoop(1);
QCOMPARE(stateSignal.count(), 3);
+
+ QTestEventLoop::instance().enterLoop(1);
+ QCOMPARE(capture->status(), QMediaRecorder::LoadedStatus);
+ QVERIFY(!statusSignal.isEmpty());
+ QCOMPARE(statusSignal.last()[0].value<QMediaRecorder::Status>(), QMediaRecorder::LoadedStatus);
+ statusSignal.clear();
+
mock->stop();
QCOMPARE(stateSignal.count(), 3);
-
}
void tst_QMediaRecorder::testMute()