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 <MdaAudioSamplePlayer.h>
|
|
32 |
#include <mdaaudiosampleeditor.h>
|
|
33 |
//#include <MdaAudioTonePlayer.h>
|
|
34 |
|
|
35 |
// Test system includes
|
|
36 |
#include <testframework.h>
|
|
37 |
|
|
38 |
// Specific includes for this test suite
|
|
39 |
#include "TestStepUnitMMFAudClient.h"
|
|
40 |
#include "TestSuiteUnitMMFAudClient.h"
|
|
41 |
|
|
42 |
// Specific includes for these test steps
|
|
43 |
#include "TestStepRecorder.h"
|
|
44 |
|
|
45 |
|
|
46 |
#include "MmfAudioController.h"
|
|
47 |
#include "mmfclientaudiorecorder.h"
|
|
48 |
//#include <mmffourcc.h>
|
|
49 |
//#include <mmfpaniccodes.h>
|
|
50 |
//#include <mmfFormatImplementationUIDs.hrh>
|
|
51 |
// --------------------------------------------
|
|
52 |
|
|
53 |
/**
|
|
54 |
*
|
|
55 |
* Static constructor for CTestStepRecorderBalancePlay.
|
|
56 |
*
|
|
57 |
*
|
|
58 |
* @return "CTestStepRecorderBalancePlay*"
|
|
59 |
* The constructed CTestStepRecorderBalancePlay
|
|
60 |
*
|
|
61 |
* @xxxx
|
|
62 |
*
|
|
63 |
*/
|
|
64 |
CTestStepRecorderBalancePlay* CTestStepRecorderBalancePlay::NewL()
|
|
65 |
{
|
|
66 |
CTestStepRecorderBalancePlay* self = new(ELeave) CTestStepRecorderBalancePlay;
|
|
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 |
CTestStepRecorderBalancePlay::CTestStepRecorderBalancePlay()
|
|
79 |
{
|
|
80 |
iTestStepResult = EPass;
|
|
81 |
// store the name of this test case
|
|
82 |
// this is the name that is used by the script file
|
|
83 |
iTestStepName = _L("MM-MMF-ACLNT-U-0257-HP");
|
|
84 |
}
|
|
85 |
|
|
86 |
/**
|
|
87 |
*
|
|
88 |
* Test step destructor.
|
|
89 |
*
|
|
90 |
* @xxxx
|
|
91 |
*
|
|
92 |
*/
|
|
93 |
CTestStepRecorderBalancePlay::~CTestStepRecorderBalancePlay()
|
|
94 |
{
|
|
95 |
}
|
|
96 |
|
|
97 |
/**
|
|
98 |
*
|
|
99 |
* Test step Preamble.
|
|
100 |
*
|
|
101 |
* @xxxx
|
|
102 |
*
|
|
103 |
*/
|
|
104 |
enum TVerdict CTestStepRecorderBalancePlay::DoTestStepPreambleL(void)
|
|
105 |
{
|
|
106 |
enum TVerdict verdict;
|
|
107 |
// this installs the scheduler
|
|
108 |
verdict = CTestStepUnitMMFAudClient::DoTestStepPreambleL();
|
|
109 |
|
|
110 |
// Printing to the console and log file
|
|
111 |
INFO_PRINTF1(_L("MM-MMF-ACLNT-U-0257-HP"));
|
|
112 |
INFO_PRINTF1(_L("this test is setting/getting the Play balance of the recorder utility with several values. [Set|Get]PlaybackBalance()"));
|
|
113 |
|
|
114 |
iError = KErrNone; //KErrTimedOut;
|
|
115 |
|
|
116 |
if(!GetStringFromConfig(_L("SectionOne"), _L("AudioPlayFName1"), iFileName) )
|
|
117 |
{
|
|
118 |
//INFO_PRINTF2(_L("file name %s not found..."), fileptr);
|
|
119 |
return EInconclusive;
|
|
120 |
}
|
|
121 |
|
|
122 |
iRecorder = CMMFMdaAudioRecorderUtility::NewL(*this);
|
|
123 |
iRecorder->OpenFileL(iFileName);
|
|
124 |
CActiveScheduler::Start();
|
|
125 |
if (iRecorder->State() != CMdaAudioRecorderUtility::EOpen)
|
|
126 |
return EInconclusive;
|
|
127 |
|
|
128 |
return verdict;
|
|
129 |
}
|
|
130 |
|
|
131 |
/**
|
|
132 |
*
|
|
133 |
* Test step Postamble.
|
|
134 |
*
|
|
135 |
* @xxxx
|
|
136 |
*
|
|
137 |
*/
|
|
138 |
enum TVerdict CTestStepRecorderBalancePlay::DoTestStepPostambleL(void)
|
|
139 |
{
|
|
140 |
delete iRecorder;
|
|
141 |
iRecorder = NULL;
|
|
142 |
//[ Destroy the scheduler ]
|
|
143 |
return CTestStepUnitMMFAudClient::DoTestStepPostambleL();
|
|
144 |
}
|
|
145 |
|
|
146 |
/**
|
|
147 |
*
|
|
148 |
* Callback Handle.
|
|
149 |
*
|
|
150 |
* @xxxx
|
|
151 |
*
|
|
152 |
*/
|
|
153 |
void CTestStepRecorderBalancePlay::MoscoStateChangeEvent(CBase* /*aObject*/,
|
|
154 |
TInt /*aPreviousState*/,
|
|
155 |
TInt /*aCurrentState*/,
|
|
156 |
TInt aErrorcCode)
|
|
157 |
{
|
|
158 |
iError = aErrorcCode;
|
|
159 |
CActiveScheduler::Stop();
|
|
160 |
}
|
|
161 |
|
|
162 |
/**
|
|
163 |
*
|
|
164 |
* Do the test step.
|
|
165 |
* Each test step must supply an implementation for DoTestStepL.
|
|
166 |
*
|
|
167 |
* @return "TVerdict"
|
|
168 |
* The result of the test step
|
|
169 |
*
|
|
170 |
* @xxxx
|
|
171 |
*
|
|
172 |
*/
|
|
173 |
TVerdict CTestStepRecorderBalancePlay::DoTestStepL()
|
|
174 |
{
|
|
175 |
iTestStepResult = EPass;
|
|
176 |
TInt err = KErrNone;
|
|
177 |
TInt balance = 0; // KMMFBalanceCenter
|
|
178 |
|
|
179 |
// test 1
|
|
180 |
err = iRecorder->SetPlaybackBalance(); // default KMMFBalanceCenter = 0
|
|
181 |
if (err != KErrNone)
|
|
182 |
return EFail;
|
|
183 |
|
|
184 |
err = iRecorder->GetPlaybackBalance(balance);
|
|
185 |
if (err != KErrNone ||
|
|
186 |
balance != KMMFBalanceCenter)
|
|
187 |
return EFail;
|
|
188 |
|
|
189 |
// test 2
|
|
190 |
err = iRecorder->SetPlaybackBalance(KMMFBalanceMaxLeft); // -100
|
|
191 |
if (err != KErrNone)
|
|
192 |
return EFail;
|
|
193 |
|
|
194 |
err = iRecorder->GetPlaybackBalance(balance);
|
|
195 |
if (err != KErrNone ||
|
|
196 |
balance != KMMFBalanceMaxLeft)
|
|
197 |
return EFail;
|
|
198 |
|
|
199 |
// test 3
|
|
200 |
err = iRecorder->SetPlaybackBalance(KMMFBalanceMaxRight);
|
|
201 |
if (err != KErrNone)
|
|
202 |
return EFail;
|
|
203 |
|
|
204 |
err = iRecorder->GetPlaybackBalance(balance);
|
|
205 |
if (err != KErrNone ||
|
|
206 |
balance != KMMFBalanceMaxRight)
|
|
207 |
return EFail;
|
|
208 |
|
|
209 |
// test 4
|
|
210 |
err = iRecorder->SetPlaybackBalance(KMMFBalanceMaxRight/2);
|
|
211 |
if (err != KErrNone)
|
|
212 |
return EFail;
|
|
213 |
|
|
214 |
err = iRecorder->GetPlaybackBalance(balance);
|
|
215 |
if (err != KErrNone ||
|
|
216 |
balance != KMMFBalanceMaxRight/2)
|
|
217 |
return EFail;
|
|
218 |
|
|
219 |
|
|
220 |
// test 4 out of bounds
|
|
221 |
/* until we check the return codes...
|
|
222 |
TRAP(err, iRecorder->SetPlaybackBalance(KMMFBalanceMaxRight+5));
|
|
223 |
if (err != KErrArgument ||
|
|
224 |
err != KErrTooBig )
|
|
225 |
return EFail;
|
|
226 |
*/
|
|
227 |
|
|
228 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
229 |
// test steps return a result
|
|
230 |
return iTestStepResult;
|
|
231 |
}
|
|
232 |
|
|
233 |
//
|
|
234 |
// --------------------------------------------
|
|
235 |
//
|
|
236 |
/**
|
|
237 |
*
|
|
238 |
* Static constructor for CTestStepRecorderBalanceRecord.
|
|
239 |
*
|
|
240 |
*
|
|
241 |
* @return "CTestStepRecorderBalanceRecord*"
|
|
242 |
* The constructed CTestStepRecorderBalanceRecord
|
|
243 |
*
|
|
244 |
* @xxxx
|
|
245 |
*
|
|
246 |
*/
|
|
247 |
CTestStepRecorderBalanceRecord* CTestStepRecorderBalanceRecord::NewL()
|
|
248 |
{
|
|
249 |
CTestStepRecorderBalanceRecord* self = new(ELeave) CTestStepRecorderBalanceRecord;
|
|
250 |
return self;
|
|
251 |
}
|
|
252 |
|
|
253 |
/**
|
|
254 |
*
|
|
255 |
* Test step constructor.
|
|
256 |
* Each test step initialises its own name.
|
|
257 |
*
|
|
258 |
* @xxxx
|
|
259 |
*
|
|
260 |
*/
|
|
261 |
CTestStepRecorderBalanceRecord::CTestStepRecorderBalanceRecord()
|
|
262 |
{
|
|
263 |
iTestStepResult = EPass;
|
|
264 |
// store the name of this test case
|
|
265 |
// this is the name that is used by the script file
|
|
266 |
iTestStepName = _L("MM-MMF-ACLNT-U-0258-HP");
|
|
267 |
}
|
|
268 |
|
|
269 |
/**
|
|
270 |
*
|
|
271 |
* Test step destructor.
|
|
272 |
*
|
|
273 |
* @xxxx
|
|
274 |
*
|
|
275 |
*/
|
|
276 |
CTestStepRecorderBalanceRecord::~CTestStepRecorderBalanceRecord()
|
|
277 |
{
|
|
278 |
}
|
|
279 |
|
|
280 |
/**
|
|
281 |
*
|
|
282 |
* Test step Preamble.
|
|
283 |
*
|
|
284 |
* @xxxx
|
|
285 |
*
|
|
286 |
*/
|
|
287 |
enum TVerdict CTestStepRecorderBalanceRecord::DoTestStepPreambleL(void)
|
|
288 |
{
|
|
289 |
enum TVerdict verdict;
|
|
290 |
// this installs the scheduler
|
|
291 |
verdict = CTestStepUnitMMFAudClient::DoTestStepPreambleL();
|
|
292 |
|
|
293 |
// Printing to the console and log file
|
|
294 |
INFO_PRINTF1(_L("MM-MMF-ACLNT-U-0258-HP"));
|
|
295 |
INFO_PRINTF1(_L("this test is setting/getting the Record balance of the recorder utility with several values. [Set|Get]RecordkBalance()"));
|
|
296 |
|
|
297 |
iError = KErrNone; //KErrTimedOut;
|
|
298 |
|
|
299 |
if(!GetStringFromConfig(_L("SectionOne"), _L("AudioPlayFName1"), iFileName) )
|
|
300 |
{
|
|
301 |
//INFO_PRINTF2(_L("file name %s not found..."), fileptr);
|
|
302 |
return EInconclusive;
|
|
303 |
}
|
|
304 |
|
|
305 |
iRecorder = CMMFMdaAudioRecorderUtility::NewL(*this);
|
|
306 |
iRecorder->OpenFileL(iFileName);
|
|
307 |
CActiveScheduler::Start();
|
|
308 |
if (iRecorder->State() != CMdaAudioRecorderUtility::EOpen)
|
|
309 |
return EInconclusive;
|
|
310 |
|
|
311 |
return verdict;
|
|
312 |
}
|
|
313 |
|
|
314 |
/**
|
|
315 |
*
|
|
316 |
* Test step Postamble.
|
|
317 |
*
|
|
318 |
* @xxxx
|
|
319 |
*
|
|
320 |
*/
|
|
321 |
enum TVerdict CTestStepRecorderBalanceRecord::DoTestStepPostambleL(void)
|
|
322 |
{
|
|
323 |
delete iRecorder;
|
|
324 |
iRecorder = NULL;
|
|
325 |
//[ Destroy the scheduler ]
|
|
326 |
return CTestStepUnitMMFAudClient::DoTestStepPostambleL();
|
|
327 |
}
|
|
328 |
|
|
329 |
/**
|
|
330 |
*
|
|
331 |
* Callback Handle.
|
|
332 |
*
|
|
333 |
* @xxxx
|
|
334 |
*
|
|
335 |
*/
|
|
336 |
void CTestStepRecorderBalanceRecord::MoscoStateChangeEvent(CBase* /*aObject*/,
|
|
337 |
TInt /*aPreviousState*/,
|
|
338 |
TInt /*aCurrentState*/,
|
|
339 |
TInt aErrorcCode)
|
|
340 |
{
|
|
341 |
iError = aErrorcCode;
|
|
342 |
CActiveScheduler::Stop();
|
|
343 |
}
|
|
344 |
|
|
345 |
/**
|
|
346 |
*
|
|
347 |
* Do the test step.
|
|
348 |
* Each test step must supply an implementation for DoTestStepL.
|
|
349 |
*
|
|
350 |
* @return "TVerdict"
|
|
351 |
* The result of the test step
|
|
352 |
*
|
|
353 |
* @xxxx
|
|
354 |
*
|
|
355 |
*/
|
|
356 |
TVerdict CTestStepRecorderBalanceRecord::DoTestStepL()
|
|
357 |
{
|
|
358 |
iTestStepResult = EPass;
|
|
359 |
TInt err = KErrNone;
|
|
360 |
TInt balance = 0; // KMMFBalanceCenter
|
|
361 |
|
|
362 |
// test 1
|
|
363 |
err = iRecorder->SetRecordBalance(); // default KMMFBalanceCenter = 0
|
|
364 |
if (err != KErrNone)
|
|
365 |
return EFail;
|
|
366 |
|
|
367 |
err = iRecorder->GetRecordBalance(balance);
|
|
368 |
if (err != KErrNone ||
|
|
369 |
balance != 0)
|
|
370 |
return EFail;
|
|
371 |
|
|
372 |
// test 2
|
|
373 |
err = iRecorder->SetRecordBalance(KMMFBalanceMaxLeft); // -100
|
|
374 |
if (err != KErrNone)
|
|
375 |
return EFail;
|
|
376 |
|
|
377 |
err = iRecorder->GetRecordBalance(balance);
|
|
378 |
if (err != KErrNone ||
|
|
379 |
balance != KMMFBalanceMaxLeft)
|
|
380 |
return EFail;
|
|
381 |
|
|
382 |
// test 3
|
|
383 |
err = iRecorder->SetRecordBalance(KMMFBalanceMaxRight);
|
|
384 |
if (err != KErrNone)
|
|
385 |
return EFail;
|
|
386 |
|
|
387 |
err = iRecorder->GetRecordBalance(balance);
|
|
388 |
if (err != KErrNone ||
|
|
389 |
balance != KMMFBalanceMaxRight)
|
|
390 |
return EFail;
|
|
391 |
|
|
392 |
// test 4
|
|
393 |
err = iRecorder->SetRecordBalance(KMMFBalanceMaxRight/2);
|
|
394 |
if (err != KErrNone)
|
|
395 |
return EFail;
|
|
396 |
|
|
397 |
err = iRecorder->GetRecordBalance(balance);
|
|
398 |
if (err != KErrNone ||
|
|
399 |
balance != KMMFBalanceMaxRight/2)
|
|
400 |
return EFail;
|
|
401 |
|
|
402 |
// test 4 out of bounds
|
|
403 |
/* until we check the return codes....
|
|
404 |
TRAP(err, iRecorder->SetRecordBalance(KMMFBalanceMaxRight+5));
|
|
405 |
if (err != KErrArgument ||
|
|
406 |
err != KErrTooBig )
|
|
407 |
return EFail;
|
|
408 |
*/
|
|
409 |
|
|
410 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
411 |
// test steps return a result
|
|
412 |
return iTestStepResult;
|
|
413 |
}
|
|
414 |
|
|
415 |
//
|