os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepcig711encoderconfig.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepcig711encoderconfig.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,307 @@
1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#include "teststepcig711encoderconfig.h"
1.20 +
1.21 +
1.22 +TVerdict CTestStepCIG711EncoderConfig::DoTestStepL()
1.23 + {
1.24 + iTestStepResult = ETestSuiteError;
1.25 +
1.26 + INFO_PRINTF1(_L("Initializing test CI device"));
1.27 +
1.28 + if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0045-HP")) == 0)
1.29 + {
1.30 + iTestStepResult = DoTestStep0045L();
1.31 + }
1.32 + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0046-HP")) == 0)
1.33 + {
1.34 + iTestStepResult = DoTestStep0046L();
1.35 + }
1.36 + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0047-HP")) == 0)
1.37 + {
1.38 + iTestStepResult = DoTestStep0047L();
1.39 + }
1.40 + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0048-HP")) == 0)
1.41 + {
1.42 + iTestStepResult = DoTestStep0048L();
1.43 + }
1.44 +
1.45 + return iTestStepResult;
1.46 + }
1.47 +
1.48 +
1.49 +TVerdict CTestStepCIG711EncoderConfig::DoTestStep0045L()
1.50 + {
1.51 + iTestStepResult = EFail;
1.52 +
1.53 + INFO_PRINTF1(_L("G711EncoderIntfc - Instantiating"));
1.54 +
1.55 + //Initialize - with the UID of our test HwDevice
1.56 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.57 + TUid testUID = {KUidG711EncoderConfigTestDevice};
1.58 + #else
1.59 + TFourCC testUID('T','0','1','6');
1.60 + #endif
1.61 +
1.62 + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
1.63 +
1.64 + if (iTestStepResult != EPass)
1.65 + {
1.66 + INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
1.67 + return EInconclusive;
1.68 + }
1.69 +
1.70 + // reset the value as previous test is pass
1.71 + iTestStepResult = EFail;
1.72 +
1.73 + // KUidG711EncoderIntfc
1.74 + MG711EncoderIntfc* ptr = static_cast <MG711EncoderIntfc*> (iMMFDevSound->CustomInterface(KUidG711EncoderIntfc));
1.75 +
1.76 + if (ptr)
1.77 + {
1.78 + INFO_PRINTF1(_L("MG711EncoderIntfc instantiated successfully"));
1.79 +
1.80 + iTestStepResult = EPass;
1.81 + }
1.82 + else
1.83 + {
1.84 + ERR_PRINTF1(_L("MG711EncoderIntfc failed to retrieve the interface"));
1.85 + }
1.86 +
1.87 + return iTestStepResult;
1.88 + }
1.89 +
1.90 +
1.91 +TVerdict CTestStepCIG711EncoderConfig::DoTestStep0046L()
1.92 + {
1.93 + iTestStepResult = EFail;
1.94 + TInt result = KErrGeneral;
1.95 +
1.96 + INFO_PRINTF1(_L("G711EncoderIntfc - SetEncoderMode"));
1.97 +
1.98 + //Initialize - with the UID of our test HwDevice
1.99 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.100 + TUid testUID = {KUidG711EncoderConfigTestDevice};
1.101 + #else
1.102 + TFourCC testUID('T','0','1','6');
1.103 + #endif
1.104 +
1.105 + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
1.106 +
1.107 + if (iTestStepResult != EPass)
1.108 + {
1.109 + INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
1.110 + return EInconclusive;
1.111 + }
1.112 +
1.113 + // reset the value as previous test is pass
1.114 + iTestStepResult = EFail;
1.115 +
1.116 + // KUidG711EncoderIntfc
1.117 + MG711EncoderIntfc* ptr = static_cast <MG711EncoderIntfc*> (iMMFDevSound->CustomInterface(KUidG711EncoderIntfc));
1.118 +
1.119 + if (ptr)
1.120 + {
1.121 + MG711EncoderIntfc::TEncodeMode encodeMode = MG711EncoderIntfc::EEncULaw;
1.122 + TInt setEncodeMode = MG711EncoderIntfc::EEncALaw;
1.123 +
1.124 + result = ptr->SetEncoderMode(encodeMode) ; // call method
1.125 +
1.126 + if (result == KErrNone)
1.127 + {
1.128 + // This file is created by the test stub, the plugin device
1.129 + _LIT(KFileName, "c:\\temp\\g711EncoderConfig.txt");
1.130 +
1.131 + ReadFileL(KFileName, setEncodeMode);
1.132 +
1.133 + if (static_cast<MG711EncoderIntfc::TEncodeMode>(setEncodeMode) == encodeMode)
1.134 + {
1.135 + INFO_PRINTF1(_L("MG711EncoderIntfc::SetEncoderMode finished successfully"));
1.136 +
1.137 + iTestStepResult = EPass;
1.138 + }
1.139 + else
1.140 + {
1.141 + ERR_PRINTF2(_L("MIlbcEncoderIntfc::SetEncoderMode failed with encodeMode %d"), encodeMode);
1.142 + }
1.143 + }
1.144 + else
1.145 + {
1.146 + ERR_PRINTF2(_L("MG711DecoderIntfc::SetEncoderMode failed with error %d"), result);
1.147 + }
1.148 + }
1.149 + else
1.150 + {
1.151 + INFO_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface"));
1.152 + iTestStepResult = EInconclusive;
1.153 + }
1.154 +
1.155 + return iTestStepResult;
1.156 + }
1.157 +
1.158 +
1.159 +TVerdict CTestStepCIG711EncoderConfig::DoTestStep0047L()
1.160 + {
1.161 + iTestStepResult = EFail;
1.162 + TInt result = KErrGeneral;
1.163 +
1.164 + INFO_PRINTF1(_L("G711EncoderIntfc - SetVadMode"));
1.165 +
1.166 + //Initialize - with the UID of our test HwDevice
1.167 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.168 + TUid testUID = {KUidG711EncoderConfigTestDevice};
1.169 + #else
1.170 + TFourCC testUID('T','0','1','6');
1.171 + #endif
1.172 +
1.173 + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
1.174 +
1.175 + if (iTestStepResult != EPass)
1.176 + {
1.177 + INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
1.178 + return EInconclusive;
1.179 + }
1.180 +
1.181 + // reset the value as previous test is pass
1.182 + iTestStepResult = EFail;
1.183 +
1.184 + // KUidG711EncoderIntfc
1.185 + MG711EncoderIntfc* ptr = static_cast <MG711EncoderIntfc*> (iMMFDevSound->CustomInterface(KUidG711EncoderIntfc));
1.186 +
1.187 + if (ptr)
1.188 + {
1.189 + TBool vadModeOn = EFalse;
1.190 +
1.191 + result = ptr->SetVadMode(ETrue); // call method
1.192 +
1.193 + if (result == KErrNone)
1.194 + {
1.195 + INFO_PRINTF1(_L("MG711EncoderIntfc::SetVadMode finished successfully"));
1.196 +
1.197 + result = ptr->GetVadMode(vadModeOn);
1.198 +
1.199 + if ( (result == KErrNone) && vadModeOn)
1.200 + {
1.201 + INFO_PRINTF1(_L("MG711EncoderIntfc::GetVadMode finished successfully"));
1.202 +
1.203 + iTestStepResult = EPass;
1.204 + }
1.205 + else
1.206 + {
1.207 + ERR_PRINTF3(_L("MG711EncoderIntfc::GetVadMode failed with result %d vadModeOn %d"), result, vadModeOn);
1.208 + }
1.209 + }
1.210 + else
1.211 + {
1.212 + ERR_PRINTF2(_L("MG711DecoderIntfc::SetVadMode failed with error %d"), result);
1.213 + }
1.214 + }
1.215 + else
1.216 + {
1.217 + INFO_PRINTF1(_L("MG711EncoderIntfc failed to retrieve the interface"));
1.218 + iTestStepResult = EInconclusive;
1.219 + }
1.220 +
1.221 + return iTestStepResult;
1.222 + }
1.223 +
1.224 +
1.225 +TVerdict CTestStepCIG711EncoderConfig::DoTestStep0048L()
1.226 + {
1.227 + iTestStepResult = EFail;
1.228 + TInt result = KErrGeneral;
1.229 +
1.230 + INFO_PRINTF1(_L("G711EncoderIntfc - GetVadMode"));
1.231 +
1.232 + //Initialize - with the UID of our test HwDevice
1.233 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.234 + TUid testUID = {KUidG711EncoderConfigTestDevice};
1.235 + #else
1.236 + TFourCC testUID('T','0','1','6');
1.237 + #endif
1.238 +
1.239 + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
1.240 +
1.241 + if (iTestStepResult != EPass)
1.242 + {
1.243 + INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
1.244 + return EInconclusive;
1.245 + }
1.246 +
1.247 + // reset the value as previous test is pass
1.248 + iTestStepResult = EFail;
1.249 +
1.250 + // KUidG711EncoderIntfc
1.251 + MG711EncoderIntfc* ptr = static_cast <MG711EncoderIntfc*> (iMMFDevSound->CustomInterface(KUidG711EncoderIntfc));
1.252 +
1.253 + if (ptr)
1.254 + {
1.255 + TBool vadModeOn = EFalse;
1.256 +
1.257 + result = ptr->SetVadMode(ETrue); // call method
1.258 +
1.259 + if (result == KErrNone)
1.260 + {
1.261 + INFO_PRINTF1(_L("MG711EncoderIntfc::SetVadMode finished successfully"));
1.262 +
1.263 + result = ptr->GetVadMode(vadModeOn);
1.264 +
1.265 + if ( (result == KErrNone) && vadModeOn)
1.266 + {
1.267 + INFO_PRINTF1(_L("MG711EncoderIntfc::GetVadMode finished successfully"));
1.268 +
1.269 + result = ptr->SetVadMode(EFalse);
1.270 +
1.271 + if (result == KErrNone)
1.272 + {
1.273 + INFO_PRINTF1(_L("MG711EncoderIntfc::SetVadMode finished successfully"));
1.274 +
1.275 + result = ptr->GetVadMode(vadModeOn);
1.276 +
1.277 + if ( (result == KErrNone) && !vadModeOn)
1.278 + {
1.279 + INFO_PRINTF1(_L("MG711EncoderIntfc::GetVadMode finished successfully"));
1.280 +
1.281 + iTestStepResult = EPass;
1.282 + }
1.283 + else
1.284 + {
1.285 + ERR_PRINTF3(_L("MG711EncoderIntfc::GetVadMode failed with result %d vadModeOn %d"), result, vadModeOn);
1.286 + }
1.287 + }
1.288 + else
1.289 + {
1.290 + ERR_PRINTF2(_L("MG711EncoderIntfc::SetVadMode failed with result %d"), result);
1.291 + }
1.292 + }
1.293 + else
1.294 + {
1.295 + ERR_PRINTF3(_L("MG711EncoderIntfc::GetVadMode failed with result %d vadModeOn %d"), result, vadModeOn);
1.296 + }
1.297 + }
1.298 + else
1.299 + {
1.300 + ERR_PRINTF2(_L("MG711EncoderIntfc::SetVadMode failed with result %d"), result);
1.301 + }
1.302 + }
1.303 + else
1.304 + {
1.305 + INFO_PRINTF1(_L("MG711EncoderIntfc failed to retrieve the interface"));
1.306 + iTestStepResult = EInconclusive;
1.307 + }
1.308 +
1.309 + return iTestStepResult;
1.310 + }