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 <mdaaudiosampleeditor.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 "TestStepConvert.h"
|
|
42 |
|
|
43 |
|
|
44 |
#include "MmfAudioController.h"
|
|
45 |
#include "mmfclientaudioconverter.h"
|
|
46 |
#include <mmfcontrollerimplementationuids.hrh>
|
|
47 |
//#include <mmfFormatImplementationUIDs.hrh>
|
|
48 |
//#include <mmffourcc.h>
|
|
49 |
//#include <mmfpaniccodes.h>
|
|
50 |
// --------------------------------------------
|
|
51 |
|
|
52 |
/**
|
|
53 |
*
|
|
54 |
* Static constructor for CTestStepConvertOpenLocFormat3.
|
|
55 |
*
|
|
56 |
*
|
|
57 |
* @return "CTestStepConvertOpenLocFormat3*"
|
|
58 |
* The constructed CTestStepConvertOpenLocFormat3
|
|
59 |
*
|
|
60 |
* @xxxx
|
|
61 |
*
|
|
62 |
*/
|
|
63 |
CTestStepConvertOpenLocFormat3* CTestStepConvertOpenLocFormat3::NewL()
|
|
64 |
{
|
|
65 |
CTestStepConvertOpenLocFormat3* self = new(ELeave) CTestStepConvertOpenLocFormat3;
|
|
66 |
return self;
|
|
67 |
}
|
|
68 |
|
|
69 |
/**
|
|
70 |
*
|
|
71 |
* Test step constructor.
|
|
72 |
* Each test step initialises its own name.
|
|
73 |
*
|
|
74 |
* @xxxx
|
|
75 |
*
|
|
76 |
*/
|
|
77 |
CTestStepConvertOpenLocFormat3::CTestStepConvertOpenLocFormat3() : iError(KErrNone)
|
|
78 |
{
|
|
79 |
// store the name of this test case
|
|
80 |
// this is the name that is used by the script file
|
|
81 |
iTestStepName = _L("MM-MMF-ACLNT-U-0554-CP");
|
|
82 |
}
|
|
83 |
|
|
84 |
/**
|
|
85 |
*
|
|
86 |
* Test step destructor.
|
|
87 |
*
|
|
88 |
* @xxxx
|
|
89 |
*
|
|
90 |
*/
|
|
91 |
CTestStepConvertOpenLocFormat3::~CTestStepConvertOpenLocFormat3()
|
|
92 |
{
|
|
93 |
}
|
|
94 |
|
|
95 |
void CTestStepConvertOpenLocFormat3::MoscoStateChangeEvent(CBase* /*aObject*/,
|
|
96 |
TInt /*aPreviousState*/,
|
|
97 |
TInt aCurrentState,
|
|
98 |
TInt aErrorcCode)
|
|
99 |
{
|
|
100 |
//Tests for DEF032016
|
|
101 |
if(aCurrentState == CMdaAudioClipUtility::ERecording)
|
|
102 |
{
|
|
103 |
iError = KErrGeneral;
|
|
104 |
INFO_PRINTF1(_L("CTestStepConvertOpenLocFormat3::MoscoStateChangeEvent incorrect state == CMdaAudioClipUtility::ERecording"));
|
|
105 |
}
|
|
106 |
else
|
|
107 |
iError = aErrorcCode;
|
|
108 |
|
|
109 |
CActiveScheduler::Stop();
|
|
110 |
}
|
|
111 |
|
|
112 |
/**
|
|
113 |
*
|
|
114 |
* Test step Preamble.
|
|
115 |
*
|
|
116 |
* @xxxx
|
|
117 |
*
|
|
118 |
*/
|
|
119 |
enum TVerdict CTestStepConvertOpenLocFormat3::DoTestStepPreambleL(void)
|
|
120 |
{
|
|
121 |
enum TVerdict verdict;
|
|
122 |
// this installs the scheduler
|
|
123 |
verdict = CTestStepUnitMMFAudClient::DoTestStepPreambleL();
|
|
124 |
|
|
125 |
// Printing to the console and log file
|
|
126 |
//INFO_PRINTF2(_L("%S"),iTestStepName);
|
|
127 |
INFO_PRINTF1(_L("this is a test of CMdaAudioConvertUtility::OpenL(location, location, controller, format, datatype) "));
|
|
128 |
|
|
129 |
if(!GetStringFromConfig(_L("SectionOne"), _L("AudioPlayFName5"), iFileName) ||
|
|
130 |
!GetStringFromConfig(_L("SectionOne"), _L("AudioFNameToConvert3"), iFileName2) ||
|
|
131 |
!GetStringFromConfig(_L("SectionOne"), _L("AudioPlayFName8"), iFileNameWav1) ||
|
|
132 |
!GetStringFromConfig(_L("SectionOne"), _L("AudioFNameToConvert4"), iFileNameWav2) )
|
|
133 |
{
|
|
134 |
//INFO_PRINTF2(_L("file name %s not found..."), fileptr);
|
|
135 |
return EInconclusive;
|
|
136 |
}
|
|
137 |
|
|
138 |
// create the Convert utility
|
|
139 |
if ( (iConvert = CMdaAudioConvertUtility::NewL(*this)) == NULL )
|
|
140 |
verdict = EInconclusive;
|
|
141 |
// create an empty target file
|
|
142 |
iFs.Connect();
|
|
143 |
if ( iFile.Replace(iFs, iFileName2, EFileWrite) )
|
|
144 |
return EInconclusive;
|
|
145 |
if ( iFile.SetSize(0) )
|
|
146 |
return EInconclusive;
|
|
147 |
|
|
148 |
if ( iFile.Replace(iFs, iFileNameWav2, EFileWrite) )
|
|
149 |
return EInconclusive;
|
|
150 |
if ( iFile.SetSize(0) )
|
|
151 |
return EInconclusive;
|
|
152 |
|
|
153 |
|
|
154 |
iFile.Close();
|
|
155 |
iFs.Close();
|
|
156 |
|
|
157 |
|
|
158 |
return verdict;
|
|
159 |
}
|
|
160 |
|
|
161 |
/**
|
|
162 |
*
|
|
163 |
* Test step Postamble.
|
|
164 |
*
|
|
165 |
* @xxxx
|
|
166 |
*
|
|
167 |
*/
|
|
168 |
enum TVerdict CTestStepConvertOpenLocFormat3::DoTestStepPostambleL(void)
|
|
169 |
{
|
|
170 |
//delete the converted file
|
|
171 |
iFs.Connect();
|
|
172 |
iFileMan = CFileMan::NewL(iFs);
|
|
173 |
iFileMan->Delete(iFileName2);
|
|
174 |
iFileMan->Delete(iFileNameWav2);
|
|
175 |
iFs.Close();
|
|
176 |
delete iFileMan;
|
|
177 |
iFileMan = NULL;
|
|
178 |
|
|
179 |
delete iClipLocationSrc;
|
|
180 |
delete iClipLocationTrgt;
|
|
181 |
delete iConvert;
|
|
182 |
iConvert = NULL;
|
|
183 |
|
|
184 |
//[ Destroy the scheduler ]
|
|
185 |
return CTestStepUnitMMFAudClient::DoTestStepPostambleL();
|
|
186 |
}
|
|
187 |
|
|
188 |
/**
|
|
189 |
*
|
|
190 |
* Do the test step.
|
|
191 |
* Each test step must supply an implementation for DoTestStepL.
|
|
192 |
*
|
|
193 |
* @return "TVerdict"
|
|
194 |
* The result of the test step
|
|
195 |
*
|
|
196 |
* @xxxx
|
|
197 |
*
|
|
198 |
*/
|
|
199 |
TVerdict CTestStepConvertOpenLocFormat3::DoTestStepL()
|
|
200 |
{
|
|
201 |
iTestStepResult = EPass;
|
|
202 |
TInt err = KErrNone;
|
|
203 |
|
|
204 |
TMdaAudioDataSettings iAudioSettings;
|
|
205 |
iAudioSettings.iSampleRate = 8000;
|
|
206 |
iAudioSettings.iChannels = 1;
|
|
207 |
|
|
208 |
|
|
209 |
|
|
210 |
|
|
211 |
for(TInt conversion=0; conversion<2; conversion++)
|
|
212 |
{
|
|
213 |
if(conversion == 0)
|
|
214 |
{
|
|
215 |
iClipLocationSrc = new TMdaFileClipLocation(iFileName);
|
|
216 |
iClipLocationTrgt = new TMdaFileClipLocation(iFileName2);
|
|
217 |
|
|
218 |
|
|
219 |
TRAP(err,iConvert->OpenL(iClipLocationSrc,
|
|
220 |
iClipLocationTrgt,
|
|
221 |
&iRawClipFormat,
|
|
222 |
&iRawClipFormat,
|
|
223 |
&iRawAudioCodec,
|
|
224 |
&iAudioSettings,
|
|
225 |
&iRawAudio16Codec,
|
|
226 |
&iAudioSettings ));
|
|
227 |
}
|
|
228 |
else
|
|
229 |
{
|
|
230 |
iClipLocationSrc = new TMdaFileClipLocation(iFileNameWav1);
|
|
231 |
iClipLocationTrgt = new TMdaFileClipLocation(iFileNameWav2);
|
|
232 |
|
|
233 |
TRAP(err,iConvert->OpenL(iClipLocationSrc,
|
|
234 |
iClipLocationTrgt,
|
|
235 |
&iWavClipFormat,
|
|
236 |
&iWavClipFormat,
|
|
237 |
&iWavAudioPcmCodec,
|
|
238 |
&iAudioSettings,
|
|
239 |
&iWavAudioulawCodec,
|
|
240 |
&iAudioSettings ));
|
|
241 |
}
|
|
242 |
|
|
243 |
CActiveScheduler::Start();
|
|
244 |
|
|
245 |
if (iConvert == NULL ||
|
|
246 |
iError != KErrNone ||
|
|
247 |
err != KErrNone ||
|
|
248 |
iConvert->State() != CMdaAudioConvertUtility::EOpen )
|
|
249 |
return EFail;
|
|
250 |
|
|
251 |
iConvert->SetPosition(TTimeIntervalMicroSeconds(0));
|
|
252 |
iConvert->ConvertL();
|
|
253 |
CActiveScheduler::Start();
|
|
254 |
if (iError!=KErrNone)
|
|
255 |
return EFail;
|
|
256 |
CActiveScheduler::Start();
|
|
257 |
if (iError!=KErrNone)
|
|
258 |
return EFail;
|
|
259 |
|
|
260 |
|
|
261 |
delete iClipLocationSrc; iClipLocationSrc=NULL;
|
|
262 |
delete iClipLocationTrgt;iClipLocationTrgt=NULL;
|
|
263 |
}
|
|
264 |
|
|
265 |
iConvert->Close();
|
|
266 |
delete iConvert;
|
|
267 |
iConvert = NULL;
|
|
268 |
|
|
269 |
//check if target files OK
|
|
270 |
TInt size = 0;
|
|
271 |
iFs.Connect();
|
|
272 |
if ( KErrNone != iFile.Open(iFs, iFileName2, EFileRead) )
|
|
273 |
{
|
|
274 |
INFO_PRINTF2(_L("****the target file %S doesn't exit!!!!!****"), &iFileName2);
|
|
275 |
iTestStepResult = EFail;
|
|
276 |
}
|
|
277 |
else if (iFile.Size(size) != KErrNone)
|
|
278 |
iTestStepResult = EInconclusive;
|
|
279 |
if (size == 0)
|
|
280 |
iTestStepResult = EFail;
|
|
281 |
|
|
282 |
|
|
283 |
size =0;
|
|
284 |
if ( KErrNone != iFile.Open(iFs, iFileNameWav2, EFileRead) )
|
|
285 |
{
|
|
286 |
INFO_PRINTF2(_L("****the target file %S doesn't exit!!!!!****"), &iFileNameWav2);
|
|
287 |
iTestStepResult = EFail;
|
|
288 |
}
|
|
289 |
else if (iFile.Size(size) != KErrNone)
|
|
290 |
iTestStepResult = EInconclusive;
|
|
291 |
if (size == 0)
|
|
292 |
iTestStepResult = EFail;
|
|
293 |
|
|
294 |
|
|
295 |
|
|
296 |
|
|
297 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
298 |
// test steps return a result
|
|
299 |
return iTestStepResult;
|
|
300 |
}
|
|
301 |
|