camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestStillStates.cpp
branchRCL_3
changeset 20 e3cdd00b5ae3
parent 19 18fa9327a158
child 21 27fe719c32e6
equal deleted inserted replaced
19:18fa9327a158 20:e3cdd00b5ae3
     1 /*
       
     2 * Copyright (c) 2009 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: CaeTestStillStates.cpp
       
    15 *
       
    16 */
       
    17 
       
    18 #include "CaeTestStillStates.h"
       
    19 #include <f32file.h>
       
    20 
       
    21 /*
       
    22 #if ( defined (__WINS__) || defined (__WINSCW) )
       
    23 _LIT(KProcessFileName, "c:\\stillstates.dat");
       
    24 #else
       
    25 _LIT(KProcessFileName, "e:\\stillstates.dat");
       
    26 #endif
       
    27 */
       
    28 
       
    29 //const TReal32 KViewFinderFrameFrequencyMinimum = 13.0;
       
    30 
       
    31 
       
    32 
       
    33 CCaeTestStillStates::CCaeTestStillStates ()
       
    34     {
       
    35     }
       
    36 
       
    37 
       
    38 
       
    39 CCaeTestStillStates::~CCaeTestStillStates ()
       
    40     {
       
    41     }
       
    42 
       
    43 
       
    44 void CCaeTestStillStates::setUpL ()
       
    45     {
       
    46 	iStatesClient = CCaeTestStatesClient::NewL();
       
    47 
       
    48     iStatesClient->SetFileNameBase( KFileNameBase );
       
    49     }
       
    50 
       
    51 
       
    52 void CCaeTestStillStates::tearDown ()
       
    53     {
       
    54     delete iStatesClient;    
       
    55     iStatesClient = 0;
       
    56     }
       
    57 
       
    58 
       
    59 //
       
    60 // Own test functions.
       
    61 //
       
    62 // The framework will do for a test function:
       
    63 //
       
    64 // setUpL();
       
    65 // TRAPD(leaveCode, 'myTestFunction()');
       
    66 // "Report leave error or assertion failure for 'myTestFunction()'".
       
    67 // tearDown();
       
    68 //
       
    69 
       
    70 /********************************************************/
       
    71 /*               PREPARE STILL CAPTURE                  */
       
    72 /********************************************************/
       
    73 
       
    74 void CCaeTestStillStates::TestPrepareStillCaptureNeg1L()
       
    75     {
       
    76 	// ID: CAE.SC.PREPARESTILLCAPTUREL.005
       
    77     //
       
    78     // Group:   Capture
       
    79     // 
       
    80     // Action : Try to prepare the engine for still image capture using invalid quality level index. 
       
    81     //          Initialization is done.
       
    82 	//      
       
    83 	// Output : Leave.   
       
    84 
       
    85     iStatesClient->SetStillQualityLevelIndex( -1 );
       
    86 
       
    87     TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareStillCapturing ) );
       
    88     assertL( error != KErrNone );
       
    89     }
       
    90 
       
    91 void CCaeTestStillStates::TestPrepareStillCapture3L()
       
    92     {
       
    93 	// ID: CAE.SC.PREPARESTILLCAPTUREL.006
       
    94     //
       
    95     // Group:   Capture
       
    96     // 
       
    97     // Action : Try to prepare the engine for still image capture using invalid quality level index. 
       
    98     //          Initialization is done.
       
    99 	//      
       
   100 	// Output : Leave.   
       
   101 
       
   102     iStatesClient->SetStillQualityLevelIndex( 3 );
       
   103 
       
   104     TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareStillCapturing ) );
       
   105     assertL( error != KErrNone );
       
   106     }
       
   107 
       
   108 void CCaeTestStillStates::TestSpecPrepareSCUnsupportedFormatWhenInitializedL()
       
   109     {
       
   110 	// ID: CAE.SC.PREPARESTILLCAPTUREL.008
       
   111     //
       
   112     // Group:   Capture
       
   113     // 
       
   114     // Action : Set still image capturing format to a format unsupported by Camera API implementation. 
       
   115 	//          Initialization is done.
       
   116     //
       
   117 	// Output : Leave.   
       
   118 
       
   119     iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
       
   120 
       
   121     TSize sizeVga( KImgWidthTooBig, KImgHeightTooBig );
       
   122 
       
   123     iStatesClient->SetStillFrameSize( sizeVga );
       
   124 
       
   125     TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareStill ) );//verified if is correct action
       
   126     assertL( error != KErrNone );
       
   127     }
       
   128 
       
   129 void CCaeTestStillStates::TestSpecPrepareSCSupportedFormatWhenPreparedL()
       
   130     {
       
   131 	// ID: CAE.SC.PREPARESTILLCAPTUREL.009
       
   132     //
       
   133     // Group:   Capture
       
   134     // 
       
   135     // Action : Set still image capturing format to a format supported by Camera API implementation. 
       
   136 	//          Still Capture prepared.
       
   137     //
       
   138 	// Output : OK.   
       
   139 
       
   140     iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
       
   141 
       
   142     TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
       
   143 
       
   144     iStatesClient->SetStillFrameSize( sizeVga );
       
   145 
       
   146     iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareStillWhenPrepared );//verified if is correct action
       
   147     }
       
   148 
       
   149 void CCaeTestStillStates::TestPrepareCroppedStillCapturingL()
       
   150     {
       
   151 	// ID: CAE.SC.PREPARESTILLCAPTUREL.011
       
   152     //
       
   153     // Group:   Capture
       
   154     // 
       
   155     // Action : 
       
   156 	//      
       
   157 	// Output : Leave.   
       
   158 
       
   159     iStatesClient->SetStillQualityLevelIndex( 1 );
       
   160 
       
   161     TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareCroppedStillCapturing ) );
       
   162     assertL( error == KErrNotSupported );
       
   163     }
       
   164 
       
   165 void CCaeTestStillStates::TestPrepareStillCaptureWhenPowerOffL()
       
   166     {
       
   167 	// ID: CAE.SC.PREPARESTILLCAPTUREL.011
       
   168     //
       
   169     // Group:   Capture
       
   170     // 
       
   171     // Action : Prepare still capture when init is not ready
       
   172 	//      
       
   173 	// Output : Leave.   
       
   174 
       
   175     iStatesClient->SetStillQualityLevelIndex( 1 );
       
   176 
       
   177     TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareStillCaptureWhenPowerOff ) );
       
   178     assertL( error == KErrNotReady );
       
   179     }
       
   180 
       
   181 void CCaeTestStillStates::TestPrepareStillCaptureWhenRecordingL()
       
   182     {
       
   183 	// ID: CAE.SC.PREPARESTILLCAPTUREL.012
       
   184     //
       
   185     // Group:   Capture
       
   186     // 
       
   187     // Action : Prepare still capture when recording
       
   188 	//      
       
   189 	// Output : Leave.   
       
   190 
       
   191     iStatesClient->SetStillQualityLevelIndex( 1 );
       
   192 
       
   193     TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareStillCaptureWhenRecording ) );
       
   194     assertL( error == KErrNotReady );
       
   195     }
       
   196 
       
   197 void CCaeTestStillStates::TestPrepareStillCaptrureWrongSizeL()
       
   198     {
       
   199 	// ID: CAE.SC.PREPARESTILLCAPTUREL.013
       
   200     //
       
   201     // Group:   Capture
       
   202     // 
       
   203     // Action : Set still image capturing format to a format unsupported by Camera API implementation. 
       
   204 	//          Initialization is done.
       
   205     //
       
   206 	// Output : Leave.   
       
   207 
       
   208     iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
       
   209 
       
   210     TSize wrongSize( 600, 400 );
       
   211 
       
   212     iStatesClient->SetStillFrameSize( wrongSize );
       
   213 
       
   214     TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareStill ) );//verified if is correct action
       
   215     assertL( error == KErrNotSupported );
       
   216     }
       
   217 
       
   218 /********************************************************/
       
   219 /*                 STATE CHANGE                         */
       
   220 /********************************************************/
       
   221 
       
   222 void CCaeTestStillStates::TestReleaseL()
       
   223     {
       
   224     // ID: CAE.GEN.RELESEANDRESERVE.002
       
   225 	//
       
   226     // General
       
   227     // 
       
   228     // Action : Try to release the camera module.
       
   229 	//      
       
   230 	// Output : OK.   
       
   231 
       
   232     iStatesClient->RunTestActionL( CCaeTestStatesClient::ERelease );
       
   233     assertL( iStatesClient->CountInitComplete() == 1 );
       
   234     }
       
   235 
       
   236 void CCaeTestStillStates::TestReleaseReleaseL()
       
   237     {
       
   238     // ID: CAE.GEN.RELESEANDRESERVE.003
       
   239 	//
       
   240     // General
       
   241     // 
       
   242     // Action : Try to release the camera module twice.
       
   243 	//      
       
   244 	// Output : OK.   
       
   245 
       
   246     iStatesClient->RunTestActionL( CCaeTestStatesClient::EReleaseRelease);
       
   247     assertL( iStatesClient->CountInitComplete() == 1 );
       
   248     }
       
   249 
       
   250 void CCaeTestStillStates::TestReserveL()
       
   251     {
       
   252     // ID: CAE.GEN.RELESEANDRESERVE.004
       
   253 	//
       
   254     // General
       
   255     // 
       
   256     // Action : Try to re-reserve the camera module after initial reservation.  
       
   257 	//      
       
   258 	// Output : OK.   
       
   259 
       
   260     iStatesClient->RunTestActionL( CCaeTestStatesClient::EReserveReserve );
       
   261     assertL( iStatesClient->CountInitComplete() == 1 );
       
   262     }
       
   263 
       
   264 void CCaeTestStillStates::TestReleaseReserveCaptureL()
       
   265     {
       
   266     // ID: CAE.GEN.RELESEANDRESERVE.005
       
   267 	//
       
   268     // General
       
   269     // 
       
   270     // Action : Try to re-reserve the camera module after initial reservation
       
   271     //          and releasing. Then capture still image.
       
   272 	//      
       
   273 	// Output : OK.   
       
   274 
       
   275     iStatesClient->SetStillQualityLevelIndex( 0 );
       
   276 
       
   277     iStatesClient->SetStillFileName( _L("cae_relres_ql_2.jpg") );
       
   278 
       
   279     iStatesClient->RunTestActionL( CCaeTestStatesClient::EReleaseReserveCapture );
       
   280     assertL( iStatesClient->CountInitComplete() == 2 );
       
   281     }
       
   282 
       
   283 
       
   284 /********************************************************/
       
   285 /*                GENERAL TESTS                         */
       
   286 /********************************************************/
       
   287 
       
   288 void CCaeTestStillStates::TestPowerOffPowerOffL()
       
   289     {
       
   290     // ID: CAE.GEN.POWEROFFPOWEROFF.001
       
   291 	//
       
   292     // General
       
   293     // 
       
   294     // Action : Test to turn camera power off two time, when initialization is done.
       
   295 	//      
       
   296 	// Output : OK.   
       
   297 
       
   298     iStatesClient->RunTestActionL( CCaeTestStatesClient::EPowerOffPowerOff );
       
   299     assertL( iStatesClient->CountInitComplete() == 1 );
       
   300     }
       
   301 
       
   302 void CCaeTestStillStates::TestCaptureAfterPowerOffOnL()
       
   303     {
       
   304 	// ID: CAE.SC.CAPTURESTILL.POWEROFF.002
       
   305     //
       
   306     // Group:   Capture
       
   307     // 
       
   308     // Action : Test to prepare still capturing and capture Vga Exif image 
       
   309     //          image after poweroff + poweron.
       
   310 	//      
       
   311 	// Output : No leave, image cae_snap_1_8_vga_poweroffon captured
       
   312 
       
   313     TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
       
   314 
       
   315     iStatesClient->SetStillFrameSize( sizeVga );
       
   316     
       
   317     iStatesClient->SetStillFormat( CCamera::EFormatExif );
       
   318 
       
   319     //iStatesClient->SetSnapFileName( _L("cae_snap_1_8_vga_poweroff.mbm") );
       
   320 
       
   321     iStatesClient->SetSnapImageSize( TSize( 44, 52 ) );
       
   322 
       
   323     iStatesClient->SetStillFileName( _L("cae_snap_1_8_vga_poweroffon.jpg") );
       
   324 
       
   325     iStatesClient->RunTestActionL( CCaeTestStatesClient::ECaptureStillAfterPowerOffOn );
       
   326 
       
   327     assertL( iStatesClient->CountInitComplete() == 2 );
       
   328     assertL( iStatesClient->CountStillPrepareComplete() == 2 );
       
   329     assertL( iStatesClient->CountSnapImageReady() == 1 );
       
   330     assertL( iStatesClient->CountStillImageReady() == 1 );
       
   331     }
       
   332 
       
   333 
       
   334 void CCaeTestStillStates::TestStartVfStartVfL()
       
   335     {
       
   336 	// CAE.VF.STARTVIEWFINDERSTARTVIEWFINDER.001
       
   337     //
       
   338     // View Finder
       
   339     // 
       
   340     // Action : Test start two time view finder, when initialization is done.
       
   341 	//      
       
   342 	// Output : OK.   
       
   343 
       
   344     TSize sizeQqvga( KImgWidthQQVGA, KImgHeightQQVGA );
       
   345 
       
   346     iStatesClient->SetViewFinderSize( sizeQqvga );
       
   347 
       
   348     iStatesClient->SetTimeout( 100000 );
       
   349 
       
   350     iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfStartVf );
       
   351     }
       
   352 
       
   353 void CCaeTestStillStates::TestStartVfWhenPowerOffL()
       
   354     {
       
   355 	// CAE.VF.STARTVIEWFINDERWHENPOWEROFF.001
       
   356     //
       
   357     // View Finder
       
   358     // 
       
   359     // Action : Test to start view finder when power is off, initialization is done.
       
   360 	//      
       
   361 	// Output : Leave.  
       
   362     
       
   363     TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfWhenPowerOff ) );
       
   364     assertL( error == KErrNotReady );
       
   365     }
       
   366 
       
   367 
       
   368 void CCaeTestStillStates::TestCancelCaptureStillWhenInitializedL()
       
   369     {
       
   370 	// CAE.SC.CANCEL.001
       
   371     //
       
   372     // Capture (actually just cancelling)
       
   373     // 
       
   374     // Action : Test to cancel still capturing when just initialization is done.
       
   375 	//      
       
   376 	// Output : OK.  
       
   377     
       
   378     iStatesClient->RunTestActionL( CCaeTestStatesClient::ECancelCaptureStillWhenInitialized );
       
   379     }
       
   380 
       
   381 
       
   382 void CCaeTestStillStates::TestCancelCaptureStillAtSnapL()
       
   383     {
       
   384 	// CAE.SC.CANCEL.002
       
   385     //
       
   386     // Capture
       
   387     // 
       
   388     // Action : Test to cancel still capturing after snap image callback. Captures an image after cancelling.
       
   389 	//      
       
   390 	// Output : OK.  
       
   391     
       
   392     iStatesClient->SetStillQualityLevelIndex( 0 );
       
   393     
       
   394     iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureAndCancelStillAtSnap );
       
   395     
       
   396     assertL( iStatesClient->CountInitComplete() == 1 );
       
   397     assertL( iStatesClient->CountStillPrepareComplete() == 2 ); // == 2 because calling PrepareStillCaptureL after cancelling
       
   398     assertL( iStatesClient->CountSnapImageReady() == 3 );
       
   399     // Changed this from 2 to 3. Before it was timing dependent, giving either value. Now the case is timed better.
       
   400     assertL( iStatesClient->CountStillImageReady() == 3 ); 
       
   401     }
       
   402 
       
   403 
       
   404 /********************************************************/
       
   405 /*                STILL BURST TESTS                     */
       
   406 /********************************************************/
       
   407 
       
   408 
       
   409 void CCaeTestStillStates::TestCaptureCaptureStillBurst3L()
       
   410     {
       
   411 	// ID: CAE.SC.CAPTURECAPTURESTILLBURST.3.001
       
   412     //
       
   413     // Group:   Capture
       
   414     // 
       
   415     // Action : Test to prepare still capturing burst mode and capture three  
       
   416     //          images in a burst when initialization is done. Then repeat the burst capture.
       
   417 	//      
       
   418 	// Output : OK.   
       
   419 
       
   420     const TInt KStillBurstLength = 3;
       
   421 
       
   422     iStatesClient->SetStillQualityLevelIndex( 0 );
       
   423 
       
   424     iStatesClient->SetSnapFileName( _L("cae_snap_vga16M_burstburst3.mbm") );
       
   425 
       
   426     iStatesClient->SetStillFileName( _L("cae_vga16M_burstburst3.jpg") );
       
   427 
       
   428     iStatesClient->SetStillBurstLength( KStillBurstLength );
       
   429 
       
   430     iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureCaptureStillBurst );
       
   431 
       
   432     assertL( iStatesClient->CountInitComplete() == 1 );
       
   433     assertL( iStatesClient->CountStillPrepareComplete() == 1 );
       
   434     assertL( iStatesClient->CountStillBurstCaptureMoment() == ( 2 * KStillBurstLength ) );
       
   435     assertL( iStatesClient->CountSnapImageReady() == ( 2 * KStillBurstLength ) );
       
   436     assertL( iStatesClient->CountStillImageReady() == ( 2 * KStillBurstLength ) );
       
   437     assertL( iStatesClient->CountStillBurstComplete() == 2 );
       
   438     }
       
   439 
       
   440 void CCaeTestStillStates::TestSpecPrepCaptureCaptureStillBurst3L()
       
   441     {
       
   442 	// ID: CAE.SC.CAPTURECAPTURESTILLBURST.3.002
       
   443     //
       
   444     // Group:   Capture
       
   445     // 
       
   446     // Action : Test to prepare still capturing burst mode and capture three  
       
   447     //          images in a burst when initialization is done. Then repeat the burst capture.
       
   448 	//      
       
   449 	// Output : OK.   
       
   450 
       
   451     const TInt KStillBurstLength = 3;
       
   452 
       
   453     iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
       
   454 
       
   455     TSize sizevga( KImgWidthVGA, KImgHeightVGA );
       
   456 
       
   457     iStatesClient->SetStillFrameSize( sizevga );
       
   458 
       
   459     iStatesClient->SetSnapFileName( _L("cae_snap_vga16M_spburstburst3.mbm") );
       
   460 
       
   461     iStatesClient->SetStillFileName( _L("cae_vga16M_spburstburst3.mbm") );
       
   462 
       
   463     iStatesClient->SetStillBurstLength( KStillBurstLength );
       
   464 
       
   465     iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecPrepAndCaptureCaptureStillBurst );
       
   466 
       
   467     assertL( iStatesClient->CountInitComplete() == 1 );
       
   468     assertL( iStatesClient->CountStillPrepareComplete() == 1 );
       
   469     assertL( iStatesClient->CountStillBurstCaptureMoment() == ( 2 * KStillBurstLength ) );
       
   470     assertL( iStatesClient->CountSnapImageReady() == ( 2 * KStillBurstLength ) );
       
   471     assertL( iStatesClient->CountStillImageReady() == ( 2 * KStillBurstLength ) );
       
   472     assertL( iStatesClient->CountStillBurstComplete() == 2 );
       
   473     }
       
   474 
       
   475 void CCaeTestStillStates::TestCaptureStillBurst3CaptureStillL()
       
   476     {
       
   477 	// ID: CAE.SC.CAPTURESTILLBURSTCAPTURESTILL.3.001
       
   478     //
       
   479     // Group:   Capture
       
   480     // 
       
   481     // Action : Test to prepare still capturing burst mode and capture three  
       
   482     //          images in a burst when initialization is done. Then repeat the burst capture.
       
   483 	//      
       
   484 	// Output : OK.   
       
   485 
       
   486     const TInt KStillBurstLength = 3;
       
   487 
       
   488     iStatesClient->SetStillQualityLevelIndex( 0 );
       
   489 
       
   490     iStatesClient->SetSnapFileName( _L("cae_snap_vga16M_burst3capture.mbm") );
       
   491 
       
   492     iStatesClient->SetStillFileName( _L("cae_vga16M_burst3capture.jpg") );
       
   493 
       
   494     iStatesClient->SetStillBurstLength( KStillBurstLength );
       
   495 
       
   496     iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurstCaptureStill );
       
   497 
       
   498     assertL( iStatesClient->CountInitComplete() == 1 );
       
   499     assertL( iStatesClient->CountStillPrepareComplete() == 1 );
       
   500     assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
       
   501     assertL( iStatesClient->CountSnapImageReady() == ( KStillBurstLength + 1 ) );
       
   502     assertL( iStatesClient->CountStillImageReady() == ( KStillBurstLength + 1 ) );
       
   503     assertL( iStatesClient->CountStillBurstComplete() == 1 );
       
   504     }
       
   505 
       
   506 void CCaeTestStillStates::TestSpecPrepCaptureStillBurst3CaptureStillL()
       
   507     {
       
   508 	// ID: CAE.SC.CAPTURESTILLBURSTCAPTURESTILL.3.002
       
   509     //
       
   510     // Group:   Capture
       
   511     // 
       
   512     // Action : Test to prepare still capturing burst mode and capture three  
       
   513     //          images in a burst when initialization is done. Then repeat the burst capture.
       
   514 	//      
       
   515 	// Output : OK.   
       
   516 
       
   517     const TInt KStillBurstLength = 3;
       
   518 
       
   519     iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
       
   520 
       
   521     TSize sizevga( KImgWidthVGA, KImgHeightVGA );
       
   522 
       
   523     iStatesClient->SetStillFrameSize( sizevga );
       
   524 
       
   525     iStatesClient->SetSnapFileName( _L("cae_snap_qqvga16M_spburst3capture.mbm") );
       
   526 
       
   527     iStatesClient->SetStillFileName( _L("cae_qqvga16M_spburst3capture.mbm") );
       
   528 
       
   529     iStatesClient->SetStillBurstLength( KStillBurstLength );
       
   530 
       
   531     iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecPrepAndCaptureStillBurstCaptureStill );
       
   532 
       
   533     assertL( iStatesClient->CountInitComplete() == 1 );
       
   534     assertL( iStatesClient->CountStillPrepareComplete() == 1 );
       
   535     assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
       
   536     assertL( iStatesClient->CountSnapImageReady() == ( KStillBurstLength + 1 ) );
       
   537     assertL( iStatesClient->CountStillImageReady() == ( KStillBurstLength + 1 ) );
       
   538     assertL( iStatesClient->CountStillBurstComplete() == 1 );
       
   539     }
       
   540 
       
   541 
       
   542 void CCaeTestStillStates::TestCancelCaptureStillBurst3AtSnapL()
       
   543     {
       
   544 	// ID: CAE.SC.CAPTURESTILLBURST.CANCEL.007
       
   545     //
       
   546     // Group:   Capture
       
   547     // 
       
   548     // Action : Test to prepare still capturing burst mode and capture three  
       
   549     //          images in a burst and cancel still burst after snap image callback, 
       
   550     //          initialization is done. After cancelling captures a burst.
       
   551 	//      
       
   552 	// Output : OK.   
       
   553 
       
   554     const TInt KStillBurstLength = 3;
       
   555 
       
   556     iStatesClient->SetStillQualityLevelIndex( 0 );
       
   557 
       
   558     iStatesClient->SetSnapFileName( _L("cae_snap_vga16M_burst_cancel.mbm") );
       
   559 
       
   560     iStatesClient->SetStillFileName( _L("cae_vga16M_burst_cancel.jpg") );
       
   561 
       
   562     iStatesClient->SetStillBurstLength( KStillBurstLength );
       
   563 
       
   564     iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureAndCancelStillBurstAtSnap );
       
   565 
       
   566     assertL( iStatesClient->CountInitComplete() == 1 );
       
   567     assertL( iStatesClient->CountStillPrepareComplete() == 2 ); // == 2 because calling PrepareStillCaptureL after cancel
       
   568     assertL( iStatesClient->CountStillBurstCaptureMoment() == 3 * KStillBurstLength );
       
   569     assertL( iStatesClient->CountSnapImageReady() >= KStillBurstLength + 1 );
       
   570     assertL( iStatesClient->CountStillImageReady() >= KStillBurstLength );
       
   571     assertL( iStatesClient->CountStillBurstComplete() == 1 );
       
   572     }
       
   573 
       
   574 
       
   575 void CCaeTestStillStates::TestCancelCaptureStillBurst3AtMomentL()
       
   576     {
       
   577 	// ID: CAE.SC.CAPTURESTILLBURST.CANCEL.008
       
   578     //
       
   579     // Group:   Capture
       
   580     // 
       
   581     // Action : Test to prepare still capturing burst mode and capture three  
       
   582     //          images in a burst and cancel still burst in the second capture moment callback.
       
   583     //          Initialization is done. After cancelling prepares, captures burst, and cancels.
       
   584     //          Then captures a burst that is not cancelled.
       
   585 	//      
       
   586 	// Output : OK.   
       
   587 
       
   588     const TInt KStillBurstLength = 3;
       
   589 
       
   590     iStatesClient->SetStillQualityLevelIndex( 0 );
       
   591 
       
   592     iStatesClient->SetSnapFileName( _L("cae_snap_vga16M_burst_cancelmom.mbm") );
       
   593 
       
   594     iStatesClient->SetStillFileName( _L("cae_vga16M_burst_cancelmom.jpg") );
       
   595 
       
   596     iStatesClient->SetStillBurstLength( KStillBurstLength );
       
   597 
       
   598     iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureAndCancelStillBurstAtMoment );
       
   599 
       
   600     assertL( iStatesClient->CountInitComplete() == 1 );
       
   601     assertL( iStatesClient->CountStillPrepareComplete() == 2 ); // == 2 because calling PrepareStillCaptureL after cancel
       
   602     assertL( iStatesClient->CountStillBurstCaptureMoment() == ( 2 + 1 + KStillBurstLength ) );
       
   603     assertL( iStatesClient->CountSnapImageReady() == KStillBurstLength );
       
   604     assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
       
   605     assertL( iStatesClient->CountStillBurstComplete() == 1 );
       
   606     }
       
   607 
       
   608 
       
   609 void CCaeTestStillStates::TestCaptureStillBurstMp2Exif100IgnoreErrorsL()
       
   610     {
       
   611 	// ID: CAE.SC.CAPTURESTILLBURST.MP2EXIF.IGNORE.100.001
       
   612     //
       
   613     // Group: Capture
       
   614     // 
       
   615     // Action : Test OOM case using too long burst with 2 megapixel Exif images. OOM error is ignored in callbacks 
       
   616 	//			and the test case tries to get all snap and still images from the engine.  
       
   617 	//      
       
   618 	// Output : Leave
       
   619 
       
   620     const TInt KStillBurstLength = 100;
       
   621     const TSize sizeMp2( KImgWidthMP2, KImgHeightMP2 );
       
   622 
       
   623 	iStatesClient->SetStopOnErrorInMcaeoSnapImageReady( EFalse );
       
   624 	iStatesClient->SetStopOnErrorInMcaeoStillImageReady( EFalse );
       
   625 
       
   626     iStatesClient->SetStillFrameSize( sizeMp2 );
       
   627     iStatesClient->SetStillFormat( CCamera::EFormatExif );
       
   628     iStatesClient->SetStillBurstLength( KStillBurstLength );
       
   629 
       
   630 	TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurstExif ) );
       
   631 
       
   632     assertL( error == KErrNoMemory );
       
   633     assertL( iStatesClient->CountInitComplete() == 1 );
       
   634     assertL( iStatesClient->CountStillPrepareComplete() == 1 );
       
   635     assertL( iStatesClient->CountStillBurstComplete() == 1 );
       
   636     assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountSnapImageReady() + 1 );
       
   637     assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountStillImageReady() + 1 );
       
   638     assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountImageDeliveredStillBurstComplete() + 1 );	
       
   639     }
       
   640 
       
   641 void CCaeTestStillStates::TestCaptureStillBurstMp1Exif100IgnoreErrorsL()
       
   642     {
       
   643 	// ID: CAE.SC.CAPTURESTILLBURST.MP1EXIF.IGNORE.100.001
       
   644     //
       
   645     // Group: Capture
       
   646     // 
       
   647     // Action : Test OOM case using too long burst with one megapixel Exif images. OOM error is ignored in callbacks 
       
   648 	//			and the test case tries to get all snap and still images from the engine.  
       
   649 	//      
       
   650 	// Output : Leave
       
   651 
       
   652     const TInt KStillBurstLength = 100;
       
   653     const TSize sizeMp1M3( KImgWidthMP1M3, KImgHeightMP1M3 );
       
   654 
       
   655 	iStatesClient->SetStopOnErrorInMcaeoSnapImageReady( EFalse );
       
   656 	iStatesClient->SetStopOnErrorInMcaeoStillImageReady( EFalse );
       
   657 
       
   658     iStatesClient->SetStillFrameSize( sizeMp1M3 );
       
   659     iStatesClient->SetStillFormat( CCamera::EFormatExif );
       
   660     iStatesClient->SetStillBurstLength( KStillBurstLength );
       
   661 
       
   662 	TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurstExif ) );
       
   663 
       
   664     assertL( error == KErrNoMemory );
       
   665     assertL( iStatesClient->CountInitComplete() == 1 );
       
   666     assertL( iStatesClient->CountStillPrepareComplete() == 1 );
       
   667     assertL( iStatesClient->CountStillBurstComplete() == 1 );
       
   668     assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountSnapImageReady() + 1 );
       
   669     assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountStillImageReady() + 1 );
       
   670     assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountImageDeliveredStillBurstComplete() + 1 );	
       
   671     }
       
   672 
       
   673 
       
   674 
       
   675 void CCaeTestStillStates::TestCaptureStillBurstVgaBitmap100IgnoreErrorsL()
       
   676     {
       
   677 	// ID: CAE.SC.CAPTURESTILLBURST.VGABITMAP.IGNORE.100.002
       
   678     //
       
   679     // Group: Capture
       
   680     // 
       
   681     // Action : Test OOM case using too long burst with VGA bitmaps. OOM error is ignored in callbacks 
       
   682 	//			and the test case tries to get all snap and still images from the engine.  
       
   683 	//      
       
   684 	// Output : Leave    
       
   685 
       
   686     const TInt KStillBurstLength = 100;
       
   687     const TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
       
   688 
       
   689 	iStatesClient->SetStopOnErrorInMcaeoSnapImageReady( EFalse );
       
   690 	iStatesClient->SetStopOnErrorInMcaeoStillImageReady( EFalse );
       
   691 
       
   692     iStatesClient->SetStillFrameSize( sizeVga );
       
   693     iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
       
   694     iStatesClient->SetStillBurstLength( KStillBurstLength );
       
   695 
       
   696 	TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurst ) );
       
   697 
       
   698     assertL( error == KErrNoMemory );
       
   699     assertL( iStatesClient->CountInitComplete() == 1 );
       
   700     assertL( iStatesClient->CountStillPrepareComplete() == 1 );
       
   701     assertL( iStatesClient->CountStillBurstComplete() == 1 );
       
   702     assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountSnapImageReady() + 1 );
       
   703     assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountStillImageReady() + 1 );
       
   704     assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountImageDeliveredStillBurstComplete() + 1 );	
       
   705     }
       
   706 
       
   707 
       
   708 void CCaeTestStillStates::TestCaptureStillBurstVgaJpeg100IgnoreErrorsL()
       
   709     {
       
   710 	// ID: CAE.SC.CAPTURESTILLBURST.VGAJPEG.IGNORE.100.003
       
   711     //
       
   712     // Group: Capture
       
   713     // 
       
   714     // Action : Test OOM case using too long burst with VGA Jpeg images. OOM error is ignored in callbacks 
       
   715 	//			and the test case tries to get all snap and still images from the engine.  
       
   716 	//      
       
   717 	// Output : Leave    
       
   718 
       
   719     const TInt KStillBurstLength = 100;
       
   720     const TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
       
   721 
       
   722 	iStatesClient->SetStopOnErrorInMcaeoSnapImageReady( EFalse );
       
   723 	iStatesClient->SetStopOnErrorInMcaeoStillImageReady( EFalse );
       
   724 
       
   725     iStatesClient->SetStillFrameSize( sizeVga );
       
   726     iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
       
   727     iStatesClient->SetStillBurstLength( KStillBurstLength );
       
   728 
       
   729 	TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurstExif ) );
       
   730 
       
   731     assertL( error == KErrNoMemory );
       
   732     assertL( iStatesClient->CountInitComplete() == 1 );
       
   733     assertL( iStatesClient->CountStillPrepareComplete() == 1 );
       
   734     assertL( iStatesClient->CountStillBurstComplete() == 1 );
       
   735     assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountSnapImageReady() + 1 );
       
   736     assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountStillImageReady() + 1 );
       
   737     assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountImageDeliveredStillBurstComplete() + 1 );	
       
   738     }
       
   739 
       
   740 
       
   741 
       
   742 /********************************************************/
       
   743 /*                "DESTROY ENGINE"-TESTS                */
       
   744 /********************************************************/
       
   745 
       
   746 
       
   747 void CCaeTestStillStates::TestDestroy1L()
       
   748     {
       
   749 	// ID: CAE.SC.DESTROY.001
       
   750     //
       
   751     // Group:   General
       
   752     // 
       
   753     // Action : Test to destroy the engine when still capture prepare is ready. 
       
   754 	//      
       
   755 	// Output : OK.   
       
   756 
       
   757     iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
       
   758 
       
   759     TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
       
   760 
       
   761     iStatesClient->SetStillFrameSize( sizeVga );
       
   762 
       
   763     iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenStillPrepareReady );
       
   764 
       
   765     assertL( iStatesClient->CountInitComplete() == 1 );
       
   766     assertL( iStatesClient->CountStillPrepareComplete() == 1 );
       
   767     assertL( iStatesClient->CountSnapImageReady() == 0 );
       
   768     assertL( iStatesClient->CountStillImageReady() == 0 );
       
   769     }
       
   770 
       
   771 
       
   772 void CCaeTestStillStates::TestDestroy2L()
       
   773     {
       
   774 	// ID: CAE.SC.DESTROY.002
       
   775     //
       
   776     // Group:   General
       
   777     // 
       
   778     // Action : Test to destroy the engine just after snap image callback. 
       
   779 	//      
       
   780 	// Output : OK.   
       
   781 
       
   782     iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
       
   783 
       
   784     TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
       
   785 
       
   786     iStatesClient->SetStillFrameSize( sizeVga );
       
   787 
       
   788     iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenSnapImageReady );
       
   789 
       
   790     assertL( iStatesClient->CountInitComplete() == 1 );
       
   791     assertL( iStatesClient->CountStillPrepareComplete() == 1 );
       
   792     assertL( iStatesClient->CountSnapImageReady() == 1 );
       
   793     assertL( iStatesClient->CountStillImageReady() == 0 );
       
   794     }
       
   795 
       
   796 
       
   797 void CCaeTestStillStates::TestDestroy3L()
       
   798     {
       
   799 	// ID: CAE.SC.DESTROY.003
       
   800     //
       
   801     // Group:   General
       
   802     // 
       
   803     // Action : Test to destroy the engine just after snap image callback. 
       
   804 	//      
       
   805 	// Output : OK.   
       
   806 
       
   807     iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
       
   808 
       
   809     TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
       
   810 
       
   811     iStatesClient->SetStillFrameSize( sizeVga );
       
   812 
       
   813     iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenSnapImageReady );
       
   814 
       
   815     assertL( iStatesClient->CountInitComplete() == 1 );
       
   816     assertL( iStatesClient->CountStillPrepareComplete() == 1 );
       
   817     assertL( iStatesClient->CountSnapImageReady() == 1 );
       
   818     assertL( iStatesClient->CountStillImageReady() == 1 );
       
   819     }
       
   820 
       
   821 
       
   822 void CCaeTestStillStates::TestDestroy4L()
       
   823     {
       
   824 	// ID: CAE.SC.DESTROY.004
       
   825     //
       
   826     // Group:   General
       
   827     // 
       
   828     // Action : Test to destroy the engine just after still image callback. 
       
   829 	//      
       
   830 	// Output : OK.   
       
   831 
       
   832     iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
       
   833 
       
   834     TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
       
   835 
       
   836     iStatesClient->SetStillFrameSize( sizeVga );
       
   837 
       
   838     iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenStillCaptureReady );
       
   839 
       
   840     assertL( iStatesClient->CountInitComplete() == 1 );
       
   841     assertL( iStatesClient->CountStillPrepareComplete() == 1 );
       
   842     assertL( iStatesClient->CountSnapImageReady() == 1 );
       
   843     assertL( iStatesClient->CountStillImageReady() == 1 );
       
   844     }
       
   845 
       
   846 
       
   847 void CCaeTestStillStates::TestDestroy5L()
       
   848     {
       
   849 	// ID: CAE.SC.DESTROY.005
       
   850     //
       
   851     // Group:   General
       
   852     // 
       
   853     // Action : Test to destroy the engine just after still burst ready callback. 
       
   854 	//      
       
   855 	// Output : OK.   
       
   856 
       
   857     const TInt KStillBurstLength = 3;
       
   858 
       
   859     iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
       
   860 
       
   861     TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
       
   862 
       
   863     iStatesClient->SetStillFrameSize( sizeVga );
       
   864 
       
   865     iStatesClient->SetStillBurstLength( KStillBurstLength );
       
   866 
       
   867     iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenStillBurstReady );
       
   868 
       
   869     assertL( iStatesClient->CountInitComplete() == 1 );
       
   870     assertL( iStatesClient->CountStillPrepareComplete() == 1 );
       
   871     assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
       
   872     assertL( iStatesClient->CountSnapImageReady() == KStillBurstLength );
       
   873     assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
       
   874     assertL( iStatesClient->CountStillBurstComplete() == 1 );
       
   875     }
       
   876 
       
   877 
       
   878 void CCaeTestStillStates::TestDestroy6L()
       
   879     {
       
   880 	// ID: CAE.SC.DESTROY.006
       
   881     //
       
   882     // Group:   General
       
   883     // 
       
   884     // Action : Test to destroy the engine just after the first snap image callback in still burst. 
       
   885 	//      
       
   886 	// Output : OK.   
       
   887 
       
   888     const TInt KStillBurstLength = 3;
       
   889 
       
   890     iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
       
   891 
       
   892     TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
       
   893 
       
   894     iStatesClient->SetStillFrameSize( sizeVga );
       
   895 
       
   896     iStatesClient->SetStillBurstLength( KStillBurstLength );
       
   897 
       
   898     iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenSnapImageReadyInStillBurst );
       
   899 
       
   900     assertL( iStatesClient->CountInitComplete() == 1 );
       
   901     assertL( iStatesClient->CountStillPrepareComplete() == 1 );
       
   902     assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
       
   903     assertL( iStatesClient->CountSnapImageReady() >= 1 );
       
   904     assertL( iStatesClient->CountStillImageReady() == 0 );
       
   905     assertL( iStatesClient->CountStillBurstComplete() == 0 );
       
   906     }
       
   907 
       
   908 
       
   909 void CCaeTestStillStates::TestDestroy7L()
       
   910     {
       
   911 	// ID: CAE.SC.DESTROY.007
       
   912     //
       
   913     // Group:   General
       
   914     // 
       
   915     // Action : Test to destroy the engine just after the first still image callback in still burst. 
       
   916 	//      
       
   917 	// Output : OK.   
       
   918 
       
   919     const TInt KStillBurstLength = 3;
       
   920 
       
   921     iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
       
   922 
       
   923     TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
       
   924 
       
   925     iStatesClient->SetStillFrameSize( sizeVga );
       
   926 
       
   927     iStatesClient->SetStillBurstLength( KStillBurstLength );
       
   928 
       
   929     iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenStillImageReadyInStillBurst );
       
   930 
       
   931     assertL( iStatesClient->CountInitComplete() == 1 );
       
   932     assertL( iStatesClient->CountStillPrepareComplete() == 1 );
       
   933     assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
       
   934     assertL( iStatesClient->CountSnapImageReady() >= 1 );
       
   935     assertL( iStatesClient->CountStillImageReady() == 1 );
       
   936     assertL( iStatesClient->CountStillBurstComplete() == 0 );
       
   937     }
       
   938 
       
   939 
       
   940 /********************************************************/
       
   941 /*                ERROR SIMULATIONS                     */
       
   942 /********************************************************/
       
   943 
       
   944 
       
   945 void CCaeTestStillStates::TestEncodingErrorL()
       
   946     {
       
   947 	// ID: CAE.SC.ERRORS.001
       
   948     //
       
   949     // Group:   Errors.
       
   950     // 
       
   951     // Action : Test still image capture with simulated encoding error.
       
   952 	//      
       
   953 	// Output : Leave with code KErrAbort.   
       
   954 
       
   955     iStatesClient->SetStillQualityLevelIndex( 0 );
       
   956 
       
   957     TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EEncodingError ) );
       
   958     assertL( error == KErrAbort );
       
   959 
       
   960     assertL( iStatesClient->CountInitComplete() == 1 );
       
   961     assertL( iStatesClient->CountStillPrepareComplete() == 1 );
       
   962     assertL( iStatesClient->CountSnapImageReady() == 1 );
       
   963     assertL( iStatesClient->CountStillImageReady() == 1 );
       
   964     }
       
   965 
       
   966 
       
   967 void CCaeTestStillStates::TestPowerErrorL()
       
   968     {
       
   969 	// ID: CAE.SC.ERRORS.002
       
   970     //
       
   971     // Group:   Errors.
       
   972     // 
       
   973     // Action : Test still image capture with simulated camera power error.
       
   974 	//      
       
   975 	// Output : Leave with code KErrAbort.   
       
   976 
       
   977     TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPowerError ) );
       
   978     assertL( error == KErrAbort );
       
   979 
       
   980     assertL( iStatesClient->CountInitComplete() == 1 );
       
   981     assertL( iStatesClient->CountStillPrepareComplete() == 0 );
       
   982     assertL( iStatesClient->CountSnapImageReady() == 0 );
       
   983     assertL( iStatesClient->CountStillImageReady() == 0 );
       
   984     }
       
   985 
       
   986 
       
   987 void CCaeTestStillStates::TestReserveErrorL()
       
   988     {
       
   989 	// ID: CAE.SC.ERRORS.003
       
   990     //
       
   991     // Group:   Errors.
       
   992     // 
       
   993     // Action : Test still image capture with simulated camera reservation error.
       
   994 	//      
       
   995 	// Output : Leave with code KErrAbort.   
       
   996 
       
   997     TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EReserveError ) );
       
   998     assertL( error == KErrAbort );
       
   999 
       
  1000     assertL( iStatesClient->CountInitComplete() == 1 );
       
  1001     assertL( iStatesClient->CountStillPrepareComplete() == 0 );
       
  1002     assertL( iStatesClient->CountSnapImageReady() == 0 );
       
  1003     assertL( iStatesClient->CountStillImageReady() == 0 );
       
  1004     }
       
  1005 
       
  1006 
       
  1007 void CCaeTestStillStates::TestStillCaptureErrorL()
       
  1008     {
       
  1009 	// ID: CAE.SC.ERRORS.004
       
  1010     //
       
  1011     // Group:   Errors.
       
  1012     // 
       
  1013     // Action : Test still image capture with simulated capture error.
       
  1014 	//      
       
  1015 	// Output : Leave with code KErrAbort.   
       
  1016 
       
  1017     iStatesClient->SetStillQualityLevelIndex( 0 );
       
  1018 
       
  1019     TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStillCaptureError ) );
       
  1020     assertL( error == KErrAbort );
       
  1021 
       
  1022     assertL( iStatesClient->CountInitComplete() == 1 );
       
  1023     assertL( iStatesClient->CountStillPrepareComplete() == 1 );
       
  1024     assertL( iStatesClient->CountSnapImageReady() == 1 );
       
  1025     assertL( iStatesClient->CountStillImageReady() == 0 );
       
  1026     }
       
  1027 
       
  1028 
       
  1029 void CCaeTestStillStates::TestSnapImageErrorL()
       
  1030     {
       
  1031 	// ID: CAE.SC.ERRORS.005
       
  1032     //
       
  1033     // Group:   Errors.
       
  1034     // 
       
  1035     // Action : Test still image capture with simulated snap image error.
       
  1036 	//      
       
  1037 	// Output : Leave with code KErrAbort.   
       
  1038 
       
  1039     const TSize sizeMp1M3( KImgWidthMP1M3, KImgHeightMP1M3 );
       
  1040     iStatesClient->SetStillFrameSize( sizeMp1M3 );
       
  1041     iStatesClient->SetStillFormat( CCamera::EFormatExif );
       
  1042 
       
  1043 
       
  1044     TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESnapImageError ) );
       
  1045     assertL( error == KErrAbort );
       
  1046 
       
  1047     assertL( iStatesClient->CountInitComplete() == 1 );
       
  1048     assertL( iStatesClient->CountStillPrepareComplete() == 1 );
       
  1049     assertL( iStatesClient->CountSnapImageReady() == 1 );
       
  1050     assertL( iStatesClient->CountStillImageReady() == 0 );
       
  1051     }
       
  1052 
       
  1053 
       
  1054 void CCaeTestStillStates::TestStillImageErrorL()
       
  1055     {
       
  1056 	// ID: CAE.SC.ERRORS.006
       
  1057     //
       
  1058     // Group:   Errors.
       
  1059     // 
       
  1060     // Action : Test still image capture with simulated still image error.
       
  1061 	//      
       
  1062 	// Output : Leave with code KErrAbort.   
       
  1063 
       
  1064     const TSize sizeMp1M3( KImgWidthMP1M3, KImgHeightMP1M3 );
       
  1065     iStatesClient->SetStillFrameSize( sizeMp1M3 );
       
  1066     iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
       
  1067 
       
  1068     TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStillImageError ) );
       
  1069     assertL( error == KErrAbort );
       
  1070 
       
  1071     assertL( iStatesClient->CountInitComplete() == 1 );
       
  1072     assertL( iStatesClient->CountStillPrepareComplete() == 1 );
       
  1073     assertL( iStatesClient->CountSnapImageReady() == 1 );
       
  1074     assertL( iStatesClient->CountStillImageReady() == 1 );
       
  1075     }
       
  1076 
       
  1077 
       
  1078 void CCaeTestStillStates::TestStillConvertError1L()
       
  1079     {
       
  1080 	// ID: CAE.SC.ERRORS.007
       
  1081     //
       
  1082     // Group:   Errors.
       
  1083     // 
       
  1084     // Action : Test still image capture with simulated still image conversion error.
       
  1085 	//      
       
  1086 	// Output : Leave with code KErrAbort.   
       
  1087 
       
  1088     iStatesClient->SetStillQualityLevelIndex( 0 );
       
  1089 
       
  1090     TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStillConvertError1 ) );
       
  1091     assertL( error == KErrAbort );
       
  1092 
       
  1093     assertL( iStatesClient->CountInitComplete() == 1 );
       
  1094     assertL( iStatesClient->CountStillPrepareComplete() == 1 );
       
  1095     assertL( iStatesClient->CountSnapImageReady() == 1 );
       
  1096     assertL( iStatesClient->CountStillImageReady() == 1 );
       
  1097     }
       
  1098 
       
  1099 
       
  1100 void CCaeTestStillStates::TestStillConvertError2L()
       
  1101     {
       
  1102 	// ID: CAE.SC.ERRORS.008
       
  1103     //
       
  1104     // Group:   Errors.
       
  1105     // 
       
  1106     // Action : Test still image capture with simulated still image conversion error.
       
  1107 	//      
       
  1108 	// Output : Leave with code KErrAbort.   
       
  1109 
       
  1110     iStatesClient->SetStillQualityLevelIndex( 0 );
       
  1111 
       
  1112     TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStillConvertError2 ) );
       
  1113     assertL( error == KErrAbort );
       
  1114 
       
  1115     assertL( iStatesClient->CountInitComplete() == 1 );
       
  1116     assertL( iStatesClient->CountStillPrepareComplete() == 1 );
       
  1117     assertL( iStatesClient->CountSnapImageReady() == 1 );
       
  1118     assertL( iStatesClient->CountStillImageReady() == 1 );
       
  1119     }
       
  1120 
       
  1121 
       
  1122 void CCaeTestStillStates::TestStillConvertError3L()
       
  1123     {
       
  1124 	// ID: CAE.SC.ERRORS.009
       
  1125     //
       
  1126     // Group:   Errors.
       
  1127     // 
       
  1128     // Action : Test still image capture with simulated still image conversion error.
       
  1129 	//      
       
  1130 	// Output : Leave with code KErrAbort.   
       
  1131 
       
  1132     iStatesClient->SetStillQualityLevelIndex( 0 );
       
  1133 
       
  1134     TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStillConvertError3 ) );
       
  1135     assertL( error == KErrAbort );
       
  1136 
       
  1137     assertL( iStatesClient->CountInitComplete() == 1 );
       
  1138     assertL( iStatesClient->CountStillPrepareComplete() == 1 );
       
  1139     assertL( iStatesClient->CountSnapImageReady() == 1 );
       
  1140     assertL( iStatesClient->CountStillImageReady() == 1 );
       
  1141     }
       
  1142 
       
  1143 void CCaeTestStillStates::TestSetCameraIndexLowL()
       
  1144     {
       
  1145 	// ID: CAE.SC.SETCAMERAINDEX.001
       
  1146     //
       
  1147     // Group:   Capture
       
  1148     // 
       
  1149     // Action : Set camera index to -1 and capture a still image.
       
  1150 	//      
       
  1151 	// Output : leave
       
  1152 
       
  1153     iStatesClient->SetDisplayIndex( 1 );
       
  1154     iStatesClient->SetSnapFileName( _L("cae_snap_camera_index_1.mbm") );
       
  1155     TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESetCameraIndexLow ) );
       
  1156     assertL( error == KErrHardwareNotAvailable );
       
  1157     }
       
  1158 
       
  1159 void CCaeTestStillStates::TestSetCameraIndexHighL()
       
  1160     {
       
  1161 	// ID: CAE.SC.SETCAMERAINDEX.002
       
  1162     //
       
  1163     // Group:   Capture
       
  1164     // 
       
  1165     // Action : Set camera index to too big value and capture a still image.
       
  1166 	//      
       
  1167 	// Output : leave
       
  1168 
       
  1169     iStatesClient->SetDisplayIndex( 1 );
       
  1170     iStatesClient->SetSnapFileName( _L("cae_snap_camera_index_1.mbm") );
       
  1171     TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESetCameraIndexHigh ) );
       
  1172     assertL( error == KErrHardwareNotAvailable );
       
  1173     }
       
  1174 
       
  1175 //
       
  1176 // An own static function to collect the test functions into one 
       
  1177 // suite of tests. The framework will run the tests and free the
       
  1178 // memory allocated for the test suite.
       
  1179 // 
       
  1180 
       
  1181 MTest* CCaeTestStillStates::suiteL ()
       
  1182     {
       
  1183 	// Always use NewL (Do not use NewLC) !!!
       
  1184     CTestSuite *suite = CTestSuite::NewL( _L8("CCaeTestStillStates") );
       
  1185 
       
  1186     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.005"), &TestPrepareStillCaptureNeg1L ) );
       
  1187     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.006"), &TestPrepareStillCapture3L ) );
       
  1188     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.008"), &TestSpecPrepareSCUnsupportedFormatWhenInitializedL ) );
       
  1189     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.009"), &TestSpecPrepareSCSupportedFormatWhenPreparedL ) );
       
  1190    
       
  1191     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.010"), &TestPrepareCroppedStillCapturingL ) );
       
  1192     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.011"), &TestPrepareStillCaptureWhenPowerOffL ) );
       
  1193     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.012"), &TestPrepareStillCaptureWhenRecordingL ) );
       
  1194     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.013"), &TestPrepareStillCaptrureWrongSizeL ) );
       
  1195     
       
  1196     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.GEN.RELESEANDRESERVE.002"), &TestReleaseL ) );
       
  1197     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.GEN.RELESEANDRESERVE.003"), &TestReleaseReleaseL ) );
       
  1198     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.GEN.RELESEANDRESERVE.004"), &TestReserveL ) );
       
  1199     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.GEN.RELESEANDRESERVE.005"), &TestReleaseReserveCaptureL ) );
       
  1200     
       
  1201     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.GEN.POWEROFFPOWEROFF.001"), &TestPowerOffPowerOffL ) );
       
  1202     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURESTILL.POWEROFF.002"), &TestCaptureAfterPowerOffOnL ) );
       
  1203     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.VF.STARTVIEWFINDERSTARTVIEWFINDER.001"), &TestStartVfStartVfL ) );
       
  1204     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.VF.STARTVIEWFINDERWHENPOWEROFF.001"), &TestStartVfWhenPowerOffL ) );
       
  1205         
       
  1206     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CANCEL.001"), &TestCancelCaptureStillWhenInitializedL ) );
       
  1207     
       
  1208     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CANCEL.002"), &TestCancelCaptureStillAtSnapL ) );
       
  1209 
       
  1210 #ifdef __CAMERA_BURST_MODE
       
  1211     // Only if Still BURST is supported (built in).
       
  1212     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURECAPTURESTILLBURST.3.001"), &TestCaptureCaptureStillBurst3L ) );
       
  1213     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURECAPTURESTILLBURST.3.002"), &TestSpecPrepCaptureCaptureStillBurst3L ) );
       
  1214     
       
  1215     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTCAPTURESTILL.3.001"), &TestCaptureStillBurst3CaptureStillL ) );
       
  1216     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTCAPTURESTILL.3.002"), &TestSpecPrepCaptureStillBurst3CaptureStillL ) );
       
  1217     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.CANCEL.007"), &TestCancelCaptureStillBurst3AtSnapL ) );
       
  1218     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.CANCEL.008"), &TestCancelCaptureStillBurst3AtMomentL ) );
       
  1219 
       
  1220 #if (MIRAGE_X_PROD2) || (MIRAGE_X_PROD4)
       
  1221 	suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.MP1EXIF.IGNORE.100.001"), &TestCaptureStillBurstMp1Exif100IgnoreErrorsL ) );
       
  1222 #endif
       
  1223 #if (MIRAGE_X_PROD7)
       
  1224 	suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.MP2EXIF.IGNORE.100.001"), &TestCaptureStillBurstMp2Exif100IgnoreErrorsL ) );
       
  1225 #endif
       
  1226     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.VGABITMAP.IGNORE.100.002"), &TestCaptureStillBurstVgaBitmap100IgnoreErrorsL ) );
       
  1227     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.VGAJPEG.IGNORE.100.003"), &TestCaptureStillBurstVgaJpeg100IgnoreErrorsL ) );
       
  1228 
       
  1229 #endif // __CAMERA_BURST_MODE
       
  1230 
       
  1231     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.DESTROY.001"), &TestDestroy1L ) );
       
  1232     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.DESTROY.002"), &TestDestroy2L ) );
       
  1233     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.DESTROY.003"), &TestDestroy3L ) );
       
  1234     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.DESTROY.004"), &TestDestroy4L ) );
       
  1235 
       
  1236 #ifdef __CAMERA_BURST_MODE
       
  1237     // Only if Still BURST is supported (built in).
       
  1238     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.DESTROY.005"), &TestDestroy5L ) );
       
  1239     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.DESTROY.006"), &TestDestroy6L ) );    
       
  1240     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.DESTROY.007"), &TestDestroy7L ) );
       
  1241 #endif
       
  1242     
       
  1243     #ifdef CAE_TEST_VERSION
       
  1244     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.ERRORS.001"), &TestEncodingErrorL ) );
       
  1245     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.ERRORS.002"), &TestPowerErrorL ) );
       
  1246     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.ERRORS.003"), &TestReserveErrorL ) );
       
  1247     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.ERRORS.004"), &TestStillCaptureErrorL ) );
       
  1248 #if (MIRAGE_X_PROD2) || (MIRAGE_X_PROD4)
       
  1249     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.ERRORS.005"), &TestSnapImageErrorL ) );
       
  1250 #endif
       
  1251     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.ERRORS.006"), &TestStillImageErrorL ) );
       
  1252     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.ERRORS.007"), &TestStillConvertError1L ) );
       
  1253     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.ERRORS.008"), &TestStillConvertError2L ) );
       
  1254     // suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.ERRORS.009"), &TestStillConvertError3L ) );
       
  1255     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.SETCAMERAINDEX.001"), &TestSetCameraIndexLowL ) );
       
  1256     suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.SETCAMERAINDEX.002"), &TestSetCameraIndexHighL ) );
       
  1257 #endif
       
  1258     return suite;
       
  1259     }
       
  1260 
       
  1261 
       
  1262 
       
  1263