|
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 |
|
20 // |
|
21 // Forward declarations. |
|
22 // |
|
23 |
|
24 class CGroupViewTesterBase; |
|
25 |
|
26 |
|
27 // |
|
28 // CTestConductor. |
|
29 // |
|
30 |
|
31 class CTestConductor : public CBase |
|
32 { |
|
33 public: |
|
34 static CTestConductor* NewL(); |
|
35 void SetTestError(TInt aTestError); |
|
36 ~CTestConductor(); |
|
37 private: |
|
38 CTestConductor(); |
|
39 void ConstructL(); |
|
40 void RunTestsL(); |
|
41 void AddContactsL(); |
|
42 private: |
|
43 RFs iFs; |
|
44 CLog* iLog; |
|
45 CContactDatabase* iDb; |
|
46 CRandomContactGenerator* iRandomGenerator; |
|
47 TInt iTotalContacts; |
|
48 TInt iTestError; |
|
49 }; |
|
50 |
|
51 // |
|
52 // CGroupViewTester. |
|
53 // |
|
54 |
|
55 class CGroupViewTester : public CActive, public MContactViewObserver |
|
56 { |
|
57 public: |
|
58 static CGroupViewTester* NewL(CLog& aLog,CTestConductor* aTestConductor,CContactDatabase& iDb); |
|
59 ~CGroupViewTester(); |
|
60 private: |
|
61 CGroupViewTester(CLog& aLog,CTestConductor* aTestConductor,CContactDatabase& iDb); |
|
62 void ConstructL(); |
|
63 void NextTest(); |
|
64 void ExceriseViewL(CContactViewBase& aView); |
|
65 void TestGroupViewSortOrderL(CContactGroupView& aView); |
|
66 void CreateGroupTestDataL(); |
|
67 private: // From CActive. |
|
68 void RunL(); |
|
69 TInt RunError(TInt aError); |
|
70 void DoCancel(); |
|
71 static TInt EventConsumerCallBack(TAny* aThis); |
|
72 private: // From MContactViewObserver. |
|
73 virtual void HandleContactViewEvent(const CContactViewBase& aView,const TContactViewEvent& aEvent); |
|
74 void HandleDatabaseEventL(TContactDbObserverEvent aEvent); |
|
75 private: |
|
76 enum TTest |
|
77 { |
|
78 ECreateLocalView, |
|
79 EExerciseLocalView, |
|
80 ECreateGroupOneView, |
|
81 ETestGroupOneView, |
|
82 ECreateGroupOneViewByName, |
|
83 ETestGroupOneViewByName, |
|
84 ECreateGroupOneViewNotInGroup, |
|
85 ETestGroupOneViewNotInGroup, |
|
86 EAllViewsOutOfBoundsAccess, |
|
87 ECreateUnfiledGroupView, |
|
88 ETestUnfiledGroupView, |
|
89 ETestUnfiledGroupAddition, |
|
90 ENumTests |
|
91 }; |
|
92 private: |
|
93 CLog& iLog; |
|
94 CTestConductor* iTestConductor; |
|
95 CContactDatabase& iDb; |
|
96 TInt iCurrentTest; |
|
97 RContactViewSortOrder iSortOrder_1; |
|
98 CContactTextDef* iTextDef; |
|
99 TBuf<128> iScratchBuf; |
|
100 CContactLocalView* iLocalView; |
|
101 //GroupView_One |
|
102 CContactGroup* iGroupOne; |
|
103 TContactItemId iGroupOneId; |
|
104 HBufC* iGroupView_One_Name; |
|
105 CContactGroupView* iGroupViewOne; |
|
106 CContactGroupView* iGroupViewOneByName; |
|
107 CContactGroupView* iGroupViewOneNotInGroup; |
|
108 CContactGroupView* iGroupViewUnfiled; |
|
109 CContactIdArray* iIdsInGroupViewOne; |
|
110 // |
|
111 CEventConsumer* iEventConsumer; |
|
112 |
|
113 TInt iNumNotificationExpected; |
|
114 }; |