58
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 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: Unit tests for CxeSceneModeStore class
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include <QtCore/QString>
|
|
19 |
#include <QtTest>
|
|
20 |
|
|
21 |
#include "cxenamespace.h"
|
|
22 |
#include "cxeerror.h"
|
|
23 |
#include "cxeexception.h"
|
|
24 |
#include "unittest_cxescenemodestore.h"
|
|
25 |
|
|
26 |
const char* FAIL_TEST_SETTING = "Fail test";
|
|
27 |
|
|
28 |
UnitTestCxeSceneModeStore::UnitTestCxeSceneModeStore() :
|
|
29 |
mSceneModeStore(NULL)
|
|
30 |
{
|
|
31 |
}
|
|
32 |
|
|
33 |
UnitTestCxeSceneModeStore::~UnitTestCxeSceneModeStore()
|
|
34 |
{
|
|
35 |
}
|
|
36 |
|
|
37 |
void UnitTestCxeSceneModeStore::init()
|
|
38 |
{
|
|
39 |
mSceneModeStore = new CxeSceneModeStore();
|
|
40 |
}
|
|
41 |
|
|
42 |
void UnitTestCxeSceneModeStore::cleanup()
|
|
43 |
{
|
|
44 |
delete mSceneModeStore;
|
|
45 |
mSceneModeStore = NULL;
|
|
46 |
}
|
|
47 |
|
|
48 |
void UnitTestCxeSceneModeStore::testSceneSettingValue()
|
|
49 |
{
|
|
50 |
QVariant value;
|
|
51 |
CxeError::Id err = mSceneModeStore->sceneSettingValue(Cxe::ImageMode, CxeSettingIds::COLOR_TONE, value);
|
|
52 |
QCOMPARE(err, CxeError::None);
|
|
53 |
|
|
54 |
err = mSceneModeStore->sceneSettingValue(Cxe::VideoMode, CxeSettingIds::COLOR_TONE, value);
|
|
55 |
QCOMPARE(err, CxeError::None);
|
|
56 |
}
|
|
57 |
|
|
58 |
void UnitTestCxeSceneModeStore::testSceneSettingValueNotFound()
|
|
59 |
{
|
|
60 |
QVariant value;
|
|
61 |
CxeError::Id err = mSceneModeStore->sceneSettingValue(Cxe::ImageMode, FAIL_TEST_SETTING, value);
|
|
62 |
QCOMPARE(err, CxeError::NotFound);
|
|
63 |
}
|
|
64 |
|
|
65 |
void UnitTestCxeSceneModeStore::testCurrentScene()
|
|
66 |
{
|
|
67 |
CxeScene scene;
|
|
68 |
try {
|
|
69 |
scene = mSceneModeStore->currentScene(Cxe::ImageMode);
|
|
70 |
}
|
|
71 |
catch (CxeException exception){
|
|
72 |
QString message = "Exception thrown, error id = ";
|
|
73 |
message.append(exception.error());
|
|
74 |
QFAIL(message.toAscii());
|
|
75 |
}
|
|
76 |
QVERIFY(true);
|
|
77 |
}
|
|
78 |
|
|
79 |
void UnitTestCxeSceneModeStore::testCurrentScene2()
|
|
80 |
{
|
|
81 |
CxeScene scene;
|
|
82 |
try {
|
|
83 |
scene = mSceneModeStore->currentScene(Cxe::VideoMode);
|
|
84 |
}
|
|
85 |
catch (CxeException exception){
|
|
86 |
QString message = "Exception thrown, error id = ";
|
|
87 |
message.append(exception.error());
|
|
88 |
QFAIL(message.toAscii());
|
|
89 |
}
|
|
90 |
QVERIFY(true);
|
|
91 |
}
|
|
92 |
|
|
93 |
void UnitTestCxeSceneModeStore::testCurrentSceneId()
|
|
94 |
{
|
|
95 |
QString sceneId = mSceneModeStore->currentSceneId(Cxe::ImageMode);
|
|
96 |
QVERIFY(sceneId != "");
|
|
97 |
sceneId = mSceneModeStore->currentSceneId(Cxe::VideoMode);
|
|
98 |
QVERIFY(sceneId != "");
|
|
99 |
}
|
|
100 |
|
|
101 |
void UnitTestCxeSceneModeStore::testGetScene()
|
|
102 |
{
|
|
103 |
CxeScene scene;
|
|
104 |
try {
|
|
105 |
scene = mSceneModeStore->getScene(Cxe::ImageMode, Cxe::IMAGE_SCENE_AUTO);
|
|
106 |
}
|
|
107 |
catch (CxeException exception) {
|
|
108 |
QString message = "Exception thrown, error id = ";
|
|
109 |
message.append(exception.error());
|
|
110 |
QFAIL(message.toAscii());
|
|
111 |
}
|
|
112 |
QVERIFY(true);
|
|
113 |
}
|
|
114 |
|
|
115 |
void UnitTestCxeSceneModeStore::testSetCurrentScene()
|
|
116 |
{
|
|
117 |
try {
|
|
118 |
mSceneModeStore->setCurrentScene(Cxe::ImageMode, Cxe::IMAGE_SCENE_NIGHT);
|
|
119 |
}
|
|
120 |
catch (CxeException exception){
|
|
121 |
QString message = "Exception thrown, error id = ";
|
|
122 |
message.append(exception.error());
|
|
123 |
QFAIL(message.toAscii());
|
|
124 |
}
|
|
125 |
QString scene = mSceneModeStore->currentSceneId(Cxe::ImageMode);
|
|
126 |
QVERIFY(scene == Cxe::IMAGE_SCENE_NIGHT);
|
|
127 |
|
|
128 |
mSceneModeStore->setCurrentScene(Cxe::VideoMode, Cxe::VIDEO_SCENE_LOWLIGHT);
|
|
129 |
scene = mSceneModeStore->currentSceneId(Cxe::VideoMode);
|
|
130 |
QVERIFY(scene == Cxe::VIDEO_SCENE_LOWLIGHT);
|
|
131 |
}
|
|
132 |
|
|
133 |
void UnitTestCxeSceneModeStore::testSetSceneSettingValue()
|
|
134 |
{
|
|
135 |
CxeError::Id err = mSceneModeStore->setSceneSettingValue(Cxe::ImageMode, CxeSettingIds::SHARPNESS,
|
|
136 |
Cxe::SharpnessHard);
|
|
137 |
QCOMPARE(err, CxeError::None);
|
|
138 |
|
|
139 |
err = mSceneModeStore->setSceneSettingValue(Cxe::ImageMode, FAIL_TEST_SETTING,
|
|
140 |
Cxe::SharpnessHard);
|
|
141 |
QCOMPARE(err, CxeError::NotFound);
|
|
142 |
|
|
143 |
}
|
|
144 |
|
|
145 |
QTEST_MAIN(UnitTestCxeSceneModeStore);
|
|
146 |
|