|
1 // Copyright (c) 2006-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 // Tests for TBaSystemSoundType and TBaSystemSoundInfo class |
|
15 // |
|
16 // |
|
17 |
|
18 #include <e32test.h> |
|
19 #include <basched.h> |
|
20 #include <f32file.h> |
|
21 #include <s32file.h> |
|
22 #include <bassnd.h> |
|
23 |
|
24 RTest test(_L("T_SSND1")); |
|
25 RFs TheFs; |
|
26 |
|
27 const TUid KRing1 = {100}; |
|
28 const TUid KRing2 = {101}; |
|
29 |
|
30 _LIT(KSndNameWarble,"c:\\system\\data\\warble.wav"); |
|
31 _LIT(KSndNameMozart,"c:\\system\\data\\mozart.wav"); |
|
32 |
|
33 /** |
|
34 @SYMTestCaseID SYSLIB-BAFL-UT-1707 |
|
35 @SYMTestCaseDesc Testing the functions of TBaSystemSoundType and TBaSystemSoundInfo class |
|
36 Tests for TBaSystemSoundInfo::SetTone(),TBaSystemSoundInfo::SetFixedSequenceNumber(),TBaSystemSoundInfo::TBaSystemSoundInfo(TTone) and TBaSystemSoundType::operator==() function |
|
37 @SYMTestPriority Medium |
|
38 @SYMTestActions Compare two system sound types, set the tone and fixed sequence number |
|
39 @SYMTestExpectedResults Test must not fail |
|
40 @SYMREQ REQ0000 |
|
41 */ |
|
42 |
|
43 void TestSoundsL() |
|
44 { |
|
45 test.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-UT-1707 Setting sounds ")); |
|
46 |
|
47 TBaSystemSoundType sndType1(KSystemSoundRingUID,KRing1); |
|
48 TBaSystemSoundInfo sndInfo1(sndType1,KSndNameWarble()); |
|
49 BaSystemSound::SetSoundL(TheFs,sndInfo1); |
|
50 TBaSystemSoundType sndType2(KSystemSoundRingUID,KRing2); |
|
51 TBaSystemSoundInfo sndInfo2(sndType2,KSndNameMozart()); |
|
52 BaSystemSound::SetSoundL(TheFs,sndInfo2); |
|
53 |
|
54 TBaSystemSoundType sndType3(KSystemSoundRingUID,KRing1); |
|
55 TBaSystemSoundInfo sndInfo3(sndType3,KSndNameWarble()); |
|
56 BaSystemSound::SetSoundL(TheFs,sndInfo3); |
|
57 |
|
58 // Comparing two system sound types |
|
59 |
|
60 test(!(sndType1==sndType2)); |
|
61 test(sndType1==sndType3); |
|
62 |
|
63 // Setting with TTone |
|
64 |
|
65 TBaSystemSoundInfo::TTone tone(120,3400); |
|
66 TBaSystemSoundType sndType4; |
|
67 TBaSystemSoundInfo sndInfo4(sndType4,tone); |
|
68 |
|
69 TBaSystemSoundInfo::TTone tone1(140,3200); |
|
70 |
|
71 sndInfo4.SetFixedSequenceNumber(1); |
|
72 TInt seqNo = sndInfo4.FixedSequenceNumber(); |
|
73 test(seqNo==1); |
|
74 sndInfo4.SetTone(tone1); |
|
75 test(!(sndType4==sndType3)); |
|
76 } |
|
77 |
|
78 void DoTestsL() |
|
79 { |
|
80 TheFs.Connect(); |
|
81 CleanupClosePushL(TheFs); |
|
82 |
|
83 TestSoundsL(); |
|
84 |
|
85 CleanupStack::PopAndDestroy(); // TheFs |
|
86 } |
|
87 |
|
88 TInt E32Main() |
|
89 { |
|
90 __UHEAP_MARK; |
|
91 |
|
92 CTrapCleanup* cleanup=CTrapCleanup::New(); |
|
93 if(cleanup == NULL) |
|
94 { |
|
95 return KErrNoMemory; |
|
96 } |
|
97 test.Title(); |
|
98 test.Start(_L("Testing system sounds")); |
|
99 TRAPD(err,DoTestsL()); |
|
100 test(err==KErrNone); |
|
101 test.End(); |
|
102 test.Close(); |
|
103 delete cleanup; |
|
104 |
|
105 __UHEAP_MARKEND; |
|
106 |
|
107 return(0); |
|
108 } |