|
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_MProfilePttSettings test class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 //////////////////////////////////////////////////////////////////////// |
|
20 // T_MProfilePttSettings.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 <MProfileExtraSettings.h> |
|
35 //#include "T_ProfileTestTools.h" |
|
36 #include <centralrepository.h> |
|
37 #include <ProfileEngineSDKCRKeys.h> |
|
38 |
|
39 // the header for the tested class |
|
40 #include <MProfilePttSettings.h> |
|
41 // the header for the tester class |
|
42 #include "T_MProfilePttSettings.h" |
|
43 |
|
44 //CONSTS |
|
45 |
|
46 // create the testing class |
|
47 T_MProfilePttSettings* T_MProfilePttSettings::NewLC() |
|
48 { |
|
49 T_MProfilePttSettings* self = new(ELeave) T_MProfilePttSettings; |
|
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_MProfilePttSettings::ConstructL() |
|
59 { |
|
60 CEUnitTestSuiteClass::ConstructL(); |
|
61 } |
|
62 |
|
63 T_MProfilePttSettings::~T_MProfilePttSettings() |
|
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_MProfilePttSettings::EmptySetupL() |
|
85 { |
|
86 } |
|
87 |
|
88 |
|
89 |
|
90 void T_MProfilePttSettings::SetupL() |
|
91 { |
|
92 RDebug::Print( _L( "Digia:PttSettings test 1" ) ); |
|
93 iFs.Connect(); |
|
94 RDebug::Print( _L( "Digia:PttSettings test 2" ) ); |
|
95 iCenRep = CRepository::NewL( KCRUidProfileEngine ); |
|
96 RDebug::Print( _L( "Digia:PttSettings test 3" ) ); |
|
97 iCenRep->Reset(); |
|
98 RDebug::Print( _L( "Digia:PttSettings test 4" ) ); |
|
99 |
|
100 iProfileEngine = CreateProfileEngineL(); |
|
101 |
|
102 RDebug::Print( _L( "Digia:PttSettings test 5" ) ); |
|
103 iProfileEngine->SetActiveProfileL( iActiveId ); |
|
104 RDebug::Print( _L( "Digia:PttSettings test 6" ) ); |
|
105 iProfile = iProfileEngine->ActiveProfileL(); |
|
106 RDebug::Print( _L( "Digia:PttSettings test 7" ) ); |
|
107 |
|
108 iProfileExtraSettings = &( iProfile->ProfileExtraSettings() ); |
|
109 RDebug::Print( _L( "Digia:PttSettings test 8" ) ); |
|
110 iProfilePttSettings = &( iProfileExtraSettings->ProfilePttSettings() ); |
|
111 RDebug::Print( _L( "Digia:PttSettings test 9" ) ); |
|
112 } |
|
113 |
|
114 void T_MProfilePttSettings::Setup0L() |
|
115 { |
|
116 iActiveId = 0; |
|
117 SetupL(); |
|
118 } |
|
119 |
|
120 void T_MProfilePttSettings::Setup1L() |
|
121 { |
|
122 iActiveId = 1; |
|
123 SetupL(); |
|
124 } |
|
125 |
|
126 void T_MProfilePttSettings::Setup2L() |
|
127 { |
|
128 iActiveId = 2; |
|
129 SetupL(); |
|
130 } |
|
131 |
|
132 void T_MProfilePttSettings::Setup3L() |
|
133 { |
|
134 iActiveId = 3; |
|
135 SetupL(); |
|
136 } |
|
137 |
|
138 void T_MProfilePttSettings::Setup4L() |
|
139 { |
|
140 iActiveId = 4; |
|
141 SetupL(); |
|
142 } |
|
143 |
|
144 |
|
145 /** |
|
146 * Teardown |
|
147 */ |
|
148 void T_MProfilePttSettings::EmptyTeardown() |
|
149 { |
|
150 |
|
151 } |
|
152 |
|
153 void T_MProfilePttSettings::Teardown() |
|
154 { |
|
155 iFs.Close(); |
|
156 if( iProfile ) |
|
157 { |
|
158 iProfile->Release(); |
|
159 iProfile = NULL; |
|
160 iProfilePttSettings = NULL; |
|
161 iProfileExtraSettings = NULL; |
|
162 } |
|
163 if( iProfileEngine ) |
|
164 { |
|
165 iProfileEngine->Release(); |
|
166 iProfileEngine = NULL; |
|
167 } |
|
168 delete iCenRep; |
|
169 |
|
170 } |
|
171 |
|
172 /** |
|
173 * Tests |
|
174 */ |
|
175 void T_MProfilePttSettings::EmptyTestL() |
|
176 { |
|
177 //EUNIT_ASSERT( ETrue ); |
|
178 } |
|
179 |
|
180 void T_MProfilePttSettings::GetPttStatusTestL() |
|
181 { |
|
182 __UHEAP_MARK; |
|
183 TProfilePttStatus status( iProfilePttSettings->PttStatus() ); |
|
184 __UHEAP_MARKEND; |
|
185 |
|
186 RDebug::Print( _L( "GetPttStatusTestL: status=%d" ), status ); |
|
187 //EUNIT_ASSERT( status == T_ProfileTestTools::ProfilePttStatus( iActiveId ) ); |
|
188 } |
|
189 |
|
190 void T_MProfilePttSettings::GetPttRingingToneTestL() |
|
191 { |
|
192 __UHEAP_MARK; |
|
193 const TDesC& desc = iProfilePttSettings->PttRingingTone(); |
|
194 __UHEAP_MARKEND; |
|
195 |
|
196 //EUNIT_ASSERT( desc.CompareF( T_ProfileTestTools::ProfilePttRingingTone( iActiveId ) ) == 0 ); |
|
197 } |
|
198 |
|
199 // Test case table for this test suite class |
|
200 EUNIT_BEGIN_TEST_TABLE( T_MProfilePttSettings, "T_MProfilePttSettings test suite", "MODULE" ) |
|
201 |
|
202 EUNIT_TESTCASE("0: Get ptt status test ", Setup0L, GetPttStatusTestL, Teardown) |
|
203 |
|
204 EUNIT_TESTCASE("1: Get ptt status test ", Setup1L, GetPttStatusTestL, Teardown) |
|
205 |
|
206 EUNIT_TESTCASE("2: Get ptt status test ", Setup2L, GetPttStatusTestL, Teardown) |
|
207 |
|
208 EUNIT_TESTCASE("3: Get ptt status test ", Setup3L, GetPttStatusTestL, Teardown) |
|
209 |
|
210 EUNIT_TESTCASE("4: Get ptt status test ", Setup4L, GetPttStatusTestL, Teardown) |
|
211 |
|
212 EUNIT_TESTCASE("0: Get ptt ringing tone test ", Setup0L, GetPttRingingToneTestL, Teardown) |
|
213 |
|
214 EUNIT_TESTCASE("1: Get ptt ringing tone test ", Setup1L, GetPttRingingToneTestL, Teardown) |
|
215 |
|
216 EUNIT_TESTCASE("2: Get ptt ringing tone test ", Setup2L, GetPttRingingToneTestL, Teardown) |
|
217 |
|
218 EUNIT_TESTCASE("3: Get ptt ringing tone test ", Setup3L, GetPttRingingToneTestL, Teardown) |
|
219 |
|
220 EUNIT_TESTCASE("4: Get ptt ringing tone test ", Setup4L, GetPttRingingToneTestL, Teardown) |
|
221 |
|
222 EUNIT_END_TESTCASE_TABLE |
|
223 |
|
224 // End of File |
|
225 |