os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepciaudiovibracontrol.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 "teststepciaudiovibracontrol.h"
    17 
    18 
    19 TVerdict CTestStepCIAudioVibraControl::DoTestStepL()
    20 	{
    21 	iTestStepResult = ETestSuiteError;
    22 
    23 	INFO_PRINTF1(_L("Initializing test CI device"));
    24 
    25 	if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0066-HP")) == 0)
    26 		{
    27 		iTestStepResult = DoTestStep0066L();
    28 		}
    29 	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0067-HP")) == 0)
    30 		{
    31 		iTestStepResult = DoTestStep0067L();
    32 		}
    33 	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0068-HP")) == 0)
    34 		{
    35 		iTestStepResult = DoTestStep0068L();
    36 		}
    37 
    38 	return iTestStepResult;
    39 	}
    40 
    41 
    42 TVerdict CTestStepCIAudioVibraControl::DoTestStep0066L()
    43 	{
    44 	iTestStepResult = EFail;
    45 
    46 	INFO_PRINTF1(_L("AudioVibraControl - Instantiating"));
    47 
    48 	//Initialize - with the UID of our test HwDevice
    49 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    50 	TUid testUID = {KUidAudioVibraControlTestDevice};
    51 	#else
    52 	TFourCC testUID('T','0','1','1');
    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 	// KUidAudioVibraControl
    67 	MAudioVibraControl* ptr = static_cast <MAudioVibraControl*> (iMMFDevSound->CustomInterface(KUidAudioVibraControl));
    68 
    69 	if (ptr)
    70 		{
    71 		INFO_PRINTF1(_L("MAudioVibraControl instantiated successfully"));
    72 
    73 		iTestStepResult = EPass;
    74 		}
    75 	else
    76 		{
    77 		ERR_PRINTF1(_L("MAudioVibraControl failed to retrieve the interface"));
    78 		}
    79 
    80 	return iTestStepResult;
    81 	}
    82 
    83 
    84 TVerdict CTestStepCIAudioVibraControl::DoTestStep0067L()
    85 	{
    86 	iTestStepResult = EFail;
    87 	TInt result = KErrGeneral;
    88 
    89 	INFO_PRINTF1(_L("AudioVibraControl - StartVibra"));
    90 
    91 	//Initialize - with the UID of our test HwDevice
    92 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    93 	TUid testUID = {KUidAudioVibraControlTestDevice};
    94 	#else
    95 	TFourCC testUID('T','0','1','1');
    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 	// KUidAudioVibraControl
   110 	MAudioVibraControl* ptr = static_cast <MAudioVibraControl*> (iMMFDevSound->CustomInterface(KUidAudioVibraControl));
   111 
   112 	if (ptr)
   113 		{
   114 		result = ptr->StartVibra(); // call method
   115 		
   116 		if(result == KErrNone)
   117 			{
   118 			INFO_PRINTF1(_L("MAudioVibraControl::StartVibra finished successfully"));
   119 
   120 			iTestStepResult = EPass;
   121 			}
   122 		else
   123 			{
   124 			ERR_PRINTF2(_L("MAudioVibraControl::StartVibra failed with result %d"), result);
   125 			}
   126 		}
   127 	else
   128 		{
   129 		INFO_PRINTF1(_L("MAudioVibraControl failed to retrieve the interface"));
   130 		iTestStepResult = EInconclusive;
   131 		}
   132 
   133 	return iTestStepResult;
   134 	}
   135 
   136 
   137 TVerdict CTestStepCIAudioVibraControl::DoTestStep0068L()
   138 	{
   139 	iTestStepResult = EFail;
   140 	TInt result = KErrGeneral;
   141 
   142 	INFO_PRINTF1(_L("AudioVibraControl - StopVibra"));
   143 
   144 	//Initialize - with the UID of our test HwDevice
   145 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   146 	TUid testUID = {KUidAudioVibraControlTestDevice};
   147 	#else
   148 	TFourCC testUID('T','0','1','1');
   149 	#endif
   150 	
   151 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   152 
   153 	if (iTestStepResult != EPass)
   154 		{
   155 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   156 		return EInconclusive;
   157 		}
   158 
   159 	// reset the value as previous test is pass
   160 	iTestStepResult = EFail;
   161 
   162 	// KUidAudioVibraControl
   163 	MAudioVibraControl* ptr = static_cast <MAudioVibraControl*> (iMMFDevSound->CustomInterface(KUidAudioVibraControl));
   164 
   165 	if (ptr)
   166 		{
   167 		result = ptr->StopVibra(); // call method
   168 
   169 		if (result == KErrNone)
   170 			{
   171 			INFO_PRINTF1(_L("MAudioVibraControl::StopVibra finished successfully"));
   172 
   173 			iTestStepResult = EPass;
   174 			}
   175 		else
   176 			{
   177 			ERR_PRINTF2(_L("MAudioVibraControl::StopVibra failed with result %d"), result);
   178 			}
   179 		}
   180 	else
   181 		{
   182 		INFO_PRINTF1(_L("MAudioVibraControl failed to retrieve the interface"));
   183 		iTestStepResult = EInconclusive;
   184 		}
   185 
   186 	return iTestStepResult;
   187 	}