videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/src/testmpxvideoplaybacktoolbar.cpp
changeset 44 518105d52e45
parent 42 17f382c040b1
child 49 824471cb468a
equal deleted inserted replaced
42:17f382c040b1 44:518105d52e45
     1 /**
       
     2 * Copyright (c) 2010 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 TestMPXVideoPlaybackToolBar
       
    15 * 
       
    16 */
       
    17 
       
    18 // Version : %version:  4 %
       
    19 
       
    20 
       
    21 #include <qdebug>
       
    22 #include <hbmainwindow.h>
       
    23 #include <hbapplication.h>
       
    24 
       
    25 #include "hbtoolbar.h"
       
    26 #include "hbtoolbutton.h"
       
    27 #include "testmpxvideoplaybacktoolbar.h"
       
    28 #include "mpxvideoplaybackviewfiledetails.h"
       
    29 #include "mpxvideoplaybackcontrolscontroller.h"
       
    30 #include "mpxvideoplaybackdocumentloader.h"
       
    31 
       
    32 #define private public
       
    33 #include "mpxvideoplaybacktoolbar.h"
       
    34 #undef private
       
    35 
       
    36 // -------------------------------------------------------------------------------------------------
       
    37 // main
       
    38 // -------------------------------------------------------------------------------------------------
       
    39 //
       
    40 int main(int argc, char *argv[])
       
    41 {
       
    42     MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::Main()"));
       
    43 
       
    44     HbApplication app(argc, argv);
       
    45     HbMainWindow window;
       
    46 
       
    47     TestMPXVideoPlaybackToolBar tv;
       
    48 
       
    49     char *pass[3];
       
    50     pass[0] = argv[0];
       
    51     pass[1] = "-o";
       
    52     pass[2] = "c:\\data\\testmpxvideoplaybacktoolbar.txt";
       
    53     
       
    54     int res = QTest::qExec(&tv, 3, pass);
       
    55     
       
    56     return res;
       
    57 }
       
    58 
       
    59 // -------------------------------------------------------------------------------------------------
       
    60 // init
       
    61 // -------------------------------------------------------------------------------------------------
       
    62 //
       
    63 void TestMPXVideoPlaybackToolBar::init( bool attachOperation )
       
    64 {
       
    65     MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::init()"));
       
    66 
       
    67     mController = new QMPXVideoPlaybackControlsController( attachOperation );   
       
    68     mVideoToolBar = new QMPXVideoPlaybackToolBar( mController );
       
    69 
       
    70     mVideoToolBar->setVisible( true );
       
    71 
       
    72     connect( this, SIGNAL( commandSignal() ), mVideoToolBar, SLOT( retrieveButtons() ) );
       
    73     emit commandSignal();
       
    74     disconnect( this, SIGNAL( commandSignal() ), mVideoToolBar, SLOT( retrieveButtons() ) );
       
    75 }
       
    76 
       
    77 // -------------------------------------------------------------------------------------------------
       
    78 // cleanup
       
    79 // -------------------------------------------------------------------------------------------------
       
    80 //
       
    81 void TestMPXVideoPlaybackToolBar::cleanup()
       
    82 {
       
    83     MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::cleanup()"));
       
    84 
       
    85     if ( mController )
       
    86     {
       
    87         delete mController;
       
    88         mController = NULL;
       
    89     }
       
    90 
       
    91     if ( mVideoToolBar )
       
    92     {
       
    93         delete mVideoToolBar;
       
    94         mVideoToolBar = NULL;
       
    95     }
       
    96 }
       
    97 
       
    98 // -------------------------------------------------------------------------------------------------
       
    99 // testPlay
       
   100 // -------------------------------------------------------------------------------------------------
       
   101 //
       
   102 void TestMPXVideoPlaybackToolBar::testPlay()
       
   103 {
       
   104     MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testPlay()"));
       
   105 
       
   106     init();
       
   107 
       
   108     mVideoToolBar->mButtons[EMPX3rdButton]->release();
       
   109 
       
   110     QVERIFY( mController->mTimerAction == EMPXTimerReset );
       
   111     QVERIFY( mController->mCommand == EMPXPbvCmdPlayPause );
       
   112 
       
   113     cleanup();
       
   114 }
       
   115 
       
   116 // -------------------------------------------------------------------------------------------------
       
   117 // testLongTapOnFF
       
   118 // -------------------------------------------------------------------------------------------------
       
   119 //
       
   120 void TestMPXVideoPlaybackToolBar::testLongTapOnFF()
       
   121 {
       
   122     MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testLongTapOnFF()"));
       
   123 
       
   124     init();
       
   125 
       
   126     //
       
   127     // Start seeking
       
   128     //
       
   129     mVideoToolBar->mButtons[EMPX4thButton]->press();
       
   130     QVERIFY( mController->mTimerAction == EMPXTimerCancel );
       
   131 
       
   132     connect( this, SIGNAL( commandSignal() ), mVideoToolBar, SLOT( ffPressing() ) );
       
   133     emit commandSignal();
       
   134     disconnect( this, SIGNAL( commandSignal() ), mVideoToolBar, SLOT( ffPressing() ) );
       
   135 
       
   136     QVERIFY( mVideoToolBar->mSeekingState == EMPXFastForwarding );
       
   137     QVERIFY( mController->mCommand == EMPXPbvCmdSeekForward );
       
   138 
       
   139     //
       
   140     // End seeking
       
   141     //
       
   142     mVideoToolBar->mButtons[EMPX4thButton]->release();
       
   143 
       
   144     QVERIFY( mVideoToolBar->mSeekingState == EMPXNotSeeking );
       
   145     QVERIFY( mController->mTimerAction == EMPXTimerReset );
       
   146     QVERIFY( mController->mCommand == EMPXPbvCmdEndSeek );
       
   147 
       
   148     cleanup();
       
   149 }
       
   150 
       
   151 // -------------------------------------------------------------------------------------------------
       
   152 // testLongTapOnRW
       
   153 // -------------------------------------------------------------------------------------------------
       
   154 //
       
   155 void TestMPXVideoPlaybackToolBar::testLongTapOnRW()
       
   156 {
       
   157     MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testLongTapOnRW()"));
       
   158 
       
   159     init();
       
   160 
       
   161     //
       
   162     // Start seeking
       
   163     //
       
   164     mVideoToolBar->mButtons[EMPX2ndButton]->press();
       
   165     QVERIFY( mController->mTimerAction == EMPXTimerCancel );
       
   166 
       
   167     connect( this, SIGNAL( commandSignal() ), mVideoToolBar, SLOT( rwPressing() ) );
       
   168     emit commandSignal();
       
   169     disconnect( this, SIGNAL( commandSignal() ), mVideoToolBar, SLOT( rwPressing() ) );
       
   170 
       
   171     QVERIFY( mVideoToolBar->mSeekingState == EMPXRewinding );
       
   172     QVERIFY( mController->mCommand == EMPXPbvCmdSeekBackward );
       
   173 
       
   174     //
       
   175     // End seeking
       
   176     //
       
   177     mVideoToolBar->mButtons[EMPX2ndButton]->release();
       
   178 
       
   179     QVERIFY( mVideoToolBar->mSeekingState == EMPXNotSeeking );
       
   180     QVERIFY( mController->mTimerAction == EMPXTimerReset );
       
   181     QVERIFY( mController->mCommand == EMPXPbvCmdEndSeek );
       
   182 
       
   183     cleanup();
       
   184 }
       
   185 
       
   186 // -------------------------------------------------------------------------------------------------
       
   187 // testShortTapOnFF
       
   188 // -------------------------------------------------------------------------------------------------
       
   189 //
       
   190 void TestMPXVideoPlaybackToolBar::testShortTapOnFF()
       
   191 {
       
   192     MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testShortTapOnFF()"));
       
   193 
       
   194     init();
       
   195 
       
   196     //
       
   197     // If mPostion + KMPXFastForward < mDuration
       
   198     //
       
   199     mVideoToolBar->mPosition = 30;
       
   200     mVideoToolBar->mDuration = 70;
       
   201     mVideoToolBar->mButtons[EMPX4thButton]->release();
       
   202 
       
   203     QVERIFY( mController->mTimerAction == EMPXTimerReset );
       
   204     QVERIFY( mController->mCommand == EMPXPbvCmdSetPosition );
       
   205     QVERIFY( mController->mCommandValue == mVideoToolBar->mPosition + KMPXFastForward );
       
   206 
       
   207     //
       
   208     // If mPostion + KMPXFastForward < mDuration
       
   209     //
       
   210     mVideoToolBar->mDuration = 50;
       
   211     mController->mCommand = EMPXPbvCmdPlay;
       
   212 
       
   213     mVideoToolBar->mButtons[EMPX4thButton]->release();
       
   214     QVERIFY( mController->mTimerAction == EMPXTimerReset );
       
   215     QVERIFY( mController->mCommand == EMPXPbvCmdPlay );
       
   216 
       
   217     cleanup();
       
   218 }
       
   219 
       
   220 // -------------------------------------------------------------------------------------------------
       
   221 // testShortTapOnRW
       
   222 // -------------------------------------------------------------------------------------------------
       
   223 //
       
   224 void TestMPXVideoPlaybackToolBar::testShortTapOnRW()
       
   225 {
       
   226     MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testShortTapOnRW()"));
       
   227 
       
   228     init();
       
   229 
       
   230     //
       
   231     // If mPostion + KMPXRewind > 0
       
   232     //
       
   233     mVideoToolBar->mPosition = 30;
       
   234     mVideoToolBar->mButtons[EMPX2ndButton]->release();
       
   235 
       
   236     QVERIFY( mController->mTimerAction == EMPXTimerReset );
       
   237     QVERIFY( mController->mCommand == EMPXPbvCmdSetPosition );
       
   238     QVERIFY( mController->mCommandValue == mVideoToolBar->mPosition + KMPXRewind );
       
   239 
       
   240     //
       
   241     // If mPostion + KMPXRewind < 0
       
   242     //
       
   243     mVideoToolBar->mPosition = 4;
       
   244     mVideoToolBar->mButtons[EMPX2ndButton]->release();
       
   245 
       
   246     QVERIFY( mController->mTimerAction == EMPXTimerReset );
       
   247     QVERIFY( mController->mCommand == EMPXPbvCmdSetPosition );
       
   248     QVERIFY( mController->mCommandValue == 0 );
       
   249 
       
   250     cleanup();
       
   251 }
       
   252 
       
   253 // -------------------------------------------------------------------------------------------------
       
   254 // testPause
       
   255 // -------------------------------------------------------------------------------------------------
       
   256 //
       
   257 void TestMPXVideoPlaybackToolBar::testPause()
       
   258 {
       
   259     MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testPause()"));
       
   260 
       
   261     init();
       
   262 
       
   263     mVideoToolBar->mButtons[EMPX3rdButton]->release();
       
   264 
       
   265     QVERIFY( mController->mTimerAction == EMPXTimerReset );
       
   266     QVERIFY( mController->mCommand == EMPXPbvCmdPlayPause );
       
   267 
       
   268     cleanup();
       
   269 }
       
   270 
       
   271 // -------------------------------------------------------------------------------------------------
       
   272 // testChangeAspectRatio
       
   273 // -------------------------------------------------------------------------------------------------
       
   274 //
       
   275 void TestMPXVideoPlaybackToolBar::testChangeAspectRatio()
       
   276 {
       
   277     MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testChangeAspectRatio()"));
       
   278 
       
   279     init();
       
   280 
       
   281     //
       
   282     // Test natural
       
   283     //
       
   284     mVideoToolBar->mAspectRatio = EMMFZoom;
       
   285     mVideoToolBar->mButtons[EMPX1stButton]->release();
       
   286 
       
   287     QVERIFY( mController->mTimerAction == EMPXTimerReset );
       
   288     QVERIFY( mController->mCommand == EMPXPbvCmdNaturalAspectRatio );
       
   289 
       
   290     //
       
   291     // Test stretch
       
   292     //
       
   293     mVideoToolBar->mAspectRatio = EMMFStretch;
       
   294     mVideoToolBar->mButtons[EMPX1stButton]->release();
       
   295 
       
   296     QVERIFY( mController->mTimerAction == EMPXTimerReset );
       
   297     QVERIFY( mController->mCommand == EMPXPbvCmdZoomAspectRatio );
       
   298 
       
   299     //
       
   300     // Test stretch
       
   301     //
       
   302     mVideoToolBar->mAspectRatio = EMMFNatural;
       
   303     mVideoToolBar->mButtons[EMPX1stButton]->release();
       
   304 
       
   305     QVERIFY( mController->mTimerAction == EMPXTimerReset );
       
   306     QVERIFY( mController->mCommand == EMPXPbvCmdStretchAspectRatio );
       
   307 
       
   308     cleanup();
       
   309 }
       
   310 
       
   311 // -------------------------------------------------------------------------------------------------
       
   312 // testUpdateState
       
   313 // -------------------------------------------------------------------------------------------------
       
   314 //
       
   315 void TestMPXVideoPlaybackToolBar::testUpdateState()
       
   316 {
       
   317     MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testUpdateState()"));
       
   318 
       
   319     init();
       
   320 
       
   321     //
       
   322     // Playing
       
   323     //
       
   324     TMPXPlaybackState state = EPbStatePlaying;
       
   325     mVideoToolBar->updateState( state );
       
   326 
       
   327     QVERIFY( mVideoToolBar->mToolBar->mEnabled == true );
       
   328 
       
   329     //
       
   330     // Paused
       
   331     //
       
   332     state = EPbStatePaused;
       
   333     mVideoToolBar->updateState( state );
       
   334 
       
   335     QVERIFY( mVideoToolBar->mToolBar->mEnabled == true );
       
   336 
       
   337     //
       
   338     // Not initialized
       
   339     //
       
   340     state = EPbStateNotInitialised;
       
   341     mVideoToolBar->updateState( state );
       
   342 
       
   343     QVERIFY( mVideoToolBar->mToolBar->mEnabled == false );
       
   344 
       
   345     cleanup();
       
   346 }
       
   347 
       
   348 // -------------------------------------------------------------------------------------------------
       
   349 // testAspectRatioChanged
       
   350 // -------------------------------------------------------------------------------------------------
       
   351 //
       
   352 void TestMPXVideoPlaybackToolBar::testAspectRatioChanged()
       
   353 {
       
   354     MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testAspectRatioChanged()"));
       
   355 
       
   356     init();
       
   357 
       
   358     //
       
   359     // Natural
       
   360     //
       
   361     int aspectRatio = EMMFNatural;
       
   362     mVideoToolBar->aspectRatioChanged( aspectRatio );
       
   363     QVERIFY( mVideoToolBar->mAspectRatio == EMMFNatural );
       
   364 
       
   365     //
       
   366     // Stretch
       
   367     //
       
   368     aspectRatio = EMMFStretch;
       
   369     mVideoToolBar->aspectRatioChanged( aspectRatio );
       
   370     QVERIFY( mVideoToolBar->mAspectRatio == EMMFStretch );
       
   371 
       
   372     //
       
   373     // Zoom
       
   374     //
       
   375     aspectRatio = EMMFZoom;
       
   376     mVideoToolBar->aspectRatioChanged( aspectRatio );
       
   377     QVERIFY( mVideoToolBar->mAspectRatio == EMMFZoom );
       
   378 
       
   379     cleanup();
       
   380 }
       
   381 
       
   382 // -------------------------------------------------------------------------------------------------
       
   383 // testHandleButtonPressed
       
   384 // -------------------------------------------------------------------------------------------------
       
   385 //
       
   386 void TestMPXVideoPlaybackToolBar::testHandleButtonPressed()
       
   387 {
       
   388     MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testHandleButtonPressed()"));
       
   389 
       
   390     init();
       
   391 
       
   392     mVideoToolBar->mButtons[EMPX1stButton]->press();
       
   393 
       
   394     QVERIFY( mController->mTimerAction == EMPXTimerCancel );
       
   395 
       
   396     cleanup();
       
   397 }
       
   398 
       
   399 // -------------------------------------------------------------------------------------------------
       
   400 // testUpdateWithFileDetails
       
   401 // -------------------------------------------------------------------------------------------------
       
   402 //
       
   403 void TestMPXVideoPlaybackToolBar::testUpdateWithFileDetails()
       
   404 {
       
   405     MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testUpdateWithFileDetails()"));
       
   406 
       
   407     //
       
   408     // 'non-attach' mode
       
   409     //
       
   410     init();
       
   411 
       
   412     QMPXVideoPlaybackViewFileDetails *details = mController->fileDetails();
       
   413 
       
   414     //
       
   415     // video clip, view mode is full-screen
       
   416     //
       
   417     details->mVideoEnabled = true;
       
   418     details->mVideoHeight = 1;
       
   419     details->mVideoWidth = 1;
       
   420     details->mTvOutConnected = false;
       
   421     details->mSeekable = true;
       
   422     details->mPausableStream = true;
       
   423     mController->mViewMode = EFullScreenView;
       
   424 
       
   425     mVideoToolBar->updateWithFileDetails( details );
       
   426 
       
   427     QVERIFY( mVideoToolBar->mButtons[EMPX1stButton]->isEnabled() == true );
       
   428     QVERIFY( mVideoToolBar->mButtons[EMPX2ndButton]->isEnabled() == true );
       
   429     QVERIFY( mVideoToolBar->mButtons[EMPX3rdButton]->isEnabled() == true );
       
   430     QVERIFY( mVideoToolBar->mButtons[EMPX4thButton]->isEnabled() == true );
       
   431     QVERIFY( mVideoToolBar->mButtons[EMPX5thButton]->isEnabled() == true );
       
   432 
       
   433     //
       
   434     // video clip has same aspect ratio as display window
       
   435     //
       
   436     details->mVideoEnabled = true;
       
   437     details->mVideoHeight = 360;
       
   438     details->mVideoWidth = 640;
       
   439     details->mTvOutConnected = false;
       
   440     mController->mViewMode = EFullScreenView;
       
   441 
       
   442     mVideoToolBar->updateWithFileDetails( details );
       
   443 
       
   444     QVERIFY( mVideoToolBar->mButtons[EMPX1stButton]->isEnabled() == false );
       
   445     QVERIFY( mVideoToolBar->mButtons[EMPX2ndButton]->isEnabled() == true );
       
   446     QVERIFY( mVideoToolBar->mButtons[EMPX3rdButton]->isEnabled() == true );
       
   447     QVERIFY( mVideoToolBar->mButtons[EMPX4thButton]->isEnabled() == true );
       
   448     QVERIFY( mVideoToolBar->mButtons[EMPX5thButton]->isEnabled() == true );
       
   449 
       
   450     //
       
   451     // audio-only clip, view mode is full-screen
       
   452     //
       
   453     details->mVideoEnabled = false;
       
   454     details->mVideoHeight = 0;
       
   455     details->mVideoWidth = 1;
       
   456     details->mTvOutConnected = true;
       
   457     details->mSeekable = false;
       
   458     details->mPausableStream = true;
       
   459 
       
   460     mVideoToolBar->updateWithFileDetails( details );
       
   461 
       
   462     QVERIFY( mVideoToolBar->mButtons[EMPX1stButton]->isEnabled() == false );
       
   463     QVERIFY( mVideoToolBar->mButtons[EMPX2ndButton]->isEnabled() == false );
       
   464     QVERIFY( mVideoToolBar->mButtons[EMPX3rdButton]->isEnabled() == true );
       
   465     QVERIFY( mVideoToolBar->mButtons[EMPX4thButton]->isEnabled() == false );
       
   466     QVERIFY( mVideoToolBar->mButtons[EMPX5thButton]->isEnabled() == false );
       
   467 
       
   468     //
       
   469     // local audio-only clip, view mode is audio-only
       
   470     //
       
   471     details->mVideoEnabled = false;
       
   472     details->mVideoHeight = 0;
       
   473     details->mVideoWidth = 1;
       
   474     details->mTvOutConnected = true;
       
   475     details->mSeekable = true;
       
   476     details->mPausableStream = false;
       
   477     mController->mViewMode = EAudioOnlyView;
       
   478 
       
   479     mVideoToolBar->updateWithFileDetails( details );
       
   480 
       
   481     QVERIFY( mVideoToolBar->mButtons[EMPX1stButton]->isEnabled() == true );
       
   482     QVERIFY( mVideoToolBar->mButtons[EMPX2ndButton]->isEnabled() == false );
       
   483     QVERIFY( mVideoToolBar->mButtons[EMPX3rdButton]->isEnabled() == false );
       
   484     QVERIFY( mVideoToolBar->mButtons[EMPX4thButton]->isEnabled() == false );
       
   485     QVERIFY( mVideoToolBar->mButtons[EMPX5thButton]->isEnabled() == false );
       
   486 
       
   487     //
       
   488     // streaming audio-only clip, view mode is audio-only
       
   489     //
       
   490     details->mVideoEnabled = false;
       
   491     details->mPlaybackMode = EMPXVideoStreaming;
       
   492     mController->mViewMode = EAudioOnlyView;
       
   493     details->mSeekable = false;
       
   494     details->mPausableStream = false;
       
   495 	
       
   496     mVideoToolBar->updateWithFileDetails( details );
       
   497 
       
   498     QVERIFY( mVideoToolBar->mButtons[EMPX1stButton]->isEnabled() == false );
       
   499     QVERIFY( mVideoToolBar->mButtons[EMPX2ndButton]->isEnabled() == false );
       
   500     QVERIFY( mVideoToolBar->mButtons[EMPX3rdButton]->isEnabled() == false );
       
   501     QVERIFY( mVideoToolBar->mButtons[EMPX4thButton]->isEnabled() == false );
       
   502     QVERIFY( mVideoToolBar->mButtons[EMPX5thButton]->isEnabled() == false );
       
   503 
       
   504     cleanup();
       
   505 
       
   506     //
       
   507 	// 'attach' mode
       
   508 	//
       
   509     init( true );
       
   510 
       
   511     //
       
   512     // video clip, view mode is full-screen
       
   513     //
       
   514     details->mVideoEnabled = true;
       
   515     details->mVideoHeight = 1;
       
   516     details->mVideoWidth = 1;
       
   517     details->mTvOutConnected = false;
       
   518     details->mSeekable = true;
       
   519     details->mPausableStream = true;
       
   520 
       
   521     mVideoToolBar->updateWithFileDetails( details );
       
   522 
       
   523     QVERIFY( mVideoToolBar->mButtons[EMPX1stButton]->isEnabled() == true );
       
   524     QVERIFY( mVideoToolBar->mButtons[EMPX2ndButton]->isEnabled() == true );
       
   525     QVERIFY( mVideoToolBar->mButtons[EMPX3rdButton]->isEnabled() == true );
       
   526     QVERIFY( mVideoToolBar->mButtons[EMPX4thButton]->isEnabled() == true );
       
   527     QVERIFY( mVideoToolBar->mButtons[EMPX5thButton]->isEnabled() == true );
       
   528 
       
   529     cleanup();
       
   530 }
       
   531 
       
   532 // -------------------------------------------------------------------------------------------------
       
   533 // testOpenDetailsView
       
   534 // -------------------------------------------------------------------------------------------------
       
   535 //
       
   536 void TestMPXVideoPlaybackToolBar::testOpenDetailsView()
       
   537 {
       
   538     MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testOpenDetailsView()"));
       
   539 
       
   540     init();
       
   541 
       
   542     QSignalSpy spy( mVideoToolBar, SIGNAL( openDetailsView() ) );  
       
   543 
       
   544     mController->mViewMode = EFullScreenView;
       
   545     mVideoToolBar->mButtons[EMPX5thButton]->release();
       
   546     QVERIFY( mController->mViewMode == EDetailsView );
       
   547 
       
   548     mController->mViewMode = EDetailsView;
       
   549     mVideoToolBar->mButtons[EMPX5thButton]->release();
       
   550     QVERIFY( mController->mViewMode == EDetailsView );
       
   551 
       
   552     mController->mViewMode = EAudioOnlyView;
       
   553     mVideoToolBar->mButtons[EMPX5thButton]->release();
       
   554     QVERIFY( mController->mViewMode == EAudioOnlyView );
       
   555 
       
   556     cleanup();
       
   557 }
       
   558 
       
   559 // -------------------------------------------------------------------------------------------------
       
   560 // testAttach
       
   561 // -------------------------------------------------------------------------------------------------
       
   562 //
       
   563 void TestMPXVideoPlaybackToolBar::testAttach()
       
   564 {
       
   565     MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testAttach()"));
       
   566 
       
   567     //
       
   568     // test when 'attach' operation is enabled
       
   569     //
       
   570     init( true );
       
   571     
       
   572     QMPXVideoPlaybackViewFileDetails *details = mController->fileDetails();
       
   573     details->mVideoEnabled = false;
       
   574     mVideoToolBar->updateWithFileDetails( details );
       
   575 
       
   576     //
       
   577     // release 'attach' button
       
   578     //
       
   579     mVideoToolBar->mButtons[EMPX1stButton]->release();
       
   580 
       
   581     //
       
   582     // verify the controller attachVideo() slot has been called
       
   583     //
       
   584     QVERIFY( mController->mCommand == EMPXPbvCmdClose );
       
   585     QVERIFY( mController->mAttachVideoDone == true );
       
   586     
       
   587     //
       
   588     // clean up
       
   589     //
       
   590     cleanup();
       
   591     
       
   592     //
       
   593     // test when 'attach' operation is disabled
       
   594     //
       
   595     init();
       
   596 
       
   597     //
       
   598     // verify the controller attachVideo() slot is not called
       
   599     //
       
   600     QVERIFY( mController->mAttachVideoDone == false );
       
   601     
       
   602     //
       
   603     // clean up
       
   604     //
       
   605     cleanup();
       
   606     
       
   607 }
       
   608 
       
   609 // -------------------------------------------------------------------------------------------------
       
   610 // testSend
       
   611 // -------------------------------------------------------------------------------------------------
       
   612 //
       
   613 void TestMPXVideoPlaybackToolBar::testSend()
       
   614 {
       
   615     MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testSend()"));
       
   616 
       
   617     //
       
   618     // test when 'share' operation is enabled
       
   619     //
       
   620     init( false );
       
   621     
       
   622     QMPXVideoPlaybackViewFileDetails *details = mController->fileDetails();
       
   623     details->mVideoEnabled = false;
       
   624     mController->mViewMode = EAudioOnlyView;
       
   625     mVideoToolBar->updateWithFileDetails( details ); 
       
   626     
       
   627     //
       
   628     // release 'share' button
       
   629     //
       
   630     mVideoToolBar->mButtons[EMPX1stButton]->release();
       
   631 
       
   632     //
       
   633     // verify the controller sendVideo() slot has been called
       
   634     //
       
   635     QVERIFY( mController->mCommand == EMPXPbvCmdPause );
       
   636     QVERIFY( mController->mSendVideoDone == true );
       
   637     
       
   638     //
       
   639     // clean up
       
   640     //
       
   641     cleanup();        
       
   642 }
       
   643 
       
   644 // End of file