sl@0
|
1 |
// Copyright (c) 2006-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 |
@file
|
sl@0
|
18 |
@test
|
sl@0
|
19 |
@internalComponent - Internal Symbian test code
|
sl@0
|
20 |
*/
|
sl@0
|
21 |
|
sl@0
|
22 |
#ifndef __GRAPHICSPERFORMANCE_REDRAWING_H__
|
sl@0
|
23 |
#define __GRAPHICSPERFORMANCE_REDRAWING_H__
|
sl@0
|
24 |
|
sl@0
|
25 |
#include "te_graphicsperformanceSuiteStepBase.h"
|
sl@0
|
26 |
#include <w32std.h>
|
sl@0
|
27 |
#include <test/ttmsgraphicsstep.h>
|
sl@0
|
28 |
|
sl@0
|
29 |
class CWindow;
|
sl@0
|
30 |
class CWsClient;
|
sl@0
|
31 |
class CRedrawingTest;
|
sl@0
|
32 |
|
sl@0
|
33 |
// List of test cases implemented
|
sl@0
|
34 |
// -*-* To add new test case add new enum to bottom of list
|
sl@0
|
35 |
enum TRedrawTestCase
|
sl@0
|
36 |
{
|
sl@0
|
37 |
ETwoWindowBitblt, // Test two windows with alpha bitblited images
|
sl@0
|
38 |
ETwoWindowBitbltMasked, // Test two windows with alpha bitblt masked images
|
sl@0
|
39 |
ETwoWindowManyBitmapsBitblt, // Test many small bitmaps in window with invaldate small area
|
sl@0
|
40 |
};
|
sl@0
|
41 |
|
sl@0
|
42 |
/**
|
sl@0
|
43 |
This class is an active object that receives redraw events from the windows server
|
sl@0
|
44 |
*/
|
sl@0
|
45 |
class CWsRedrawer : public CActive
|
sl@0
|
46 |
{
|
sl@0
|
47 |
public:
|
sl@0
|
48 |
CWsRedrawer();
|
sl@0
|
49 |
void ConstructL(CWsClient* aClient);
|
sl@0
|
50 |
~CWsRedrawer();
|
sl@0
|
51 |
void IssueRequest();
|
sl@0
|
52 |
|
sl@0
|
53 |
// From CActive
|
sl@0
|
54 |
void DoCancel();
|
sl@0
|
55 |
void RunL();
|
sl@0
|
56 |
|
sl@0
|
57 |
private:
|
sl@0
|
58 |
CWsClient* iClient;
|
sl@0
|
59 |
};
|
sl@0
|
60 |
|
sl@0
|
61 |
/**
|
sl@0
|
62 |
Window base abstract class. Derive from this class to introduce new types of windows
|
sl@0
|
63 |
*/
|
sl@0
|
64 |
class CWindow : public CBase
|
sl@0
|
65 |
{
|
sl@0
|
66 |
public:
|
sl@0
|
67 |
CWindow(CWsClient* aClient, TRedrawTestCase aTestCase);
|
sl@0
|
68 |
void ConstructL (const TRect& aRect, CWindow* aParent=0);
|
sl@0
|
69 |
~CWindow();
|
sl@0
|
70 |
|
sl@0
|
71 |
RWindow& Window();
|
sl@0
|
72 |
void Activate();
|
sl@0
|
73 |
CWindowGc& SystemGc();
|
sl@0
|
74 |
|
sl@0
|
75 |
virtual void Draw(const TRect& aRect) = 0;
|
sl@0
|
76 |
|
sl@0
|
77 |
protected:
|
sl@0
|
78 |
RWindow iWindow; // window server window
|
sl@0
|
79 |
TRect iRect; // rectangle re owning window
|
sl@0
|
80 |
CWsClient* iClient; // client including session and group
|
sl@0
|
81 |
TRedrawTestCase iTestCase;
|
sl@0
|
82 |
};
|
sl@0
|
83 |
|
sl@0
|
84 |
/**
|
sl@0
|
85 |
Main window used to draw background
|
sl@0
|
86 |
*/
|
sl@0
|
87 |
class CMainWindow : public CWindow
|
sl@0
|
88 |
{
|
sl@0
|
89 |
public:
|
sl@0
|
90 |
CMainWindow (CWsClient* aClient, TRedrawTestCase aTestCase);
|
sl@0
|
91 |
~CMainWindow ();
|
sl@0
|
92 |
void ConstructL(const TRect& aRect, CWindow* aParent=0);
|
sl@0
|
93 |
void Draw (const TRect& aRect);
|
sl@0
|
94 |
|
sl@0
|
95 |
private:
|
sl@0
|
96 |
CFbsBitmap* iBitmapImage;
|
sl@0
|
97 |
};
|
sl@0
|
98 |
|
sl@0
|
99 |
/**
|
sl@0
|
100 |
Test window for use in test cases
|
sl@0
|
101 |
*/
|
sl@0
|
102 |
class CTestWindow : public CWindow
|
sl@0
|
103 |
{
|
sl@0
|
104 |
public:
|
sl@0
|
105 |
CTestWindow(CWsClient* aClient, TRedrawTestCase aTestCase);
|
sl@0
|
106 |
void ConstructL (const TRect& aRect, CWindow* aParent=0);
|
sl@0
|
107 |
~CTestWindow();
|
sl@0
|
108 |
void Draw(const TRect& aRect);
|
sl@0
|
109 |
void AppInitiatedDraw();
|
sl@0
|
110 |
|
sl@0
|
111 |
private:
|
sl@0
|
112 |
TBool iBitmapFlag; // Flag to indicate which image to bitblt
|
sl@0
|
113 |
CFbsBitmap* iBitmap12bit;
|
sl@0
|
114 |
CFbsBitmap* iAlpha8bitMask;
|
sl@0
|
115 |
CFbsBitmap* iBitmapImage;
|
sl@0
|
116 |
CFbsBitmap* i16x16Icon;
|
sl@0
|
117 |
CFbsBitmap* i16x16IconMonochrome;
|
sl@0
|
118 |
};
|
sl@0
|
119 |
|
sl@0
|
120 |
/**
|
sl@0
|
121 |
The windows server client is an active object to run the redraw test cases
|
sl@0
|
122 |
*/
|
sl@0
|
123 |
class CWsClient : public CActive
|
sl@0
|
124 |
{
|
sl@0
|
125 |
public:
|
sl@0
|
126 |
CWsClient(CRedrawingTest& iTestSuite, TRedrawTestCase aTestCase);
|
sl@0
|
127 |
void ConstructL();
|
sl@0
|
128 |
~CWsClient();
|
sl@0
|
129 |
CRedrawingTest& TestSuite() { return iTestSuite; }
|
sl@0
|
130 |
RWsSession& WsSession() { return iWs; }
|
sl@0
|
131 |
CWindowGc& Gc() { return *iGc; }
|
sl@0
|
132 |
RWindowGroup& WindowGroup() { return iGroup; }
|
sl@0
|
133 |
|
sl@0
|
134 |
private:
|
sl@0
|
135 |
void ConstructMainWindowL();
|
sl@0
|
136 |
void IssueRequest();
|
sl@0
|
137 |
|
sl@0
|
138 |
// From CActive
|
sl@0
|
139 |
void DoCancel();
|
sl@0
|
140 |
void RunL();
|
sl@0
|
141 |
|
sl@0
|
142 |
// Nested class to handle test case in separate active object
|
sl@0
|
143 |
class CRedrawingTestActive : public CActive
|
sl@0
|
144 |
{
|
sl@0
|
145 |
public:
|
sl@0
|
146 |
CRedrawingTestActive(CWsClient& aClient);
|
sl@0
|
147 |
~CRedrawingTestActive();
|
sl@0
|
148 |
|
sl@0
|
149 |
void ConstructL();
|
sl@0
|
150 |
|
sl@0
|
151 |
private:
|
sl@0
|
152 |
// From CActive
|
sl@0
|
153 |
void RunL();
|
sl@0
|
154 |
void DoCancel();
|
sl@0
|
155 |
|
sl@0
|
156 |
void RequestComplete();
|
sl@0
|
157 |
|
sl@0
|
158 |
// Test cases
|
sl@0
|
159 |
void TestTwoWindowsBitBlt();
|
sl@0
|
160 |
void TestInvalidateSmallArea();
|
sl@0
|
161 |
|
sl@0
|
162 |
private:
|
sl@0
|
163 |
CWsClient& iClient;
|
sl@0
|
164 |
TBool iFlipWindow;
|
sl@0
|
165 |
TInt iIterationCount;
|
sl@0
|
166 |
};
|
sl@0
|
167 |
// End nested class CRedrawingTestActive
|
sl@0
|
168 |
|
sl@0
|
169 |
private:
|
sl@0
|
170 |
RWsSession iWs;
|
sl@0
|
171 |
CWindowGc* iGc;
|
sl@0
|
172 |
RWindowGroup iGroup;
|
sl@0
|
173 |
CWsScreenDevice* iScreen;
|
sl@0
|
174 |
TRect iRect;
|
sl@0
|
175 |
|
sl@0
|
176 |
CWsRedrawer* iRedrawer;
|
sl@0
|
177 |
CRedrawingTestActive* iTestActive;
|
sl@0
|
178 |
TRedrawTestCase iTestCase;
|
sl@0
|
179 |
CMainWindow* iMainWindow;
|
sl@0
|
180 |
CTestWindow* iTestWindow;
|
sl@0
|
181 |
CTestWindow* iTestWindow2;
|
sl@0
|
182 |
CRedrawingTest& iTestSuite;
|
sl@0
|
183 |
};
|
sl@0
|
184 |
|
sl@0
|
185 |
/**
|
sl@0
|
186 |
This the the test case derived from CTe_graphicsperformanceSuiteStepBase
|
sl@0
|
187 |
It will construct the rest of the framework
|
sl@0
|
188 |
*/
|
sl@0
|
189 |
class CRedrawingTest : public CTe_graphicsperformanceSuiteStepBase
|
sl@0
|
190 |
{
|
sl@0
|
191 |
public:
|
sl@0
|
192 |
CRedrawingTest();
|
sl@0
|
193 |
~CRedrawingTest();
|
sl@0
|
194 |
inline CTProfiler& Profiler() const;
|
sl@0
|
195 |
private:
|
sl@0
|
196 |
// From CTestStep
|
sl@0
|
197 |
virtual TVerdict doTestStepPreambleL();
|
sl@0
|
198 |
virtual TVerdict doTestStepL();
|
sl@0
|
199 |
|
sl@0
|
200 |
void RunRedrawWindowTestCaseL(const TDesC& aTestName, TRedrawTestCase aTestCase);
|
sl@0
|
201 |
|
sl@0
|
202 |
private:
|
sl@0
|
203 |
CWsClient* iWsClient;
|
sl@0
|
204 |
};
|
sl@0
|
205 |
|
sl@0
|
206 |
_LIT(KRedrawingTest,"TRedrawing");
|
sl@0
|
207 |
|
sl@0
|
208 |
#endif //__GRAPHICSPERFORMANCE_REDRAWING_H__
|