|
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 // VerifyAttachmentInfo |
|
17 // [Action Parameters] |
|
18 // AttachmentInfo <input>: Reference to the attachment info. |
|
19 // FileName <input>: File name to compare against file name in AttachmentInfo. |
|
20 // FileSize <input>: Size of the file in KB. |
|
21 // MimeType <input>: Mime type of attachment file. |
|
22 // [Action Description] |
|
23 // Compares the attachment information against a inputs provided. |
|
24 // [APIs Used] |
|
25 // TDesC8::Compare |
|
26 // __ACTION_INFO_END__ |
|
27 // |
|
28 // |
|
29 |
|
30 |
|
31 #include "CMtfTestActionVerifyAttachmentInfo.h" |
|
32 #include "CMtfTestCase.h" |
|
33 #include "CMtfTestActionParameters.h" |
|
34 #include "MtfTestActionUtilsUser.h" |
|
35 |
|
36 #include <miutset.h> |
|
37 #include <cmsvattachment.h> |
|
38 |
|
39 const TInt KMimeTypeLength = 50; |
|
40 |
|
41 CMtfTestAction* CMtfTestActionVerifyAttachmentInfo::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
42 { |
|
43 CMtfTestActionVerifyAttachmentInfo* self = new(ELeave) CMtfTestActionVerifyAttachmentInfo(aTestCase); |
|
44 CleanupStack::PushL(self); |
|
45 self->ConstructL(aActionParameters); |
|
46 CleanupStack::Pop(); |
|
47 return self; |
|
48 } |
|
49 |
|
50 |
|
51 CMtfTestActionVerifyAttachmentInfo::CMtfTestActionVerifyAttachmentInfo(CMtfTestCase& aTestCase) |
|
52 : CMtfSynchronousTestAction(aTestCase) |
|
53 { |
|
54 } |
|
55 |
|
56 |
|
57 CMtfTestActionVerifyAttachmentInfo::~CMtfTestActionVerifyAttachmentInfo() |
|
58 { |
|
59 } |
|
60 |
|
61 |
|
62 void CMtfTestActionVerifyAttachmentInfo::ExecuteActionL() |
|
63 { |
|
64 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionVerifyAttachmentInfo); |
|
65 CMsvAttachment* attachmentInfo = ObtainParameterReferenceL<CMsvAttachment>(TestCase(),ActionParameters().Parameter(0)); |
|
66 HBufC* paramFileName = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(1)); |
|
67 TInt paramFileSize = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(2)); |
|
68 HBufC* paramMimeType = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(3)); |
|
69 |
|
70 |
|
71 TestCase().INFO_PRINTF1(_L("VerifyAttachmentInfo.....")); |
|
72 |
|
73 TestCase().INFO_PRINTF2(_L("Attachment Name - %S"), &attachmentInfo->AttachmentName()); |
|
74 TestCase().INFO_PRINTF2(_L("Size - %d"), attachmentInfo->Size()); |
|
75 |
|
76 TBuf<KMimeTypeLength> mimeType; |
|
77 mimeType.Copy(attachmentInfo->MimeType()); |
|
78 TestCase().INFO_PRINTF2(_L("MimeType - %S"), &mimeType); |
|
79 |
|
80 |
|
81 TestCase().INFO_PRINTF1(_L("With..")); |
|
82 |
|
83 TestCase().INFO_PRINTF2(_L("Attachment Name - %S"), paramFileName); |
|
84 TestCase().INFO_PRINTF2(_L("Size - %d"), paramFileSize); |
|
85 TestCase().INFO_PRINTF2(_L("MimeType - %S"), paramMimeType); |
|
86 |
|
87 if ( |
|
88 (paramFileName->Compare(attachmentInfo->AttachmentName()) == 0) && |
|
89 (paramMimeType->Compare(mimeType) == 0) && |
|
90 (paramFileSize == attachmentInfo->Size()) |
|
91 ) |
|
92 { |
|
93 } |
|
94 else |
|
95 { |
|
96 User::Leave(KErrGeneral); |
|
97 } |
|
98 |
|
99 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionVerifyAttachmentInfo); |
|
100 TestCase().ActionCompletedL(*this); |
|
101 } |