os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepcig711decoderconfig.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepcig711decoderconfig.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,502 @@
     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 "teststepcig711decoderconfig.h"
    1.20 +
    1.21 +
    1.22 +TVerdict CTestStepCIG711DecoderConfig::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-0040-HP")) == 0)
    1.29 +		{
    1.30 +		iTestStepResult = DoTestStep0040L();
    1.31 +		}
    1.32 +	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0041-HP")) == 0)
    1.33 +		{
    1.34 +		iTestStepResult = DoTestStep0041L();
    1.35 +		}
    1.36 +	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0042-HP")) == 0)
    1.37 +		{
    1.38 +		iTestStepResult = DoTestStep0042L();
    1.39 +		}
    1.40 +	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0043-HP")) == 0)
    1.41 +		{
    1.42 +		iTestStepResult = DoTestStep0043L();
    1.43 +		}
    1.44 +	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0044-HP")) == 0)
    1.45 +		{
    1.46 +		iTestStepResult = DoTestStep0044L();
    1.47 +		}
    1.48 +	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0094-HP")) == 0)
    1.49 +		{
    1.50 +		iTestStepResult = DoTestStep0094L();
    1.51 +		}
    1.52 +	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0095-HP")) == 0)
    1.53 +		{
    1.54 +		iTestStepResult = DoTestStep0095L();
    1.55 +		}
    1.56 +
    1.57 +	return iTestStepResult;
    1.58 +	}
    1.59 +
    1.60 +
    1.61 +TVerdict CTestStepCIG711DecoderConfig::DoTestStep0040L()
    1.62 +	{
    1.63 +	iTestStepResult = EFail;
    1.64 +
    1.65 +	INFO_PRINTF1(_L("G711DecoderIntfc - Instantiating"));
    1.66 +
    1.67 +	//Initialize - with the UID of our test HwDevice
    1.68 +	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    1.69 +	TUid testUID = {KUidG711DecoderConfigTestDevice};
    1.70 +	#else
    1.71 +	TFourCC testUID('T','0','1','5');
    1.72 +	#endif
    1.73 +		
    1.74 +	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
    1.75 +	
    1.76 +	if (iTestStepResult != EPass)
    1.77 +		{
    1.78 +		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
    1.79 +		return EInconclusive;
    1.80 +		}
    1.81 +
    1.82 +	// reset the value as previous test is pass
    1.83 +	iTestStepResult = EFail;  
    1.84 +
    1.85 +	// KUidG711DecoderIntfc
    1.86 +	MG711DecoderIntfc* ptr = static_cast <MG711DecoderIntfc*> (iMMFDevSound->CustomInterface(KUidG711DecoderIntfc));
    1.87 +
    1.88 +	if (ptr)
    1.89 +		{
    1.90 +		INFO_PRINTF1(_L("MG711DecoderIntfc instantiated successfully"));
    1.91 +
    1.92 +		iTestStepResult = EPass;
    1.93 +		}
    1.94 +	else
    1.95 +		{
    1.96 +		ERR_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface"));
    1.97 +		}
    1.98 +
    1.99 +	return iTestStepResult;
   1.100 +	}
   1.101 +
   1.102 +
   1.103 +TVerdict CTestStepCIG711DecoderConfig::DoTestStep0041L()
   1.104 +	{
   1.105 +	iTestStepResult = EFail;
   1.106 +	TInt result = KErrGeneral;
   1.107 +
   1.108 +	INFO_PRINTF1(_L("G711DecoderIntfc - SetDecoderMode"));
   1.109 +
   1.110 +	//Initialize - with the UID of our test HwDevice
   1.111 +	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   1.112 +	TUid testUID = {KUidG711DecoderConfigTestDevice};
   1.113 +	#else
   1.114 +	TFourCC testUID('T','0','1','5');
   1.115 +	#endif
   1.116 +	
   1.117 +	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   1.118 +
   1.119 +	if (iTestStepResult != EPass)
   1.120 +		{
   1.121 +		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   1.122 +		return EInconclusive;
   1.123 +		}
   1.124 +
   1.125 +	// reset the value as previous test is pass
   1.126 +	iTestStepResult = EFail;  
   1.127 +
   1.128 +	// KUidG711DecoderIntfc
   1.129 +	MG711DecoderIntfc* ptr = static_cast <MG711DecoderIntfc*> (iMMFDevSound->CustomInterface(KUidG711DecoderIntfc));
   1.130 +
   1.131 +	if (ptr)
   1.132 +		{
   1.133 +		result = ptr->SetDecoderMode(MG711DecoderIntfc::EDecULaw); // call method
   1.134 +		
   1.135 +		if (result == KErrNone)
   1.136 +			{
   1.137 +			INFO_PRINTF1(_L("MG711DecoderIntfc::SetDecoderMode finished successfully"));
   1.138 +
   1.139 +			iTestStepResult = EPass;		
   1.140 +			}
   1.141 +		else
   1.142 +			{
   1.143 +			ERR_PRINTF2(_L("MG711DecoderIntfc::SetDecoderMode failed with error %d"), result);
   1.144 +			}
   1.145 +		}
   1.146 +	else
   1.147 +		{
   1.148 +		INFO_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface"));
   1.149 +		iTestStepResult = EInconclusive;
   1.150 +		}
   1.151 +
   1.152 +	return iTestStepResult;
   1.153 +	}
   1.154 +
   1.155 +
   1.156 +TVerdict CTestStepCIG711DecoderConfig::DoTestStep0094L()
   1.157 +	{
   1.158 +	iTestStepResult = EFail;
   1.159 +	TInt result = KErrGeneral;
   1.160 +
   1.161 +	INFO_PRINTF1(_L("G711DecoderIntfc - GetDecoderMode"));
   1.162 +
   1.163 +	//Initialize - with the UID of our test HwDevice
   1.164 +	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   1.165 +	TUid testUID = {KUidG711DecoderConfigTestDevice};
   1.166 +	#else
   1.167 +	TFourCC testUID('T','0','1','5');
   1.168 +	#endif
   1.169 +	
   1.170 +	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   1.171 +
   1.172 +	if (iTestStepResult != EPass)
   1.173 +		{
   1.174 +		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   1.175 +		return EInconclusive;
   1.176 +		}
   1.177 +
   1.178 +	// reset the value as previous test is pass
   1.179 +	iTestStepResult = EFail;  
   1.180 +
   1.181 +	// KUidG711DecoderIntfc
   1.182 +	MG711DecoderIntfc* ptr = static_cast <MG711DecoderIntfc*> (iMMFDevSound->CustomInterface(KUidG711DecoderIntfc));
   1.183 +
   1.184 +	if (ptr)
   1.185 +		{
   1.186 +		MG711DecoderIntfc::TDecodeMode decodeMode = MG711DecoderIntfc::EDecULaw;
   1.187 +
   1.188 +		result = ptr->SetDecoderMode(MG711DecoderIntfc::EDecALaw);
   1.189 +		
   1.190 +		if (result == KErrNone)
   1.191 +			{
   1.192 +			INFO_PRINTF1(_L("MG711DecoderIntfc::SetDecoderMode finished successfully"));
   1.193 +
   1.194 +			result = ptr->GetDecoderMode(decodeMode); // call method
   1.195 +
   1.196 +			if (MG711DecoderIntfc::EDecALaw == decodeMode)
   1.197 +				{
   1.198 +				INFO_PRINTF1(_L("MG711DecoderIntfc::GetDecoderMode finished successfully"));
   1.199 +
   1.200 +				iTestStepResult = EPass;
   1.201 +				}
   1.202 +			else
   1.203 +				{
   1.204 +				ERR_PRINTF3(_L("MG711DecoderIntfc::GetDecoderMode failed with result %d decodeMode %d"), result, decodeMode);
   1.205 +				}			
   1.206 +			}
   1.207 +		else
   1.208 +			{
   1.209 +			ERR_PRINTF2(_L("MG711DecoderIntfc::SetDecoderMode failed with error %d"), result);
   1.210 +			}
   1.211 +		}
   1.212 +	else
   1.213 +		{
   1.214 +		INFO_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface"));
   1.215 +		iTestStepResult = EInconclusive;
   1.216 +		}
   1.217 +
   1.218 +	return iTestStepResult;
   1.219 +	}
   1.220 +
   1.221 +
   1.222 +TVerdict CTestStepCIG711DecoderConfig::DoTestStep0042L()
   1.223 +	{
   1.224 +	iTestStepResult = EFail;
   1.225 +	TInt result = KErrGeneral;
   1.226 +
   1.227 +	INFO_PRINTF1(_L("G711DecoderIntfc - SetComfortNoiseGeneration"));
   1.228 +
   1.229 +	//Initialize - with the UID of our test HwDevice
   1.230 +	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   1.231 +	TUid testUID = {KUidG711DecoderConfigTestDevice};
   1.232 +	#else
   1.233 +	TFourCC testUID('T','0','1','5');
   1.234 +	#endif
   1.235 +	
   1.236 +	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   1.237 +
   1.238 +	if (iTestStepResult != EPass)
   1.239 +		{
   1.240 +		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   1.241 +		return EInconclusive;
   1.242 +		}
   1.243 +
   1.244 +	// reset the value as previous test is pass
   1.245 +	iTestStepResult = EFail;  
   1.246 +
   1.247 +	// KUidG711DecoderIntfc
   1.248 +	MG711DecoderIntfc* ptr = static_cast <MG711DecoderIntfc*> (iMMFDevSound->CustomInterface(KUidG711DecoderIntfc));
   1.249 +
   1.250 +	if (ptr)
   1.251 +		{
   1.252 +		TBool cng = ETrue;
   1.253 +
   1.254 +		result = ptr->SetComfortNoiseGeneration(cng); // call method
   1.255 +		
   1.256 +		if (result == KErrNone)
   1.257 +			{
   1.258 +			INFO_PRINTF1(_L("MG711DecoderIntfc::SetComfortNoiseGeneration finished successfully"));
   1.259 +			
   1.260 +			result = ptr->GetComfortNoiseGeneration(cng);
   1.261 +			
   1.262 +			if ( (result == KErrNone) && cng)
   1.263 +				{
   1.264 +				INFO_PRINTF1(_L("MG711DecoderIntfc::GetComfortNoiseGeneration finished successfully"));
   1.265 +				
   1.266 +				result = ptr->SetComfortNoiseGeneration(EFalse);
   1.267 +				
   1.268 +				if (result == KErrNone)
   1.269 +					{
   1.270 +					INFO_PRINTF1(_L("MG711DecoderIntfc::SetComfortNoiseGeneration finished successfully"));
   1.271 +					
   1.272 +					result = ptr->GetComfortNoiseGeneration(cng);
   1.273 +			
   1.274 +					if ( (result == KErrNone) && !cng)
   1.275 +						{
   1.276 +						INFO_PRINTF1(_L("MG711DecoderIntfc::GetComfortNoiseGeneration finished successfully"));
   1.277 +
   1.278 +						iTestStepResult = EPass;
   1.279 +						}
   1.280 +					else
   1.281 +						{
   1.282 +						ERR_PRINTF3(_L("MG711DecoderIntfc::GetComfortNoiseGeneration failed with result %d  cng %d"), result, cng);
   1.283 +						}
   1.284 +					}
   1.285 +				else
   1.286 +					{
   1.287 +					ERR_PRINTF2(_L("MG711DecoderIntfc::SetComfortNoiseGeneration failed with result %d"), result);
   1.288 +					}
   1.289 +				}
   1.290 +			else
   1.291 +				{
   1.292 +				ERR_PRINTF3(_L("MG711DecoderIntfc::GetComfortNoiseGeneration failed with  result %d  cng %d"), result, cng);
   1.293 +				}
   1.294 +			}
   1.295 +		else
   1.296 +			{
   1.297 +			ERR_PRINTF2(_L("MG711DecoderIntfc::SetComfortNoiseGeneration failed with result %d"), result);
   1.298 +			}
   1.299 +		}
   1.300 +	else
   1.301 +		{
   1.302 +		INFO_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface"));
   1.303 +		iTestStepResult = EInconclusive;
   1.304 +		}
   1.305 +
   1.306 +	return iTestStepResult;
   1.307 +	}
   1.308 +
   1.309 +
   1.310 +TVerdict CTestStepCIG711DecoderConfig::DoTestStep0043L()
   1.311 +	{
   1.312 +	iTestStepResult = EFail;
   1.313 +	TInt result = KErrGeneral;
   1.314 +
   1.315 +	INFO_PRINTF1(_L("G711DecoderIntfc - GetComfortNoiseGeneration"));
   1.316 +
   1.317 +	//Initialize - with the UID of our test HwDevice
   1.318 +	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   1.319 +	TUid testUID = {KUidG711DecoderConfigTestDevice};
   1.320 +	#else
   1.321 +	TFourCC testUID('T','0','1','5');
   1.322 +	#endif
   1.323 +	
   1.324 +	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   1.325 +
   1.326 +	if (iTestStepResult != EPass)
   1.327 +		{
   1.328 +		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   1.329 +		return EInconclusive;
   1.330 +		}
   1.331 +
   1.332 +	// reset the value as previous test is pass
   1.333 +	iTestStepResult = EFail;  
   1.334 +
   1.335 +	// KUidG711DecoderIntfc
   1.336 +	MG711DecoderIntfc* ptr = static_cast <MG711DecoderIntfc*> (iMMFDevSound->CustomInterface(KUidG711DecoderIntfc));
   1.337 +
   1.338 +	TBool cng = ETrue;
   1.339 +
   1.340 +	if (ptr)
   1.341 +		{
   1.342 +		result = ptr->SetComfortNoiseGeneration(cng); // call method
   1.343 +		
   1.344 +		if (result == KErrNone)
   1.345 +			{
   1.346 +			INFO_PRINTF1(_L("MG711DecoderIntfc::SetComfortNoiseGeneration finished successfully"));
   1.347 +
   1.348 +			result = ptr->GetComfortNoiseGeneration(cng);
   1.349 +			
   1.350 +			if ( (result == KErrNone) && cng)
   1.351 +				{
   1.352 +				INFO_PRINTF1(_L("MG711DecoderIntfc::GetComfortNoiseGeneration finished successfully"));
   1.353 +
   1.354 +				iTestStepResult = EPass;
   1.355 +				}
   1.356 +			else
   1.357 +				{
   1.358 +				ERR_PRINTF3(_L("MG711DecoderIntfc::GetComfortNoiseGeneration failed with result %d cng %d"), result, cng);
   1.359 +				}
   1.360 +			}
   1.361 +		else
   1.362 +			{
   1.363 +			ERR_PRINTF2(_L("MG711DecoderIntfc::GetComfortNoiseGeneration failed with result %d"), result);
   1.364 +			}
   1.365 +		}
   1.366 +	else
   1.367 +		{
   1.368 +		INFO_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface"));
   1.369 +		iTestStepResult = EInconclusive;
   1.370 +		}
   1.371 +
   1.372 +	return iTestStepResult;
   1.373 +	}
   1.374 +
   1.375 +
   1.376 +TVerdict CTestStepCIG711DecoderConfig::DoTestStep0044L()
   1.377 +	{
   1.378 +	iTestStepResult = EFail;
   1.379 +	TInt result = KErrGeneral;
   1.380 +
   1.381 +	INFO_PRINTF1(_L("G711DecoderIntfc - SetPacketLossConcealment"));
   1.382 +
   1.383 +	//Initialize - with the UID of our test HwDevice
   1.384 +	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   1.385 +	TUid testUID = {KUidG711DecoderConfigTestDevice};
   1.386 +	#else
   1.387 +	TFourCC testUID('T','0','1','5');
   1.388 +	#endif
   1.389 +	
   1.390 +	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   1.391 +
   1.392 +	if (iTestStepResult != EPass)
   1.393 +		{
   1.394 +		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   1.395 +		return EInconclusive;
   1.396 +		}
   1.397 +
   1.398 +	// reset the value as previous test is pass
   1.399 +	iTestStepResult = EFail;  
   1.400 +
   1.401 +	// KUidG711DecoderIntfc
   1.402 +	MG711DecoderIntfc* ptr = static_cast <MG711DecoderIntfc*> (iMMFDevSound->CustomInterface(KUidG711DecoderIntfc));
   1.403 +
   1.404 +	if (ptr)
   1.405 +		{
   1.406 +		TBool plc = ETrue;
   1.407 +
   1.408 +		result = ptr->SetPacketLossConcealment(EFalse); // call method
   1.409 +		
   1.410 +		if (result == KErrNone)
   1.411 +			{
   1.412 +			INFO_PRINTF1(_L("MG711DecoderIntfc::SetPacketLossConcealment finished successfully"));
   1.413 +
   1.414 +			result = ptr->GetPacketLossConcealment(plc);
   1.415 +
   1.416 +			if ( (result == KErrNone) && (EFalse == plc) )
   1.417 +				{
   1.418 +				INFO_PRINTF1(_L("MG711DecoderIntfc::GetPacketLossConcealment finished successfully"));
   1.419 +
   1.420 +				iTestStepResult = EPass;
   1.421 +				}
   1.422 +			else
   1.423 +				{
   1.424 +				ERR_PRINTF3(_L("MG711DecoderIntfc::GetPacketLossConcealment failed with result %d  plc %d"), result, plc);
   1.425 +				}			
   1.426 +			}
   1.427 +		else
   1.428 +			{
   1.429 +			ERR_PRINTF2(_L("MG711DecoderIntfc::SetPacketLossConcealment failed with error %d"), result);
   1.430 +			}
   1.431 +		}
   1.432 +	else
   1.433 +		{
   1.434 +		INFO_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface"));
   1.435 +		iTestStepResult = EInconclusive;
   1.436 +		}
   1.437 +
   1.438 +	return iTestStepResult;
   1.439 +	}
   1.440 +
   1.441 +
   1.442 +TVerdict CTestStepCIG711DecoderConfig::DoTestStep0095L()
   1.443 +	{
   1.444 +	iTestStepResult = EFail;
   1.445 +	TInt result = KErrGeneral;
   1.446 +
   1.447 +	INFO_PRINTF1(_L("G711DecoderIntfc - GetPacketLossConcealment"));
   1.448 +
   1.449 +	//Initialize - with the UID of our test HwDevice
   1.450 +	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   1.451 +	TUid testUID = {KUidG711DecoderConfigTestDevice};
   1.452 +	#else
   1.453 +	TFourCC testUID('T','0','1','5');
   1.454 +	#endif
   1.455 +	
   1.456 +	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   1.457 +
   1.458 +	if (iTestStepResult != EPass)
   1.459 +		{
   1.460 +		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   1.461 +		return EInconclusive;
   1.462 +		}
   1.463 +
   1.464 +	// reset the value as previous test is pass
   1.465 +	iTestStepResult = EFail;  
   1.466 +
   1.467 +	// KUidG711DecoderIntfc
   1.468 +	MG711DecoderIntfc* ptr = static_cast <MG711DecoderIntfc*> (iMMFDevSound->CustomInterface(KUidG711DecoderIntfc));
   1.469 +
   1.470 +	if (ptr)
   1.471 +		{
   1.472 +		TBool plc = ETrue;
   1.473 +
   1.474 +		result = ptr->SetPacketLossConcealment(EFalse);
   1.475 +		
   1.476 +		if (result == KErrNone)
   1.477 +			{
   1.478 +			INFO_PRINTF1(_L("MG711DecoderIntfc::SetPacketLossConcealment finished successfully"));
   1.479 +
   1.480 +			result = ptr->GetPacketLossConcealment(plc); // call method
   1.481 +
   1.482 +			if ( (result == KErrNone) && (EFalse == plc) )
   1.483 +				{
   1.484 +				INFO_PRINTF1(_L("MG711DecoderIntfc::GetPacketLossConcealment finished successfully"));
   1.485 +
   1.486 +				iTestStepResult = EPass;
   1.487 +				}
   1.488 +			else
   1.489 +				{
   1.490 +				ERR_PRINTF3(_L("MG711DecoderIntfc::GetPacketLossConcealment failed with result %d  plc %d"), result, plc);
   1.491 +				}			
   1.492 +			}
   1.493 +		else
   1.494 +			{
   1.495 +			ERR_PRINTF2(_L("MG711DecoderIntfc::SetPacketLossConcealment failed with error %d"), result);
   1.496 +			}
   1.497 +		}
   1.498 +	else
   1.499 +		{
   1.500 +		INFO_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface"));
   1.501 +		iTestStepResult = EInconclusive;
   1.502 +		}
   1.503 +
   1.504 +	return iTestStepResult;
   1.505 +	}