42 #include "videofiledetailsviewplugin.h" |
45 #include "videofiledetailsviewplugin.h" |
43 #undef private |
46 #undef private |
44 |
47 |
45 const char *TEST_VIDEO_DETAILS_VIEW = "videofiledetailsview"; |
48 const char *TEST_VIDEO_DETAILS_VIEW = "videofiledetailsview"; |
46 const char *TEST_VIDEO_DETAILS_WIDGET = "mContent"; |
49 const char *TEST_VIDEO_DETAILS_WIDGET = "mContent"; |
47 |
|
48 const char *TEST_VIDEO_DETAILS_TITLE = "mLblTitle"; |
50 const char *TEST_VIDEO_DETAILS_TITLE = "mLblTitle"; |
49 const char *TEST_VIDEO_DETAILS_ITEM = "mLblDetail"; |
51 const char *TEST_VIDEO_DETAILS_LISTWIDGET ="mDetailsList"; |
50 const char *TEST_VIDEO_DETAILS_BUTTON_PLAY = "mBtnPlay"; |
52 const char* const VIDEO_DETAILS_THUMBNAIL = "mDetailsLabel"; |
51 const char* const VIDEO_DETAILS_BUTTON_ATTACH = "mBtnAttach"; |
53 const char* const VIDEO_DETAILS_BUTTON = "mButton"; |
52 const char *TEST_VIDEO_DETAILS_MENUACTION_SHARE = "mOptionsShare"; |
|
53 const char *TEST_VIDEO_DETAILS_MENUACTION_DELETE = "mOptionsDelete"; |
54 const char *TEST_VIDEO_DETAILS_MENUACTION_DELETE = "mOptionsDelete"; |
54 |
55 |
55 const char *TEST_VIDEO_DETAILS_SCROLLAREA = "mDetailScrollArea"; |
|
56 |
|
57 // --------------------------------------------------------------------------- |
56 // --------------------------------------------------------------------------- |
58 // initTestCase |
57 // initTestCase |
59 // --------------------------------------------------------------------------- |
58 // --------------------------------------------------------------------------- |
60 // |
59 // |
61 void TestVideoFileDetails::initTestCase() |
60 void TestVideoFileDetails::initTestCase() |
62 { |
61 { |
63 mWrapper = VideoCollectionWrapper::instance(); |
|
64 mDummyModel = 0; |
62 mDummyModel = 0; |
65 mDummyModel = new VideoSortFilterProxyModel(); |
63 mDummyModel = new VideoSortFilterProxyModel(); |
66 |
64 |
67 connect(this, SIGNAL(shortDetailsReady(int)), mDummyModel, SIGNAL(shortDetailsReady(int))); |
65 connect(this, SIGNAL(shortDetailsReady(TMPXItemId)), mDummyModel, SIGNAL(shortDetailsReady(TMPXItemId))); |
68 connect(this, SIGNAL(fullDetailsReady(int)), mDummyModel, SIGNAL(fullDetailsReady(int))); |
66 connect(this, SIGNAL(fullDetailsReady(TMPXItemId)), mDummyModel, SIGNAL(fullDetailsReady(TMPXItemId))); |
69 |
67 |
70 connect(this, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), |
68 connect(this, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), |
71 mDummyModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&))); |
69 mDummyModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&))); |
72 |
70 |
73 connect(this, SIGNAL(rowsRemoved(const QModelIndex&, int, int)), |
71 connect(this, SIGNAL(rowsRemoved(const QModelIndex&, int, int)), |
74 mDummyModel, SIGNAL(rowsRemoved(const QModelIndex&, int, int))); |
72 mDummyModel, SIGNAL(rowsRemoved(const QModelIndex&, int, int))); |
75 |
73 |
76 mWrapper->setModel(mDummyModel); |
74 VideoCollectionWrapper::instance().setModel(mDummyModel); |
77 } |
75 } |
78 |
76 |
79 // --------------------------------------------------------------------------- |
77 // --------------------------------------------------------------------------- |
80 // cleanupTestCase |
78 // cleanupTestCase |
81 // --------------------------------------------------------------------------- |
79 // --------------------------------------------------------------------------- |
173 // |
165 // |
174 inline void TestVideoFileDetails::activateViewTestRound() |
166 inline void TestVideoFileDetails::activateViewTestRound() |
175 { |
167 { |
176 init(); |
168 init(); |
177 |
169 |
178 HbScrollArea* area = findWidget<HbScrollArea>(TEST_VIDEO_DETAILS_SCROLLAREA); |
|
179 |
|
180 // won't scroll without these |
|
181 area->contentWidget()->adjustSize(); |
|
182 area->setHorizontalScrollBarPolicy(HbScrollArea::ScrollBarAutoHide); |
|
183 |
|
184 area->scrollContentsTo(QPointF(0, 200)); |
|
185 |
|
186 QSignalSpy spy(area, SIGNAL(scrollPositionChanged(const QPointF))); |
|
187 |
|
188 activateView(); |
170 activateView(); |
189 |
171 |
190 QVERIFY( mPlugin->getView() != 0 ); |
172 QVERIFY( mPlugin->getView() != 0 ); |
191 QVERIFY( mPlugin->viewPlugin() == mPlugin ); |
173 QVERIFY( mPlugin->viewPlugin() == mPlugin ); |
192 QCOMPARE( mPlugin->mVideoIndex, -1 ); |
174 QCOMPARE( mPlugin->mVideoId, TMPXItemId::InvalidId() ); |
193 |
|
194 verifyOrientation(); |
|
195 |
175 |
196 // verify that actions are currently disabled. |
176 // verify that actions are currently disabled. |
197 HbPushButton* playBtn = findWidget<HbPushButton>(TEST_VIDEO_DETAILS_BUTTON_PLAY); |
177 HbStackedWidget* thumbWidget = findWidget<HbStackedWidget>(VIDEO_DETAILS_THUMBNAIL); |
198 HbAction* shareAction = findObject<HbAction>(TEST_VIDEO_DETAILS_MENUACTION_SHARE); |
178 VideoDetailsLabel* thumbLabel = (VideoDetailsLabel*)thumbWidget->widgetAt(0); |
199 HbAction* deleteAction = findObject<HbAction>(TEST_VIDEO_DETAILS_MENUACTION_DELETE); |
179 HbAction* deleteAction = findObject<HbAction>(TEST_VIDEO_DETAILS_MENUACTION_DELETE); |
200 |
180 |
201 QVERIFY( playBtn != 0 ); |
181 HbPushButton* button = findWidget<HbPushButton>(VIDEO_DETAILS_BUTTON); |
202 QVERIFY( shareAction != 0 ); |
182 |
|
183 QVERIFY( button != 0 ); |
|
184 QVERIFY( thumbLabel != 0 ); |
203 QVERIFY( deleteAction != 0 ); |
185 QVERIFY( deleteAction != 0 ); |
204 QVERIFY( playBtn->isEnabled() ); |
|
205 QVERIFY( shareAction->isEnabled() ); |
|
206 QVERIFY( deleteAction->isEnabled() ); |
186 QVERIFY( deleteAction->isEnabled() ); |
207 |
|
208 // verify that the scroll area has been scrolled to the top. |
|
209 QCOMPARE( spy.count(), 1 ); |
|
210 QPointF scrollPoint = spy.takeFirst().at(0).toPointF(); |
|
211 QCOMPARE( scrollPoint, QPointF(0, 0) ); |
|
212 |
187 |
213 QVERIFY(mPlugin->mActivated); |
188 QVERIFY(mPlugin->mActivated); |
214 // second activation should not affect |
189 // second activation should not affect |
215 activateView(); |
190 activateView(); |
216 QVERIFY(mPlugin->mActivated); |
191 QVERIFY(mPlugin->mActivated); |
217 QVERIFY( playBtn != 0 ); |
192 QVERIFY( button != 0 ); |
218 QVERIFY( shareAction != 0 ); |
193 QVERIFY( thumbLabel != 0 ); |
219 QVERIFY( deleteAction != 0 ); |
194 QVERIFY( deleteAction != 0 ); |
220 QVERIFY( playBtn->isEnabled() ); |
|
221 QVERIFY( shareAction->isEnabled() ); |
|
222 QVERIFY( deleteAction->isEnabled() ); |
195 QVERIFY( deleteAction->isEnabled() ); |
223 |
|
224 |
196 |
225 cleanup(); |
197 cleanup(); |
226 } |
198 } |
227 |
|
228 // --------------------------------------------------------------------------- |
|
229 // Verifies that correct orientation is loaded from xml |
|
230 // --------------------------------------------------------------------------- |
|
231 // |
|
232 inline void TestVideoFileDetails::verifyOrientation() |
|
233 { |
|
234 HbWidget* info = findWidget<HbWidget>(TEST_VIDEO_DETAILS_SCROLLAREA); |
|
235 |
|
236 // this verifies that we have correct orientation loaded from the xml. |
|
237 if (hbInstance->allMainWindows().at(0)->orientation() == Qt::Vertical) |
|
238 { |
|
239 QVERIFY( info->pos().x() < 300 ); |
|
240 QVERIFY( info->pos().x() > 0 ); |
|
241 } else { |
|
242 QVERIFY( info->pos().x() > 300 ); |
|
243 QVERIFY( info->pos().x() < 640 ); |
|
244 } |
|
245 } |
|
246 |
199 |
247 // --------------------------------------------------------------------------- |
200 // --------------------------------------------------------------------------- |
248 // Slot: create view |
201 // Slot: create view |
249 // --------------------------------------------------------------------------- |
202 // --------------------------------------------------------------------------- |
250 // |
203 // |
443 activateView(); |
394 activateView(); |
444 |
395 |
445 // no data |
396 // no data |
446 emit shortDetailsReady(testIndex); |
397 emit shortDetailsReady(testIndex); |
447 |
398 |
448 QCOMPARE( mPlugin->mVideoIndex, testIndex ); |
399 QCOMPARE( mPlugin->mVideoId, testIndex ); |
449 QVERIFY( mPlugin->mTitleAnim->text().isEmpty() ); |
400 QVERIFY( mPlugin->mTitleAnim->text().isEmpty() ); |
450 QCOMPARE( mPlugin->mThumbnailManager->mRequests.count(), 0 ); |
401 QCOMPARE( mPlugin->mThumbnailManager->mRequests.count(), 0 ); |
451 QVERIFY( findWidget<HbPushButton>(TEST_VIDEO_DETAILS_BUTTON_PLAY)->primitive(HbStyle::P_PushButton_background)->isVisible() == false ); |
|
452 |
402 |
453 mDummyModel->setData(Qt::DisplayRole, display); |
403 mDummyModel->setData(Qt::DisplayRole, display); |
454 mDummyModel->setData(VideoCollectionCommon::KeyFilePath, filepath); |
404 mDummyModel->setData(VideoCollectionCommon::KeyFilePath, filepath); |
455 |
405 |
456 // no tn manager |
406 // no tn manager |
457 ThumbnailManager *tmpTnManager = mPlugin->mThumbnailManager; |
407 ThumbnailManager *tmpTnManager = mPlugin->mThumbnailManager; |
458 mPlugin->mThumbnailManager = 0; |
408 mPlugin->mThumbnailManager = 0; |
459 emit shortDetailsReady(testIndex); |
409 emit shortDetailsReady(testIndex); |
460 QCOMPARE( mPlugin->mVideoIndex, testIndex ); |
410 QCOMPARE( mPlugin->mVideoId, testIndex ); |
461 QCOMPARE( mPlugin->mTitleAnim->text(), display.at(0) ); |
411 QCOMPARE( mPlugin->mTitleAnim->text(), display.at(0) ); |
462 QVERIFY( findWidget<HbPushButton>(TEST_VIDEO_DETAILS_BUTTON_PLAY)->primitive(HbStyle::P_PushButton_background)->isVisible() == false ); |
|
463 mPlugin->mThumbnailManager = tmpTnManager; |
412 mPlugin->mThumbnailManager = tmpTnManager; |
464 |
413 |
465 // data exists |
414 // data exists |
466 emit shortDetailsReady(testIndex); |
415 emit shortDetailsReady(testIndex); |
467 |
416 |
468 QCOMPARE( mDummyModel->lastIndex().row(), testIndex ); |
417 QCOMPARE( mPlugin->mVideoId, testIndex ); |
|
418 QCOMPARE( mDummyModel->lastId(), testIndex ); |
469 QCOMPARE( mPlugin->mTitleAnim->text(), display.at(0) ); |
419 QCOMPARE( mPlugin->mTitleAnim->text(), display.at(0) ); |
470 QVERIFY( ThumbnailManager::mRequests.contains(0) ); |
420 QVERIFY( ThumbnailManager::mRequests.contains(0) ); |
471 ThumbnailManager::TnRequest request = ThumbnailManager::mRequests[0]; |
421 ThumbnailManager::TnRequest request = ThumbnailManager::mRequests[0]; |
472 QCOMPARE( request.name, filepath ); |
422 QCOMPARE( request.name, filepath ); |
473 // 20 == priorityHight in this case |
423 // 20 == priorityHight in this case |
474 QCOMPARE( request.priority, 5000 ); |
424 QCOMPARE( request.priority, 5000 ); |
475 QVERIFY( findWidget<HbPushButton>(TEST_VIDEO_DETAILS_BUTTON_PLAY)->primitive(HbStyle::P_PushButton_background)->isVisible() == false ); |
|
476 |
425 |
477 |
426 |
478 mDummyModel->setData(VideoCollectionCommon::KeyMetaData, createDummyMetadata() ); |
427 mDummyModel->setData(VideoCollectionCommon::KeyMetaData, createDummyMetadata() ); |
479 emit fullDetailsReady(testIndex); |
428 emit fullDetailsReady(testIndex); |
480 |
429 |
481 emit shortDetailsReady(testIndex); |
430 emit shortDetailsReady(testIndex); |
482 QVERIFY( findWidget<HbPushButton>(TEST_VIDEO_DETAILS_BUTTON_PLAY)->primitive(HbStyle::P_PushButton_background)->isVisible() == false ); |
|
483 |
431 |
484 int detailCount = sizeof(VideoCollectionCommon::VideoDetailLabelKeys) / sizeof(int); |
432 int detailCount = sizeof(VideoCollectionCommon::VideoDetailLabelKeys) / sizeof(int); |
485 for(int i = 1; i<=detailCount; i++) { |
433 |
486 HbLabel* detail = findWidget<HbLabel>(TEST_VIDEO_DETAILS_ITEM + QString::number(i)); |
434 HbListWidget* list = findWidget<HbListWidget>(TEST_VIDEO_DETAILS_LISTWIDGET); |
487 QVERIFY( detail->text().isEmpty() ); |
|
488 } |
|
489 |
435 |
490 QVERIFY( findWidget<HbPushButton>(TEST_VIDEO_DETAILS_BUTTON_PLAY)->icon().isNull() ); |
436 QVERIFY(list); |
491 |
437 QVERIFY(list->count() == 0); |
492 cleanup(); |
438 |
|
439 cleanup(); |
493 } |
440 } |
494 |
441 |
495 // --------------------------------------------------------------------------- |
442 // --------------------------------------------------------------------------- |
496 // Slot: test for the fullDetailsReadySlot |
443 // Slot: test for the fullDetailsReadySlot |
497 // --------------------------------------------------------------------------- |
444 // --------------------------------------------------------------------------- |
498 // |
445 // |
499 void TestVideoFileDetails::testFullDetailsReadySlot() |
446 void TestVideoFileDetails::testFullDetailsReadySlot() |
500 { |
447 { |
501 const int testIndex = 6; |
448 TMPXItemId testIndex(6,0); |
502 init(); |
449 init(); |
503 activateView(); |
450 activateView(); |
504 |
451 |
505 int detailCount = sizeof(VideoCollectionCommon::VideoDetailLabelKeys) / sizeof(int); |
452 int detailCount = sizeof(VideoCollectionCommon::VideoDetailLabelKeys) / sizeof(int); |
506 for(int i = 1; i<=detailCount; i++) { |
453 |
507 HbLabel* detail = findWidget<HbLabel>(TEST_VIDEO_DETAILS_ITEM + QString::number(i)); |
454 HbListWidget* list = findWidget<HbListWidget>(TEST_VIDEO_DETAILS_LISTWIDGET); |
508 if(detail == 0) |
455 QVERIFY(list); |
509 { |
456 QVERIFY(list->count() == 0); |
510 QFAIL(QString("Found a null label at %1, check that the xml is " |
|
511 "correct, and that the resource files have been regenerated (by running abld " |
|
512 "reallyclean before build)").arg(TEST_VIDEO_DETAILS_ITEM + QString::number(i)). |
|
513 toStdString().data()); |
|
514 } |
|
515 } |
|
516 |
457 |
517 mDummyModel->setData(VideoCollectionCommon::KeyMetaData, createDummyMetadata() ); |
458 mDummyModel->setData(VideoCollectionCommon::KeyMetaData, createDummyMetadata() ); |
518 |
459 |
519 emit fullDetailsReady(testIndex); |
460 emit fullDetailsReady(testIndex); |
520 |
461 |
521 // verify that actions are currently enabled. |
462 // verify that actions are currently enabled. |
522 HbPushButton* playBtn = findWidget<HbPushButton>(TEST_VIDEO_DETAILS_BUTTON_PLAY); |
463 HbStackedWidget* thumbWidget = findWidget<HbStackedWidget>(VIDEO_DETAILS_THUMBNAIL); |
523 HbAction* shareAction = findObject<HbAction>(TEST_VIDEO_DETAILS_MENUACTION_SHARE); |
464 VideoDetailsLabel* thumbLabel = (VideoDetailsLabel*)thumbWidget->widgetAt(0); |
524 HbAction* deleteAction = findObject<HbAction>(TEST_VIDEO_DETAILS_MENUACTION_DELETE); |
465 HbAction* deleteAction = findObject<HbAction>(TEST_VIDEO_DETAILS_MENUACTION_DELETE); |
525 |
466 |
526 QVERIFY( playBtn != 0 ); |
467 QVERIFY( thumbLabel != 0 ); |
527 QVERIFY( shareAction != 0 ); |
|
528 QVERIFY( deleteAction != 0 ); |
468 QVERIFY( deleteAction != 0 ); |
529 QVERIFY( playBtn->isEnabled() ); |
|
530 QVERIFY( shareAction->isEnabled() ); |
|
531 QVERIFY( deleteAction->isEnabled() ); |
469 QVERIFY( deleteAction->isEnabled() ); |
532 |
470 |
533 for(int i = 0; i<detailCount; i++) { |
471 QVERIFY(list->count() == detailCount); |
|
472 |
|
473 for(int i = 0; i<detailCount; i++) |
|
474 { |
534 QString expected = tr(VideoCollectionCommon::VideoDetailLabels[i]).arg( |
475 QString expected = tr(VideoCollectionCommon::VideoDetailLabels[i]).arg( |
535 VideoCollectionCommon::VideoDetailLabelKeys[i]); |
476 VideoCollectionCommon::VideoDetailLabelKeys[i]); |
536 HbLabel* detail = findWidget<HbLabel>(TEST_VIDEO_DETAILS_ITEM + QString::number(i+1)); |
477 HbListWidgetItem* detail = list->item(i); |
537 QVERIFY( detail != 0 ); |
478 QVERIFY( detail != 0 ); |
538 QVERIFY( detail->text().contains(expected) ); |
479 QVERIFY( detail->text().contains(expected) ); |
539 } |
480 } |
540 |
481 |
541 // for coverity sake, retest without star-rating |
482 // for coverity sake, retest without star-rating |
542 mDummyModel->reset(); |
483 mDummyModel->reset(); |
543 mDummyModel->setData(VideoCollectionCommon::KeyMetaData, createDummyMetadata(1) ); |
484 mDummyModel->setData(VideoCollectionCommon::KeyMetaData, createDummyMetadata() ); |
544 emit fullDetailsReady(testIndex); |
485 emit fullDetailsReady(testIndex); |
|
486 |
|
487 int ii = 0; |
545 for(int i = 0; i<detailCount; i++) |
488 for(int i = 0; i<detailCount; i++) |
546 { |
489 { |
547 if(VideoCollectionCommon::VideoDetailLabelKeys[i] != VideoCollectionCommon::MetaKeyStarRating) |
490 if(VideoCollectionCommon::VideoDetailLabelKeys[i] != VideoCollectionCommon::MetaKeyStarRating) |
548 { |
491 { |
549 QString expected = tr(VideoCollectionCommon::VideoDetailLabels[i]).arg( |
492 QString expected = tr(VideoCollectionCommon::VideoDetailLabels[i]).arg( |
550 VideoCollectionCommon::VideoDetailLabelKeys[i]); |
493 VideoCollectionCommon::VideoDetailLabelKeys[i]); |
551 HbLabel* detail = findWidget<HbLabel>(TEST_VIDEO_DETAILS_ITEM + QString::number(i+1)); |
494 HbListWidgetItem* detail = list->item(ii); |
552 QVERIFY( detail != 0 ); |
495 QVERIFY( detail != 0 ); |
553 QVERIFY( detail->text().contains(expected) ); |
496 QVERIFY( detail->text().contains(expected) ); |
554 } |
497 } |
|
498 ++ii; |
555 } |
499 } |
556 |
500 |
557 cleanup(); |
501 cleanup(); |
558 } |
502 } |
559 |
503 |
560 // --------------------------------------------------------------------------- |
504 // --------------------------------------------------------------------------- |
561 // Slot: test for the testStartPlaybackSlot |
505 // Slot: test for the testStartPlaybackSlot |
562 // --------------------------------------------------------------------------- |
506 // --------------------------------------------------------------------------- |
563 // |
507 // |
564 void TestVideoFileDetails::testStartPlaybackSlot() |
508 void TestVideoFileDetails::testStartPlaybackSlot() |
565 { |
509 { |
566 const int testIndex = 6; |
510 TMPXItemId testIndex(6,0); |
567 mDummyModel->reset(); |
511 mDummyModel->reset(); |
568 init(); |
512 init(); |
569 activateView(); |
513 activateView(); |
570 |
514 |
571 // Note that if the details view has not received signal in it's |
515 // Note that if the details view has not received signal in it's |
572 // fullDetailsReadySlot, the button is disabled and should not do anything. |
516 // fullDetailsReadySlot, the button is disabled and should not do anything. |
573 |
517 |
574 HbPushButton* playBtn = findWidget<HbPushButton>(TEST_VIDEO_DETAILS_BUTTON_PLAY); |
518 HbStackedWidget* thumbWidget = findWidget<HbStackedWidget>(VIDEO_DETAILS_THUMBNAIL); |
575 QVERIFY( playBtn != 0 ); |
519 VideoDetailsLabel* thumbLabel = (VideoDetailsLabel*)thumbWidget->widgetAt(0); |
576 playBtn->click(); |
520 QVERIFY( thumbLabel != 0 ); |
577 |
521 thumbLabel->click(); |
578 QCOMPARE( mDummyModel->startPlaybackIndex(), -1 ); |
522 |
|
523 QCOMPARE( mDummyModel->startPlaybackIndex(), TMPXItemId::InvalidId() ); |
579 |
524 |
580 emit fullDetailsReady(testIndex); |
525 emit fullDetailsReady(testIndex); |
581 mPlugin->mVideoIndex = testIndex; |
526 mPlugin->mVideoId = testIndex; |
582 |
527 |
583 playBtn->click(); |
528 thumbLabel->click(); |
584 |
529 |
585 QCOMPARE( mDummyModel->startPlaybackIndex(), testIndex ); |
530 QCOMPARE( mDummyModel->startPlaybackIndex(), testIndex ); |
586 |
531 |
587 // invalid index |
532 // invalid index |
588 mPlugin->mVideoIndex = -1; |
533 mPlugin->mVideoId = TMPXItemId::InvalidId(); |
589 playBtn->click(); |
534 thumbLabel->click(); |
590 // startplayback index has not changed since previous |
535 // startplayback index has not changed since previous |
591 QCOMPARE( mDummyModel->startPlaybackIndex(), testIndex ); |
536 QCOMPARE( mDummyModel->startPlaybackIndex(), testIndex ); |
592 |
537 |
593 cleanup(); |
538 cleanup(); |
594 } |
539 } |
614 HbAction* deleteAction = findObject<HbAction>(TEST_VIDEO_DETAILS_MENUACTION_DELETE); |
559 HbAction* deleteAction = findObject<HbAction>(TEST_VIDEO_DETAILS_MENUACTION_DELETE); |
615 |
560 |
616 QVERIFY( deleteAction != 0 ); |
561 QVERIFY( deleteAction != 0 ); |
617 deleteAction->trigger(); |
562 deleteAction->trigger(); |
618 QCOMPARE( mDummyModel->dataAccessCount(), 0 ); |
563 QCOMPARE( mDummyModel->dataAccessCount(), 0 ); |
619 mPlugin->mVideoIndex = 0; |
564 mPlugin->mVideoId = (0,0); |
620 |
565 |
621 mDummyModel->setDataReturnInvalid(true); |
566 mDummyModel->setDataReturnInvalid(true); |
622 QModelIndex expected = mDummyModel->index(0, 0); |
567 QModelIndex expected = mDummyModel->index(0, 0); |
623 deleteAction->trigger(); |
568 deleteAction->trigger(); |
624 QCOMPARE( mDummyModel->dataAccessCount(), 1 ); |
569 QCOMPARE( mDummyModel->dataAccessCount(), 1 ); |
625 QVERIFY( mDummyModel->lastIndex() == expected ); |
570 QVERIFY( mDummyModel->lastIndex() == expected ); |
626 QCOMPARE( mDummyModel->deleteFileIndex(), -1 ); // verify that no file was deleted. |
571 QCOMPARE( mDummyModel->deleteFileIndex(), -1 ); // verify that no file was deleted. |
627 mDummyModel->setDataReturnInvalid(false); |
572 mDummyModel->setDataReturnInvalid(false); |
628 |
573 |
629 mPlugin->mVideoIndex = 0; |
574 mPlugin->mVideoId = (0,0); |
630 expected = mDummyModel->index(0, 0); |
575 expected = mDummyModel->index(0, 0); |
631 deleteAction->trigger(); |
576 deleteAction->trigger(); |
632 QCOMPARE( mDummyModel->dataAccessCount(), 2 ); |
577 QCOMPARE( mDummyModel->dataAccessCount(), 2 ); |
633 QVERIFY( mDummyModel->lastIndex() == expected ); |
578 QVERIFY( mDummyModel->lastIndex() == expected ); |
634 QCOMPARE( mDummyModel->deleteFileIndex(), -1 ); // verify that no file was deleted. |
579 QCOMPARE( mDummyModel->deleteFileIndex(), -1 ); // verify that no file was deleted. |