os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepcispeechencoderconfig.cpp
First public contribution.
1 // Copyright (c) 2007-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include "teststepcispeechencoderconfig.h"
19 TVerdict CTestStepCISpeechEncoderConfig::DoTestStepL()
21 iTestStepResult = ETestSuiteError;
23 INFO_PRINTF1(_L("Initializing test CI device"));
25 if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0001-HP")) == 0)
27 iTestStepResult = DoTestStep0001L();
29 else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0002-HP")) == 0)
31 iTestStepResult = DoTestStep0002L();
33 else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0003-HP")) == 0)
35 iTestStepResult = DoTestStep0003L();
38 return iTestStepResult;
42 TVerdict CTestStepCISpeechEncoderConfig::DoTestStep0001L()
44 iTestStepResult = EFail;
46 INFO_PRINTF1(_L("SpeechEncoderConfig - Instantiating"));
48 //Initialize - with the UID of our test HwDevice
49 #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
50 TUid testUID = {KUidSpeechEncoderConfigTestDevice};
52 TFourCC testUID('T','0','1','4');
55 iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
57 if (iTestStepResult != EPass)
59 INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
63 // reset the value as previous test is pass
64 iTestStepResult = EFail;
66 // KUidSpeechEncoderConfig
67 MSpeechEncoderConfig* ptr = static_cast <MSpeechEncoderConfig*> (iMMFDevSound->CustomInterface(KUidSpeechEncoderConfig));
71 INFO_PRINTF1(_L("MSpeechEncoderConfig instantiated successfully"));
73 iTestStepResult = EPass;
77 ERR_PRINTF1(_L("MSpeechEncoderConfig failed to retrieve the interface"));
80 return iTestStepResult;
84 TVerdict CTestStepCISpeechEncoderConfig::DoTestStep0002L()
86 iTestStepResult = EFail;
87 TInt result = KErrGeneral;
89 INFO_PRINTF1(_L("SpeechEncoderConfig - SetVadMode"));
91 //Initialize - with the UID of our test HwDevice
92 #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
93 TUid testUID = {KUidSpeechEncoderConfigTestDevice};
95 TFourCC testUID('T','0','1','4');
98 iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
100 if (iTestStepResult != EPass)
102 INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
103 return EInconclusive;
106 // reset the value as previous test is pass
107 iTestStepResult = EFail;
109 // KUidSpeechEncoderConfig
110 MSpeechEncoderConfig* ptr = static_cast <MSpeechEncoderConfig*> (iMMFDevSound->CustomInterface(KUidSpeechEncoderConfig));
114 TBool vadModeOn = EFalse;
116 result = ptr->SetVadMode(vadModeOn); // call method
118 if (result == KErrNone)
120 INFO_PRINTF1(_L("MSpeechEncoderConfig::SetVadMode finished successfully"));
122 iTestStepResult = EPass;
126 ERR_PRINTF2(_L("MSpeechEncoderConfig::SetVadMode failed with error %d"), result);
131 INFO_PRINTF1(_L("MSpeechEncoderConfig failed to retrieve the interface"));
132 iTestStepResult = EInconclusive;
135 return iTestStepResult;
139 TVerdict CTestStepCISpeechEncoderConfig::DoTestStep0003L()
141 iTestStepResult = EFail;
142 TInt result = KErrGeneral;
144 INFO_PRINTF1(_L("SpeechEncoderConfig - GetVadMode"));
146 //Initialize - with the UID of our test HwDevice
147 #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
148 TUid testUID = {KUidSpeechEncoderConfigTestDevice};
150 TFourCC testUID('T','0','1','4');
153 iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
155 if (iTestStepResult != EPass)
157 INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
158 return EInconclusive;
161 // reset the value as previous test is pass
162 iTestStepResult = EFail;
164 // KUidSpeechEncoderConfig
165 MSpeechEncoderConfig* ptr = static_cast <MSpeechEncoderConfig*> (iMMFDevSound->CustomInterface(KUidSpeechEncoderConfig));
169 TBool vadModeOn = ETrue;
171 result = ptr->SetVadMode(vadModeOn); // call method
173 if (result == KErrNone)
175 INFO_PRINTF1(_L("MSpeechEncoderConfig::SetVadMode finished successfully"));
177 result = ptr->GetVadMode(vadModeOn);
179 if ( (result == KErrNone) && vadModeOn )
181 INFO_PRINTF1(_L("MSpeechEncoderConfig::GetVadMode finished successfully"));
183 iTestStepResult = EPass;
185 else if (result != KErrNone)
187 INFO_PRINTF2(_L("MSpeechEncoderConfig::GetVadMode failed with error %d"), result);
191 ERR_PRINTF1(_L("MSpeechEncoderConfig::GetVadMode failed - expected and received mismatch"));
196 ERR_PRINTF2(_L("MSpeechEncoderConfig::SetVadMode failed with error %d"), result);
201 INFO_PRINTF1(_L("MSpeechEncoderConfig failed to retrieve the interface"));
202 iTestStepResult = EInconclusive;
205 return iTestStepResult;