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