os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepcieaacplusdecoder.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/teststepcieaacplusdecoder.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,431 @@
     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 "teststepcieaacplusdecoder.h"
    1.20 +
    1.21 +/*****************************************************************************/
    1.22 +CTestStepCIEAacPlusDecoder::CTestStepCIEAacPlusDecoder()
    1.23 +	{
    1.24 +	iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0008-HP");
    1.25 +	}
    1.26 +
    1.27 +/*****************************************************************************/
    1.28 +TVerdict CTestStepCIEAacPlusDecoder::DoTestStepL()
    1.29 +	{
    1.30 +	INFO_PRINTF1(_L("Initializing test EAAC+ Decoder CI device"));
    1.31 +	
    1.32 +	//Initialize - with the UID of our test HwDevice and try to get the interface
    1.33 +	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    1.34 +	TUid testUID = {KUidEAacPlusDecoderTestDevice};
    1.35 +	#else
    1.36 +	TFourCC testUID('T','0','0','2');
    1.37 +	#endif
    1.38 +	
    1.39 +	MEAacPlusDecoderIntfc* interface = NULL;
    1.40 +	interface = static_cast<MEAacPlusDecoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidEAacPlusDecoderIntfc));
    1.41 +
    1.42 +	if (interface)
    1.43 +		{
    1.44 +		iTestStepResult = EPass;
    1.45 +		INFO_PRINTF1(_L("Successfully retrieved the interface."));
    1.46 +		}
    1.47 +	else
    1.48 +		{
    1.49 +		iTestStepResult = EFail;
    1.50 +		ERR_PRINTF1(_L("Failed to retrieve the interface"));
    1.51 +		}
    1.52 +	return iTestStepResult;
    1.53 +	}
    1.54 +
    1.55 +/*****************************************************************************/
    1.56 +CTestStepCIEAacPlusDecoderGetSetFrequency::CTestStepCIEAacPlusDecoderGetSetFrequency(TBool aIsGetTest) 
    1.57 +											: iIsGetTest(aIsGetTest)
    1.58 +	{
    1.59 +	if (iIsGetTest)
    1.60 +		{
    1.61 +		iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0015-HP");		
    1.62 +		}
    1.63 +	else
    1.64 +		{
    1.65 +		iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0009-HP");
    1.66 +		}
    1.67 +	}
    1.68 +
    1.69 +TVerdict CTestStepCIEAacPlusDecoderGetSetFrequency::DoTestStepL()
    1.70 +	{
    1.71 +	INFO_PRINTF1(_L("Initializing test EAAC+ Decoder CI device"));
    1.72 +	
    1.73 +	//Initialize - with the UID of our test HwDevice and try to get the interface
    1.74 +	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    1.75 +	TUid testUID = {KUidEAacPlusDecoderTestDevice};
    1.76 +	#else
    1.77 +	TFourCC testUID('T','0','0','2');
    1.78 +	#endif
    1.79 +	
    1.80 +	MEAacPlusDecoderIntfc* interface = NULL;
    1.81 +	interface = static_cast<MEAacPlusDecoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidEAacPlusDecoderIntfc));
    1.82 +	
    1.83 +	if (interface)
    1.84 +		{
    1.85 +		INFO_PRINTF1(_L("Setting the EAAC+ Decoder's Sampling Frequency"));
    1.86 +		TUint frequency = 666;
    1.87 +		interface->SetInputSamplingFrequency(frequency);
    1.88 +		
    1.89 +		TUint testFrequency;
    1.90 +		TInt err = interface->GetInputSamplingFrequency(testFrequency);
    1.91 +		if (err == KErrNone && testFrequency == frequency)
    1.92 +			{
    1.93 +			iTestStepResult = EPass;
    1.94 +			if (iIsGetTest)
    1.95 +				{
    1.96 +				INFO_PRINTF1(_L("Successfully got the frequency."));
    1.97 +				}
    1.98 +			else
    1.99 +				{
   1.100 +				INFO_PRINTF1(_L("Successfully set the frequency."));
   1.101 +				}
   1.102 +			}
   1.103 +		else
   1.104 +			{
   1.105 +			iTestStepResult = EFail;
   1.106 +			if (iIsGetTest)
   1.107 +				{
   1.108 +				ERR_PRINTF1(_L("Failed to get the frequency"));
   1.109 +				}
   1.110 +			else
   1.111 +				{
   1.112 +				ERR_PRINTF1(_L("Failed to set the frequency"));			
   1.113 +				}
   1.114 +			}
   1.115 +		}
   1.116 +	else
   1.117 +		{
   1.118 +		iTestStepResult = EInconclusive;
   1.119 +		ERR_PRINTF1(_L("Failed to retrieve the interface."));
   1.120 +		}
   1.121 +
   1.122 +	return iTestStepResult;
   1.123 +	}
   1.124 +
   1.125 +/*****************************************************************************/
   1.126 +CTestStepCIEAacPlusDecoderGetSetObjType::CTestStepCIEAacPlusDecoderGetSetObjType(TBool aIsGetTest) 
   1.127 +										: iIsGetTest(aIsGetTest)
   1.128 +	{
   1.129 +	if (iIsGetTest)
   1.130 +		{
   1.131 +		iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0016-HP");		
   1.132 +		}
   1.133 +	else
   1.134 +		{
   1.135 +		iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0010-HP");
   1.136 +		}
   1.137 +	}
   1.138 +
   1.139 +TVerdict CTestStepCIEAacPlusDecoderGetSetObjType::DoTestStepL()
   1.140 +	{
   1.141 +	INFO_PRINTF1(_L("Initializing test EAAC+ Decoder CI device"));
   1.142 +	
   1.143 +	//Initialize - with the UID of our test HwDevice and try to get the interface
   1.144 +	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   1.145 +	TUid testUID = {KUidEAacPlusDecoderTestDevice};
   1.146 +	#else
   1.147 +	TFourCC testUID('T','0','0','2');
   1.148 +	#endif
   1.149 +	
   1.150 +	MEAacPlusDecoderIntfc* interface = NULL;
   1.151 +	interface = static_cast<MEAacPlusDecoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidEAacPlusDecoderIntfc));
   1.152 +	if (interface)
   1.153 +		{
   1.154 +		INFO_PRINTF1(_L("Setting the EAAC+ Decoder's Object Type"));
   1.155 +		
   1.156 +		MEAacPlusDecoderIntfc::TAudioObjectType audioObjectType = MEAacPlusDecoderIntfc::EAacLtp;
   1.157 +		interface->SetAudioObjectType(audioObjectType);
   1.158 +		
   1.159 +		MEAacPlusDecoderIntfc::TAudioObjectType testAudioObjectType;
   1.160 +		interface->GetAudioObjectType(testAudioObjectType);
   1.161 +		if (audioObjectType == testAudioObjectType)
   1.162 +			{
   1.163 +			iTestStepResult = EPass;
   1.164 +			if (iIsGetTest)
   1.165 +				{
   1.166 +				INFO_PRINTF1(_L("Successfully got the object type."));
   1.167 +				}
   1.168 +			else
   1.169 +				{
   1.170 +				INFO_PRINTF1(_L("Successfully set the object type."));				
   1.171 +				}
   1.172 +			}
   1.173 +		else
   1.174 +			{
   1.175 +			iTestStepResult = EFail;
   1.176 +			if (iIsGetTest)
   1.177 +				{
   1.178 +				ERR_PRINTF1(_L("Failed to get the object type"));
   1.179 +				}
   1.180 +			else
   1.181 +				{
   1.182 +				ERR_PRINTF1(_L("Failed to set the object type"));
   1.183 +				}
   1.184 +			}
   1.185 +		}
   1.186 +	else
   1.187 +		{
   1.188 +		iTestStepResult = EInconclusive;
   1.189 +		ERR_PRINTF1(_L("Failed to retrieve the interface."));
   1.190 +		}
   1.191 +
   1.192 +	return iTestStepResult;
   1.193 +	}
   1.194 +	
   1.195 +/*****************************************************************************/
   1.196 +CTestStepCIEAacPlusDecoderGetSetNumChannels::CTestStepCIEAacPlusDecoderGetSetNumChannels(TBool aIsGetTest) 
   1.197 +											: iIsGetTest(aIsGetTest)
   1.198 +	{
   1.199 +	if (iIsGetTest)
   1.200 +		{
   1.201 +		iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0017-HP");
   1.202 +		}
   1.203 +	else
   1.204 +		{
   1.205 +		iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0011-HP");
   1.206 +		}
   1.207 +	}
   1.208 +
   1.209 +TVerdict CTestStepCIEAacPlusDecoderGetSetNumChannels::DoTestStepL()
   1.210 +	{
   1.211 +	INFO_PRINTF1(_L("Initializing test EAAC+ Decoder CI device"));
   1.212 +	
   1.213 +	//Initialize - with the UID of our test HwDevice and try to get the interface
   1.214 +	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   1.215 +	TUid testUID = {KUidEAacPlusDecoderTestDevice};
   1.216 +	#else
   1.217 +	TFourCC testUID('T','0','0','2');
   1.218 +	#endif
   1.219 +	
   1.220 +	MEAacPlusDecoderIntfc* interface = NULL;
   1.221 +	interface = static_cast<MEAacPlusDecoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidEAacPlusDecoderIntfc));
   1.222 +	if (interface)
   1.223 +		{
   1.224 +		INFO_PRINTF1(_L("Setting the EAAC+ Decoder's Number of Channels"));
   1.225 +		TUint numChannels = 2;
   1.226 +		interface->SetNumOfChannels(numChannels);
   1.227 +		
   1.228 +		TUint testNumChannels;
   1.229 +		interface->GetNumOfChannels(testNumChannels);
   1.230 +		if (testNumChannels == numChannels)
   1.231 +			{
   1.232 +			iTestStepResult = EPass;
   1.233 +			if (iIsGetTest)
   1.234 +				{
   1.235 +				INFO_PRINTF1(_L("Successfully got the number of channels."));
   1.236 +				}
   1.237 +			else
   1.238 +				{
   1.239 +				INFO_PRINTF1(_L("Successfully set the number of channels."));				
   1.240 +				}
   1.241 +			}
   1.242 +		else
   1.243 +			{
   1.244 +			iTestStepResult = EFail;
   1.245 +			if (iIsGetTest)
   1.246 +				{
   1.247 +				ERR_PRINTF1(_L("Failed to get the number of channels"));
   1.248 +				}
   1.249 +			else
   1.250 +				{
   1.251 +				ERR_PRINTF1(_L("Failed to set the number of channels"));
   1.252 +				}
   1.253 +			}
   1.254 +		}
   1.255 +	else
   1.256 +		{
   1.257 +		iTestStepResult = EInconclusive;
   1.258 +		ERR_PRINTF1(_L("Failed to retrieve the interface."));
   1.259 +		}
   1.260 +
   1.261 +	return iTestStepResult;
   1.262 +	}
   1.263 +
   1.264 +/*****************************************************************************/
   1.265 +CTestStepCIEAacPlusDecoderGetSetSbr::CTestStepCIEAacPlusDecoderGetSetSbr(TBool aIsGetTest) 
   1.266 +									: iIsGetTest(aIsGetTest)
   1.267 +	{
   1.268 +	if (iIsGetTest)
   1.269 +		{
   1.270 +		iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0018-HP");		
   1.271 +		}
   1.272 +	else
   1.273 +		{
   1.274 +		iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0012-HP");
   1.275 +		}
   1.276 +	}
   1.277 +
   1.278 +TVerdict CTestStepCIEAacPlusDecoderGetSetSbr::DoTestStepL()
   1.279 +	{
   1.280 +	INFO_PRINTF1(_L("Initializing test EAAC+ Decoder CI device"));
   1.281 +	
   1.282 +	//Initialize - with the UID of our test HwDevice and try to get the interface
   1.283 +	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   1.284 +	TUid testUID = {KUidEAacPlusDecoderTestDevice};
   1.285 +	#else
   1.286 +	TFourCC testUID('T','0','0','2');
   1.287 +	#endif
   1.288 +	
   1.289 +	MEAacPlusDecoderIntfc* interface = NULL;
   1.290 +	interface = static_cast<MEAacPlusDecoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidEAacPlusDecoderIntfc));
   1.291 +	if (interface)
   1.292 +		{
   1.293 +		INFO_PRINTF1(_L("Setting the EAAC+ Decoder's SBR"));
   1.294 +		interface->SetSbr(ETrue);
   1.295 +		
   1.296 +		TBool testSbr = EFalse;
   1.297 +		interface->GetSbr(testSbr);
   1.298 +		if (testSbr)
   1.299 +			{
   1.300 +			iTestStepResult = EPass;
   1.301 +			if (iIsGetTest)
   1.302 +				{			
   1.303 +				INFO_PRINTF1(_L("Successfully got SBR."));
   1.304 +				}
   1.305 +			else
   1.306 +				{				
   1.307 +				INFO_PRINTF1(_L("Successfully set SBR."));
   1.308 +				}
   1.309 +			}
   1.310 +		else
   1.311 +			{
   1.312 +			iTestStepResult = EFail;
   1.313 +			if (iIsGetTest)
   1.314 +				{
   1.315 +				ERR_PRINTF1(_L("Failed to get SBR."));
   1.316 +				}
   1.317 +			else
   1.318 +				{
   1.319 +				ERR_PRINTF1(_L("Failed to set SBR."));	
   1.320 +				}
   1.321 +			}
   1.322 +		}
   1.323 +	else
   1.324 +		{
   1.325 +		iTestStepResult = EInconclusive;
   1.326 +		ERR_PRINTF1(_L("Failed to retrieve the interface."));
   1.327 +		}
   1.328 +
   1.329 +	return iTestStepResult;
   1.330 +	}
   1.331 +	
   1.332 +/*****************************************************************************/
   1.333 +CTestStepCIEAacPlusDecoderGetSetDsm::CTestStepCIEAacPlusDecoderGetSetDsm(TBool aIsGetTest) 
   1.334 +									: iIsGetTest(aIsGetTest)
   1.335 +	{
   1.336 +	if (iIsGetTest)
   1.337 +		{
   1.338 +		iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0019-HP");
   1.339 +		}
   1.340 +	else
   1.341 +		{
   1.342 +		iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0013-HP");
   1.343 +		}
   1.344 +	}
   1.345 +
   1.346 +TVerdict CTestStepCIEAacPlusDecoderGetSetDsm::DoTestStepL()
   1.347 +	{
   1.348 +	INFO_PRINTF1(_L("Initializing test EAAC+ Decoder CI device"));
   1.349 +	
   1.350 +	//Initialize - with the UID of our test HwDevice and try to get the interface
   1.351 +	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   1.352 +	TUid testUID = {KUidEAacPlusDecoderTestDevice};
   1.353 +	#else
   1.354 +	TFourCC testUID('T','0','0','2');
   1.355 +	#endif
   1.356 +	
   1.357 +	MEAacPlusDecoderIntfc* interface = NULL;
   1.358 +	interface = static_cast<MEAacPlusDecoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidEAacPlusDecoderIntfc));
   1.359 +	if (interface)
   1.360 +		{
   1.361 +		INFO_PRINTF1(_L("Setting the EAAC+ Decoder's Down Sampled Mode"));
   1.362 +		interface->SetDownSampledMode(ETrue);
   1.363 +		
   1.364 +		TBool testDSM = EFalse;
   1.365 +		interface->GetDownSampledMode(testDSM);
   1.366 +		if (testDSM)
   1.367 +			{
   1.368 +			iTestStepResult = EPass;
   1.369 +			if (iIsGetTest)
   1.370 +				{
   1.371 +				INFO_PRINTF1(_L("Successfully got the DSM."));
   1.372 +				}
   1.373 +			else
   1.374 +				{
   1.375 +				INFO_PRINTF1(_L("Successfully set the DSM."));
   1.376 +				}
   1.377 +			}
   1.378 +		else
   1.379 +			{
   1.380 +			iTestStepResult = EFail;
   1.381 +				ERR_PRINTF1(_L("Failed to set the DSM."));
   1.382 +			}
   1.383 +		}
   1.384 +	else
   1.385 +		{
   1.386 +		iTestStepResult = EInconclusive;
   1.387 +		ERR_PRINTF1(_L("Failed to retrieve the interface."));
   1.388 +		}
   1.389 +
   1.390 +	return iTestStepResult;
   1.391 +	}
   1.392 +	
   1.393 +/*****************************************************************************/
   1.394 +CTestStepCIEAacPlusDecoderApplyConfig::CTestStepCIEAacPlusDecoderApplyConfig()
   1.395 +	{
   1.396 +
   1.397 +	iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0014-HP");
   1.398 +	}
   1.399 +
   1.400 +TVerdict CTestStepCIEAacPlusDecoderApplyConfig::DoTestStepL()
   1.401 +	{
   1.402 +	INFO_PRINTF1(_L("Initializing test EAAC+ Decoder CI device"));
   1.403 +	
   1.404 +	//Initialize - with the UID of our test HwDevice and try to get the interface
   1.405 +	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   1.406 +	TUid testUID = {KUidEAacPlusDecoderTestDevice};
   1.407 +	#else
   1.408 +	TFourCC testUID('T','0','0','2');
   1.409 +	#endif
   1.410 +	
   1.411 +	MEAacPlusDecoderIntfc* interface = NULL;
   1.412 +	interface = static_cast<MEAacPlusDecoderIntfc*>(InitializeAndInstantiateInterfaceL(testUID, KUidEAacPlusDecoderIntfc));
   1.413 +	if (interface)
   1.414 +		{
   1.415 +		INFO_PRINTF1(_L("Applying the config to the EAAC+ Decoder"));
   1.416 +		TInt err = interface->ApplyConfig();
   1.417 +		if (err == KErrNone)
   1.418 +			{
   1.419 +			iTestStepResult = EPass;
   1.420 +			INFO_PRINTF1(_L("Successfully applied the config."));
   1.421 +			}
   1.422 +		else
   1.423 +			{
   1.424 +			iTestStepResult = EFail;
   1.425 +			ERR_PRINTF2(_L("Failed to apply the config, error: %d"), err);
   1.426 +			}
   1.427 +		}
   1.428 +	else
   1.429 +		{
   1.430 +		iTestStepResult = EInconclusive;
   1.431 +		ERR_PRINTF1(_L("Failed to retrieve the interface."));
   1.432 +		}
   1.433 +	return iTestStepResult;
   1.434 +	}