|
1 // Copyright (c) 2007-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 // |
|
15 |
|
16 #include <cntview.h> |
|
17 #include "t_utils2.h" |
|
18 |
|
19 class CGroupViewTesterBase; |
|
20 |
|
21 |
|
22 class CTestConductor : public CBase |
|
23 { |
|
24 public: |
|
25 static CTestConductor* NewL(); |
|
26 void SetTestError(TInt aTestError); |
|
27 TContactItemId AddRandomContactL(); |
|
28 ~CTestConductor(); |
|
29 private: |
|
30 CTestConductor(); |
|
31 void ConstructL(); |
|
32 void RunTestsL(); |
|
33 void AddContactsL(); |
|
34 private: |
|
35 RFs iFs; |
|
36 CLog* iLog; |
|
37 CContactDatabase* iDb; |
|
38 CRandomContactGenerator* iRandomGenerator; |
|
39 TInt iTotalContacts; |
|
40 TInt iTestError; |
|
41 }; |
|
42 |
|
43 class CGroupViewTester : public CActive, public MContactViewObserver |
|
44 { |
|
45 public: |
|
46 static CGroupViewTester* NewL( CLog& aLog, CTestConductor* aTestConductor, |
|
47 CContactDatabase& iDb ); |
|
48 ~CGroupViewTester(); |
|
49 |
|
50 private: |
|
51 CGroupViewTester( CLog& aLog, CTestConductor* aTestConductor, |
|
52 CContactDatabase& iDb ); |
|
53 void ConstructL(); |
|
54 void NextTest(); |
|
55 void CreateGroupTestDataL(); |
|
56 void LogEvent( TContactViewEvent& aEvent ); |
|
57 |
|
58 private: // From CActive. |
|
59 void RunL(); |
|
60 TInt RunError( TInt aError ); |
|
61 void DoCancel(); |
|
62 |
|
63 private: // From MContactViewObserver. |
|
64 virtual void HandleContactViewEvent( const CContactViewBase& aView, |
|
65 const TContactViewEvent& aEvent); |
|
66 |
|
67 private: |
|
68 enum TTest |
|
69 { |
|
70 ECreateLocalView, |
|
71 ECreateGroupOneView, |
|
72 ECreateGroupTwoView, |
|
73 EDeleteItemsFromView, |
|
74 EAddItemToGroup, |
|
75 ENumTests |
|
76 }; |
|
77 |
|
78 private: |
|
79 CLog& iLog; |
|
80 CTestConductor* iTestConductor; |
|
81 CContactDatabase& iDb; |
|
82 TInt iCurrentTest; |
|
83 RContactViewSortOrder iSortOrder_1; |
|
84 CContactTextDef* iTextDef; |
|
85 CContactLocalView* iLocalView; |
|
86 CContactGroup* iGroupOne; |
|
87 TContactItemId iGroupOneId; |
|
88 CContactGroupView* iGroupViewOne; |
|
89 CContactGroupView* iGroupViewTwo; |
|
90 CContactIdArray* iIdsInGroupViewOne; |
|
91 TInt iNumNotificationExpected; |
|
92 TInt iNumRemovedEvents; |
|
93 TContactItemId iIdAdded; |
|
94 TContactItemId iUnfiledContact; |
|
95 TContactItemId iLastContactID; |
|
96 TContactItemId iSecondLastContactID; |
|
97 TContactItemId iThirdLastContactID; |
|
98 }; |