os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepcig711decoderconfig.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #include "teststepcig711decoderconfig.h"
    17 
    18 
    19 TVerdict CTestStepCIG711DecoderConfig::DoTestStepL()
    20 	{
    21 	iTestStepResult = ETestSuiteError;
    22 
    23 	INFO_PRINTF1(_L("Initializing test CI device"));
    24 
    25 	if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0040-HP")) == 0)
    26 		{
    27 		iTestStepResult = DoTestStep0040L();
    28 		}
    29 	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0041-HP")) == 0)
    30 		{
    31 		iTestStepResult = DoTestStep0041L();
    32 		}
    33 	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0042-HP")) == 0)
    34 		{
    35 		iTestStepResult = DoTestStep0042L();
    36 		}
    37 	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0043-HP")) == 0)
    38 		{
    39 		iTestStepResult = DoTestStep0043L();
    40 		}
    41 	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0044-HP")) == 0)
    42 		{
    43 		iTestStepResult = DoTestStep0044L();
    44 		}
    45 	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0094-HP")) == 0)
    46 		{
    47 		iTestStepResult = DoTestStep0094L();
    48 		}
    49 	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0095-HP")) == 0)
    50 		{
    51 		iTestStepResult = DoTestStep0095L();
    52 		}
    53 
    54 	return iTestStepResult;
    55 	}
    56 
    57 
    58 TVerdict CTestStepCIG711DecoderConfig::DoTestStep0040L()
    59 	{
    60 	iTestStepResult = EFail;
    61 
    62 	INFO_PRINTF1(_L("G711DecoderIntfc - Instantiating"));
    63 
    64 	//Initialize - with the UID of our test HwDevice
    65 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    66 	TUid testUID = {KUidG711DecoderConfigTestDevice};
    67 	#else
    68 	TFourCC testUID('T','0','1','5');
    69 	#endif
    70 		
    71 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
    72 	
    73 	if (iTestStepResult != EPass)
    74 		{
    75 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
    76 		return EInconclusive;
    77 		}
    78 
    79 	// reset the value as previous test is pass
    80 	iTestStepResult = EFail;  
    81 
    82 	// KUidG711DecoderIntfc
    83 	MG711DecoderIntfc* ptr = static_cast <MG711DecoderIntfc*> (iMMFDevSound->CustomInterface(KUidG711DecoderIntfc));
    84 
    85 	if (ptr)
    86 		{
    87 		INFO_PRINTF1(_L("MG711DecoderIntfc instantiated successfully"));
    88 
    89 		iTestStepResult = EPass;
    90 		}
    91 	else
    92 		{
    93 		ERR_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface"));
    94 		}
    95 
    96 	return iTestStepResult;
    97 	}
    98 
    99 
   100 TVerdict CTestStepCIG711DecoderConfig::DoTestStep0041L()
   101 	{
   102 	iTestStepResult = EFail;
   103 	TInt result = KErrGeneral;
   104 
   105 	INFO_PRINTF1(_L("G711DecoderIntfc - SetDecoderMode"));
   106 
   107 	//Initialize - with the UID of our test HwDevice
   108 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   109 	TUid testUID = {KUidG711DecoderConfigTestDevice};
   110 	#else
   111 	TFourCC testUID('T','0','1','5');
   112 	#endif
   113 	
   114 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   115 
   116 	if (iTestStepResult != EPass)
   117 		{
   118 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   119 		return EInconclusive;
   120 		}
   121 
   122 	// reset the value as previous test is pass
   123 	iTestStepResult = EFail;  
   124 
   125 	// KUidG711DecoderIntfc
   126 	MG711DecoderIntfc* ptr = static_cast <MG711DecoderIntfc*> (iMMFDevSound->CustomInterface(KUidG711DecoderIntfc));
   127 
   128 	if (ptr)
   129 		{
   130 		result = ptr->SetDecoderMode(MG711DecoderIntfc::EDecULaw); // call method
   131 		
   132 		if (result == KErrNone)
   133 			{
   134 			INFO_PRINTF1(_L("MG711DecoderIntfc::SetDecoderMode finished successfully"));
   135 
   136 			iTestStepResult = EPass;		
   137 			}
   138 		else
   139 			{
   140 			ERR_PRINTF2(_L("MG711DecoderIntfc::SetDecoderMode failed with error %d"), result);
   141 			}
   142 		}
   143 	else
   144 		{
   145 		INFO_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface"));
   146 		iTestStepResult = EInconclusive;
   147 		}
   148 
   149 	return iTestStepResult;
   150 	}
   151 
   152 
   153 TVerdict CTestStepCIG711DecoderConfig::DoTestStep0094L()
   154 	{
   155 	iTestStepResult = EFail;
   156 	TInt result = KErrGeneral;
   157 
   158 	INFO_PRINTF1(_L("G711DecoderIntfc - GetDecoderMode"));
   159 
   160 	//Initialize - with the UID of our test HwDevice
   161 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   162 	TUid testUID = {KUidG711DecoderConfigTestDevice};
   163 	#else
   164 	TFourCC testUID('T','0','1','5');
   165 	#endif
   166 	
   167 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   168 
   169 	if (iTestStepResult != EPass)
   170 		{
   171 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   172 		return EInconclusive;
   173 		}
   174 
   175 	// reset the value as previous test is pass
   176 	iTestStepResult = EFail;  
   177 
   178 	// KUidG711DecoderIntfc
   179 	MG711DecoderIntfc* ptr = static_cast <MG711DecoderIntfc*> (iMMFDevSound->CustomInterface(KUidG711DecoderIntfc));
   180 
   181 	if (ptr)
   182 		{
   183 		MG711DecoderIntfc::TDecodeMode decodeMode = MG711DecoderIntfc::EDecULaw;
   184 
   185 		result = ptr->SetDecoderMode(MG711DecoderIntfc::EDecALaw);
   186 		
   187 		if (result == KErrNone)
   188 			{
   189 			INFO_PRINTF1(_L("MG711DecoderIntfc::SetDecoderMode finished successfully"));
   190 
   191 			result = ptr->GetDecoderMode(decodeMode); // call method
   192 
   193 			if (MG711DecoderIntfc::EDecALaw == decodeMode)
   194 				{
   195 				INFO_PRINTF1(_L("MG711DecoderIntfc::GetDecoderMode finished successfully"));
   196 
   197 				iTestStepResult = EPass;
   198 				}
   199 			else
   200 				{
   201 				ERR_PRINTF3(_L("MG711DecoderIntfc::GetDecoderMode failed with result %d decodeMode %d"), result, decodeMode);
   202 				}			
   203 			}
   204 		else
   205 			{
   206 			ERR_PRINTF2(_L("MG711DecoderIntfc::SetDecoderMode failed with error %d"), result);
   207 			}
   208 		}
   209 	else
   210 		{
   211 		INFO_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface"));
   212 		iTestStepResult = EInconclusive;
   213 		}
   214 
   215 	return iTestStepResult;
   216 	}
   217 
   218 
   219 TVerdict CTestStepCIG711DecoderConfig::DoTestStep0042L()
   220 	{
   221 	iTestStepResult = EFail;
   222 	TInt result = KErrGeneral;
   223 
   224 	INFO_PRINTF1(_L("G711DecoderIntfc - SetComfortNoiseGeneration"));
   225 
   226 	//Initialize - with the UID of our test HwDevice
   227 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   228 	TUid testUID = {KUidG711DecoderConfigTestDevice};
   229 	#else
   230 	TFourCC testUID('T','0','1','5');
   231 	#endif
   232 	
   233 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   234 
   235 	if (iTestStepResult != EPass)
   236 		{
   237 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   238 		return EInconclusive;
   239 		}
   240 
   241 	// reset the value as previous test is pass
   242 	iTestStepResult = EFail;  
   243 
   244 	// KUidG711DecoderIntfc
   245 	MG711DecoderIntfc* ptr = static_cast <MG711DecoderIntfc*> (iMMFDevSound->CustomInterface(KUidG711DecoderIntfc));
   246 
   247 	if (ptr)
   248 		{
   249 		TBool cng = ETrue;
   250 
   251 		result = ptr->SetComfortNoiseGeneration(cng); // call method
   252 		
   253 		if (result == KErrNone)
   254 			{
   255 			INFO_PRINTF1(_L("MG711DecoderIntfc::SetComfortNoiseGeneration finished successfully"));
   256 			
   257 			result = ptr->GetComfortNoiseGeneration(cng);
   258 			
   259 			if ( (result == KErrNone) && cng)
   260 				{
   261 				INFO_PRINTF1(_L("MG711DecoderIntfc::GetComfortNoiseGeneration finished successfully"));
   262 				
   263 				result = ptr->SetComfortNoiseGeneration(EFalse);
   264 				
   265 				if (result == KErrNone)
   266 					{
   267 					INFO_PRINTF1(_L("MG711DecoderIntfc::SetComfortNoiseGeneration finished successfully"));
   268 					
   269 					result = ptr->GetComfortNoiseGeneration(cng);
   270 			
   271 					if ( (result == KErrNone) && !cng)
   272 						{
   273 						INFO_PRINTF1(_L("MG711DecoderIntfc::GetComfortNoiseGeneration finished successfully"));
   274 
   275 						iTestStepResult = EPass;
   276 						}
   277 					else
   278 						{
   279 						ERR_PRINTF3(_L("MG711DecoderIntfc::GetComfortNoiseGeneration failed with result %d  cng %d"), result, cng);
   280 						}
   281 					}
   282 				else
   283 					{
   284 					ERR_PRINTF2(_L("MG711DecoderIntfc::SetComfortNoiseGeneration failed with result %d"), result);
   285 					}
   286 				}
   287 			else
   288 				{
   289 				ERR_PRINTF3(_L("MG711DecoderIntfc::GetComfortNoiseGeneration failed with  result %d  cng %d"), result, cng);
   290 				}
   291 			}
   292 		else
   293 			{
   294 			ERR_PRINTF2(_L("MG711DecoderIntfc::SetComfortNoiseGeneration failed with result %d"), result);
   295 			}
   296 		}
   297 	else
   298 		{
   299 		INFO_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface"));
   300 		iTestStepResult = EInconclusive;
   301 		}
   302 
   303 	return iTestStepResult;
   304 	}
   305 
   306 
   307 TVerdict CTestStepCIG711DecoderConfig::DoTestStep0043L()
   308 	{
   309 	iTestStepResult = EFail;
   310 	TInt result = KErrGeneral;
   311 
   312 	INFO_PRINTF1(_L("G711DecoderIntfc - GetComfortNoiseGeneration"));
   313 
   314 	//Initialize - with the UID of our test HwDevice
   315 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   316 	TUid testUID = {KUidG711DecoderConfigTestDevice};
   317 	#else
   318 	TFourCC testUID('T','0','1','5');
   319 	#endif
   320 	
   321 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   322 
   323 	if (iTestStepResult != EPass)
   324 		{
   325 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   326 		return EInconclusive;
   327 		}
   328 
   329 	// reset the value as previous test is pass
   330 	iTestStepResult = EFail;  
   331 
   332 	// KUidG711DecoderIntfc
   333 	MG711DecoderIntfc* ptr = static_cast <MG711DecoderIntfc*> (iMMFDevSound->CustomInterface(KUidG711DecoderIntfc));
   334 
   335 	TBool cng = ETrue;
   336 
   337 	if (ptr)
   338 		{
   339 		result = ptr->SetComfortNoiseGeneration(cng); // call method
   340 		
   341 		if (result == KErrNone)
   342 			{
   343 			INFO_PRINTF1(_L("MG711DecoderIntfc::SetComfortNoiseGeneration finished successfully"));
   344 
   345 			result = ptr->GetComfortNoiseGeneration(cng);
   346 			
   347 			if ( (result == KErrNone) && cng)
   348 				{
   349 				INFO_PRINTF1(_L("MG711DecoderIntfc::GetComfortNoiseGeneration finished successfully"));
   350 
   351 				iTestStepResult = EPass;
   352 				}
   353 			else
   354 				{
   355 				ERR_PRINTF3(_L("MG711DecoderIntfc::GetComfortNoiseGeneration failed with result %d cng %d"), result, cng);
   356 				}
   357 			}
   358 		else
   359 			{
   360 			ERR_PRINTF2(_L("MG711DecoderIntfc::GetComfortNoiseGeneration failed with result %d"), result);
   361 			}
   362 		}
   363 	else
   364 		{
   365 		INFO_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface"));
   366 		iTestStepResult = EInconclusive;
   367 		}
   368 
   369 	return iTestStepResult;
   370 	}
   371 
   372 
   373 TVerdict CTestStepCIG711DecoderConfig::DoTestStep0044L()
   374 	{
   375 	iTestStepResult = EFail;
   376 	TInt result = KErrGeneral;
   377 
   378 	INFO_PRINTF1(_L("G711DecoderIntfc - SetPacketLossConcealment"));
   379 
   380 	//Initialize - with the UID of our test HwDevice
   381 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   382 	TUid testUID = {KUidG711DecoderConfigTestDevice};
   383 	#else
   384 	TFourCC testUID('T','0','1','5');
   385 	#endif
   386 	
   387 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   388 
   389 	if (iTestStepResult != EPass)
   390 		{
   391 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   392 		return EInconclusive;
   393 		}
   394 
   395 	// reset the value as previous test is pass
   396 	iTestStepResult = EFail;  
   397 
   398 	// KUidG711DecoderIntfc
   399 	MG711DecoderIntfc* ptr = static_cast <MG711DecoderIntfc*> (iMMFDevSound->CustomInterface(KUidG711DecoderIntfc));
   400 
   401 	if (ptr)
   402 		{
   403 		TBool plc = ETrue;
   404 
   405 		result = ptr->SetPacketLossConcealment(EFalse); // call method
   406 		
   407 		if (result == KErrNone)
   408 			{
   409 			INFO_PRINTF1(_L("MG711DecoderIntfc::SetPacketLossConcealment finished successfully"));
   410 
   411 			result = ptr->GetPacketLossConcealment(plc);
   412 
   413 			if ( (result == KErrNone) && (EFalse == plc) )
   414 				{
   415 				INFO_PRINTF1(_L("MG711DecoderIntfc::GetPacketLossConcealment finished successfully"));
   416 
   417 				iTestStepResult = EPass;
   418 				}
   419 			else
   420 				{
   421 				ERR_PRINTF3(_L("MG711DecoderIntfc::GetPacketLossConcealment failed with result %d  plc %d"), result, plc);
   422 				}			
   423 			}
   424 		else
   425 			{
   426 			ERR_PRINTF2(_L("MG711DecoderIntfc::SetPacketLossConcealment failed with error %d"), result);
   427 			}
   428 		}
   429 	else
   430 		{
   431 		INFO_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface"));
   432 		iTestStepResult = EInconclusive;
   433 		}
   434 
   435 	return iTestStepResult;
   436 	}
   437 
   438 
   439 TVerdict CTestStepCIG711DecoderConfig::DoTestStep0095L()
   440 	{
   441 	iTestStepResult = EFail;
   442 	TInt result = KErrGeneral;
   443 
   444 	INFO_PRINTF1(_L("G711DecoderIntfc - GetPacketLossConcealment"));
   445 
   446 	//Initialize - with the UID of our test HwDevice
   447 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   448 	TUid testUID = {KUidG711DecoderConfigTestDevice};
   449 	#else
   450 	TFourCC testUID('T','0','1','5');
   451 	#endif
   452 	
   453 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   454 
   455 	if (iTestStepResult != EPass)
   456 		{
   457 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   458 		return EInconclusive;
   459 		}
   460 
   461 	// reset the value as previous test is pass
   462 	iTestStepResult = EFail;  
   463 
   464 	// KUidG711DecoderIntfc
   465 	MG711DecoderIntfc* ptr = static_cast <MG711DecoderIntfc*> (iMMFDevSound->CustomInterface(KUidG711DecoderIntfc));
   466 
   467 	if (ptr)
   468 		{
   469 		TBool plc = ETrue;
   470 
   471 		result = ptr->SetPacketLossConcealment(EFalse);
   472 		
   473 		if (result == KErrNone)
   474 			{
   475 			INFO_PRINTF1(_L("MG711DecoderIntfc::SetPacketLossConcealment finished successfully"));
   476 
   477 			result = ptr->GetPacketLossConcealment(plc); // call method
   478 
   479 			if ( (result == KErrNone) && (EFalse == plc) )
   480 				{
   481 				INFO_PRINTF1(_L("MG711DecoderIntfc::GetPacketLossConcealment finished successfully"));
   482 
   483 				iTestStepResult = EPass;
   484 				}
   485 			else
   486 				{
   487 				ERR_PRINTF3(_L("MG711DecoderIntfc::GetPacketLossConcealment failed with result %d  plc %d"), result, plc);
   488 				}			
   489 			}
   490 		else
   491 			{
   492 			ERR_PRINTF2(_L("MG711DecoderIntfc::SetPacketLossConcealment failed with error %d"), result);
   493 			}
   494 		}
   495 	else
   496 		{
   497 		INFO_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface"));
   498 		iTestStepResult = EInconclusive;
   499 		}
   500 
   501 	return iTestStepResult;
   502 	}