|
1 // Copyright (c) 2008-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 #ifndef __T_SUBVIEW_H__ |
|
17 #define __T_SUBVIEW_H__ |
|
18 |
|
19 #include <e32test.h> |
|
20 |
|
21 #include <cntdb.h> |
|
22 #include <cntitem.h> |
|
23 #include <cntfield.h> |
|
24 #include <cntfldst.h> |
|
25 #include <cntview.h> |
|
26 #include "cntviewprivate.h" |
|
27 #include "dbcreator.h" |
|
28 |
|
29 _LIT(KDbName, "C:t_subview.cdb"); |
|
30 _LIT(KTestName, "t_subview"); |
|
31 const TInt KNumContacts(500); |
|
32 _LIT(KLowChar, "f"); |
|
33 _LIT(KHighChar, "r"); |
|
34 _LIT(KLowBoundary, ">=f"); |
|
35 _LIT(KHighBoundary, "<s"); |
|
36 |
|
37 RTest test(KTestName); |
|
38 |
|
39 |
|
40 class CSubViewTest : public CActive, public MContactViewObserver |
|
41 { |
|
42 public: |
|
43 static CSubViewTest* NewLC(); |
|
44 void HandleContactViewEvent(const CContactViewBase& aView, const TContactViewEvent& aEvent); |
|
45 void DoTestL(); |
|
46 |
|
47 private: |
|
48 void ConstructL(); |
|
49 CSubViewTest(); |
|
50 ~CSubViewTest(); |
|
51 void Cleanup(); |
|
52 void RunL(); |
|
53 void DoCancel(); |
|
54 void CreateNamedLocalViewL(); |
|
55 void CreateSubViewL(); |
|
56 void ResortNamedLocalViewL(); |
|
57 void PrintSubViewL() const; |
|
58 void PreResortTestL() const; |
|
59 void PostResortTestL() const; |
|
60 void CheckSortOrderL() const; |
|
61 void SubAndLocalViewCompareTestL() const; |
|
62 |
|
63 private: |
|
64 enum TSubViewTestState {ETestStarted, |
|
65 ENamedLocalViewCreated, |
|
66 ESubViewCreated, |
|
67 EResorting, |
|
68 ENamedLocalViewResorted, |
|
69 ESubViewUpdated, |
|
70 ESortingComplete |
|
71 }; |
|
72 private: |
|
73 CContactDatabase* iContactsDb; |
|
74 CContactNamedLocalView* iNamedLocalView; |
|
75 CContactSubView* iSubView; |
|
76 TInt iViewCount; |
|
77 TSubViewTestState iState; |
|
78 TInt iLnameIdx; |
|
79 TInt iFnameIdx; |
|
80 TInt iCnameIdx; |
|
81 TInt iNumIdx; |
|
82 TBuf<24> iNameOfFirstContact; |
|
83 TBuf<24> iNameOfLastContact; |
|
84 }; |
|
85 |
|
86 |
|
87 |
|
88 #endif //__T_SUBVIEW_H__ |