sl@0
|
1 |
// Copyright (c) 2007-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 |
#include "tdrawbitmap.h"
|
sl@0
|
17 |
|
sl@0
|
18 |
CTDrawBitmap::CTDrawBitmap()
|
sl@0
|
19 |
{
|
sl@0
|
20 |
SetTestStepName(KTDirectGdiDrawBitmapStep);
|
sl@0
|
21 |
}
|
sl@0
|
22 |
|
sl@0
|
23 |
CTDrawBitmap::~CTDrawBitmap()
|
sl@0
|
24 |
{
|
sl@0
|
25 |
}
|
sl@0
|
26 |
|
sl@0
|
27 |
/**
|
sl@0
|
28 |
Override of base class pure virtual
|
sl@0
|
29 |
Lists the tests to be run
|
sl@0
|
30 |
*/
|
sl@0
|
31 |
void CTDrawBitmap::RunTestsL()
|
sl@0
|
32 |
{
|
sl@0
|
33 |
if (iUseDirectGdi && !iUseSwDirectGdi)
|
sl@0
|
34 |
{
|
sl@0
|
35 |
// In the event that a test leaves after a BitBlt() or DrawBitmap() has occurred
|
sl@0
|
36 |
// the vgimage cache will need to be reset.
|
sl@0
|
37 |
// This needs to be the first item on the cleanupstack,
|
sl@0
|
38 |
// as some tests perform pushes and pops of bitmaps.
|
sl@0
|
39 |
CleanupStack::PushL(TCleanupItem(ResetCache, iVgImageCache));
|
sl@0
|
40 |
}
|
sl@0
|
41 |
if(!iLargeTarget)
|
sl@0
|
42 |
{
|
sl@0
|
43 |
iTestParams.iDoCompressed = ETrue;
|
sl@0
|
44 |
SetTestStepID(_L("GRAPHICS-DIRECTGDI-DRAWBITMAP-0001"));
|
sl@0
|
45 |
TestBasicL();
|
sl@0
|
46 |
RecordTestResultL();
|
sl@0
|
47 |
iTestParams.iDoCompressed = EFalse;
|
sl@0
|
48 |
SetTestStepID(_L("GRAPHICS-DIRECTGDI-DRAWBITMAP-0003"));
|
sl@0
|
49 |
TestInvalidParametersL();
|
sl@0
|
50 |
RecordTestResultL();
|
sl@0
|
51 |
SetTestStepID(_L("GRAPHICS-DIRECTGDI-DRAWBITMAP-0005"));
|
sl@0
|
52 |
TestSourceBitmapCloningL();
|
sl@0
|
53 |
RecordTestResultL();
|
sl@0
|
54 |
SetTestStepID(_L("GRAPHICS-DIRECTGDI-DRAWBITMAP-0006"));
|
sl@0
|
55 |
TestDrawModeL();
|
sl@0
|
56 |
RecordTestResultL();
|
sl@0
|
57 |
SetTestStepID(_L("GRAPHICS-DIRECTGDI-DRAWBITMAP-0007"));
|
sl@0
|
58 |
TestSetOriginL();
|
sl@0
|
59 |
RecordTestResultL();
|
sl@0
|
60 |
}
|
sl@0
|
61 |
else
|
sl@0
|
62 |
{
|
sl@0
|
63 |
SetTestStepID(_L("GRAPHICS-DIRECTGDI-DRAWBITMAP-0002"));
|
sl@0
|
64 |
TestPositioningL();
|
sl@0
|
65 |
RecordTestResultL();
|
sl@0
|
66 |
SetTestStepID(_L("GRAPHICS-DIRECTGDI-DRAWBITMAP-0004"));
|
sl@0
|
67 |
TestScalingL();
|
sl@0
|
68 |
RecordTestResultL();
|
sl@0
|
69 |
}
|
sl@0
|
70 |
if (iUseDirectGdi && !iUseSwDirectGdi)
|
sl@0
|
71 |
{
|
sl@0
|
72 |
CleanupStack::PopAndDestroy(iVgImageCache);
|
sl@0
|
73 |
}
|
sl@0
|
74 |
}
|
sl@0
|
75 |
|
sl@0
|
76 |
/**
|
sl@0
|
77 |
@SYMTestCaseID
|
sl@0
|
78 |
GRAPHICS-DIRECTGDI-DRAWBITMAP-0001
|
sl@0
|
79 |
|
sl@0
|
80 |
@SYMPREQ
|
sl@0
|
81 |
PREQ39
|
sl@0
|
82 |
|
sl@0
|
83 |
@SYMREQ
|
sl@0
|
84 |
REQ9199
|
sl@0
|
85 |
REQ9204
|
sl@0
|
86 |
REQ9195
|
sl@0
|
87 |
REQ9201
|
sl@0
|
88 |
REQ9202
|
sl@0
|
89 |
REQ9222
|
sl@0
|
90 |
REQ9223
|
sl@0
|
91 |
REQ9236
|
sl@0
|
92 |
REQ9237
|
sl@0
|
93 |
|
sl@0
|
94 |
@SYMTestCaseDesc
|
sl@0
|
95 |
Bitmap drawing basic functionality test.
|
sl@0
|
96 |
|
sl@0
|
97 |
@SYMTestPriority
|
sl@0
|
98 |
Critical
|
sl@0
|
99 |
|
sl@0
|
100 |
@SYMTestStatus
|
sl@0
|
101 |
Implemented
|
sl@0
|
102 |
|
sl@0
|
103 |
@SYMTestActions
|
sl@0
|
104 |
Test bitmap drawing for simple and valid parameters:
|
sl@0
|
105 |
- Set the origin at TPoint(-35,80)
|
sl@0
|
106 |
- Draw a stretched bitmap at TPoint(55,-60)
|
sl@0
|
107 |
|
sl@0
|
108 |
@SYMTestExpectedResults
|
sl@0
|
109 |
Source bitmap should be copied into drawing target.
|
sl@0
|
110 |
Valid bitmap should be created. This bitmap shall be compared
|
sl@0
|
111 |
to a reference bitmap.
|
sl@0
|
112 |
*/
|
sl@0
|
113 |
void CTDrawBitmap::TestBasicL()
|
sl@0
|
114 |
{
|
sl@0
|
115 |
_LIT(KTestName, "DrawBitmap-Basic");
|
sl@0
|
116 |
if(!iRunningOomTests)
|
sl@0
|
117 |
{
|
sl@0
|
118 |
INFO_PRINTF1(KTestName);
|
sl@0
|
119 |
}
|
sl@0
|
120 |
|
sl@0
|
121 |
ResetGc();
|
sl@0
|
122 |
|
sl@0
|
123 |
CFbsBitmap* bitmap;
|
sl@0
|
124 |
if(iTestParams.iDoCompressed)
|
sl@0
|
125 |
{
|
sl@0
|
126 |
bitmap = iCompressedBitmap;
|
sl@0
|
127 |
}
|
sl@0
|
128 |
else
|
sl@0
|
129 |
{
|
sl@0
|
130 |
bitmap = iCheckedBoardBitmap2;
|
sl@0
|
131 |
}
|
sl@0
|
132 |
|
sl@0
|
133 |
iGc->DrawBitmap(TRect(TPoint(20, 20), bitmap->SizeInPixels()), *bitmap, TRect(10, 10, 130, 130));
|
sl@0
|
134 |
TESTNOERRORL(iGc->GetError());
|
sl@0
|
135 |
|
sl@0
|
136 |
if(!iTestParams.iDoCompressed)
|
sl@0
|
137 |
WriteTargetOutput(KTestName());
|
sl@0
|
138 |
}
|
sl@0
|
139 |
|
sl@0
|
140 |
/**
|
sl@0
|
141 |
@SYMTestCaseID
|
sl@0
|
142 |
GRAPHICS-DIRECTGDI-DRAWBITMAP-0002
|
sl@0
|
143 |
|
sl@0
|
144 |
@SYMPREQ
|
sl@0
|
145 |
PREQ39
|
sl@0
|
146 |
|
sl@0
|
147 |
@SYMREQ
|
sl@0
|
148 |
REQ9199
|
sl@0
|
149 |
REQ9204
|
sl@0
|
150 |
REQ9195
|
sl@0
|
151 |
REQ9201
|
sl@0
|
152 |
REQ9202
|
sl@0
|
153 |
REQ9222
|
sl@0
|
154 |
REQ9223
|
sl@0
|
155 |
REQ9236
|
sl@0
|
156 |
REQ9237
|
sl@0
|
157 |
|
sl@0
|
158 |
@SYMTestCaseDesc
|
sl@0
|
159 |
Test regularity of bitmap positioning.
|
sl@0
|
160 |
|
sl@0
|
161 |
@SYMTestPriority
|
sl@0
|
162 |
Critical
|
sl@0
|
163 |
|
sl@0
|
164 |
@SYMTestStatus
|
sl@0
|
165 |
Implemented
|
sl@0
|
166 |
|
sl@0
|
167 |
@SYMTestActions
|
sl@0
|
168 |
Test positioning functionality of DrawBitmap() methods. Test boundary
|
sl@0
|
169 |
conditions and clipping to surface area.
|
sl@0
|
170 |
Covers the whole target bitmap starting from TPoint(-30,-30) with staggered blits of a small 8x8 bitmap.
|
sl@0
|
171 |
|
sl@0
|
172 |
@SYMTestExpectedResults
|
sl@0
|
173 |
Source bitmap should be drawn tiled in a staggered fashion across the whole target. Clipping should be applied.
|
sl@0
|
174 |
Valid bitmap should be created. This bitmap shall be compared to a reference bitmap.
|
sl@0
|
175 |
*/
|
sl@0
|
176 |
void CTDrawBitmap::TestPositioningL()
|
sl@0
|
177 |
{
|
sl@0
|
178 |
_LIT(KTestName, "DrawBitmap-Positioning");
|
sl@0
|
179 |
if(!iRunningOomTests)
|
sl@0
|
180 |
{
|
sl@0
|
181 |
INFO_PRINTF1(KTestName);
|
sl@0
|
182 |
}
|
sl@0
|
183 |
iTestParams.iDoCompressed = ETrue;
|
sl@0
|
184 |
TestPositioningBaseL(KTestName(), EDrawBitmap);
|
sl@0
|
185 |
iTestParams.iDoCompressed = EFalse;
|
sl@0
|
186 |
TestPositioningBaseL(KTestName(), EDrawBitmap);
|
sl@0
|
187 |
}
|
sl@0
|
188 |
|
sl@0
|
189 |
/**
|
sl@0
|
190 |
@SYMTestCaseID
|
sl@0
|
191 |
GRAPHICS-DIRECTGDI-DRAWBITMAP-0003
|
sl@0
|
192 |
|
sl@0
|
193 |
@SYMPREQ
|
sl@0
|
194 |
PREQ39
|
sl@0
|
195 |
|
sl@0
|
196 |
@SYMREQ
|
sl@0
|
197 |
REQ9199
|
sl@0
|
198 |
REQ9204
|
sl@0
|
199 |
REQ9195
|
sl@0
|
200 |
REQ9222
|
sl@0
|
201 |
REQ9223
|
sl@0
|
202 |
REQ9236
|
sl@0
|
203 |
REQ9237
|
sl@0
|
204 |
|
sl@0
|
205 |
@SYMTestCaseDesc
|
sl@0
|
206 |
Test functions behaviour after calling with invalid parameters.
|
sl@0
|
207 |
|
sl@0
|
208 |
@SYMTestPriority
|
sl@0
|
209 |
Critical
|
sl@0
|
210 |
|
sl@0
|
211 |
@SYMTestStatus
|
sl@0
|
212 |
Implemented
|
sl@0
|
213 |
|
sl@0
|
214 |
@SYMTestActions
|
sl@0
|
215 |
Set valid parameters (see DrawBitmap-BasicL). Replace individual parameters
|
sl@0
|
216 |
with Invalid ones:
|
sl@0
|
217 |
Invalid source rectangles
|
sl@0
|
218 |
aSourceRect : negative source rectangle starting point or size
|
sl@0
|
219 |
TRect( TPoint( -30, -30), TSize(-10, -10) )
|
sl@0
|
220 |
aSourceRect : source rectangle not compatible with bitmap
|
sl@0
|
221 |
TRect( TSize(aBitmap->SizeInPixel(). iWidth + 10, aBitmap->SizeInPixel(). IHeight + 10))
|
sl@0
|
222 |
aSourceRect : swapped points in source rectangle
|
sl@0
|
223 |
TRect( TPoint( 100, 100 ) , TPoint( 0, 0 ) )
|
sl@0
|
224 |
Invalid destination rectangle (aDestRect):
|
sl@0
|
225 |
negative size
|
sl@0
|
226 |
Invalid source bitmap
|
sl@0
|
227 |
zero size bitmap
|
sl@0
|
228 |
not initialized bitmap
|
sl@0
|
229 |
|
sl@0
|
230 |
@SYMTestExpectedResults
|
sl@0
|
231 |
Function should detect invalid parameters and return.
|
sl@0
|
232 |
Nothing will be drawn on the target surface.
|
sl@0
|
233 |
*/
|
sl@0
|
234 |
void CTDrawBitmap::TestInvalidParametersL()
|
sl@0
|
235 |
{
|
sl@0
|
236 |
_LIT(KTestName, "DrawBitmap-InvalidParameters");
|
sl@0
|
237 |
if(!iRunningOomTests)
|
sl@0
|
238 |
{
|
sl@0
|
239 |
INFO_PRINTF1(KTestName);
|
sl@0
|
240 |
}
|
sl@0
|
241 |
|
sl@0
|
242 |
TestInvalidParametersBaseL(KTestName(), EDrawBitmap);
|
sl@0
|
243 |
}
|
sl@0
|
244 |
|
sl@0
|
245 |
/**
|
sl@0
|
246 |
@SYMTestCaseID
|
sl@0
|
247 |
GRAPHICS-DIRECTGDI-DRAWBITMAP-0004
|
sl@0
|
248 |
|
sl@0
|
249 |
@SYMPREQ
|
sl@0
|
250 |
PREQ39
|
sl@0
|
251 |
|
sl@0
|
252 |
@SYMREQ
|
sl@0
|
253 |
REQ9199
|
sl@0
|
254 |
REQ9204
|
sl@0
|
255 |
REQ9195
|
sl@0
|
256 |
REQ9201
|
sl@0
|
257 |
REQ9202
|
sl@0
|
258 |
REQ9222
|
sl@0
|
259 |
REQ9223
|
sl@0
|
260 |
REQ9236
|
sl@0
|
261 |
REQ9237
|
sl@0
|
262 |
|
sl@0
|
263 |
@SYMTestCaseDesc
|
sl@0
|
264 |
Test regularity of bitmap scaling.
|
sl@0
|
265 |
|
sl@0
|
266 |
@SYMTestPriority
|
sl@0
|
267 |
Critical
|
sl@0
|
268 |
|
sl@0
|
269 |
@SYMTestStatus
|
sl@0
|
270 |
Implemented
|
sl@0
|
271 |
|
sl@0
|
272 |
@SYMTestActions
|
sl@0
|
273 |
Test scaling implementation of DrawBitmap() methods : scaling down of a normal
|
sl@0
|
274 |
bitmap and scaling up of a bitmap fragment.
|
sl@0
|
275 |
|
sl@0
|
276 |
@SYMTestExpectedResults
|
sl@0
|
277 |
Scaled bitmap should be drawn in a target area. Valid bitmap should be created.
|
sl@0
|
278 |
The bitmap should be properly scaled. This bitmap shall be compared to a reference
|
sl@0
|
279 |
bitmap.
|
sl@0
|
280 |
*/
|
sl@0
|
281 |
void CTDrawBitmap::TestScalingL()
|
sl@0
|
282 |
{
|
sl@0
|
283 |
_LIT(KTestName, "DrawBitmap-Scaling");
|
sl@0
|
284 |
if(!iRunningOomTests)
|
sl@0
|
285 |
{
|
sl@0
|
286 |
INFO_PRINTF1(KTestName);
|
sl@0
|
287 |
}
|
sl@0
|
288 |
|
sl@0
|
289 |
TInt width = iGdiTarget->SizeInPixels().iWidth;
|
sl@0
|
290 |
TInt height = iGdiTarget->SizeInPixels().iHeight;
|
sl@0
|
291 |
|
sl@0
|
292 |
CFbsBitmap* bitmap1 = iCheckedBoardBitmap1;
|
sl@0
|
293 |
TInt bmp1Width = bitmap1->SizeInPixels().iWidth;
|
sl@0
|
294 |
TInt bmp1Height = bitmap1->SizeInPixels().iHeight;
|
sl@0
|
295 |
CFbsBitmap* bitmap2 = iCheckedBoardBitmap2;
|
sl@0
|
296 |
TInt bmp2Width = bitmap2->SizeInPixels().iWidth;
|
sl@0
|
297 |
TInt bmp2Height = bitmap2->SizeInPixels().iHeight;
|
sl@0
|
298 |
|
sl@0
|
299 |
ResetGc();
|
sl@0
|
300 |
|
sl@0
|
301 |
// small bitmap - extrem magnification
|
sl@0
|
302 |
TReal32 scale = 1.0f;
|
sl@0
|
303 |
TReal32 scaleFactor = 1.55f;
|
sl@0
|
304 |
TInt posX = 1;
|
sl@0
|
305 |
for(TInt j=0; j<6; j++)
|
sl@0
|
306 |
{
|
sl@0
|
307 |
TSize size(static_cast<TInt>(bmp1Width*scale), static_cast<TInt>(bmp1Height*scale));
|
sl@0
|
308 |
TPoint pos(posX, height/4-size.iHeight/2);
|
sl@0
|
309 |
|
sl@0
|
310 |
iGc->DrawBitmap(TRect(pos, size), *bitmap1);
|
sl@0
|
311 |
|
sl@0
|
312 |
posX += size.iWidth+2;
|
sl@0
|
313 |
scale *= scaleFactor;
|
sl@0
|
314 |
}
|
sl@0
|
315 |
|
sl@0
|
316 |
// large bitmap - extreme minification
|
sl@0
|
317 |
|
sl@0
|
318 |
scale /= scaleFactor;
|
sl@0
|
319 |
posX = 1;
|
sl@0
|
320 |
for(TInt j=5; j>=0; j--)
|
sl@0
|
321 |
{
|
sl@0
|
322 |
TSize size(static_cast<TInt>(bmp1Width*scale), static_cast<TInt>(bmp1Height*scale));
|
sl@0
|
323 |
TPoint pos(posX, 3*height/4-size.iHeight/2);
|
sl@0
|
324 |
|
sl@0
|
325 |
iGc->DrawBitmap(TRect(pos, size), *bitmap2);
|
sl@0
|
326 |
|
sl@0
|
327 |
posX += size.iWidth+2;
|
sl@0
|
328 |
scale /= scaleFactor;
|
sl@0
|
329 |
}
|
sl@0
|
330 |
|
sl@0
|
331 |
TESTNOERRORL(iGc->GetError());
|
sl@0
|
332 |
|
sl@0
|
333 |
TBuf<30> testName;
|
sl@0
|
334 |
testName.Append(KTestName);
|
sl@0
|
335 |
WriteTargetOutput(testName);
|
sl@0
|
336 |
}
|
sl@0
|
337 |
|
sl@0
|
338 |
/**
|
sl@0
|
339 |
@SYMTestCaseID
|
sl@0
|
340 |
GRAPHICS-DIRECTGDI-DRAWBITMAP-0005
|
sl@0
|
341 |
|
sl@0
|
342 |
@SYMPREQ
|
sl@0
|
343 |
PREQ39
|
sl@0
|
344 |
|
sl@0
|
345 |
@SYMREQ
|
sl@0
|
346 |
REQ9199
|
sl@0
|
347 |
REQ9204
|
sl@0
|
348 |
REQ9195
|
sl@0
|
349 |
REQ9201
|
sl@0
|
350 |
REQ9202
|
sl@0
|
351 |
REQ9222
|
sl@0
|
352 |
REQ9223
|
sl@0
|
353 |
REQ9236
|
sl@0
|
354 |
REQ9237
|
sl@0
|
355 |
|
sl@0
|
356 |
@SYMTestCaseDesc
|
sl@0
|
357 |
Tests that a bitmap is still drawn successfully if it is deleted
|
sl@0
|
358 |
right after the call to DrawBitmap() but before Finish() is called.
|
sl@0
|
359 |
|
sl@0
|
360 |
@SYMTestPriority
|
sl@0
|
361 |
Critical
|
sl@0
|
362 |
|
sl@0
|
363 |
@SYMTestStatus
|
sl@0
|
364 |
Implemented
|
sl@0
|
365 |
|
sl@0
|
366 |
@SYMTestActions
|
sl@0
|
367 |
For each method:
|
sl@0
|
368 |
1. Call method with valid parameters (see DrawBitmap-Basic).
|
sl@0
|
369 |
2. Right after returning from method call, destroy the source bitmap.
|
sl@0
|
370 |
3. Call the method again with the same bitmap parameter.
|
sl@0
|
371 |
Repeat p. 1-3 a few times.
|
sl@0
|
372 |
|
sl@0
|
373 |
@SYMTestExpectedResults
|
sl@0
|
374 |
Source bitmap should be copied into target area. Memory leaks should not be
|
sl@0
|
375 |
created. Valid bitmap should be created. This bitmap should be the same as
|
sl@0
|
376 |
a reference bitmap.
|
sl@0
|
377 |
*/
|
sl@0
|
378 |
void CTDrawBitmap::TestSourceBitmapCloningL()
|
sl@0
|
379 |
{
|
sl@0
|
380 |
_LIT(KTestName, "DrawBitmap-SourceBitmapCloning");
|
sl@0
|
381 |
if(!iRunningOomTests)
|
sl@0
|
382 |
{
|
sl@0
|
383 |
INFO_PRINTF1(KTestName);
|
sl@0
|
384 |
}
|
sl@0
|
385 |
|
sl@0
|
386 |
iTestParams.iDoCompressed = ETrue;
|
sl@0
|
387 |
TestSourceBitmapCloningBaseL(KTestName(), EDrawBitmap);
|
sl@0
|
388 |
iTestParams.iDoCompressed = EFalse;
|
sl@0
|
389 |
TestSourceBitmapCloningBaseL(KTestName(), EDrawBitmap);
|
sl@0
|
390 |
}
|
sl@0
|
391 |
|
sl@0
|
392 |
/**
|
sl@0
|
393 |
@SYMTestCaseID
|
sl@0
|
394 |
GRAPHICS-DIRECTGDI-DRAWBITMAP-0006
|
sl@0
|
395 |
|
sl@0
|
396 |
@SYMPREQ
|
sl@0
|
397 |
PREQ39
|
sl@0
|
398 |
|
sl@0
|
399 |
@SYMREQ
|
sl@0
|
400 |
REQ9199
|
sl@0
|
401 |
REQ9204
|
sl@0
|
402 |
REQ9195
|
sl@0
|
403 |
REQ9201
|
sl@0
|
404 |
REQ9202
|
sl@0
|
405 |
REQ9222
|
sl@0
|
406 |
REQ9223
|
sl@0
|
407 |
REQ9236
|
sl@0
|
408 |
REQ9237
|
sl@0
|
409 |
|
sl@0
|
410 |
@SYMTestCaseDesc
|
sl@0
|
411 |
Test correctness of drawing bitmaps in all possible draw modes.
|
sl@0
|
412 |
|
sl@0
|
413 |
@SYMTestPriority
|
sl@0
|
414 |
Critical
|
sl@0
|
415 |
|
sl@0
|
416 |
@SYMTestStatus
|
sl@0
|
417 |
Implemented
|
sl@0
|
418 |
|
sl@0
|
419 |
@SYMTestActions
|
sl@0
|
420 |
Set valid parameters (see DrawBitmap-Basic).
|
sl@0
|
421 |
Use the semi-transparent source bitmap (aBitmap).
|
sl@0
|
422 |
Set drawmode to EDrawModeWriteAlpha and call the methods.
|
sl@0
|
423 |
Set drawmode to EDrawModePEN and call the methods.
|
sl@0
|
424 |
Set drawmode to EDrawModeWriteAlpha and call the methods.
|
sl@0
|
425 |
|
sl@0
|
426 |
@SYMTestExpectedResults
|
sl@0
|
427 |
The image drawn in the center of the test should be drawn blended (EDrawModePEN)
|
sl@0
|
428 |
and the images drawn at the left and right sides should be drawn opaque (EDrawModeWriteAlpha).
|
sl@0
|
429 |
should be copied into rendering target. Valid bitmap should be created.
|
sl@0
|
430 |
This bitmap should be the same as a reference bitmap.
|
sl@0
|
431 |
*/
|
sl@0
|
432 |
void CTDrawBitmap::TestDrawModeL()
|
sl@0
|
433 |
{
|
sl@0
|
434 |
_LIT(KTestName, "DrawBitmap-DrawMode");
|
sl@0
|
435 |
if(!iRunningOomTests)
|
sl@0
|
436 |
{
|
sl@0
|
437 |
INFO_PRINTF1(KTestName);
|
sl@0
|
438 |
}
|
sl@0
|
439 |
|
sl@0
|
440 |
ResetGc();
|
sl@0
|
441 |
|
sl@0
|
442 |
TSize bmpSize(iCheckedBoardWithAlphaBitmap->SizeInPixels());
|
sl@0
|
443 |
|
sl@0
|
444 |
TInt halfHeight = (bmpSize.iHeight >> 1);
|
sl@0
|
445 |
TInt quaterWidth = (bmpSize.iWidth >> 2);
|
sl@0
|
446 |
TInt y1 = halfHeight - (bmpSize.iHeight >> 2);
|
sl@0
|
447 |
|
sl@0
|
448 |
TSize vertRectSize (quaterWidth, bmpSize.iHeight);
|
sl@0
|
449 |
TSize horizRectSize (bmpSize.iWidth, halfHeight);
|
sl@0
|
450 |
|
sl@0
|
451 |
// Render column to left
|
sl@0
|
452 |
iGc->SetDrawMode(DirectGdi::EDrawModeWriteAlpha);
|
sl@0
|
453 |
iGc->DrawBitmap(
|
sl@0
|
454 |
TRect (TPoint(0, 0), vertRectSize),
|
sl@0
|
455 |
*iCheckedBoardWithAlphaBitmap);
|
sl@0
|
456 |
|
sl@0
|
457 |
// Render row in center
|
sl@0
|
458 |
iGc->SetDrawMode(DirectGdi::EDrawModePEN);
|
sl@0
|
459 |
iGc->DrawBitmap(
|
sl@0
|
460 |
TRect(TPoint(0, y1), horizRectSize),
|
sl@0
|
461 |
*iCheckedBoardWithAlphaBitmap);
|
sl@0
|
462 |
|
sl@0
|
463 |
// Render column to right
|
sl@0
|
464 |
iGc->SetDrawMode(DirectGdi::EDrawModeWriteAlpha);
|
sl@0
|
465 |
iGc->DrawBitmap(
|
sl@0
|
466 |
TRect (TPoint(bmpSize.iWidth - quaterWidth, 0), vertRectSize),
|
sl@0
|
467 |
*iCheckedBoardWithAlphaBitmap);
|
sl@0
|
468 |
|
sl@0
|
469 |
TESTNOERRORL(iGc->GetError());
|
sl@0
|
470 |
|
sl@0
|
471 |
WriteTargetOutput(KTestName());
|
sl@0
|
472 |
}
|
sl@0
|
473 |
|
sl@0
|
474 |
/**
|
sl@0
|
475 |
@SYMTestCaseID
|
sl@0
|
476 |
GRAPHICS-DIRECTGDI-DRAWBITMAP-0007
|
sl@0
|
477 |
|
sl@0
|
478 |
@SYMPREQ
|
sl@0
|
479 |
PREQ39
|
sl@0
|
480 |
|
sl@0
|
481 |
@SYMREQ
|
sl@0
|
482 |
REQ9199
|
sl@0
|
483 |
REQ9204
|
sl@0
|
484 |
REQ9195
|
sl@0
|
485 |
REQ9201
|
sl@0
|
486 |
REQ9202
|
sl@0
|
487 |
REQ9222
|
sl@0
|
488 |
REQ9223
|
sl@0
|
489 |
REQ9236
|
sl@0
|
490 |
REQ9237
|
sl@0
|
491 |
|
sl@0
|
492 |
@SYMTestCaseDesc
|
sl@0
|
493 |
Test that a bitmap is drawn at the correct position when SetOrigin() is called before
|
sl@0
|
494 |
the bitmap is drawn.
|
sl@0
|
495 |
|
sl@0
|
496 |
@SYMTestPriority
|
sl@0
|
497 |
Critical
|
sl@0
|
498 |
|
sl@0
|
499 |
@SYMTestStatus
|
sl@0
|
500 |
Implemented
|
sl@0
|
501 |
|
sl@0
|
502 |
@SYMTestActions
|
sl@0
|
503 |
Call SetOrigin().
|
sl@0
|
504 |
Call DrawBitmap().
|
sl@0
|
505 |
|
sl@0
|
506 |
@SYMTestExpectedResults
|
sl@0
|
507 |
Source bitmap should be drawn at the correct position (TPoint(20,20)). Valid bitmap
|
sl@0
|
508 |
should be created. This bitmap shall be compared to a reference bitmap.
|
sl@0
|
509 |
*/
|
sl@0
|
510 |
void CTDrawBitmap::TestSetOriginL()
|
sl@0
|
511 |
{
|
sl@0
|
512 |
_LIT(KTestName, "DrawBitmap-SetOrigin");
|
sl@0
|
513 |
|
sl@0
|
514 |
// Only do test for one pixel format to cut down on the number of images produced
|
sl@0
|
515 |
// as this is just a positional test and we don't need to test for all pixel formats.
|
sl@0
|
516 |
if (!((iTestParams.iTargetPixelFormat == EUidPixelFormatRGB_565) && (iTestParams.iSourcePixelFormat == EUidPixelFormatRGB_565)))
|
sl@0
|
517 |
{
|
sl@0
|
518 |
return;
|
sl@0
|
519 |
}
|
sl@0
|
520 |
|
sl@0
|
521 |
if(!iRunningOomTests)
|
sl@0
|
522 |
{
|
sl@0
|
523 |
INFO_PRINTF1(KTestName);
|
sl@0
|
524 |
}
|
sl@0
|
525 |
|
sl@0
|
526 |
ResetGc();
|
sl@0
|
527 |
|
sl@0
|
528 |
CFbsBitmap* bitmap = iCheckedBoardBitmap2;
|
sl@0
|
529 |
iGc->SetOrigin(TPoint(-35, 80));
|
sl@0
|
530 |
iGc->DrawBitmap(TRect(TPoint(55, -60), bitmap->SizeInPixels()), *bitmap, TRect(10, 10, 130, 130));
|
sl@0
|
531 |
TESTNOERRORL(iGc->GetError());
|
sl@0
|
532 |
|
sl@0
|
533 |
WriteTargetOutput(KTestName());
|
sl@0
|
534 |
}
|