0
|
1 |
// Copyright (c) 2002-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 |
// This file contains an example Test step implementation
|
|
15 |
// This demonstrates the various functions provided
|
|
16 |
// by the CTestStep base class which are available within
|
|
17 |
// a test step
|
|
18 |
//
|
|
19 |
//
|
|
20 |
|
|
21 |
// EPOC includes
|
|
22 |
#include <e32base.h>
|
|
23 |
#include <e32test.h>
|
|
24 |
#include <e32keys.h>
|
|
25 |
#include <c32comm.h>
|
|
26 |
#include <f32file.h>
|
|
27 |
#include <etel.h>
|
|
28 |
#include <etelmm.h>
|
|
29 |
#include <testframework.h>
|
|
30 |
|
|
31 |
#include <mdaaudiotoneplayer.h>
|
|
32 |
|
|
33 |
// Test system includes
|
|
34 |
#include <testframework.h>
|
|
35 |
|
|
36 |
// Specific includes for this test suite
|
|
37 |
#include "TestStepUnitMMFAudClient.h"
|
|
38 |
#include "TestSuiteUnitMMFAudClient.h"
|
|
39 |
|
|
40 |
// Specific includes for these test steps
|
|
41 |
#include "TestStepTone.h"
|
|
42 |
|
|
43 |
#include "toneTest.h"
|
|
44 |
|
|
45 |
//#include <mmfaudiocontroller.h>
|
|
46 |
#include "mmfclienttoneplayer.h"
|
|
47 |
//#include "MmfClientAudioPlayer.h"
|
|
48 |
//#include <mmffourcc.h>
|
|
49 |
//#include <mmfpaniccodes.h>
|
|
50 |
//#include <mmfFormatImplementationUIDs.hrh>
|
|
51 |
// --------------------------------------------
|
|
52 |
|
|
53 |
/**
|
|
54 |
*
|
|
55 |
* Static constructor for CTestStepTonePrepareToPlayDescSeq.
|
|
56 |
*
|
|
57 |
*
|
|
58 |
* @return "CTestStepTonePrepareToPlayDescSeq*"
|
|
59 |
* The constructed CTestStepTonePrepareToPlayDescSeq
|
|
60 |
*
|
|
61 |
* @xxxx
|
|
62 |
*
|
|
63 |
*/
|
|
64 |
CTestStepTonePrepareToPlayDescSeq* CTestStepTonePrepareToPlayDescSeq::NewL()
|
|
65 |
{
|
|
66 |
CTestStepTonePrepareToPlayDescSeq* self = new(ELeave) CTestStepTonePrepareToPlayDescSeq;
|
|
67 |
return self;
|
|
68 |
}
|
|
69 |
|
|
70 |
/**
|
|
71 |
*
|
|
72 |
* Test step constructor.
|
|
73 |
* Each test step initialises its own name.
|
|
74 |
*
|
|
75 |
* @xxxx
|
|
76 |
*
|
|
77 |
*/
|
|
78 |
CTestStepTonePrepareToPlayDescSeq::CTestStepTonePrepareToPlayDescSeq() : iError(KErrNone)
|
|
79 |
{
|
|
80 |
// store the name of this test case
|
|
81 |
// this is the name that is used by the script file
|
|
82 |
iTestStepName = _L("MM-MMF-ACLNT-U-0456-CP");
|
|
83 |
|
|
84 |
// need a bigger heap size on EKA2 HW
|
|
85 |
#if !defined __WINS__
|
|
86 |
iHeapSize = KHeapSizeToneTestEKA2;
|
|
87 |
#endif // EKA2
|
|
88 |
}
|
|
89 |
|
|
90 |
/**
|
|
91 |
*
|
|
92 |
* Test step destructor.
|
|
93 |
*
|
|
94 |
* @xxxx
|
|
95 |
*
|
|
96 |
*/
|
|
97 |
CTestStepTonePrepareToPlayDescSeq::~CTestStepTonePrepareToPlayDescSeq()
|
|
98 |
{
|
|
99 |
}
|
|
100 |
|
|
101 |
void CTestStepTonePrepareToPlayDescSeq::MatoPrepareComplete(TInt aError)
|
|
102 |
{
|
|
103 |
iError = aError;
|
|
104 |
CActiveScheduler::Stop();
|
|
105 |
}
|
|
106 |
|
|
107 |
void CTestStepTonePrepareToPlayDescSeq::MatoPlayComplete(TInt aError)
|
|
108 |
{
|
|
109 |
iError = aError;
|
|
110 |
CActiveScheduler::Stop();
|
|
111 |
}
|
|
112 |
|
|
113 |
/**
|
|
114 |
*
|
|
115 |
* Test step Preamble.
|
|
116 |
*
|
|
117 |
* @xxxx
|
|
118 |
*
|
|
119 |
*/
|
|
120 |
enum TVerdict CTestStepTonePrepareToPlayDescSeq::DoTestStepPreambleL(void)
|
|
121 |
{
|
|
122 |
TInt err = KErrNone;
|
|
123 |
enum TVerdict verdict;
|
|
124 |
// this installs the scheduler
|
|
125 |
verdict = CTestStepUnitMMFAudClient::DoTestStepPreambleL();
|
|
126 |
|
|
127 |
// Printing to the console and log file
|
|
128 |
INFO_PRINTF1(_L("MM-MMF-ACLNT-U-0456-CP"));
|
|
129 |
INFO_PRINTF1(_L("this is a test of CMdaAudioToneUtility::PrepareToPlayDesSequence() "));
|
|
130 |
|
|
131 |
// get the file with the DTMF string
|
|
132 |
if(!GetStringFromConfig(_L("SectionOne"), _L("DTMFStringFName1"), iFileName))
|
|
133 |
{
|
|
134 |
//INFO_PRINTF2(_L("file name %s not found..."), fileptr);
|
|
135 |
return EInconclusive;
|
|
136 |
}
|
|
137 |
|
|
138 |
// create the Tone utility
|
|
139 |
TRAP( err, (iTone = CMMFMdaAudioToneUtility::NewL(*this)) );
|
|
140 |
if ( err != KErrNone ||
|
|
141 |
iTone->State() != EMdaAudioToneUtilityNotReady )
|
|
142 |
verdict = EInconclusive;
|
|
143 |
|
|
144 |
return verdict;
|
|
145 |
|
|
146 |
}
|
|
147 |
|
|
148 |
/**
|
|
149 |
*
|
|
150 |
* Test step Postamble.
|
|
151 |
*
|
|
152 |
* @xxxx
|
|
153 |
*
|
|
154 |
*/
|
|
155 |
enum TVerdict CTestStepTonePrepareToPlayDescSeq::DoTestStepPostambleL(void)
|
|
156 |
{
|
|
157 |
delete iTone;
|
|
158 |
iTone = NULL;
|
|
159 |
//[ Destroy the scheduler ]
|
|
160 |
return CTestStepUnitMMFAudClient::DoTestStepPostambleL();
|
|
161 |
}
|
|
162 |
|
|
163 |
/**
|
|
164 |
*
|
|
165 |
* Do the test step.
|
|
166 |
* Each test step must supply an implementation for DoTestStepL.
|
|
167 |
*
|
|
168 |
* @return "TVerdict"
|
|
169 |
* The result of the test step
|
|
170 |
*
|
|
171 |
* @xxxx
|
|
172 |
*
|
|
173 |
*/
|
|
174 |
TVerdict CTestStepTonePrepareToPlayDescSeq::DoTestStepL()
|
|
175 |
{
|
|
176 |
iTestStepResult = EPass;
|
|
177 |
|
|
178 |
//_LIT8(KDTMFStr1, "AB,C, DE, FG");
|
|
179 |
//_LIT8(KDTMFStr2, "A5774 6788* #A *d GHET"); //HIJKLMNOPQRSTUVWXYZ");
|
|
180 |
//_LIT8(KDTMFStrInvalid, "123 <>?$%&$%^&");
|
|
181 |
|
|
182 |
iTone->PrepareToPlayDesSequence(KFixedSequenceData);
|
|
183 |
CActiveScheduler::Start();
|
|
184 |
|
|
185 |
TInt err1 = KErrNone;
|
|
186 |
TInt type = 0;
|
|
187 |
err1 = GetAudToneType(iTone, type);
|
|
188 |
if (err1 != KErrNone ||
|
|
189 |
type != CMMFToneConfig::EMmfToneTypeDesSeq ||
|
|
190 |
iError != KErrNone ||
|
|
191 |
iTone->State() != EMdaAudioToneUtilityPrepared)
|
|
192 |
return EFail;
|
|
193 |
|
|
194 |
iTone->Play();
|
|
195 |
CActiveScheduler::Start();
|
|
196 |
|
|
197 |
if (iError != KErrNone )
|
|
198 |
return EFail;
|
|
199 |
|
|
200 |
iTone->CancelPrepare();
|
|
201 |
if (iTone->State() != EMdaAudioToneUtilityNotReady )
|
|
202 |
return EInconclusive;
|
|
203 |
//repeat
|
|
204 |
iTone->PrepareToPlayDesSequence(KFixedSequenceData);
|
|
205 |
CActiveScheduler::Start();
|
|
206 |
|
|
207 |
err1 = GetAudToneType(iTone, type);
|
|
208 |
if (err1 != KErrNone ||
|
|
209 |
type != CMMFToneConfig::EMmfToneTypeDesSeq ||
|
|
210 |
iError != KErrNone ||
|
|
211 |
iTone->State() != EMdaAudioToneUtilityPrepared)
|
|
212 |
return EFail;
|
|
213 |
|
|
214 |
iTone->Play();
|
|
215 |
CActiveScheduler::Start();
|
|
216 |
if (iError != KErrNone )
|
|
217 |
return EFail;
|
|
218 |
|
|
219 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
220 |
// test steps return a result
|
|
221 |
return iTestStepResult;
|
|
222 |
}
|
|
223 |
|