|
1 // Copyright (c) 2001-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 CViewTesterBase; |
|
20 |
|
21 class CTestConductor : public CBase |
|
22 { |
|
23 public: |
|
24 static CTestConductor* NewL(); |
|
25 ~CTestConductor(); |
|
26 void AddContactL(TInt aBitwiseFilterType); |
|
27 void AddContactsL(); |
|
28 void SetTestError(TInt aTestError); |
|
29 CContactIdArray* contacts; |
|
30 |
|
31 private: |
|
32 CTestConductor(); |
|
33 void ConstructL(); |
|
34 void RunTestsL(); |
|
35 private: |
|
36 RFs iFs; |
|
37 CLog* iLog; |
|
38 CContactDatabase* iDb; |
|
39 CRandomContactGenerator* iRandomGenerator; |
|
40 TInt iTotalContacts; |
|
41 TInt iTestError; |
|
42 }; |
|
43 |
|
44 class CViewTester : public CActive, public MContactViewObserver |
|
45 { |
|
46 public: |
|
47 static CViewTester* NewL(CLog& aLog,CContactDatabase& iDb,CTestConductor* aTestConductor); |
|
48 ~CViewTester(); |
|
49 |
|
50 private: |
|
51 CViewTester(CLog& aLog,CContactDatabase& iDb,CTestConductor* aTestConductor); |
|
52 void ConstructL(); |
|
53 void CompleteRequest(); |
|
54 void NextTest(); |
|
55 |
|
56 private: // From CActive. |
|
57 void RunL(); |
|
58 TInt RunError(TInt aError); |
|
59 void DoCancel(); |
|
60 |
|
61 private: // From MContactViewObserver. |
|
62 virtual void HandleContactViewEvent(const CContactViewBase& aView,const TContactViewEvent& aEvent); |
|
63 private: |
|
64 enum TTest |
|
65 { |
|
66 EStartingTests, |
|
67 |
|
68 EConstructRemoteView, |
|
69 ERemoteViewSortOrderChange, |
|
70 |
|
71 EAddPhoneNumber1, |
|
72 EPhoneNumberChangedEvent1, |
|
73 EAddPhoneNumber2, |
|
74 EPhoneNumberChangedEvent2, |
|
75 EAddPhoneNumber3, |
|
76 EPhoneNumberChangedEvent3, |
|
77 EAddPhoneNumber4, |
|
78 EPhoneNumberChangedEvent4, |
|
79 |
|
80 |
|
81 |
|
82 ERemoteViewPlugin, |
|
83 ERemoteViewPlugin2, |
|
84 |
|
85 |
|
86 EEndTest |
|
87 }; |
|
88 |
|
89 TTest iTestState; |
|
90 CLog& iLog; |
|
91 CContactDatabase& iDb; |
|
92 |
|
93 RArray<TInt> iLocalViewResults; |
|
94 RArray<TInt> iReceivedResults; |
|
95 |
|
96 RArray<TInt> iAddNumberRemoteViewResults1; |
|
97 RArray<TInt> iAddNumberRemoteViewResults2; |
|
98 RArray<TInt> iAddNumberRemoteViewResults3; |
|
99 RArray<TInt> iAddNumberRemoteViewResults4; |
|
100 RArray<TInt> iAddNumberReceivedResults; |
|
101 |
|
102 CContactNamedRemoteView* iRemoteView; |
|
103 CContactRemoteView* iRemoteView2; |
|
104 CContactRemoteView* iRemoteView3; |
|
105 |
|
106 RContactViewSortOrder iViewSortOrder; |
|
107 |
|
108 TContactIdWithMapping iContactToDeleteMapping; |
|
109 |
|
110 CTestConductor* iTestConductor; |
|
111 TInt iItemEventsExpected; |
|
112 TInt iItemsEventsRecieved; |
|
113 |
|
114 private: |
|
115 void AssignAllContactsToGroup(); |
|
116 void AssignContactsToGroup2(); |
|
117 |
|
118 void ConstructRemoteViewL(const TDesC8& aSortPluginName = KNullDesC8); |
|
119 void RemoteViewSortOrderChangeL(); |
|
120 void DestructRemoteView(); |
|
121 |
|
122 |
|
123 void CompareRecordedResultWithExpected(); |
|
124 void AddNumberCompareRecordedResultWithExpected(const RArray<TInt>&); |
|
125 CContactRemoteView* ExtracttRemoteViewLC(); |
|
126 static CArrayFix<TContactItemId >* OrderOfContactsLC(const CContactViewBase& aView); |
|
127 void AddPhoneNumberL(const TDesC& aWorkPhone,TContactItemId& ItemId); |
|
128 }; |