19 |
19 |
20 #include "cxetestutils.h" |
20 #include "cxetestutils.h" |
21 #include "unittest_cxevideocapturecontrolsymbian.h" |
21 #include "unittest_cxevideocapturecontrolsymbian.h" |
22 #include "cxevideocapturecontrolsymbian.h" |
22 #include "cxevideocapturecontrolsymbian.h" |
23 #include "cxevideocapturecontrolsymbianunit.h" |
23 #include "cxevideocapturecontrolsymbianunit.h" |
|
24 #include "cxesnapshotcontrol.h" |
24 #include "cxefakefilenamegenerator.h" |
25 #include "cxefakefilenamegenerator.h" |
25 #include "cxedummycamera.h" |
26 #include "cxedummycamera.h" |
26 #include "cxefakecameradevice.h" |
27 #include "cxefakecameradevice.h" |
27 #include "cxefakeviewfindercontrol.h" |
28 #include "cxefakeviewfindercontrol.h" |
28 #include "cxefakecameradevicecontrol.h" |
29 #include "cxefakecameradevicecontrol.h" |
63 CX_DEBUG_ENTER_FUNCTION(); |
64 CX_DEBUG_ENTER_FUNCTION(); |
64 mCameraDeviceControl = new CxeFakeCameraDeviceControl(); |
65 mCameraDeviceControl = new CxeFakeCameraDeviceControl(); |
65 mCameraDeviceControl->setMode(Cxe::VideoMode); |
66 mCameraDeviceControl->setMode(Cxe::VideoMode); |
66 mCameraDevice = new CxeFakeCameraDevice(); |
67 mCameraDevice = new CxeFakeCameraDevice(); |
67 mViewfinderControl = new CxeFakeViewfinderControl(); |
68 mViewfinderControl = new CxeFakeViewfinderControl(); |
|
69 mSnapshotControl = new CxeSnapshotControl(*mCameraDevice); |
68 mSettings = new CxeFakeSettings(); |
70 mSettings = new CxeFakeSettings(); |
69 mSettings->set(CxeSettingIds::VIDEO_SHOWCAPTURED, -1); |
71 mSettings->set(CxeSettingIds::VIDEO_SHOWCAPTURED, -1); |
70 mFilenameGeneratorSymbian = new CxeFakeFilenameGenerator(); |
72 mFilenameGeneratorSymbian = new CxeFakeFilenameGenerator(); |
71 mFilenameGeneratorSymbian->init(Cxe::VideoMode); |
73 mFilenameGeneratorSymbian->init(Cxe::VideoMode); |
72 mFakeQualityPresets = new CxeFakeQualityPresets(); |
74 mFakeQualityPresets = new CxeFakeQualityPresets(); |
73 mDiskMonitor = new CxeDiskMonitor(*mSettings); |
75 mDiskMonitor = new CxeDiskMonitor(*mSettings); |
74 mCxeVideoCaptureControlSymbian = new CxeVideoCaptureControlSymbianUnit(*mCameraDevice, |
76 mCxeVideoCaptureControlSymbian = new CxeVideoCaptureControlSymbianUnit(*mCameraDevice, |
75 *mViewfinderControl, |
77 *mViewfinderControl, |
|
78 *mSnapshotControl, |
76 *mCameraDeviceControl, |
79 *mCameraDeviceControl, |
77 *mFilenameGeneratorSymbian, |
80 *mFilenameGeneratorSymbian, |
78 *mSettings, |
81 *mSettings, |
79 *mFakeQualityPresets, |
82 *mFakeQualityPresets, |
80 *mDiskMonitor); |
83 *mDiskMonitor); |
100 mCxeVideoCaptureControlSymbian = 0; |
103 mCxeVideoCaptureControlSymbian = 0; |
101 delete mFilenameGeneratorSymbian; |
104 delete mFilenameGeneratorSymbian; |
102 mFilenameGeneratorSymbian = 0; |
105 mFilenameGeneratorSymbian = 0; |
103 delete mViewfinderControl; |
106 delete mViewfinderControl; |
104 mViewfinderControl = 0; |
107 mViewfinderControl = 0; |
|
108 delete mSnapshotControl; |
|
109 mSnapshotControl = 0; |
105 delete mCameraDeviceControl; |
110 delete mCameraDeviceControl; |
106 mCameraDeviceControl = 0; |
111 mCameraDeviceControl = 0; |
107 delete mCameraDevice; |
112 delete mCameraDevice; |
108 mCameraDevice = 0; |
113 mCameraDevice = 0; |
109 delete mFakeQualityPresets; |
114 delete mFakeQualityPresets; |
228 QCOMPARE(mCxeVideoCaptureControlSymbian->snapshot(), QPixmap()); |
233 QCOMPARE(mCxeVideoCaptureControlSymbian->snapshot(), QPixmap()); |
229 |
234 |
230 CX_DEBUG_EXIT_FUNCTION(); |
235 CX_DEBUG_EXIT_FUNCTION(); |
231 } |
236 } |
232 |
237 |
233 void UnitTestCxeVideoCaptureControlSymbian::testHandleSnapshotEvent() |
238 void UnitTestCxeVideoCaptureControlSymbian::testHandleSnapshotReady() |
234 { |
239 { |
235 CX_DEBUG_ENTER_FUNCTION(); |
240 CX_DEBUG_ENTER_FUNCTION(); |
|
241 QPixmap snapshot; |
236 |
242 |
237 QSignalSpy spy(mCxeVideoCaptureControlSymbian, SIGNAL(snapshotReady(CxeError::Id, const QPixmap&, const QString&))); |
243 QSignalSpy spy(mCxeVideoCaptureControlSymbian, SIGNAL(snapshotReady(CxeError::Id, const QPixmap&, const QString&))); |
238 mCxeVideoCaptureControlSymbian->deinit(); |
244 mCxeVideoCaptureControlSymbian->deinit(); |
239 doPrepareStuff(); |
245 doPrepareStuff(); |
240 mCxeVideoCaptureControlSymbian->handleSnapshotEvent(CxeError::OutOfMemory); |
246 mCxeVideoCaptureControlSymbian->handleSnapshotReady(CxeError::OutOfMemory, snapshot); |
241 QCOMPARE(mCxeVideoCaptureControlSymbian->state(), CxeVideoCaptureControl::Ready); |
247 QCOMPARE(mCxeVideoCaptureControlSymbian->state(), CxeVideoCaptureControl::Ready); |
242 |
248 |
243 // check that we receive this signal once the snapshot is ready |
249 // check that we receive this signal once the snapshot is ready |
244 QVERIFY(CxeTestUtils::waitForSignal(spy, 1000)); |
250 QVERIFY(CxeTestUtils::waitForSignal(spy, 1000)); |
245 |
251 |
246 doPrepareStuff(); |
252 doPrepareStuff(); |
247 mCxeVideoCaptureControlSymbian->handleSnapshotEvent(CxeError::None); |
253 mCxeVideoCaptureControlSymbian->handleSnapshotReady(CxeError::None, snapshot); |
248 QVERIFY(CxeTestUtils::waitForSignal(spy, 1000)); |
254 QVERIFY(CxeTestUtils::waitForSignal(spy, 1000)); |
249 |
255 |
250 CX_DEBUG_EXIT_FUNCTION(); |
256 CX_DEBUG_EXIT_FUNCTION(); |
251 } |
257 } |
252 |
258 |