1 /* |
|
2 * Copyright (c) 2007-2007 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: Test for music control for the slideshow |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __T_CSHWMUSICCONTROL_H__ |
|
22 #define __T_CSHWMUSICCONTROL_H__ |
|
23 |
|
24 // EXTERNAL INCLUDES |
|
25 #include <CEUnitTestSuiteClass.h> |
|
26 #include <EUnitDecorators.h> |
|
27 |
|
28 |
|
29 // INTERNAL INCLUDES |
|
30 #include "shweventqueue.h" |
|
31 #include "shwmusiccontrol.h" |
|
32 #include "shwmusicobserver.h" |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 |
|
36 |
|
37 const TInt KMaxFileLen = 256; |
|
38 |
|
39 // CLASS DEFINITION |
|
40 /** |
|
41 * EUnit test suite for CShwMusicControl |
|
42 */ |
|
43 NONSHARABLE_CLASS( T_CShwMusicControl ) |
|
44 : public CEUnitTestSuiteClass, |
|
45 public MShwMusicObserver, |
|
46 public MShwEventQueue |
|
47 { |
|
48 public: // Constructors and destructors |
|
49 |
|
50 /** |
|
51 * Two phase construction |
|
52 */ |
|
53 static T_CShwMusicControl* NewL(); |
|
54 static T_CShwMusicControl* NewLC(); |
|
55 /** |
|
56 * Destructor |
|
57 */ |
|
58 ~T_CShwMusicControl(); |
|
59 |
|
60 private: // Constructors and destructors |
|
61 |
|
62 T_CShwMusicControl(); |
|
63 void ConstructL(); |
|
64 |
|
65 public: |
|
66 static TInt StopPlaying(TAny* aMusicControl); |
|
67 |
|
68 public: // From MShwEventQueue |
|
69 |
|
70 void SendEventL( MShwEvent* aEvent ); |
|
71 |
|
72 |
|
73 public: // From MShwMusicObserver |
|
74 |
|
75 void MusicOnL(); |
|
76 void MusicOff(); |
|
77 void MusicVolume(TInt aCurrentVolume, TInt aMaxVolume); |
|
78 void ErrorWithTrackL(TInt aErrorCode); |
|
79 |
|
80 private: // New methods |
|
81 |
|
82 void SetupL(); |
|
83 void Teardown(); |
|
84 void Empty(); |
|
85 |
|
86 void TestConstructL(); |
|
87 void T_NotifyLL(); |
|
88 void T_NotifyL1L(); |
|
89 void T_NotifyL2L(); |
|
90 void T_NotifyL3L(); |
|
91 void T_NotifyL4L(); |
|
92 void T_NotifyL5L(); |
|
93 void T_ExtendedPlayL(); |
|
94 void T_ErrorInFileL(); |
|
95 void T_LeaveInObserverL(); |
|
96 |
|
97 private: // Data |
|
98 // The music state |
|
99 TBool iMusicOn; |
|
100 |
|
101 // The music volume |
|
102 TInt iCurrentVolume; |
|
103 |
|
104 // The maximum music volume |
|
105 TInt iMaxVolume; |
|
106 |
|
107 // The previous music volume setting |
|
108 // - used to test volume up and down. |
|
109 TInt iPrevVolume; |
|
110 |
|
111 // Own: the class under test |
|
112 CShwMusicControl* iCShwMusicControl; |
|
113 |
|
114 // Own: the event received from SendEventL |
|
115 MShwEvent* iEvent; |
|
116 |
|
117 // Own: scheduler wait object |
|
118 CActiveSchedulerWait iWait; |
|
119 |
|
120 // Own: scheduler wait object |
|
121 CActiveSchedulerWait iPlayWait; |
|
122 |
|
123 // Own: a timer callback |
|
124 CPeriodic* iTimer; |
|
125 |
|
126 /// Own: the error code from ErrorWithTrackL |
|
127 TInt iErrorCode; |
|
128 |
|
129 /// Own: error code to cause a leave in observer |
|
130 TInt iLeaveInObserver; |
|
131 |
|
132 EUNIT_DECLARE_TEST_TABLE; |
|
133 |
|
134 }; |
|
135 |
|
136 #endif // __T_CSHWMUSICCONTROL_H__ |
|
137 |
|
138 // End of file |
|