messagingfw/msgtestfw/TestActions/SendAs/src/CMtfTestActionSendAsCheckMultipleRecipientFlag.cpp
changeset 62 db3f5fa34ec7
parent 0 8e480a14352b
equal deleted inserted replaced
60:9f5ae1728557 62:db3f5fa34ec7
       
     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 // SendAsCheckMultipleRecipientFlag
       
    17 // [Action Parameters]
       
    18 // CMsvEntry	paramMsgEntry	   <input>: Reference to the message entry object
       
    19 // [Action Description]
       
    20 // SendAsCheckMultipleRecipientFlag Test Action is intended to verify that the Multiple Recipient Flag is set 
       
    21 // __ACTION_INFO_END__
       
    22 // 
       
    23 //
       
    24 
       
    25 /**
       
    26  @file 
       
    27  @internalTechnology 
       
    28 */
       
    29 
       
    30 
       
    31 // User include
       
    32 #include "CMtfTestActionSendAsCheckMultipleRecipientFlag.h"
       
    33 #include "CMtfTestCase.h"
       
    34 #include "CMtfTestActionParameters.h"
       
    35 #include "CMtfTestActionUtilsMessage.h"
       
    36 
       
    37 #include "btmsgtypeuid.h"
       
    38 #include "irmsgtypeuid.h"
       
    39 #include "MSVSTD.H" 
       
    40 
       
    41 //Granularity for CArrayFixFlat arrays
       
    42 const TInt KArrayGranularity = 16;
       
    43 
       
    44 /**
       
    45   NewL()
       
    46   Constructs a CMtfTestActionSendAsCheckMultipleRecipientFlag 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 CMtfTestActionSendAsCheckMultipleRecipientFlag
       
    52   @pre    None
       
    53   @post   CMtfTestActionSendAsCheckMultipleRecipientFlag object is created
       
    54 */
       
    55 CMtfTestAction* CMtfTestActionSendAsCheckMultipleRecipientFlag::
       
    56 		NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters)
       
    57 	{
       
    58 	CMtfTestActionSendAsCheckMultipleRecipientFlag* self = 
       
    59 							new (ELeave) CMtfTestActionSendAsCheckMultipleRecipientFlag(aTestCase);
       
    60 
       
    61 	CleanupStack::PushL(self);
       
    62 	self->ConstructL(aActionParameters);
       
    63 	CleanupStack::Pop(self);
       
    64 	return self;
       
    65 	}
       
    66 	
       
    67 
       
    68 /**
       
    69   CMtfTestActionSendAsCheckMultipleRecipientFlag 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 CMtfTestActionSendAsCheckMultipleRecipientFlag::CMtfTestActionSendAsCheckMultipleRecipientFlag(CMtfTestCase& aTestCase)
       
    77 	: CMtfSynchronousTestAction(aTestCase)
       
    78 	{
       
    79 	}
       
    80 
       
    81 /**
       
    82   Function : ~CMtfTestActionSendAsCheckMultipleRecipientFlag
       
    83   Description : Destructor
       
    84   @internalTechnology
       
    85   @param :
       
    86   @return : 
       
    87   @pre 
       
    88   @post 
       
    89 */
       
    90 CMtfTestActionSendAsCheckMultipleRecipientFlag::~CMtfTestActionSendAsCheckMultipleRecipientFlag()
       
    91 	{
       
    92 	}
       
    93 
       
    94 /**
       
    95   ExecuteActionL
       
    96   Verifies whether the Multiple Recipient flag has been set
       
    97   @internalTechnology 
       
    98   @pre    None
       
    99   @post   None
       
   100   @leave  System wide errors
       
   101 */
       
   102 void CMtfTestActionSendAsCheckMultipleRecipientFlag::ExecuteActionL()
       
   103 	{
       
   104 	if((TestCase().TestStepResult()) == EPass)
       
   105 		{
       
   106 		TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSendAsCheckMultipleRecipientFlag);
       
   107 			
       
   108 		// Get Test Action input parameters
       
   109 		CMsvEntry*	paramMsgEntry = ObtainParameterReferenceL<CMsvEntry>(TestCase(),
       
   110 										ActionParameters().Parameter(0));
       
   111 										
       
   112 		
       
   113 		if (paramMsgEntry == NULL)
       
   114 			{
       
   115 			TestCase().ERR_PRINTF1(_L("Invalid parameter: Message Entry value is NULL"));
       
   116 			TestCase().SetTestStepResult(EFail);
       
   117 			}
       
   118 			
       
   119 		if((TestCase().TestStepResult()) == EPass)	
       
   120 			{
       
   121 			TInt result ;			
       
   122 			// Call function to verify the flag 
       
   123 			result = CheckFlag(*paramMsgEntry);
       
   124 			if (result == KErrNone)
       
   125 					{
       
   126 					TestCase().INFO_PRINTF2(_L("Multiple Flag was set successfully: %d"), result);
       
   127 					}
       
   128 				else if (result == KErrNotFound)
       
   129 					{
       
   130 					TestCase().ERR_PRINTF1(_L("Multiple Flag was not set"));
       
   131 					TestCase().SetTestStepResult(EFail);			
       
   132 					}
       
   133 				else
       
   134 					{
       
   135 					TestCase().ERR_PRINTF2(_L("Verification of Recipient address failed with error: %d"), result);
       
   136 					TestCase().SetTestStepResult(EFail);			
       
   137 					}
       
   138 			}
       
   139 		}
       
   140 			
       
   141 	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSendAsCheckMultipleRecipientFlag);
       
   142 	TestCase().ActionCompletedL(*this);
       
   143 	}
       
   144 	
       
   145 	
       
   146 /**
       
   147  Calls the MultipleRecipient() to check if it has been set to True 
       
   148 */
       
   149 TInt CMtfTestActionSendAsCheckMultipleRecipientFlag::CheckFlag(CMsvEntry& aMsgEntry)
       
   150 	{
       
   151 	TInt returnValue = KErrNotFound;
       
   152 	TBool check = aMsgEntry.Entry().MultipleRecipients();
       
   153 	if (check)
       
   154 		{
       
   155 		return KErrNone;
       
   156 		}
       
   157 	return returnValue ;
       
   158 	}
       
   159 	
       
   160