sl@0
|
1 |
|
sl@0
|
2 |
// ECamPresetsTest.cpp
|
sl@0
|
3 |
|
sl@0
|
4 |
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
5 |
// All rights reserved.
|
sl@0
|
6 |
// This component and the accompanying materials are made available
|
sl@0
|
7 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
8 |
// which accompanies this distribution, and is available
|
sl@0
|
9 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Initial Contributors:
|
sl@0
|
12 |
// Nokia Corporation - initial contribution.
|
sl@0
|
13 |
//
|
sl@0
|
14 |
// Contributors:
|
sl@0
|
15 |
//
|
sl@0
|
16 |
// Description:
|
sl@0
|
17 |
//
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <ecamuids.hrh>
|
sl@0
|
20 |
#include <ecom/ecomresolverparams.h>
|
sl@0
|
21 |
#include "ECamPresetsTest.h"
|
sl@0
|
22 |
#include "ECamUnitTestPluginUids.hrh"
|
sl@0
|
23 |
#include "ECamUnitTestPlugin.h"
|
sl@0
|
24 |
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
|
sl@0
|
25 |
#include <ecamadvsettingsuidsconst.hrh>
|
sl@0
|
26 |
#include <ecamadvsettingsconst.h>
|
sl@0
|
27 |
#include <ecamimageprocessingconst.h>
|
sl@0
|
28 |
#endif
|
sl@0
|
29 |
//
|
sl@0
|
30 |
// RECamPresetsTest
|
sl@0
|
31 |
//
|
sl@0
|
32 |
RECamPresetsTest* RECamPresetsTest::NewL(TBool aAllocTest)
|
sl@0
|
33 |
{
|
sl@0
|
34 |
RECamPresetsTest* self = new (ELeave) RECamPresetsTest(aAllocTest);
|
sl@0
|
35 |
return self;
|
sl@0
|
36 |
}
|
sl@0
|
37 |
|
sl@0
|
38 |
RECamPresetsTest::RECamPresetsTest(TBool /*aAllocTest*/)
|
sl@0
|
39 |
{
|
sl@0
|
40 |
iTestStepName = _L("MM-ECM-ADV-U-006-HP");
|
sl@0
|
41 |
}
|
sl@0
|
42 |
|
sl@0
|
43 |
TVerdict RECamPresetsTest::DoTestStepL()
|
sl@0
|
44 |
{
|
sl@0
|
45 |
TVerdict verdict = EFail;
|
sl@0
|
46 |
INFO_PRINTF1(_L("Alloc test"));
|
sl@0
|
47 |
TInt i;
|
sl@0
|
48 |
TInt err;
|
sl@0
|
49 |
for (i = 1 ; ; i++)
|
sl@0
|
50 |
{
|
sl@0
|
51 |
__MM_HEAP_MARK;
|
sl@0
|
52 |
|
sl@0
|
53 |
if (i % 5 == 0)
|
sl@0
|
54 |
{
|
sl@0
|
55 |
INFO_PRINTF2(_L("Fail count = %d"), i);
|
sl@0
|
56 |
}
|
sl@0
|
57 |
|
sl@0
|
58 |
__UHEAP_SETFAIL(RHeap::EFailNext, i);
|
sl@0
|
59 |
|
sl@0
|
60 |
TRAP(err, verdict = DoPresetsTestStepL());
|
sl@0
|
61 |
|
sl@0
|
62 |
TAny* testAlloc = User::Alloc(1);
|
sl@0
|
63 |
TBool heapTestingComplete = (testAlloc == NULL) && (err==KErrNone);
|
sl@0
|
64 |
User::Free(testAlloc);
|
sl@0
|
65 |
|
sl@0
|
66 |
__UHEAP_RESET;
|
sl@0
|
67 |
__MM_HEAP_MARKEND;
|
sl@0
|
68 |
|
sl@0
|
69 |
if ((err != KErrNoMemory ) || heapTestingComplete)
|
sl@0
|
70 |
{
|
sl@0
|
71 |
INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
|
sl@0
|
72 |
INFO_PRINTF1(_L("Alloc testing completed successfully"));
|
sl@0
|
73 |
verdict = EPass;
|
sl@0
|
74 |
break;
|
sl@0
|
75 |
}
|
sl@0
|
76 |
}
|
sl@0
|
77 |
return verdict;
|
sl@0
|
78 |
}
|
sl@0
|
79 |
|
sl@0
|
80 |
TVerdict RECamPresetsTest::DoPresetsTestStepL()
|
sl@0
|
81 |
{
|
sl@0
|
82 |
TVerdict result = EPass;
|
sl@0
|
83 |
CCamera* camera = NULL;
|
sl@0
|
84 |
|
sl@0
|
85 |
TInt error = KErrNone;
|
sl@0
|
86 |
CCamera::CCameraPresets* presets = NULL;
|
sl@0
|
87 |
|
sl@0
|
88 |
// using observer 2
|
sl@0
|
89 |
MCameraObserver2* observer2 = NULL;
|
sl@0
|
90 |
|
sl@0
|
91 |
__MM_HEAP_MARK;
|
sl@0
|
92 |
INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
|
sl@0
|
93 |
|
sl@0
|
94 |
TRAP(error, camera = CCamera::New2L(*observer2, 0,0));
|
sl@0
|
95 |
|
sl@0
|
96 |
if (error==KErrNone)
|
sl@0
|
97 |
{
|
sl@0
|
98 |
CleanupStack::PushL(camera);
|
sl@0
|
99 |
INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
|
sl@0
|
100 |
presets = static_cast<CCamera::CCameraPresets*> (camera->CustomInterface(KECamPresetsUid));
|
sl@0
|
101 |
if (presets!= NULL)
|
sl@0
|
102 |
{
|
sl@0
|
103 |
CleanupStack::PushL(presets);
|
sl@0
|
104 |
INFO_PRINTF1(_L("CCameraPresets object was created"));
|
sl@0
|
105 |
CleanupStack::PopAndDestroy(presets);
|
sl@0
|
106 |
}
|
sl@0
|
107 |
else
|
sl@0
|
108 |
{
|
sl@0
|
109 |
result = EFail;
|
sl@0
|
110 |
User::Leave(KErrNoMemory);
|
sl@0
|
111 |
}
|
sl@0
|
112 |
CleanupStack::PopAndDestroy(camera);
|
sl@0
|
113 |
}
|
sl@0
|
114 |
else
|
sl@0
|
115 |
{
|
sl@0
|
116 |
INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
|
sl@0
|
117 |
result = EFail;
|
sl@0
|
118 |
User::Leave(KErrNoMemory);
|
sl@0
|
119 |
}
|
sl@0
|
120 |
__MM_HEAP_MARKEND;
|
sl@0
|
121 |
|
sl@0
|
122 |
// create a presets object using NewL
|
sl@0
|
123 |
__MM_HEAP_MARK;
|
sl@0
|
124 |
INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver2"));
|
sl@0
|
125 |
|
sl@0
|
126 |
TRAP(error, camera = CCamera::New2L(*observer2, 0,0));
|
sl@0
|
127 |
|
sl@0
|
128 |
if (error==KErrNone)
|
sl@0
|
129 |
{
|
sl@0
|
130 |
CleanupStack::PushL(camera);
|
sl@0
|
131 |
INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
|
sl@0
|
132 |
TRAP(error, presets = CCamera::CCameraPresets::NewL(*camera));
|
sl@0
|
133 |
|
sl@0
|
134 |
if (error==KErrNone)
|
sl@0
|
135 |
{
|
sl@0
|
136 |
CleanupStack::PushL(presets);
|
sl@0
|
137 |
INFO_PRINTF1(_L("CCameraPresets object was created using NewL"));
|
sl@0
|
138 |
CleanupStack::PopAndDestroy(presets);
|
sl@0
|
139 |
}
|
sl@0
|
140 |
else
|
sl@0
|
141 |
{
|
sl@0
|
142 |
INFO_PRINTF1(_L("CCameraPresets object was not created using NewL"));
|
sl@0
|
143 |
result = EFail;
|
sl@0
|
144 |
User::Leave(KErrNoMemory);
|
sl@0
|
145 |
}
|
sl@0
|
146 |
CleanupStack::PopAndDestroy(camera);
|
sl@0
|
147 |
}
|
sl@0
|
148 |
else
|
sl@0
|
149 |
{
|
sl@0
|
150 |
INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
|
sl@0
|
151 |
result = EFail;
|
sl@0
|
152 |
User::Leave(KErrNoMemory);
|
sl@0
|
153 |
}
|
sl@0
|
154 |
__MM_HEAP_MARKEND;
|
sl@0
|
155 |
|
sl@0
|
156 |
return result;
|
sl@0
|
157 |
}
|
sl@0
|
158 |
|
sl@0
|
159 |
//
|
sl@0
|
160 |
// RECamPresetsNotificationTest
|
sl@0
|
161 |
//
|
sl@0
|
162 |
RECamPresetsNotificationTest* RECamPresetsNotificationTest::NewL(TBool aAllocTest)
|
sl@0
|
163 |
{
|
sl@0
|
164 |
RECamPresetsNotificationTest* self = new (ELeave) RECamPresetsNotificationTest(aAllocTest);
|
sl@0
|
165 |
CleanupStack::PushL(self);
|
sl@0
|
166 |
self->ConstructL();
|
sl@0
|
167 |
CleanupStack::Pop(self);
|
sl@0
|
168 |
return self;
|
sl@0
|
169 |
}
|
sl@0
|
170 |
|
sl@0
|
171 |
void RECamPresetsNotificationTest::ConstructL()
|
sl@0
|
172 |
{
|
sl@0
|
173 |
iOriginalSet.Reset();
|
sl@0
|
174 |
iResultSet.Reset();
|
sl@0
|
175 |
|
sl@0
|
176 |
}
|
sl@0
|
177 |
RECamPresetsNotificationTest::RECamPresetsNotificationTest(TBool /*aAllocTest*/)
|
sl@0
|
178 |
{
|
sl@0
|
179 |
iTestStepName = _L("MM-ECM-ADV-U-008-HP");
|
sl@0
|
180 |
}
|
sl@0
|
181 |
|
sl@0
|
182 |
TVerdict RECamPresetsNotificationTest::DoTestStepL()
|
sl@0
|
183 |
{
|
sl@0
|
184 |
TVerdict result = EPass;
|
sl@0
|
185 |
CCamera* camera = NULL;
|
sl@0
|
186 |
|
sl@0
|
187 |
TInt error = KErrNone;
|
sl@0
|
188 |
CCamera::CCameraPresets* presets = NULL;
|
sl@0
|
189 |
|
sl@0
|
190 |
__MM_HEAP_MARK;
|
sl@0
|
191 |
INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
|
sl@0
|
192 |
|
sl@0
|
193 |
TRAP(error, camera = CCamera::New2L(*this,0,0));
|
sl@0
|
194 |
|
sl@0
|
195 |
if (error==KErrNone)
|
sl@0
|
196 |
{
|
sl@0
|
197 |
CleanupStack::PushL(camera);
|
sl@0
|
198 |
// CCamUnitTestPlugin* camera1 = static_cast<CCamUnitTestPlugin*>(camera);
|
sl@0
|
199 |
// rely on public member, done for simplfication of an external
|
sl@0
|
200 |
// initialization as it is the simplest way
|
sl@0
|
201 |
// camera1->iPresets = iOriginalSet;
|
sl@0
|
202 |
INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
|
sl@0
|
203 |
presets = static_cast<CCamera::CCameraPresets*> (camera->CustomInterface(KECamPresetsUid));
|
sl@0
|
204 |
if (presets!= NULL)
|
sl@0
|
205 |
{
|
sl@0
|
206 |
CleanupStack::PushL(presets);
|
sl@0
|
207 |
|
sl@0
|
208 |
// get the supported set of values
|
sl@0
|
209 |
presets->GetSupportedPresetsL(iResultSet);
|
sl@0
|
210 |
|
sl@0
|
211 |
//verify that the input and output are the same
|
sl@0
|
212 |
INFO_PRINTF2(_L("camera supports %d presets"), iResultSet.Count());
|
sl@0
|
213 |
|
sl@0
|
214 |
// the array should not be empty
|
sl@0
|
215 |
if (iResultSet.Count()==0)
|
sl@0
|
216 |
{
|
sl@0
|
217 |
result = EFail;
|
sl@0
|
218 |
}
|
sl@0
|
219 |
else
|
sl@0
|
220 |
{
|
sl@0
|
221 |
iResultSet.Reset();
|
sl@0
|
222 |
}
|
sl@0
|
223 |
|
sl@0
|
224 |
INFO_PRINTF1(_L("Current preset shall be KUidECamPresetNone"));
|
sl@0
|
225 |
TUid currentPreset = presets->Preset();
|
sl@0
|
226 |
|
sl@0
|
227 |
// Current Preset shall be KUidECamPresetNone.
|
sl@0
|
228 |
if(currentPreset.iUid != KUidECamPresetNoneUidValue)
|
sl@0
|
229 |
{
|
sl@0
|
230 |
INFO_PRINTF1(_L("Current preset wrongly set"));
|
sl@0
|
231 |
result = EFail;
|
sl@0
|
232 |
}
|
sl@0
|
233 |
|
sl@0
|
234 |
// set new value
|
sl@0
|
235 |
iInputEventUid = KUidECamPresetBeach;
|
sl@0
|
236 |
INFO_PRINTF2(_L("Select a new preset %d"), iInputEventUid.iUid);
|
sl@0
|
237 |
presets->SetPreset(iInputEventUid);
|
sl@0
|
238 |
|
sl@0
|
239 |
CheckNotification(iInputEventUid, result);
|
sl@0
|
240 |
|
sl@0
|
241 |
presets->GetAffectedSettingsL(iResultSet);
|
sl@0
|
242 |
INFO_PRINTF2(_L("This preset affected %d settings"), iResultSet.Count());
|
sl@0
|
243 |
|
sl@0
|
244 |
// get the alternative function
|
sl@0
|
245 |
RArray<TUid> associatedSettings;
|
sl@0
|
246 |
CleanupClosePushL(associatedSettings);
|
sl@0
|
247 |
associatedSettings.Reset();
|
sl@0
|
248 |
INFO_PRINTF1(_L("Get associated settings for the selected preset"));
|
sl@0
|
249 |
TRAP(error,presets->GetAssociatedSettingsL(iInputEventUid, associatedSettings));
|
sl@0
|
250 |
if(error != KErrNone)
|
sl@0
|
251 |
{
|
sl@0
|
252 |
CleanupStack::PopAndDestroy(&associatedSettings);
|
sl@0
|
253 |
}
|
sl@0
|
254 |
|
sl@0
|
255 |
if (iResultSet.Count()!=associatedSettings.Count())
|
sl@0
|
256 |
{
|
sl@0
|
257 |
result = EFail;
|
sl@0
|
258 |
}
|
sl@0
|
259 |
else
|
sl@0
|
260 |
{
|
sl@0
|
261 |
iResultSet.Reset();
|
sl@0
|
262 |
}
|
sl@0
|
263 |
CleanupStack::PopAndDestroy(&associatedSettings);
|
sl@0
|
264 |
|
sl@0
|
265 |
// set KUidECamPresetOutdoor to get range restricted settings.
|
sl@0
|
266 |
iInputEventUid = KUidECamPresetOutdoor;
|
sl@0
|
267 |
INFO_PRINTF2(_L("Select the Outdoor preset %d"), iInputEventUid.iUid);
|
sl@0
|
268 |
presets->SetPreset(iInputEventUid);
|
sl@0
|
269 |
|
sl@0
|
270 |
INFO_PRINTF1(_L("Check the RangeRestricted notification"));
|
sl@0
|
271 |
CheckNotification(KUidECamEventRangeRestricted, result);
|
sl@0
|
272 |
|
sl@0
|
273 |
if(result != EFail)
|
sl@0
|
274 |
{
|
sl@0
|
275 |
INFO_PRINTF1(_L("Retrieve the RangeRestricted settings"));
|
sl@0
|
276 |
// get the range restricted settings
|
sl@0
|
277 |
RArray<TUid> rangeRestrictedSettings;
|
sl@0
|
278 |
presets->GetRangeRestrictedSettingsL(rangeRestrictedSettings);
|
sl@0
|
279 |
if (rangeRestrictedSettings.Count() == 0)
|
sl@0
|
280 |
{
|
sl@0
|
281 |
INFO_PRINTF1(_L("RangeRestricted settings are Zero"));
|
sl@0
|
282 |
result = EFail;
|
sl@0
|
283 |
}
|
sl@0
|
284 |
rangeRestrictedSettings.Close();
|
sl@0
|
285 |
}
|
sl@0
|
286 |
|
sl@0
|
287 |
INFO_PRINTF1(_L("Check the FeatureRestricted settings"));
|
sl@0
|
288 |
// get the feature restricted settings
|
sl@0
|
289 |
RArray<TUid> featureRestrictedSettings;
|
sl@0
|
290 |
presets->GetFeatureRestrictedSettingsL(featureRestrictedSettings);
|
sl@0
|
291 |
if (featureRestrictedSettings.Count() != 0)
|
sl@0
|
292 |
{
|
sl@0
|
293 |
INFO_PRINTF1(_L("FeatureRestricted settings are not Zero"));
|
sl@0
|
294 |
result = EFail;
|
sl@0
|
295 |
}
|
sl@0
|
296 |
featureRestrictedSettings.Close();
|
sl@0
|
297 |
|
sl@0
|
298 |
TBool unlockSupported = EFalse;
|
sl@0
|
299 |
presets->IsPresetUnlockSupportedL(unlockSupported);
|
sl@0
|
300 |
if(!unlockSupported)
|
sl@0
|
301 |
{
|
sl@0
|
302 |
INFO_PRINTF1(_L("Preset Unlock not supported"));
|
sl@0
|
303 |
result = EFail;
|
sl@0
|
304 |
}
|
sl@0
|
305 |
|
sl@0
|
306 |
INFO_PRINTF1(_L("Unlock Preset"));
|
sl@0
|
307 |
presets->UnlockPresetL();
|
sl@0
|
308 |
CheckNotification(KUidECamEventPresetUnlocked, result);
|
sl@0
|
309 |
|
sl@0
|
310 |
INFO_PRINTF1(_L("Lock Preset"));
|
sl@0
|
311 |
presets->LockPresetL();
|
sl@0
|
312 |
CheckNotification(KUidECamEventPresetLocked, result);
|
sl@0
|
313 |
|
sl@0
|
314 |
CleanupStack::PopAndDestroy(presets);
|
sl@0
|
315 |
}
|
sl@0
|
316 |
else
|
sl@0
|
317 |
{
|
sl@0
|
318 |
result = EFail;
|
sl@0
|
319 |
User::Leave(KErrNoMemory);
|
sl@0
|
320 |
}
|
sl@0
|
321 |
|
sl@0
|
322 |
CleanupStack::PopAndDestroy(camera);
|
sl@0
|
323 |
}
|
sl@0
|
324 |
else
|
sl@0
|
325 |
{
|
sl@0
|
326 |
INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
|
sl@0
|
327 |
result = EFail;
|
sl@0
|
328 |
User::Leave(KErrNoMemory);
|
sl@0
|
329 |
}
|
sl@0
|
330 |
|
sl@0
|
331 |
__MM_HEAP_MARKEND;
|
sl@0
|
332 |
|
sl@0
|
333 |
return result;
|
sl@0
|
334 |
}
|
sl@0
|
335 |
|
sl@0
|
336 |
//
|
sl@0
|
337 |
// RECamPresetsNegTest //
|
sl@0
|
338 |
//
|
sl@0
|
339 |
RECamPresetsNegTest* RECamPresetsNegTest::NewL(TBool aAllocTest)
|
sl@0
|
340 |
{
|
sl@0
|
341 |
RECamPresetsNegTest* self = new (ELeave) RECamPresetsNegTest(aAllocTest);
|
sl@0
|
342 |
return self;
|
sl@0
|
343 |
}
|
sl@0
|
344 |
|
sl@0
|
345 |
RECamPresetsNegTest::RECamPresetsNegTest(TBool /*aAllocTest*/)
|
sl@0
|
346 |
{
|
sl@0
|
347 |
iTestStepName = _L("MM-ECM-ADV-U-0101-HP");
|
sl@0
|
348 |
}
|
sl@0
|
349 |
|
sl@0
|
350 |
TVerdict RECamPresetsNegTest::DoTestStepL()
|
sl@0
|
351 |
{
|
sl@0
|
352 |
TVerdict result = EPass;
|
sl@0
|
353 |
CCamera* camera = NULL;
|
sl@0
|
354 |
|
sl@0
|
355 |
TInt error = KErrNone;
|
sl@0
|
356 |
CCamera::CCameraPresets* presets = NULL;
|
sl@0
|
357 |
|
sl@0
|
358 |
__MM_HEAP_MARK;
|
sl@0
|
359 |
|
sl@0
|
360 |
INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
|
sl@0
|
361 |
|
sl@0
|
362 |
TRAP(error, camera = CCamera::New2L(*this,0,0));
|
sl@0
|
363 |
|
sl@0
|
364 |
if (error==KErrNone)
|
sl@0
|
365 |
{
|
sl@0
|
366 |
CleanupStack::PushL(camera);
|
sl@0
|
367 |
INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
|
sl@0
|
368 |
presets = static_cast<CCamera::CCameraPresets*> (camera->CustomInterface(KECamPresetsUid));
|
sl@0
|
369 |
if (presets!= NULL)
|
sl@0
|
370 |
{
|
sl@0
|
371 |
CleanupStack::PushL(presets);
|
sl@0
|
372 |
|
sl@0
|
373 |
TUid aCurrentPreset = presets->Preset();
|
sl@0
|
374 |
// get the current value
|
sl@0
|
375 |
INFO_PRINTF2(_L("Current preset %x"), aCurrentPreset.iUid);
|
sl@0
|
376 |
|
sl@0
|
377 |
// get the supported set of values
|
sl@0
|
378 |
RArray<TUid> aResultSet;
|
sl@0
|
379 |
CleanupClosePushL(aResultSet);
|
sl@0
|
380 |
aResultSet.Reset();
|
sl@0
|
381 |
presets->GetSupportedPresetsL(aResultSet);
|
sl@0
|
382 |
|
sl@0
|
383 |
// Setting a non supported preset should be rejected
|
sl@0
|
384 |
// In the test plugin only KUidECamPresetOutdoor, KUidECamPresetNightPartyIndoor & KUidECamPresetBeach are supported
|
sl@0
|
385 |
iInputEventUid = KUidECamPresetIndoorSport;
|
sl@0
|
386 |
presets->SetPreset(iInputEventUid);
|
sl@0
|
387 |
|
sl@0
|
388 |
CheckNotificationNeg(iInputEventUid, result);
|
sl@0
|
389 |
|
sl@0
|
390 |
// Setting a non supported preset should be rejected
|
sl@0
|
391 |
// In the test plugin only KUidECamPresetOutdoor, KUidECamPresetNightPartyIndoor & KUidECamPresetBeach are supported
|
sl@0
|
392 |
iInputEventUid = KUidECamPresetVideoTelephony;
|
sl@0
|
393 |
presets->SetPreset(iInputEventUid);
|
sl@0
|
394 |
|
sl@0
|
395 |
CheckNotificationNeg(iInputEventUid, result);
|
sl@0
|
396 |
|
sl@0
|
397 |
TUid aGetPreset = presets->Preset();
|
sl@0
|
398 |
|
sl@0
|
399 |
if ((aCurrentPreset == aGetPreset) && (aGetPreset == KUidECamPresetNone))
|
sl@0
|
400 |
{
|
sl@0
|
401 |
INFO_PRINTF2(_L("Current preset has not changed %x"), aGetPreset.iUid);
|
sl@0
|
402 |
}
|
sl@0
|
403 |
else
|
sl@0
|
404 |
{
|
sl@0
|
405 |
INFO_PRINTF1(_L("Expected no affected settings"));
|
sl@0
|
406 |
result = EFail;
|
sl@0
|
407 |
}
|
sl@0
|
408 |
|
sl@0
|
409 |
// get the affected settings
|
sl@0
|
410 |
RArray<TUid> aAffectedSet;
|
sl@0
|
411 |
CleanupClosePushL(aAffectedSet);
|
sl@0
|
412 |
presets->GetAffectedSettingsL(aAffectedSet);
|
sl@0
|
413 |
// the list of affected settings should be empty
|
sl@0
|
414 |
if (aAffectedSet.Count()!=0)
|
sl@0
|
415 |
{
|
sl@0
|
416 |
INFO_PRINTF1(_L("Expected no affected settings"));
|
sl@0
|
417 |
result = EFail;
|
sl@0
|
418 |
}
|
sl@0
|
419 |
else
|
sl@0
|
420 |
{
|
sl@0
|
421 |
INFO_PRINTF1(_L("No affected settings"));
|
sl@0
|
422 |
}
|
sl@0
|
423 |
|
sl@0
|
424 |
CleanupStack::PopAndDestroy(2, &aResultSet); //aAffectedSet
|
sl@0
|
425 |
|
sl@0
|
426 |
CleanupStack::PopAndDestroy(presets);
|
sl@0
|
427 |
}
|
sl@0
|
428 |
else // preset is NULL
|
sl@0
|
429 |
{
|
sl@0
|
430 |
result = EFail;
|
sl@0
|
431 |
}
|
sl@0
|
432 |
CleanupStack::PopAndDestroy(camera);
|
sl@0
|
433 |
}
|
sl@0
|
434 |
else // error != KErrNone
|
sl@0
|
435 |
{
|
sl@0
|
436 |
INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
|
sl@0
|
437 |
result = EFail;
|
sl@0
|
438 |
}
|
sl@0
|
439 |
__MM_HEAP_MARKEND;
|
sl@0
|
440 |
|
sl@0
|
441 |
return result;
|
sl@0
|
442 |
}
|
sl@0
|
443 |
|
sl@0
|
444 |
//
|
sl@0
|
445 |
// RECamPresetsBaselineTest
|
sl@0
|
446 |
//
|
sl@0
|
447 |
RECamPresetsBaselineTest* RECamPresetsBaselineTest::NewL(TBool aAllocTest)
|
sl@0
|
448 |
{
|
sl@0
|
449 |
RECamPresetsBaselineTest* self = new (ELeave) RECamPresetsBaselineTest(aAllocTest);
|
sl@0
|
450 |
CleanupStack::PushL(self);
|
sl@0
|
451 |
self->ConstructL();
|
sl@0
|
452 |
CleanupStack::Pop(self);
|
sl@0
|
453 |
return self;
|
sl@0
|
454 |
}
|
sl@0
|
455 |
|
sl@0
|
456 |
void RECamPresetsBaselineTest::ConstructL()
|
sl@0
|
457 |
{
|
sl@0
|
458 |
iOriginalSet.Reset();
|
sl@0
|
459 |
iResultSet.Reset();
|
sl@0
|
460 |
|
sl@0
|
461 |
}
|
sl@0
|
462 |
RECamPresetsBaselineTest::RECamPresetsBaselineTest(TBool /*aAllocTest*/)
|
sl@0
|
463 |
{
|
sl@0
|
464 |
iTestStepName = _L("MM-ECM-ADV-U-046-HP");
|
sl@0
|
465 |
}
|
sl@0
|
466 |
|
sl@0
|
467 |
TVerdict RECamPresetsBaselineTest::DoTestStepL()
|
sl@0
|
468 |
{
|
sl@0
|
469 |
TVerdict result = EPass;
|
sl@0
|
470 |
CCamera* camera = NULL;
|
sl@0
|
471 |
|
sl@0
|
472 |
TInt error = KErrNone;
|
sl@0
|
473 |
CCamera::CCameraPresets* presets = NULL;
|
sl@0
|
474 |
|
sl@0
|
475 |
__MM_HEAP_MARK;
|
sl@0
|
476 |
INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver2"));
|
sl@0
|
477 |
|
sl@0
|
478 |
TRAP(error, camera = CCamera::NewL(*this,0,0));
|
sl@0
|
479 |
|
sl@0
|
480 |
if (error==KErrNone)
|
sl@0
|
481 |
{
|
sl@0
|
482 |
CleanupStack::PushL(camera);
|
sl@0
|
483 |
// CCamUnitTestPlugin* camera1 = static_cast<CCamUnitTestPlugin*>(camera);
|
sl@0
|
484 |
// rely on public member, done for simplfication of an external
|
sl@0
|
485 |
// initialization as it is the simplest way
|
sl@0
|
486 |
// camera1->iPresets = iOriginalSet;
|
sl@0
|
487 |
INFO_PRINTF1(_L("KErrNone return from CCamera::NewL()"));
|
sl@0
|
488 |
presets = static_cast<CCamera::CCameraPresets*> (camera->CustomInterface(KECamPresetsUid));
|
sl@0
|
489 |
if (presets!= NULL)
|
sl@0
|
490 |
{
|
sl@0
|
491 |
CleanupStack::PushL(presets);
|
sl@0
|
492 |
|
sl@0
|
493 |
// get the supported set of values
|
sl@0
|
494 |
presets->GetSupportedPresetsL(iResultSet);
|
sl@0
|
495 |
|
sl@0
|
496 |
//verify that the input and output are the same
|
sl@0
|
497 |
INFO_PRINTF2(_L("camera supports %d presets"), iResultSet.Count());
|
sl@0
|
498 |
|
sl@0
|
499 |
// the array should not contain any unfamiliar uid for preset(after baseline)
|
sl@0
|
500 |
for(TInt index =0; index < iResultSet.Count(); index++)
|
sl@0
|
501 |
{
|
sl@0
|
502 |
/** KUidECamPresetFactoryDefaultUidValue is the baseline. Any preset with greater uid value means that it has
|
sl@0
|
503 |
been added in later versions */
|
sl@0
|
504 |
if(iResultSet[index].iUid > KUidECamPresetFactoryDefaultUidValue)
|
sl@0
|
505 |
{
|
sl@0
|
506 |
result = EFail;
|
sl@0
|
507 |
}
|
sl@0
|
508 |
}
|
sl@0
|
509 |
|
sl@0
|
510 |
iResultSet.Reset();
|
sl@0
|
511 |
|
sl@0
|
512 |
presets->Preset();
|
sl@0
|
513 |
// set new unfamiliar value
|
sl@0
|
514 |
iInputEventUid = KUidECamPresetNightPartyIndoor;
|
sl@0
|
515 |
INFO_PRINTF2(_L("Select a new preset %d"), iInputEventUid.iUid);
|
sl@0
|
516 |
presets->SetPreset(iInputEventUid);
|
sl@0
|
517 |
|
sl@0
|
518 |
CheckNotification(iInputEventUid, result);
|
sl@0
|
519 |
|
sl@0
|
520 |
if(presets->Preset().iUid != KUidECamPresetFactoryDefaultUidValue)
|
sl@0
|
521 |
{
|
sl@0
|
522 |
result = EFail;
|
sl@0
|
523 |
}
|
sl@0
|
524 |
|
sl@0
|
525 |
presets->GetAffectedSettingsL(iResultSet);
|
sl@0
|
526 |
INFO_PRINTF2(_L("This preset affected %d settings"), iResultSet.Count());
|
sl@0
|
527 |
|
sl@0
|
528 |
// the array should not contain any unfamiliar uid for settings(after baseline)
|
sl@0
|
529 |
for(TInt index =0; index < iResultSet.Count(); index++)
|
sl@0
|
530 |
{
|
sl@0
|
531 |
/** KUidECamEventCameraSettingAutoFocusType2UidValue is the baseline. Any settings with greater uid value means that it has
|
sl@0
|
532 |
been added in later versions */
|
sl@0
|
533 |
if(iResultSet[index].iUid > KUidECamEventCameraSettingAutoFocusType2UidValue)
|
sl@0
|
534 |
{
|
sl@0
|
535 |
result = EFail;
|
sl@0
|
536 |
}
|
sl@0
|
537 |
}
|
sl@0
|
538 |
|
sl@0
|
539 |
// get the alternative function
|
sl@0
|
540 |
RArray<TUid> associatedSettings;
|
sl@0
|
541 |
|
sl@0
|
542 |
presets->GetAssociatedSettingsL(iInputEventUid, associatedSettings);
|
sl@0
|
543 |
|
sl@0
|
544 |
if (iResultSet.Count()!=associatedSettings.Count())
|
sl@0
|
545 |
{
|
sl@0
|
546 |
result = EFail;
|
sl@0
|
547 |
}
|
sl@0
|
548 |
else
|
sl@0
|
549 |
{
|
sl@0
|
550 |
iResultSet.Reset();
|
sl@0
|
551 |
}
|
sl@0
|
552 |
associatedSettings.Close();
|
sl@0
|
553 |
CleanupStack::PopAndDestroy(presets);
|
sl@0
|
554 |
}
|
sl@0
|
555 |
else
|
sl@0
|
556 |
{
|
sl@0
|
557 |
result = EFail;
|
sl@0
|
558 |
}
|
sl@0
|
559 |
CleanupStack::PopAndDestroy(camera);
|
sl@0
|
560 |
}
|
sl@0
|
561 |
else
|
sl@0
|
562 |
{
|
sl@0
|
563 |
INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL(): observer 2"), error);
|
sl@0
|
564 |
result = EFail;
|
sl@0
|
565 |
}
|
sl@0
|
566 |
|
sl@0
|
567 |
__MM_HEAP_MARKEND;
|
sl@0
|
568 |
|
sl@0
|
569 |
return result;
|
sl@0
|
570 |
}
|