messagingfw/msgtestfw/TestActions/Email/Pop3/src/CMtfTestActionCreateExpPop3MailInfo.cpp
changeset 22 bde600d88860
parent 0 8e480a14352b
equal deleted inserted replaced
21:08008ce8a6df 22:bde600d88860
       
     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 // CreateExpPop3MailInfo
       
    17 // [Action Parameters]
       
    18 // Body Text Lines   <input> : Number of lines of body text to expect
       
    19 // Footer present    <input> : whether to expect a footer message
       
    20 // HTML lines        <input> : Number of lines of html to expect
       
    21 // Description       <input> : Subject line of the email this will be used to check
       
    22 // Attachments       <input> : Number of attachments to expect
       
    23 // ExpPop3MailInto   <output>: Reference to the created CExpMailInfo object
       
    24 // Footer size       <input><optional> : Size of the amount left on the server that should be in the footer message
       
    25 // [Action Description]
       
    26 // Creates a object representing the expect results of a donwloaded email
       
    27 // inlcuding the number of body text lines, number of html lines, number
       
    28 // of attachments, presence or not of a partial download footer, and optionally
       
    29 // the size mentioned in the partial download footer.
       
    30 // This can be passed to the VerifyEmail test action which compares these
       
    31 // objects with email messages in the mail store
       
    32 // [APIs Used]
       
    33 // None
       
    34 // __ACTION_INFO_END__
       
    35 // 
       
    36 //
       
    37 
       
    38 /**
       
    39  @file
       
    40 */
       
    41 
       
    42 
       
    43 
       
    44 
       
    45 #include <msvapi.h>
       
    46 #include <miutset.h>
       
    47 
       
    48 #include "CMtfTestActionCreateExpPop3MailInfo.h"
       
    49 #include "CMtfTestCase.h"
       
    50 #include "CMtfTestActionParameters.h"
       
    51 #include "CExpMailInfo.h"
       
    52 
       
    53 
       
    54 CMtfTestAction* CMtfTestActionCreateExpPop3MailInfo::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters)
       
    55 	{
       
    56 	CMtfTestActionCreateExpPop3MailInfo* self = new (ELeave) CMtfTestActionCreateExpPop3MailInfo(aTestCase);
       
    57 	CleanupStack::PushL(self);
       
    58 	self->ConstructL(aActionParameters);
       
    59 	CleanupStack::Pop();
       
    60 	return self;
       
    61 	}
       
    62 	
       
    63 
       
    64 CMtfTestActionCreateExpPop3MailInfo::CMtfTestActionCreateExpPop3MailInfo(CMtfTestCase& aTestCase)
       
    65 	: CMtfSynchronousTestAction(aTestCase)
       
    66 	{
       
    67 	}
       
    68 
       
    69 
       
    70 CMtfTestActionCreateExpPop3MailInfo::~CMtfTestActionCreateExpPop3MailInfo()
       
    71 	{
       
    72 	}
       
    73 
       
    74 void CMtfTestActionCreateExpPop3MailInfo::ExecuteActionL()
       
    75 	{
       
    76 	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionCreateExpPop3MailInfo);
       
    77 	CExpPop3MailInfo* expMailInfo  = new (ELeave) CExpPop3MailInfo;
       
    78 	CleanupStack::PushL( expMailInfo );
       
    79 	expMailInfo->SetNumLinesBodyText( ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(0)) );
       
    80 	expMailInfo->SetFooterExpected( ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(1)) );
       
    81 	expMailInfo->SetNumLinesHtml( ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(2)) );
       
    82 
       
    83 	HBufC* paramDescription = ObtainParameterReferenceL<HBufC>(TestCase(), ActionParameters().Parameter(3));	
       
    84 	TPtr p = paramDescription->Des();
       
    85 	expMailInfo->SetDescription( p ); 
       
    86 
       
    87 	TInt paramNAttachmentsExp   = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(4));
       
    88 	expMailInfo->SetNumAttachments( paramNAttachmentsExp );
       
    89 
       
    90 	
       
    91 	if(ActionParameters().Count()==7)
       
    92 		{
       
    93 		expMailInfo->SetFooterSize( ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(6)) );
       
    94 		}
       
    95 	else
       
    96 		{
       
    97 		expMailInfo->SetFooterSize( 0 );
       
    98 		}
       
    99 
       
   100 	StoreParameterL<CExpPop3MailInfo>( TestCase(), *expMailInfo, ActionParameters().Parameter( 5 ));
       
   101 
       
   102 	CleanupStack::Pop(1); // expMailInfo
       
   103 	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionCreateExpPop3MailInfo);
       
   104 	TestCase().ActionCompletedL(*this);
       
   105 	}
       
   106 
       
   107 
       
   108 
       
   109 
       
   110 
       
   111 
       
   112