From: Dmytro Poplavskiy Date: Mon, 6 Feb 2012 04:12:57 +0000 (+1000) Subject: Made camera unit tests more stable X-Git-Tag: upstream/5.2.95+rc1~580 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fb73a565747d06faec7c47490c0c509a74ff08e3;p=platform%2Fupstream%2Fqtmultimedia.git Made camera unit tests more stable Replaced qWait() with QTRY_COMPARE() Change-Id: I951bd8ca1eaaf8d0fd7308a90f82afcdb0475819 Reviewed-by: Michael Goddard --- diff --git a/tests/auto/unit/qcamera/tst_qcamera.cpp b/tests/auto/unit/qcamera/tst_qcamera.cpp index 83b00a3..08bd953 100644 --- a/tests/auto/unit/qcamera/tst_qcamera.cpp +++ b/tests/auto/unit/qcamera/tst_qcamera.cpp @@ -971,10 +971,9 @@ void tst_QCamera::testCameraEncodingProperyChange() stateChangedSignal.clear(); statusChangedSignal.clear(); - QTest::qWait(10); - QCOMPARE(camera.state(), QCamera::ActiveState); - QCOMPARE(camera.status(), QCamera::ActiveStatus); + QTRY_COMPARE(camera.status(), QCamera::ActiveStatus); + QCOMPARE(stateChangedSignal.count(), 0); QCOMPARE(statusChangedSignal.count(), 1); stateChangedSignal.clear(); @@ -986,7 +985,10 @@ void tst_QCamera::testCameraEncodingProperyChange() QCOMPARE(statusChangedSignal.count(), 0); camera.setCaptureMode(QCamera::CaptureStillImage); - QTest::qWait(10); + + QCOMPARE(camera.state(), QCamera::ActiveState); + QTRY_COMPARE(camera.status(), QCamera::ActiveStatus); + stateChangedSignal.clear(); statusChangedSignal.clear(); @@ -1000,10 +1002,9 @@ void tst_QCamera::testCameraEncodingProperyChange() stateChangedSignal.clear(); statusChangedSignal.clear(); - QTest::qWait(10); - QCOMPARE(camera.state(), QCamera::ActiveState); - QCOMPARE(camera.status(), QCamera::ActiveStatus); + QTRY_COMPARE(camera.status(), QCamera::ActiveStatus); + QCOMPARE(stateChangedSignal.count(), 0); QCOMPARE(statusChangedSignal.count(), 1); stateChangedSignal.clear(); @@ -1023,10 +1024,9 @@ void tst_QCamera::testCameraEncodingProperyChange() stateChangedSignal.clear(); statusChangedSignal.clear(); - QTest::qWait(10); - QCOMPARE(camera.state(), QCamera::ActiveState); - QCOMPARE(camera.status(), QCamera::ActiveStatus); + QTRY_COMPARE(camera.status(), QCamera::ActiveStatus); + QCOMPARE(stateChangedSignal.count(), 0); QCOMPARE(statusChangedSignal.count(), 1); } diff --git a/tests/auto/unit/qcamerawidgets/tst_qcamerawidgets.cpp b/tests/auto/unit/qcamerawidgets/tst_qcamerawidgets.cpp index cf1f347..45cf340 100644 --- a/tests/auto/unit/qcamerawidgets/tst_qcamerawidgets.cpp +++ b/tests/auto/unit/qcamerawidgets/tst_qcamerawidgets.cpp @@ -145,10 +145,9 @@ void tst_QCameraWidgets::testCameraEncodingProperyChange() stateChangedSignal.clear(); statusChangedSignal.clear(); - QTest::qWait(10); - QCOMPARE(camera.state(), QCamera::ActiveState); - QCOMPARE(camera.status(), QCamera::ActiveStatus); + QTRY_COMPARE(camera.status(), QCamera::ActiveStatus); + QCOMPARE(stateChangedSignal.count(), 0); QCOMPARE(statusChangedSignal.count(), 1); stateChangedSignal.clear(); @@ -160,7 +159,7 @@ void tst_QCameraWidgets::testCameraEncodingProperyChange() QCOMPARE(statusChangedSignal.count(), 0); camera.setCaptureMode(QCamera::CaptureStillImage); - QTest::qWait(10); + QTRY_COMPARE(camera.status(), QCamera::ActiveStatus); stateChangedSignal.clear(); statusChangedSignal.clear(); @@ -174,10 +173,9 @@ void tst_QCameraWidgets::testCameraEncodingProperyChange() stateChangedSignal.clear(); statusChangedSignal.clear(); - QTest::qWait(10); - QCOMPARE(camera.state(), QCamera::ActiveState); - QCOMPARE(camera.status(), QCamera::ActiveStatus); + QTRY_COMPARE(camera.status(), QCamera::ActiveStatus); + QCOMPARE(stateChangedSignal.count(), 0); QCOMPARE(statusChangedSignal.count(), 1); stateChangedSignal.clear(); @@ -197,10 +195,9 @@ void tst_QCameraWidgets::testCameraEncodingProperyChange() stateChangedSignal.clear(); statusChangedSignal.clear(); - QTest::qWait(10); - QCOMPARE(camera.state(), QCamera::ActiveState); - QCOMPARE(camera.status(), QCamera::ActiveStatus); + QTRY_COMPARE(camera.status(), QCamera::ActiveStatus); + QCOMPARE(stateChangedSignal.count(), 0); QCOMPARE(statusChangedSignal.count(), 1); stateChangedSignal.clear(); @@ -214,7 +211,7 @@ void tst_QCameraWidgets::testCameraEncodingProperyChange() QCOMPARE(stateChangedSignal.count(), 0); QCOMPARE(statusChangedSignal.count(), 1); - QTest::qWait(10); + QTRY_COMPARE(camera.status(), QCamera::ActiveStatus); mockCameraService->mockControl->m_propertyChangesSupported = true; //the changes to encoding settings,