|
1 /* |
|
2 * Copyright (c) 2002 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 class for CProfileIndexHandler. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "T_CProfileToneHandler.h" |
|
22 #include <EUnitMacros.h> |
|
23 #include <CProfileToneHandler.h> |
|
24 |
|
25 namespace |
|
26 { |
|
27 } |
|
28 |
|
29 // ============================ MEMBER FUNCTIONS =============================== |
|
30 |
|
31 // ----------------------------------------------------------------------------- |
|
32 // T_CProfileToneHandler::T_CProfileToneHandler |
|
33 // C++ constructor can NOT contain any code, that might leave. |
|
34 // ----------------------------------------------------------------------------- |
|
35 // |
|
36 T_CProfileToneHandler::T_CProfileToneHandler() |
|
37 { |
|
38 } |
|
39 |
|
40 // ----------------------------------------------------------------------------- |
|
41 // T_CProfileToneHandler::ConstructL |
|
42 // Symbian 2nd phase constructor can leave. |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 void T_CProfileToneHandler::ConstructL() |
|
46 { |
|
47 CEUnitTestSuiteClass::ConstructL(); |
|
48 } |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // T_CProfileToneHandler::NewLC |
|
52 // Two-phased constructor. |
|
53 // ----------------------------------------------------------------------------- |
|
54 // |
|
55 T_CProfileToneHandler* T_CProfileToneHandler::NewLC() |
|
56 { |
|
57 T_CProfileToneHandler* self = new( ELeave ) T_CProfileToneHandler(); |
|
58 CleanupStack::PushL( self ); |
|
59 self->ConstructL(); |
|
60 return self; |
|
61 } |
|
62 |
|
63 // Destructor (virtual by CBase) |
|
64 T_CProfileToneHandler::~T_CProfileToneHandler() |
|
65 { |
|
66 } |
|
67 |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // T_CProfileToneHandler::SetupL |
|
71 // ----------------------------------------------------------------------------- |
|
72 // |
|
73 void T_CProfileToneHandler::SetupL() |
|
74 { |
|
75 iToneHandler = CProfileToneHandler::NewL(); |
|
76 } |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // T_CProfileToneHandler::EmptySetupL |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 void T_CProfileToneHandler::EmptySetupL() |
|
83 { |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // T_CProfileToneHandler::Teardown |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 void T_CProfileToneHandler::Teardown() |
|
91 { |
|
92 delete iToneHandler; |
|
93 } |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // T_CProfileToneHandler::NewLTestL |
|
97 // ----------------------------------------------------------------------------- |
|
98 // |
|
99 void T_CProfileToneHandler::NewLTestL() |
|
100 { |
|
101 CProfileToneHandler* toneHandler = CProfileToneHandler::NewL(); |
|
102 CleanupStack::PushL( toneHandler ); |
|
103 EUNIT_ASSERT( toneHandler ); |
|
104 CleanupStack::PopAndDestroy(); // toneHandler |
|
105 |
|
106 toneHandler = CProfileToneHandler::NewL( ); |
|
107 CleanupStack::PushL( toneHandler ); |
|
108 EUNIT_ASSERT( toneHandler ); |
|
109 |
|
110 CProfileToneHandler* anotherToneHandler = CProfileToneHandler::NewL( ); |
|
111 CleanupStack::PushL( anotherToneHandler ); |
|
112 EUNIT_ASSERT( anotherToneHandler ); |
|
113 CleanupStack::PopAndDestroy(); // anotherToneHandler |
|
114 |
|
115 CleanupStack::PopAndDestroy(); // toneHandler |
|
116 } |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 // T_CProfileToneHandler::NewLCTestL |
|
120 // ----------------------------------------------------------------------------- |
|
121 // |
|
122 void T_CProfileToneHandler::NewLCTestL() |
|
123 { |
|
124 CProfileToneHandler* toneHandler = CProfileToneHandler::NewLC(); |
|
125 EUNIT_ASSERT( toneHandler ); |
|
126 CleanupStack::PopAndDestroy(); // toneHandler |
|
127 |
|
128 toneHandler = CProfileToneHandler::NewLC( ); |
|
129 EUNIT_ASSERT( toneHandler ); |
|
130 |
|
131 CProfileToneHandler* anotherToneHandler = CProfileToneHandler::NewLC( ); |
|
132 EUNIT_ASSERT( anotherToneHandler ); |
|
133 CleanupStack::PopAndDestroy(); // anotherToneHandler |
|
134 |
|
135 CleanupStack::PopAndDestroy(); // toneHandler |
|
136 } |
|
137 |
|
138 // ----------------------------------------------------------------------------- |
|
139 // T_CProfileToneHandler::SetActiveProfileRingingToneTestL |
|
140 // ----------------------------------------------------------------------------- |
|
141 // |
|
142 void T_CProfileToneHandler::SetActiveProfileRingingToneTestL() |
|
143 { |
|
144 iToneHandler->SetActiveProfileRingingToneL( KNullDesC ); |
|
145 } |
|
146 |
|
147 // ----------------------------------------------------------------------------- |
|
148 // T_CProfileToneHandler::SetProfileToneTestL |
|
149 // ----------------------------------------------------------------------------- |
|
150 // |
|
151 void T_CProfileToneHandler::SetProfileToneTestL() |
|
152 { |
|
153 iToneHandler->SetProfileToneL( 0, EProfileRingingToneSetting, KNullDesC ); |
|
154 } |
|
155 |
|
156 // ----------------------------------------------------------------------------- |
|
157 // T_CProfileToneHandler::SetToneForAllProfilesTestL |
|
158 // ----------------------------------------------------------------------------- |
|
159 // |
|
160 void T_CProfileToneHandler::SetToneForAllProfilesTestL() |
|
161 { |
|
162 iToneHandler->SetToneForAllProfilesL( EProfileRingingToneSetting, KNullDesC ); |
|
163 } |
|
164 |
|
165 // ========================== EUNIT TEST CASES ================================= |
|
166 |
|
167 EUNIT_BEGIN_TEST_TABLE( |
|
168 T_CProfileToneHandler, // Name of the tester class |
|
169 "T_CProfileToneHandler test suite.", // Textual description of the test suite. |
|
170 "MODULE" ) |
|
171 |
|
172 EUNIT_TEST( |
|
173 "NewLTestL", |
|
174 "CProfileToneHandler", |
|
175 "NewL", |
|
176 "FUNCTIONALITY", |
|
177 EmptySetupL, NewLTestL, Teardown ) |
|
178 EUNIT_TEST( |
|
179 "NewLCTestL", |
|
180 "CProfileToneHandler", |
|
181 "NewLC", |
|
182 "FUNCTIONALITY", |
|
183 EmptySetupL, NewLCTestL, Teardown ) |
|
184 EUNIT_TEST( |
|
185 "SetProfileToneTestL", |
|
186 "CProfileToneHandler", |
|
187 "SetProfileToneL", |
|
188 "FUNCTIONALITY", |
|
189 SetupL, SetProfileToneTestL, Teardown ) |
|
190 EUNIT_TEST( |
|
191 "SetActiveProfileRingingToneTestL", |
|
192 "CProfileToneHandler", |
|
193 "SetActiveProfileRingingToneL", |
|
194 "FUNCTIONALITY", |
|
195 SetupL, SetActiveProfileRingingToneTestL, Teardown ) |
|
196 EUNIT_TEST( |
|
197 "SetToneForAllProfilesTestL", |
|
198 "CProfileToneHandler", |
|
199 "SetToneForAllProfilesL", |
|
200 "FUNCTIONALITY", |
|
201 SetupL, SetToneForAllProfilesTestL, Teardown ) |
|
202 |
|
203 EUNIT_END_TEST_TABLE |
|
204 |
|
205 // End of File |