os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepciaudiovibracontrol.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepciaudiovibracontrol.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,187 @@
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 "teststepciaudiovibracontrol.h"
1.20 +
1.21 +
1.22 +TVerdict CTestStepCIAudioVibraControl::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-0066-HP")) == 0)
1.29 + {
1.30 + iTestStepResult = DoTestStep0066L();
1.31 + }
1.32 + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0067-HP")) == 0)
1.33 + {
1.34 + iTestStepResult = DoTestStep0067L();
1.35 + }
1.36 + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0068-HP")) == 0)
1.37 + {
1.38 + iTestStepResult = DoTestStep0068L();
1.39 + }
1.40 +
1.41 + return iTestStepResult;
1.42 + }
1.43 +
1.44 +
1.45 +TVerdict CTestStepCIAudioVibraControl::DoTestStep0066L()
1.46 + {
1.47 + iTestStepResult = EFail;
1.48 +
1.49 + INFO_PRINTF1(_L("AudioVibraControl - Instantiating"));
1.50 +
1.51 + //Initialize - with the UID of our test HwDevice
1.52 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.53 + TUid testUID = {KUidAudioVibraControlTestDevice};
1.54 + #else
1.55 + TFourCC testUID('T','0','1','1');
1.56 + #endif
1.57 +
1.58 + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
1.59 +
1.60 + if (iTestStepResult != EPass)
1.61 + {
1.62 + INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
1.63 + return EInconclusive;
1.64 + }
1.65 +
1.66 + // reset the value as previous test is pass
1.67 + iTestStepResult = EFail;
1.68 +
1.69 + // KUidAudioVibraControl
1.70 + MAudioVibraControl* ptr = static_cast <MAudioVibraControl*> (iMMFDevSound->CustomInterface(KUidAudioVibraControl));
1.71 +
1.72 + if (ptr)
1.73 + {
1.74 + INFO_PRINTF1(_L("MAudioVibraControl instantiated successfully"));
1.75 +
1.76 + iTestStepResult = EPass;
1.77 + }
1.78 + else
1.79 + {
1.80 + ERR_PRINTF1(_L("MAudioVibraControl failed to retrieve the interface"));
1.81 + }
1.82 +
1.83 + return iTestStepResult;
1.84 + }
1.85 +
1.86 +
1.87 +TVerdict CTestStepCIAudioVibraControl::DoTestStep0067L()
1.88 + {
1.89 + iTestStepResult = EFail;
1.90 + TInt result = KErrGeneral;
1.91 +
1.92 + INFO_PRINTF1(_L("AudioVibraControl - StartVibra"));
1.93 +
1.94 + //Initialize - with the UID of our test HwDevice
1.95 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.96 + TUid testUID = {KUidAudioVibraControlTestDevice};
1.97 + #else
1.98 + TFourCC testUID('T','0','1','1');
1.99 + #endif
1.100 +
1.101 + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
1.102 +
1.103 + if (iTestStepResult != EPass)
1.104 + {
1.105 + INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
1.106 + return EInconclusive;
1.107 + }
1.108 +
1.109 + // reset the value as previous test is pass
1.110 + iTestStepResult = EFail;
1.111 +
1.112 + // KUidAudioVibraControl
1.113 + MAudioVibraControl* ptr = static_cast <MAudioVibraControl*> (iMMFDevSound->CustomInterface(KUidAudioVibraControl));
1.114 +
1.115 + if (ptr)
1.116 + {
1.117 + result = ptr->StartVibra(); // call method
1.118 +
1.119 + if(result == KErrNone)
1.120 + {
1.121 + INFO_PRINTF1(_L("MAudioVibraControl::StartVibra finished successfully"));
1.122 +
1.123 + iTestStepResult = EPass;
1.124 + }
1.125 + else
1.126 + {
1.127 + ERR_PRINTF2(_L("MAudioVibraControl::StartVibra failed with result %d"), result);
1.128 + }
1.129 + }
1.130 + else
1.131 + {
1.132 + INFO_PRINTF1(_L("MAudioVibraControl failed to retrieve the interface"));
1.133 + iTestStepResult = EInconclusive;
1.134 + }
1.135 +
1.136 + return iTestStepResult;
1.137 + }
1.138 +
1.139 +
1.140 +TVerdict CTestStepCIAudioVibraControl::DoTestStep0068L()
1.141 + {
1.142 + iTestStepResult = EFail;
1.143 + TInt result = KErrGeneral;
1.144 +
1.145 + INFO_PRINTF1(_L("AudioVibraControl - StopVibra"));
1.146 +
1.147 + //Initialize - with the UID of our test HwDevice
1.148 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.149 + TUid testUID = {KUidAudioVibraControlTestDevice};
1.150 + #else
1.151 + TFourCC testUID('T','0','1','1');
1.152 + #endif
1.153 +
1.154 + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
1.155 +
1.156 + if (iTestStepResult != EPass)
1.157 + {
1.158 + INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
1.159 + return EInconclusive;
1.160 + }
1.161 +
1.162 + // reset the value as previous test is pass
1.163 + iTestStepResult = EFail;
1.164 +
1.165 + // KUidAudioVibraControl
1.166 + MAudioVibraControl* ptr = static_cast <MAudioVibraControl*> (iMMFDevSound->CustomInterface(KUidAudioVibraControl));
1.167 +
1.168 + if (ptr)
1.169 + {
1.170 + result = ptr->StopVibra(); // call method
1.171 +
1.172 + if (result == KErrNone)
1.173 + {
1.174 + INFO_PRINTF1(_L("MAudioVibraControl::StopVibra finished successfully"));
1.175 +
1.176 + iTestStepResult = EPass;
1.177 + }
1.178 + else
1.179 + {
1.180 + ERR_PRINTF2(_L("MAudioVibraControl::StopVibra failed with result %d"), result);
1.181 + }
1.182 + }
1.183 + else
1.184 + {
1.185 + INFO_PRINTF1(_L("MAudioVibraControl failed to retrieve the interface"));
1.186 + iTestStepResult = EInconclusive;
1.187 + }
1.188 +
1.189 + return iTestStepResult;
1.190 + }