1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/test/tauto/TKRepeat.H Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,110 @@
1.4 +// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +/**
1.20 + @file
1.21 + @test
1.22 + @internalComponent - Internal Symbian test code
1.23 +*/
1.24 +
1.25 +#ifndef __TKREPEAT_H__
1.26 +#define __TKREPEAT_H__
1.27 +
1.28 +#include <e32std.h>
1.29 +#include <e32svr.h>
1.30 +#include <w32std.h>
1.31 +#include "../tlib/testbase.h"
1.32 +#include "AUTO.H"
1.33 +#include "TGraphicsHarness.h"
1.34 +
1.35 +class CRKWindow;
1.36 +
1.37 +class CTKRepeat : public CTWsGraphicsBase
1.38 + {
1.39 + friend class CRKWindow;
1.40 +public:
1.41 + CTKRepeat(CTestStep* aStep);
1.42 + ~CTKRepeat();
1.43 + void ConstructL();
1.44 + void TestKeyboardRepeatRateL(const TTimeIntervalMicroSeconds32 &aInitialTime, const TTimeIntervalMicroSeconds32 &aTime);
1.45 + TBool CheckReportL();
1.46 +public:
1.47 + TBool iAbort;
1.48 +protected:
1.49 +//from CTGraphicsStep
1.50 + virtual void RunTestCaseL(TInt aCurTestCase);
1.51 +private:
1.52 + inline TestClient *Client() {return TheClient;}
1.53 +private:
1.54 + TTimeIntervalMicroSeconds32 iOldInitialTime;
1.55 + TTimeIntervalMicroSeconds32 iOldTime;
1.56 + CRKWindow *iWin;
1.57 + TSize iWinSize;
1.58 + TInt iState;
1.59 + };
1.60 +
1.61 +class CRKWindow : public CTWin
1.62 + {
1.63 + enum TRKStates {
1.64 + EStateWaitingForKeyDown,
1.65 + EStateWaitingForKeyCode,
1.66 + EStateWaitingForFirstRepeat,
1.67 + EStateWaitingForNthRepeat,
1.68 + EStateWaitingForKeyUp,
1.69 + EStateInactive,
1.70 + EStateError,
1.71 + };
1.72 +public:
1.73 + CRKWindow(CTKRepeat *aTest);
1.74 + void SetUpL(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc);
1.75 + void SetState(TRKStates aState);
1.76 + void SetKeyboardRepeatRate(const TTimeIntervalMicroSeconds32 &aInitialTime, const TTimeIntervalMicroSeconds32 &aTime);
1.77 + void WinKeyL(const TKeyEvent &,const TTime &);
1.78 + void KeyUpL(const TKeyEvent &aKey,const TTime &aTime);
1.79 + void KeyDownL(const TKeyEvent &aKey,const TTime &aTime);
1.80 + void Draw();
1.81 + TDesC& Report();
1.82 + TBool CheckResults();
1.83 + void SendEvent();
1.84 +protected:
1.85 + TInt iConnIndex;
1.86 + CTKRepeat *iTest;
1.87 + TRgb iBack;
1.88 + TRKStates iState;
1.89 + TInt iDownCode;
1.90 + TInt iRepCount;
1.91 + TTimeIntervalMicroSeconds32 iInitialRepeatSet;
1.92 + TTimeIntervalMicroSeconds32 iRepeatSet;
1.93 + TTime iPrevTime;
1.94 + TTimeIntervalMicroSeconds32 iInitialGap;
1.95 + TTimeIntervalMicroSeconds32 iTotalGap;
1.96 + TTimeIntervalMicroSeconds32 iMinGap;
1.97 + TTimeIntervalMicroSeconds32 iMaxGap;
1.98 + TBuf<0x40> iReport;
1.99 + };
1.100 +
1.101 +class CTKRepeatStep : public CTGraphicsStep
1.102 + {
1.103 +public:
1.104 + CTKRepeatStep();
1.105 +protected:
1.106 + //from CTGraphicsStep
1.107 + virtual CTGraphicsBase* CreateTestL();
1.108 + };
1.109 +
1.110 +_LIT(KTKRepeatStep,"TKRepeat");
1.111 +
1.112 +
1.113 +#endif