videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/src/testmpxvideoplaybacktoolbar.cpp
changeset 20 b9e04db066d4
child 24 7d93ee07fb27
equal deleted inserted replaced
17:69946d1824c4 20:b9e04db066d4
       
     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:  2 %
       
    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 // ---------------------------------------------------------------------------
       
    61 // init
       
    62 // ---------------------------------------------------------------------------
       
    63 //
       
    64 void TestMPXVideoPlaybackToolBar::init( bool attachOperation )
       
    65 {
       
    66     MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::init()"));
       
    67 
       
    68     mController = new QMPXVideoPlaybackControlsController( attachOperation );   
       
    69     mVideoToolBar = new QMPXVideoPlaybackToolBar( mController );
       
    70 
       
    71     mVideoToolBar->setVisible( true );
       
    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->mTvOutPlayAllowed = true;
       
   422     details->mSeekable = true;
       
   423     details->mPausableStream = true;
       
   424     mController->mViewMode = EFullScreenView;
       
   425 
       
   426     mVideoToolBar->updateWithFileDetails( details );
       
   427 
       
   428     QVERIFY( mVideoToolBar->mButtons[EMPX1stButton]->isEnabled() == true );
       
   429     QVERIFY( mVideoToolBar->mButtons[EMPX2ndButton]->isEnabled() == true );
       
   430     QVERIFY( mVideoToolBar->mButtons[EMPX3rdButton]->isEnabled() == true );
       
   431     QVERIFY( mVideoToolBar->mButtons[EMPX4thButton]->isEnabled() == true );
       
   432     QVERIFY( mVideoToolBar->mButtons[EMPX5thButton]->isEnabled() == true );
       
   433 
       
   434     //
       
   435     // video clip has same aspect ratio as display window
       
   436     //
       
   437     details->mVideoEnabled = true;
       
   438     details->mVideoHeight = 360;
       
   439     details->mVideoWidth = 640;
       
   440     details->mTvOutConnected = false;
       
   441     mController->mViewMode = EFullScreenView;
       
   442 
       
   443     mVideoToolBar->updateWithFileDetails( details );
       
   444 
       
   445     QVERIFY( mVideoToolBar->mButtons[EMPX1stButton]->isEnabled() == false );
       
   446     QVERIFY( mVideoToolBar->mButtons[EMPX2ndButton]->isEnabled() == true );
       
   447     QVERIFY( mVideoToolBar->mButtons[EMPX3rdButton]->isEnabled() == true );
       
   448     QVERIFY( mVideoToolBar->mButtons[EMPX4thButton]->isEnabled() == true );
       
   449     QVERIFY( mVideoToolBar->mButtons[EMPX5thButton]->isEnabled() == true );
       
   450 
       
   451     //
       
   452     // audio-only clip, view mode is full-screen
       
   453     //
       
   454     details->mVideoEnabled = false;
       
   455     details->mVideoHeight = 0;
       
   456     details->mVideoWidth = 1;
       
   457     details->mTvOutConnected = true;
       
   458     details->mTvOutPlayAllowed = true;
       
   459     details->mSeekable = false;
       
   460     details->mPausableStream = false;
       
   461 
       
   462     mVideoToolBar->updateWithFileDetails( details );
       
   463 
       
   464     QVERIFY( mVideoToolBar->mButtons[EMPX1stButton]->isEnabled() == false );
       
   465     QVERIFY( mVideoToolBar->mButtons[EMPX2ndButton]->isEnabled() == false );
       
   466     QVERIFY( mVideoToolBar->mButtons[EMPX3rdButton]->isEnabled() == false );
       
   467     QVERIFY( mVideoToolBar->mButtons[EMPX4thButton]->isEnabled() == false );
       
   468     QVERIFY( mVideoToolBar->mButtons[EMPX5thButton]->isEnabled() == false );
       
   469 
       
   470     //
       
   471     // local audio-only clip, view mode is audio-only
       
   472     //
       
   473     details->mVideoEnabled = false;
       
   474     details->mVideoHeight = 0;
       
   475     details->mVideoWidth = 1;
       
   476     details->mTvOutConnected = true;
       
   477     details->mTvOutPlayAllowed = true;
       
   478     details->mSeekable = false;
       
   479     details->mPausableStream = false;
       
   480     mController->mViewMode = EAudioOnlyView;
       
   481 
       
   482     mVideoToolBar->updateWithFileDetails( details );
       
   483 
       
   484     QVERIFY( mVideoToolBar->mButtons[EMPX1stButton]->isEnabled() == true );
       
   485     QVERIFY( mVideoToolBar->mButtons[EMPX2ndButton]->isEnabled() == false );
       
   486     QVERIFY( mVideoToolBar->mButtons[EMPX3rdButton]->isEnabled() == false );
       
   487     QVERIFY( mVideoToolBar->mButtons[EMPX4thButton]->isEnabled() == false );
       
   488     QVERIFY( mVideoToolBar->mButtons[EMPX5thButton]->isEnabled() == false );
       
   489 
       
   490     //
       
   491     // streaming audio-only clip, view mode is audio-only
       
   492     //
       
   493     details->mVideoEnabled = false;
       
   494     details->mPlaybackMode = EMPXVideoStreaming;
       
   495     mController->mViewMode = EAudioOnlyView;
       
   496 	
       
   497     mVideoToolBar->updateWithFileDetails( details );
       
   498 
       
   499     QVERIFY( mVideoToolBar->mButtons[EMPX1stButton]->isEnabled() == false );
       
   500     QVERIFY( mVideoToolBar->mButtons[EMPX2ndButton]->isEnabled() == false );
       
   501     QVERIFY( mVideoToolBar->mButtons[EMPX3rdButton]->isEnabled() == false );
       
   502     QVERIFY( mVideoToolBar->mButtons[EMPX4thButton]->isEnabled() == false );
       
   503     QVERIFY( mVideoToolBar->mButtons[EMPX5thButton]->isEnabled() == false );
       
   504 
       
   505     cleanup();
       
   506 
       
   507     //
       
   508 	// 'attach' mode
       
   509 	//
       
   510     init( true );
       
   511 
       
   512     //
       
   513     // video clip, view mode is full-screen
       
   514     //
       
   515     details->mVideoEnabled = true;
       
   516     details->mVideoHeight = 1;
       
   517     details->mVideoWidth = 1;
       
   518     details->mTvOutConnected = false;
       
   519     details->mTvOutPlayAllowed = true;
       
   520     details->mSeekable = true;
       
   521     details->mPausableStream = true;
       
   522 
       
   523     mVideoToolBar->updateWithFileDetails( details );
       
   524 
       
   525     QVERIFY( mVideoToolBar->mButtons[EMPX1stButton]->isEnabled() == true );
       
   526     QVERIFY( mVideoToolBar->mButtons[EMPX2ndButton]->isEnabled() == true );
       
   527     QVERIFY( mVideoToolBar->mButtons[EMPX3rdButton]->isEnabled() == true );
       
   528     QVERIFY( mVideoToolBar->mButtons[EMPX4thButton]->isEnabled() == true );
       
   529     QVERIFY( mVideoToolBar->mButtons[EMPX5thButton]->isEnabled() == true );
       
   530 
       
   531     cleanup();
       
   532 }
       
   533 
       
   534 // ---------------------------------------------------------------------------
       
   535 // testOpenDetailsView
       
   536 // ---------------------------------------------------------------------------
       
   537 //
       
   538 void TestMPXVideoPlaybackToolBar::testOpenDetailsView()
       
   539 {
       
   540     MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testOpenDetailsView()"));
       
   541 
       
   542     init();
       
   543 
       
   544     QSignalSpy spy( mVideoToolBar, SIGNAL( openDetailsView() ) );  
       
   545 
       
   546     mController->mViewMode = EFullScreenView;
       
   547     mVideoToolBar->mButtons[EMPX5thButton]->release();
       
   548     QVERIFY( mController->mViewMode == EDetailsView );
       
   549 
       
   550     mController->mViewMode = EDetailsView;
       
   551     mVideoToolBar->mButtons[EMPX5thButton]->release();
       
   552     QVERIFY( mController->mViewMode == EDetailsView );
       
   553 
       
   554     mController->mViewMode = EAudioOnlyView;
       
   555     mVideoToolBar->mButtons[EMPX5thButton]->release();
       
   556     QVERIFY( mController->mViewMode == EAudioOnlyView );
       
   557 
       
   558     cleanup();
       
   559 }
       
   560 
       
   561 // ---------------------------------------------------------------------------
       
   562 // testAttach
       
   563 // ---------------------------------------------------------------------------
       
   564 //
       
   565 void TestMPXVideoPlaybackToolBar::testAttach()
       
   566 {
       
   567     MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testAttach()"));
       
   568 
       
   569     //
       
   570     // test when 'attach' operation is enabled
       
   571     //
       
   572     init( true );
       
   573     
       
   574     QMPXVideoPlaybackViewFileDetails *details = mController->fileDetails();
       
   575     details->mVideoEnabled = false;
       
   576     mVideoToolBar->updateWithFileDetails( details );
       
   577 
       
   578     //
       
   579     // release 'attach' button
       
   580     //
       
   581     mVideoToolBar->mButtons[EMPX1stButton]->release();
       
   582 
       
   583     //
       
   584     // verify the controller attachVideo() slot has been called
       
   585     //
       
   586     QVERIFY( mController->mCommand == EMPXPbvCmdClose );
       
   587     QVERIFY( mController->mAttachVideoDone == true );
       
   588     
       
   589     //
       
   590     // clean up
       
   591     //
       
   592     cleanup();
       
   593     
       
   594     //
       
   595     // test when 'attach' operation is disabled
       
   596     //
       
   597     init();
       
   598 
       
   599     //
       
   600     // verify the controller attachVideo() slot is not called
       
   601     //
       
   602     QVERIFY( mController->mAttachVideoDone == false );
       
   603     
       
   604     //
       
   605     // clean up
       
   606     //
       
   607     cleanup();
       
   608     
       
   609 }
       
   610 
       
   611 // ---------------------------------------------------------------------------
       
   612 // testSend
       
   613 // ---------------------------------------------------------------------------
       
   614 //
       
   615 void TestMPXVideoPlaybackToolBar::testSend()
       
   616 {
       
   617     MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testSend()"));
       
   618 
       
   619     //
       
   620     // test when 'share' operation is enabled
       
   621     //
       
   622     init( false );
       
   623     
       
   624     QMPXVideoPlaybackViewFileDetails *details = mController->fileDetails();
       
   625     details->mVideoEnabled = false;
       
   626     mController->mViewMode = EAudioOnlyView;
       
   627     mVideoToolBar->updateWithFileDetails( details ); 
       
   628     
       
   629     //
       
   630     // release 'share' button
       
   631     //
       
   632     mVideoToolBar->mButtons[EMPX1stButton]->release();
       
   633 
       
   634     //
       
   635     // verify the controller sendVideo() slot has been called
       
   636     //
       
   637     QVERIFY( mController->mCommand == EMPXPbvCmdPause );
       
   638     QVERIFY( mController->mSendVideoDone == true );
       
   639     
       
   640     //
       
   641     // clean up
       
   642     //
       
   643     cleanup();        
       
   644 }
       
   645 
       
   646 // End of file