34
|
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: Testclas for testing VideoListDataModel class methods*
|
|
15 |
*/
|
|
16 |
|
|
17 |
|
|
18 |
#ifndef __TESTVIDEOLISTDATAMODEL_H__
|
|
19 |
#define __TESTVIDEOLISTDATAMODEL_H__
|
|
20 |
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include <QtTest/QtTest>
|
|
24 |
|
|
25 |
|
|
26 |
class VideoCollectionClient;
|
|
27 |
class VideoListDataModel;
|
|
28 |
class MediaObjectFactory;
|
|
29 |
|
|
30 |
class TestVideoListDataModel : public QObject
|
|
31 |
{
|
|
32 |
Q_OBJECT
|
|
33 |
|
|
34 |
|
|
35 |
signals:
|
|
36 |
/**
|
|
37 |
* when testing dataChanged -signal emitting and
|
|
38 |
* videoDataChangedSlot -slot
|
|
39 |
*/
|
|
40 |
void testVideoDataChangedSignal(int);
|
|
41 |
|
|
42 |
|
|
43 |
// test functions for the test framework
|
|
44 |
private slots:
|
|
45 |
|
|
46 |
/**
|
|
47 |
* called before anything else when test starts
|
|
48 |
*/
|
|
49 |
void initTestCase();
|
|
50 |
|
|
51 |
/**
|
|
52 |
* will be called before each testfunction is executed.
|
|
53 |
*
|
|
54 |
*/
|
|
55 |
void init();
|
|
56 |
|
|
57 |
/**
|
|
58 |
* will be called after every testfunction.
|
|
59 |
*
|
|
60 |
*/
|
|
61 |
void cleanup();
|
|
62 |
|
|
63 |
/**
|
|
64 |
* will be called after testing ends
|
|
65 |
*
|
|
66 |
*/
|
|
67 |
void cleanupTestCase();
|
|
68 |
|
|
69 |
/**
|
|
70 |
* Tests for the c++ constructor. Mainly to check that the parent is set
|
|
71 |
* correctly.
|
|
72 |
*/
|
|
73 |
void testConstructor();
|
|
74 |
|
|
75 |
/**
|
|
76 |
* Tests for possible failure initializations
|
|
77 |
*/
|
|
78 |
void testInitializeFails();
|
|
79 |
|
|
80 |
/**
|
|
81 |
* Tests for possible succesfully initiliazation
|
|
82 |
*
|
|
83 |
*/
|
|
84 |
void testInitialize();
|
|
85 |
|
|
86 |
/**
|
|
87 |
* Tests to make sure model returns correct row count
|
|
88 |
* in all cases
|
|
89 |
*
|
|
90 |
*/
|
|
91 |
void testRowCount();
|
|
92 |
|
|
93 |
/**
|
|
94 |
* tests if correct media id will be returned at certain positions
|
|
95 |
*
|
|
96 |
*/
|
|
97 |
void testMediaIdAtIndex();
|
35
|
98 |
|
|
99 |
/**
|
|
100 |
* verifies indexOfId
|
|
101 |
*/
|
|
102 |
void testIndexOfId();
|
34
|
103 |
|
|
104 |
/**
|
|
105 |
* tests if correct file path for media will be returned at certain positions
|
|
106 |
*
|
|
107 |
*/
|
|
108 |
void testMediaFilePathForId();
|
|
109 |
|
|
110 |
/**
|
|
111 |
* Tests to make sure model returns correct data from itemData -method
|
|
112 |
*
|
|
113 |
*/
|
|
114 |
void testItemData();
|
|
115 |
|
|
116 |
|
|
117 |
/**
|
|
118 |
* Tests to make sure model returns correct data from Data -method
|
|
119 |
*
|
|
120 |
*/
|
|
121 |
void testData();
|
|
122 |
|
|
123 |
/**
|
|
124 |
* Tests to make sure model returns correct data from ColumnCount
|
|
125 |
*
|
|
126 |
*/
|
|
127 |
void testColumnCount();
|
|
128 |
|
|
129 |
/**
|
|
130 |
* Tests to make sure model returns correct data from index
|
|
131 |
*
|
|
132 |
*/
|
|
133 |
void testIndex();
|
|
134 |
|
|
135 |
/**
|
|
136 |
* Tests to make sure model returns correct data from parent
|
|
137 |
*
|
|
138 |
*/
|
|
139 |
void testParent();
|
|
140 |
|
|
141 |
/**
|
|
142 |
* Tests to make sure detail rows are created ok in all cases
|
|
143 |
*
|
|
144 |
*/
|
|
145 |
void testPrepareDetails();
|
35
|
146 |
|
|
147 |
/**
|
|
148 |
* Tests video count string is created ok in all cases
|
|
149 |
*
|
|
150 |
*/
|
|
151 |
void testPrepareVideoCountString();
|
|
152 |
|
34
|
153 |
/**
|
|
154 |
* Tests to make sure size strings are created ok in all cases
|
|
155 |
*
|
|
156 |
*/
|
|
157 |
void testPrepareSizeString();
|
|
158 |
|
|
159 |
/**
|
|
160 |
* Tests to make sure length strings are created ok in all cases
|
|
161 |
*
|
|
162 |
*/
|
|
163 |
void testPrepareLengthString();
|
|
164 |
|
|
165 |
/**
|
|
166 |
* Tests to make removeorws behaves correctly in all posiible cases
|
|
167 |
*
|
|
168 |
*/
|
|
169 |
void testRemoveRows();
|
|
170 |
|
|
171 |
/**
|
|
172 |
* tests deleteStartingFailsSlot
|
|
173 |
*/
|
|
174 |
void testDeleteStartingFailsSlot();
|
|
175 |
|
|
176 |
/**
|
|
177 |
* verifies belongsToAlbum
|
|
178 |
*/
|
|
179 |
void testBelongsToAlbum();
|
|
180 |
|
|
181 |
/**
|
|
182 |
* verifies setAlbumInUse
|
|
183 |
*/
|
|
184 |
void testSetAlbumInUse();
|
|
185 |
|
|
186 |
/**
|
35
|
187 |
* verifies removeItemsFromAlbum;
|
|
188 |
*/
|
|
189 |
void testRemoveItemsFromAlbum();
|
|
190 |
|
|
191 |
/**
|
34
|
192 |
* tests reportAsyncStatus
|
|
193 |
*/
|
|
194 |
void testreportAsyncStatus();
|
|
195 |
|
|
196 |
|
|
197 |
private:
|
|
198 |
|
|
199 |
/**
|
|
200 |
* creates all objects used in tests,
|
|
201 |
* returns false if some creation fails.
|
|
202 |
*
|
|
203 |
* @return bool
|
|
204 |
*
|
|
205 |
*/
|
|
206 |
bool initializeTestObjects();
|
|
207 |
|
|
208 |
/**
|
|
209 |
* cleanups class data
|
|
210 |
*/
|
|
211 |
void cleanupTestObjects();
|
|
212 |
|
|
213 |
/**
|
|
214 |
* videocollection client stub -object
|
|
215 |
*/
|
|
216 |
VideoCollectionClient *mCollectionStub;
|
|
217 |
|
|
218 |
/**
|
|
219 |
* Test object for wich intialize is not called in
|
|
220 |
* init -method
|
|
221 |
*/
|
|
222 |
VideoListDataModel *mTestObjectInitialized;
|
|
223 |
|
|
224 |
/**
|
|
225 |
* Test object for wich intialize is called in
|
|
226 |
* init -method
|
|
227 |
*/
|
|
228 |
VideoListDataModel *mTestObjectNotInitialized;
|
|
229 |
|
|
230 |
/**
|
|
231 |
* CMPXMedia -object factory.
|
|
232 |
*/
|
|
233 |
MediaObjectFactory *mMediaFactory;
|
|
234 |
};
|
|
235 |
|
|
236 |
|
|
237 |
|
|
238 |
#endif // __TESTVIDEOLISTDATAMODEL_H__
|
|
239 |
|
|
240 |
// End of file
|
|
241 |
|
|
242 |
|
|
243 |
|