1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 #include <QTest> |
|
18 #include <QTimer> |
|
19 #include <QSignalSpy> |
|
20 |
|
21 #include "unittest_cxecameradevicecontrolsymbian.h" |
|
22 #include "cxecameradevicecontrolunit.h" |
|
23 #include "cxetestutils.h" |
|
24 #include "cxutils.h" |
|
25 |
|
26 UnitTestCxeCameraDeviceControlSymbian::UnitTestCxeCameraDeviceControlSymbian() |
|
27 : mDeviceControl(NULL) |
|
28 { |
|
29 } |
|
30 |
|
31 UnitTestCxeCameraDeviceControlSymbian::~UnitTestCxeCameraDeviceControlSymbian() |
|
32 { |
|
33 delete mDeviceControl; |
|
34 } |
|
35 |
|
36 // Run before each individual test case |
|
37 void UnitTestCxeCameraDeviceControlSymbian::init() |
|
38 { |
|
39 delete mDeviceControl; |
|
40 mDeviceControl = NULL; |
|
41 mDeviceControl = new CxeCameraDeviceControlUnit(); |
|
42 mDeviceControl->init(); |
|
43 } |
|
44 |
|
45 // Run after each individual test case |
|
46 void UnitTestCxeCameraDeviceControlSymbian::cleanup() |
|
47 { |
|
48 delete mDeviceControl; |
|
49 mDeviceControl = NULL; |
|
50 } |
|
51 |
|
52 void UnitTestCxeCameraDeviceControlSymbian::testMode() |
|
53 { |
|
54 // Image mode is the default |
|
55 QVERIFY(mDeviceControl->mode() == Cxe::ImageMode); |
|
56 } |
|
57 |
|
58 void UnitTestCxeCameraDeviceControlSymbian::testSetMode() |
|
59 { |
|
60 mDeviceControl->setMode(Cxe::VideoMode); |
|
61 |
|
62 QVERIFY(mDeviceControl->mode() == Cxe::VideoMode); |
|
63 } |
|
64 |
|
65 void UnitTestCxeCameraDeviceControlSymbian::testRelease() |
|
66 { |
|
67 mDeviceControl->release(); |
|
68 |
|
69 QVERIFY(mDeviceControl->state() == CxeCameraDeviceControl::Idle); |
|
70 } |
|
71 |
|
72 void UnitTestCxeCameraDeviceControlSymbian::testCameraIndex() |
|
73 { |
|
74 QVERIFY(mDeviceControl->cameraIndex() == Cxe::PrimaryCameraIndex); |
|
75 } |
|
76 |
|
77 void UnitTestCxeCameraDeviceControlSymbian::testSwitchCamera() |
|
78 { |
|
79 QVERIFY(mDeviceControl->cameraIndex() == Cxe::PrimaryCameraIndex); |
|
80 |
|
81 mDeviceControl->switchCamera(Cxe::SecondaryCameraIndex); |
|
82 |
|
83 QVERIFY(CxeTestUtils::waitForState<CxeCameraDeviceControl>( |
|
84 *mDeviceControl, CxeCameraDeviceControl::Ready, 1000)); |
|
85 |
|
86 QVERIFY(mDeviceControl->cameraIndex() == Cxe::SecondaryCameraIndex); |
|
87 } |
|
88 |
|
89 void UnitTestCxeCameraDeviceControlSymbian::testReserve() |
|
90 { |
|
91 mDeviceControl->reserve(); |
|
92 |
|
93 QVERIFY(CxeTestUtils::waitForState<CxeCameraDeviceControl>( |
|
94 *mDeviceControl, CxeCameraDeviceControl::Ready, 1000)); |
|
95 } |
|
96 |
|
97 // main() function |
|
98 QTEST_MAIN(UnitTestCxeCameraDeviceControlSymbian); |
|