1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/graphicscomposition/surfaceupdate/tsrc/tsurfaceupdateinteg.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,148 @@
1.4 +// Copyright (c) 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 +
1.21 +/**
1.22 + @file
1.23 + @test
1.24 + @internalComponent - Internal Symbian test code
1.25 +*/
1.26 +
1.27 +
1.28 +#ifndef __TSURFACEUPDATEINTEG_H__
1.29 +#define __TSURFACEUPDATEINTEG_H__
1.30 +
1.31 +#include <test/testexecutestepbase.h>
1.32 +#include <test/tgraphicsharness.h>
1.33 +#include "surfaceupdateserver.h"
1.34 +#include "surfaceupdateclient.h"
1.35 +#include <graphics/surface.h>
1.36 +
1.37 +
1.38 +class CTWindowGroup;
1.39 +class CTWindowTreeNode;
1.40 +class CTRedrawHandler;
1.41 +class CSurfaceHelper;
1.42 +class CTWindow;
1.43 +
1.44 +/**
1.45 + * Main class for installing a test environment and running test cases.
1.46 + */
1.47 +class CTSurfaceUpdateInteg : public CTGraphicsBase
1.48 + {
1.49 +public:
1.50 + CTSurfaceUpdateInteg(CTestStep* aStep);
1.51 + ~CTSurfaceUpdateInteg();
1.52 + void ConstructL();
1.53 +protected:
1.54 +//from CTGraphicsStep
1.55 + virtual void RunTestCaseL(TInt aCurTestCase);
1.56 +private:
1.57 + void TestCase1L();
1.58 + void TestCase2L();
1.59 + void TestCase3();
1.60 +
1.61 + CTWindowGroup* CreateGroupL(CWsScreenDevice* aScreenDevice);
1.62 + void RegisterWindowL(CTWindowTreeNode* aWindow);
1.63 + TBool CompareAllScreens();
1.64 + TBool Compare(TInt aScreenNumber, const TRect& aRectSrc, CFbsBitmap* aOriginalBitmap);
1.65 + void FillRefBitmap(TRgb aColor);
1.66 +private:
1.67 + TInt iNumOfScreens;
1.68 + RWsSession iWs;
1.69 + RSurfaceUpdateSession iSurfaceUpdate;
1.70 +
1.71 + RPointerArray <CWsScreenDevice> iWsDevs;
1.72 + RPointerArray <CWindowGc> iGcs;
1.73 +
1.74 + RPointerArray <CTWindowGroup> iGroups;
1.75 + RPointerArray <CTWindowTreeNode> iWindows;
1.76 + CTRedrawHandler* iRedrawHandler;
1.77 + CSurfaceHelper* iSurfaceHelper;
1.78 + TSurfaceId iSurface; //doesn't own
1.79 + TSurfaceId iSurfaceAbove; //doesn't own
1.80 + TSurfaceId iSurfaceAbove1; //bigger size, doesn't own
1.81 + TSurfaceId iSurfaceDoubleBuffered; //doesn't own
1.82 + RPointerArray<CFbsBitmap> iBitmaps; //the list of bitmaps where each bitmap corresponds to particular screen
1.83 + CTWindow *iWindowAbove1; //on first screen, doesn't own
1.84 + CTWindow *iWindowAbove11; //on first screen, bigger size, doesn't own
1.85 + CTWindow *iWindowAbove2; //on second screen, doesn't own
1.86 + CTWindow *iWindowSingleBuffured1; //on first screen, doesn't own
1.87 + CTWindow *iWindowSingleBuffured2; //on second screen, doesn't own
1.88 + CTWindow *iWindowDoubleBuffured1; //on first screen, doesn't own
1.89 + CTWindow *iWindowDoubleBuffured2; //on second screen, doesn't own
1.90 +
1.91 +
1.92 + CFbsBitmap* iRefBitmap; //used for comparison
1.93 + CFbsBitmapDevice* iBitmapDevice;
1.94 + CGraphicsContext* iGraphicsContext;
1.95 + };
1.96 +
1.97 +class CTSurfaceUpdateIntegStep : public CTGraphicsStep
1.98 + {
1.99 +public:
1.100 + CTSurfaceUpdateIntegStep();
1.101 + inline TBool IsScreenCaptureSupported() const;
1.102 +
1.103 +private:
1.104 + //from CTGraphicsStep
1.105 + virtual CTGraphicsBase* CreateTestL();
1.106 + virtual void TestSetupL();
1.107 + virtual void TestClose();
1.108 +private:
1.109 + TBool iScreenCapture; //signifies if screen capture is supported or not
1.110 + };
1.111 +
1.112 +inline TBool CTSurfaceUpdateIntegStep::IsScreenCaptureSupported() const
1.113 + {
1.114 + return iScreenCapture;
1.115 + }
1.116 +
1.117 +
1.118 +struct TSwitchDisplayAndReleaseBuffer
1.119 + {
1.120 + TInt iBuffer; //buffer for submission
1.121 + TInt iScreen; //screen to be connected/disconnected
1.122 + TSurfaceId iSurfaceId;
1.123 + };
1.124 +
1.125 +/**
1.126 + * The class executes specified commands in a separate thread.
1.127 + * Will be used when a main thread is blocked and waits for notifications to arrive.
1.128 + */
1.129 +class CCommandDispatcher : public CBase
1.130 + {
1.131 +public:
1.132 +enum CommandName
1.133 + {
1.134 + EDisconnectDisplayAndReleaseBuffer,
1.135 + EConnectDisplayAndReleaseBuffer
1.136 + };
1.137 + CCommandDispatcher(CommandName aCommandName, TAny* aPram) :
1.138 + iCommandName(aCommandName), iParam(aPram){}
1.139 + TInt Start();
1.140 +private:
1.141 + static TInt ThreadFunction(TAny*);
1.142 + void ExecuteCommandL();
1.143 +private:
1.144 + CommandName iCommandName;
1.145 + TAny* iParam;
1.146 + };
1.147 +
1.148 +_LIT(KTSurfaceUpdateIntegStep,"TSurfaceUpdateInteg");
1.149 +
1.150 +
1.151 +#endif // __TSURFACEUPDATEINTEG_H__