uifw/AvKon/tsrc/bc/bctesttemplate/src/bctesttemplatecase.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2007 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:  test case
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <w32std.h>
       
    20 #include <coecntrl.h>
       
    21 
       
    22 #include "bctesttemplatecase.h"
       
    23 #include "bctesttemplatecontainer.h"
       
    24 #include "bctesttemplate.hrh"
       
    25 
       
    26 
       
    27 // ======== MEMBER FUNCTIONS ========
       
    28 
       
    29 // ---------------------------------------------------------------------------
       
    30 // Symbian 2nd static Constructor
       
    31 // ---------------------------------------------------------------------------
       
    32 //
       
    33 CBCTestTemplateCase* CBCTestTemplateCase::NewL( CBCTestTemplateContainer* 
       
    34     aContainer )
       
    35     {
       
    36     CBCTestTemplateCase* self = new( ELeave ) CBCTestTemplateCase( 
       
    37         aContainer );
       
    38     CleanupStack::PushL( self );
       
    39     self->ConstructL();
       
    40     CleanupStack::Pop( self );
       
    41     return self;
       
    42     }
       
    43     
       
    44 // ---------------------------------------------------------------------------
       
    45 // C++ default constructor
       
    46 // ---------------------------------------------------------------------------
       
    47 //
       
    48 CBCTestTemplateCase::CBCTestTemplateCase( CBCTestTemplateContainer* 
       
    49     aContainer )
       
    50     : iContainer( aContainer )
       
    51     {    
       
    52     }
       
    53     
       
    54 // ---------------------------------------------------------------------------
       
    55 // Destructor
       
    56 // ---------------------------------------------------------------------------
       
    57 //
       
    58 CBCTestTemplateCase::~CBCTestTemplateCase()
       
    59     {  
       
    60     }
       
    61     
       
    62 // ---------------------------------------------------------------------------
       
    63 // Symbian 2nd Constructor
       
    64 // ---------------------------------------------------------------------------
       
    65 //
       
    66 void CBCTestTemplateCase::ConstructL()
       
    67     {    
       
    68     BuildScriptL();    
       
    69     }
       
    70     
       
    71 // ---------------------------------------------------------------------------
       
    72 // CBCTestTemplateCase::BuildScriptL
       
    73 // ---------------------------------------------------------------------------
       
    74 //
       
    75 void CBCTestTemplateCase::BuildScriptL()
       
    76     { 
       
    77     // Add script as your need.   
       
    78     AddTestL( DELAY(1), LeftCBA, KeyOK, TEND );    
       
    79     }
       
    80     
       
    81 // ---------------------------------------------------------------------------
       
    82 // CBCTestTemplateCase::RunL
       
    83 // ---------------------------------------------------------------------------
       
    84 //
       
    85 void CBCTestTemplateCase::RunL( TInt aCmd )
       
    86     {
       
    87     if ( aCmd < EBCTestCmdOutline1 || aCmd > EBCTestCmdOutline1 )
       
    88         {
       
    89         return;
       
    90         }
       
    91     // Call release before prepare to let container has time to draw the 
       
    92     // control created in PrepareCaseL.
       
    93     ReleaseCaseL();
       
    94     PrepareCaseL( aCmd );
       
    95     switch ( aCmd )  
       
    96         {
       
    97         case EBCTestCmdOutline1:
       
    98             TestFunction();
       
    99             break;
       
   100         default:
       
   101             break;
       
   102         }
       
   103     }
       
   104 
       
   105 // ---------------------------------------------------------------------------
       
   106 // CBCTestTemplateCase::PrepareCaseL
       
   107 // ---------------------------------------------------------------------------
       
   108 //
       
   109 void CBCTestTemplateCase::PrepareCaseL( TInt aCmd )
       
   110     {        
       
   111     switch ( aCmd )
       
   112         {
       
   113         case EBCTestCmdOutline1:
       
   114             // Here is a simple demo. You should create your control 
       
   115             // instead of this.
       
   116             iControl = new( ELeave ) CCoeControl();            
       
   117             iControl->SetContainerWindowL( *iContainer );
       
   118             iControl->MakeVisible( ETrue );
       
   119             break;
       
   120         default:
       
   121             break;
       
   122         }
       
   123     // Pass the owner of iControl to iContainer.
       
   124     iContainer->SetControl( iControl );
       
   125     }
       
   126 
       
   127 // ---------------------------------------------------------------------------
       
   128 // CBCTestTemplateCase::ReleaseCaseL
       
   129 // ---------------------------------------------------------------------------
       
   130 //   
       
   131 void CBCTestTemplateCase::ReleaseCaseL()
       
   132     {
       
   133     // let container delete the component control.
       
   134     iContainer->ResetControl();
       
   135     iControl = NULL;
       
   136     }
       
   137 
       
   138 // ---------------------------------------------------------------------------
       
   139 // CBCTestTemplateCase::TestLayoutDecorator
       
   140 // ---------------------------------------------------------------------------
       
   141 //    
       
   142 void CBCTestTemplateCase::TestFunction()
       
   143     {
       
   144     // Test some API here
       
   145     }
       
   146