uiacceltk/hitchcock/tsrc/alfperfapp/src/alfperfapptestcasefactory.cpp
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     1 /*
       
     2 * Copyright (c) 2008 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:  CAlfPerfAppTestCaseFactory implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "alfperfapptestcasefactory.h"
       
    20 
       
    21 #include "alfperfappframeworktestcase.h"
       
    22 #include "alfperfappimagetestcase.h"
       
    23 #include "alfperfapplayouttestcase.h"
       
    24 #include "alfperfapptexttestcase.h"
       
    25 #include "alfperfappcovertestcase.h"
       
    26 #include "alfperfappsuitetestcase.h"
       
    27 #include "alfperfappgallerytestcase.h"
       
    28 #include "alfperfappgallerytestcase.h"
       
    29 #include "alfperfappavkontestcase.h"
       
    30 
       
    31 // ============================ MEMBER FUNCTIONS ===============================
       
    32 
       
    33 CAlfPerfAppTestCaseFactory* CAlfPerfAppTestCaseFactory::NewL()
       
    34     {
       
    35     CAlfPerfAppTestCaseFactory* self = new (ELeave) CAlfPerfAppTestCaseFactory;
       
    36     return self;
       
    37     }
       
    38 
       
    39 CAlfPerfAppTestCaseFactory::~CAlfPerfAppTestCaseFactory()
       
    40     {
       
    41     }
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 // Creates test case corresponding to the aCaseId.
       
    45 //  - If the case is a sequence case (marked by negative case id), pass the sequence
       
    46 //    index to the case. Otherwise set it to 0 (to mark a non-sequence case)
       
    47 //  - This is done because same cases can be called with or without sequence
       
    48 //    functionality
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 CAlfPerfAppTestCase* CAlfPerfAppTestCaseFactory::CreateL( TInt aCaseId, TInt aSequenceIndex )
       
    52     {
       
    53     TInt index = 0;
       
    54     if(aCaseId < 0) // If this is a sequence case
       
    55         {
       
    56         aCaseId *= -1;
       
    57         index = aSequenceIndex;
       
    58         }
       
    59     
       
    60     if ( CAlfPerfAppFrameworkTestCase::IsSupported( aCaseId ) )
       
    61         {
       
    62         return CAlfPerfAppFrameworkTestCase::NewL( aCaseId, index);
       
    63         }
       
    64         
       
    65     if ( CAlfPerfAppImageTestCase::IsSupported( aCaseId ) )
       
    66         {
       
    67         return CAlfPerfAppImageTestCase::NewL( aCaseId, index );
       
    68         }
       
    69 
       
    70     if ( CAlfPerfAppLayoutTestCase::IsSupported( aCaseId ) )
       
    71         {
       
    72         return CAlfPerfAppLayoutTestCase::NewL( aCaseId, index );
       
    73         }
       
    74         
       
    75     if ( CAlfPerfAppTextTestCase::IsSupported( aCaseId ) )
       
    76         {
       
    77         return CAlfPerfAppTextTestCase::NewL( aCaseId, index );
       
    78         }   
       
    79     if ( CAlfPerfAppCoverTestCase::IsSupported( aCaseId ) )
       
    80         {
       
    81         return CAlfPerfAppCoverTestCase::NewL( aCaseId, index );
       
    82         }
       
    83 
       
    84     if ( CAlfPerfAppSuiteTestCase::IsSupported( aCaseId ) )
       
    85         {
       
    86         return CAlfPerfAppSuiteTestCase::NewL( aCaseId, index );
       
    87         }    
       
    88 
       
    89     if ( CAlfPerfAppGalleryTestCase::IsSupported( aCaseId ) )
       
    90         {
       
    91         return CAlfPerfAppGalleryTestCase::NewL( aCaseId, index );
       
    92         }
       
    93     
       
    94     if ( CAlfPerfAppAvkonTestCase::IsSupported( aCaseId ) )
       
    95         {
       
    96         return CAlfPerfAppAvkonTestCase::NewL( aCaseId, index );
       
    97         }
       
    98     
       
    99     User::Leave( KErrNotSupported );
       
   100     return NULL;
       
   101     }
       
   102 
       
   103 CAlfPerfAppTestCaseFactory::CAlfPerfAppTestCaseFactory()
       
   104     {
       
   105     }
       
   106