messagingfw/msgtestfw/TestActions/Base/src/CMtfTestActionCreateChildrenSelection.cpp
changeset 0 8e480a14352b
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     1 // Copyright (c) 2003-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 // CreateChildrenSelection
       
    17 // [Action Parameters]
       
    18 // Session    <input>: Reference to the session.
       
    19 // ParentId   <input>: Value of the parent id.
       
    20 // Selection <output>: Reference to the created selection.
       
    21 // [Action Description]
       
    22 // Creates a selection of all children.
       
    23 // [APIs Used]
       
    24 // none.
       
    25 // __ACTION_INFO_END__
       
    26 // 
       
    27 //
       
    28 
       
    29 /**
       
    30  @file
       
    31 */
       
    32 
       
    33 #include "CMtfTestActionCreateChildrenSelection.h"
       
    34 #include "CMtfTestCase.h"
       
    35 #include "CMtfTestActionParameters.h"
       
    36 
       
    37 #include <msvapi.h>
       
    38 
       
    39 
       
    40 CMtfTestAction* CMtfTestActionCreateChildrenSelection::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters)
       
    41 	{
       
    42 	CMtfTestActionCreateChildrenSelection* self = new (ELeave) CMtfTestActionCreateChildrenSelection(aTestCase);
       
    43 	CleanupStack::PushL(self);
       
    44 	self->ConstructL(aActionParameters);
       
    45 	CleanupStack::Pop();
       
    46 	return self;
       
    47 	}
       
    48 	
       
    49 
       
    50 CMtfTestActionCreateChildrenSelection::CMtfTestActionCreateChildrenSelection(CMtfTestCase& aTestCase)
       
    51 	: CMtfSynchronousTestAction(aTestCase)
       
    52 	{
       
    53 	}
       
    54 
       
    55 
       
    56 CMtfTestActionCreateChildrenSelection::~CMtfTestActionCreateChildrenSelection()
       
    57 	{
       
    58 	}
       
    59 
       
    60 
       
    61 void CMtfTestActionCreateChildrenSelection::ExecuteActionL()
       
    62 	{
       
    63 	if((TestCase().TestStepResult()) == EPass)
       
    64 		{
       
    65 		TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionCreateChildrenSelection);
       
    66 		CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
       
    67 		TMsvId paramParentId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1));
       
    68 
       
    69 		CMsvEntry* entry = CMsvEntry::NewL(*paramSession,paramParentId,TMsvSelectionOrdering(KMsvNoGrouping,EMsvSortByNone,ETrue));
       
    70 		CleanupStack::PushL(entry);
       
    71 		entry->SetEntryL(paramParentId);
       
    72 
       
    73 		TMsvSelectionOrdering order;
       
    74 		order.SetShowInvisibleEntries(ETrue);
       
    75 		entry->SetSortTypeL(order);
       
    76 
       
    77 		CMsvEntrySelection* paramSelection = entry->ChildrenL();
       
    78 		CleanupStack::PushL(paramSelection);
       
    79 		StoreParameterL<CMsvEntrySelection>(TestCase(),*paramSelection,ActionParameters().Parameter(2));
       
    80 		CleanupStack::Pop(paramSelection);
       
    81 		CleanupStack::PopAndDestroy(entry);
       
    82 	
       
    83 		TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionCreateChildrenSelection);
       
    84 		}
       
    85 	TestCase().ActionCompletedL(*this);
       
    86 	}
       
    87 
       
    88