uifw/AvKon/tsrc/bc/bctestutil/inc/bctestkeyfeeder.h
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2006-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:  Emulate key or pointer event.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CBCTESTKEYFEEDER_H
       
    20 #define C_CBCTESTKEYFEEDER_H
       
    21 
       
    22 #include    <eikenv.h>
       
    23 
       
    24 #include    "bctestutil.h"
       
    25 
       
    26 class CBCTestSuite;
       
    27 class CEikonEnv;
       
    28 
       
    29 /**
       
    30  *  CBCTestKeyFeeder for autotests
       
    31  */
       
    32 class CBCTestKeyFeeder : public CBase
       
    33     {
       
    34 public:
       
    35 
       
    36 // Constructors and destructor
       
    37 
       
    38     /**
       
    39      * C++ default constructor.
       
    40      */
       
    41     CBCTestKeyFeeder();
       
    42 
       
    43     /**
       
    44      * Destructor.
       
    45      */
       
    46     virtual ~CBCTestKeyFeeder();
       
    47 
       
    48 // New functions
       
    49 
       
    50     /**
       
    51      * Periodic function called every 0.1 seconds
       
    52      * The function is a callback used by CPeriodic, so it have
       
    53      * to conform to demanded format, it has to return TInt.
       
    54      * @param aThis Pointer to this (CBCTestKeyFeeder)
       
    55      * @return Always return 0
       
    56      */
       
    57     static TInt PeriodicKeyFeederL(TAny* aThis);
       
    58 
       
    59     /**
       
    60      * Handles autotest commands (big switch case)
       
    61      */
       
    62     void HandleAutoCommandL();
       
    63 
       
    64     /**
       
    65      * Pauses timer temporarily
       
    66      */
       
    67     void PauseTimer();
       
    68 
       
    69     /**
       
    70      * Resumes timer
       
    71      */
       
    72     void ResumeTimer();
       
    73 
       
    74     /*
       
    75      * Start auto test
       
    76      * @param aAutoTest, a structure containes autotest scripts of every
       
    77      * test case.
       
    78      */
       
    79     void StartAutoTestL(SAutoTest* aAutoTest);
       
    80 
       
    81     /**
       
    82      * Set test suite pointer, key feeder will pass some event to suite to
       
    83      * handle durint automatic test process.
       
    84      */
       
    85     void SetSuite( CBCTestSuite* aSuite );
       
    86 
       
    87 private:
       
    88 
       
    89 // new functions
       
    90 
       
    91     /**
       
    92      * Simulates key down press using window server
       
    93      * @param aScanCode
       
    94      */
       
    95     void KeyDown(TInt aScanCode);
       
    96 
       
    97     /**
       
    98      * Simulates key down press using window server
       
    99      * @param aScanCode
       
   100      */
       
   101     void KeyUp(TInt aScanCode);
       
   102 
       
   103     /**
       
   104      * Simulates key press using window server
       
   105      * @param aScanCode
       
   106      */
       
   107     void KeyPress(TInt aCode, TInt aScanCode);
       
   108 
       
   109     /**
       
   110      * Simulates pointer event
       
   111      * @param aEvent
       
   112      */
       
   113     void PointerEvent(TRawEvent& aEvent);
       
   114 
       
   115 private: //data
       
   116 
       
   117     /**
       
   118      * Not Own.
       
   119      */
       
   120     CBCTestSuite* iSuite;
       
   121 
       
   122     /**
       
   123      * Not Own.
       
   124      */
       
   125     CEikonEnv* iEikEnv;
       
   126 
       
   127     /**
       
   128      * For changing delays between key feeds
       
   129      */
       
   130     TInt iTickCount;
       
   131     TInt iTickCounter;
       
   132 
       
   133     /**
       
   134      * active object
       
   135      */
       
   136     CPeriodic* iPeriodic;
       
   137 
       
   138     /**
       
   139      * Not Own.
       
   140      */
       
   141     SAutoTest* iAutoTest;
       
   142 
       
   143     /**
       
   144      * Not Own.
       
   145      */
       
   146     const TInt* iScriptCommands;
       
   147 
       
   148     TInt iScriptIndex;
       
   149     TInt iIndex;
       
   150 
       
   151     TInt iWaitCount;
       
   152     TInt iRepeat;
       
   153     TInt iCommand;
       
   154     TInt iRepeatCommand;
       
   155 
       
   156     /**
       
   157      * for key down presses
       
   158      */
       
   159     TBool iKeyDown;
       
   160 
       
   161     /**
       
   162      * for key up presses
       
   163      */
       
   164     TBool iKeyUp;
       
   165 
       
   166     /**
       
   167      * State of modifier keys
       
   168      */
       
   169     TUint iModifiers;
       
   170     TUint iOldModifiers;
       
   171 
       
   172     TInt iOutlineCount;
       
   173 
       
   174     TBool iTimerPaused;
       
   175 
       
   176     /**
       
   177      * conditional sequence support
       
   178      */
       
   179     TBool      iDoElse;
       
   180     TInt       iIfCount;
       
   181 
       
   182     };
       
   183 
       
   184 #endif // C_CBCTESTKEYFEEDER_H