os/graphics/graphicstest/uibench/src/tmultiptreventhandlingperf.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // teventhandlingperf.h
    15 // 
    16 //
    17 
    18 /**
    19  @file
    20  @test
    21  @internalComponent - Internal Symbian test code 
    22 */
    23 
    24 
    25 #ifndef __TMULTIPTREVENTHANDLINGPERF_H__
    26 #define __TMULTIPTREVENTHANDLINGPERF_H__
    27 
    28 #include <e32base.h>
    29 #include <coemain.h>
    30 #include <coeaui.h>
    31 #include <coecntrl.h>
    32 
    33 _LIT(KChunkName,"MULTIPOINTERSHAREDCHUNK");
    34 
    35 
    36 enum TMultiPtrPerfPanics
    37 	{
    38 	EMultiPtrPerfPanicWrongTest,
    39 	};
    40 
    41 class CMultiPtrPerfTestAppUi;
    42 
    43 class CMultiPtrPerfTestControl : public CCoeControl
    44 	{
    45 	enum {EEventBufferSize=32};
    46 public:
    47 	~CMultiPtrPerfTestControl();
    48 	void ConstructL();
    49 	void ConstructL(TPoint aOrigin, TSize aSize);
    50 	TInt CalculateLatencyAndStartThread();
    51 	void AddExpectedEvent(TAdvancedPointerEvent& aExpEvent);
    52 	TInt Failed(TPoint3D aExp3DPoint, TPoint3D aActual3DPoint, TInt aErrorCode = 0, TInt aExpPtrNum = 0, TInt aActPtrNum = 0);
    53 	TInt PointerEventsNotSupported();
    54 	
    55 	// From CCoeControl
    56 	void HandlePointerEventL(const TPointerEvent& aPointerEvent);
    57 
    58 protected:
    59 	CCirBuf<TAdvancedPointerEvent> iEventBuffer;
    60 	CMultiPtrPerfTestAppUi* iPtrAppUi;
    61 	RChunk iChunk;
    62 	TInt iLatLenInLetters;
    63 	TInt64 iAverageLatency;
    64 	TInt64 iLatency;
    65 	TInt iChunkOffset;
    66 	TBool iPointerEventNotSupported;
    67 	};
    68 
    69 class CMultiPtrPerfTestAppUi : public CCoeAppUi
    70 	{
    71 public:
    72 	CMultiPtrPerfTestAppUi();
    73 	~CMultiPtrPerfTestAppUi();
    74 	
    75 	void ConstructL();
    76 	TInt CreateEventSimulatingThreads();
    77 	TInt64 TestStartTime() {return iTestStartTime;}
    78 	TInt& TestCaseNum() {return iTestCaseNum;}
    79 	void AddExpectedEvent(TAdvancedPointerEvent& aExpEvent);
    80 	void Failed(TPoint3D aExp3DPoint, TPoint3D aActual3DPoint, TInt aErrorCode = 0, TInt aExpPtrNum = 0, TInt aActPtrNum = 0);
    81 	void PointerEventsNotSupported();
    82 	void CloseThread() {iThread.Close();}
    83 	void SetNumberOfEvents(TInt aNumEvents) {iNumEvents = aNumEvents;}
    84 	void DecrementEventCount() {--iNumEvents;}
    85 	TInt EventCount() {return iNumEvents;}
    86 	RThread& ChildThread() {return iThread;}
    87 	
    88 private:
    89 	TInt iTestCaseNum;
    90 	TInt64 iTestStartTime;
    91 	CMultiPtrPerfTestControl* iControl;
    92 	RThread iThread;
    93 	TInt iNumEvents;
    94 	};
    95 
    96 #endif // __TMULTIPTREVENTHANDLINGPERF_H__