|
1 /* |
|
2 * Copyright (c) 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: Implementation of the T_MProfileTones test class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 //////////////////////////////////////////////////////////////////////// |
|
20 // T_MProfileTones.cpp |
|
21 // |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32math.h> |
|
25 #include <e32svr.h> |
|
26 |
|
27 #include <EUnitMacros.h> |
|
28 #include <TEUnitAssertionInfo.h> |
|
29 |
|
30 #include <BAMDESCA.H> |
|
31 #include <MProfileEngine.h> |
|
32 #include <MProfile.h> |
|
33 #include <MProfileName.h> |
|
34 #include <MProfileExtraTones.h> |
|
35 #include <MProfileTones.h> |
|
36 #include <TProfileToneSettings.h> |
|
37 //#include "T_ProfileTestTools.h" |
|
38 #include <centralrepository.h> |
|
39 #include <ProfileEngineSDKCRKeys.h> |
|
40 |
|
41 // the header for the tested class |
|
42 #include "T_MProfileTones.h" |
|
43 |
|
44 //CONSTS |
|
45 |
|
46 // create the testing class |
|
47 T_MProfileTones* T_MProfileTones::NewLC() |
|
48 { |
|
49 T_MProfileTones* self = new(ELeave) T_MProfileTones; |
|
50 |
|
51 CleanupStack::PushL( self ); |
|
52 // need to generate the table, so call base classes |
|
53 // second phase constructor |
|
54 self->ConstructL(); |
|
55 return self; |
|
56 } |
|
57 |
|
58 void T_MProfileTones::ConstructL() |
|
59 { |
|
60 CEUnitTestSuiteClass::ConstructL(); |
|
61 } |
|
62 |
|
63 T_MProfileTones::~T_MProfileTones() |
|
64 { |
|
65 iFs.Close(); |
|
66 if( iProfileEngine ) |
|
67 { |
|
68 iProfileEngine->Release(); |
|
69 } |
|
70 if( iProfile ) |
|
71 { |
|
72 iProfile->Release(); |
|
73 } |
|
74 } |
|
75 |
|
76 /** |
|
77 * Assistance methods |
|
78 */ |
|
79 |
|
80 |
|
81 /** |
|
82 * Setup |
|
83 */ |
|
84 void T_MProfileTones::EmptySetupL() |
|
85 { |
|
86 } |
|
87 |
|
88 |
|
89 |
|
90 void T_MProfileTones::SetupL() |
|
91 { |
|
92 iFs.Connect(); |
|
93 iCenRep = CRepository::NewL( KCRUidProfileEngine ); |
|
94 iCenRep->Reset(); |
|
95 |
|
96 iProfileEngine = CreateProfileEngineL(); |
|
97 |
|
98 iProfileEngine->SetActiveProfileL( iActiveId ); |
|
99 iProfile = iProfileEngine->ActiveProfileL(); |
|
100 |
|
101 iProfileTones = &( iProfile->ProfileTones() ); |
|
102 } |
|
103 |
|
104 void T_MProfileTones::Setup0L() |
|
105 { |
|
106 iActiveId = 0; |
|
107 SetupL(); |
|
108 } |
|
109 |
|
110 void T_MProfileTones::Setup1L() |
|
111 { |
|
112 iActiveId = 1; |
|
113 SetupL(); |
|
114 } |
|
115 |
|
116 void T_MProfileTones::Setup2L() |
|
117 { |
|
118 iActiveId = 2; |
|
119 SetupL(); |
|
120 } |
|
121 |
|
122 void T_MProfileTones::Setup3L() |
|
123 { |
|
124 iActiveId = 3; |
|
125 SetupL(); |
|
126 } |
|
127 |
|
128 void T_MProfileTones::Setup4L() |
|
129 { |
|
130 iActiveId = 4; |
|
131 SetupL(); |
|
132 } |
|
133 |
|
134 |
|
135 /** |
|
136 * Teardown |
|
137 */ |
|
138 void T_MProfileTones::EmptyTeardown() |
|
139 { |
|
140 |
|
141 } |
|
142 |
|
143 void T_MProfileTones::Teardown() |
|
144 { |
|
145 iFs.Close(); |
|
146 if( iProfile ) |
|
147 { |
|
148 iProfile->Release(); |
|
149 iProfile = NULL; |
|
150 } |
|
151 if( iProfileEngine ) |
|
152 { |
|
153 iProfileEngine->Release(); |
|
154 iProfileEngine = NULL; |
|
155 } |
|
156 delete iCenRep; |
|
157 |
|
158 } |
|
159 |
|
160 /** |
|
161 * Tests |
|
162 */ |
|
163 void T_MProfileTones::EmptyTestL() |
|
164 { |
|
165 //EUNIT_ASSERT( ETrue ); |
|
166 } |
|
167 |
|
168 void T_MProfileTones::GetRingingTone1TestL() |
|
169 { |
|
170 __UHEAP_MARK; |
|
171 const TDesC& des = iProfileTones->RingingTone1(); |
|
172 __UHEAP_MARKEND; |
|
173 TFileName rt( des ); |
|
174 //EUNIT_ASSERT( des.CompareF( T_ProfileTestTools::ProfileRingingTone( iActiveId ) ) == 0 ); |
|
175 } |
|
176 |
|
177 void T_MProfileTones::GetRingingTone2TestL() |
|
178 { |
|
179 __UHEAP_MARK; |
|
180 const TDesC& des = iProfileTones->RingingTone2(); |
|
181 __UHEAP_MARKEND; |
|
182 //EUNIT_ASSERT( des.CompareF( T_ProfileTestTools::ProfileRingingTone( iActiveId ) ) == 0 ); |
|
183 } |
|
184 |
|
185 void T_MProfileTones::GetMessageAlertToneTestL() |
|
186 { |
|
187 __UHEAP_MARK; |
|
188 const TDesC& des = iProfileTones->MessageAlertTone(); |
|
189 __UHEAP_MARKEND; |
|
190 //EUNIT_ASSERT( des.CompareF( T_ProfileTestTools::ProfileMessageAlertTone( iActiveId ) ) == 0 ); |
|
191 } |
|
192 |
|
193 void T_MProfileTones::GetProfileToneSettingsTestL() |
|
194 { |
|
195 __UHEAP_MARK; |
|
196 const TProfileToneSettings& settings = iProfileTones->ToneSettings(); |
|
197 __UHEAP_MARKEND; |
|
198 //EUNIT_ASSERT( T_ProfileTestTools::CheckToneSettings( iActiveId, settings ) ); |
|
199 } |
|
200 |
|
201 // Test case table for this test suite class |
|
202 EUNIT_BEGIN_TEST_TABLE( T_MProfileTones, "T_MProfileTones test suite", "MODULE" ) |
|
203 |
|
204 EUNIT_TESTCASE("0: Get ringing tone 1 test ", Setup0L, GetRingingTone1TestL, Teardown) |
|
205 EUNIT_TESTCASE("0: Get ringing tone 2 test ", Setup0L, GetRingingTone2TestL, Teardown) |
|
206 EUNIT_TESTCASE("0: Get msg alert tone test ", Setup0L, GetMessageAlertToneTestL, Teardown) |
|
207 EUNIT_TESTCASE("0: Get tone settings test ", Setup0L, GetProfileToneSettingsTestL, Teardown) |
|
208 |
|
209 EUNIT_TESTCASE("1: Get ringing tone 1 test ", Setup1L, GetRingingTone1TestL, Teardown) |
|
210 EUNIT_TESTCASE("1: Get ringing tone 2 test ", Setup1L, GetRingingTone2TestL, Teardown) |
|
211 EUNIT_TESTCASE("1: Get msg alert tone test ", Setup1L, GetMessageAlertToneTestL, Teardown) |
|
212 EUNIT_TESTCASE("1: Get tone settings test ", Setup1L, GetProfileToneSettingsTestL, Teardown) |
|
213 |
|
214 EUNIT_TESTCASE("2: Get ringing tone 1 test ", Setup2L, GetRingingTone1TestL, Teardown) |
|
215 EUNIT_TESTCASE("2: Get ringing tone 2 test ", Setup2L, GetRingingTone2TestL, Teardown) |
|
216 EUNIT_TESTCASE("2: Get msg alert tone test ", Setup2L, GetMessageAlertToneTestL, Teardown) |
|
217 EUNIT_TESTCASE("2: Get tone settings test ", Setup2L, GetProfileToneSettingsTestL, Teardown) |
|
218 |
|
219 EUNIT_TESTCASE("3: Get ringing tone 1 test ", Setup3L, GetRingingTone1TestL, Teardown) |
|
220 EUNIT_TESTCASE("3: Get ringing tone 2 test ", Setup3L, GetRingingTone2TestL, Teardown) |
|
221 EUNIT_TESTCASE("3: Get msg alert tone test ", Setup3L, GetMessageAlertToneTestL, Teardown) |
|
222 EUNIT_TESTCASE("3: Get tone settings test ", Setup3L, GetProfileToneSettingsTestL, Teardown) |
|
223 |
|
224 EUNIT_TESTCASE("4: Get ringing tone 1 test ", Setup4L, GetRingingTone1TestL, Teardown) |
|
225 EUNIT_TESTCASE("4: Get ringing tone 2 test ", Setup4L, GetRingingTone2TestL, Teardown) |
|
226 EUNIT_TESTCASE("4: Get msg alert tone test ", Setup4L, GetMessageAlertToneTestL, Teardown) |
|
227 EUNIT_TESTCASE("4: Get tone settings test ", Setup4L, GetProfileToneSettingsTestL, Teardown) |
|
228 |
|
229 EUNIT_END_TESTCASE_TABLE |
|
230 |
|
231 // End of File |