os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepciaudiovibracontrol.cpp
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include "teststepciaudiovibracontrol.h"
19 TVerdict CTestStepCIAudioVibraControl::DoTestStepL()
21 iTestStepResult = ETestSuiteError;
23 INFO_PRINTF1(_L("Initializing test CI device"));
25 if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0066-HP")) == 0)
27 iTestStepResult = DoTestStep0066L();
29 else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0067-HP")) == 0)
31 iTestStepResult = DoTestStep0067L();
33 else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0068-HP")) == 0)
35 iTestStepResult = DoTestStep0068L();
38 return iTestStepResult;
42 TVerdict CTestStepCIAudioVibraControl::DoTestStep0066L()
44 iTestStepResult = EFail;
46 INFO_PRINTF1(_L("AudioVibraControl - Instantiating"));
48 //Initialize - with the UID of our test HwDevice
49 #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
50 TUid testUID = {KUidAudioVibraControlTestDevice};
52 TFourCC testUID('T','0','1','1');
55 iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
57 if (iTestStepResult != EPass)
59 INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
63 // reset the value as previous test is pass
64 iTestStepResult = EFail;
66 // KUidAudioVibraControl
67 MAudioVibraControl* ptr = static_cast <MAudioVibraControl*> (iMMFDevSound->CustomInterface(KUidAudioVibraControl));
71 INFO_PRINTF1(_L("MAudioVibraControl instantiated successfully"));
73 iTestStepResult = EPass;
77 ERR_PRINTF1(_L("MAudioVibraControl failed to retrieve the interface"));
80 return iTestStepResult;
84 TVerdict CTestStepCIAudioVibraControl::DoTestStep0067L()
86 iTestStepResult = EFail;
87 TInt result = KErrGeneral;
89 INFO_PRINTF1(_L("AudioVibraControl - StartVibra"));
91 //Initialize - with the UID of our test HwDevice
92 #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
93 TUid testUID = {KUidAudioVibraControlTestDevice};
95 TFourCC testUID('T','0','1','1');
98 iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
100 if (iTestStepResult != EPass)
102 INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
103 return EInconclusive;
106 // reset the value as previous test is pass
107 iTestStepResult = EFail;
109 // KUidAudioVibraControl
110 MAudioVibraControl* ptr = static_cast <MAudioVibraControl*> (iMMFDevSound->CustomInterface(KUidAudioVibraControl));
114 result = ptr->StartVibra(); // call method
116 if(result == KErrNone)
118 INFO_PRINTF1(_L("MAudioVibraControl::StartVibra finished successfully"));
120 iTestStepResult = EPass;
124 ERR_PRINTF2(_L("MAudioVibraControl::StartVibra failed with result %d"), result);
129 INFO_PRINTF1(_L("MAudioVibraControl failed to retrieve the interface"));
130 iTestStepResult = EInconclusive;
133 return iTestStepResult;
137 TVerdict CTestStepCIAudioVibraControl::DoTestStep0068L()
139 iTestStepResult = EFail;
140 TInt result = KErrGeneral;
142 INFO_PRINTF1(_L("AudioVibraControl - StopVibra"));
144 //Initialize - with the UID of our test HwDevice
145 #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
146 TUid testUID = {KUidAudioVibraControlTestDevice};
148 TFourCC testUID('T','0','1','1');
151 iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
153 if (iTestStepResult != EPass)
155 INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
156 return EInconclusive;
159 // reset the value as previous test is pass
160 iTestStepResult = EFail;
162 // KUidAudioVibraControl
163 MAudioVibraControl* ptr = static_cast <MAudioVibraControl*> (iMMFDevSound->CustomInterface(KUidAudioVibraControl));
167 result = ptr->StopVibra(); // call method
169 if (result == KErrNone)
171 INFO_PRINTF1(_L("MAudioVibraControl::StopVibra finished successfully"));
173 iTestStepResult = EPass;
177 ERR_PRINTF2(_L("MAudioVibraControl::StopVibra failed with result %d"), result);
182 INFO_PRINTF1(_L("MAudioVibraControl failed to retrieve the interface"));
183 iTestStepResult = EInconclusive;
186 return iTestStepResult;