|
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 // CheckChildrenCount |
|
17 // [Action Parameters] |
|
18 // Session <input>: Reference to the session. |
|
19 // ParentId <input>: Value of the parent id. |
|
20 // Count <input>: Value of expected count. |
|
21 // [Action Description] |
|
22 // Checks if children count is as expected. |
|
23 // [APIs Used] |
|
24 // CMsvEntry::SetEntryL |
|
25 // CMsvEntry::ChildrenL |
|
26 // CMsvEntry::SetSortTypeL |
|
27 // TMsvSelectionOrdering::SetShowInvisibleEntries |
|
28 // __ACTION_INFO_END__ |
|
29 // |
|
30 // |
|
31 |
|
32 /** |
|
33 @file |
|
34 */ |
|
35 |
|
36 |
|
37 #include "CMtfTestActionCheckChildrenCount.h" |
|
38 #include "CMtfTestCase.h" |
|
39 #include "CMtfTestActionParameters.h" |
|
40 |
|
41 #include <msvapi.h> |
|
42 |
|
43 |
|
44 CMtfTestAction* CMtfTestActionCheckChildrenCount::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
45 { |
|
46 CMtfTestActionCheckChildrenCount* self = new (ELeave) CMtfTestActionCheckChildrenCount(aTestCase); |
|
47 CleanupStack::PushL(self); |
|
48 self->ConstructL(aActionParameters); |
|
49 CleanupStack::Pop(); |
|
50 return self; |
|
51 } |
|
52 |
|
53 |
|
54 CMtfTestActionCheckChildrenCount::CMtfTestActionCheckChildrenCount(CMtfTestCase& aTestCase) |
|
55 : CMtfSynchronousTestAction(aTestCase) |
|
56 { |
|
57 } |
|
58 |
|
59 |
|
60 CMtfTestActionCheckChildrenCount::~CMtfTestActionCheckChildrenCount() |
|
61 { |
|
62 } |
|
63 |
|
64 |
|
65 void CMtfTestActionCheckChildrenCount::ExecuteActionL() |
|
66 { |
|
67 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionCheckChildrenCount); |
|
68 if((TestCase().TestStepResult()) == EPass) |
|
69 { |
|
70 CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0)); |
|
71 TMsvId paramParentId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1)); |
|
72 TInt paramCount = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(2)); |
|
73 |
|
74 CMsvEntry* entry = CMsvEntry::NewL(*paramSession,paramParentId,TMsvSelectionOrdering(KMsvNoGrouping,EMsvSortByNone,ETrue)); |
|
75 CleanupStack::PushL(entry); |
|
76 entry->SetEntryL(paramParentId); |
|
77 |
|
78 TMsvSelectionOrdering order; |
|
79 order.SetShowInvisibleEntries(ETrue); |
|
80 entry->SetSortTypeL(order); |
|
81 |
|
82 CMsvEntrySelection* selection = entry->ChildrenL(); |
|
83 CleanupStack::PushL(selection); |
|
84 |
|
85 TInt count = selection->Count(); |
|
86 if (paramCount != count) |
|
87 User::Leave(KErrArgument); |
|
88 |
|
89 CleanupStack::PopAndDestroy(selection); |
|
90 CleanupStack::PopAndDestroy(entry); |
|
91 |
|
92 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionCheckChildrenCount ); |
|
93 } |
|
94 TestCase().ActionCompletedL(*this); |
|
95 } |
|
96 |