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 |
|
|
44 |
//#include <mmfaudiocontroller.h>
|
|
45 |
#include "mmfclienttoneplayer.h"
|
|
46 |
//#include "MmfClientAudioPlayer.h"
|
|
47 |
//#include <mmffourcc.h>
|
|
48 |
//#include <mmfpaniccodes.h>
|
|
49 |
//#include <mmfFormatImplementationUIDs.hrh>
|
|
50 |
// --------------------------------------------
|
|
51 |
|
|
52 |
/**
|
|
53 |
*
|
|
54 |
* Static constructor for CTestStepToneSetVolume.
|
|
55 |
*
|
|
56 |
*
|
|
57 |
* @return "CTestStepToneSetVolume*"
|
|
58 |
* The constructed CTestStepToneSetVolume
|
|
59 |
*
|
|
60 |
* @xxxx
|
|
61 |
*
|
|
62 |
*/
|
|
63 |
CTestStepToneSetVolume* CTestStepToneSetVolume::NewL()
|
|
64 |
{
|
|
65 |
CTestStepToneSetVolume* self = new(ELeave) CTestStepToneSetVolume;
|
|
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 |
CTestStepToneSetVolume::CTestStepToneSetVolume() : 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-0462-CP");
|
|
82 |
}
|
|
83 |
|
|
84 |
/**
|
|
85 |
*
|
|
86 |
* Test step destructor.
|
|
87 |
*
|
|
88 |
* @xxxx
|
|
89 |
*
|
|
90 |
*/
|
|
91 |
CTestStepToneSetVolume::~CTestStepToneSetVolume()
|
|
92 |
{
|
|
93 |
}
|
|
94 |
|
|
95 |
void CTestStepToneSetVolume::MatoPrepareComplete(TInt aError)
|
|
96 |
{
|
|
97 |
iError = aError;
|
|
98 |
CActiveScheduler::Stop();
|
|
99 |
}
|
|
100 |
|
|
101 |
void CTestStepToneSetVolume::MatoPlayComplete(TInt aError)
|
|
102 |
{
|
|
103 |
iError = aError;
|
|
104 |
CActiveScheduler::Stop();
|
|
105 |
}
|
|
106 |
|
|
107 |
/**
|
|
108 |
*
|
|
109 |
* Test step Preamble.
|
|
110 |
*
|
|
111 |
* @xxxx
|
|
112 |
*
|
|
113 |
*/
|
|
114 |
enum TVerdict CTestStepToneSetVolume::DoTestStepPreambleL(void)
|
|
115 |
{
|
|
116 |
TInt err = KErrNone;
|
|
117 |
enum TVerdict verdict;
|
|
118 |
// this installs the scheduler
|
|
119 |
verdict = CTestStepUnitMMFAudClient::DoTestStepPreambleL();
|
|
120 |
|
|
121 |
// Printing to the console and log file
|
|
122 |
INFO_PRINTF1(_L("MM-MMF-ACLNT-U-0462-CP"));
|
|
123 |
INFO_PRINTF1(_L("this is a test of CMdaAudioToneUtility::SetVolume() "));
|
|
124 |
|
|
125 |
// create the Tone utility
|
|
126 |
TRAP( err, (iTone = CMMFMdaAudioToneUtility::NewL(*this)) );
|
|
127 |
if ( err != KErrNone ||
|
|
128 |
iTone->State() != EMdaAudioToneUtilityNotReady )
|
|
129 |
verdict = EInconclusive;
|
|
130 |
return verdict;
|
|
131 |
|
|
132 |
}
|
|
133 |
|
|
134 |
/**
|
|
135 |
*
|
|
136 |
* Test step Postamble.
|
|
137 |
*
|
|
138 |
* @xxxx
|
|
139 |
*
|
|
140 |
*/
|
|
141 |
enum TVerdict CTestStepToneSetVolume::DoTestStepPostambleL(void)
|
|
142 |
{
|
|
143 |
delete iTone;
|
|
144 |
iTone = NULL;
|
|
145 |
//[ Destroy the scheduler ]
|
|
146 |
return CTestStepUnitMMFAudClient::DoTestStepPostambleL();
|
|
147 |
}
|
|
148 |
|
|
149 |
/**
|
|
150 |
*
|
|
151 |
* Do the test step.
|
|
152 |
* Each test step must supply an implementation for DoTestStepL.
|
|
153 |
*
|
|
154 |
* @return "TVerdict"
|
|
155 |
* The result of the test step
|
|
156 |
*
|
|
157 |
* @xxxx
|
|
158 |
*
|
|
159 |
*/
|
|
160 |
TVerdict CTestStepToneSetVolume::DoTestStepL()
|
|
161 |
{
|
|
162 |
iTestStepResult = EPass;
|
|
163 |
|
|
164 |
TInt maxVol = iTone->MaxVolume();
|
|
165 |
TInt vol =0;
|
|
166 |
for (vol=0; vol<=maxVol; vol+=maxVol/10)
|
|
167 |
{
|
|
168 |
iTone->SetVolume(vol);
|
|
169 |
// no way to check directly since its a SoundDev property which is on the server side
|
|
170 |
// out of scope to check the SoundDev
|
|
171 |
}
|
|
172 |
|
|
173 |
// Try also with prepared Tone utility
|
|
174 |
iTone->PrepareToPlayTone(400,TTimeIntervalMicroSeconds(500000));
|
|
175 |
CActiveScheduler::Start();
|
|
176 |
if ( iError != KErrNone ||
|
|
177 |
iTone->State() != EMdaAudioToneUtilityPrepared )
|
|
178 |
return EInconclusive;
|
|
179 |
|
|
180 |
maxVol = iTone->MaxVolume();
|
|
181 |
for (vol=0; vol<=maxVol; vol+=maxVol/10)
|
|
182 |
{
|
|
183 |
iTone->SetVolume(vol);
|
|
184 |
}
|
|
185 |
|
|
186 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
187 |
// test steps return a result
|
|
188 |
return iTestStepResult;
|
|
189 |
}
|
|
190 |
|