videoplayback/videoplaybackview/tsrc/testvideoplaybackview/src/testvideoplaybackview.cpp
changeset 63 4707a0db12f6
parent 50 21fe8338c6bf
child 66 adb51f74b890
equal deleted inserted replaced
58:d2b028fd1f7d 63:4707a0db12f6
    13 *
    13 *
    14 * Description:   tester for methods in VideoSortFilterProxyModel
    14 * Description:   tester for methods in VideoSortFilterProxyModel
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: 14 %
    18 // Version : %version: ou1cpsw#16 %
    19 
    19 
    20 #include <e32err.h>
    20 #include <e32err.h>
    21 #include <w32std.h>
    21 #include <w32std.h>
    22 
    22 
    23 #include <mmf/common/mmferrors.h>
    23 #include <mmf/common/mmferrors.h>
    28 
    28 
    29 #include <hbapplication.h>
    29 #include <hbapplication.h>
    30 #include <hbinstance.h>
    30 #include <hbinstance.h>
    31 #include <qgraphicssceneevent>
    31 #include <qgraphicssceneevent>
    32 #include <QDebug>
    32 #include <QDebug>
       
    33 
       
    34 #include "hbdialog.h"
       
    35 #include "hbmessagebox.h"
       
    36 #include "hbnotificationdialog.h"
    33 
    37 
    34 #include "videoplaybackviewfiledetails.h"
    38 #include "videoplaybackviewfiledetails.h"
    35 #include "mpxcommonvideoplaybackview.hrh"
    39 #include "mpxcommonvideoplaybackview.hrh"
    36 
    40 
    37 #include "testvideoplaybackview.h"
    41 #include "testvideoplaybackview.h"
   105 void TestVideoPlaybackView::testHandleActivateView()
   109 void TestVideoPlaybackView::testHandleActivateView()
   106 {
   110 {
   107     init();
   111     init();
   108     mVideoView->handleActivateView();
   112     mVideoView->handleActivateView();
   109 
   113 
   110     QVERIFY( mVideoView->mVideoMpxWrapper->iMediaRequested == true );
   114     QVERIFY( mVideoView->mVideoMpxWrapper->iMediaRequested );
       
   115     QVERIFY( mVideoView->mVideoMpxWrapper->iActivated );
   111     QCOMPARE( mVideoView->mVideoMpxWrapper->iFileDetails->mBitRate, 16000 );
   116     QCOMPARE( mVideoView->mVideoMpxWrapper->iFileDetails->mBitRate, 16000 );
   112     QCOMPARE( mVideoView->mVideoMpxWrapper->iFileDetails->mTitle, QString("Test Video Title") );
   117     QCOMPARE( mVideoView->mVideoMpxWrapper->iFileDetails->mTitle, QString("Test Video Title") );
   113 
   118 
   114     cleanup();
   119     cleanup();
   115 }
   120 }
   164 {
   169 {
   165     //
   170     //
   166     // construct and activate playback view
   171     // construct and activate playback view
   167     //
   172     //
   168     setup();
   173     setup();
   169 
   174     
       
   175     HbMessageBox::mMessageBConstructCount = 0;
       
   176     HbNotificationDialog::mNotifConstructCount = 0;
   170     //
   177     //
   171     // ensure that playback view is currently activated
   178     // ensure that playback view is currently activated
   172     //
   179     //
   173     QVERIFY( ! mVideoView->mTimerForClosingView->isActive() );
   180     QVERIFY( ! mVideoView->mTimerForClosingView->isActive() );
   174 
   181 
   175     //
   182     //
   176     // test showDialog() method
   183     // test showDialog() method using default arguments
   177     //
   184     //
   178     mVideoView->showDialog( "test error msg" );
   185     mVideoView->showDialog( "test error msg" );
   179 
   186     
   180     //
   187     QVERIFY(HbMessageBox::mMessageBConstructCount == 1);
   181     // connect and emit signal for handleClosePopupDialog() slot
   188     QVERIFY(HbNotificationDialog::mNotifConstructCount == 0);
   182     //
       
   183     connect( this, SIGNAL( commandSignal() ), mVideoView, SLOT( handleClosePopupDialog() ) );
       
   184     emit commandSignal();
       
   185 
       
   186     //
       
   187     // verify that playback view is properly closed
       
   188     //
       
   189     QVERIFY( mVideoView->mTimerForClosingView->isActive() );
   189     QVERIFY( mVideoView->mTimerForClosingView->isActive() );
   190 
   190 
   191     //
   191     mVideoView->handleActivateView();
   192     // disconnect signal for handleClosePopupDialog() slot
   192     HbMessageBox::mMessageBConstructCount = 0;
   193     //
   193     HbNotificationDialog::mNotifConstructCount = 0;
   194     disconnect( this, SIGNAL( commandSignal() ), mVideoView, SLOT( handleClosePopupDialog() ) );
   194     mVideoView->mTimerForClosingView->stop();
   195 
   195     
       
   196     //
       
   197     // test showDialog() method, error, no closing 
       
   198     //
       
   199     mVideoView->showDialog( "test error msg", false );
       
   200     
       
   201     QVERIFY(HbMessageBox::mMessageBConstructCount == 1);
       
   202     QVERIFY(HbNotificationDialog::mNotifConstructCount == 0);
       
   203     QVERIFY( !mVideoView->mTimerForClosingView->isActive() );
       
   204     
       
   205     HbMessageBox::mMessageBConstructCount = 0;
       
   206     HbNotificationDialog::mNotifConstructCount = 0;
       
   207     
       
   208     //
       
   209     // test showDialog() method, nofitification, closing 
       
   210     //
       
   211     mVideoView->showDialog( "test error msg", true, false );
       
   212     
       
   213     QVERIFY(HbMessageBox::mMessageBConstructCount == 0);
       
   214     QVERIFY(HbNotificationDialog::mNotifConstructCount == 1);
       
   215     QVERIFY( mVideoView->mTimerForClosingView->isActive() );
       
   216     
       
   217     mVideoView->handleActivateView();
       
   218     HbMessageBox::mMessageBConstructCount = 0;
       
   219     HbNotificationDialog::mNotifConstructCount = 0;
       
   220     mVideoView->mTimerForClosingView->stop();
       
   221     
       
   222     //
       
   223     // test showDialog() method, nofitification, not closing 
       
   224     //
       
   225     mVideoView->showDialog( "test error msg", false, false );
       
   226 
       
   227     QVERIFY(HbMessageBox::mMessageBConstructCount == 0);
       
   228     QVERIFY(HbNotificationDialog::mNotifConstructCount == 1);
       
   229     QVERIFY( !mVideoView->mTimerForClosingView->isActive() );
       
   230 
       
   231     
   196     //
   232     //
   197     // destruct playback view
   233     // destruct playback view
   198     //
   234     //
   199     cleanup();
   235     cleanup();
   200 }
   236 }
   426 {
   462 {
   427     setup();
   463     setup();
   428 
   464 
   429     mVideoView->handleDeactivateView();
   465     mVideoView->handleDeactivateView();
   430 
   466 
   431     QVERIFY( mVideoView->mVideoMpxWrapper == NULL );
   467     QVERIFY( mVideoView->mVideoMpxWrapper != NULL );
       
   468     QVERIFY( ! mVideoView->mVideoMpxWrapper->iActivated );
   432 
   469 
   433     cleanup();
   470     cleanup();
   434 }
   471 }
   435 
   472 
   436 // -------------------------------------------------------------------------------------------------
   473 // -------------------------------------------------------------------------------------------------