|
1 // Copyright (c) 2004-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 // __ACTION_INFO_BEGIN__ |
|
15 // [Action Name] |
|
16 // GetMessageAtIndex |
|
17 // [Action Parameters] |
|
18 // CMsvEntrySelection paramMessageSelection <input> : Reference to Mail selection |
|
19 // TInt index <input> : Value of Index |
|
20 // TMsvId paramMessageId <output> : Value of message Id |
|
21 // [Action Description] |
|
22 // GetMessagAtIndex Test Action takes a CMsvEntrySelection and an array index |
|
23 // value as inputs. The Test Action provides the TMsvId present in the |
|
24 // CMsvEntrySelection at the specified index as output |
|
25 // [APIs Used] |
|
26 // CMsvEntrySelection::At() |
|
27 // __ACTION_INFO_END__ |
|
28 // |
|
29 // |
|
30 |
|
31 /** |
|
32 @file |
|
33 @internalTechnology |
|
34 */ |
|
35 |
|
36 |
|
37 // User include |
|
38 #include "CMtfTestActionGetMessageAtIndex.h" |
|
39 #include "CMtfTestCase.h" |
|
40 #include "CMtfTestActionParameters.h" |
|
41 |
|
42 |
|
43 |
|
44 /** |
|
45 NewL() |
|
46 Constructs a CMtfTestActionGetMessageAtIndex object. |
|
47 Uses two phase construction and leaves nothing on the CleanupStack. |
|
48 @internalTechnology |
|
49 @param aTestCase Test Case to which this Test Action belongs |
|
50 @param aActionParameters Action parameters, must not be NULL |
|
51 @return Created object of type CMtfTestActionGetMessageAtIndex |
|
52 @pre None |
|
53 @post CMtfTestActionGetMessageAtIndex object is created |
|
54 */ |
|
55 CMtfTestAction* CMtfTestActionGetMessageAtIndex:: |
|
56 NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
57 { |
|
58 CMtfTestActionGetMessageAtIndex* self = |
|
59 new (ELeave) CMtfTestActionGetMessageAtIndex(aTestCase); |
|
60 |
|
61 CleanupStack::PushL(self); |
|
62 self->ConstructL(aActionParameters); |
|
63 CleanupStack::Pop(self); |
|
64 return self; |
|
65 } |
|
66 |
|
67 |
|
68 /** |
|
69 CMtfTestActionGetMessageAtIndex constructor |
|
70 Calls the base class' constructor |
|
71 @internalTechnology |
|
72 @param aTestCase Test Case to which this Test Action belongs |
|
73 @pre None |
|
74 @post None |
|
75 */ |
|
76 CMtfTestActionGetMessageAtIndex::CMtfTestActionGetMessageAtIndex(CMtfTestCase& aTestCase) |
|
77 : CMtfSynchronousTestAction(aTestCase) |
|
78 { |
|
79 } |
|
80 |
|
81 /** |
|
82 Function : ~CMtfTestActionGetMessageAtIndex |
|
83 Description : Destructor |
|
84 @internalTechnology |
|
85 @param : |
|
86 @return : |
|
87 @pre |
|
88 @post |
|
89 */ |
|
90 CMtfTestActionGetMessageAtIndex::~CMtfTestActionGetMessageAtIndex() |
|
91 { |
|
92 } |
|
93 |
|
94 /** |
|
95 ExecuteActionL |
|
96 Obtains the parameters for the test action. Get the Message Id at given index. The Message |
|
97 Id is stored as output parameters of this Test Action |
|
98 @internalTechnology |
|
99 @pre None |
|
100 @post None |
|
101 @leave System wide errors |
|
102 */ |
|
103 void CMtfTestActionGetMessageAtIndex::ExecuteActionL() |
|
104 { |
|
105 if((TestCase().TestStepResult()) == EPass) |
|
106 { |
|
107 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionGetMessageAtIndex); |
|
108 |
|
109 // Get test action input parameters |
|
110 CMsvEntrySelection* paramSelection = ObtainParameterReferenceL<CMsvEntrySelection>(TestCase(), |
|
111 ActionParameters().Parameter(0)); |
|
112 |
|
113 TInt index = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(1)); |
|
114 |
|
115 // Validate the index value provided |
|
116 TMsvId paramMessageId; |
|
117 TInt length = paramSelection->Length(); |
|
118 |
|
119 if(index > length) |
|
120 { |
|
121 TestCase().ERR_PRINTF3(_L("Index out of bounds, length of selection: %d, input provided = %d"),length, index); |
|
122 TestCase().SetTestStepResult(EFail); |
|
123 } |
|
124 else |
|
125 { |
|
126 // Valid index, get the message Id and store it as output parameter |
|
127 paramMessageId = paramSelection->At(index); |
|
128 StoreParameterL<TMsvId>(TestCase(),paramMessageId,ActionParameters().Parameter(2)); |
|
129 } |
|
130 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionGetMessageAtIndex); |
|
131 } |
|
132 TestCase().ActionCompletedL(*this); |
|
133 } |
|
134 |