|
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 #include "T_UTILS.H" |
|
19 |
|
20 // |
|
21 // Forward declarations. |
|
22 // |
|
23 |
|
24 class CViewTesterBase; |
|
25 |
|
26 |
|
27 // |
|
28 // CTestConductor. |
|
29 // |
|
30 |
|
31 class CTestConductor : public CBase |
|
32 { |
|
33 public: |
|
34 static CTestConductor* NewL(); |
|
35 ~CTestConductor(); |
|
36 void AddContactL(TInt aBitwiseFilterType); |
|
37 void SetTestError(TInt aTestError); |
|
38 private: |
|
39 CTestConductor(); |
|
40 void ConstructL(); |
|
41 void RunTestsL(); |
|
42 void AddContactsL(); |
|
43 void AddContactsThatMatchFilterL(TInt aNumberOfContacts, TInt aFilter); |
|
44 private: |
|
45 RFs iFs; |
|
46 CLog* iLog; |
|
47 CContactDatabase* iDb; |
|
48 CRandomContactGenerator* iRandomGenerator; |
|
49 TInt iTotalContacts; |
|
50 TInt iTestError; |
|
51 }; |
|
52 |
|
53 |
|
54 // |
|
55 // CViewTester. |
|
56 // |
|
57 |
|
58 class CViewTester : public CActive, public MContactViewObserver |
|
59 { |
|
60 public: |
|
61 static CViewTester* NewL(CLog& aLog,CContactDatabase& iDb,CTestConductor* aTestConductor); |
|
62 ~CViewTester(); |
|
63 private: |
|
64 CViewTester(CLog& aLog,CContactDatabase& iDb,CTestConductor* aTestConductor); |
|
65 void ConstructL(); |
|
66 void NextTest(); |
|
67 void ExceriseViewL(CContactViewBase& aView); |
|
68 private: // From CActive. |
|
69 void RunL(); |
|
70 TInt RunError(TInt aError); |
|
71 void DoCancel(); |
|
72 private: // From MContactViewObserver. |
|
73 virtual void HandleContactViewEvent(const CContactViewBase& aView,const TContactViewEvent& aEvent); |
|
74 private: |
|
75 void TestViewNotificationsL(CContactViewBase& aView); |
|
76 private: |
|
77 TBool ContactIdsEqualL(const CContactViewBase& aView, TInt aIndex); |
|
78 void TestViewIndiciesL(const CContactViewBase& aView); |
|
79 void PrintTimeTaken(TInt aProfile); |
|
80 void PrintTotalTimeTaken(); |
|
81 |
|
82 private: |
|
83 void HandleViewCreation(const CContactViewBase& aView, const TContactViewEvent& aEvent, CContactViewBase* aPtrView); |
|
84 |
|
85 private: |
|
86 CContactFilteredView* CreateFilterViewL(); |
|
87 |
|
88 private: |
|
89 enum TTest |
|
90 { |
|
91 ECreateLocalView, |
|
92 EExerciseLocalView, |
|
93 ECreateLandlineFilterView, |
|
94 ECreateSmsFilterView, |
|
95 ECreateEmailFilterView, |
|
96 ECreateFaxFilterView, |
|
97 ECreatePhonableFilterView, |
|
98 ECreateWorkFilterView, |
|
99 ECreateHomeFilterView, |
|
100 ECreateUnfilteredView, |
|
101 ECreateRingToneView, |
|
102 ECreateVoiceDialView, |
|
103 ECreateWirelessVillageAddressView, |
|
104 ECreateIMAddressView, |
|
105 ETestLandlineFilterView, |
|
106 ETestSmsFilterView, |
|
107 ETestEmailFilterView, |
|
108 ETestFaxFilterView, |
|
109 ETestPhonableFilterView, |
|
110 ETestWorkFilterView, |
|
111 ETestHomeFilterView, |
|
112 ETestUnfilteredView, |
|
113 ETestRingToneView, |
|
114 ETestVoiceDialView, |
|
115 ETestWirelessVillageAddressView, |
|
116 ETestIMAddressView, |
|
117 EOOMIMAddressView, |
|
118 EOOMDeleteIMAddressView, |
|
119 ETestRemoveContacts, |
|
120 ETestViewIndiciesAfterRemoval, |
|
121 ETestAddContacts, |
|
122 ETestViewIndiciesAfterAddition, |
|
123 EAllViewsOutOfBoundsAccess, |
|
124 ECreateLandLineFilterView2Fields, |
|
125 ETestLandLineFilterView2Fields, |
|
126 ENumTests |
|
127 }; |
|
128 |
|
129 private: |
|
130 CLog& iLog; |
|
131 CContactDatabase& iDb; |
|
132 TInt iCurrentTest; |
|
133 RContactViewSortOrder iSortOrder_1; |
|
134 RContactViewSortOrder iSortOrder_2; |
|
135 CContactTextDef* iTextDef; |
|
136 TBuf<128> iScratchBuf; |
|
137 CContactNamedRemoteView* iNamedRemoteView; |
|
138 CContactFilteredView* iLandlineFilterView; |
|
139 CContactFilteredView* iSmsFilterView; |
|
140 CContactFilteredView* iEmailFilterView; |
|
141 CContactFilteredView* iFaxFilterView; |
|
142 CContactFilteredView* iPhonableFilterView; |
|
143 CContactFilteredView* iWorkFilterView; |
|
144 CContactFilteredView* iHomeFilterView; |
|
145 CContactFilteredView* iUnfilteredView; |
|
146 CContactFilteredView* iRingToneView; |
|
147 CContactFilteredView* iVoiceDialView; |
|
148 CContactFilteredView* iWirelessVillageView; |
|
149 CContactFilteredView* iIMAddressView; |
|
150 CContactFilteredView* iOOMIMAddressView; |
|
151 CContactFilteredView* iLandlineFilterView2Fields; |
|
152 |
|
153 TInt iFilter; |
|
154 TInt iNumNotificationExpected; |
|
155 CTestConductor* iTestConductor; |
|
156 TInt iItemEventsExpected; |
|
157 TInt iItemsEventsRecieved; |
|
158 TInt iTimeForTestsToComplete[ENumTests]; |
|
159 TCntProfile iProfile; |
|
160 TInt iOOMCounter; |
|
161 TContactItemId iFilterViewSavedId; |
|
162 }; |