|
1 /* |
|
2 * Copyright (c) 2007 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: Part of CLF API tests |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDES |
|
20 #include <ceunittestsuiteclass.h> |
|
21 #include <bautils.h> |
|
22 #include <barsc.h> |
|
23 #include <CLFContentListing.hrh> |
|
24 #include <CLFContentListing.h> |
|
25 |
|
26 // FORWARD DECLARATION |
|
27 class MCLFContentListingEngine; |
|
28 class MCLFItemListModel; |
|
29 class MCLFSortingStyle; |
|
30 class TTestOperationObserver; |
|
31 class TTestCustomSorter; |
|
32 class TTestCustomGrouper; |
|
33 class TTestPostFilter; |
|
34 class TTestChangedItemObserver; |
|
35 class MCLFModifiableItem; |
|
36 class TTestCLFProcessObserver; |
|
37 class MCLFItem; |
|
38 |
|
39 /** |
|
40 * Test suite for Content Listing Framework API |
|
41 */ |
|
42 class T_CLFApiModuleTests : public CEUnitTestSuiteClass |
|
43 { |
|
44 public: // Construct / destruct |
|
45 static T_CLFApiModuleTests* NewLC(); |
|
46 ~T_CLFApiModuleTests(); |
|
47 |
|
48 private: |
|
49 void ConstructL(); |
|
50 |
|
51 private: // Assistance methods |
|
52 void ResourceL( TInt aResourceId ); |
|
53 void SortingStyleResourceL(); |
|
54 void ListModelResourceL(); |
|
55 void CreateNewFileL( TInt aNumber, TDes& aFileName ); |
|
56 TCLFItemId FindTestFileIdL( TInt aNumber ); |
|
57 TBool CheckFileNameShortingL(); |
|
58 TBool CheckFileSizeShortingL(); |
|
59 TBool CheckFileDateShortingL(); |
|
60 TBool CheckFileTypesL( const MDesCArray& aMimeTypeArray, const TArray<TInt>& aMediaTypes ); |
|
61 TBool CheckMimeTypesL( const MDesCArray& aMimeTypeArray, const TDesC& aMimeType ); |
|
62 TBool CheckMediaTypesL( const TArray<TInt>& aMediaTypes, TCLFMediaType aMediaType ); |
|
63 HBufC8* MakeOpaqueDataL( const MDesCArray& aFiles ); |
|
64 void MakeMultibleSortingItemsL( RPointerArray<MCLFModifiableItem>& aItemArray ); |
|
65 TBool CheckMultibleSortingShortingL(); |
|
66 TBool CheckMultibleSortingShorting2L(); |
|
67 const MCLFItem* FindItem( MCLFItemListModel& aModel, TCLFItemId aItemId ); |
|
68 |
|
69 |
|
70 private: // test methods |
|
71 // setups |
|
72 void BaseSetupL(); |
|
73 void SortingStyleResourceSetupL(); |
|
74 void CreateModelSetupL(); |
|
75 void CreateModelFromResourceSetupL(); |
|
76 void ListModelSetupL(); |
|
77 void ListModelSetupFromResourceL(); |
|
78 void ListModelAllFileItemsSetupL(); |
|
79 void EngineTestSetupL(); |
|
80 void SortingStyleTestSetupL(); |
|
81 void SortingStyleResourceTestSetupL(); |
|
82 void ModifiableItemTestSetupL(); |
|
83 void ItemTestSetupL(); |
|
84 void MultibleSortingSetupL(); |
|
85 void MultibleSortingResourceSetupL(); |
|
86 |
|
87 // teardowns |
|
88 void Teardown(); |
|
89 |
|
90 // tests |
|
91 // Constructor test |
|
92 void CreateEngineTestL(); |
|
93 void CreateModifiableItemTestL(); |
|
94 void CreateSortignStyleTestL(); |
|
95 void CreateSortignStyleFromResourceTestL(); |
|
96 void CreateListModelTestL(); |
|
97 void CreateListModelFromResourceTestL(); |
|
98 |
|
99 // Engine test |
|
100 void UpdateItemsTestL(); |
|
101 void UpdateItemsWithIdTestL(); |
|
102 void UpdateItemsWithOpaqueDataFolderTestL(); |
|
103 |
|
104 // Sorting Style test; |
|
105 void SortingStyleResourceTestL(); |
|
106 void SortingStyleOrderingTestL(); |
|
107 void SortingStyleDataTypeTestL(); |
|
108 void SortingStyleUndefinedItemPositionTestL(); |
|
109 void SortingStyleFieldTestL(); |
|
110 |
|
111 // List model test |
|
112 void RefreshTestL(); |
|
113 void SetSortingStyleTestL(); |
|
114 void SetCustomSorterTestL(); |
|
115 void GroupingTestL(); |
|
116 void SetPostFilterTestL(); |
|
117 void SetWantedMimeTypesTestL(); |
|
118 void SetWantedMediaTypesTestL(); |
|
119 void SetWantedMediaAndMimeTypesTestL(); |
|
120 void MultibleSortingTestL(); |
|
121 void ModelItemsChangedTestL(); |
|
122 |
|
123 |
|
124 // item test |
|
125 void ItemFieldTestL(); |
|
126 |
|
127 // Modifiable item test |
|
128 void MIFieldTestL(); |
|
129 |
|
130 private: // Implementation |
|
131 |
|
132 EUNIT_DECLARE_TEST_TABLE; |
|
133 |
|
134 private: // Data |
|
135 MCLFContentListingEngine* iEngine; |
|
136 MCLFItemListModel* iListModel; |
|
137 MCLFSortingStyle* iSortingStyle; |
|
138 MCLFSortingStyle* iSortingStyle1; |
|
139 MCLFSortingStyle* iSortingStyle2; |
|
140 MCLFSortingStyle* iSortingStyle3; |
|
141 MCLFModifiableItem* iModifiableItem; |
|
142 const MCLFItem* iItem; // ref. not owned |
|
143 |
|
144 TTestOperationObserver* iTestObserver; |
|
145 TTestCustomSorter* iTestSorter; |
|
146 TTestCustomSorter* iTestSorter1; |
|
147 TTestCustomGrouper* iTestGrouper; |
|
148 TTestCustomGrouper* iTestGrouper1; |
|
149 TTestPostFilter* iTestFilter; |
|
150 TTestPostFilter* iTestFilter1; |
|
151 TTestCLFProcessObserver* iTestCLFProcessObserver; |
|
152 TTestCLFProcessObserver* iTestCLFProcessObserver1; |
|
153 |
|
154 CDesCArray* iMimeTypeArray; |
|
155 CDesCArray* iMimeTypeArray1; |
|
156 RArray<TInt> iMediaTypeArray; |
|
157 RArray<TInt> iMediaTypeArray1; |
|
158 |
|
159 TTestChangedItemObserver* iChangedItemObserver; |
|
160 TTestChangedItemObserver* iChangedItemObserver1; |
|
161 RArray<TCLFItemId> iUpdateItemIdArray; |
|
162 HBufC8* iOpaqueData; |
|
163 TInt iSemanticId; |
|
164 |
|
165 RFs iFs; |
|
166 RResourceFile iResourceFile; |
|
167 HBufC8* iDataBuffer; |
|
168 TResourceReader iResourceReader; |
|
169 CActiveSchedulerWait iWait; |
|
170 RArray<TCLFItemId> iChangedArray; |
|
171 TInt iItemCount; |
|
172 RPointerArray<MCLFModifiableItem> iModifiableItems; |
|
173 TFileName iFileName; |
|
174 |
|
175 }; |
|
176 |
|
177 // End of file |