author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 15 Sep 2010 12:09:15 +0300 | |
branch | RCL_3 |
changeset 38 | ac48f0cc9f9c |
parent 33 | bc78a40cd63c |
child 41 | 755f0370535b |
permissions | -rw-r--r-- |
33 | 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 |
||
18 |
||
19 |
// INTERNAL INCLUDES |
|
20 |
#include "telephonyaudiorouting.h" |
|
21 |
#include "ut_musengsession.h" |
|
22 |
#include "musengstubs.h" |
|
23 |
#include "musengtestdefs.h" |
|
24 |
||
25 |
#include "musenglivesession.h" |
|
26 |
#include "musengtelephoneutils.h" |
|
27 |
#include "musengmceutils.h" |
|
28 |
||
29 |
// SYSTEM INCLUDES |
|
30 |
#include <digia/eunit/eunitmacros.h> |
|
31 |
#include <centralrepository.h> |
|
32 |
#include <mcedisplaysink.h> |
|
33 |
#include <e32property.h> |
|
34 |
#include <telephonydomainpskeys.h> |
|
35 |
||
36 |
||
37 |
||
38 |
// ----------------------------------------------------------------------------- |
|
39 |
// |
|
40 |
// ----------------------------------------------------------------------------- |
|
41 |
// |
|
42 |
UT_CMusEngSession* UT_CMusEngSession::NewL() |
|
43 |
{ |
|
44 |
UT_CMusEngSession* self = UT_CMusEngSession::NewLC(); |
|
45 |
CleanupStack::Pop( self ); |
|
46 |
return self; |
|
47 |
} |
|
48 |
||
49 |
||
50 |
// ----------------------------------------------------------------------------- |
|
51 |
// |
|
52 |
// ----------------------------------------------------------------------------- |
|
53 |
// |
|
54 |
UT_CMusEngSession* UT_CMusEngSession::NewLC() |
|
55 |
{ |
|
56 |
UT_CMusEngSession* self = new( ELeave ) UT_CMusEngSession(); |
|
57 |
CleanupStack::PushL( self ); |
|
58 |
self->ConstructL(); |
|
59 |
return self; |
|
60 |
} |
|
61 |
||
62 |
||
63 |
// ----------------------------------------------------------------------------- |
|
64 |
// |
|
65 |
// ----------------------------------------------------------------------------- |
|
66 |
// |
|
67 |
UT_CMusEngSession::~UT_CMusEngSession() |
|
68 |
{ |
|
69 |
// NOP |
|
70 |
} |
|
71 |
||
72 |
||
73 |
// ----------------------------------------------------------------------------- |
|
74 |
// Default constructor |
|
75 |
// ----------------------------------------------------------------------------- |
|
76 |
// |
|
77 |
UT_CMusEngSession::UT_CMusEngSession() |
|
78 |
:iLiveSession( NULL ), |
|
79 |
iObserver( NULL ) |
|
80 |
{ |
|
81 |
// NOP |
|
82 |
} |
|
83 |
||
84 |
||
85 |
// ----------------------------------------------------------------------------- |
|
86 |
// Second phase construct |
|
87 |
// ----------------------------------------------------------------------------- |
|
88 |
// |
|
89 |
void UT_CMusEngSession::ConstructL() |
|
90 |
{ |
|
91 |
// The ConstructL from the base class CEUnitTestSuiteClass must be called. |
|
92 |
// It generates the test case table. |
|
93 |
CEUnitTestSuiteClass::ConstructL(); |
|
94 |
} |
|
95 |
||
96 |
||
97 |
// ----------------------------------------------------------------------------- |
|
98 |
// |
|
99 |
// ----------------------------------------------------------------------------- |
|
100 |
// |
|
101 |
void UT_CMusEngSession::SetupL() |
|
102 |
{ |
|
103 |
iObserver = new( ELeave ) CMusEngObserverStub; |
|
104 |
iLiveSession = CMusEngLiveSession::NewL( KNullDesC(), |
|
105 |
TRect(0,0, 100,100), |
|
106 |
*iObserver, |
|
107 |
*iObserver, |
|
108 |
*iObserver ); |
|
109 |
} |
|
110 |
||
111 |
||
112 |
// ----------------------------------------------------------------------------- |
|
113 |
// |
|
114 |
// ----------------------------------------------------------------------------- |
|
115 |
// |
|
116 |
void UT_CMusEngSession::Teardown() |
|
117 |
{ |
|
118 |
delete iLiveSession; |
|
119 |
delete iObserver; |
|
120 |
} |
|
121 |
||
122 |
||
123 |
||
124 |
// TEST CASES |
|
125 |
||
126 |
||
127 |
||
128 |
||
129 |
||
130 |
// ----------------------------------------------------------------------------- |
|
131 |
// |
|
132 |
// ----------------------------------------------------------------------------- |
|
133 |
// |
|
134 |
void UT_CMusEngSession::UT_RectL() |
|
135 |
{ |
|
136 |
TRect rect = iLiveSession->Rect(); |
|
137 |
||
138 |
// Initial values |
|
139 |
EUNIT_ASSERT( rect.iTl.iX == 0 ); |
|
140 |
EUNIT_ASSERT( rect.iTl.iY == 0 ); |
|
141 |
EUNIT_ASSERT( rect.iBr.iX == 100 ); |
|
142 |
EUNIT_ASSERT( rect.iBr.iY == 100 ); |
|
143 |
||
144 |
iLiveSession->iRect.iTl.iX = 100; |
|
145 |
iLiveSession->iRect.iTl.iY = 200; |
|
146 |
iLiveSession->iRect.iBr.iX = 300; |
|
147 |
iLiveSession->iRect.iBr.iY = 400; |
|
148 |
||
149 |
rect = iLiveSession->Rect(); |
|
150 |
||
151 |
EUNIT_ASSERT( rect.iTl.iX == 100 ); |
|
152 |
EUNIT_ASSERT( rect.iTl.iY == 200 ); |
|
153 |
EUNIT_ASSERT( rect.iBr.iX == 300 ); |
|
154 |
EUNIT_ASSERT( rect.iBr.iY == 400 ); |
|
155 |
} |
|
156 |
||
157 |
||
158 |
// ----------------------------------------------------------------------------- |
|
159 |
// |
|
160 |
// ----------------------------------------------------------------------------- |
|
161 |
// |
|
162 |
void UT_CMusEngSession::UT_SetRectLL() |
|
163 |
{ |
|
164 |
TRect rect; |
|
165 |
||
166 |
rect.iTl.iX = 100; |
|
167 |
rect.iTl.iY = 200; |
|
168 |
rect.iBr.iX = 300; |
|
169 |
rect.iBr.iY = 400; |
|
170 |
||
171 |
iLiveSession->SetRectL( rect ); |
|
172 |
||
173 |
EUNIT_ASSERT( iLiveSession->iRect.iTl.iX == 100 ); |
|
174 |
EUNIT_ASSERT( iLiveSession->iRect.iTl.iY == 200 ); |
|
175 |
EUNIT_ASSERT( iLiveSession->iRect.iBr.iX == 300 ); |
|
176 |
EUNIT_ASSERT( iLiveSession->iRect.iBr.iY == 400 ); |
|
177 |
||
178 |
ESTABLISH_OUT_SESSION( iLiveSession ); |
|
179 |
||
180 |
CMceDisplaySink* display = |
|
181 |
MusEngMceUtils::GetDisplayL( *( iLiveSession->iSession ) ); |
|
182 |
||
183 |
TRect displayRect = display->DisplayRectL(); |
|
184 |
||
185 |
EUNIT_ASSERT( displayRect.iTl.iX == 100 ); |
|
186 |
EUNIT_ASSERT( displayRect.iTl.iY == 200 ); |
|
187 |
EUNIT_ASSERT( displayRect.iBr.iX == 300 ); |
|
188 |
EUNIT_ASSERT( displayRect.iBr.iY == 400 ); |
|
189 |
} |
|
190 |
||
191 |
||
192 |
// ----------------------------------------------------------------------------- |
|
193 |
// |
|
194 |
// ----------------------------------------------------------------------------- |
|
195 |
// |
|
196 |
void UT_CMusEngSession::UT_AudioRoutingCanBeChangedL() |
|
197 |
{ |
|
198 |
iLiveSession->iTelephoneUtils->iTelephonyAudioRouting->iCurrentOutput = |
|
199 |
CTelephonyAudioRouting::ELoudspeaker; |
|
200 |
EUNIT_ASSERT( iLiveSession->AudioRoutingCanBeChanged() ); |
|
201 |
||
202 |
iLiveSession->iTelephoneUtils->iTelephonyAudioRouting->iCurrentOutput = |
|
38
ac48f0cc9f9c
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
203 |
CTelephonyAudioRouting::ETTY; |
33 | 204 |
EUNIT_ASSERT( !iLiveSession->AudioRoutingCanBeChanged() ); |
205 |
} |
|
206 |
||
207 |
||
208 |
// ----------------------------------------------------------------------------- |
|
209 |
// |
|
210 |
// ----------------------------------------------------------------------------- |
|
211 |
// |
|
212 |
void UT_CMusEngSession::UT_IsAudioRoutingHeadsetL() |
|
213 |
{ |
|
214 |
iLiveSession->iTelephoneUtils->iTelephonyAudioRouting->iCurrentOutput = |
|
215 |
CTelephonyAudioRouting::EBTAudioAccessory; |
|
216 |
EUNIT_ASSERT( iLiveSession->IsAudioRoutingHeadset() ); |
|
217 |
||
218 |
iLiveSession->iTelephoneUtils->iTelephonyAudioRouting->iCurrentOutput = |
|
219 |
CTelephonyAudioRouting::ENotActive; |
|
220 |
EUNIT_ASSERT( !iLiveSession->IsAudioRoutingHeadset()); |
|
221 |
||
222 |
iLiveSession->iTelephoneUtils->iTelephonyAudioRouting->iCurrentOutput = |
|
223 |
CTelephonyAudioRouting::ENone; |
|
224 |
EUNIT_ASSERT( !iLiveSession->IsAudioRoutingHeadset()); |
|
225 |
||
226 |
iLiveSession->iTelephoneUtils->iTelephonyAudioRouting->iCurrentOutput = |
|
227 |
CTelephonyAudioRouting::EHandset; |
|
228 |
EUNIT_ASSERT( !iLiveSession->IsAudioRoutingHeadset()); |
|
229 |
||
230 |
iLiveSession->iTelephoneUtils->iTelephonyAudioRouting->iCurrentOutput = |
|
231 |
CTelephonyAudioRouting::ELoudspeaker; |
|
232 |
EUNIT_ASSERT( !iLiveSession->IsAudioRoutingHeadset()); |
|
233 |
||
234 |
iLiveSession->iTelephoneUtils->iTelephonyAudioRouting->iCurrentOutput = |
|
235 |
CTelephonyAudioRouting::EWiredAudioAccessory; |
|
236 |
EUNIT_ASSERT( iLiveSession->IsAudioRoutingHeadset()); |
|
237 |
||
238 |
iLiveSession->iTelephoneUtils->iTelephonyAudioRouting->iCurrentOutput = |
|
239 |
CTelephonyAudioRouting::ETTY; |
|
240 |
EUNIT_ASSERT( !iLiveSession->IsAudioRoutingHeadset()); |
|
241 |
||
242 |
} |
|
243 |
||
244 |
void UT_CMusEngSession::UT_IsAudioRoutingLoudSpeakerL() |
|
245 |
{ |
|
246 |
iLiveSession->iTelephoneUtils->iTelephonyAudioRouting->iCurrentOutput = |
|
247 |
CTelephonyAudioRouting::ELoudspeaker; |
|
248 |
iLiveSession->iTelephoneUtils->iAudioOutputAtStartup = |
|
249 |
CTelephonyAudioRouting::ELoudspeaker; |
|
250 |
EUNIT_ASSERT( !iLiveSession->IsAudioRoutingLoudSpeaker()); |
|
251 |
||
252 |
iLiveSession->iTelephoneUtils->iTelephonyAudioRouting->iCurrentOutput = |
|
253 |
CTelephonyAudioRouting::ELoudspeaker; |
|
254 |
iLiveSession->iTelephoneUtils->iAudioOutputAtStartup = |
|
255 |
CTelephonyAudioRouting::EHandset; |
|
256 |
EUNIT_ASSERT( iLiveSession->IsAudioRoutingLoudSpeaker() ); |
|
257 |
||
258 |
iLiveSession->iTelephoneUtils->iTelephonyAudioRouting->iCurrentOutput = |
|
259 |
CTelephonyAudioRouting::ELoudspeaker; |
|
260 |
iLiveSession->iTelephoneUtils->iAudioOutputAtStartup = |
|
261 |
CTelephonyAudioRouting::EBTAudioAccessory; |
|
262 |
EUNIT_ASSERT( iLiveSession->IsAudioRoutingLoudSpeaker() ); |
|
263 |
||
264 |
iLiveSession->iTelephoneUtils->iTelephonyAudioRouting->iCurrentOutput = |
|
265 |
CTelephonyAudioRouting::ELoudspeaker; |
|
266 |
iLiveSession->iTelephoneUtils->iAudioOutputAtStartup = |
|
267 |
CTelephonyAudioRouting::EWiredAudioAccessory; |
|
268 |
EUNIT_ASSERT( iLiveSession->IsAudioRoutingLoudSpeaker() ); |
|
269 |
} |
|
270 |
||
271 |
// ----------------------------------------------------------------------------- |
|
272 |
// |
|
273 |
// ----------------------------------------------------------------------------- |
|
274 |
// |
|
275 |
void UT_CMusEngSession::UT_EnableLoudspeakerLL() |
|
276 |
{ |
|
277 |
// Almost dummy case is enough, because IsLoudSpeakerEnabled forwards |
|
278 |
// requests to CMusEngTelephonyUtils and is tested there. So test only |
|
279 |
// fail handling |
|
280 |
iLiveSession->EnableLoudspeakerL( EFalse, EFalse ); |
|
281 |
||
282 |
CMusEngTelephoneUtils* telephone = iLiveSession->iTelephoneUtils; |
|
283 |
||
284 |
EUNIT_ASSERT( telephone->iTelephonyAudioRouting->iShowNoteMode == EFalse ); |
|
285 |
EUNIT_ASSERT( telephone->iTelephonyAudioRouting->iCurrentOutput != |
|
286 |
CTelephonyAudioRouting::ELoudspeaker ); |
|
287 |
||
288 |
telephone->iTelephonyAudioRouting->iForceFailWithCode = KErrNotSupported; |
|
289 |
||
290 |
//Must fail in HW, but not in emulator |
|
291 |
TRAPD( error, iLiveSession->EnableLoudspeakerL( ETrue, ETrue ) ); |
|
292 |
MUS_TEST_FORWARD_ALLOC_FAILURE( error ); |
|
293 |
||
294 |
#if (!defined (__WINS__) && !defined(__WINSCW__)) |
|
295 |
EUNIT_ASSERT( error == KErrNotSupported ); |
|
296 |
#else |
|
297 |
EUNIT_ASSERT( error == KErrNone ); |
|
298 |
#endif |
|
299 |
||
300 |
EUNIT_ASSERT( telephone->iTelephonyAudioRouting->iCurrentOutput != |
|
301 |
CTelephonyAudioRouting::ELoudspeaker ); |
|
302 |
||
303 |
telephone->iTelephonyAudioRouting->iForceFailWithCode = KErrGeneral; |
|
304 |
||
305 |
// Must fail in all cases |
|
306 |
TRAP( error, iLiveSession->EnableLoudspeakerL( EFalse, ETrue ) ); |
|
307 |
MUS_TEST_FORWARD_ALLOC_FAILURE( error ); |
|
308 |
EUNIT_ASSERT( error == KErrGeneral ); |
|
309 |
||
310 |
EUNIT_ASSERT( telephone->iTelephonyAudioRouting->iCurrentOutput != |
|
311 |
CTelephonyAudioRouting::ELoudspeaker ); |
|
312 |
||
313 |
||
314 |
} |
|
315 |
||
316 |
||
317 |
// ----------------------------------------------------------------------------- |
|
318 |
// |
|
319 |
// ----------------------------------------------------------------------------- |
|
320 |
// |
|
321 |
void UT_CMusEngSession::UT_IsLoudSpeakerEnabledL() |
|
322 |
{ |
|
323 |
// Dummy case is enough, because IsLoudSpeakerEnabled forwards requests |
|
324 |
// to CMusEngTelephonyUtils and is tested there. |
|
325 |
||
326 |
// By default loudspeaker is not enabled. |
|
327 |
EUNIT_ASSERT( !iLiveSession->IsLoudSpeakerEnabled() ); |
|
328 |
} |
|
329 |
||
330 |
||
331 |
// ----------------------------------------------------------------------------- |
|
332 |
// |
|
333 |
// ----------------------------------------------------------------------------- |
|
334 |
// |
|
335 |
void UT_CMusEngSession::UT_VolumeLL() |
|
336 |
{ |
|
337 |
// Dummy case is enough, because VolumeL forwards requests |
|
338 |
// to CMusEngTelephonyUtils and is tested there. |
|
339 |
||
340 |
iLiveSession->IsLoudSpeakerEnabled(); |
|
341 |
} |
|
342 |
||
343 |
||
344 |
// ----------------------------------------------------------------------------- |
|
345 |
// |
|
346 |
// ----------------------------------------------------------------------------- |
|
347 |
// |
|
348 |
void UT_CMusEngSession::UT_MuteMicLL() |
|
349 |
{ |
|
350 |
// Cannot test since EUnit notices some error leak if |
|
351 |
// the state of the mute is actually changed. Still, from MusEngine |
|
352 |
// point of view everything is done identically despite the fact if |
|
353 |
// real state changes or not. => Problem is in EUnit or leak happens |
|
354 |
// elsewhere. |
|
355 |
} |
|
356 |
||
357 |
||
358 |
// ----------------------------------------------------------------------------- |
|
359 |
// Almost a dummy test since we cannot write |
|
360 |
// ----------------------------------------------------------------------------- |
|
361 |
// |
|
362 |
void UT_CMusEngSession::UT_IsMicMutedLL() |
|
363 |
{ |
|
364 |
// Ignore error (KErrAlreadyExists etc), just make sure this property exists |
|
365 |
RProperty::Define( KPSUidTelMicrophoneMuteStatus, |
|
366 |
KTelMicrophoneMuteState, |
|
367 |
RProperty::EInt, |
|
368 |
0 ); |
|
369 |
||
370 |
User::LeaveIfError( RProperty::Set( KPSUidTelMicrophoneMuteStatus, |
|
371 |
KTelMicrophoneMuteState, |
|
372 |
EPSTelMicMuteStateUninitialized ) ); |
|
373 |
||
374 |
EUNIT_ASSERT( !iLiveSession->IsMicMutedL() ) |
|
375 |
||
376 |
User::LeaveIfError( RProperty::Set( KPSUidTelMicrophoneMuteStatus, |
|
377 |
KTelMicrophoneMuteState, |
|
378 |
EPSTelMicMuteOn ) ); |
|
379 |
||
380 |
EUNIT_ASSERT( iLiveSession->IsMicMutedL() ) |
|
381 |
||
382 |
User::LeaveIfError( RProperty::Set( KPSUidTelMicrophoneMuteStatus, |
|
383 |
KTelMicrophoneMuteState, |
|
384 |
EPSTelMicMuteOff ) ); |
|
385 |
||
386 |
EUNIT_ASSERT( !iLiveSession->IsMicMutedL() ) |
|
387 |
} |
|
388 |
||
389 |
||
390 |
// ----------------------------------------------------------------------------- |
|
391 |
// |
|
392 |
// ----------------------------------------------------------------------------- |
|
393 |
// |
|
394 |
void UT_CMusEngSession::UT_SetAudioRoutingObserverL() |
|
395 |
{ |
|
396 |
EUNIT_ASSERT( !iLiveSession->iTelephoneUtils->iAudioRoutingObserver ) |
|
397 |
||
398 |
iLiveSession->SetAudioRoutingObserver( iObserver ); |
|
399 |
||
400 |
EUNIT_ASSERT_EQUALS( iLiveSession->iTelephoneUtils->iAudioRoutingObserver, |
|
401 |
iObserver ) |
|
402 |
} |
|
403 |
||
404 |
||
405 |
// ----------------------------------------------------------------------------- |
|
406 |
// |
|
407 |
// ----------------------------------------------------------------------------- |
|
408 |
// |
|
409 |
void UT_CMusEngSession::UT_VolumeUpLL() |
|
410 |
{ |
|
411 |
CMusEngTelephoneUtils* telephone = iLiveSession->iTelephoneUtils; |
|
412 |
||
413 |
// Next ones must leave if runs out of memory, so that test |
|
414 |
// does not fail when executed with alloc fail simulation |
|
415 |
User::LeaveIfError( telephone->iRepository->Set( |
|
416 |
KTelIncallEarVolume, |
|
417 |
KTelephonyVolumeDefaultValue ) ); |
|
418 |
User::LeaveIfError( telephone->iRepository->Set( |
|
419 |
KTelIncallLoudspeakerVolume, |
|
420 |
KTelephonyVolumeDefaultValue ) ); |
|
421 |
||
422 |
||
423 |
TInt earVolume = 0; |
|
424 |
TInt speakerVolume = 0; |
|
425 |
||
426 |
iLiveSession->CMusEngSession::VolumeUpL(); |
|
427 |
||
428 |
telephone->iRepository->Get( KTelIncallEarVolume, |
|
429 |
earVolume ); |
|
430 |
telephone->iRepository->Get( KTelIncallLoudspeakerVolume, |
|
431 |
speakerVolume ); |
|
432 |
||
433 |
EUNIT_ASSERT( earVolume == KTelephonyVolumeDefaultValue + 1 ); |
|
434 |
EUNIT_ASSERT( speakerVolume == KTelephonyVolumeDefaultValue ); |
|
435 |
} |
|
436 |
||
437 |
||
438 |
// ----------------------------------------------------------------------------- |
|
439 |
// |
|
440 |
// ----------------------------------------------------------------------------- |
|
441 |
// |
|
442 |
void UT_CMusEngSession::UT_VolumeDownLL() |
|
443 |
{ |
|
444 |
CMusEngTelephoneUtils* telephone = iLiveSession->iTelephoneUtils; |
|
445 |
||
446 |
// Next ones must leave if runs out of memory, so that test |
|
447 |
// does not fail when executed with alloc fail simulation |
|
448 |
User::LeaveIfError( telephone->iRepository->Set( |
|
449 |
KTelIncallEarVolume, |
|
450 |
KTelephonyVolumeDefaultValue ) ); |
|
451 |
User::LeaveIfError( telephone->iRepository->Set( |
|
452 |
KTelIncallLoudspeakerVolume, |
|
453 |
KTelephonyVolumeDefaultValue ) ); |
|
454 |
||
455 |
||
456 |
TInt earVolume = 0; |
|
457 |
TInt speakerVolume = 0; |
|
458 |
||
459 |
iLiveSession->CMusEngSession::VolumeDownL(); |
|
460 |
||
461 |
telephone->iRepository->Get( KTelIncallEarVolume, |
|
462 |
earVolume ); |
|
463 |
telephone->iRepository->Get( KTelIncallLoudspeakerVolume, |
|
464 |
speakerVolume ); |
|
465 |
||
466 |
EUNIT_ASSERT( earVolume == KTelephonyVolumeDefaultValue - 1 ); |
|
467 |
EUNIT_ASSERT( speakerVolume == KTelephonyVolumeDefaultValue ); |
|
468 |
} |
|
469 |
||
470 |
||
471 |
// ----------------------------------------------------------------------------- |
|
472 |
// |
|
473 |
// ----------------------------------------------------------------------------- |
|
474 |
// |
|
475 |
void UT_CMusEngSession::UT_SetVolumeLL() |
|
476 |
{ |
|
477 |
CMusEngTelephoneUtils* telephone = iLiveSession->iTelephoneUtils; |
|
478 |
||
479 |
// Next ones must leave if runs out of memory, so that test |
|
480 |
// does not fail when executed with alloc fail simulation |
|
481 |
User::LeaveIfError( telephone->iRepository->Set( |
|
482 |
KTelIncallEarVolume, |
|
483 |
KTelephonyVolumeDefaultValue ) ); |
|
484 |
User::LeaveIfError( telephone->iRepository->Set( |
|
485 |
KTelIncallLoudspeakerVolume, |
|
486 |
KTelephonyVolumeDefaultValue ) ); |
|
487 |
||
488 |
||
489 |
TInt earVolume = 0; |
|
490 |
TInt speakerVolume = 0; |
|
491 |
TInt newVolume = KTelephonyVolumeDefaultValue + 1; |
|
492 |
||
493 |
iLiveSession->CMusEngSession::SetVolumeL( newVolume ); |
|
494 |
||
495 |
telephone->iRepository->Get( KTelIncallEarVolume, |
|
496 |
earVolume ); |
|
497 |
telephone->iRepository->Get( KTelIncallLoudspeakerVolume, |
|
498 |
speakerVolume ); |
|
499 |
||
500 |
EUNIT_ASSERT( earVolume == newVolume ); |
|
501 |
EUNIT_ASSERT( speakerVolume == KTelephonyVolumeDefaultValue ); |
|
502 |
} |
|
503 |
||
504 |
||
505 |
// ----------------------------------------------------------------------------- |
|
506 |
// |
|
507 |
// ----------------------------------------------------------------------------- |
|
508 |
// |
|
509 |
void UT_CMusEngSession::UT_SetVolumeChangeObserverL() |
|
510 |
{ |
|
511 |
EUNIT_ASSERT( !iLiveSession->iVolumeObserver ) |
|
512 |
||
513 |
iLiveSession->SetVolumeChangeObserver( iObserver ); |
|
514 |
||
515 |
EUNIT_ASSERT_EQUALS( iLiveSession->iVolumeObserver, iObserver ) |
|
516 |
||
517 |
iObserver->VolumeChanged( 2, EFalse ); |
|
518 |
EUNIT_ASSERT( iObserver->iVolume == 2 ); |
|
519 |
} |
|
520 |
||
521 |
||
522 |
// TEST TABLE |
|
523 |
||
524 |
EUNIT_BEGIN_TEST_TABLE( |
|
525 |
UT_CMusEngSession, |
|
526 |
"UT_CMusEngSesssion", |
|
527 |
"UNIT" ) |
|
528 |
||
529 |
EUNIT_TEST( |
|
530 |
"Rect - test ", |
|
531 |
"CMusEngSession", |
|
532 |
"Rect", |
|
533 |
"FUNCTIONALITY", |
|
534 |
SetupL, UT_RectL, Teardown) |
|
535 |
||
536 |
EUNIT_TEST( |
|
537 |
"SetRectL - test ", |
|
538 |
"CMusEngSession", |
|
539 |
"SetRectL", |
|
540 |
"FUNCTIONALITY", |
|
541 |
SetupL, UT_SetRectLL, Teardown) |
|
542 |
||
543 |
EUNIT_TEST( |
|
544 |
"AudioRoutingCanBeChanged - test ", |
|
545 |
"CMusEngSession", |
|
546 |
"AudioRoutingCanBeChanged", |
|
547 |
"FUNCTIONALITY", |
|
548 |
SetupL, UT_AudioRoutingCanBeChangedL, Teardown) |
|
549 |
||
550 |
EUNIT_TEST( |
|
551 |
"IsAudioRoutingHeadsetL - test ", |
|
552 |
"CMusEngSession", |
|
553 |
"IsAudioRoutingHeadsetL", |
|
554 |
"FUNCTIONALITY", |
|
555 |
SetupL, UT_IsAudioRoutingHeadsetL, Teardown) |
|
556 |
||
557 |
EUNIT_TEST( |
|
558 |
"IsAudioRoutingLoudSpeakerL - test ", |
|
559 |
"CMusEngSession", |
|
560 |
"IsAudioRoutingLoudSpeakerL", |
|
561 |
"FUNCTIONALITY", |
|
562 |
SetupL, UT_IsAudioRoutingLoudSpeakerL, Teardown) |
|
563 |
||
564 |
EUNIT_TEST( |
|
565 |
"EnableLoudspeakerL - test ", |
|
566 |
"CMusEngSession", |
|
567 |
"EnableLoudspeakerL", |
|
568 |
"FUNCTIONALITY", |
|
569 |
SetupL, UT_EnableLoudspeakerLL, Teardown) |
|
570 |
||
571 |
EUNIT_TEST( |
|
572 |
"IsLoudSpeakerEnabled - test ", |
|
573 |
"CMusEngSession", |
|
574 |
"IsLoudSpeakerEnabled", |
|
575 |
"FUNCTIONALITY", |
|
576 |
SetupL, UT_IsLoudSpeakerEnabledL, Teardown) |
|
577 |
||
578 |
EUNIT_TEST( |
|
579 |
"VolumeL - test ", |
|
580 |
"CMusEngSession", |
|
581 |
"VolumeL", |
|
582 |
"FUNCTIONALITY", |
|
583 |
SetupL, UT_VolumeLL, Teardown) |
|
584 |
||
585 |
EUNIT_TEST( |
|
586 |
"MuteMicL - test ", |
|
587 |
"CMusEngSession", |
|
588 |
"MuteMicL", |
|
589 |
"FUNCTIONALITY", |
|
590 |
SetupL, UT_MuteMicLL, Teardown) |
|
591 |
||
592 |
EUNIT_TEST( |
|
593 |
"IsMicMutedL - test ", |
|
594 |
"CMusEngSession", |
|
595 |
"IsMicMutedL", |
|
596 |
"FUNCTIONALITY", |
|
597 |
SetupL, UT_IsMicMutedLL, Teardown) |
|
598 |
||
599 |
EUNIT_TEST( |
|
600 |
"SetAudioRoutingObserverL - test ", |
|
601 |
"CMusEngSession", |
|
602 |
"SetAudioRoutingObserverL", |
|
603 |
"FUNCTIONALITY", |
|
604 |
SetupL, UT_SetAudioRoutingObserverL, Teardown) |
|
605 |
||
606 |
EUNIT_TEST( |
|
607 |
"VolumeUpL - test ", |
|
608 |
"CMusEngSession", |
|
609 |
"VolumeUpL", |
|
610 |
"FUNCTIONALITY", |
|
611 |
SetupL, UT_VolumeUpLL, Teardown) |
|
612 |
||
613 |
EUNIT_TEST( |
|
614 |
"VolumeDownL - test ", |
|
615 |
"CMusEngSession", |
|
616 |
"VolumeDownL", |
|
617 |
"FUNCTIONALITY", |
|
618 |
SetupL, UT_VolumeDownLL, Teardown) |
|
619 |
||
620 |
EUNIT_TEST( |
|
621 |
"SetVolumeL - test ", |
|
622 |
"CMusEngSession", |
|
623 |
"SetVolumeL", |
|
624 |
"FUNCTIONALITY", |
|
625 |
SetupL, UT_SetVolumeLL, Teardown) |
|
626 |
||
627 |
EUNIT_TEST( |
|
628 |
"SetVolumeChangeObserver - test ", |
|
629 |
"CMusEngSession", |
|
630 |
"SetVolumeChangeObserver", |
|
631 |
"FUNCTIONALITY", |
|
632 |
SetupL, UT_SetVolumeChangeObserverL, Teardown) |
|
633 |
||
634 |
||
635 |
EUNIT_END_TEST_TABLE |
|
636 |
||
637 |
// END OF FILE |