sl@0: // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @test sl@0: @internalComponent - Internal Symbian test code sl@0: */ sl@0: sl@0: #ifndef __TKREPEAT_H__ sl@0: #define __TKREPEAT_H__ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include "../tlib/testbase.h" sl@0: #include "AUTO.H" sl@0: #include "TGraphicsHarness.h" sl@0: sl@0: class CRKWindow; sl@0: sl@0: class CTKRepeat : public CTWsGraphicsBase sl@0: { sl@0: friend class CRKWindow; sl@0: public: sl@0: CTKRepeat(CTestStep* aStep); sl@0: ~CTKRepeat(); sl@0: void ConstructL(); sl@0: void TestKeyboardRepeatRateL(const TTimeIntervalMicroSeconds32 &aInitialTime, const TTimeIntervalMicroSeconds32 &aTime); sl@0: TBool CheckReportL(); sl@0: public: sl@0: TBool iAbort; sl@0: protected: sl@0: //from CTGraphicsStep sl@0: virtual void RunTestCaseL(TInt aCurTestCase); sl@0: private: sl@0: inline TestClient *Client() {return TheClient;} sl@0: private: sl@0: TTimeIntervalMicroSeconds32 iOldInitialTime; sl@0: TTimeIntervalMicroSeconds32 iOldTime; sl@0: CRKWindow *iWin; sl@0: TSize iWinSize; sl@0: TInt iState; sl@0: }; sl@0: sl@0: class CRKWindow : public CTWin sl@0: { sl@0: enum TRKStates { sl@0: EStateWaitingForKeyDown, sl@0: EStateWaitingForKeyCode, sl@0: EStateWaitingForFirstRepeat, sl@0: EStateWaitingForNthRepeat, sl@0: EStateWaitingForKeyUp, sl@0: EStateInactive, sl@0: EStateError, sl@0: }; sl@0: public: sl@0: CRKWindow(CTKRepeat *aTest); sl@0: void SetUpL(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc); sl@0: void SetState(TRKStates aState); sl@0: void SetKeyboardRepeatRate(const TTimeIntervalMicroSeconds32 &aInitialTime, const TTimeIntervalMicroSeconds32 &aTime); sl@0: void WinKeyL(const TKeyEvent &,const TTime &); sl@0: void KeyUpL(const TKeyEvent &aKey,const TTime &aTime); sl@0: void KeyDownL(const TKeyEvent &aKey,const TTime &aTime); sl@0: void Draw(); sl@0: TDesC& Report(); sl@0: TBool CheckResults(); sl@0: void SendEvent(); sl@0: protected: sl@0: TInt iConnIndex; sl@0: CTKRepeat *iTest; sl@0: TRgb iBack; sl@0: TRKStates iState; sl@0: TInt iDownCode; sl@0: TInt iRepCount; sl@0: TTimeIntervalMicroSeconds32 iInitialRepeatSet; sl@0: TTimeIntervalMicroSeconds32 iRepeatSet; sl@0: TTime iPrevTime; sl@0: TTimeIntervalMicroSeconds32 iInitialGap; sl@0: TTimeIntervalMicroSeconds32 iTotalGap; sl@0: TTimeIntervalMicroSeconds32 iMinGap; sl@0: TTimeIntervalMicroSeconds32 iMaxGap; sl@0: TBuf<0x40> iReport; sl@0: }; sl@0: sl@0: class CTKRepeatStep : public CTGraphicsStep sl@0: { sl@0: public: sl@0: CTKRepeatStep(); sl@0: protected: sl@0: //from CTGraphicsStep sl@0: virtual CTGraphicsBase* CreateTestL(); sl@0: }; sl@0: sl@0: _LIT(KTKRepeatStep,"TKRepeat"); sl@0: sl@0: sl@0: #endif