videoplayback/videoplaybackview/tsrc/testtoolbar/src/testtoolbar.cpp
changeset 44 518105d52e45
child 50 21fe8338c6bf
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 TestToolBar
       
    15 *
       
    16 */
       
    17 
       
    18 // Version : %version:  6 %
       
    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     // Not initialized
       
   344     //
       
   345     state = EPbStateNotInitialised;
       
   346     mVideoToolBar->updateState( state );
       
   347 
       
   348     QVERIFY( mVideoToolBar->mToolBar->mEnabled == false );
       
   349 
       
   350     cleanup();
       
   351 }
       
   352 
       
   353 // -------------------------------------------------------------------------------------------------
       
   354 // testAspectRatioChanged
       
   355 // -------------------------------------------------------------------------------------------------
       
   356 //
       
   357 void TestToolBar::testAspectRatioChanged()
       
   358 {
       
   359     MPX_ENTER_EXIT(_L("TestToolBar::testAspectRatioChanged()"));
       
   360 
       
   361     init();
       
   362 
       
   363     //
       
   364     // Natural
       
   365     //
       
   366     int aspectRatio = EMMFNatural;
       
   367     mVideoToolBar->aspectRatioChanged( aspectRatio );
       
   368     QVERIFY( mVideoToolBar->mAspectRatio == EMMFNatural );
       
   369 
       
   370     //
       
   371     // Stretch
       
   372     //
       
   373     aspectRatio = EMMFStretch;
       
   374     mVideoToolBar->aspectRatioChanged( aspectRatio );
       
   375     QVERIFY( mVideoToolBar->mAspectRatio == EMMFStretch );
       
   376 
       
   377     //
       
   378     // Zoom
       
   379     //
       
   380     aspectRatio = EMMFZoom;
       
   381     mVideoToolBar->aspectRatioChanged( aspectRatio );
       
   382     QVERIFY( mVideoToolBar->mAspectRatio == EMMFZoom );
       
   383 
       
   384     cleanup();
       
   385 }
       
   386 
       
   387 // -------------------------------------------------------------------------------------------------
       
   388 // testHandleButtonPressed
       
   389 // -------------------------------------------------------------------------------------------------
       
   390 //
       
   391 void TestToolBar::testHandleButtonPressed()
       
   392 {
       
   393     MPX_ENTER_EXIT(_L("TestToolBar::testHandleButtonPressed()"));
       
   394 
       
   395     init();
       
   396 
       
   397     mVideoToolBar->mButtons[E1stButton]->press();
       
   398 
       
   399     QVERIFY( mController->mTimerAction == ETimerCancel );
       
   400 
       
   401     cleanup();
       
   402 }
       
   403 
       
   404 // -------------------------------------------------------------------------------------------------
       
   405 // testUpdateWithFileDetails
       
   406 // -------------------------------------------------------------------------------------------------
       
   407 //
       
   408 void TestToolBar::testUpdateWithFileDetails()
       
   409 {
       
   410     MPX_ENTER_EXIT(_L("TestToolBar::testUpdateWithFileDetails()"));
       
   411 
       
   412     //
       
   413     // 'non-attach' mode
       
   414     //
       
   415     init();
       
   416 
       
   417     VideoPlaybackViewFileDetails *details = mController->fileDetails();
       
   418 
       
   419     //
       
   420     // video clip, view mode is full-screen
       
   421     //
       
   422     details->mVideoEnabled = true;
       
   423     details->mVideoHeight = 1;
       
   424     details->mVideoWidth = 1;
       
   425     details->mTvOutConnected = false;
       
   426     details->mSeekable = true;
       
   427     details->mPausableStream = true;
       
   428     mController->mViewMode = EFullScreenView;
       
   429 
       
   430     mVideoToolBar->updateWithFileDetails( details );
       
   431 
       
   432     QVERIFY( mVideoToolBar->mButtons[E1stButton]->isEnabled() == true );
       
   433     QVERIFY( mVideoToolBar->mButtons[E2ndButton]->isEnabled() == true );
       
   434     QVERIFY( mVideoToolBar->mButtons[E3rdButton]->isEnabled() == true );
       
   435     QVERIFY( mVideoToolBar->mButtons[E4thButton]->isEnabled() == true );
       
   436     QVERIFY( mVideoToolBar->mButtons[E5thButton]->isEnabled() == true );
       
   437 
       
   438     //
       
   439     // video clip has same aspect ratio as display window
       
   440     //
       
   441     details->mVideoEnabled = true;
       
   442     details->mVideoHeight = 360;
       
   443     details->mVideoWidth = 640;
       
   444     details->mTvOutConnected = false;
       
   445     mController->mViewMode = EFullScreenView;
       
   446 
       
   447     mVideoToolBar->updateWithFileDetails( details );
       
   448 
       
   449     QVERIFY( mVideoToolBar->mButtons[E1stButton]->isEnabled() == false );
       
   450     QVERIFY( mVideoToolBar->mButtons[E2ndButton]->isEnabled() == true );
       
   451     QVERIFY( mVideoToolBar->mButtons[E3rdButton]->isEnabled() == true );
       
   452     QVERIFY( mVideoToolBar->mButtons[E4thButton]->isEnabled() == true );
       
   453     QVERIFY( mVideoToolBar->mButtons[E5thButton]->isEnabled() == true );
       
   454 
       
   455     //
       
   456     // audio-only clip, view mode is full-screen
       
   457     //
       
   458     details->mVideoEnabled = false;
       
   459     details->mVideoHeight = 0;
       
   460     details->mVideoWidth = 1;
       
   461     details->mTvOutConnected = true;
       
   462     details->mSeekable = false;
       
   463     details->mPausableStream = true;
       
   464 
       
   465     mVideoToolBar->updateWithFileDetails( details );
       
   466 
       
   467     QVERIFY( mVideoToolBar->mButtons[E1stButton]->isEnabled() == false );
       
   468     QVERIFY( mVideoToolBar->mButtons[E2ndButton]->isEnabled() == false );
       
   469     QVERIFY( mVideoToolBar->mButtons[E3rdButton]->isEnabled() == true );
       
   470     QVERIFY( mVideoToolBar->mButtons[E4thButton]->isEnabled() == false );
       
   471     QVERIFY( mVideoToolBar->mButtons[E5thButton]->isEnabled() == false );
       
   472 
       
   473     //
       
   474     // local audio-only clip, view mode is audio-only
       
   475     //
       
   476     details->mVideoEnabled = false;
       
   477     details->mVideoHeight = 0;
       
   478     details->mVideoWidth = 1;
       
   479     details->mTvOutConnected = true;
       
   480     details->mSeekable = true;
       
   481     details->mPausableStream = false;
       
   482     mController->mState = EPbStatePlaying;
       
   483     mController->mViewMode = EAudioOnlyView;
       
   484 
       
   485     mVideoToolBar->updateWithFileDetails( details );
       
   486 
       
   487     QVERIFY( mVideoToolBar->mButtons[E1stButton]->isEnabled() == true );
       
   488     QVERIFY( mVideoToolBar->mButtons[E2ndButton]->isEnabled() == false );
       
   489     QVERIFY( mVideoToolBar->mButtons[E3rdButton]->isEnabled() == false );
       
   490     QVERIFY( mVideoToolBar->mButtons[E4thButton]->isEnabled() == false );
       
   491     QVERIFY( mVideoToolBar->mButtons[E5thButton]->isEnabled() == false );
       
   492 
       
   493     //
       
   494     // streaming audio-only clip, view mode is audio-only, non-pausable stream in 'playing' state
       
   495     //
       
   496     details->mVideoEnabled = false;
       
   497     details->mPlaybackMode = EMPXVideoStreaming;
       
   498     mController->mViewMode = EAudioOnlyView;
       
   499     details->mSeekable = false;
       
   500     details->mPausableStream = false;
       
   501     mController->mState = EPbStatePlaying;
       
   502 
       
   503     mVideoToolBar->updateWithFileDetails( details );
       
   504 
       
   505     QVERIFY( mVideoToolBar->mButtons[E1stButton]->isEnabled() == false );
       
   506     QVERIFY( mVideoToolBar->mButtons[E2ndButton]->isEnabled() == false );
       
   507     QVERIFY( mVideoToolBar->mButtons[E3rdButton]->isEnabled() == false );
       
   508     QVERIFY( mVideoToolBar->mButtons[E4thButton]->isEnabled() == false );
       
   509     QVERIFY( mVideoToolBar->mButtons[E5thButton]->isEnabled() == false );
       
   510 
       
   511     //
       
   512     // streaming audio-only clip, view mode is audio-only, non-pausable stream in 'paused' state
       
   513     //
       
   514     details->mVideoEnabled = false;
       
   515     details->mPlaybackMode = EMPXVideoStreaming;
       
   516     mController->mViewMode = EAudioOnlyView;
       
   517     details->mSeekable = false;
       
   518     details->mPausableStream = false;
       
   519     mController->mState = EPbStatePaused;
       
   520 
       
   521     mVideoToolBar->updateWithFileDetails( details );
       
   522 
       
   523     QVERIFY( mVideoToolBar->mButtons[E1stButton]->isEnabled() == false );
       
   524     QVERIFY( mVideoToolBar->mButtons[E2ndButton]->isEnabled() == false );
       
   525     QVERIFY( mVideoToolBar->mButtons[E3rdButton]->isEnabled() == true );
       
   526     QVERIFY( mVideoToolBar->mButtons[E4thButton]->isEnabled() == false );
       
   527     QVERIFY( mVideoToolBar->mButtons[E5thButton]->isEnabled() == false );
       
   528 
       
   529     cleanup();
       
   530 
       
   531     //
       
   532     // 'attach' mode
       
   533     //
       
   534     init( true );
       
   535 
       
   536     //
       
   537     // video clip, view mode is full-screen
       
   538     //
       
   539     details->mVideoEnabled = true;
       
   540     details->mVideoHeight = 1;
       
   541     details->mVideoWidth = 1;
       
   542     details->mTvOutConnected = false;
       
   543     details->mSeekable = true;
       
   544     details->mPausableStream = true;
       
   545 
       
   546     mVideoToolBar->updateWithFileDetails( details );
       
   547 
       
   548     QVERIFY( mVideoToolBar->mButtons[E1stButton]->isEnabled() == true );
       
   549     QVERIFY( mVideoToolBar->mButtons[E2ndButton]->isEnabled() == true );
       
   550     QVERIFY( mVideoToolBar->mButtons[E3rdButton]->isEnabled() == true );
       
   551     QVERIFY( mVideoToolBar->mButtons[E4thButton]->isEnabled() == true );
       
   552     QVERIFY( mVideoToolBar->mButtons[E5thButton]->isEnabled() == true );
       
   553 
       
   554     cleanup();
       
   555 }
       
   556 
       
   557 // -------------------------------------------------------------------------------------------------
       
   558 // testOpenDetailsView
       
   559 // -------------------------------------------------------------------------------------------------
       
   560 //
       
   561 void TestToolBar::testOpenDetailsView()
       
   562 {
       
   563     MPX_ENTER_EXIT(_L("TestToolBar::testOpenDetailsView()"));
       
   564 
       
   565     init();
       
   566 
       
   567     QSignalSpy spy( mVideoToolBar, SIGNAL( openDetailsView() ) );
       
   568 
       
   569     mController->mViewMode = EFullScreenView;
       
   570     mVideoToolBar->mButtons[E5thButton]->release();
       
   571     QVERIFY( mController->mViewMode == EDetailsView );
       
   572 
       
   573     mController->mViewMode = EDetailsView;
       
   574     mVideoToolBar->mButtons[E5thButton]->release();
       
   575     QVERIFY( mController->mViewMode == EDetailsView );
       
   576 
       
   577     mController->mViewMode = EAudioOnlyView;
       
   578     mVideoToolBar->mButtons[E5thButton]->release();
       
   579     QVERIFY( mController->mViewMode == EAudioOnlyView );
       
   580 
       
   581     cleanup();
       
   582 }
       
   583 
       
   584 // -------------------------------------------------------------------------------------------------
       
   585 // testAttach
       
   586 // -------------------------------------------------------------------------------------------------
       
   587 //
       
   588 void TestToolBar::testAttach()
       
   589 {
       
   590     MPX_ENTER_EXIT(_L("TestToolBar::testAttach()"));
       
   591 
       
   592     //
       
   593     // test when 'attach' operation is enabled
       
   594     //
       
   595     init( true );
       
   596 
       
   597     VideoPlaybackViewFileDetails *details = mController->fileDetails();
       
   598     details->mVideoEnabled = false;
       
   599     mVideoToolBar->updateWithFileDetails( details );
       
   600 
       
   601     //
       
   602     // release 'attach' button
       
   603     //
       
   604     mVideoToolBar->mButtons[E1stButton]->release();
       
   605 
       
   606     //
       
   607     // verify the controller attachVideo() slot has been called
       
   608     //
       
   609     QVERIFY( mController->mCommand == EMPXPbvCmdClose );
       
   610     QVERIFY( mController->mAttachVideoDone == true );
       
   611 
       
   612     //
       
   613     // clean up
       
   614     //
       
   615     cleanup();
       
   616 
       
   617     //
       
   618     // test when 'attach' operation is disabled
       
   619     //
       
   620     init();
       
   621 
       
   622     //
       
   623     // verify the controller attachVideo() slot is not called
       
   624     //
       
   625     QVERIFY( mController->mAttachVideoDone == false );
       
   626 
       
   627     //
       
   628     // clean up
       
   629     //
       
   630     cleanup();
       
   631 
       
   632 }
       
   633 
       
   634 // -------------------------------------------------------------------------------------------------
       
   635 // testSend
       
   636 // -------------------------------------------------------------------------------------------------
       
   637 //
       
   638 void TestToolBar::testSend()
       
   639 {
       
   640     MPX_ENTER_EXIT(_L("TestToolBar::testSend()"));
       
   641 
       
   642     //
       
   643     // test when 'share' operation is enabled
       
   644     //
       
   645     init( false );
       
   646 
       
   647     VideoPlaybackViewFileDetails *details = mController->fileDetails();
       
   648     details->mVideoEnabled = false;
       
   649     mController->mViewMode = EAudioOnlyView;
       
   650     mVideoToolBar->updateWithFileDetails( details );
       
   651 
       
   652     //
       
   653     // release 'share' button
       
   654     //
       
   655     mVideoToolBar->mButtons[E1stButton]->release();
       
   656 
       
   657     //
       
   658     // verify the controller sendVideo() slot has been called
       
   659     //
       
   660     QVERIFY( mController->mCommand == EMPXPbvCmdPause );
       
   661     QVERIFY( mController->mSendVideoDone == true );
       
   662 
       
   663     //
       
   664     // clean up
       
   665     //
       
   666     cleanup();
       
   667 }
       
   668 
       
   669 // End of file