os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepcispeechencoderconfig.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #include "teststepcispeechencoderconfig.h"
    17 
    18 
    19 TVerdict CTestStepCISpeechEncoderConfig::DoTestStepL()
    20 	{
    21 	iTestStepResult = ETestSuiteError;
    22 
    23 	INFO_PRINTF1(_L("Initializing test CI device"));
    24 
    25 	if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0001-HP")) == 0)
    26 		{
    27 		iTestStepResult = DoTestStep0001L();
    28 		}
    29 	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0002-HP")) == 0)
    30 		{
    31 		iTestStepResult = DoTestStep0002L();
    32 		}
    33 	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0003-HP")) == 0)
    34 		{
    35 		iTestStepResult = DoTestStep0003L();
    36 		}
    37 
    38 	return iTestStepResult;
    39 	}
    40 
    41 
    42 TVerdict CTestStepCISpeechEncoderConfig::DoTestStep0001L()
    43 	{
    44 	iTestStepResult = EFail;
    45 
    46 	INFO_PRINTF1(_L("SpeechEncoderConfig - Instantiating"));
    47 
    48 	//Initialize - with the UID of our test HwDevice
    49 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    50 	TUid testUID = {KUidSpeechEncoderConfigTestDevice};
    51 	#else
    52 	TFourCC testUID('T','0','1','4');
    53 	#endif
    54 	
    55 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
    56 
    57 	if (iTestStepResult != EPass)
    58 		{
    59 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
    60 		return EInconclusive;
    61 		}
    62 
    63 	// reset the value as previous test is pass
    64 	iTestStepResult = EFail;  
    65 
    66 	// KUidSpeechEncoderConfig
    67 	MSpeechEncoderConfig* ptr = static_cast <MSpeechEncoderConfig*> (iMMFDevSound->CustomInterface(KUidSpeechEncoderConfig));
    68 
    69 	if (ptr)
    70 		{
    71 		INFO_PRINTF1(_L("MSpeechEncoderConfig instantiated successfully"));
    72 
    73 		iTestStepResult = EPass;
    74 		}
    75 	else
    76 		{
    77 		ERR_PRINTF1(_L("MSpeechEncoderConfig failed to retrieve the interface"));
    78 		}
    79 
    80 	return iTestStepResult;
    81 	}
    82 
    83 
    84 TVerdict CTestStepCISpeechEncoderConfig::DoTestStep0002L()
    85 	{
    86 	iTestStepResult = EFail;
    87 	TInt result = KErrGeneral;
    88 
    89 	INFO_PRINTF1(_L("SpeechEncoderConfig - SetVadMode"));
    90 
    91 	//Initialize - with the UID of our test HwDevice
    92 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    93 	TUid testUID = {KUidSpeechEncoderConfigTestDevice};
    94 	#else
    95 	TFourCC testUID('T','0','1','4');
    96 	#endif
    97 	
    98 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
    99 
   100 	if (iTestStepResult != EPass)
   101 		{
   102 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   103 		return EInconclusive;
   104 		}
   105 
   106 	// reset the value as previous test is pass
   107 	iTestStepResult = EFail;
   108 
   109 	// KUidSpeechEncoderConfig
   110 	MSpeechEncoderConfig* ptr = static_cast <MSpeechEncoderConfig*> (iMMFDevSound->CustomInterface(KUidSpeechEncoderConfig));
   111 
   112 	if (ptr)
   113 		{
   114 		TBool vadModeOn = EFalse;
   115 
   116 		result = ptr->SetVadMode(vadModeOn); // call method
   117 		
   118 		if (result == KErrNone)
   119 			{
   120 			INFO_PRINTF1(_L("MSpeechEncoderConfig::SetVadMode finished successfully"));
   121 
   122 			iTestStepResult = EPass;
   123 			}
   124 		else
   125 			{
   126 			ERR_PRINTF2(_L("MSpeechEncoderConfig::SetVadMode failed with error %d"), result);
   127 			}
   128 		}
   129 	else
   130 		{
   131 		INFO_PRINTF1(_L("MSpeechEncoderConfig failed to retrieve the interface"));
   132 		iTestStepResult = EInconclusive;
   133 		}
   134 
   135 	return iTestStepResult;
   136 	}
   137 
   138 
   139 TVerdict CTestStepCISpeechEncoderConfig::DoTestStep0003L()
   140 	{
   141 	iTestStepResult = EFail;
   142 	TInt result = KErrGeneral;
   143 
   144 	INFO_PRINTF1(_L("SpeechEncoderConfig - GetVadMode"));
   145 
   146 	//Initialize - with the UID of our test HwDevice
   147 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   148 	TUid testUID = {KUidSpeechEncoderConfigTestDevice};
   149 	#else
   150 	TFourCC testUID('T','0','1','4');
   151 	#endif
   152 	
   153 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   154 
   155 	if (iTestStepResult != EPass)
   156 		{
   157 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   158 		return EInconclusive;
   159 		}
   160 
   161 	// reset the value as previous test is pass
   162 	iTestStepResult = EFail;
   163 
   164 	// KUidSpeechEncoderConfig
   165 	MSpeechEncoderConfig* ptr = static_cast <MSpeechEncoderConfig*> (iMMFDevSound->CustomInterface(KUidSpeechEncoderConfig));
   166 
   167 	if (ptr)
   168 		{
   169 		TBool vadModeOn = ETrue;
   170 
   171 		result = ptr->SetVadMode(vadModeOn); // call method
   172 		
   173 		if (result == KErrNone)
   174 			{
   175 			INFO_PRINTF1(_L("MSpeechEncoderConfig::SetVadMode finished successfully"));
   176 
   177 			result = ptr->GetVadMode(vadModeOn);
   178 			
   179 			if ( (result == KErrNone) && vadModeOn )
   180 				{
   181 				INFO_PRINTF1(_L("MSpeechEncoderConfig::GetVadMode finished successfully"));
   182 
   183 				iTestStepResult = EPass;
   184 				}
   185 			else if (result != KErrNone)
   186 				{
   187 				INFO_PRINTF2(_L("MSpeechEncoderConfig::GetVadMode failed with error %d"), result);
   188 				}
   189 			else
   190 				{
   191 				ERR_PRINTF1(_L("MSpeechEncoderConfig::GetVadMode failed - expected and received mismatch"));
   192 				}
   193 			}
   194 		else
   195 			{
   196 			ERR_PRINTF2(_L("MSpeechEncoderConfig::SetVadMode failed with error %d"), result);
   197 			}
   198 		}
   199 	else
   200 		{
   201 		INFO_PRINTF1(_L("MSpeechEncoderConfig failed to retrieve the interface"));
   202 		iTestStepResult = EInconclusive;
   203 		}
   204 
   205 	return iTestStepResult;
   206 	}