30
|
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: tester for methods in CVideoCollectionListener
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDES
|
|
20 |
#include <e32cmn.h>
|
|
21 |
#include <mpxmediacontainerdefs.h>
|
|
22 |
#include <mpxmediageneraldefs.h>
|
|
23 |
#include <mpxmessagecontainerdefs.h>
|
|
24 |
#include <mpxmessagegeneraldefs.h>
|
|
25 |
#include <mpxcollectioncommanddefs.h>
|
|
26 |
#include <mpxcollectionmessage.h>
|
|
27 |
#include <vcxmyvideosdefs.h>
|
|
28 |
#include <vcxmyvideosuids.h>
|
|
29 |
#include "testvideocollectionlistener.h"
|
|
30 |
#include "mediaobjectfactory.h"
|
34
|
31 |
#include "videocollectioncommon.h"
|
|
32 |
#include "stubsignalreceiver.h"
|
|
33 |
#include "stubcollection.h"
|
30
|
34 |
|
|
35 |
#include "videocollectionutils.h"
|
|
36 |
|
|
37 |
#define private public
|
|
38 |
#include "videocollectionlistener.h"
|
|
39 |
#undef private
|
|
40 |
|
|
41 |
|
|
42 |
// -----------------------------------------------------------------------------
|
|
43 |
// main
|
|
44 |
// -----------------------------------------------------------------------------
|
|
45 |
//
|
|
46 |
int main(int argc, char *argv[])
|
|
47 |
{
|
|
48 |
TestVideoCollectionListener tv;
|
|
49 |
|
34
|
50 |
int res;
|
|
51 |
if(argc > 1)
|
|
52 |
{
|
|
53 |
res = QTest::qExec(&tv, argc, argv);
|
|
54 |
}
|
|
55 |
else
|
|
56 |
{
|
|
57 |
char *pass[3];
|
|
58 |
pass[0] = argv[0];
|
|
59 |
pass[1] = "-o";
|
|
60 |
pass[2] = "c:\\data\\testvideocollectionlistener.txt";
|
|
61 |
res = QTest::qExec(&tv, 3, pass);
|
|
62 |
}
|
30
|
63 |
|
|
64 |
return res;
|
|
65 |
}
|
|
66 |
|
|
67 |
// -----------------------------------------------------------------------------
|
|
68 |
// initTestCase
|
|
69 |
// -----------------------------------------------------------------------------
|
|
70 |
//
|
|
71 |
void TestVideoCollectionListener::initTestCase()
|
|
72 |
{
|
|
73 |
mMediaFactory = new MediaObjectFactory();
|
|
74 |
}
|
|
75 |
|
|
76 |
// -----------------------------------------------------------------------------
|
|
77 |
// init
|
|
78 |
// -----------------------------------------------------------------------------
|
|
79 |
//
|
|
80 |
void TestVideoCollectionListener::init()
|
|
81 |
{
|
|
82 |
mStubCollectionClient = new VideoCollectionClient();
|
|
83 |
|
34
|
84 |
mSignalReceiver = new StubSignalReceiver();
|
|
85 |
|
|
86 |
mTestObject = new VideoCollectionListener(*mStubCollectionClient, *mSignalReceiver);
|
30
|
87 |
|
|
88 |
mStubCollection = new StubCollection(*mTestObject);
|
|
89 |
|
|
90 |
qRegisterMetaType<CMPXMediaArray*>("CMPXMediaArray*");
|
34
|
91 |
|
30
|
92 |
qRegisterMetaType<CMPXMedia*>("CMPXMedia*");
|
34
|
93 |
|
30
|
94 |
qRegisterMetaType<TMPXItemId>("TMPXItemId");
|
|
95 |
|
|
96 |
qRegisterMetaType<QList<TMPXItemId>*>("QList<TMPXItemId>*");
|
|
97 |
}
|
|
98 |
|
|
99 |
// -----------------------------------------------------------------------------
|
|
100 |
// cleanup
|
|
101 |
// -----------------------------------------------------------------------------
|
|
102 |
//
|
|
103 |
void TestVideoCollectionListener::cleanup()
|
|
104 |
{
|
|
105 |
delete mTestObject;
|
|
106 |
mTestObject = 0;
|
|
107 |
|
34
|
108 |
delete mSignalReceiver;
|
|
109 |
mSignalReceiver = 0;
|
|
110 |
|
30
|
111 |
delete mStubCollectionClient;
|
|
112 |
mStubCollectionClient = 0;
|
|
113 |
|
|
114 |
delete mStubCollection;
|
|
115 |
mStubCollection = 0;
|
|
116 |
|
|
117 |
}
|
|
118 |
|
|
119 |
// -----------------------------------------------------------------------------
|
|
120 |
// cleanupTestCase
|
|
121 |
// -----------------------------------------------------------------------------
|
|
122 |
//
|
|
123 |
void TestVideoCollectionListener::cleanupTestCase()
|
|
124 |
{
|
|
125 |
delete mMediaFactory;
|
|
126 |
}
|
|
127 |
|
|
128 |
// -----------------------------------------------------------------------------
|
|
129 |
// testHandleCollectionMediaL
|
|
130 |
// -----------------------------------------------------------------------------
|
|
131 |
//
|
|
132 |
void TestVideoCollectionListener::testHandleCollectionMediaLFunc()
|
|
133 |
{
|
|
134 |
// nothing to test here, because
|
|
135 |
// currently HandleCollectionMediaL is empty implementation required
|
|
136 |
// by the inheritance of MMPXCollectionObserver.
|
|
137 |
User::Heap().__DbgMarkStart();
|
|
138 |
|
|
139 |
CMPXMedia *media = NULL;
|
|
140 |
TRAP_IGNORE(media = CMPXMedia::NewL());
|
|
141 |
mStubCollection->callHandleCollectionMediaLFunc(*media, 0);
|
|
142 |
delete media;
|
34
|
143 |
|
|
144 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
|
145 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
30
|
146 |
|
|
147 |
int remHeap = User::Heap().__DbgMarkEnd(0);
|
|
148 |
QVERIFY(remHeap == 0);
|
|
149 |
}
|
|
150 |
|
|
151 |
// -----------------------------------------------------------------------------
|
|
152 |
// testHandleOpenLMediaFunc
|
|
153 |
// -----------------------------------------------------------------------------
|
|
154 |
//
|
|
155 |
void TestVideoCollectionListener::testHandleOpenLMediaFunc()
|
|
156 |
{
|
|
157 |
|
34
|
158 |
mStubCollectionClient->setCollectionLevel(VideoCollectionCommon::ELevelVideos);
|
30
|
159 |
CMPXMedia *media = mMediaFactory->newMedia(0);
|
|
160 |
|
|
161 |
// error != KErrNone
|
|
162 |
mStubCollection->callHandleOpenLFunc(*media, 0, true, -2 );
|
34
|
163 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
30
|
164 |
|
|
165 |
// collectionLevel != LevelVideos
|
|
166 |
mStubCollectionClient->setCollectionLevel(-100);
|
|
167 |
mStubCollection->callHandleOpenLFunc(*media, 0, true, 0 );
|
|
168 |
|
34
|
169 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
|
170 |
mStubCollectionClient->setCollectionLevel(VideoCollectionCommon::ELevelVideos);
|
30
|
171 |
|
|
172 |
// empty media (== media does not contain array)
|
|
173 |
mStubCollection->callHandleOpenLFunc(*media, 0, true, 0 );
|
34
|
174 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
30
|
175 |
|
|
176 |
// signal emitting: correct media-array passed
|
|
177 |
CMPXMediaArray *array = mMediaFactory->newMediaArray();
|
|
178 |
|
34
|
179 |
CMPXMediaArray *arrayToTest = 0;
|
36
|
180 |
|
|
181 |
// empty array, no path
|
|
182 |
mMediaFactory->putValuePtr<CMPXMediaArray>(media, KMPXMediaArrayContents, array);
|
|
183 |
mStubCollection->callHandleOpenLFunc(*media, 0, true, 0 );
|
|
184 |
arrayToTest = static_cast<CMPXMediaArray*>(mSignalReceiver->getLatestPointerAddr());
|
|
185 |
QVERIFY(arrayToTest == 0);
|
|
186 |
|
34
|
187 |
CMPXCollectionPath* collectionPath = 0;
|
|
188 |
TRAP_IGNORE(
|
36
|
189 |
collectionPath = CMPXCollectionPath::NewL();
|
|
190 |
collectionPath->AppendL( KVcxUidMyVideosMpxCollection ););
|
|
191 |
|
|
192 |
// empty array, path exists level incorrect (new video list, not category neither album level)
|
34
|
193 |
mMediaFactory->putValuePtr<CMPXCollectionPath>(media, KMPXMediaGeneralContainerPath, collectionPath);
|
|
194 |
mStubCollection->callHandleOpenLFunc(*media, 0, true, 0 );
|
|
195 |
arrayToTest = static_cast<CMPXMediaArray*>(mSignalReceiver->getLatestPointerAddr());
|
|
196 |
QVERIFY(arrayToTest != 0);
|
|
197 |
QVERIFY(arrayToTest->Count() == array->Count());
|
36
|
198 |
|
|
199 |
delete collectionPath;
|
|
200 |
// empty array, path exists level correct
|
|
201 |
collectionPath = 0;
|
|
202 |
TRAP_IGNORE(
|
|
203 |
collectionPath = CMPXCollectionPath::NewL();
|
|
204 |
collectionPath->AppendL( KVcxUidMyVideosMpxCollection );
|
|
205 |
collectionPath->AppendL( KVcxMvcCategoryIdAll););
|
34
|
206 |
|
|
207 |
// array of items from different levels, everything is reported
|
|
208 |
mStubCollectionClient->setCollectionLevel(VideoCollectionCommon::ELevelCategory);
|
|
209 |
mMediaFactory->putArrayContent(array, mMediaFactory->newMedia(1, 2));
|
|
210 |
mMediaFactory->putValuePtr<CMPXCollectionPath>(media, KMPXMediaGeneralContainerPath, collectionPath);
|
30
|
211 |
|
|
212 |
mStubCollection->callHandleOpenLFunc(*media, 0, true, 0 );
|
34
|
213 |
arrayToTest = static_cast<CMPXMediaArray*>(mSignalReceiver->getLatestPointerAddr());
|
|
214 |
QVERIFY(arrayToTest != 0);
|
|
215 |
QVERIFY(arrayToTest->Count() == array->Count());
|
|
216 |
|
30
|
217 |
|
34
|
218 |
mStubCollectionClient->setCollectionLevel(VideoCollectionCommon::ELevelVideos);
|
30
|
219 |
delete array;
|
|
220 |
array = mMediaFactory->newMediaArray();
|
|
221 |
mMediaFactory->putArrayContent(array, mMediaFactory->newMedia(1));
|
|
222 |
mMediaFactory->putArrayContent(array, mMediaFactory->newMedia(2));
|
|
223 |
mMediaFactory->putArrayContent(array, mMediaFactory->newMedia(3));
|
|
224 |
|
34
|
225 |
mMediaFactory->putValuePtr<CMPXMediaArray>(media, KMPXMediaArrayContents, array);
|
|
226 |
mMediaFactory->putValuePtr<CMPXCollectionPath>(media, KMPXMediaGeneralContainerPath, collectionPath);
|
30
|
227 |
mStubCollection->callHandleOpenLFunc(*media, 0, true, 0 );
|
|
228 |
|
34
|
229 |
arrayToTest = static_cast<CMPXMediaArray*>(mSignalReceiver->getLatestPointerAddr());
|
|
230 |
QVERIFY(arrayToTest != 0);
|
|
231 |
QVERIFY(arrayToTest->Count() == array->Count());
|
30
|
232 |
|
36
|
233 |
delete collectionPath;
|
|
234 |
collectionPath = 0;
|
|
235 |
TRAP_IGNORE(
|
|
236 |
collectionPath = CMPXCollectionPath::NewL();
|
|
237 |
collectionPath->AppendL( KVcxUidMyVideosMpxCollection );
|
|
238 |
collectionPath->AppendL( KVcxMvcMediaTypeCategory););
|
|
239 |
mMediaFactory->putValuePtr<CMPXCollectionPath>(media, KMPXMediaGeneralContainerPath, collectionPath);
|
|
240 |
|
30
|
241 |
mStubCollection->callHandleOpenLFunc(*media, 0, true, 0 );
|
|
242 |
|
34
|
243 |
arrayToTest = static_cast<CMPXMediaArray*>(mSignalReceiver->getLatestPointerAddr());
|
|
244 |
QVERIFY(arrayToTest != 0);
|
|
245 |
QVERIFY(arrayToTest->Count() == array->Count());
|
30
|
246 |
|
|
247 |
|
34
|
248 |
CMPXMediaArray *gottenArray = static_cast<CMPXMediaArray*>(mSignalReceiver->getLatestPointerAddr());
|
30
|
249 |
QVERIFY(gottenArray->Count() == 3);
|
|
250 |
|
|
251 |
TMPXItemId mediaId = TMPXItemId::InvalidId();
|
|
252 |
VideoCollectionUtils::instance().mediaValue<TMPXItemId>((*gottenArray)[0], KMPXMediaGeneralId, mediaId );
|
|
253 |
QVERIFY(mediaId.iId1 == 1);
|
|
254 |
VideoCollectionUtils::instance().mediaValue<TMPXItemId>((*gottenArray)[1], KMPXMediaGeneralId, mediaId );
|
|
255 |
QVERIFY(mediaId.iId1 == 2);
|
|
256 |
VideoCollectionUtils::instance().mediaValue<TMPXItemId>((*gottenArray)[2], KMPXMediaGeneralId, mediaId );
|
|
257 |
QVERIFY(mediaId.iId1 == 3);
|
|
258 |
|
34
|
259 |
collectionPath->Reset();
|
|
260 |
delete collectionPath;
|
|
261 |
TMPXItemId albumId(100,2);
|
|
262 |
TRAP_IGNORE(
|
|
263 |
collectionPath = CMPXCollectionPath::NewL();
|
|
264 |
collectionPath->AppendL( KVcxUidMyVideosMpxCollection );
|
|
265 |
collectionPath->AppendL( albumId ););
|
|
266 |
// level == album
|
|
267 |
mStubCollectionClient->setCollectionLevel(VideoCollectionCommon::ELevelAlbum);
|
|
268 |
mSignalReceiver->resetLatestItems();
|
|
269 |
delete array;
|
|
270 |
array = mMediaFactory->newMediaArray();
|
|
271 |
mMediaFactory->putArrayContent(array, mMediaFactory->newMedia(1));
|
|
272 |
mMediaFactory->putArrayContent(array, mMediaFactory->newMedia(2));
|
|
273 |
mMediaFactory->putArrayContent(array, mMediaFactory->newMedia(3));
|
|
274 |
// call open item to update latest item id in stub collection client
|
|
275 |
mStubCollectionClient->openItem(albumId);
|
|
276 |
mMediaFactory->putValuePtr<CMPXMediaArray>(media, KMPXMediaArrayContents, array);
|
|
277 |
mMediaFactory->putValuePtr<CMPXCollectionPath>(media, KMPXMediaGeneralContainerPath, collectionPath);
|
|
278 |
mStubCollection->callHandleOpenLFunc(*media, 0, true, 0 );
|
|
279 |
|
|
280 |
gottenArray = static_cast<CMPXMediaArray*>(mSignalReceiver->getLatestPointerAddr());
|
|
281 |
QVERIFY(gottenArray->Count() == 3);
|
|
282 |
|
|
283 |
mediaId = TMPXItemId::InvalidId();
|
|
284 |
VideoCollectionUtils::instance().mediaValue<TMPXItemId>((*gottenArray)[0], KMPXMediaGeneralId, mediaId );
|
|
285 |
QVERIFY(mediaId.iId1 == 1);
|
|
286 |
VideoCollectionUtils::instance().mediaValue<TMPXItemId>((*gottenArray)[1], KMPXMediaGeneralId, mediaId );
|
|
287 |
QVERIFY(mediaId.iId1 == 2);
|
|
288 |
VideoCollectionUtils::instance().mediaValue<TMPXItemId>((*gottenArray)[2], KMPXMediaGeneralId, mediaId );
|
|
289 |
QVERIFY(mediaId.iId1 == 3);
|
|
290 |
mediaId = mSignalReceiver->getLatestItemId();
|
|
291 |
QVERIFY(mediaId == albumId);
|
|
292 |
|
30
|
293 |
delete array;
|
|
294 |
delete media;
|
34
|
295 |
collectionPath->Reset();
|
|
296 |
delete collectionPath;
|
|
297 |
mSignalReceiver->resetLatestItems();
|
30
|
298 |
}
|
|
299 |
|
|
300 |
// -----------------------------------------------------------------------------
|
|
301 |
// testHandleOpenLPlaylistFunc
|
|
302 |
// -----------------------------------------------------------------------------
|
|
303 |
//
|
|
304 |
void TestVideoCollectionListener::testHandleOpenLPlaylistFunc()
|
|
305 |
{
|
|
306 |
|
|
307 |
// nothing to test here, because
|
|
308 |
// currently HandleCollectionMediaL is empty implementation required
|
|
309 |
// by the inheritance of MMPXCollectionObserver.
|
|
310 |
User::Heap().__DbgMarkStart();
|
|
311 |
CMPXCollectionPlaylist *plList = 0;
|
|
312 |
|
|
313 |
mStubCollection->callHandleOpenLFunc(*plList, 0);
|
|
314 |
|
34
|
315 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
|
316 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
30
|
317 |
|
|
318 |
int remHeap = User::Heap().__DbgMarkEnd(0);
|
|
319 |
QVERIFY(remHeap == 0);
|
|
320 |
}
|
|
321 |
|
|
322 |
// -----------------------------------------------------------------------------
|
36
|
323 |
// testHandleCommandCompleteInvalid
|
30
|
324 |
// -----------------------------------------------------------------------------
|
|
325 |
//
|
36
|
326 |
void TestVideoCollectionListener::testHandleCommandCompleteInvalid()
|
30
|
327 |
{
|
|
328 |
|
|
329 |
User::Heap().__DbgMarkStart();
|
|
330 |
|
|
331 |
CMPXCommand *pCommand = mMediaFactory->newMedia(0);
|
|
332 |
|
|
333 |
// error != KErrNone
|
|
334 |
mStubCollection->callHandleCommandComplete(pCommand, -2);
|
34
|
335 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
36
|
336 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
30
|
337 |
|
|
338 |
// command == NULL
|
|
339 |
mStubCollection->callHandleCommandComplete(0, 0);
|
34
|
340 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
36
|
341 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
30
|
342 |
|
|
343 |
// null command + error != KErrNone
|
|
344 |
mStubCollection->callHandleCommandComplete(0, -2);
|
34
|
345 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
36
|
346 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
34
|
347 |
|
30
|
348 |
// command without id
|
|
349 |
delete pCommand;
|
|
350 |
pCommand = mMediaFactory->newMedia();
|
|
351 |
mStubCollection->callHandleCommandComplete(pCommand, 0);
|
34
|
352 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
36
|
353 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
30
|
354 |
|
|
355 |
// no command attribute
|
|
356 |
delete pCommand;
|
|
357 |
pCommand = mMediaFactory->newMedia(0);
|
|
358 |
mStubCollection->callHandleCommandComplete(pCommand, 0);
|
34
|
359 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
36
|
360 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
30
|
361 |
|
|
362 |
// invalid KVcxMediaMyVideosCommandId
|
|
363 |
int value = (KVcxCommandMyVideosGetMediaFullDetailsByMpxId + 10);
|
|
364 |
mMediaFactory->putTValue<int>(pCommand, KVcxMediaMyVideosCommandId, value );
|
|
365 |
mStubCollection->callHandleCommandComplete(pCommand, 0);
|
34
|
366 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
36
|
367 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
30
|
368 |
|
36
|
369 |
delete pCommand;
|
|
370 |
|
|
371 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
|
372 |
|
|
373 |
int remHeap = User::Heap().__DbgMarkEnd(0);
|
|
374 |
QVERIFY(remHeap == 0);
|
|
375 |
}
|
|
376 |
|
|
377 |
// -----------------------------------------------------------------------------
|
|
378 |
// testHandleCommandCompleteGetDetails
|
|
379 |
// -----------------------------------------------------------------------------
|
|
380 |
//
|
|
381 |
void TestVideoCollectionListener::testHandleCommandCompleteGetDetails()
|
|
382 |
{
|
|
383 |
mSignalReceiver->resetLatestItems();
|
|
384 |
User::Heap().__DbgMarkStart();
|
|
385 |
CMPXCommand *pCommand = mMediaFactory->newMedia(0);
|
|
386 |
// cmd KVcxCommandMyVideosGetMediaFullDetailsByMpxId
|
30
|
387 |
// no media object in command
|
36
|
388 |
int value;
|
30
|
389 |
value = KVcxCommandMyVideosGetMediaFullDetailsByMpxId;
|
|
390 |
mMediaFactory->putTValue<int>(pCommand, KVcxMediaMyVideosCommandId, value );
|
|
391 |
mStubCollection->callHandleCommandComplete(pCommand, 0);
|
36
|
392 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
30
|
393 |
|
36
|
394 |
// correct item
|
|
395 |
delete pCommand;
|
|
396 |
pCommand = mMediaFactory->newMedia();
|
30
|
397 |
CMPXMedia *subMedia = mMediaFactory->newMedia(10);
|
36
|
398 |
mMediaFactory->putTValue<int>(pCommand, KVcxMediaMyVideosCommandId, value );
|
30
|
399 |
mMediaFactory->putValuePtr<CMPXMedia>(pCommand, KMPXCommandColAddMedia, subMedia);
|
|
400 |
mStubCollection->callHandleCommandComplete(pCommand, 0);
|
36
|
401 |
TMPXItemId itemId = TMPXItemId::InvalidId();
|
|
402 |
TMPXItemId expectedId = TMPXItemId::InvalidId();
|
|
403 |
TRAP_IGNORE(itemId = static_cast<CMPXMedia*>(mSignalReceiver->getLatestPointerAddr())->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId));
|
|
404 |
TRAP_IGNORE(expectedId = subMedia->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId));
|
|
405 |
QVERIFY(itemId == expectedId);
|
|
406 |
|
30
|
407 |
delete subMedia;
|
|
408 |
delete pCommand;
|
|
409 |
|
36
|
410 |
int remHeap = User::Heap().__DbgMarkEnd(0);
|
|
411 |
QVERIFY(remHeap == 0);
|
|
412 |
}
|
|
413 |
|
|
414 |
// -----------------------------------------------------------------------------
|
|
415 |
// testHandleCommandCompleteRemoveAlbums
|
|
416 |
// -----------------------------------------------------------------------------
|
|
417 |
//
|
|
418 |
void TestVideoCollectionListener::testHandleCommandCompleteRemoveAlbums()
|
|
419 |
{
|
|
420 |
mSignalReceiver->resetLatestItems();
|
|
421 |
|
|
422 |
User::Heap().__DbgMarkStart();
|
|
423 |
CMPXCommand *pCommand = mMediaFactory->newMedia(0);
|
|
424 |
|
|
425 |
int value = KVcxCommandMyVideosRemoveAlbums;
|
|
426 |
|
|
427 |
// no messageArray object in command
|
|
428 |
mMediaFactory->putTValue<int>(pCommand, KVcxMediaMyVideosCommandId, value );
|
|
429 |
mStubCollection->callHandleCommandComplete(pCommand, 0);
|
34
|
430 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
30
|
431 |
|
36
|
432 |
delete pCommand;
|
|
433 |
pCommand = mMediaFactory->newMedia();
|
|
434 |
|
|
435 |
// empty message array
|
|
436 |
mMediaFactory->putTValue<int>(pCommand, KVcxMediaMyVideosCommandId, value );
|
|
437 |
CMPXMediaArray *array = mMediaFactory->newMediaArray();
|
|
438 |
mMediaFactory->putValuePtr<CMPXMediaArray>(pCommand, KMPXMediaArrayContents, array);
|
|
439 |
mStubCollection->callHandleCommandComplete(pCommand, 0);
|
|
440 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
|
441 |
|
|
442 |
delete array;
|
|
443 |
delete pCommand;
|
|
444 |
pCommand = mMediaFactory->newMedia();
|
|
445 |
|
|
446 |
// some items, no failed
|
|
447 |
mMediaFactory->putTValue<int>(pCommand, KVcxMediaMyVideosCommandId, value );
|
|
448 |
CMPXMedia *media1 = mMediaFactory->newMedia(1,0);
|
|
449 |
CMPXMedia *media2 = mMediaFactory->newMedia(2,0);
|
|
450 |
CMPXMedia *media3 = mMediaFactory->newMedia(3,0);
|
|
451 |
array = mMediaFactory->newMediaArray();
|
|
452 |
TRAP_IGNORE(
|
|
453 |
array->AppendL(media1);
|
|
454 |
array->AppendL(media2);
|
|
455 |
array->AppendL(media3););
|
|
456 |
|
|
457 |
mMediaFactory->putValuePtr<CMPXMediaArray>(pCommand, KMPXMediaArrayContents, array);
|
|
458 |
mStubCollection->callHandleCommandComplete(pCommand, 0);
|
|
459 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
|
460 |
delete array;
|
|
461 |
delete pCommand;
|
|
462 |
|
|
463 |
// some items, one invalid item, no failed
|
|
464 |
array = mMediaFactory->newMediaArray();
|
|
465 |
pCommand = mMediaFactory->newMedia();
|
|
466 |
mMediaFactory->putTValue<int>(pCommand, KVcxMediaMyVideosCommandId, value );
|
|
467 |
media1 = mMediaFactory->newMedia(1,0);
|
|
468 |
media2 = mMediaFactory->newMedia(2,0);
|
|
469 |
media3 = mMediaFactory->newMedia(3,0);
|
|
470 |
CMPXMedia *media4;
|
|
471 |
TRAP_IGNORE(media4 = CMPXMedia::NewL());
|
|
472 |
TRAP_IGNORE(
|
|
473 |
array->AppendL(media1);
|
|
474 |
array->AppendL(media2);
|
|
475 |
array->AppendL(media3);
|
|
476 |
array->AppendL(media4););
|
|
477 |
|
|
478 |
mMediaFactory->putValuePtr<CMPXMediaArray>(pCommand, KMPXMediaArrayContents, array);
|
|
479 |
mStubCollection->callHandleCommandComplete(pCommand, 0);
|
|
480 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
|
481 |
|
|
482 |
delete array;
|
|
483 |
delete pCommand;
|
|
484 |
|
|
485 |
// some items, one failed
|
|
486 |
array = mMediaFactory->newMediaArray();
|
|
487 |
pCommand = mMediaFactory->newMedia();
|
|
488 |
mMediaFactory->putTValue<int>(pCommand, KVcxMediaMyVideosCommandId, value );
|
|
489 |
media1 = mMediaFactory->newMedia(1,0);
|
|
490 |
value = 0;
|
|
491 |
mMediaFactory->putTValue<int>(media1, KVcxMediaMyVideosInt32Value, value);
|
|
492 |
media2 = mMediaFactory->newMedia(2,0);
|
|
493 |
value = 1;
|
|
494 |
mMediaFactory->putTValue<int>(media2, KVcxMediaMyVideosInt32Value, value);
|
|
495 |
media3 = mMediaFactory->newMedia(3,0);
|
|
496 |
TRAP_IGNORE(
|
|
497 |
array->AppendL(media1);
|
|
498 |
array->AppendL(media2);
|
|
499 |
array->AppendL(media3););
|
|
500 |
|
|
501 |
mMediaFactory->putValuePtr<CMPXMediaArray>(pCommand, KMPXMediaArrayContents, array);
|
|
502 |
mStubCollection->callHandleCommandComplete(pCommand, 0);
|
|
503 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() != 0);
|
|
504 |
QVERIFY(mSignalReceiver->getLatestListData().count() == 1);
|
|
505 |
QVERIFY(mSignalReceiver->getLatestListData().at(0) == TMPXItemId(2,0));
|
|
506 |
mSignalReceiver->resetLatestItems();
|
|
507 |
delete array;
|
|
508 |
delete pCommand;
|
|
509 |
|
30
|
510 |
int remHeap = User::Heap().__DbgMarkEnd(0);
|
|
511 |
QVERIFY(remHeap == 0);
|
|
512 |
}
|
|
513 |
|
|
514 |
// -----------------------------------------------------------------------------
|
|
515 |
// testCollectionMessageError
|
|
516 |
// -----------------------------------------------------------------------------
|
|
517 |
//
|
|
518 |
void TestVideoCollectionListener::testCollectionMessageError()
|
|
519 |
{
|
|
520 |
|
34
|
521 |
mSignalReceiver->resetLatestItems();
|
30
|
522 |
User::Heap().__DbgMarkStart();
|
|
523 |
|
|
524 |
CMPXMessage *message = mMediaFactory->newMedia(0);
|
|
525 |
|
|
526 |
// correct message, error != KErrNone
|
|
527 |
mStubCollection->callHandleCollectionMessage(message, -1);
|
|
528 |
QVERIFY(mStubCollectionClient->getOpenStatus() == -1);
|
|
529 |
|
|
530 |
// message does not contain KMPXMessageGeneralId
|
|
531 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
532 |
QVERIFY(mStubCollectionClient->getOpenStatus() == -1);
|
|
533 |
|
|
534 |
delete message;
|
|
535 |
|
|
536 |
// empty message
|
|
537 |
mStubCollection->callHandleCollectionMessage(0, 0);
|
|
538 |
QVERIFY(mStubCollectionClient->getOpenStatus() == -1);
|
|
539 |
|
34
|
540 |
// none of above calls should not cause any callbacks
|
|
541 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
|
542 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
|
543 |
QVERIFY(mSignalReceiver->getLatestIntegerData() == -1);
|
30
|
544 |
|
|
545 |
int remHeap = User::Heap().__DbgMarkEnd(0);
|
|
546 |
QVERIFY(remHeap == 0);
|
|
547 |
}
|
|
548 |
|
|
549 |
// -----------------------------------------------------------------------------
|
|
550 |
// testCollectionMessageNotOpened
|
|
551 |
// -----------------------------------------------------------------------------
|
|
552 |
//
|
|
553 |
void TestVideoCollectionListener::testCollectionMessageNotOpened()
|
|
554 |
{
|
34
|
555 |
mSignalReceiver->resetLatestItems();
|
|
556 |
|
30
|
557 |
User::Heap().__DbgMarkStart();
|
|
558 |
mStubCollectionClient->setOpenStatus( VideoCollectionClient::ECollectionOpening);
|
|
559 |
|
|
560 |
// collection not opened, empty message
|
|
561 |
mStubCollection->callHandleCollectionMessage(0, 0);
|
|
562 |
QVERIFY(mStubCollectionClient->getOpenStatus() == VideoCollectionClient::ECollectionOpening);
|
|
563 |
|
|
564 |
// collection not opened, no msg id
|
|
565 |
CMPXMessage *message = mMediaFactory->newMedia(0);
|
|
566 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
567 |
QVERIFY(mStubCollectionClient->getOpenStatus() == VideoCollectionClient::ECollectionOpening);
|
|
568 |
|
|
569 |
TMPXMessageId msgId = 1;
|
|
570 |
mMediaFactory->putTValue<TMPXMessageId>(message, KMPXMessageGeneralId, msgId);
|
|
571 |
|
|
572 |
// collection not opened, invalid msg id
|
|
573 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
574 |
QVERIFY(mStubCollectionClient->getOpenStatus() == VideoCollectionClient::ECollectionOpening);
|
|
575 |
|
|
576 |
msgId = KMPXMessageGeneral;
|
|
577 |
mMediaFactory->putTValue<TMPXMessageId>(message, KMPXMessageGeneralId, msgId);
|
|
578 |
|
|
579 |
// collection not opened, correct msg id, missing all details
|
|
580 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
581 |
QVERIFY(mStubCollectionClient->getOpenStatus() == VideoCollectionClient::ECollectionOpening);
|
|
582 |
|
|
583 |
int value = -1;
|
|
584 |
mMediaFactory->putTValue<int>(message, KMPXMessageGeneralEvent, value);
|
|
585 |
|
|
586 |
// collection not opened, correct msg id, missing KMPXMessageGeneralData
|
|
587 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
588 |
QVERIFY(mStubCollectionClient->getOpenStatus() == VideoCollectionClient::ECollectionOpening);
|
|
589 |
|
|
590 |
delete message;
|
|
591 |
message = mMediaFactory->newMedia(0);
|
|
592 |
mMediaFactory->putTValue<TMPXMessageId>(message, KMPXMessageGeneralId, msgId);
|
|
593 |
mMediaFactory->putTValue<int>(message, KMPXMessageGeneralData, value);
|
|
594 |
|
|
595 |
// collection not opened, correct msg id, missing KMPXMessageGeneralEvent
|
|
596 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
597 |
QVERIFY(mStubCollectionClient->getOpenStatus() == VideoCollectionClient::ECollectionOpening);
|
|
598 |
|
|
599 |
mMediaFactory->putTValue<int>(message, KMPXMessageGeneralEvent, value);
|
|
600 |
|
|
601 |
// collection not opened, correct msg id, invalid detail values
|
|
602 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
603 |
QVERIFY(mStubCollectionClient->getOpenStatus() == VideoCollectionClient::ECollectionOpening);
|
|
604 |
|
|
605 |
value = EMcContainerOpened;
|
|
606 |
mMediaFactory->putTValue<int>(message, KMPXMessageGeneralData, value);
|
|
607 |
|
|
608 |
// collection not opened, correct msg id, invalid KMPXMessageGeneralEvent value
|
|
609 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
610 |
QVERIFY(mStubCollectionClient->getOpenStatus() == VideoCollectionClient::ECollectionOpening);
|
|
611 |
|
|
612 |
value = -1;
|
|
613 |
mMediaFactory->putTValue<int>(message, KMPXMessageGeneralData, value);
|
|
614 |
value = TMPXCollectionMessage::EPathChanged;
|
|
615 |
mMediaFactory->putTValue<int>(message, KMPXMessageGeneralEvent, value);
|
|
616 |
|
|
617 |
// collection not opened, correct msg id, invalid KMPXMessageGeneralData value
|
|
618 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
619 |
QVERIFY(mStubCollectionClient->getOpenStatus() == VideoCollectionClient::ECollectionOpening);
|
|
620 |
|
|
621 |
value = EMcContainerOpened;
|
|
622 |
mMediaFactory->putTValue<int>(message, KMPXMessageGeneralData, value);
|
|
623 |
mStubCollectionClient->setOpenStatus(-1);
|
|
624 |
// correct message, open status != CVideoCollectionClient::ECollectionOpening
|
|
625 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
626 |
QVERIFY(mStubCollectionClient->getOpenStatus() == -1);
|
|
627 |
|
|
628 |
mStubCollectionClient->setOpenStatus(VideoCollectionClient::ECollectionOpening);
|
|
629 |
// correct message, open status == CVideoCollectionClient::ECollectionOpening
|
|
630 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
631 |
QVERIFY(mStubCollectionClient->getOpenStatus() == VideoCollectionClient::ECollectionOpened);
|
|
632 |
|
34
|
633 |
// none of above calls should not cause any callbacks
|
|
634 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
|
635 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
|
636 |
QVERIFY(mSignalReceiver->getLatestIntegerData() == -1);
|
30
|
637 |
|
|
638 |
delete message;
|
|
639 |
|
|
640 |
int remHeap = User::Heap().__DbgMarkEnd(0);
|
|
641 |
QVERIFY(remHeap == 0);
|
|
642 |
}
|
|
643 |
|
|
644 |
// -----------------------------------------------------------------------------
|
|
645 |
// testCollectionMessageMyVidCommandId
|
|
646 |
// -----------------------------------------------------------------------------
|
|
647 |
//
|
|
648 |
void TestVideoCollectionListener::testCollectionMessageMyVidCommandId()
|
|
649 |
{
|
34
|
650 |
mSignalReceiver->resetLatestItems();
|
|
651 |
|
30
|
652 |
User::Heap().__DbgMarkStart();
|
|
653 |
|
|
654 |
mStubCollectionClient->setOpenStatus(VideoCollectionClient::ECollectionOpened);
|
|
655 |
CMPXMessage *message = mMediaFactory->newMedia(0);
|
|
656 |
TMPXMessageId msgId = KVcxCommandIdMyVideos;
|
|
657 |
mMediaFactory->putTValue<TMPXMessageId>(message, KMPXMessageGeneralId, msgId);
|
|
658 |
|
|
659 |
// KMPXMessageCollectionId != KVcxUidMyVideosMpxCollection
|
|
660 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
661 |
|
|
662 |
TUid uid = {KVcxUidMyVideosMpxCollection};
|
|
663 |
mMediaFactory->putTValue<TUid>(message, KMPXMessageCollectionId, uid);
|
|
664 |
|
|
665 |
// does not contain KVcxMediaMyVideosCommandId
|
|
666 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
667 |
|
|
668 |
int value = KVcxMessageMyVideosMessageArray + 1;
|
|
669 |
mMediaFactory->putTValue<int>( message, KVcxMediaMyVideosCommandId, value);
|
|
670 |
|
|
671 |
// non KVcxMessageMyVideosMessageArray, invalid value
|
|
672 |
// (this is tested throughoutly in testCollectionMessageNonMyVidMsgArray)
|
|
673 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
674 |
|
|
675 |
value = KVcxMessageMyVideosMessageArray;
|
|
676 |
mMediaFactory->putTValue<int>( message, KVcxMediaMyVideosCommandId, value);
|
|
677 |
CMPXMediaArray *nullArray = 0;
|
|
678 |
mMediaFactory->putValuePtr<CMPXMediaArray>(message, KMPXMediaArrayContents, nullArray);
|
|
679 |
// KVcxMessageMyVideosMessageArray, but no contents.
|
|
680 |
// (this is tested throughoutly in testCollectionMessageMyVidMsgArray)
|
|
681 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
682 |
delete message;
|
|
683 |
|
34
|
684 |
// none of above calls should not cause any callbacks
|
|
685 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
|
686 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
|
687 |
QVERIFY(mSignalReceiver->getLatestIntegerData() == -1);
|
30
|
688 |
|
|
689 |
int remHeap = User::Heap().__DbgMarkEnd(0);
|
|
690 |
QVERIFY(remHeap == 0);
|
|
691 |
|
|
692 |
}
|
|
693 |
|
|
694 |
// -----------------------------------------------------------------------------
|
|
695 |
// testHandleMyVideosMessageArray
|
|
696 |
// -----------------------------------------------------------------------------
|
|
697 |
//
|
|
698 |
void TestVideoCollectionListener::testHandleMyVideosMessageArray()
|
|
699 |
{
|
|
700 |
|
34
|
701 |
mSignalReceiver->resetLatestItems();
|
30
|
702 |
User::Heap().__DbgMarkStart();
|
|
703 |
|
|
704 |
mStubCollectionClient->setOpenStatus(VideoCollectionClient::ECollectionOpened);
|
|
705 |
CMPXMessage *message = mMediaFactory->newMedia(0);
|
|
706 |
TMPXMessageId msgId = KVcxCommandIdMyVideos;
|
|
707 |
mMediaFactory->putTValue<TMPXMessageId>(message, KMPXMessageGeneralId, msgId);
|
|
708 |
TUid uid = {KVcxUidMyVideosMpxCollection};
|
|
709 |
mMediaFactory->putTValue<TUid>(message, KMPXMessageCollectionId, uid);
|
|
710 |
int value = KVcxMessageMyVideosMessageArray;
|
|
711 |
mMediaFactory->putTValue<int>( message, KVcxMediaMyVideosCommandId, value);
|
|
712 |
|
|
713 |
// no message array
|
|
714 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
715 |
|
|
716 |
// CMPXMedia *subMedia = mMediaFactory->newMedia(0);
|
|
717 |
// mMediaFactory->putValuePtr<CMPXMedia>( message, KMPXMessageArrayContents, subMedia);
|
|
718 |
//////////////////
|
|
719 |
// NOTE
|
|
720 |
// We cannot test case where message containsCMPXMedia instead of CMPXMessageArray.
|
|
721 |
// collection fw does not support type check of pointers. Whatever pointer we have it is supported as long as
|
|
722 |
// it is saved into message with correct attribute.
|
|
723 |
//
|
|
724 |
// this kind of situation causes crash in application because we cannot validate type.
|
|
725 |
|
|
726 |
// mStubCollection->callHandleCollectionMessage(message, 0);
|
|
727 |
// delete subMedia;
|
|
728 |
CMPXMediaArray *array = mMediaFactory->newMediaArray();
|
|
729 |
mMediaFactory->putValuePtr<CMPXMediaArray>( message, KMPXMessageArrayContents, array);
|
|
730 |
|
|
731 |
// empty message array
|
|
732 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
733 |
|
|
734 |
mMediaFactory->putArrayContent(array, mMediaFactory->newMedia(1));
|
|
735 |
mMediaFactory->putArrayContent(array, mMediaFactory->newMedia(2));
|
|
736 |
mMediaFactory->putArrayContent(array, mMediaFactory->newMedia(3));
|
|
737 |
mMediaFactory->putArrayContent(array, mMediaFactory->newMedia(4));
|
|
738 |
|
|
739 |
// message array containing invalid ( == empty) items
|
|
740 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
741 |
|
|
742 |
delete array;
|
|
743 |
array = mMediaFactory->newMediaArray();
|
|
744 |
CMPXMedia *media = 0;
|
|
745 |
|
|
746 |
value = 0;
|
|
747 |
media = mMediaFactory->newMedia(1);
|
|
748 |
mMediaFactory->putTValue<int>(media, KVcxMediaMyVideosCommandId, value );
|
|
749 |
mMediaFactory->putArrayContent(array, media);
|
|
750 |
value = -1;
|
|
751 |
media = mMediaFactory->newMedia(2);
|
|
752 |
mMediaFactory->putTValue<int>(media, KVcxMediaMyVideosCommandId, value );
|
|
753 |
mMediaFactory->putArrayContent(array, media);
|
|
754 |
value = -2;
|
|
755 |
media = mMediaFactory->newMedia(3);
|
|
756 |
mMediaFactory->putTValue<int>(media, KVcxMediaMyVideosCommandId, value );
|
|
757 |
mMediaFactory->putArrayContent(array, media);
|
|
758 |
|
|
759 |
mMediaFactory->putValuePtr<CMPXMediaArray>( message, KMPXMessageArrayContents, array);
|
|
760 |
|
|
761 |
// message array containing KVcxMediaMyVideosCommandId -typed items
|
|
762 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
763 |
|
|
764 |
delete array;
|
|
765 |
array = mMediaFactory->newMediaArray();
|
|
766 |
TMPXMessageId valueid = 1;
|
|
767 |
media = mMediaFactory->newMedia(1);
|
|
768 |
mMediaFactory->putTValue<TMPXMessageId>(media, KMPXMessageGeneralId, valueid );
|
|
769 |
mMediaFactory->putArrayContent(array, media);
|
|
770 |
valueid = 2;
|
|
771 |
media = mMediaFactory->newMedia(2);
|
|
772 |
mMediaFactory->putTValue<TMPXMessageId>(media, KMPXMessageGeneralId, valueid );
|
|
773 |
mMediaFactory->putArrayContent(array, media);
|
|
774 |
valueid = 3;
|
|
775 |
media = mMediaFactory->newMedia(3);
|
|
776 |
mMediaFactory->putTValue<TMPXMessageId>(media, KMPXMessageGeneralId, valueid );
|
|
777 |
mMediaFactory->putArrayContent(array, media);
|
|
778 |
|
|
779 |
mMediaFactory->putValuePtr<CMPXMediaArray>( message, KMPXMessageArrayContents, array);
|
|
780 |
|
|
781 |
// message array containing KMPXMessageGeneralId -typed items
|
|
782 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
783 |
|
|
784 |
delete array;
|
|
785 |
array = mMediaFactory->newMediaArray();
|
|
786 |
valueid = 0;
|
|
787 |
media = mMediaFactory->newMedia(1);
|
|
788 |
mMediaFactory->putTValue<TMPXMessageId>(media, KMPXMessageGeneralId, valueid );
|
|
789 |
mMediaFactory->putArrayContent(array, media);
|
|
790 |
value = 1;
|
|
791 |
media = mMediaFactory->newMedia(2);
|
|
792 |
mMediaFactory->putTValue<TMPXMessageId>(media, KVcxMediaMyVideosCommandId, valueid );
|
|
793 |
mMediaFactory->putArrayContent(array, media);
|
|
794 |
valueid = 2;
|
|
795 |
media = mMediaFactory->newMedia(3);
|
|
796 |
mMediaFactory->putTValue<TMPXMessageId>(media, KMPXMessageGeneralId, valueid );
|
|
797 |
mMediaFactory->putArrayContent(array, media);
|
|
798 |
|
|
799 |
mMediaFactory->putValuePtr<CMPXMediaArray>( message, KMPXMessageArrayContents, array);
|
|
800 |
|
|
801 |
// message array contains both KVcxMediaMyVideosCommandId and KMPXMessageGeneralId typed items
|
|
802 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
803 |
delete array;
|
|
804 |
delete message;
|
34
|
805 |
// none of above calls should cause any callbacks
|
|
806 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
|
807 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
|
808 |
QVERIFY(mSignalReceiver->getLatestIntegerData() == -1);
|
30
|
809 |
|
|
810 |
int remHeap = User::Heap().__DbgMarkEnd(0);
|
|
811 |
QVERIFY(remHeap == 0);
|
|
812 |
}
|
|
813 |
|
|
814 |
// -----------------------------------------------------------------------------
|
|
815 |
// testHandleMyVideosMPXMessage
|
|
816 |
// -----------------------------------------------------------------------------
|
|
817 |
//
|
|
818 |
void TestVideoCollectionListener::testHandleMyVideosMPXMessage()
|
|
819 |
{
|
|
820 |
// tests all other my videos msg ids than KVcxMessageMyVideosDeleteResp.
|
|
821 |
// it is tested in testMyVideosDeleteMsgArray
|
|
822 |
|
34
|
823 |
mSignalReceiver->resetLatestItems();
|
30
|
824 |
|
|
825 |
User::Heap().__DbgMarkStart();
|
|
826 |
|
|
827 |
mStubCollectionClient->setOpenStatus(VideoCollectionClient::ECollectionOpened);
|
|
828 |
CMPXMessage *message = mMediaFactory->newMedia(0);
|
|
829 |
TMPXMessageId msgId = KVcxCommandIdMyVideos;
|
|
830 |
mMediaFactory->putTValue<TMPXMessageId>(message, KMPXMessageGeneralId, msgId);
|
|
831 |
TUid uid = {KVcxUidMyVideosMpxCollection};
|
|
832 |
mMediaFactory->putTValue<TUid>(message, KMPXMessageCollectionId, uid);
|
|
833 |
|
|
834 |
// msg ids, that should not cause any additional funtionality (verified at the end of the method)
|
|
835 |
int value = KVcxMessageMyVideosDeleteStarted;
|
|
836 |
mMediaFactory->putTValue<int>( message, KVcxMediaMyVideosCommandId, value);
|
|
837 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
838 |
|
|
839 |
value = KVcxMessageMyVideosMoveOrCopyStarted;
|
|
840 |
mMediaFactory->putTValue<int>( message, KVcxMediaMyVideosCommandId, value);
|
|
841 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
842 |
|
|
843 |
value = KVcxMessageMyVideosMoveResp;
|
|
844 |
mMediaFactory->putTValue<int>( message, KVcxMediaMyVideosCommandId, value);
|
|
845 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
846 |
|
|
847 |
value = KVcxMessageMyVideosCopyResp;
|
|
848 |
mMediaFactory->putTValue<int>( message, KVcxMediaMyVideosCommandId, value);
|
|
849 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
850 |
|
|
851 |
// Handling of KVcxMessageMyVideosItemsAppended
|
|
852 |
VideoCollectionClient::mStartOpenCurrentStateCallCount = 0;
|
|
853 |
value = KVcxMessageMyVideosItemsAppended;
|
|
854 |
mMediaFactory->putTValue<int>( message, KVcxMediaMyVideosCommandId, value);
|
|
855 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
856 |
QCOMPARE(VideoCollectionClient::mStartOpenCurrentStateCallCount, 1);
|
|
857 |
|
|
858 |
// Handling of // Handling of KVcxMessageMyVideosItemsAppended
|
|
859 |
VideoCollectionClient::mStartOpenCurrentStateCallCount = 0;
|
|
860 |
value = KVcxMessageMyVideosListComplete;
|
|
861 |
mMediaFactory->putTValue<int>( message, KVcxMediaMyVideosCommandId, value);
|
|
862 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
863 |
QCOMPARE(VideoCollectionClient::mStartOpenCurrentStateCallCount, 1);
|
|
864 |
|
|
865 |
//////
|
|
866 |
// KVcxMessageMyVideosGetMediasByMpxIdResp
|
|
867 |
value = KVcxMessageMyVideosGetMediasByMpxIdResp;
|
|
868 |
mMediaFactory->putTValue<int>( message, KVcxMediaMyVideosCommandId, value);
|
|
869 |
|
|
870 |
// no contents
|
|
871 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
34
|
872 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
|
873 |
QVERIFY(mSignalReceiver->getLatestIntegerData() == -1);
|
30
|
874 |
|
|
875 |
CMPXMediaArray *array = mMediaFactory->newMediaArray();
|
|
876 |
mMediaFactory->putValuePtr<CMPXMediaArray>( message, KMPXMediaArrayContents, array);
|
|
877 |
|
|
878 |
// empty array
|
|
879 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
34
|
880 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
|
881 |
QVERIFY(mSignalReceiver->getLatestIntegerData() == -1);
|
30
|
882 |
|
|
883 |
mMediaFactory->putArrayContent( array, mMediaFactory->newMedia(10));
|
|
884 |
mMediaFactory->putArrayContent( array, mMediaFactory->newMedia(11));
|
|
885 |
|
|
886 |
// item(s) exists
|
|
887 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
34
|
888 |
CMPXMedia *fetched = static_cast<CMPXMedia*>(mSignalReceiver->getLatestPointerAddr());
|
30
|
889 |
int fetchedId = -1;
|
|
890 |
VideoCollectionUtils::instance().mediaValue<int>(fetched, KMPXMediaGeneralId, fetchedId );
|
|
891 |
QVERIFY(fetchedId == 10);
|
34
|
892 |
|
|
893 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
|
894 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() != 0);
|
|
895 |
QVERIFY(mSignalReceiver->getLatestIntegerData() == -1);
|
|
896 |
|
|
897 |
mSignalReceiver->resetLatestItems();
|
30
|
898 |
delete array;
|
|
899 |
delete message;
|
|
900 |
int remHeap = User::Heap().__DbgMarkEnd(0);
|
|
901 |
QVERIFY(remHeap == 0);
|
|
902 |
}
|
|
903 |
|
|
904 |
// -----------------------------------------------------------------------------
|
|
905 |
// testCollectionMessageNonMyVidMsgArray
|
|
906 |
// -----------------------------------------------------------------------------
|
|
907 |
//
|
|
908 |
void TestVideoCollectionListener::testMyVideosDeleteMsgArray()
|
|
909 |
{
|
34
|
910 |
mSignalReceiver->resetLatestItems();
|
30
|
911 |
|
|
912 |
User::Heap().__DbgMarkStart();
|
|
913 |
|
|
914 |
mStubCollectionClient->setOpenStatus(VideoCollectionClient::ECollectionOpened);
|
|
915 |
CMPXMessage *message = mMediaFactory->newMedia(0);
|
|
916 |
TMPXMessageId msgId = KVcxCommandIdMyVideos;
|
|
917 |
mMediaFactory->putTValue<TMPXMessageId>(message, KMPXMessageGeneralId, msgId);
|
|
918 |
TUid uid = {KVcxUidMyVideosMpxCollection};
|
|
919 |
mMediaFactory->putTValue<TUid>(message, KMPXMessageCollectionId, uid);
|
|
920 |
|
|
921 |
int value = KVcxMessageMyVideosDeleteResp;
|
|
922 |
mMediaFactory->putTValue<int>( message, KVcxMediaMyVideosCommandId, value);
|
|
923 |
|
34
|
924 |
// null array
|
30
|
925 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
34
|
926 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
|
927 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
|
928 |
QVERIFY(mSignalReceiver->getLatestIntegerData() == -1);
|
30
|
929 |
|
|
930 |
// empty array
|
|
931 |
CMPXMediaArray *array = mMediaFactory->newMediaArray();
|
|
932 |
mMediaFactory->putValuePtr<CMPXMediaArray>( message, KMPXMediaArrayContents, array);
|
|
933 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
34
|
934 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
|
935 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
|
936 |
QVERIFY(mSignalReceiver->getLatestIntegerData() == -1);
|
30
|
937 |
|
|
938 |
// item(s) does not contain KVcxMediaMyVideosInt32Value
|
|
939 |
mMediaFactory->putArrayContent( array, mMediaFactory->newMedia(1));
|
|
940 |
mMediaFactory->putArrayContent( array, mMediaFactory->newMedia(2));
|
|
941 |
mMediaFactory->putArrayContent( array, mMediaFactory->newMedia(3));
|
|
942 |
mMediaFactory->putArrayContent( array, mMediaFactory->newMedia(4));
|
|
943 |
mMediaFactory->putValuePtr<CMPXMediaArray>( message, KMPXMessageArrayContents, array);
|
|
944 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
34
|
945 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
|
946 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() != 0);
|
|
947 |
QVERIFY(mSignalReceiver->getLatestIntegerData() == 4);
|
|
948 |
QVERIFY(mSignalReceiver->getLatestListData().count() == 0);
|
30
|
949 |
|
|
950 |
delete array;
|
|
951 |
array = mMediaFactory->newMediaArray();
|
|
952 |
mMediaFactory->putValuePtr<CMPXMediaArray>( message, KMPXMediaArrayContents, array);
|
36
|
953 |
|
|
954 |
// item(s) does contain KVcxMediaMyVideosInt32Value + one invalid item (== no id) before of that
|
|
955 |
mSignalReceiver->resetLatestItems();
|
|
956 |
CMPXMedia *media = 0;
|
|
957 |
TRAP_IGNORE(media = CMPXMedia::NewL());
|
|
958 |
mMediaFactory->putArrayContent( array, mMediaFactory->newMedia(1));
|
|
959 |
mMediaFactory->putArrayContent( array, media);
|
|
960 |
media = mMediaFactory->newMedia(3);
|
|
961 |
value = 1;
|
|
962 |
mMediaFactory->putTValue<int>( media, KVcxMediaMyVideosInt32Value, value);
|
|
963 |
mMediaFactory->putArrayContent( array, media);
|
|
964 |
mMediaFactory->putValuePtr<CMPXMediaArray>( message, KMPXMessageArrayContents, array);
|
|
965 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
966 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
|
967 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
|
968 |
QVERIFY(mSignalReceiver->getLatestIntegerData() == -1);
|
|
969 |
QVERIFY(mSignalReceiver->getLatestListData().count() == 0);
|
|
970 |
|
|
971 |
delete array;
|
|
972 |
array = mMediaFactory->newMediaArray();
|
|
973 |
mMediaFactory->putValuePtr<CMPXMediaArray>( message, KMPXMediaArrayContents, array);
|
30
|
974 |
|
|
975 |
// item(s) containing KVcxMediaMyVideosInt32Value -values, both incorrect (1) and correct (3)
|
36
|
976 |
|
30
|
977 |
mMediaFactory->putArrayContent( array, mMediaFactory->newMedia(1));
|
|
978 |
|
|
979 |
media = mMediaFactory->newMedia(2);
|
|
980 |
value = 1;
|
|
981 |
mMediaFactory->putTValue<int>( media, KVcxMediaMyVideosInt32Value, value);
|
|
982 |
mMediaFactory->putArrayContent( array, media);
|
|
983 |
|
|
984 |
media = mMediaFactory->newMedia(3);
|
|
985 |
value = 1;
|
|
986 |
mMediaFactory->putTValue<int>( media, KVcxMediaMyVideosInt32Value, value);
|
|
987 |
mMediaFactory->putArrayContent( array, media);
|
|
988 |
|
|
989 |
media = mMediaFactory->newMedia(4);
|
|
990 |
value = 0;
|
|
991 |
mMediaFactory->putTValue<int>( media, KVcxMediaMyVideosInt32Value, value);
|
|
992 |
mMediaFactory->putArrayContent( array, media);
|
|
993 |
|
|
994 |
media = mMediaFactory->newMedia(5);
|
|
995 |
value = 1;
|
|
996 |
mMediaFactory->putTValue<int>( media, KVcxMediaMyVideosInt32Value, value);
|
|
997 |
mMediaFactory->putArrayContent( array, media);
|
|
998 |
|
|
999 |
mMediaFactory->putArrayContent( array, mMediaFactory->newMedia(6));
|
|
1000 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
34
|
1001 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
|
1002 |
QVERIFY(mSignalReceiver->getLatestIntegerData() == 6);
|
|
1003 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() != 0);
|
|
1004 |
QVERIFY(mSignalReceiver->getLatestListData().count() == 3);
|
|
1005 |
QVERIFY(mSignalReceiver->getLatestListData().value(0).iId1 == 2);
|
|
1006 |
QVERIFY(mSignalReceiver->getLatestListData().value(1).iId1 == 3);
|
|
1007 |
QVERIFY(mSignalReceiver->getLatestListData().value(2).iId1 == 5);
|
|
1008 |
mSignalReceiver->resetLatestItems();
|
|
1009 |
|
30
|
1010 |
delete array;
|
|
1011 |
delete message;
|
|
1012 |
|
|
1013 |
int remHeap = User::Heap().__DbgMarkEnd(0);
|
|
1014 |
QVERIFY(remHeap == 0);
|
|
1015 |
}
|
|
1016 |
|
|
1017 |
// -----------------------------------------------------------------------------
|
|
1018 |
// testCollectionMessageNonMyVidCommandId
|
|
1019 |
// -----------------------------------------------------------------------------
|
|
1020 |
//
|
|
1021 |
void TestVideoCollectionListener::testHandleMPXMessage()
|
|
1022 |
{
|
34
|
1023 |
mSignalReceiver->resetLatestItems();
|
30
|
1024 |
|
|
1025 |
User::Heap().__DbgMarkStart();
|
|
1026 |
|
|
1027 |
mStubCollectionClient->setOpenStatus(VideoCollectionClient::ECollectionOpened);
|
|
1028 |
CMPXMessage *message = mMediaFactory->newMedia(0);
|
|
1029 |
TMPXMessageId msgId = KMPXMessageGeneral;
|
|
1030 |
mMediaFactory->putTValue<TMPXMessageId>(message, KMPXMessageGeneralId, msgId);
|
|
1031 |
TUid uid = {KVcxUidMyVideosMpxCollection};
|
|
1032 |
mMediaFactory->putTValue<TUid>(message, KMPXMessageCollectionId, uid);
|
|
1033 |
|
|
1034 |
// NOTE:
|
|
1035 |
// - we're testing only for KMPXMessageGeneral only once, because handleGeneralMPXMessage is already verified
|
|
1036 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
34
|
1037 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
36
|
1038 |
QVERIFY(mSignalReceiver->getLatestModifiedItemId() == TMPXItemId::InvalidId());
|
34
|
1039 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
30
|
1040 |
|
|
1041 |
// invalid
|
|
1042 |
msgId = KMPXMessageIdItemChanged + 1;
|
|
1043 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
34
|
1044 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
36
|
1045 |
QVERIFY(mSignalReceiver->getLatestModifiedItemId() == TMPXItemId::InvalidId());
|
34
|
1046 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
30
|
1047 |
|
|
1048 |
// KMPXMessageIdItemChanged with no content
|
34
|
1049 |
mStubCollectionClient->setCollectionLevel(VideoCollectionCommon::ELevelVideos);
|
30
|
1050 |
msgId = KMPXMessageIdItemChanged;
|
|
1051 |
mMediaFactory->putTValue<TMPXMessageId>(message, KMPXMessageGeneralId, msgId);
|
|
1052 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
34
|
1053 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
36
|
1054 |
QVERIFY(mSignalReceiver->getLatestModifiedItemId() == TMPXItemId::InvalidId());
|
34
|
1055 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
30
|
1056 |
|
|
1057 |
// KMPXMessageIdItemChanged with level != CVideoCollectionClient::ELevelVideos
|
34
|
1058 |
mStubCollectionClient->setCollectionLevel(VideoCollectionCommon::ELevelVideos - 1);
|
30
|
1059 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
34
|
1060 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
36
|
1061 |
QVERIFY(mSignalReceiver->getLatestModifiedItemId() == TMPXItemId::InvalidId());
|
34
|
1062 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
30
|
1063 |
|
34
|
1064 |
// KMPXMessageIdItemChanged with EMPXItemModified event type, no id
|
|
1065 |
mStubCollectionClient->setCollectionLevel(VideoCollectionCommon::ELevelVideos);
|
30
|
1066 |
TMPXChangeEventType eventType = EMPXItemModified;
|
34
|
1067 |
mMediaFactory->putTValue<TMPXChangeEventType>(message, KMPXMessageChangeEventType, eventType);
|
30
|
1068 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
34
|
1069 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
36
|
1070 |
QVERIFY(mSignalReceiver->getLatestModifiedItemId() == TMPXItemId::InvalidId());
|
34
|
1071 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
30
|
1072 |
|
34
|
1073 |
// KMPXMessageIdItemChanged with existing with EMPXItemModified event type, iId2 != album
|
30
|
1074 |
TMPXItemId eventId;
|
34
|
1075 |
eventId.iId1 = 1;
|
|
1076 |
eventId.iId2 = 0;
|
30
|
1077 |
mMediaFactory->putTValue<TMPXItemId>(message, KMPXMessageMediaGeneralId, eventId);
|
|
1078 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
34
|
1079 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
36
|
1080 |
QVERIFY(mSignalReceiver->getLatestModifiedItemId() == eventId);
|
34
|
1081 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
36
|
1082 |
|
34
|
1083 |
// KMPXMessageIdItemChanged with existing with EMPXItemModified event type iId2 == album, not same as opened
|
|
1084 |
eventId.iId1 = 1;
|
|
1085 |
eventId.iId2 = 2;
|
|
1086 |
mMediaFactory->putTValue<TMPXItemId>(message, KMPXMessageMediaGeneralId, eventId);
|
|
1087 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
1088 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
36
|
1089 |
QVERIFY(mSignalReceiver->getLatestModifiedItemId() == eventId);
|
|
1090 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
|
1091 |
|
|
1092 |
// KMPXMessageIdItemChanged with existing with EMPXItemModified event type iId2 == category, not same as opened
|
|
1093 |
eventId.iId1 = 1;
|
|
1094 |
eventId.iId2 = 1;
|
|
1095 |
mMediaFactory->putTValue<TMPXItemId>(message, KMPXMessageMediaGeneralId, eventId);
|
|
1096 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
|
1097 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
|
1098 |
QVERIFY(mSignalReceiver->getLatestModifiedItemId() == eventId);
|
34
|
1099 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
|
1100 |
|
|
1101 |
// KMPXMessageIdItemChanged with existing with EMPXItemModified event type iId2 == album, same as opened
|
36
|
1102 |
eventId.iId1 = 2;
|
34
|
1103 |
eventId.iId2 = 2;
|
|
1104 |
int callCount = mStubCollectionClient->mOpenItemCallCount;
|
|
1105 |
mStubCollectionClient->openItem(eventId);
|
|
1106 |
QVERIFY(mStubCollectionClient->mOpenItemCallCount == callCount + 1);
|
|
1107 |
mMediaFactory->putTValue<TMPXItemId>(message, KMPXMessageMediaGeneralId, eventId);
|
|
1108 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
36
|
1109 |
QVERIFY(mSignalReceiver->getLatestModifiedItemId() == eventId);
|
34
|
1110 |
QVERIFY(mStubCollectionClient->mOpenItemCallCount == callCount + 2);
|
|
1111 |
mSignalReceiver->resetLatestItems();
|
30
|
1112 |
|
|
1113 |
// KMPXMessageIdItemChanged with EMPXItemDeleted event type
|
|
1114 |
eventType = EMPXItemDeleted;
|
34
|
1115 |
eventId.iId1 = 10;
|
|
1116 |
eventId.iId2 = 0;
|
30
|
1117 |
mMediaFactory->putTValue<TMPXChangeEventType>(message, KMPXMessageChangeEventType, eventType);
|
34
|
1118 |
mMediaFactory->putTValue<TMPXItemId>(message, KMPXMessageMediaGeneralId, eventId);
|
30
|
1119 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
34
|
1120 |
QVERIFY(mSignalReceiver->getLatestItemId().iId1 == 10);
|
36
|
1121 |
QVERIFY(mSignalReceiver->getLatestModifiedItemId() == TMPXItemId::InvalidId());
|
34
|
1122 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
30
|
1123 |
|
34
|
1124 |
mSignalReceiver->resetLatestItems();
|
|
1125 |
|
|
1126 |
// KMPXMessageIdItemChanged with EMPXItemInserted event type with id2 differrent than videos
|
30
|
1127 |
eventType = EMPXItemInserted;
|
|
1128 |
eventId.iId2 = 2;
|
|
1129 |
mMediaFactory->putTValue<TMPXItemId>(message, KMPXMessageMediaGeneralId, eventId);
|
|
1130 |
mMediaFactory->putTValue<TMPXChangeEventType>(message, KMPXMessageChangeEventType, eventType);
|
|
1131 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
34
|
1132 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
36
|
1133 |
QVERIFY(mSignalReceiver->getLatestModifiedItemId() == TMPXItemId::InvalidId());
|
34
|
1134 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
30
|
1135 |
// mpx id should have not changed into 10
|
34
|
1136 |
QVERIFY(mStubCollectionClient->getLatestMPXId() == eventId);
|
30
|
1137 |
|
|
1138 |
// KMPXMessageIdItemChanged with EMPXItemInserted event type with correct id2 no media object
|
|
1139 |
eventId.iId2 = 1;
|
|
1140 |
mMediaFactory->putTValue<TMPXItemId>(message, KMPXMessageMediaGeneralId, eventId);
|
|
1141 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
34
|
1142 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
36
|
1143 |
QVERIFY(mSignalReceiver->getLatestModifiedItemId() == TMPXItemId::InvalidId());
|
34
|
1144 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
|
30
|
1145 |
QVERIFY(mStubCollectionClient->getLatestMPXId() == eventId);
|
|
1146 |
|
34
|
1147 |
|
30
|
1148 |
// KMPXMessageIdItemChanged with EMPXItemInserted event type with correct id2 with media object
|
|
1149 |
CMPXMedia *media = mMediaFactory->newMedia(11);
|
|
1150 |
mMediaFactory->putValuePtr<CMPXMedia>(message, KMPXCommandColAddMedia, media);
|
|
1151 |
mStubCollection->callHandleCollectionMessage(message, 0);
|
34
|
1152 |
QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
|
36
|
1153 |
QVERIFY(mSignalReceiver->getLatestModifiedItemId() == TMPXItemId::InvalidId());
|
34
|
1154 |
QVERIFY(mSignalReceiver->getLatestPointerAddr() != 0);
|
|
1155 |
CMPXMedia *gotten = static_cast<CMPXMedia*>(mSignalReceiver->getLatestPointerAddr());
|
30
|
1156 |
int fetchedId = -1;
|
|
1157 |
VideoCollectionUtils::instance().mediaValue<int>(gotten, KMPXMediaGeneralId, fetchedId );
|
|
1158 |
QVERIFY(fetchedId == 11);
|
|
1159 |
|
|
1160 |
delete media;
|
|
1161 |
delete message;
|
34
|
1162 |
mSignalReceiver->resetLatestItems();
|
30
|
1163 |
int remHeap = User::Heap().__DbgMarkEnd(0);
|
|
1164 |
QVERIFY(remHeap == 0);
|
|
1165 |
}
|
|
1166 |
|
|
1167 |
// End of file
|
|
1168 |
|
|
1169 |
|
|
1170 |
|