os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepcigsmconfig.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 "teststepcigsmconfig.h"
19 TVerdict CTestStepCIGsmConfig::DoTestStepL()
21 iTestStepResult = ETestSuiteError;
23 INFO_PRINTF1(_L("Initializing test CI device"));
25 if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0088-HP")) == 0)
27 iTestStepResult = DoTestStep0088L();
29 else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0089-HP")) == 0)
31 iTestStepResult = DoTestStep0089L();
33 else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0090-HP")) == 0)
35 iTestStepResult = DoTestStep0090L();
38 return iTestStepResult;
42 TVerdict CTestStepCIGsmConfig::DoTestStep0088L()
44 iTestStepResult = EFail;
46 INFO_PRINTF1(_L("GsmConfig - Instantiating"));
48 //Initialize - with the UID of our test HwDevice
49 #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
50 TUid testUID = {KUidGsmConfigTestDevice};
52 TFourCC testUID('T','0','2','0');
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;
67 MMMFGsmConfig* ptr = static_cast <MMMFGsmConfig*> (iMMFDevSound->CustomInterface(KUidGsmConfig));
71 INFO_PRINTF1(_L("MMMFGsmConfig instantiated successfully"));
73 iTestStepResult = EPass;
77 ERR_PRINTF1(_L("MMMFGsmConfig failed to retrieve the interface"));
80 return iTestStepResult;
84 TVerdict CTestStepCIGsmConfig::DoTestStep0089L()
86 iTestStepResult = EFail;
87 TInt result = KErrGeneral;
89 INFO_PRINTF1(_L("GsmConfig - SetConversionFormat"));
91 //Initialize - with the UID of our test HwDevice
92 #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
93 TUid testUID = {KUidGsmConfigTestDevice};
95 TFourCC testUID('T','0','2','0');
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;
110 MMMFGsmConfig* ptr = static_cast <MMMFGsmConfig*> (iMMFDevSound->CustomInterface(KUidGsmConfig));
114 result = ptr->SetConversionFormat(MMMFGsmConfig::ENone); // call method
116 if (result == KErrNone)
118 INFO_PRINTF1(_L("MMMFGsmConfig::SetConversionFormat finished successfully"));
120 iTestStepResult = EPass;
124 ERR_PRINTF2(_L("MMMFGsmConfig::SetConversionFormat failed with error %d"), result);
129 INFO_PRINTF1(_L("MMMFGsmConfig failed to retrieve the interface"));
130 iTestStepResult = EInconclusive;
133 return iTestStepResult;
137 TVerdict CTestStepCIGsmConfig::DoTestStep0090L()
139 iTestStepResult = EFail;
140 TInt result = KErrGeneral;
142 INFO_PRINTF1(_L("GsmConfig - ConversionFormat"));
144 //Initialize - with the UID of our test HwDevice
145 #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
146 TUid testUID = {KUidGsmConfigTestDevice};
148 TFourCC testUID('T','0','2','0');
151 iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
153 if (iTestStepResult != EPass)
155 INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
156 return EInconclusive;
159 // reset the value as previous test is pass
160 iTestStepResult = EFail;
163 MMMFGsmConfig* ptr = static_cast <MMMFGsmConfig*> (iMMFDevSound->CustomInterface(KUidGsmConfig));
167 MMMFGsmConfig::TMMFGsmConversionFormat convFormat = MMMFGsmConfig::ENone;
169 result = ptr->SetConversionFormat(MMMFGsmConfig::EAlawPCM); // call method
171 if (result == KErrNone)
173 INFO_PRINTF1(_L("MMMFGsmConfig::SetConversionFormat finished successfully"));
175 result = ptr->ConversionFormat(convFormat);
177 if ( (result == KErrNone) && (MMMFGsmConfig::EAlawPCM == convFormat) )
179 INFO_PRINTF1(_L("MMMFGsmConfig::ConversionFormat finished successfully"));
181 iTestStepResult = EPass;
185 ERR_PRINTF3(_L("MMMFGsmConfig::SetConversionFormat failed with result %d convFormat"), result, convFormat);
190 ERR_PRINTF2(_L("MMMFGsmConfig::SetConversionFormat failed with error %d"), result);
195 INFO_PRINTF1(_L("MMMFGsmConfig failed to retrieve the interface"));
196 iTestStepResult = EInconclusive;
199 return iTestStepResult;