|
1 /** |
|
2 * Copyright (c) 2007-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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __PREPARE_DATA_TEST_STEP_H__ |
|
21 #define __PREPARE_DATA_TEST_STEP_H__ |
|
22 |
|
23 // System Includes |
|
24 #include <test/testexecutestepbase.h> |
|
25 #include <cntdb.h> |
|
26 #include <cntitem.h> |
|
27 #include <cntviewbase.h> |
|
28 #include <cntfldst.h> |
|
29 #include <cntfilt.h> |
|
30 #include <e32math.h> |
|
31 |
|
32 // User Includes |
|
33 #include "AddModifyDeleteContactFields.h" |
|
34 #include "TestContactViewDatabaseUtilitiesStep.h" |
|
35 |
|
36 |
|
37 /** |
|
38 * This class supports addition of contact items and groups in the database basically from view construction |
|
39 * point of view. While adding contact items, the following things are taken into consideration |
|
40 * -- Num of desired Sortable contacts specific to Sort order |
|
41 * -- Num of Unsortable Contacts specific to Sort order |
|
42 * -- Num of Contacts with desired Contact View Filter |
|
43 * -- Num of contacts with desired Strings |
|
44 * -- Num of Groups and Num of contacts in each group |
|
45 * |
|
46 */ |
|
47 class CPrepareDataTestStep : public CTestContactViewDatabaseUtilitiesStep, public TAddModifyDeleteContactFields |
|
48 { |
|
49 public: |
|
50 CPrepareDataTestStep(); |
|
51 ~CPrepareDataTestStep(); |
|
52 TVerdict doTestStepPreambleL(); |
|
53 TVerdict doTestStepL(); |
|
54 TVerdict doTestStepPostambleL(); |
|
55 |
|
56 private: |
|
57 void AddContactsInDatabaseL(); |
|
58 void ImportContactsL(); |
|
59 void UpdateContactFieldsSpecificToSortOrderL(const TPtrC& aSortOrderSection); |
|
60 void AddContactFieldL(CContactItem& aContact, const RContactViewSortOrder& aSortOrder, TBool aData = EFalse); |
|
61 |
|
62 void IterateThroAllSortOrderSectionsAndUpdateContactsInDatabaseL(); |
|
63 void IterateThroAllSortOrderSectionsAndUpdateContactsL(); |
|
64 |
|
65 void AddTypicalContactForFilterL(CContactItem& aContact, TInt aBitWiseFilter); |
|
66 TBool CheckAllTheFieldsExists(const CContactItem& aContact, const RContactViewSortOrder& aSortOrder); |
|
67 void IterateThroAllFilterViewsSectionsAndUpdateL(); |
|
68 void UpdateContactsInDatabaseAsPerFilteredViewRequirementsL(const TPtrC& aFilteredViewSection); |
|
69 |
|
70 void RetrieveContactsSpecificToSortOrderL(const RContactViewSortOrder& aSortOrder, RArray<TContactItemId>& aContactSpecificToSorder); |
|
71 void IterateThroAllMatchingStringSectionsAndUpdateL(); |
|
72 void UpdateContactsInDatabaseAsPerMatchingStringsL(const TPtrC& aMatchingStringSection); |
|
73 void AddMatchingStringToContactL(CContactItem& aContact, TUid aUid, const TPtrC& aDesiredMatchingString); |
|
74 void UpdateContactToSpecificStringL(); |
|
75 void UpdateContactFieldsToDesireStingL(const TPtrC& aMatchingStringSection); |
|
76 |
|
77 private: |
|
78 CActiveScheduler* iScheduler; |
|
79 CContactDatabase* iDb; |
|
80 RArray <TContactItemId> iListOfContactItemsInDatabase; |
|
81 TInt64 iRandSeed; |
|
82 }; |
|
83 |
|
84 _LIT(KPrepareDataTestStep,"PrepareDataTestStep"); |
|
85 #endif |
|
86 |
|
87 |
|
88 |