os/graphics/graphicscomposition/surfaceupdate/tsrc/tsurfaceupdateinteg.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
sl@0
    17
sl@0
    18
/**
sl@0
    19
 @file
sl@0
    20
 @test
sl@0
    21
 @internalComponent - Internal Symbian test code 
sl@0
    22
*/
sl@0
    23
sl@0
    24
sl@0
    25
#ifndef __TSURFACEUPDATEINTEG_H__
sl@0
    26
#define __TSURFACEUPDATEINTEG_H__
sl@0
    27
sl@0
    28
#include <test/testexecutestepbase.h>
sl@0
    29
#include <test/tgraphicsharness.h>
sl@0
    30
#include "surfaceupdateserver.h"
sl@0
    31
#include "surfaceupdateclient.h"
sl@0
    32
#include <graphics/surface.h>
sl@0
    33
sl@0
    34
sl@0
    35
class CTWindowGroup;
sl@0
    36
class CTWindowTreeNode;
sl@0
    37
class CTRedrawHandler;
sl@0
    38
class CSurfaceHelper;
sl@0
    39
class CTWindow;
sl@0
    40
sl@0
    41
/**
sl@0
    42
 * Main class for installing a test environment and running test cases. 
sl@0
    43
 */
sl@0
    44
class CTSurfaceUpdateInteg : public CTGraphicsBase
sl@0
    45
	{
sl@0
    46
public:
sl@0
    47
	CTSurfaceUpdateInteg(CTestStep* aStep);
sl@0
    48
	~CTSurfaceUpdateInteg();
sl@0
    49
	void ConstructL();
sl@0
    50
protected:
sl@0
    51
//from 	CTGraphicsStep
sl@0
    52
	virtual void RunTestCaseL(TInt aCurTestCase);
sl@0
    53
private:
sl@0
    54
	void TestCase1L();
sl@0
    55
	void TestCase2L();
sl@0
    56
	void TestCase3();
sl@0
    57
	
sl@0
    58
	CTWindowGroup* CreateGroupL(CWsScreenDevice* aScreenDevice);
sl@0
    59
	void RegisterWindowL(CTWindowTreeNode* aWindow);
sl@0
    60
	TBool CompareAllScreens();
sl@0
    61
	TBool Compare(TInt aScreenNumber, const TRect& aRectSrc, CFbsBitmap* aOriginalBitmap);
sl@0
    62
	void FillRefBitmap(TRgb aColor);
sl@0
    63
private:
sl@0
    64
	TInt iNumOfScreens;
sl@0
    65
	RWsSession iWs;
sl@0
    66
	RSurfaceUpdateSession iSurfaceUpdate; 
sl@0
    67
	
sl@0
    68
	RPointerArray <CWsScreenDevice> iWsDevs;
sl@0
    69
	RPointerArray <CWindowGc> iGcs;
sl@0
    70
sl@0
    71
	RPointerArray <CTWindowGroup> iGroups;
sl@0
    72
	RPointerArray <CTWindowTreeNode> iWindows;
sl@0
    73
	CTRedrawHandler* iRedrawHandler;
sl@0
    74
	CSurfaceHelper* iSurfaceHelper;
sl@0
    75
	TSurfaceId iSurface; //doesn't own
sl@0
    76
	TSurfaceId iSurfaceAbove; //doesn't own
sl@0
    77
	TSurfaceId iSurfaceAbove1; //bigger size, doesn't own
sl@0
    78
	TSurfaceId iSurfaceDoubleBuffered; //doesn't own
sl@0
    79
	RPointerArray<CFbsBitmap> iBitmaps; //the list of bitmaps where each bitmap corresponds to particular screen
sl@0
    80
	CTWindow *iWindowAbove1; //on first screen, doesn't own
sl@0
    81
	CTWindow *iWindowAbove11; //on first screen, bigger size, doesn't own
sl@0
    82
	CTWindow *iWindowAbove2; //on second screen, doesn't own
sl@0
    83
	CTWindow *iWindowSingleBuffured1; //on first screen, doesn't own
sl@0
    84
	CTWindow *iWindowSingleBuffured2; //on second screen, doesn't own
sl@0
    85
	CTWindow *iWindowDoubleBuffured1; //on first screen, doesn't own
sl@0
    86
	CTWindow *iWindowDoubleBuffured2; //on second screen, doesn't own
sl@0
    87
	
sl@0
    88
	
sl@0
    89
	CFbsBitmap* iRefBitmap; //used for comparison
sl@0
    90
	CFbsBitmapDevice* iBitmapDevice;
sl@0
    91
	CGraphicsContext* iGraphicsContext;
sl@0
    92
	};
sl@0
    93
sl@0
    94
class CTSurfaceUpdateIntegStep : public CTGraphicsStep
sl@0
    95
	{
sl@0
    96
public:
sl@0
    97
	CTSurfaceUpdateIntegStep();
sl@0
    98
	inline TBool IsScreenCaptureSupported() const;
sl@0
    99
sl@0
   100
private:	
sl@0
   101
	//from CTGraphicsStep
sl@0
   102
	virtual CTGraphicsBase* CreateTestL();
sl@0
   103
	virtual void TestSetupL();
sl@0
   104
	virtual void TestClose();
sl@0
   105
private:
sl@0
   106
	TBool iScreenCapture; //signifies if screen capture is supported or not 
sl@0
   107
	};
sl@0
   108
sl@0
   109
inline TBool CTSurfaceUpdateIntegStep::IsScreenCaptureSupported() const
sl@0
   110
	{
sl@0
   111
	return iScreenCapture;
sl@0
   112
	}
sl@0
   113
sl@0
   114
sl@0
   115
struct TSwitchDisplayAndReleaseBuffer
sl@0
   116
	{
sl@0
   117
	TInt iBuffer; //buffer for submission
sl@0
   118
	TInt iScreen; //screen to be connected/disconnected
sl@0
   119
	TSurfaceId iSurfaceId;
sl@0
   120
	};
sl@0
   121
sl@0
   122
/**
sl@0
   123
 * The class executes specified commands in a separate thread.
sl@0
   124
 * Will be used when a main thread is blocked and waits for notifications to arrive. 
sl@0
   125
 */
sl@0
   126
class CCommandDispatcher : public CBase
sl@0
   127
	{
sl@0
   128
public:	
sl@0
   129
enum CommandName
sl@0
   130
	{
sl@0
   131
	EDisconnectDisplayAndReleaseBuffer,
sl@0
   132
	EConnectDisplayAndReleaseBuffer
sl@0
   133
	};
sl@0
   134
	CCommandDispatcher(CommandName aCommandName, TAny* aPram) :
sl@0
   135
		iCommandName(aCommandName), iParam(aPram){}
sl@0
   136
	TInt Start();
sl@0
   137
private:
sl@0
   138
	static TInt ThreadFunction(TAny*);
sl@0
   139
	void ExecuteCommandL();
sl@0
   140
private:
sl@0
   141
	CommandName iCommandName;
sl@0
   142
	TAny* iParam;
sl@0
   143
	};
sl@0
   144
sl@0
   145
_LIT(KTSurfaceUpdateIntegStep,"TSurfaceUpdateInteg");
sl@0
   146
sl@0
   147
sl@0
   148
#endif	// __TSURFACEUPDATEINTEG_H__