videocollection/videofiledetailsview/tsrc/testplugin/src/testvideofiledetails.cpp
changeset 37 4eb2df7f7cbe
parent 36 8aed59de29f9
child 38 ff53afa8ad05
equal deleted inserted replaced
36:8aed59de29f9 37:4eb2df7f7cbe
    45 // trick to get access to protected/private members.
    45 // trick to get access to protected/private members.
    46 #define private public
    46 #define private public
    47 #include "videofiledetailsviewplugin.h"
    47 #include "videofiledetailsviewplugin.h"
    48 #undef private
    48 #undef private
    49 
    49 
       
    50 const char *TEST_VIDEO_DETAILS_GFX_DEFAULT = ":/gfx/pri_large_video.svg";
    50 const char *TEST_VIDEO_DETAILS_VIEW = "videofiledetailsview";
    51 const char *TEST_VIDEO_DETAILS_VIEW = "videofiledetailsview";
    51 const char *TEST_VIDEO_DETAILS_WIDGET = "mContent";
    52 const char *TEST_VIDEO_DETAILS_WIDGET = "mContent";
    52 const char *TEST_VIDEO_DETAILS_TITLE = "mLblTitle";
    53 const char *TEST_VIDEO_DETAILS_TITLE = "mLblTitle";
    53 const char *TEST_VIDEO_DETAILS_LISTWIDGET ="mDetailsList";
    54 const char *TEST_VIDEO_DETAILS_LISTWIDGET ="mDetailsList";
    54 const char* const VIDEO_DETAILS_THUMBNAIL = "mDetailsLabel";
    55 const char* const VIDEO_DETAILS_THUMBNAIL = "mDetailsLabel";
   224     VideoCollectionWrapper::instance().setModel(0);
   225     VideoCollectionWrapper::instance().setModel(0);
   225     init();
   226     init();
   226     QVERIFY( mPlugin->mModel == 0 );
   227     QVERIFY( mPlugin->mModel == 0 );
   227     QVERIFY( mPlugin->mIsService == false);
   228     QVERIFY( mPlugin->mIsService == false);
   228     QVERIFY( mPlugin->mVideoServices == 0);
   229     QVERIFY( mPlugin->mVideoServices == 0);
   229     // TODO if the plugin is changed to throw exception in case of null model,
       
   230     //      then it needs to be added here.
       
   231     
   230     
   232     // restoring the proper model.
   231     // restoring the proper model.
   233     VideoCollectionWrapper::instance().setModel(mDummyModel);
   232     VideoCollectionWrapper::instance().setModel(mDummyModel);
   234     cleanup();
   233     cleanup();
   235 }
   234 }
   384 void TestVideoFileDetails::testShortDetailsReadySlot()
   383 void TestVideoFileDetails::testShortDetailsReadySlot()
   385 {
   384 {
   386     TMPXItemId testIndex(5,0);
   385     TMPXItemId testIndex(5,0);
   387     QString title("title");
   386     QString title("title");
   388     QString filepath("filepath");
   387     QString filepath("filepath");
   389     
       
   390     // TODO need to add the default thumbnail checking.
       
   391     
   388     
   392     init();
   389     init();
   393     activateView();
   390     activateView();
   394     
   391     
   395      // no data 
   392      // no data 
   407     mPlugin->mThumbnailManager = 0;
   404     mPlugin->mThumbnailManager = 0;
   408     emit shortDetailsReady(testIndex);
   405     emit shortDetailsReady(testIndex);
   409     QCOMPARE( mPlugin->mVideoId, testIndex );
   406     QCOMPARE( mPlugin->mVideoId, testIndex );
   410     QCOMPARE( mPlugin->mTitleAnim->text(), title );
   407     QCOMPARE( mPlugin->mTitleAnim->text(), title );
   411     mPlugin->mThumbnailManager = tmpTnManager;
   408     mPlugin->mThumbnailManager = tmpTnManager;
   412 
   409     
       
   410     // thumbnail fetching fails
       
   411     tmpTnManager->mGetThumbFails = true;
       
   412     emit shortDetailsReady(testIndex);
       
   413     QCOMPARE( mPlugin->mVideoId, testIndex );
       
   414     QCOMPARE( mPlugin->mTitleAnim->text(), title );
       
   415     QCOMPARE( mPlugin->mThumbLabel->icon().iconName(), QString(TEST_VIDEO_DETAILS_GFX_DEFAULT) );
       
   416     tmpTnManager->mGetThumbFails = false;
       
   417     
   413     // data exists
   418     // data exists
   414     emit shortDetailsReady(testIndex);
   419     emit shortDetailsReady(testIndex);
   415     
   420     
   416     QCOMPARE( mPlugin->mVideoId, testIndex );
   421     QCOMPARE( mPlugin->mVideoId, testIndex );
   417     QCOMPARE( mDummyModel->lastId(), testIndex );
   422     QCOMPARE( mDummyModel->lastId(), testIndex );
   541 // Slot: test for the sendVideoSlot
   546 // Slot: test for the sendVideoSlot
   542 // ---------------------------------------------------------------------------
   547 // ---------------------------------------------------------------------------
   543 //
   548 //
   544 void TestVideoFileDetails::testSendVideoSlot()
   549 void TestVideoFileDetails::testSendVideoSlot()
   545 {
   550 {
   546     QFAIL("Feature not yet implemented!");
   551 //    QFAIL("Feature not yet implemented!");
   547     
   552     
   548     mDummyModel->reset();
   553     mDummyModel->reset();
   549     init();
   554     init();
   550     mPlugin->activateView();
   555     mPlugin->activateView();
   551     
   556