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