|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Unit test class for character to key mappings |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __UT_CPPLPREDICTIVESEARCHTABLE_H__ |
|
19 #define __UT_CPPLPREDICTIVESEARCHTABLE_H__ |
|
20 |
|
21 // EXTERNAL INCLUDES |
|
22 #include <digia/eunit/ceunittestsuiteclass.h> |
|
23 #include <digia/eunit/eunitmacros.h> |
|
24 #include <sqldb.h> |
|
25 #include "cntdef.h" // TContactItemId |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CPplPredictiveSearchTable; |
|
29 |
|
30 // CONSTANTS |
|
31 |
|
32 // CLASS DEFINITION |
|
33 /** |
|
34 * Tester class for CPcsKeyMap. |
|
35 */ |
|
36 NONSHARABLE_CLASS( UT_CPplPredictiveSearchTable ): public CEUnitTestSuiteClass |
|
37 { |
|
38 public: // Constructors and destructors |
|
39 |
|
40 /** |
|
41 * Two phase construction |
|
42 */ |
|
43 static UT_CPplPredictiveSearchTable* NewL(); |
|
44 static UT_CPplPredictiveSearchTable* NewLC(); |
|
45 |
|
46 /** |
|
47 * Destructor |
|
48 */ |
|
49 ~UT_CPplPredictiveSearchTable(); |
|
50 |
|
51 private: // Constructors |
|
52 |
|
53 UT_CPplPredictiveSearchTable(); |
|
54 void ConstructL(); |
|
55 |
|
56 private: // Test case setup and teardown |
|
57 |
|
58 void SetupL(); |
|
59 void Teardown(); |
|
60 |
|
61 private: // Test functions |
|
62 |
|
63 void UT_CreateInDbLL(); |
|
64 void UT_CreateInDbManyContactsL(); |
|
65 void UT_UpdateLL(); |
|
66 void UT_UpdateLBothFieldsL(); |
|
67 void UT_SearchL(); |
|
68 void UT_SearchWithSpacesL(); |
|
69 void UT_DeleteLL(); |
|
70 void UT_DeleteContactsL(); |
|
71 void UT_DeleteNonexistingContactL(); |
|
72 void UT_CheckIfTableExistsL(); |
|
73 void UT_CheckIfTableExists2L(); |
|
74 void UT_SynchronizeTableL(); |
|
75 |
|
76 private: // New functions |
|
77 |
|
78 void CheckItemCountL( |
|
79 TInt aCountInTable0 = 0, |
|
80 TInt aCountInTable1 = 0, |
|
81 TInt aCountInTable2 = 0, |
|
82 TInt aCountInTable3 = 0, |
|
83 TInt aCountInTable4 = 0, |
|
84 TInt aCountInTable5 = 0, |
|
85 TInt aCountInTable6 = 0, |
|
86 TInt aCountInTable7 = 0, |
|
87 TInt aCountInTable8 = 0, |
|
88 TInt aCountInTable9 = 0); |
|
89 |
|
90 /** |
|
91 * Adds a new contact to table. |
|
92 */ |
|
93 void AddContactL(const TDesC& aFirstName, |
|
94 const TDesC& aLastName, |
|
95 const TDesC& aCompanyName, |
|
96 TContactItemId aContactId); |
|
97 |
|
98 /** |
|
99 * Searches the table for matches, and returns an array containing |
|
100 * matching contact's ids. |
|
101 */ |
|
102 RArray<TContactItemId> DoPredictiveSearchL(const TDesC& aSearchString); |
|
103 |
|
104 const TDesC& DetermineTableName(const TDesC& aSearchString); |
|
105 |
|
106 const TDesC& MultipleTables(const TDesC& aSearchString); |
|
107 |
|
108 private: // Data |
|
109 |
|
110 CPplPredictiveSearchTable* iTable; |
|
111 |
|
112 RSqlDatabase iDB; |
|
113 |
|
114 EUNIT_DECLARE_TEST_TABLE; |
|
115 }; |
|
116 |
|
117 #endif // __UT_CPPLPREDICTIVESEARCHTABLE_H__ |
|
118 |
|
119 // End of file |