|
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 // AddRecipient |
|
17 // [Action Parameters] |
|
18 // CBaseMtm paramMtm <input> : Reference to CBaseMtm object |
|
19 // HBufC paramRecipient <input> : Recipient Address |
|
20 // [Action Description] |
|
21 // AddRecipient Test Action is intended to set the body text |
|
22 // contents for a message that was created using Send-As API. |
|
23 // The body text content is read from a file and then stored in a |
|
24 // CRichText object. The CRichText object is then used to set the body text |
|
25 // for the message. |
|
26 // [APIs Used] |
|
27 // __ACTION_INFO_END__ |
|
28 // |
|
29 // |
|
30 |
|
31 /** |
|
32 @file |
|
33 @internalTechnology |
|
34 */ |
|
35 |
|
36 //system include |
|
37 #include <msvapi.h> |
|
38 #include <btmsgtypeuid.h> |
|
39 #include <mtclbase.h> |
|
40 |
|
41 // User include |
|
42 #include "CMtfTestActionAddRecipient.h" |
|
43 #include "CMtfTestCase.h" |
|
44 #include "CMtfTestActionParameters.h" |
|
45 #include "TestFrameworkActionsUtils.h" |
|
46 #include "CMtfTestActionUtilsMessage.h" |
|
47 |
|
48 /** |
|
49 NewL() |
|
50 Constructs a CMtfTestActionAddRecipient object. |
|
51 Uses two phase construction and leaves nothing on the CleanupStack. |
|
52 @internalTechnology |
|
53 @param aTestCase Test Case to which this Test Action belongs |
|
54 @param aActionParameters Action parameters, must not be NULL |
|
55 @return Created object of type CMtfTestActionSendAsSetBodyText |
|
56 @pre None |
|
57 @post CMtfTestActionAddRecipient object is created |
|
58 */ |
|
59 CMtfTestAction* CMtfTestActionAddRecipient:: |
|
60 NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
61 { |
|
62 CMtfTestActionAddRecipient* self = |
|
63 new (ELeave) CMtfTestActionAddRecipient(aTestCase); |
|
64 |
|
65 CleanupStack::PushL(self); |
|
66 self->ConstructL(aActionParameters); |
|
67 CleanupStack::Pop(self); |
|
68 return self; |
|
69 } |
|
70 |
|
71 |
|
72 /** |
|
73 CMtfTestActionAddRecipient constructor |
|
74 Calls the base class' constructor |
|
75 @internalTechnology |
|
76 @param aTestCase Test Case to which this Test Action belongs |
|
77 @pre None |
|
78 @post None |
|
79 */ |
|
80 CMtfTestActionAddRecipient::CMtfTestActionAddRecipient(CMtfTestCase& aTestCase) |
|
81 : CMtfSynchronousTestAction(aTestCase) |
|
82 { |
|
83 } |
|
84 |
|
85 /** |
|
86 Function : ~CMtfTestActionAddRecipient |
|
87 Description : Destructor |
|
88 @internalTechnology |
|
89 @param : |
|
90 @return : |
|
91 @pre |
|
92 @post |
|
93 */ |
|
94 CMtfTestActionAddRecipient::~CMtfTestActionAddRecipient() |
|
95 { |
|
96 } |
|
97 |
|
98 /** |
|
99 ExecuteActionL |
|
100 Obtains the parameters for the test action. Get the Message Id at given index. The Message |
|
101 Id is stored as output parameters of this Test Action |
|
102 @internalTechnology |
|
103 @pre None |
|
104 @post None |
|
105 @leave System wide errors |
|
106 */ |
|
107 void CMtfTestActionAddRecipient::ExecuteActionL() |
|
108 { |
|
109 if((TestCase().TestStepResult()) == EPass) |
|
110 { |
|
111 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionAddRecipient); |
|
112 |
|
113 TMsvId paramMsgId = ObtainValueParameterL<TMsvId>(TestCase(), |
|
114 ActionParameters().Parameter(0)); |
|
115 |
|
116 CBaseMtm* paramMtm = ObtainParameterReferenceL<CBaseMtm>(TestCase(), |
|
117 ActionParameters().Parameter(1)); |
|
118 |
|
119 HBufC* paramRecipient = ObtainParameterReferenceL<HBufC>(TestCase(), |
|
120 ActionParameters().Parameter(2)); |
|
121 |
|
122 TUid msgTypeMtm = paramMtm->Type(); |
|
123 paramMtm->SwitchCurrentEntryL(paramMsgId); |
|
124 |
|
125 if(msgTypeMtm.operator==(KUidMsgTypeBt)) |
|
126 { |
|
127 TPtrC16 ptr16 = paramRecipient->Des(); |
|
128 TBuf16<3> btAddress; |
|
129 |
|
130 CMtfTestActionUtilsMessage::FormatBtRecipientAddress(*paramRecipient, btAddress); |
|
131 paramMtm->AddAddresseeL(btAddress); |
|
132 } |
|
133 else |
|
134 { |
|
135 paramMtm->AddAddresseeL(*paramRecipient); |
|
136 } |
|
137 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionAddRecipient); |
|
138 } |
|
139 TestCase().ActionCompletedL(*this); |
|
140 } |
|
141 |