messagingfw/msgtestfw/TestActions/Base/src/CMtfTestActionCreateOrderedChildrenSelection.cpp
changeset 62 db3f5fa34ec7
parent 0 8e480a14352b
equal deleted inserted replaced
60:9f5ae1728557 62:db3f5fa34ec7
       
     1 // Copyright (c) 2005-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 // CreateOrderedChildrenSelection
       
    17 // [Action Parameters]
       
    18 // Session          <input>:  Reference to the session.
       
    19 // ParentId         <input>:  Value of the parent id.
       
    20 // Sorting          <input>:  Sorting criteria. See TMsvSorting.
       
    21 // Grouping         <input>:  Grouping criteria. See TMsvGrouping.
       
    22 // IncludeInvisible <input>:  Determines whether invisible entries are included in the selection.
       
    23 // Selection        <output>: Reference to the created selection.
       
    24 // [Action Description]
       
    25 // Creates an ordered selection of message store children entry ids below a given parent entry.
       
    26 // (E.g. Chronologically: earliest-latest).
       
    27 // [APIs Used]
       
    28 // TMsvGrouping
       
    29 // TMsvSorting
       
    30 // TMsvSelectionOrdering
       
    31 // CMsvEntry::NewL
       
    32 // CMsvEntry::ChildrenL
       
    33 // __ACTION_INFO_END__
       
    34 // 
       
    35 //
       
    36 
       
    37 #include "CMtfTestActionCreateOrderedChildrenSelection.h"
       
    38 #include "CMtfTestCase.h"
       
    39 #include "CMtfTestActionParameters.h"
       
    40 
       
    41 #include <msvapi.h>
       
    42 
       
    43 
       
    44 CMtfTestAction* CMtfTestActionCreateOrderedChildrenSelection::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters)
       
    45 	{
       
    46 	CMtfTestActionCreateOrderedChildrenSelection* self = new (ELeave) CMtfTestActionCreateOrderedChildrenSelection(aTestCase);
       
    47 	CleanupStack::PushL(self);
       
    48 	self->ConstructL(aActionParameters);
       
    49 	CleanupStack::Pop(self);
       
    50 	return self;
       
    51 	}
       
    52 	
       
    53 
       
    54 CMtfTestActionCreateOrderedChildrenSelection::CMtfTestActionCreateOrderedChildrenSelection(CMtfTestCase& aTestCase)
       
    55 	: CMtfSynchronousTestAction(aTestCase)
       
    56 	{
       
    57 	}
       
    58 
       
    59 
       
    60 CMtfTestActionCreateOrderedChildrenSelection::~CMtfTestActionCreateOrderedChildrenSelection()
       
    61 	{
       
    62 	}
       
    63 
       
    64 
       
    65 void CMtfTestActionCreateOrderedChildrenSelection::ExecuteActionL()
       
    66 	{
       
    67 	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionCreateOrderedChildrenSelection);
       
    68 	CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
       
    69 	TMsvId paramParentId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1));
       
    70 	TInt sorting = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(2));
       
    71 	TInt grouping = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(3));
       
    72 	TBool includeInvisible = ObtainValueParameterL<TBool>(TestCase(),ActionParameters().Parameter(4));
       
    73 
       
    74 	TMsvSelectionOrdering selectionOrdering = TMsvSelectionOrdering(TMsvGrouping(grouping),TMsvSorting(sorting),includeInvisible);
       
    75 
       
    76 	CMsvEntry* entry = CMsvEntry::NewL(*paramSession,paramParentId,selectionOrdering);
       
    77 	CleanupStack::PushL(entry);
       
    78 
       
    79 	CMsvEntrySelection* paramSelection = entry->ChildrenL();
       
    80 	CleanupStack::PushL(paramSelection);
       
    81 
       
    82 	StoreParameterL<CMsvEntrySelection>(TestCase(),*paramSelection,ActionParameters().Parameter(5));
       
    83 
       
    84 	CleanupStack::Pop(paramSelection);
       
    85 	CleanupStack::PopAndDestroy(entry);
       
    86 
       
    87 	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionCreateOrderedChildrenSelection);
       
    88 	TestCase().ActionCompletedL(*this);
       
    89 	}
       
    90 
       
    91