1 /* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 * All rights reserved. |
|
3 * This component and the accompanying materials are made available |
|
4 * under the terms of "Eclipse Public License v1.0"" |
|
5 * which accompanies this distribution, and is available |
|
6 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 * |
|
8 * Initial Contributors: |
|
9 * Nokia Corporation - initial contribution. |
|
10 * |
|
11 * Contributors: |
|
12 * |
|
13 * Description: |
|
14 * test the functions in cpprofilemodel class |
|
15 */ |
|
16 |
|
17 #include "ut_cpprofilemodel.h" |
|
18 |
|
19 |
|
20 #include <QtTest/QtTest> |
|
21 |
|
22 #include <QtCore/QStringList> |
|
23 #include <cpprofilemodel.h> |
|
24 #include <hbpushbutton.h> |
|
25 #include <hbtranslator.h> |
|
26 #include <profile.hrh> |
|
27 |
|
28 /*! |
|
29 \class TestCpProfileModel \n |
|
30 \brief describe the test case's goal, like: \n |
|
31 class name: cpprofilemodel \n |
|
32 class's description: \n |
|
33 type of test case: unit test\n |
|
34 test cases' number totally: \n |
|
35 */ |
|
36 |
|
37 void TestCpProfileModel::initTestCase() |
|
38 { |
|
39 //translate the hbTrId text in control panel. |
|
40 HbTranslator translator("control_panel"); |
|
41 translator.loadCommon(); |
|
42 ringTonePath1 = QString("C:") + QDir::separator() + QString("resource") + QDir::separator() + QString("cptestdata") + QDir::separator() + QString("sounds") + QDir::separator() + QString("testsound.aac"); |
|
43 ringTonePath2 = QString("C:") + QDir::separator() + QString("resource") + QDir::separator() + QString("cptestdata") + QDir::separator() + QString("sounds") + QDir::separator() + QString("testsound2.aac"); |
|
44 } |
|
45 /*! |
|
46 Test Case Description:\n |
|
47 1. Fucntion Name: CpProfileModel(QObject *parent = 0); \n |
|
48 2. Case Descrition: verify the constructor can work correctly. \n |
|
49 3. Input Parameters: \n |
|
50 <1> parent = 0; \n |
|
51 <2> parent = new QObject(); \n |
|
52 4. Expected result: \n |
|
53 no crash \n |
|
54 */ |
|
55 void TestCpProfileModel::testConstructor() |
|
56 { |
|
57 QObject *pObject = new QObject(); |
|
58 |
|
59 //test constructor without parent. |
|
60 CpProfileModel *profileModel = new CpProfileModel(0); |
|
61 QVERIFY( profileModel != 0 ); |
|
62 delete profileModel; |
|
63 profileModel = 0; |
|
64 // test constructor with parent. |
|
65 profileModel = new CpProfileModel(pObject); |
|
66 QVERIFY( profileModel != 0 ); |
|
67 |
|
68 delete pObject; |
|
69 } |
|
70 |
|
71 /*! |
|
72 Test Case Description:\n |
|
73 1. Fucntion Name: QString profileName(int profileId)const; \n |
|
74 2. Case Descrition: verify that it can return the corresponding profile name when using valid profile ID. \n |
|
75 3. Input Parameters: \n |
|
76 <1> profileId = EProfileWrapperGeneralId,\n |
|
77 <2> profileId = EProfileWrapperMeetingId,\n |
|
78 4. Expected result: \n \n |
|
79 <1> return QString( "General" ) \n |
|
80 <2> return QString( "Meeting" ) \n |
|
81 */ |
|
82 void TestCpProfileModel::testProfileNameWithValidProfileID() |
|
83 { |
|
84 CpProfileModel *profileModel = new CpProfileModel(); |
|
85 |
|
86 QString profileName1 = profileModel->profileName(EProfileWrapperGeneralId); |
|
87 QVERIFY( profileName1 == QString( "General" ) ); |
|
88 |
|
89 QString profileName2 = profileModel->profileName(EProfileWrapperMeetingId); |
|
90 QVERIFY( profileName2 == QString("Meeting") ); |
|
91 |
|
92 delete profileModel; |
|
93 } |
|
94 /*! |
|
95 Test Case Description:\n |
|
96 1. Fucntion Name: QString profileName(int profileId)const; \n |
|
97 2. Case Descrition: verify that it doesn't crash when using invalid profile ID. \n |
|
98 3. Input Parameters: \n |
|
99 <1> profileId = EProfileWapperStart,\n |
|
100 <2> profileId = EPRofileWrapperEnd,\n |
|
101 <3> profileId = -80, \n |
|
102 <3> profileId = 888, \n |
|
103 4. Expected result: \n \n |
|
104 <1> return QString() \n |
|
105 <2> return QString() \n |
|
106 <3> return QString() \n |
|
107 <4> return QString() \n |
|
108 */ |
|
109 void TestCpProfileModel::testProfileNameWithInvalidProfileID() |
|
110 { |
|
111 CpProfileModel *profileModel = new CpProfileModel(); |
|
112 |
|
113 QString profileName1 = profileModel->profileName(EProfileWapperStart); |
|
114 QVERIFY( profileName1 == QString() ); |
|
115 |
|
116 QString profileName2 = profileModel->profileName(EPRofileWrapperEnd); |
|
117 QVERIFY( profileName2 == QString() ); |
|
118 |
|
119 QString profileName3 = profileModel->profileName( -80 ); |
|
120 QVERIFY( profileName3 == QString() ); |
|
121 |
|
122 QString profileName4 = profileModel->profileName( 888 ); |
|
123 QVERIFY( profileName4 == QString() ); |
|
124 |
|
125 delete profileModel; |
|
126 } |
|
127 |
|
128 /*! |
|
129 Test Case Description:\n |
|
130 1. Fucntion Name: QStringList profileNames()const; \n |
|
131 2. Case Descrition: Verify that the profile name list can be get correctly with this function \n |
|
132 3. Input Parameters: \n |
|
133 none \n |
|
134 4. Expected result: \n |
|
135 \n |
|
136 */ |
|
137 void TestCpProfileModel::testProfileNames() |
|
138 { |
|
139 CpProfileModel *profileModel = new CpProfileModel(); |
|
140 |
|
141 QStringList profilesNames = profileModel->profileNames(); |
|
142 |
|
143 // Verify the right profile names are returned. |
|
144 QVERIFY ( profilesNames.count() == 2 ); |
|
145 QVERIFY( profilesNames.contains("General", Qt::CaseInsensitive)); |
|
146 QVERIFY( profilesNames.contains("Meeting", Qt::CaseInsensitive)); |
|
147 |
|
148 delete profileModel; |
|
149 } |
|
150 |
|
151 /*! |
|
152 Test Case Description:\n |
|
153 1. Fucntion Name: int activateProfile(int profileId); \n |
|
154 2. Case Descrition: Verify that the profile cannot be actived with the invalid profile ID. \n |
|
155 3. Input Parameters: \n |
|
156 <1> profileId = EProfileWapperStart,\n |
|
157 <2> profileId = EPRofileWrapperEnd,\n |
|
158 <3> profileId = -6 \n |
|
159 <4> profileId = 356 \n |
|
160 4. Expected result: \n |
|
161 <1> return KErrNotFound \n |
|
162 <2> return KErrNotFound \n |
|
163 <3> return KErrNotFound \n |
|
164 <4> return KErrNotFound \n |
|
165 */ |
|
166 void TestCpProfileModel::testActivateProfileWithInvalidID() |
|
167 { |
|
168 CpProfileModel *profileModel = new CpProfileModel(); |
|
169 |
|
170 int retErr1 = profileModel->activateProfile(EProfileWapperStart); |
|
171 QVERIFY( retErr1 == KErrNotFound ); |
|
172 |
|
173 int retErr2 = profileModel->activateProfile(EPRofileWrapperEnd); |
|
174 QVERIFY( retErr2 == KErrNotFound ); |
|
175 |
|
176 int retErr3 = profileModel->activateProfile( -6 ); |
|
177 QVERIFY( retErr3 == KErrNotFound ); |
|
178 |
|
179 int retErr4 = profileModel->activateProfile( 356 ); |
|
180 QVERIFY( retErr4 == KErrNotFound ); |
|
181 |
|
182 delete profileModel; |
|
183 } |
|
184 |
|
185 /*! |
|
186 Test Case Description:\n |
|
187 1. Fucntion Name: int activateProfile(int profileId); \n |
|
188 2. Case Descrition: Verify that the profile can be actived with the valid profile ID. \n |
|
189 3. Input Parameters: \n |
|
190 <1> profileId = EProfileWrapperGeneralId,\n |
|
191 <2> profileId = EProfileWrapperMeetingId,\n |
|
192 4. Expected result: \n |
|
193 <1> the current active profile ID is EProfileWrapperGeneralId \n |
|
194 <2> the current active profile ID is EProfileWrapperMeetingId \n |
|
195 */ |
|
196 void TestCpProfileModel::testActivateProfileWithValidID() |
|
197 { |
|
198 CpProfileModel *profileModel = new CpProfileModel(); |
|
199 |
|
200 profileModel->activateProfile(EProfileWrapperGeneralId); |
|
201 QVERIFY( profileModel->activeProfileId() == EProfileWrapperGeneralId ); |
|
202 |
|
203 profileModel->activateProfile(EProfileWrapperMeetingId); |
|
204 QVERIFY( profileModel->activeProfileId() == EProfileWrapperMeetingId ); |
|
205 |
|
206 delete profileModel; |
|
207 } |
|
208 |
|
209 /*! |
|
210 Test Case Description:\n |
|
211 1. Fucntion Name: int activeProfileId() const;\n |
|
212 2. Case Descrition: Verify that it can return the right profile ID or Error code. \n |
|
213 3. Input Parameters: \n |
|
214 <1> set an active valid profile \n |
|
215 <2> set an active invaild profile \n |
|
216 4. Expected result: \n |
|
217 <1> return the right ID \n |
|
218 <2> no crash \n |
|
219 */ |
|
220 void TestCpProfileModel::testActiveProfileId() |
|
221 { |
|
222 CpProfileModel *profileModel = new CpProfileModel(); |
|
223 |
|
224 profileModel->activateProfile(EProfileWrapperGeneralId); |
|
225 QVERIFY( profileModel->activeProfileId() == EProfileWrapperGeneralId ); |
|
226 |
|
227 profileModel->activateProfile(-8); |
|
228 // set profile failed, so the active profileID is still the previous ID, EProfileWrapperGeneralId. |
|
229 QVERIFY( profileModel->activeProfileId() == EProfileWrapperGeneralId ); |
|
230 |
|
231 delete profileModel; |
|
232 } |
|
233 /*! |
|
234 Test Case Description:\n |
|
235 1. Fucntion Name: void profileSettings(int profileId, CpProfileSettings& profileSettings);\n |
|
236 2. Case Descrition: get profile settings,\n |
|
237 3. Input Parameters: \n |
|
238 <1> profileID = EProfileWrapperGeneralId, profileSettings = CpProfileSettings; \n |
|
239 <2> profileID = EProfileWrapperMeetingId, profileSettings = CpProfileSettings; \n |
|
240 <3> profileID = EProfileWapperStart, profileSettings = CpProfileSettings; \n |
|
241 <4> profileID = EPRofileWrapperEnd, profileSettings = CpProfileSettings; \n |
|
242 <5> profileID = int, profileSettings = CpProfileSettings; \n |
|
243 4. Expected result: \n |
|
244 no crash \n |
|
245 */ |
|
246 void TestCpProfileModel::testProfileSettings() |
|
247 { |
|
248 CpProfileSettings profileSettings; |
|
249 CpProfileModel *profileModel = new CpProfileModel(); |
|
250 profileSettings.mKeyTouchScreenVibra = 0; |
|
251 profileSettings.mKeyTouchScreenTone = 2; |
|
252 // test with valid profile ID. |
|
253 profileModel->setProfileSettings( EProfileWrapperGeneralId, profileSettings ); |
|
254 profileModel->profileSettings( EProfileWrapperGeneralId, profileSettings ); |
|
255 QVERIFY( profileSettings.mKeyTouchScreenTone == 2); |
|
256 |
|
257 profileModel->setProfileSettings( EProfileWrapperMeetingId, profileSettings ); |
|
258 profileModel->profileSettings( EProfileWrapperMeetingId, profileSettings ); |
|
259 QVERIFY( profileSettings.mKeyTouchScreenVibra == 0); |
|
260 // test with invalid profile ID. |
|
261 profileModel->profileSettings( EProfileWapperStart, profileSettings ); |
|
262 |
|
263 profileModel->profileSettings( EPRofileWrapperEnd, profileSettings ); |
|
264 |
|
265 profileModel->profileSettings( 98, profileSettings ); |
|
266 |
|
267 delete profileModel; |
|
268 } |
|
269 /*! |
|
270 Test Case Description:\n |
|
271 1. Fucntion Name: int setProfileSettings(int profileId, CpProfileSettings& profileSettings );\n |
|
272 2. Case Descrition: Set profile settings from center repository keys \n |
|
273 3. Input Parameters: \n |
|
274 <1> profileID = EProfileWrapperGeneralId, profileSettings = CpProfileSettings; \n |
|
275 <2> profileID = EProfileWrapperMeetingId, profileSettings = CpProfileSettings; \n |
|
276 <3> profileID = EProfileWapperStart, profileSettings = CpProfileSettings; \n |
|
277 <4> profileID = EPRofileWrapperEnd, profileSettings = CpProfileSettings; \n |
|
278 <5> profileID = 98, profileSettings = CpProfileSettings; \n |
|
279 4. Expected result: \n |
|
280 no crash \n |
|
281 */ |
|
282 void TestCpProfileModel::testSetProfileSettings() |
|
283 { |
|
284 CpProfileSettings profileSettings; |
|
285 profileSettings.mKeyTouchScreenVibra = 4; |
|
286 profileSettings.mKeyTouchScreenTone = 3; |
|
287 CpProfileModel *profileModel = new CpProfileModel(); |
|
288 // test with valid profile ID. |
|
289 profileModel->setProfileSettings( EProfileWrapperGeneralId, profileSettings ); |
|
290 profileModel->profileSettings( EProfileWrapperGeneralId, profileSettings ); |
|
291 QVERIFY( profileSettings.mKeyTouchScreenTone == 3); |
|
292 |
|
293 profileModel->setProfileSettings( EProfileWrapperMeetingId, profileSettings ); |
|
294 profileModel->profileSettings( EProfileWrapperMeetingId, profileSettings ); |
|
295 QVERIFY( profileSettings.mKeyTouchScreenVibra == 4); |
|
296 |
|
297 // test with invalid profile ID. |
|
298 profileModel->setProfileSettings( EProfileWapperStart, profileSettings ); |
|
299 profileModel->setProfileSettings( EPRofileWrapperEnd, profileSettings ); |
|
300 profileModel->setProfileSettings( 98, profileSettings ); |
|
301 |
|
302 delete profileModel; |
|
303 } |
|
304 |
|
305 /*! |
|
306 Test Case Description:\n |
|
307 1. Fucntion Name: QString ringTone() const;\n |
|
308 2. Case Descrition: Verify that it return the right active ring tone path. \n |
|
309 3. Input Parameters: \n |
|
310 <1> set ringtone for profiles. \n |
|
311 <2> no ringtone is set. \n |
|
312 4. Expected result: \n |
|
313 <1> return the right path \n |
|
314 <2> return QString() \n |
|
315 */ |
|
316 void TestCpProfileModel::testRingToneOfActive() |
|
317 { |
|
318 CpProfileModel *profileModel = new CpProfileModel(); |
|
319 // set a ringtone for profiles. |
|
320 profileModel->setRingTone(ringTonePath1); |
|
321 QString retRingTonePath1 = profileModel->ringTone(); |
|
322 QVERIFY( retRingTonePath1 == ringTonePath1 ); |
|
323 // no ringtone is set. |
|
324 profileModel->setRingTone(QString()); |
|
325 QString retRingTonePath2 = profileModel->ringTone(); |
|
326 QVERIFY( retRingTonePath2 == QString() ); |
|
327 |
|
328 delete profileModel; |
|
329 } |
|
330 |
|
331 /*! |
|
332 Test Case Description:\n |
|
333 1. Fucntion Name: void setRingTone(const QString& filePath);\n |
|
334 2. Case Descrition: Verify that it can set ring tone successfully with valid sound path. \n |
|
335 3. Input Parameters: \n |
|
336 <1> soundPath = QString(), \n |
|
337 4. Expected result: \n |
|
338 <1> profileModel->ringTone() == soundPath \n |
|
339 */ |
|
340 void TestCpProfileModel::testSetRingToneAllWithValidPath() |
|
341 { |
|
342 CpProfileModel *profileModel = new CpProfileModel(); |
|
343 |
|
344 profileModel->setRingTone(ringTonePath1); |
|
345 QVERIFY( profileModel->ringTone() == ringTonePath1 ); |
|
346 |
|
347 delete profileModel; |
|
348 } |
|
349 |
|
350 /*! |
|
351 Test Case Description:\n |
|
352 1. Fucntion Name: void setRingTone(const QString& filePath);\n |
|
353 2. Case Descrition: Verify that no crash when setting ring tone with invalid sound path. \n |
|
354 3. Input Parameters: \n |
|
355 <1> path = QString(), \n |
|
356 <2> path = QString(XX), XX is an invalid path \n |
|
357 4. Expected result: \n |
|
358 <1> profileModel->ringTone() == QString() \n |
|
359 <2> profileModel->ringTone() == path \n |
|
360 */ |
|
361 void TestCpProfileModel::testSetRingToneAllWithInvalidPath() |
|
362 { |
|
363 QString inValidPath = "Z:/InvalidSoundPath"; |
|
364 CpProfileModel *profileModel = new CpProfileModel(); |
|
365 // using empty path. |
|
366 profileModel->setRingTone( QString() ); |
|
367 QVERIFY( profileModel->ringTone() == QString() ); |
|
368 // using an invalid path. |
|
369 profileModel->setRingTone( QString( inValidPath ) ); |
|
370 QString retStr = profileModel->ringTone(); |
|
371 QVERIFY( profileModel->ringTone() == inValidPath ); |
|
372 |
|
373 delete profileModel; |
|
374 } |
|
375 /*! |
|
376 Test Case Description:\n |
|
377 1. Fucntion Name: int void setMasterVolume(int volume);\n |
|
378 2. Case Descrition: Verify that the valid volume can be set correctly \n |
|
379 3. Input Parameters: \n |
|
380 <1> volume = int X, X = {1,2,3,4,5,6,7,8,9,10} \n |
|
381 4. Expected result: \n |
|
382 <1> profileModel->masterVolume() == X. \n |
|
383 */ |
|
384 void TestCpProfileModel::testSetMasterWithValidVolume() |
|
385 { |
|
386 CpProfileModel *profileModel = new CpProfileModel(); |
|
387 |
|
388 for( int i = EProfileRingingVolumeLevel1; i <= EProfileRingingVolumeLevel10; i++ ) |
|
389 { |
|
390 profileModel->setMasterVolume(i); |
|
391 QVERIFY( profileModel->masterVolume() == i ); |
|
392 } |
|
393 delete profileModel; |
|
394 } |
|
395 |
|
396 /*! |
|
397 Test Case Description:\n |
|
398 1. Fucntion Name: int void setMasterVolume(int volume);\n |
|
399 2. Case Descrition: Verify that no crash when using \n |
|
400 3. Input Parameters: \n |
|
401 <1> volume = -8 \n |
|
402 <2> volume = 230 \n |
|
403 4. Expected result: \n |
|
404 <1> no crash and the master volume is not changed. \n |
|
405 <2> no crash and the master volume is not changed. \n |
|
406 */ |
|
407 void TestCpProfileModel::testSetMasterWithInvalidVolume() |
|
408 { |
|
409 CpProfileModel *profileModel = new CpProfileModel(); |
|
410 int oldVolume = profileModel->masterVolume(); |
|
411 |
|
412 profileModel->setMasterVolume( -8 ); |
|
413 QVERIFY( profileModel->masterVolume() == oldVolume ); |
|
414 |
|
415 profileModel->setMasterVolume( 230 ); |
|
416 QVERIFY( profileModel->masterVolume() == oldVolume ); |
|
417 |
|
418 delete profileModel; |
|
419 } |
|
420 /*! |
|
421 Test Case Description:\n |
|
422 1. Fucntion Name: int masterVolume() const;\n |
|
423 2. Case Descrition: Verify that it returns the right master volume for device. \n |
|
424 3. Input Parameters: \n |
|
425 <1> setMasterVolume( EProfileRingingVolumeLevel3 ) \n |
|
426 4. Expected result: \n |
|
427 <1> returnMasterVolume == EProfileRingingVolumeLevel3 \n |
|
428 */ |
|
429 void TestCpProfileModel::testMasterVolume() |
|
430 { |
|
431 CpProfileModel *profileModel = new CpProfileModel(); |
|
432 profileModel->setMasterVolume( EProfileRingingVolumeLevel3 ); |
|
433 |
|
434 int returnMasterVolume = profileModel->masterVolume(); |
|
435 QVERIFY( returnMasterVolume == EProfileRingingVolumeLevel3 ); |
|
436 |
|
437 delete profileModel; |
|
438 } |
|
439 |
|
440 /*! |
|
441 Test Case Description:\n |
|
442 1. Fucntion Name: \n |
|
443 void setMasterVibra(bool isVibra);\n |
|
444 2. Case Descrition: Verify that the master vibra's status can be set successfully. \n |
|
445 3. Input Parameters: \n |
|
446 <1> isVibra = true; \n |
|
447 <2> isVibra = false; \n |
|
448 4. Expected result: \n |
|
449 <1> profileModel->masterVibra() == true. \n |
|
450 <1> profileModel->masterVibra() == false. \n |
|
451 */ |
|
452 void TestCpProfileModel::testSetMasterVibra() |
|
453 { |
|
454 CpProfileModel *profileModel = new CpProfileModel(); |
|
455 |
|
456 profileModel->setMasterVibra(true); |
|
457 QVERIFY( profileModel->masterVibra() == true ); |
|
458 |
|
459 profileModel->setMasterVibra(false); |
|
460 QVERIFY( profileModel->masterVibra() == false ); |
|
461 |
|
462 delete profileModel; |
|
463 } |
|
464 |
|
465 /*! |
|
466 Test Case Description:\n |
|
467 1. Fucntion Name: \n |
|
468 bool masterVibra() const;\n |
|
469 2. Case Descrition: Verify that it returns the correct master vibra's status. \n |
|
470 3. Input Parameters: \n |
|
471 <1> isVibra = true; \n |
|
472 <2> isVibra = false; \n |
|
473 4. Expected result: \n |
|
474 <1> profileModel->masterVibra() == true. \n |
|
475 <1> profileModel->masterVibra() == false. \n |
|
476 */ |
|
477 void TestCpProfileModel::testMasterVibra() |
|
478 { |
|
479 CpProfileModel *profileModel = new CpProfileModel(); |
|
480 |
|
481 profileModel->setMasterVibra(true); |
|
482 QVERIFY( profileModel->masterVibra() == true ); |
|
483 |
|
484 profileModel->setMasterVibra(false); |
|
485 QVERIFY( profileModel->masterVibra() == false ); |
|
486 |
|
487 delete profileModel; |
|
488 } |
|
489 /*! |
|
490 Test Case Description:\n |
|
491 1. Fucntion Name: \n |
|
492 void setSilenceMode(bool isSlience);\n |
|
493 2. Case Descrition: Verify the right slicence mode can be set. \n |
|
494 3. Input Parameters: \n |
|
495 <1> isSlience = true; \n |
|
496 <2> isSlience = false; \n |
|
497 4. Expected result: \n |
|
498 <1> profileModel->silenceMode() == true. \n |
|
499 <1> profileModel->silenceMode() == false. \n |
|
500 */ |
|
501 void TestCpProfileModel::testSetSilenceMode() |
|
502 { |
|
503 CpProfileModel *profileModel = new CpProfileModel(); |
|
504 |
|
505 profileModel->setSilenceMode(true); |
|
506 QVERIFY( profileModel->silenceMode() == true ); |
|
507 |
|
508 profileModel->setSilenceMode(false); |
|
509 QVERIFY( profileModel->silenceMode() == false ); |
|
510 |
|
511 delete profileModel; |
|
512 } |
|
513 |
|
514 /*! |
|
515 Test Case Description:\n |
|
516 1. Fucntion Name: \n |
|
517 bool silenceMode() const;\n |
|
518 void setSilenceMode(bool isSlience);\n |
|
519 2. Case Descrition: Verify it get the correct silence mode of device. \n |
|
520 3. Input Parameters: \n |
|
521 <1> isSlience = true; \n |
|
522 <2> isSlience = false; \n |
|
523 4. Expected result: \n |
|
524 <1> profileModel->silenceMode() == true. \n |
|
525 <1> profileModel->silenceMode() == false. \n |
|
526 */ |
|
527 void TestCpProfileModel::testSilenceMode() |
|
528 { |
|
529 CpProfileModel *profileModel = new CpProfileModel(); |
|
530 |
|
531 profileModel->setSilenceMode(true); |
|
532 QVERIFY( profileModel->silenceMode() == true ); |
|
533 |
|
534 profileModel->setSilenceMode(false); |
|
535 QVERIFY( profileModel->silenceMode() == false ); |
|
536 |
|
537 delete profileModel; |
|
538 } |
|
539 |
|
540 /*! |
|
541 Test Case Description:\n |
|
542 1. Fucntion Name: QString ringTone(int profileId)const; \n |
|
543 2. Case Descrition: Verify that it can return the right ringtone when using valid profile ID. \n |
|
544 3. Input Parameters: \n |
|
545 <1> profileId = EProfileWrapperGeneralId, set ringtone with ringTonePath1 \n |
|
546 <2> profileId = EProfileWrapperMeetingId, set ringtone with ringTonePath2 \n |
|
547 4. Expected result: \n |
|
548 <1> profileModel->ringTone(EProfileWrapperGeneralId) == ringTonePath1 \n |
|
549 <2> profileModel->ringTone(EProfileWrapperMeetingId) == ringTonePath2 \n |
|
550 */ |
|
551 void TestCpProfileModel::testRingToneWithValidID() |
|
552 { |
|
553 CpProfileModel *profileModel = new CpProfileModel(); |
|
554 |
|
555 profileModel->setRingTone( EProfileWrapperGeneralId, ringTonePath1 ); |
|
556 QVERIFY( profileModel->ringTone(EProfileWrapperGeneralId) == ringTonePath1 ); |
|
557 |
|
558 profileModel->setRingTone( EProfileWrapperMeetingId, ringTonePath2 ); |
|
559 QVERIFY( profileModel->ringTone(EProfileWrapperMeetingId) == ringTonePath2 ); |
|
560 |
|
561 delete profileModel; |
|
562 } |
|
563 |
|
564 /*! |
|
565 Test Case Description:\n |
|
566 1. Fucntion Name: QString ringTone(int profileId)const; \n |
|
567 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n |
|
568 3. Input Parameters: \n |
|
569 <1> profileId = EProfileWapperStart,\n |
|
570 <2> profileId = EPRofileWrapperEnd,\n |
|
571 <3> profileId = -9,\n |
|
572 <4> profileId = 100,\n |
|
573 4. Expected result: \n |
|
574 <1> no crash and return QString() \n |
|
575 <2> no crash and return QString() \n |
|
576 <3> no crash and return QString() \n |
|
577 <4> no crash and return QString() \n |
|
578 */ |
|
579 void TestCpProfileModel::testRingToneWithInvalidID() |
|
580 { |
|
581 CpProfileModel *profileModel = new CpProfileModel(); |
|
582 // set ring tone for all profile |
|
583 profileModel->setRingTone(ringTonePath1); |
|
584 |
|
585 QVERIFY( profileModel->ringTone( EProfileWapperStart ) == QString() ); |
|
586 QVERIFY( profileModel->ringTone( EPRofileWrapperEnd ) == QString() ); |
|
587 QVERIFY( profileModel->ringTone( -9 ) == QString() ); |
|
588 QVERIFY( profileModel->ringTone( 100 ) == QString() ); |
|
589 |
|
590 delete profileModel; |
|
591 } |
|
592 |
|
593 /*! |
|
594 Test Case Description:\n |
|
595 1. Fucntion Name: void setRingTone(int profileId, const QString& filePath); \n |
|
596 2. Case Descrition: Verify that it can set the profile ringtone successfully with valid profile ID. \n |
|
597 3. Input Parameters: \n |
|
598 <1> profileId = EProfileWrapperGeneralId, filePath = QString(ringTonePath) \n |
|
599 <2> profileId = EProfileWrapperMeetingId, filePath = QString() \n |
|
600 4. Expected result: \n |
|
601 <1> profileModel->ringTone(EProfileWrapperGeneralId) == ringTonePath \n |
|
602 <2> profileModel->ringTone(EProfileWrapperMeetingId) == QString() \n |
|
603 */ |
|
604 void TestCpProfileModel::testSetRingToneWithValidID() |
|
605 { |
|
606 CpProfileModel *profileModel = new CpProfileModel(); |
|
607 |
|
608 profileModel->setRingTone(EProfileWrapperGeneralId, ringTonePath2); |
|
609 QVERIFY( profileModel->ringTone(EProfileWrapperGeneralId) == ringTonePath2 ); |
|
610 |
|
611 profileModel->setRingTone(EProfileWrapperMeetingId, QString()); |
|
612 QVERIFY( profileModel->ringTone(EProfileWrapperMeetingId) == QString() ); |
|
613 |
|
614 delete profileModel; |
|
615 } |
|
616 |
|
617 /*! |
|
618 Test Case Description:\n |
|
619 1. Fucntion Name: void setRingTone(int profileId, const QString& filePath); \n |
|
620 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n |
|
621 3. Input Parameters: \n |
|
622 <1> profileId = EProfileWapperStart,\n |
|
623 <2> profileId = EPRofileWrapperEnd,\n |
|
624 <3> profileId = -19,\n |
|
625 <4> profileId = 101,\n |
|
626 4. Expected result: \n |
|
627 <1> no crash \n |
|
628 <2> no crash \n |
|
629 <3> no crash \n |
|
630 <4> no crash \n |
|
631 */ |
|
632 void TestCpProfileModel::testSetRingToneWithInvalidID() |
|
633 { |
|
634 CpProfileModel *profileModel = new CpProfileModel(); |
|
635 |
|
636 profileModel->setRingTone(EProfileWapperStart, ringTonePath2); |
|
637 |
|
638 profileModel->setRingTone(EPRofileWrapperEnd, ringTonePath2); |
|
639 |
|
640 profileModel->setRingTone(-19, ringTonePath2); |
|
641 |
|
642 profileModel->setRingTone(101, ringTonePath2); |
|
643 |
|
644 delete profileModel; |
|
645 } |
|
646 |
|
647 /*! |
|
648 Test Case Description:\n |
|
649 1. Fucntion Name: QString messageTone(int profileId) const; \n |
|
650 2. Case Descrition: Verify that it can return the right message tone when using valid profile ID. \n |
|
651 3. Input Parameters: \n |
|
652 <1> profileId = EProfileWrapperGeneralId, set ringtone with soundPath1 \n |
|
653 <2> profileId = EProfileWrapperMeetingId, set ringtone with soundTonePath2 \n |
|
654 4. Expected result: \n |
|
655 <1> profileModel->messageTone(EProfileWrapperGeneralId) == soundPath1 \n |
|
656 <2> profileModel->messageTone(EProfileWrapperMeetingId) == soundPath2 \n |
|
657 */ |
|
658 void TestCpProfileModel::testMessageToneWithValidID() |
|
659 { |
|
660 CpProfileModel *profileModel = new CpProfileModel(); |
|
661 |
|
662 profileModel->setMessageTone( EProfileWrapperGeneralId, ringTonePath1 ); |
|
663 QVERIFY( profileModel->messageTone(EProfileWrapperGeneralId) == ringTonePath1 ); |
|
664 |
|
665 profileModel->setMessageTone( EProfileWrapperMeetingId, ringTonePath2 ); |
|
666 QVERIFY( profileModel->messageTone(EProfileWrapperMeetingId) == ringTonePath2 ); |
|
667 |
|
668 delete profileModel; |
|
669 } |
|
670 |
|
671 /*! |
|
672 Test Case Description:\n |
|
673 1. Fucntion Name: QString messageTone(int profileId) const; \n |
|
674 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n |
|
675 3. Input Parameters: \n |
|
676 <1> profileId = EProfileWapperStart,\n |
|
677 <2> profileId = EPRofileWrapperEnd,\n |
|
678 <3> profileId = -9,\n |
|
679 <4> profileId = 59,\n |
|
680 4. Expected result: \n |
|
681 <1> no crash and return QString() \n |
|
682 <2> no crash and return QString() \n |
|
683 <3> no crash and return QString() \n |
|
684 <4> no crash and return QString() \n |
|
685 */ |
|
686 void TestCpProfileModel::testMessageToneWithInvalidID() |
|
687 { |
|
688 CpProfileModel *profileModel = new CpProfileModel(); |
|
689 |
|
690 QVERIFY( profileModel->messageTone( EProfileWapperStart ) == QString() ); |
|
691 QVERIFY( profileModel->messageTone( EPRofileWrapperEnd ) == QString() ); |
|
692 QVERIFY( profileModel->messageTone( -9 ) == QString() ); |
|
693 QVERIFY( profileModel->messageTone( 59 ) == QString() ); |
|
694 |
|
695 delete profileModel; |
|
696 } |
|
697 |
|
698 /*! |
|
699 Test Case Description:\n |
|
700 1. Fucntion Name: void setMessageTone(int profileId, const QString& filePath); \n |
|
701 2. Case Descrition: Verify that it can set the message tone successfully with valid profile ID. \n |
|
702 3. Input Parameters: \n |
|
703 <1> profileId = EProfileWrapperGeneralId, filePath = QString(soundPath) \n |
|
704 <2> profileId = EProfileWrapperMeetingId, filePath = QString() \n |
|
705 4. Expected result: \n \n |
|
706 <1> profileModel->messageTone(EProfileWrapperGeneralId) == ringTonePath \n |
|
707 <2> profileModel->messageTone(EProfileWrapperMeetingId) == QString() \n |
|
708 */ |
|
709 void TestCpProfileModel::testSetMessageToneWithValidID() |
|
710 { |
|
711 QString soundPath2 = QString("C:/unavailable path"); |
|
712 CpProfileModel *profileModel = new CpProfileModel(); |
|
713 |
|
714 profileModel->setMessageTone( EProfileWrapperGeneralId, ringTonePath1 ); |
|
715 QVERIFY( profileModel->messageTone(EProfileWrapperGeneralId) == ringTonePath1 ); |
|
716 // set an unavailable path. |
|
717 profileModel->setMessageTone( EProfileWrapperGeneralId, soundPath2 ); |
|
718 QVERIFY( profileModel->messageTone(EProfileWrapperGeneralId) == soundPath2 ); |
|
719 |
|
720 profileModel->setMessageTone( EProfileWrapperMeetingId, QString() ); |
|
721 QVERIFY( profileModel->messageTone(EProfileWrapperMeetingId) == QString() ); |
|
722 |
|
723 delete profileModel; |
|
724 } |
|
725 |
|
726 /*! |
|
727 Test Case Description:\n |
|
728 1. Fucntion Name: void setMessageTone(int profileId, const QString& filePath); \n |
|
729 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n |
|
730 3. Input Parameters: \n |
|
731 <1> profileId = EProfileWapperStart,\n |
|
732 <2> profileId = EPRofileWrapperEnd,\n |
|
733 <3> profileId = -100,\n |
|
734 <4> profileId = 100,\n |
|
735 4. Expected result: \n \n |
|
736 <1> no crash \n |
|
737 <2> no crash \n |
|
738 <3> no crash \n |
|
739 <4> no crash \n |
|
740 */ |
|
741 void TestCpProfileModel::testSetMessageToneWithInvalidID() |
|
742 { |
|
743 CpProfileModel *profileModel = new CpProfileModel(); |
|
744 |
|
745 profileModel->setMessageTone( EProfileWapperStart, ringTonePath1 ); |
|
746 // QVERIFY( profileModel->messageTone(EProfileWapperStart) == QString() ); |
|
747 |
|
748 profileModel->setMessageTone( EPRofileWrapperEnd, QString() ); |
|
749 // QVERIFY( profileModel->messageTone(EPRofileWrapperEnd) == QString() ); |
|
750 |
|
751 profileModel->setMessageTone( -100, ringTonePath1 ); |
|
752 // QVERIFY( profileModel->messageTone(-100) == QString() ); |
|
753 |
|
754 profileModel->setMessageTone( 100, QString() ); |
|
755 // QVERIFY( profileModel->messageTone(100) == QString() ); |
|
756 |
|
757 delete profileModel; |
|
758 } |
|
759 |
|
760 /*! |
|
761 Test Case Description:\n |
|
762 1. Fucntion Name: QString emailTone(int profileId) const; \n |
|
763 2. Case Descrition: Verify that it can return the right email tone when using valid profile ID. \n |
|
764 3. Input Parameters: \n |
|
765 <1> profileId = EProfileWrapperGeneralId, set ringtone with soundPath1 \n |
|
766 <2> profileId = EProfileWrapperMeetingId, set ringtone with soundTonePath2 \n |
|
767 4. Expected result: \n |
|
768 <1> profileModel->emailTone(EProfileWrapperGeneralId) == soundPath1 \n |
|
769 <2> profileModel->emailTone(EProfileWrapperMeetingId) == soundPath2 \n |
|
770 */ |
|
771 void TestCpProfileModel::testEmailToneWithValidID() |
|
772 { |
|
773 CpProfileModel *profileModel = new CpProfileModel(); |
|
774 |
|
775 profileModel->setEmailTone( EProfileWrapperGeneralId, ringTonePath1 ); |
|
776 QVERIFY( profileModel->emailTone(EProfileWrapperGeneralId) == ringTonePath1 ); |
|
777 |
|
778 profileModel->setEmailTone( EProfileWrapperMeetingId, ringTonePath2 ); |
|
779 QVERIFY( profileModel->emailTone(EProfileWrapperMeetingId) == ringTonePath2 ); |
|
780 |
|
781 delete profileModel; |
|
782 } |
|
783 |
|
784 /*! |
|
785 Test Case Description:\n |
|
786 1. Fucntion Name: QString emailTone(int profileId) const; \n |
|
787 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n |
|
788 3. Input Parameters: \n |
|
789 <1> profileId = EProfileWapperStart,\n |
|
790 <2> profileId = EPRofileWrapperEnd,\n |
|
791 <3> profileId = -9,\n |
|
792 <4> profileId = 59,\n |
|
793 4. Expected result: \n |
|
794 <1> no crash and return QString() \n |
|
795 <2> no crash and return QString() \n |
|
796 <3> no crash and return QString() \n |
|
797 <4> no crash and return QString() \n |
|
798 */ |
|
799 void TestCpProfileModel::testEmailToneWithInvalidID() |
|
800 { |
|
801 CpProfileModel *profileModel = new CpProfileModel(); |
|
802 |
|
803 QVERIFY( profileModel->emailTone( EProfileWapperStart ) == QString() ); |
|
804 QVERIFY( profileModel->emailTone( EPRofileWrapperEnd ) == QString() ); |
|
805 QVERIFY( profileModel->emailTone( -9 ) == QString() ); |
|
806 QVERIFY( profileModel->emailTone( 59 ) == QString() ); |
|
807 |
|
808 delete profileModel; |
|
809 } |
|
810 |
|
811 /*! |
|
812 Test Case Description:\n |
|
813 1. Fucntion Name: void setEmailTone(int profileId, const QString& filePath); \n |
|
814 2. Case Descrition: Verify that it can set the email tone successfully with valid profile ID. \n |
|
815 3. Input Parameters: \n |
|
816 <1> profileId = EProfileWrapperGeneralId, filePath = QString(soundPath) \n |
|
817 <2> profileId = EProfileWrapperMeetingId, filePath = QString() \n |
|
818 4. Expected result: \n \n |
|
819 <1> profileModel->emailTone(EProfileWrapperGeneralId) == soundPath \n |
|
820 <2> profileModel->emailTone(EProfileWrapperMeetingId) == QString() \n |
|
821 */ |
|
822 void TestCpProfileModel::testSetEmailToneWithValidID() |
|
823 { |
|
824 QString soundPath2 = QString("C:/unavailable path"); |
|
825 CpProfileModel *profileModel = new CpProfileModel(); |
|
826 |
|
827 profileModel->setEmailTone( EProfileWrapperGeneralId, ringTonePath1 ); |
|
828 QVERIFY( profileModel->emailTone(EProfileWrapperGeneralId) == ringTonePath1 ); |
|
829 // set an unavailable path. |
|
830 profileModel->setEmailTone( EProfileWrapperGeneralId, soundPath2 ); |
|
831 QVERIFY( profileModel->emailTone(EProfileWrapperGeneralId) == soundPath2 ); |
|
832 |
|
833 profileModel->setEmailTone( EProfileWrapperMeetingId, QString() ); |
|
834 QVERIFY( profileModel->emailTone(EProfileWrapperMeetingId) == QString() ); |
|
835 |
|
836 delete profileModel; |
|
837 } |
|
838 |
|
839 /*! |
|
840 Test Case Description:\n |
|
841 1. Fucntion Name: void setEmailTone(int profileId, const QString& filePath); \n |
|
842 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n |
|
843 3. Input Parameters: \n |
|
844 <1> profileId = EProfileWapperStart,\n |
|
845 <2> profileId = EPRofileWrapperEnd,\n |
|
846 <3> profileId = -100,\n |
|
847 <4> profileId = 100,\n |
|
848 4. Expected result: \n \n |
|
849 <1> no crash \n |
|
850 <2> no crash \n |
|
851 <3> no crash \n |
|
852 <4> no crash \n |
|
853 */ |
|
854 void TestCpProfileModel::testSetEmailToneWithInvalidID() |
|
855 { |
|
856 CpProfileModel *profileModel = new CpProfileModel(); |
|
857 |
|
858 profileModel->setEmailTone( EProfileWapperStart, ringTonePath1 ); |
|
859 // QVERIFY( profileModel->emailTone(EProfileWapperStart) == QString() ); |
|
860 |
|
861 profileModel->setEmailTone( EPRofileWrapperEnd, QString() ); |
|
862 // QVERIFY( profileModel->emailTone(EPRofileWrapperEnd) == QString() ); |
|
863 |
|
864 profileModel->setEmailTone( -100, ringTonePath1 ); |
|
865 // QVERIFY( profileModel->emailTone(-100) == QString() ); |
|
866 |
|
867 profileModel->setEmailTone( 100, QString() ); |
|
868 // QVERIFY( profileModel->emailTone(100) == QString() ); |
|
869 |
|
870 delete profileModel; |
|
871 } |
|
872 |
|
873 /*! |
|
874 Test Case Description:\n |
|
875 1. Fucntion Name: QString reminderTone(int profileId) const; \n |
|
876 2. Case Descrition: Verify that it can return the right reminder tone when using valid profile ID. \n |
|
877 3. Input Parameters: \n |
|
878 <1> profileId = EProfileWrapperGeneralId, set ringtone with soundPath1 \n |
|
879 <2> profileId = EProfileWrapperMeetingId, set ringtone with soundTonePath2 \n |
|
880 4. Expected result: \n |
|
881 <1> profileModel->reminderTone(EProfileWrapperGeneralId) == soundPath1 \n |
|
882 <2> profileModel->reminderTone(EProfileWrapperMeetingId) == soundPath2 \n |
|
883 */ |
|
884 void TestCpProfileModel::testReminderToneWithValidID() |
|
885 { |
|
886 CpProfileModel *profileModel = new CpProfileModel(); |
|
887 |
|
888 profileModel->setReminderTone( EProfileWrapperGeneralId, ringTonePath1 ); |
|
889 QVERIFY( profileModel->reminderTone(EProfileWrapperGeneralId) == ringTonePath1 ); |
|
890 |
|
891 profileModel->setReminderTone( EProfileWrapperMeetingId, ringTonePath2 ); |
|
892 QVERIFY( profileModel->reminderTone(EProfileWrapperMeetingId) == ringTonePath2 ); |
|
893 |
|
894 delete profileModel; |
|
895 } |
|
896 |
|
897 /*! |
|
898 Test Case Description:\n |
|
899 1. Fucntion Name: QString reminderTone(int profileId) const; \n |
|
900 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n |
|
901 3. Input Parameters: \n |
|
902 <1> profileId = EProfileWapperStart,\n |
|
903 <2> profileId = EPRofileWrapperEnd,\n |
|
904 <3> profileId = -9,\n |
|
905 <4> profileId = 59,\n |
|
906 4. Expected result: \n |
|
907 <1> no crash and return QString() \n |
|
908 <2> no crash and return QString() \n |
|
909 <3> no crash and return QString() \n |
|
910 <4> no crash and return QString() \n |
|
911 */ |
|
912 void TestCpProfileModel::testReminderToneWithInvalidID() |
|
913 { |
|
914 CpProfileModel *profileModel = new CpProfileModel(); |
|
915 |
|
916 QVERIFY( profileModel->reminderTone( EProfileWapperStart ) == QString() ); |
|
917 QVERIFY( profileModel->reminderTone( EPRofileWrapperEnd ) == QString() ); |
|
918 QVERIFY( profileModel->reminderTone( -9 ) == QString() ); |
|
919 QVERIFY( profileModel->reminderTone( 59 ) == QString() ); |
|
920 |
|
921 delete profileModel; |
|
922 } |
|
923 |
|
924 /*! |
|
925 Test Case Description:\n |
|
926 1. Fucntion Name: void setReminderTone(int profileId, const QString& filePath); \n |
|
927 2. Case Descrition: Verify that it can set the reminder tone successfully with valid profile ID. \n |
|
928 3. Input Parameters: \n |
|
929 <1> profileId = EProfileWrapperGeneralId, filePath = QString(soundPath) \n |
|
930 <2> profileId = EProfileWrapperMeetingId, filePath = QString() \n |
|
931 4. Expected result: \n \n |
|
932 <1> profileModel->reminderTone(EProfileWrapperGeneralId) == soundPath \n |
|
933 <2> profileModel->reminderTone(EProfileWrapperMeetingId) == QString() \n |
|
934 */ |
|
935 void TestCpProfileModel::testSetReminderToneWithValidID() |
|
936 { |
|
937 CpProfileModel *profileModel = new CpProfileModel(); |
|
938 |
|
939 profileModel->setReminderTone( EProfileWrapperGeneralId, ringTonePath1 ); |
|
940 QVERIFY( profileModel->reminderTone(EProfileWrapperGeneralId) == ringTonePath1 ); |
|
941 // set an unavailable path. |
|
942 profileModel->setReminderTone( EProfileWrapperGeneralId, ringTonePath2 ); |
|
943 QVERIFY( profileModel->reminderTone(EProfileWrapperGeneralId) == ringTonePath2 ); |
|
944 |
|
945 profileModel->setReminderTone( EProfileWrapperMeetingId, QString() ); |
|
946 QVERIFY( profileModel->reminderTone(EProfileWrapperMeetingId) == QString() ); |
|
947 |
|
948 delete profileModel; |
|
949 } |
|
950 |
|
951 /*! |
|
952 Test Case Description:\n |
|
953 1. Fucntion Name: void setReminderTone(int profileId, const QString& filePath); \n |
|
954 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n |
|
955 3. Input Parameters: \n |
|
956 <1> profileId = EProfileWapperStart,\n |
|
957 <2> profileId = EPRofileWrapperEnd,\n |
|
958 <3> profileId = -100,\n |
|
959 <4> profileId = 100,\n |
|
960 4. Expected result: \n |
|
961 <1> no crash \n |
|
962 <2> no crash \n |
|
963 <3> no crash \n |
|
964 <4> no crash \n |
|
965 */ |
|
966 void TestCpProfileModel::testSetReminderToneWithInvalidID() |
|
967 { |
|
968 CpProfileModel *profileModel = new CpProfileModel(); |
|
969 |
|
970 profileModel->setReminderTone( EProfileWapperStart, ringTonePath1 ); |
|
971 // QVERIFY( profileModel->reminderTone(EProfileWapperStart) == QString() ); |
|
972 |
|
973 profileModel->setReminderTone( EPRofileWrapperEnd, QString() ); |
|
974 // QVERIFY( profileModel->reminderTone(EPRofileWrapperEnd) == QString() ); |
|
975 |
|
976 profileModel->setReminderTone( -100, ringTonePath1 ); |
|
977 // QVERIFY( profileModel->reminderTone(-100) == QString() ); |
|
978 |
|
979 profileModel->setReminderTone( 100, QString() ); |
|
980 // QVERIFY( profileModel->reminderTone(100) == QString() ); |
|
981 |
|
982 delete profileModel; |
|
983 } |
|
984 |
|
985 /*! |
|
986 Test Case Description:\n |
|
987 1. Fucntion Name: QString notificationTone(int profileId) const; \n |
|
988 2. Case Descrition: Verify that it can return the right notification tone when using valid profile ID. \n |
|
989 3. Input Parameters: \n |
|
990 <1> profileId = EProfileWrapperGeneralId, isActive = true \n |
|
991 <2> profileId = EProfileWrapperMeetingId, isActive = false \n |
|
992 4. Expected result: \n |
|
993 <1> profileModel->notificationTone(EProfileWrapperGeneralId) == true \n |
|
994 <2> profileModel->notificationTone(EProfileWrapperMeetingId) == false \n |
|
995 */ |
|
996 void TestCpProfileModel::testNotificationToneWithValidID() |
|
997 { |
|
998 CpProfileModel *profileModel = new CpProfileModel(); |
|
999 |
|
1000 profileModel->setNotificationTone( EProfileWrapperGeneralId, true ); |
|
1001 QVERIFY( profileModel->notificationTone(EProfileWrapperGeneralId) == true ); |
|
1002 |
|
1003 profileModel->setNotificationTone( EProfileWrapperMeetingId, false ); |
|
1004 QVERIFY( profileModel->notificationTone(EProfileWrapperMeetingId) == false ); |
|
1005 |
|
1006 delete profileModel; |
|
1007 } |
|
1008 |
|
1009 /*! |
|
1010 Test Case Description:\n |
|
1011 1. Fucntion Name: QString notificationTone(int profileId) const; \n |
|
1012 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n |
|
1013 3. Input Parameters: \n |
|
1014 <1> profileId = EProfileWapperStart,\n |
|
1015 <2> profileId = EPRofileWrapperEnd,\n |
|
1016 <3> profileId = -9,\n |
|
1017 <4> profileId = 59,\n |
|
1018 4. Expected result: \n |
|
1019 <1> no crash and return QString() \n |
|
1020 <2> no crash and return QString() \n |
|
1021 <3> no crash and return QString() \n |
|
1022 <4> no crash and return QString() \n |
|
1023 */ |
|
1024 void TestCpProfileModel::testNotificationToneWithInvalidID() |
|
1025 { |
|
1026 CpProfileModel *profileModel = new CpProfileModel(); |
|
1027 |
|
1028 QVERIFY( profileModel->notificationTone( EProfileWapperStart ) == false ); |
|
1029 QVERIFY( profileModel->notificationTone( EPRofileWrapperEnd ) == false ); |
|
1030 QVERIFY( profileModel->notificationTone( -9 ) == false ); |
|
1031 QVERIFY( profileModel->notificationTone( 59 ) == false ); |
|
1032 |
|
1033 delete profileModel; |
|
1034 } |
|
1035 |
|
1036 /*! |
|
1037 Test Case Description:\n |
|
1038 1. Fucntion Name: void setNotificationTone(int profileId, const QString& filePath); \n |
|
1039 2. Case Descrition: Verify that it can set the notification tone successfully with valid profile ID. \n |
|
1040 3. Input Parameters: \n |
|
1041 <1> profileId = EProfileWrapperGeneralId, isActive = true \n |
|
1042 <2> profileId = EProfileWrapperMeetingId, isActive = false \n |
|
1043 4. Expected result: \n \n |
|
1044 <1> profileModel->notificationTone(EProfileWrapperGeneralId) == true \n |
|
1045 <2> profileModel->notificationTone(EProfileWrapperMeetingId) == false \n |
|
1046 */ |
|
1047 void TestCpProfileModel::testSetNotificationTone() |
|
1048 { |
|
1049 CpProfileModel *profileModel = new CpProfileModel(); |
|
1050 |
|
1051 profileModel->setNotificationTone( EProfileWrapperGeneralId, true ); |
|
1052 QVERIFY( profileModel->notificationTone(EProfileWrapperGeneralId) == true ); |
|
1053 |
|
1054 profileModel->setNotificationTone( EProfileWrapperGeneralId, false ); |
|
1055 QVERIFY( profileModel->notificationTone(EProfileWrapperGeneralId) == false ); |
|
1056 |
|
1057 delete profileModel; |
|
1058 } |
|
1059 |
|
1060 /*! |
|
1061 Test Case Description:\n |
|
1062 1. Fucntion Name: \n |
|
1063 void setKeyTouchScreenTone(int profileId, int level);\n |
|
1064 2. Case Descrition: Verify that the tone of the valid profile can be set with valid level value. \n |
|
1065 3. Input Parameters: \n |
|
1066 <1> profileId = EProfileWrapperGeneralId, level = int X (X = 0,1,2,3,4,5); \n |
|
1067 <2> profileId = EProfileWrapperMeetingId, level = int X; \n |
|
1068 4. Expected result: \n |
|
1069 <1> profileModel->keyTouchScreenTone(EProfileWrapperGeneralId) == X. \n |
|
1070 <2> profileModel->keyTouchScreenTone(EProfileWrapperMeetingId) == X. \n |
|
1071 */ |
|
1072 void TestCpProfileModel::testSetKeyTouchScreenToneWithValidID() |
|
1073 { |
|
1074 CpProfileModel *profileModel = new CpProfileModel(); |
|
1075 |
|
1076 int i = 0; |
|
1077 for ( ; i <= 5; i++ ) { |
|
1078 profileModel->setKeyTouchScreenTone( EProfileWrapperGeneralId, i ); |
|
1079 QVERIFY( profileModel->keyTouchScreenTone( EProfileWrapperGeneralId ) == i ); |
|
1080 |
|
1081 profileModel->setKeyTouchScreenTone( EProfileWrapperMeetingId, i ); |
|
1082 QVERIFY( profileModel->keyTouchScreenTone( EProfileWrapperMeetingId ) == i ); |
|
1083 } |
|
1084 |
|
1085 profileModel->setKeyTouchScreenTone( EProfileWrapperGeneralId, 12 ); |
|
1086 int b = profileModel->keyTouchScreenTone( EProfileWrapperGeneralId ); |
|
1087 |
|
1088 profileModel->setKeyTouchScreenTone( EProfileWrapperMeetingId, -12 ); |
|
1089 int c = profileModel->keyTouchScreenTone( EProfileWrapperMeetingId ); |
|
1090 |
|
1091 delete profileModel; |
|
1092 } |
|
1093 |
|
1094 /*! |
|
1095 Test Case Description:\n |
|
1096 1. Fucntion Name: \n |
|
1097 void setKeyTouchScreenTone(int profileId, int level);\n |
|
1098 2. Case Descrition: Verify that it does not crash with invalid level value. \n |
|
1099 3. Input Parameters: \n |
|
1100 <1> profileId = EProfileWapperStart, level = int X \n |
|
1101 <2> profileId = EPRofileWrapperEnd, level = int X \n |
|
1102 <3> profileId = -8, level = int X \n |
|
1103 <4> profileId = 99, level = int X \n |
|
1104 4. Expected result: \n |
|
1105 <1> no crash \n |
|
1106 <2> no crash \n |
|
1107 <3> no crash \n |
|
1108 <4> no crash \n |
|
1109 */ |
|
1110 void TestCpProfileModel::testSetKeyTouchScreenToneWithInvalidID() |
|
1111 { |
|
1112 CpProfileModel *profileModel = new CpProfileModel(); |
|
1113 |
|
1114 profileModel->setKeyTouchScreenTone( EProfileWapperStart, 4 ); |
|
1115 |
|
1116 profileModel->setKeyTouchScreenTone( EPRofileWrapperEnd, 2 ); |
|
1117 |
|
1118 profileModel->setKeyTouchScreenTone( -8, 4 ); |
|
1119 |
|
1120 profileModel->setKeyTouchScreenTone( 99, 3 ); |
|
1121 |
|
1122 delete profileModel; |
|
1123 } |
|
1124 |
|
1125 /*! |
|
1126 Test Case Description:\n |
|
1127 1. Fucntion Name: \n |
|
1128 int keyTouchScreenTone(int profileId) const; \n |
|
1129 2. Case Descrition: Verify that the tone can be get with valid profile ID. \n |
|
1130 3. Input Parameters: \n |
|
1131 <1> profileId = EProfileWrapperGeneralId \n |
|
1132 <2> profileId = EProfileWrapperMeetingId \n |
|
1133 4. Expected result: \n |
|
1134 <1> return the right tone level. \n |
|
1135 <2> return the right tone level. \n |
|
1136 */ |
|
1137 void TestCpProfileModel::testKeyTouchScreenToneWithValidID() |
|
1138 { |
|
1139 CpProfileModel *profileModel = new CpProfileModel(); |
|
1140 |
|
1141 profileModel->setKeyTouchScreenTone( EProfileWrapperGeneralId, 4 ); |
|
1142 QVERIFY( profileModel->keyTouchScreenTone( EProfileWrapperGeneralId ) == 4); |
|
1143 |
|
1144 profileModel->setKeyTouchScreenTone( EProfileWrapperMeetingId, 5 ); |
|
1145 QVERIFY( profileModel->keyTouchScreenTone( EProfileWrapperMeetingId ) == 5); |
|
1146 |
|
1147 delete profileModel; |
|
1148 } |
|
1149 |
|
1150 /*! |
|
1151 Test Case Description:\n |
|
1152 1. Fucntion Name: \n |
|
1153 int keyTouchScreenTone(int profileId) const; \n |
|
1154 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n |
|
1155 3. Input Parameters: \n |
|
1156 <1> profileId = EProfileWapperStart,\n |
|
1157 <2> profileId = EPRofileWrapperEnd,\n |
|
1158 <3> profileId = -9,\n |
|
1159 <4> profileId = 100,\n |
|
1160 4. Expected result: \n |
|
1161 <1> no crash and return 0 \n |
|
1162 <2> no crash and return 0 \n |
|
1163 <3> no crash and return 0 \n |
|
1164 <4> no crash and return 0 \n |
|
1165 */ |
|
1166 void TestCpProfileModel::testKeyTouchScreenToneWithInvalidID() |
|
1167 { |
|
1168 CpProfileModel *profileModel = new CpProfileModel(); |
|
1169 |
|
1170 QVERIFY( profileModel->keyTouchScreenTone( EProfileWapperStart ) == 0); |
|
1171 QVERIFY( profileModel->keyTouchScreenTone( EPRofileWrapperEnd ) == 0); |
|
1172 QVERIFY( profileModel->keyTouchScreenTone( -9 ) == 0); |
|
1173 QVERIFY( profileModel->keyTouchScreenTone( 100 ) == 0); |
|
1174 |
|
1175 delete profileModel; |
|
1176 } |
|
1177 |
|
1178 /*! |
|
1179 Test Case Description:\n |
|
1180 1. Fucntion Name: \n |
|
1181 void setKeyTouchScreenVibra(int profileId, int level);\n |
|
1182 2. Case Descrition: Verify that the vibra mode of the valid profile can be set with valid level value. \n |
|
1183 3. Input Parameters: \n |
|
1184 <1> profileId = EProfileWrapperGeneralId, level = int X (X = 0,1,2,3,4,5); \n |
|
1185 <2> profileId = EProfileWrapperMeetingId, level = int X; \n |
|
1186 4. Expected result: \n |
|
1187 <1> profileModel->keyTouchScreenVibra(EProfileWrapperGeneralId) == X. \n |
|
1188 <2> profileModel->keyTouchScreenVibra(EProfileWrapperMeetingId) == X. \n |
|
1189 */ |
|
1190 void TestCpProfileModel::testSetKeyTouchScreenVibraWithValidID() |
|
1191 { |
|
1192 CpProfileModel *profileModel = new CpProfileModel(); |
|
1193 |
|
1194 int i = 0; |
|
1195 for ( ; i <= 5; i++ ) { |
|
1196 profileModel->setKeyTouchScreenVibra( EProfileWrapperGeneralId, i ); |
|
1197 QVERIFY( profileModel->keyTouchScreenVibra( EProfileWrapperGeneralId ) == i ); |
|
1198 |
|
1199 profileModel->setKeyTouchScreenVibra( EProfileWrapperMeetingId, i ); |
|
1200 QVERIFY( profileModel->keyTouchScreenVibra( EProfileWrapperMeetingId ) == i ); |
|
1201 } |
|
1202 |
|
1203 profileModel->setKeyTouchScreenVibra( EProfileWrapperGeneralId, 12 ); |
|
1204 int b = profileModel->keyTouchScreenVibra( EProfileWrapperGeneralId ); |
|
1205 |
|
1206 profileModel->setKeyTouchScreenVibra( EProfileWrapperMeetingId, -12 ); |
|
1207 int c = profileModel->keyTouchScreenVibra( EProfileWrapperMeetingId ); |
|
1208 |
|
1209 delete profileModel; |
|
1210 } |
|
1211 |
|
1212 /*! |
|
1213 Test Case Description:\n |
|
1214 1. Fucntion Name: \n |
|
1215 void setKeyTouchScreenVibra(int profileId, int level);\n |
|
1216 2. Case Descrition: Verify that it does not crash with the invalid level value. \n |
|
1217 3. Input Parameters: \n |
|
1218 <1> profileId = EProfileWapperStart, level = int X \n |
|
1219 <2> profileId = EPRofileWrapperEnd, level = int X \n |
|
1220 <3> profileId = -8, level = int X \n |
|
1221 <4> profileId = 99, level = int X \n |
|
1222 4. Expected result: \n |
|
1223 <1> no crash \n |
|
1224 <2> no crash \n |
|
1225 <3> no crash \n |
|
1226 <4> no crash \n |
|
1227 */ |
|
1228 void TestCpProfileModel::testSetKeyTouchScreenVibraWithInvalidID() |
|
1229 { |
|
1230 CpProfileModel *profileModel = new CpProfileModel(); |
|
1231 |
|
1232 profileModel->setKeyTouchScreenVibra( EProfileWapperStart, 4 ); |
|
1233 |
|
1234 profileModel->setKeyTouchScreenVibra( EPRofileWrapperEnd, 2 ); |
|
1235 |
|
1236 profileModel->setKeyTouchScreenVibra( -8, 4 ); |
|
1237 |
|
1238 profileModel->setKeyTouchScreenVibra( 99, 3 ); |
|
1239 |
|
1240 delete profileModel; |
|
1241 } |
|
1242 |
|
1243 /*! |
|
1244 Test Case Description:\n |
|
1245 1. Fucntion Name: \n |
|
1246 int keyTouchScreenVibra(int profileId) const; \n |
|
1247 2. Case Descrition: Verify that the vibra value can be get with valid profile ID. \n |
|
1248 3. Input Parameters: \n |
|
1249 <1> profileId = EProfileWrapperGeneralId \n |
|
1250 <2> profileId = EProfileWrapperMeetingId \n |
|
1251 4. Expected result: \n |
|
1252 <1> return the right key touch screen vibra's value. \n |
|
1253 <2> return the right key touch screen vibra's value. \n |
|
1254 */ |
|
1255 void TestCpProfileModel::testKeyTouchScreenVibraWithValidID() |
|
1256 { |
|
1257 CpProfileModel *profileModel = new CpProfileModel(); |
|
1258 |
|
1259 profileModel->setKeyTouchScreenVibra( EProfileWrapperGeneralId, 4 ); |
|
1260 QVERIFY( profileModel->keyTouchScreenVibra( EProfileWrapperGeneralId ) == 4); |
|
1261 |
|
1262 profileModel->setKeyTouchScreenVibra( EProfileWrapperMeetingId, 5 ); |
|
1263 QVERIFY( profileModel->keyTouchScreenVibra( EProfileWrapperMeetingId ) == 5); |
|
1264 |
|
1265 delete profileModel; |
|
1266 } |
|
1267 |
|
1268 /*! |
|
1269 Test Case Description:\n |
|
1270 1. Fucntion Name: \n |
|
1271 int keyTouchScreenVibra(int profileId) const; \n |
|
1272 2. Case Descrition: Verify that it does not crash when using invalid profile ID. \n |
|
1273 3. Input Parameters: \n |
|
1274 <1> profileId = EProfileWapperStart,\n |
|
1275 <2> profileId = EPRofileWrapperEnd,\n |
|
1276 <3> profileId = -9,\n |
|
1277 <4> profileId = 100,\n |
|
1278 4. Expected result: \n |
|
1279 <1> no crash and return 0 \n |
|
1280 <2> no crash and return 0 \n |
|
1281 <3> no crash and return 0 \n |
|
1282 <4> no crash and return 0 \n |
|
1283 */ |
|
1284 void TestCpProfileModel::testKeyTouchScreenVibraWithInvalidID() |
|
1285 { |
|
1286 CpProfileModel *profileModel = new CpProfileModel(); |
|
1287 |
|
1288 QVERIFY( profileModel->keyTouchScreenVibra( EProfileWapperStart ) == 0); |
|
1289 QVERIFY( profileModel->keyTouchScreenVibra( EPRofileWrapperEnd ) == 0); |
|
1290 QVERIFY( profileModel->keyTouchScreenVibra( -9 ) == 0); |
|
1291 QVERIFY( profileModel->keyTouchScreenVibra( 100 ) == 0); |
|
1292 |
|
1293 delete profileModel; |
|
1294 } |
|
1295 |
|
1296 /*! |
|
1297 Descrition of what you will do in this function |
|
1298 */ |
|
1299 void TestCpProfileModel::cleanupTestCase() |
|
1300 { |
|
1301 // release all test data |
|
1302 QCoreApplication::processEvents(); |
|
1303 } |
|
1304 |
|
1305 QTEST_MAIN(TestCpProfileModel) |
|