103
|
1 |
// Copyright (c) 1996-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 |
// Test alpha channel transparent windows
|
|
15 |
// Test that draw operations with non-opaque colours do alpha blending in EColor64K and EColor16MA display modes
|
|
16 |
// Test that alpha channel transparent windows are drawn correctly when windows move, redraw, change visibility, etc.
|
|
17 |
// In the draw operation tests, the left window draws opaque pink on white background, the right window blends semi-transparent red on white background,
|
|
18 |
// and the results are compared.
|
|
19 |
// In the transparent window tests, the right window contains several transparent windows, which are moved, redrawn, visibility changed, etc,
|
|
20 |
// the left window contains a single window in which we draw what we expect the right window to look like. The results are compared.
|
|
21 |
// In each case, the left and right windows should be identical
|
|
22 |
//
|
|
23 |
//
|
|
24 |
|
|
25 |
|
|
26 |
#include "TALPHAWIN.H"
|
|
27 |
|
|
28 |
enum
|
|
29 |
{
|
|
30 |
EOpDrawRect,
|
|
31 |
EOpDrawLine,
|
|
32 |
EOpDrawEllipse,
|
|
33 |
EOpDrawText,
|
|
34 |
EOpDrawTextVertical,
|
|
35 |
EOpDrawTextAntiAliased,
|
|
36 |
EOpBitBlt,
|
|
37 |
EOpBitBltMasked,
|
|
38 |
ENumDrawOps
|
|
39 |
};
|
|
40 |
|
|
41 |
|
|
42 |
enum
|
|
43 |
{
|
|
44 |
ERed = 0x1,
|
|
45 |
EGreen = 0x2,
|
|
46 |
EBlue = 0x4,
|
|
47 |
|
|
48 |
EAlphaTransparency = 0x8,
|
|
49 |
ETransparencyFactor = 0x10,
|
|
50 |
// defaults to non-transparent
|
|
51 |
|
|
52 |
EOpaque = 0x20,
|
|
53 |
ETransparent = 0x40,
|
|
54 |
// defaults to semi-transparent
|
|
55 |
|
|
56 |
EModeColor64K = 0x80,
|
|
57 |
EModeColor16MA = 0x100,
|
|
58 |
// defaults to 64k
|
|
59 |
|
|
60 |
EInvisible = 0x200,
|
|
61 |
|
|
62 |
EActive = 0xf000000
|
|
63 |
};
|
|
64 |
|
|
65 |
|
|
66 |
TRgb ColourFromDrawState(TInt aDrawState)
|
|
67 |
{
|
|
68 |
TInt red = (aDrawState & ERed) ? 255 : 0;
|
|
69 |
TInt green = (aDrawState & EGreen) ? 255 : 0;
|
|
70 |
TInt blue = (aDrawState & EBlue) ? 255 : 0;
|
|
71 |
TInt alpha = 128;
|
|
72 |
if (aDrawState & EOpaque)
|
|
73 |
alpha = 255;
|
|
74 |
if (aDrawState & ETransparent)
|
|
75 |
alpha = 0;
|
|
76 |
return TRgb(red, green, blue, alpha);
|
|
77 |
}
|
|
78 |
|
|
79 |
|
|
80 |
|
|
81 |
//
|
|
82 |
// CTAlphaWinTest
|
|
83 |
//
|
|
84 |
|
|
85 |
CTAlphaWin::CTAlphaWin(CTestStep* aStep):
|
|
86 |
CTWsGraphicsBase(aStep)
|
|
87 |
{
|
|
88 |
}
|
|
89 |
|
|
90 |
CTAlphaWin::~CTAlphaWin()
|
|
91 |
{
|
|
92 |
iTestWin.DeleteAll();
|
|
93 |
delete iRefWin;
|
|
94 |
}
|
|
95 |
|
|
96 |
void CTAlphaWin::ConstructL()
|
|
97 |
{
|
|
98 |
if(TransparencySupportedL() == KErrNotSupported)
|
|
99 |
return;
|
|
100 |
|
|
101 |
TSize winSize = BaseWin->Size();
|
|
102 |
|
|
103 |
iTestWin[0] = CTAlphaWindow::NewL(this, TestWin, TPoint(0,0), winSize, ERed | EGreen | EBlue | EOpaque);
|
|
104 |
iTestWin[1] = CTAlphaWindow::NewL(this, TestWin, TPoint(0,0), TSize(winSize.iWidth/2, winSize.iHeight/2), ERed | EAlphaTransparency);
|
|
105 |
iTestWin[2] = CTAlphaWindow::NewL(this, TestWin, TPoint(winSize.iWidth/3,0), TSize(winSize.iWidth/2, winSize.iHeight/2), EGreen | EAlphaTransparency);
|
|
106 |
iTestWin[3] = CTAlphaWindow::NewL(this, TestWin, TPoint(winSize.iWidth/6, winSize.iHeight/3), TSize(winSize.iWidth/2, winSize.iHeight/2), EBlue | EAlphaTransparency);
|
|
107 |
iTestWin[4] = CTAlphaWindow::NewL(this, TestWin, TPoint(winSize.iWidth/4,winSize.iHeight/6), TSize(winSize.iWidth/3,winSize.iHeight/3), ERed | EGreen | EBlue | EAlphaTransparency | ETransparent);
|
|
108 |
|
|
109 |
iRefWin = CTAlphaRefWin::NewL(BaseWin, TPoint(0,0), winSize, iTestWin);
|
|
110 |
//Clearing the windows
|
|
111 |
BaseWin->ClearWin();
|
|
112 |
TestWin->ClearWin();
|
|
113 |
}
|
|
114 |
|
|
115 |
void CTAlphaWin::ConfigureDisplayModes(TDisplayMode aRequiredMode = EColor16M)
|
|
116 |
{
|
|
117 |
TInt i;
|
|
118 |
for (i=0; i<5; i++)
|
|
119 |
{
|
|
120 |
iTestWin[i]->BaseWin()->SetRequiredDisplayMode(aRequiredMode);
|
|
121 |
}
|
|
122 |
iRefWin->BaseWin()->SetRequiredDisplayMode(aRequiredMode);
|
|
123 |
}
|
|
124 |
|
|
125 |
|
|
126 |
void CTAlphaWin::TestSemiTransparentDrawingL()
|
|
127 |
{
|
|
128 |
TSize winSize = BaseWin->Size();
|
|
129 |
|
|
130 |
// In this window, we draw opaque pink
|
|
131 |
CTDrawOpWin* drawWin = CTDrawOpWin::NewL(this, BaseWin, TPoint(0,0), winSize, TRgb(255,127,127,255));
|
|
132 |
|
|
133 |
// In this window, we blend semi-transparent red
|
|
134 |
CTDrawOpWin* blendWin = CTDrawOpWin::NewL(this, TestWin, TPoint(0,0), winSize, TRgb(255,0,0,128));
|
|
135 |
|
|
136 |
const TInt tolerance = 9;//8 - wouldn't be enough!! The defect DEF112334 was raised
|
|
137 |
for (TInt i=EOpDrawRect; i<ENumDrawOps; i++)
|
|
138 |
{
|
|
139 |
|
|
140 |
// User::After(1000000);// helpful when debugging
|
|
141 |
drawWin->SetDrawOp(i);
|
|
142 |
blendWin->SetDrawOp(i);
|
|
143 |
drawWin->DrawNow();
|
|
144 |
blendWin->DrawNow();
|
|
145 |
TheClient->Flush();
|
|
146 |
TheClient->WaitForRedrawsToFinish();
|
|
147 |
|
|
148 |
if((i == EOpDrawTextAntiAliased) && (TheClient->iScreen->DisplayMode() == EColor16MA) || (TheClient->iScreen->DisplayMode() == EColor16MAP))
|
|
149 |
{
|
|
150 |
TSize winSize=BaseWin->Size();
|
|
151 |
TRect rect1(BaseWin->BaseWin()->InquireOffset(*TheClient->iGroup->WinTreeNode()),winSize);
|
|
152 |
TRect rect2(TestWin->BaseWin()->InquireOffset(*TheClient->iGroup->WinTreeNode()),winSize);
|
|
153 |
|
|
154 |
CheckRectL(rect1, rect2, winSize, TheClient->iScreen->DisplayMode(), tolerance, _L("CTAlphaWin::TestSemiTransparentDrawingL()"));
|
|
155 |
}
|
|
156 |
else
|
|
157 |
{
|
|
158 |
CheckRect(BaseWin,TestWin,_L("CTAlphaWin::TestSemiTransparentDrawingL()"));
|
|
159 |
}
|
|
160 |
}
|
|
161 |
delete drawWin;
|
|
162 |
delete blendWin;
|
|
163 |
}
|
|
164 |
|
|
165 |
void CTAlphaWin::TestTransparentDrawingL()
|
|
166 |
{
|
|
167 |
TSize winSize = BaseWin->Size();
|
|
168 |
|
|
169 |
// In this window, we draw opaque white
|
|
170 |
CTDrawOpWin* drawWin = CTDrawOpWin::NewL(this, BaseWin, TPoint(0,0), winSize, TRgb(255,255,255,255));
|
|
171 |
|
|
172 |
// In this window, we blend transparent red
|
|
173 |
CTDrawOpWin* blendWin = CTDrawOpWin::NewL(this, TestWin, TPoint(0,0), winSize, TRgb(255,0,0,0));
|
|
174 |
|
|
175 |
for (TInt i=EOpDrawRect; i<ENumDrawOps; i++)
|
|
176 |
{
|
|
177 |
//User::After(1000000);// helpful when debugging
|
|
178 |
drawWin->SetDrawOp(i);
|
|
179 |
blendWin->SetDrawOp(i);
|
|
180 |
drawWin->DrawNow();
|
|
181 |
blendWin->DrawNow();
|
|
182 |
TheClient->Flush();
|
|
183 |
TheClient->WaitForRedrawsToFinish();
|
|
184 |
CheckRect(BaseWin,TestWin,_L("CTAlphaWin::TestTransparentDrawingL()"));
|
|
185 |
}
|
|
186 |
delete drawWin;
|
|
187 |
delete blendWin;
|
|
188 |
}
|
|
189 |
|
|
190 |
void CTAlphaWin::CheckRectL(const TRect& aRect1, const TRect& aRect2, TSize aSize, TDisplayMode aRequiredMode, TInt aTolerance, const TDesC& aErrorMsg)
|
|
191 |
{
|
|
192 |
CFbsBitmap *bmp1 = new (ELeave) CFbsBitmap;
|
|
193 |
CleanupStack::PushL(bmp1);
|
|
194 |
User::LeaveIfError(bmp1->Create(aSize, aRequiredMode));
|
|
195 |
|
|
196 |
CFbsBitmap *bmp2 = new (ELeave) CFbsBitmap;
|
|
197 |
CleanupStack::PushL(bmp2);
|
|
198 |
User::LeaveIfError(bmp2->Create(aSize, aRequiredMode));
|
|
199 |
|
|
200 |
User::LeaveIfError(TheClient->iScreen->CopyScreenToBitmap(bmp1, aRect1));
|
|
201 |
User::LeaveIfError(TheClient->iScreen->CopyScreenToBitmap(bmp2, aRect2));
|
|
202 |
|
|
203 |
TRgb *rgbBuf1=(TRgb *)User::AllocL(aSize.iWidth*sizeof(TRgb));
|
|
204 |
TRgb *rgbBuf2=(TRgb *)User::Alloc(aSize.iWidth*sizeof(TRgb));
|
|
205 |
if(!rgbBuf2)
|
|
206 |
{
|
|
207 |
User::Free(rgbBuf1);
|
|
208 |
User::Leave(KErrNoMemory);
|
|
209 |
}
|
|
210 |
TBool equal = ETrue;
|
|
211 |
TInt maxDeviation = 0;
|
|
212 |
for(TInt yy = 0; yy < aSize.iHeight && equal; yy++)
|
|
213 |
{
|
|
214 |
TPtr8 ptr1((TUint8 *)rgbBuf1,aSize.iWidth*sizeof(TRgb));
|
|
215 |
bmp1->GetScanLine(ptr1, TPoint(0, yy), aSize.iWidth, ERgb);
|
|
216 |
TPtr8 ptr2((TUint8 *)rgbBuf2,aSize.iWidth*sizeof(TRgb));
|
|
217 |
bmp2->GetScanLine(ptr2, TPoint(0, yy), aSize.iWidth, ERgb);
|
|
218 |
|
|
219 |
TRgb *rgbBufCur1 = rgbBuf1;
|
|
220 |
TRgb *rgbBufCur2 = rgbBuf2;
|
|
221 |
for(TInt ii = 0; ii < aSize.iWidth; ii++)
|
|
222 |
{
|
|
223 |
TInt delta = Abs(rgbBufCur1->Red()-rgbBufCur2->Red());
|
|
224 |
TInt delta1 = Abs(rgbBufCur1->Green()-rgbBufCur2->Green());
|
|
225 |
TInt delta2 = Abs(rgbBufCur1->Blue()-rgbBufCur2->Blue());
|
|
226 |
|
|
227 |
if((delta > aTolerance) || (delta1 > aTolerance) || (delta2 > aTolerance))
|
|
228 |
{
|
|
229 |
equal = EFalse;
|
|
230 |
}
|
|
231 |
TInt maxItermedia = Max(delta1, delta2);
|
|
232 |
maxItermedia = Max(maxItermedia, delta);
|
|
233 |
maxDeviation = Max(maxItermedia, maxDeviation);
|
|
234 |
|
|
235 |
rgbBufCur1++;
|
|
236 |
rgbBufCur2++;
|
|
237 |
}
|
|
238 |
}
|
|
239 |
|
|
240 |
User::Free(rgbBuf1);
|
|
241 |
User::Free(rgbBuf2);
|
|
242 |
|
|
243 |
CleanupStack::PopAndDestroy(2,bmp1);
|
|
244 |
|
|
245 |
if (!equal)
|
|
246 |
{
|
|
247 |
INFO_PRINTF3(_L("%S CheckRectA failed, max deviation %d"), &aErrorMsg, maxDeviation);
|
|
248 |
}
|
|
249 |
else if(maxDeviation)
|
|
250 |
{
|
|
251 |
INFO_PRINTF4(_L("%S CheckRectA passed with tolerance %d, max deviation %d"), &aErrorMsg, aTolerance, maxDeviation);
|
|
252 |
}
|
|
253 |
|
|
254 |
iStep->TEST(equal);
|
|
255 |
}
|
|
256 |
|
|
257 |
void CTAlphaWin::TestCondition()
|
|
258 |
{
|
|
259 |
// User::After(1000000);// helpful when debugging
|
|
260 |
iRefWin->DrawNow();
|
|
261 |
TheClient->Flush();
|
|
262 |
TheClient->WaitForRedrawsToFinish();
|
|
263 |
CheckRect(BaseWin,TestWin,_L("CTAlphaWin::TestCondition()"));
|
|
264 |
}
|
|
265 |
|
|
266 |
void CTAlphaWin::TestConditionL()
|
|
267 |
{
|
|
268 |
iRefWin->DrawNow();
|
|
269 |
TheClient->Flush();
|
|
270 |
TheClient->WaitForRedrawsToFinish();
|
|
271 |
|
|
272 |
const TInt tolerance = 9;
|
|
273 |
TSize winSize=BaseWin->Size();
|
|
274 |
TRect rect1(BaseWin->BaseWin()->InquireOffset(*TheClient->iGroup->WinTreeNode()),winSize);
|
|
275 |
TRect rect2(TestWin->BaseWin()->InquireOffset(*TheClient->iGroup->WinTreeNode()),winSize);
|
|
276 |
CheckRectL(rect1, rect2, winSize, TheClient->iScreen->DisplayMode(), tolerance, _L("CTAlphaWin::TestCondition()"));
|
|
277 |
}
|
|
278 |
|
|
279 |
void CTAlphaWin::TestInitialConfiguration()
|
|
280 |
{
|
|
281 |
if(TheClient->iScreen->DisplayMode() == EColor64K)
|
|
282 |
{
|
|
283 |
TestConditionL();
|
|
284 |
}
|
|
285 |
else
|
|
286 |
{
|
|
287 |
TestCondition();
|
|
288 |
}
|
|
289 |
}
|
|
290 |
|
|
291 |
void CTAlphaWin::TestMove()
|
|
292 |
{
|
|
293 |
// Test moving windows, both in front and behind
|
|
294 |
for (TInt i = 0; i<5; i++)
|
|
295 |
{
|
|
296 |
TPoint pos = iTestWin[i]->Position();
|
|
297 |
pos += TPoint(10,10);
|
|
298 |
iTestWin[i]->SetPos(pos);
|
|
299 |
TestCondition();
|
|
300 |
}
|
|
301 |
for (TInt j = 0; j<5; j++)
|
|
302 |
{
|
|
303 |
TPoint pos = iTestWin[j]->Position();
|
|
304 |
pos -= TPoint(10,10);
|
|
305 |
iTestWin[j]->SetPos(pos);
|
|
306 |
TestCondition();
|
|
307 |
}
|
|
308 |
}
|
|
309 |
|
|
310 |
|
|
311 |
void CTAlphaWin::TestRedraw()
|
|
312 |
{
|
|
313 |
// Test redrawing windows, both in front and behind
|
|
314 |
for (TInt i=0; i<5; i++)
|
|
315 |
{
|
|
316 |
iTestWin[i]->DrawNow();
|
|
317 |
TestCondition();
|
|
318 |
}
|
|
319 |
}
|
|
320 |
|
|
321 |
|
|
322 |
void CTAlphaWin::TestInvisible()
|
|
323 |
{
|
|
324 |
// Test making windows visible and invisible, both in front and behind
|
|
325 |
for (TInt i=0; i<5; i++)
|
|
326 |
{
|
|
327 |
iTestWin[i]->SetVisible(EFalse);
|
|
328 |
TestCondition();
|
|
329 |
iTestWin[i]->SetVisible(ETrue);
|
|
330 |
TestCondition();
|
|
331 |
}
|
|
332 |
}
|
|
333 |
|
|
334 |
void CTAlphaWin::TestChildrenL()
|
|
335 |
{
|
|
336 |
struct CTAlphaWinChildren: public TCleanupItem
|
|
337 |
{
|
|
338 |
static void Destroy(TAny* trg)
|
|
339 |
{
|
|
340 |
static_cast<CTAlphaWindow*>(trg)->DestroyChildren();
|
|
341 |
}
|
|
342 |
CTAlphaWinChildren(CTAlphaWindow*trg): TCleanupItem(Destroy,trg)
|
|
343 |
{}
|
|
344 |
|
|
345 |
};
|
|
346 |
CleanupStack::PushL(CTAlphaWinChildren(iTestWin[2]));
|
|
347 |
iTestWin[2]->CreateChildrenL(3);
|
|
348 |
TestCondition();
|
|
349 |
TestMove();
|
|
350 |
CleanupStack::PopAndDestroy(iTestWin[2]);
|
|
351 |
}
|
|
352 |
|
|
353 |
|
|
354 |
void CTAlphaWin::TestAntiAliasedTextTransparentL()
|
|
355 |
{
|
|
356 |
|
|
357 |
//Clear the screen
|
|
358 |
for (TInt i=0; i<5; i++)
|
|
359 |
{
|
|
360 |
iTestWin[i]->SetVisible(EFalse);
|
|
361 |
}
|
|
362 |
iRefWin->SetVisible(EFalse);
|
|
363 |
TheClient->iWs.Flush();
|
|
364 |
|
|
365 |
//Create a new test window on the left
|
|
366 |
//Create a transparent window:
|
|
367 |
TSize winSize = BaseWin->Size();
|
|
368 |
|
|
369 |
RWindow theWin(TestWin->Client()->iWs);
|
|
370 |
User::LeaveIfError(theWin.Construct(*(TestWin->WinTreeNode()),(TUint32)&theWin));
|
|
371 |
|
|
372 |
theWin.SetExtent(TPoint(0,0), winSize);
|
|
373 |
theWin.SetBackgroundColor(TRgb(127,0,255,127));
|
187
|
374 |
TDisplayMode mode = EColor16MAP;
|
|
375 |
theWin.SetRequiredDisplayMode(mode);
|
103
|
376 |
theWin.SetVisible(ETrue);
|
|
377 |
theWin.SetTransparencyAlphaChannel();
|
|
378 |
theWin.Activate();
|
|
379 |
TheClient->iWs.Flush();
|
|
380 |
CleanupClosePushL(theWin);
|
|
381 |
|
|
382 |
//get windows screen device.
|
|
383 |
CWsScreenDevice *device;
|
|
384 |
device = new (ELeave)CWsScreenDevice(TestWin->Client()->iWs);//(TheClient->iWs);
|
|
385 |
User::LeaveIfError(device->Construct(iTest->ScreenNumber()));
|
|
386 |
CleanupStack::PushL(device);
|
|
387 |
|
|
388 |
TFontSpec fs1;
|
|
389 |
CFont *font1;
|
|
390 |
CFont *font2;
|
|
391 |
fs1.iTypeface.iName = KTestFontTypefaceName;
|
|
392 |
fs1.iHeight = 16;
|
|
393 |
fs1.iFontStyle.SetBitmapType(EDefaultGlyphBitmap);
|
|
394 |
int error = TheClient->iScreen->GetNearestFontToDesignHeightInPixels((CFont*&)font1,fs1);
|
|
395 |
if (error)
|
|
396 |
{
|
|
397 |
TheClient->iScreen->ReleaseFont(font1);
|
|
398 |
User::Panic(_L("font not created"),error);
|
|
399 |
}
|
|
400 |
fs1.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
|
|
401 |
error = TheClient->iScreen->GetNearestFontToDesignHeightInPixels((CFont*&)font2,fs1);
|
|
402 |
if (error)
|
|
403 |
{
|
|
404 |
TheClient->iScreen->ReleaseFont(font1);
|
|
405 |
TheClient->iScreen->ReleaseFont(font2);
|
|
406 |
User::Panic(_L("font not created"),error);
|
|
407 |
}
|
|
408 |
|
|
409 |
CWindowGc *gc;
|
|
410 |
device->CreateContext(gc);
|
|
411 |
CleanupStack::PushL(gc);
|
|
412 |
|
|
413 |
theWin.Invalidate();
|
|
414 |
theWin.BeginRedraw();
|
|
415 |
gc->Activate(theWin);
|
|
416 |
|
|
417 |
gc->SetPenStyle( CGraphicsContext::ESolidPen );
|
|
418 |
gc->SetPenColor( TRgb( 0, 0, 0, 127 ) );
|
|
419 |
|
|
420 |
//draw text for anti-aliasing needs an open font (scalable).
|
|
421 |
int typefaces = TheClient->iScreen->NumTypefaces();
|
|
422 |
|
|
423 |
gc->UseFont(font1);
|
|
424 |
gc->SetBrushStyle( CGraphicsContext::ENullBrush );
|
|
425 |
gc->DrawText(_L("Test"),TPoint(10,20));
|
|
426 |
gc->DiscardFont();
|
|
427 |
gc->UseFont(font2);
|
|
428 |
gc->DrawText(_L("Test"),TPoint(10,60));
|
|
429 |
gc->DiscardFont();
|
|
430 |
|
|
431 |
//destruction and tidying up
|
|
432 |
gc->Deactivate();
|
|
433 |
theWin.EndRedraw();
|
|
434 |
TheClient->iWs.Flush();
|
|
435 |
|
|
436 |
TheClient->iScreen->ReleaseFont(font1);
|
|
437 |
TheClient->iScreen->ReleaseFont(font2);
|
|
438 |
CleanupStack::PopAndDestroy(gc);//gc
|
|
439 |
CleanupStack::PopAndDestroy(device);//device
|
|
440 |
|
|
441 |
//do not close the test window yet since there is a comparison
|
|
442 |
//required
|
|
443 |
|
|
444 |
//now do the same on an off screen bitmap. Then create a window
|
|
445 |
//and put the bitmap onto it.
|
|
446 |
//create a colour bitmap
|
|
447 |
//
|
|
448 |
CFbsBitmap *bitmapOne;
|
|
449 |
bitmapOne = new (ELeave)CFbsBitmap();
|
|
450 |
CleanupStack::PushL(bitmapOne);
|
187
|
451 |
User::LeaveIfError(bitmapOne->Create(winSize,mode));
|
103
|
452 |
|
|
453 |
CFbsBitmapDevice *deviceOne=CFbsBitmapDevice::NewL(bitmapOne);
|
|
454 |
CleanupStack::PushL(deviceOne);
|
|
455 |
|
|
456 |
CFont *font3;
|
|
457 |
CFont *font4;
|
|
458 |
fs1.iFontStyle.SetBitmapType(EDefaultGlyphBitmap);
|
|
459 |
error = TheClient->iScreen->GetNearestFontToDesignHeightInPixels((CFont*&)font3,fs1);
|
|
460 |
if (error)
|
|
461 |
{
|
|
462 |
TheClient->iScreen->ReleaseFont(font3);
|
|
463 |
User::Panic(_L("font not created"),error);
|
|
464 |
}
|
|
465 |
fs1.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
|
|
466 |
error = TheClient->iScreen->GetNearestFontToDesignHeightInPixels((CFont*&)font4,fs1);
|
|
467 |
if (error)
|
|
468 |
{
|
|
469 |
TheClient->iScreen->ReleaseFont(font3);
|
|
470 |
TheClient->iScreen->ReleaseFont(font4);
|
|
471 |
User::Panic(_L("font not created"),error);
|
|
472 |
}
|
|
473 |
CFbsBitGc *bGcOne = CFbsBitGc::NewL();
|
|
474 |
CleanupStack::PushL(bGcOne);
|
|
475 |
|
|
476 |
bGcOne->Activate(deviceOne);
|
|
477 |
|
|
478 |
bGcOne->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
|
479 |
bGcOne->SetBrushColor(TRgb(127,0,255,127));
|
|
480 |
bGcOne->DrawRect(TRect(0,0,winSize.iWidth,winSize.iHeight));
|
|
481 |
|
|
482 |
bGcOne->SetPenStyle(CGraphicsContext::ESolidPen);
|
|
483 |
bGcOne->SetPenColor(TRgb(0,0,0,127));
|
|
484 |
|
|
485 |
bGcOne->UseFont(font3);
|
|
486 |
bGcOne->SetBrushStyle( CGraphicsContext::ENullBrush );
|
|
487 |
bGcOne->DrawText(_L("Test"),TPoint(10,20));
|
|
488 |
bGcOne->DiscardFont();
|
|
489 |
bGcOne->UseFont(font4);
|
|
490 |
bGcOne->DrawText(_L("Test"),TPoint(10,60));
|
|
491 |
bGcOne->DiscardFont();
|
|
492 |
//destruction and tidying up
|
|
493 |
//measure the text
|
|
494 |
CFont::TMeasureTextOutput textSize;
|
|
495 |
font4->MeasureText(_L("Test"),NULL,&textSize);
|
|
496 |
|
|
497 |
TheClient->iScreen->ReleaseFont(font3);
|
|
498 |
TheClient->iScreen->ReleaseFont(font4);
|
|
499 |
|
|
500 |
//display at the left
|
|
501 |
RWindow refWin(BaseWin->Client()->iWs);
|
|
502 |
CleanupClosePushL(refWin);
|
|
503 |
User::LeaveIfError(refWin.Construct(*(BaseWin->WinTreeNode()),(TUint32)&refWin));
|
|
504 |
|
|
505 |
refWin.SetExtent(TPoint(0,0), winSize);
|
187
|
506 |
refWin.SetRequiredDisplayMode(mode);
|
103
|
507 |
refWin.SetVisible(ETrue);
|
|
508 |
refWin.SetTransparencyAlphaChannel();
|
|
509 |
refWin.Activate();
|
|
510 |
TheClient->iWs.Flush();
|
|
511 |
|
|
512 |
//a gc for the ref win
|
|
513 |
CWsScreenDevice *refDevice;
|
|
514 |
refDevice = new (ELeave)CWsScreenDevice(BaseWin->Client()->iWs);
|
|
515 |
User::LeaveIfError(refDevice->Construct(iTest->ScreenNumber()));
|
|
516 |
CleanupStack::PushL(refDevice);
|
|
517 |
CWindowGc *gcRef;
|
|
518 |
refDevice->CreateContext(gcRef);
|
|
519 |
CleanupStack::PushL(gcRef);
|
|
520 |
|
|
521 |
refWin.Invalidate();
|
|
522 |
refWin.BeginRedraw();
|
|
523 |
gcRef->Activate(refWin);
|
|
524 |
gcRef->BitBlt(TPoint(0,0), bitmapOne);
|
|
525 |
gcRef->Deactivate();
|
|
526 |
refWin.EndRedraw();
|
|
527 |
TheClient->iWs.Flush();
|
|
528 |
|
|
529 |
TPoint refPos = refWin.AbsPosition();
|
|
530 |
TPoint winPos = theWin.AbsPosition();
|
|
531 |
|
|
532 |
//Compare the anti-aliased text areas
|
|
533 |
TInt textLength=textSize.iBounds.iBr.iX;
|
|
534 |
TInt textHeight=Abs(textSize.iBounds.iTl.iY);
|
|
535 |
|
|
536 |
TRect rect1(refPos.iX+10,refPos.iY+60-textHeight,
|
|
537 |
refPos.iX+10+textLength,refPos.iY+60);
|
|
538 |
TRect rect2(winPos.iX+10,winPos.iY+60-textHeight,
|
|
539 |
winPos.iX+10+textLength,winPos.iY+60);
|
|
540 |
|
|
541 |
TBool match = refDevice->RectCompare(rect1,rect2);
|
|
542 |
TEST(match);
|
|
543 |
|
|
544 |
CleanupStack::PopAndDestroy(gcRef);
|
|
545 |
CleanupStack::PopAndDestroy(refDevice);
|
|
546 |
CleanupStack::PopAndDestroy(&refWin);
|
|
547 |
|
|
548 |
CleanupStack::PopAndDestroy(bGcOne);
|
|
549 |
CleanupStack::PopAndDestroy(deviceOne);
|
|
550 |
CleanupStack::PopAndDestroy(bitmapOne);
|
|
551 |
CleanupStack::PopAndDestroy(&theWin);//theWin
|
|
552 |
|
|
553 |
}
|
|
554 |
//
|
|
555 |
// CTDrawOpWin
|
|
556 |
//
|
|
557 |
|
|
558 |
CTDrawOpWin* CTDrawOpWin::NewL(CTAlphaWin* aTest, CTWinBase* aParent, TPoint aPos, TSize aSize, TRgb aDrawColour)
|
|
559 |
{
|
|
560 |
CTDrawOpWin* theWin = new(ELeave) CTDrawOpWin(aTest,aDrawColour);
|
|
561 |
|
|
562 |
theWin->ConstructL(*aParent);
|
|
563 |
theWin->SetExtL(aPos, aSize);
|
|
564 |
theWin->AssignGC(*TheClient->iGc);
|
|
565 |
if (TheClient->iScreen->DisplayMode() == EColor16MA)
|
|
566 |
{
|
|
567 |
theWin->BaseWin()->SetRequiredDisplayMode(EColor16MA);
|
|
568 |
}
|
|
569 |
else
|
|
570 |
{
|
|
571 |
theWin->BaseWin()->SetRequiredDisplayMode(EColor64K);
|
|
572 |
}
|
|
573 |
|
|
574 |
theWin->Activate();
|
|
575 |
theWin->DrawNow();
|
|
576 |
|
|
577 |
return theWin;
|
|
578 |
}
|
|
579 |
|
|
580 |
CTDrawOpWin::CTDrawOpWin(CTAlphaWin* aTest, TRgb aDrawColour)
|
|
581 |
: iTest(aTest), iDrawColour(aDrawColour)
|
|
582 |
{}
|
|
583 |
|
|
584 |
|
|
585 |
void CTDrawOpWin::SetDrawOp(TInt aDrawOp)
|
|
586 |
{
|
|
587 |
iDrawOp = aDrawOp;
|
|
588 |
}
|
|
589 |
|
|
590 |
|
|
591 |
void CTDrawOpWin::Draw()
|
|
592 |
{
|
|
593 |
_LIT(KText,"Text test");
|
|
594 |
|
|
595 |
iGc->SetPenColor(iDrawColour);
|
|
596 |
iGc->SetBrushColor(iDrawColour);
|
|
597 |
TSize size = Size();
|
|
598 |
TInt top = 5;
|
|
599 |
TInt left = 5;
|
|
600 |
TInt bottom = size.iHeight - 5;
|
|
601 |
TInt right = size.iWidth - 5;
|
|
602 |
TInt square = Min(bottom-top,right-left);
|
|
603 |
|
|
604 |
switch (iDrawOp)
|
|
605 |
{
|
|
606 |
case EOpDrawRect:
|
|
607 |
iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
|
608 |
iGc->SetPenStyle(CGraphicsContext::ENullPen);
|
|
609 |
iGc->DrawRect(TRect(left,top,right,bottom));
|
|
610 |
break;
|
|
611 |
case EOpDrawLine:
|
|
612 |
//!! FAILS
|
|
613 |
//!! The endpoint of the line is drawn twice, with the result that it is darker when we do blending
|
|
614 |
//!! Not intending to fix at the moment
|
|
615 |
/*
|
|
616 |
iGc->SetPenStyle(CGraphicsContext::ESolidPen);
|
|
617 |
iGc->SetPenSize(TSize(4,4));
|
|
618 |
// The lines must not overlap, otherwise the blended lines will be darker at the overlap
|
|
619 |
iGc->DrawLine(TPoint(left+5,top), TPoint(left+square,top));
|
|
620 |
iGc->DrawLine(TPoint(left+5,top+5), TPoint(left+square,top+square));
|
|
621 |
iGc->DrawLine(TPoint(left,top+5), TPoint(left,top+square));
|
|
622 |
*/
|
|
623 |
break;
|
|
624 |
case EOpDrawEllipse:
|
|
625 |
iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
|
626 |
iGc->SetPenStyle(CGraphicsContext::ENullPen);
|
|
627 |
iGc->DrawEllipse(TRect(left,top,right,bottom));
|
|
628 |
break;
|
|
629 |
case EOpDrawText:
|
|
630 |
case EOpDrawTextVertical:
|
|
631 |
{
|
|
632 |
iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
|
|
633 |
iGc->SetPenStyle(CGraphicsContext::ESolidPen);
|
|
634 |
CFont* font;
|
|
635 |
TFontSpec fontSpec(KTestFontTypefaceName,200);
|
|
636 |
User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInTwips(font, fontSpec));
|
|
637 |
iGc->UseFont(font);
|
|
638 |
if (iDrawOp==EOpDrawText)
|
|
639 |
iGc->DrawText(KText(), TPoint(5,30));
|
|
640 |
else
|
|
641 |
iGc->DrawTextVertical(KText(), TPoint(5,30), EFalse);
|
|
642 |
iGc->DiscardFont();
|
|
643 |
TheClient->iScreen->ReleaseFont(font);
|
|
644 |
}
|
|
645 |
break;
|
|
646 |
case EOpDrawTextAntiAliased:
|
|
647 |
{
|
|
648 |
iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
|
|
649 |
iGc->SetPenStyle(CGraphicsContext::ESolidPen);
|
|
650 |
CFont* font;
|
|
651 |
TFontSpec fontSpec(KTestFontTypefaceName,600);
|
|
652 |
fontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightBold);
|
|
653 |
fontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
|
|
654 |
|
|
655 |
User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInTwips(font, fontSpec));
|
|
656 |
iGc->UseFont(font);
|
|
657 |
iGc->DrawText(KText(), TPoint(5,30));
|
|
658 |
iGc->DiscardFont();
|
|
659 |
TheClient->iScreen->ReleaseFont(font);
|
|
660 |
}
|
|
661 |
break;
|
|
662 |
case EOpBitBlt:
|
|
663 |
break;
|
|
664 |
case EOpBitBltMasked:
|
|
665 |
break;
|
|
666 |
default:
|
|
667 |
break;
|
|
668 |
};
|
|
669 |
}
|
|
670 |
|
|
671 |
|
|
672 |
|
|
673 |
//
|
|
674 |
// CTAlphaWindow
|
|
675 |
//
|
|
676 |
|
|
677 |
CTAlphaWindow::~CTAlphaWindow()
|
|
678 |
{
|
|
679 |
DestroyChildren();
|
|
680 |
}
|
|
681 |
|
|
682 |
CTAlphaWindow* CTAlphaWindow::NewL(CTAlphaWin* aTest, CTWinBase* aParent, TPoint aPos, TSize aSize, TInt aDrawState)
|
|
683 |
{
|
|
684 |
CTAlphaWindow* theWin = new (ELeave) CTAlphaWindow(aTest);
|
|
685 |
|
|
686 |
theWin->ConstructL(*aParent);
|
|
687 |
theWin->SetExtL(aPos, aSize);
|
|
688 |
theWin->SetDrawState(aDrawState);
|
|
689 |
|
|
690 |
theWin->AssignGC(*TheClient->iGc);
|
|
691 |
|
|
692 |
theWin->Activate();
|
|
693 |
theWin->iDrawState |= EActive;
|
|
694 |
theWin->DrawNow();
|
|
695 |
|
|
696 |
return theWin;
|
|
697 |
}
|
|
698 |
|
|
699 |
void CTAlphaWindow::SetDrawState(TInt aDrawState)
|
|
700 |
{
|
|
701 |
TBool active = iDrawState & EActive;
|
|
702 |
iDrawState = aDrawState & 0x7fffffff;
|
|
703 |
|
|
704 |
TRgb colour = ColourFromDrawState(iDrawState);
|
|
705 |
((RWindow*) DrawableWin())->SetBackgroundColor(colour);
|
|
706 |
|
|
707 |
if (iDrawState & EModeColor16MA)
|
|
708 |
BaseWin()->SetRequiredDisplayMode(EColor16MA);
|
|
709 |
else
|
|
710 |
BaseWin()->SetRequiredDisplayMode(EColor64K);
|
|
711 |
|
|
712 |
BaseWin()->SetVisible(! (iDrawState & EInvisible));
|
|
713 |
|
|
714 |
if (!active)
|
|
715 |
{
|
|
716 |
if (iDrawState & EAlphaTransparency)
|
|
717 |
((RWindow*) DrawableWin())->SetTransparencyAlphaChannel();
|
|
718 |
else if (iDrawState & ETransparencyFactor)
|
|
719 |
((RWindow*) DrawableWin())->SetTransparencyFactor(TRgb(128,128,128));
|
|
720 |
}
|
|
721 |
|
|
722 |
if (active)
|
|
723 |
iDrawState |= EActive;
|
|
724 |
}
|
|
725 |
|
|
726 |
void CTAlphaWindow::SetVisible(TBool aVisible)
|
|
727 |
{
|
|
728 |
if (aVisible)
|
|
729 |
iDrawState &= ~EInvisible;
|
|
730 |
else
|
|
731 |
iDrawState |= EInvisible;
|
|
732 |
BaseWin()->SetVisible(aVisible);
|
|
733 |
}
|
|
734 |
|
|
735 |
void CTAlphaWindow::CreateChildrenL(TInt aDepth)
|
|
736 |
{
|
|
737 |
DestroyChildren();
|
|
738 |
if (aDepth>0)
|
|
739 |
{
|
|
740 |
TSize size = Size();
|
|
741 |
iChild1 = CTAlphaWindow::NewL(iTest, this, TPoint(size.iWidth/3,0), TSize(2*size.iWidth/3, 2*size.iHeight/3), ERed | EGreen | EBlue | EOpaque);
|
|
742 |
iChild2 = CTAlphaWindow::NewL(iTest, this, TPoint(0,size.iHeight/3), TSize(2*size.iWidth/3, 2*size.iHeight/3), ERed | EGreen | EBlue | EAlphaTransparency);
|
|
743 |
iChild2->CreateChildrenL(aDepth-1);
|
|
744 |
}
|
|
745 |
}
|
|
746 |
|
|
747 |
void CTAlphaWindow::DestroyChildren()
|
|
748 |
{
|
|
749 |
if (iChild1)
|
|
750 |
{
|
|
751 |
iChild1->DestroyChildren();
|
|
752 |
delete iChild1;
|
|
753 |
iChild1 = NULL;
|
|
754 |
}
|
|
755 |
if (iChild2)
|
|
756 |
{
|
|
757 |
iChild2->DestroyChildren();
|
|
758 |
delete iChild2;
|
|
759 |
iChild2 = NULL;
|
|
760 |
}
|
|
761 |
}
|
|
762 |
|
|
763 |
TInt CTAlphaWindow::DrawState()
|
|
764 |
{
|
|
765 |
return iDrawState;
|
|
766 |
}
|
|
767 |
|
|
768 |
void CTAlphaWindow::Draw()
|
|
769 |
{
|
|
770 |
// we draw a diagonal line from top left to bottom right
|
|
771 |
// we use the complementary colour to the window background colour
|
|
772 |
TInt red = (iDrawState & ERed) ? 0 : 255;
|
|
773 |
TInt green = (iDrawState & EGreen) ? 0 : 255;
|
|
774 |
TInt blue = (iDrawState & EBlue) ? 0 : 255;
|
|
775 |
TRgb color(red,green,blue);
|
|
776 |
|
|
777 |
TSize size = Size();
|
|
778 |
iGc->SetPenColor(color);
|
|
779 |
iGc->SetPenSize(TSize(4,4));
|
|
780 |
iGc->DrawLine(TPoint(0,0), TPoint(size.iWidth, size.iHeight));
|
|
781 |
}
|
|
782 |
|
|
783 |
|
|
784 |
//
|
|
785 |
// CTAlphaRefWin
|
|
786 |
//
|
|
787 |
|
|
788 |
CTAlphaRefWin::CTAlphaRefWin(TFixedArray<CTAlphaWindow*,5>& aAlphaWin)
|
|
789 |
: iAlphaWin(aAlphaWin)
|
|
790 |
{}
|
|
791 |
|
|
792 |
CTAlphaRefWin* CTAlphaRefWin::NewL(CTWinBase* aParent, TPoint aPos, TSize aSize, TFixedArray<CTAlphaWindow*,5>& aAlphaWin)
|
|
793 |
{
|
|
794 |
CTAlphaRefWin* theWin = new(ELeave) CTAlphaRefWin(aAlphaWin);
|
|
795 |
|
|
796 |
theWin->ConstructL(*aParent);
|
|
797 |
theWin->SetExtL(aPos, aSize);
|
|
798 |
theWin->AssignGC(*TheClient->iGc);
|
|
799 |
theWin->BaseWin()->SetRequiredDisplayMode(EColor64K);
|
|
800 |
|
|
801 |
theWin->Activate();
|
|
802 |
theWin->DrawNow();
|
|
803 |
|
|
804 |
return theWin;
|
|
805 |
}
|
|
806 |
|
|
807 |
void CTAlphaRefWin::Draw()
|
|
808 |
{
|
|
809 |
iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
|
810 |
iGc->SetBrushColor(KRgbWhite);
|
|
811 |
iGc->Clear();
|
|
812 |
|
|
813 |
// Note, the order of the windows in the array must correspond to their z-order
|
|
814 |
for (TInt i=0; i<5; i++)
|
|
815 |
DrawWindow(iAlphaWin[i], iAlphaWin[i]->Position());
|
|
816 |
}
|
|
817 |
|
|
818 |
void CTAlphaRefWin::DrawWindow(CTAlphaWindow* aWindow, TPoint aPos)
|
|
819 |
{
|
|
820 |
TInt drawState = aWindow->DrawState();
|
|
821 |
if ( (drawState & EInvisible) || ! (drawState & EActive) )
|
|
822 |
return;
|
|
823 |
|
|
824 |
TRgb colour = ColourFromDrawState(drawState);
|
|
825 |
if (drawState & EOpaque)
|
|
826 |
colour.SetAlpha(255);
|
|
827 |
if (drawState & ETransparent)
|
|
828 |
colour.SetAlpha(0);
|
|
829 |
iGc->SetBrushColor(colour);
|
|
830 |
|
|
831 |
TPoint tl = aPos;
|
|
832 |
TPoint br = tl + aWindow->Size();
|
|
833 |
TRect rect(tl,br);
|
|
834 |
iGc->Clear(rect);
|
|
835 |
|
|
836 |
TInt red = (drawState & ERed) ? 0 : 255;
|
|
837 |
TInt green = (drawState & EGreen) ? 0 : 255;
|
|
838 |
TInt blue = (drawState & EBlue) ? 0 : 255;
|
|
839 |
colour = TRgb(red,green,blue);
|
|
840 |
|
|
841 |
iGc->SetClippingRect(rect);
|
|
842 |
|
|
843 |
TSize size = Size();
|
|
844 |
iGc->SetPenColor(colour);
|
|
845 |
iGc->SetPenSize(TSize(4,4));
|
|
846 |
iGc->DrawLine(tl, br);
|
|
847 |
|
|
848 |
iGc->CancelClippingRect();
|
|
849 |
|
|
850 |
if (aWindow->iChild1)
|
|
851 |
DrawWindow(aWindow->iChild1, aPos + aWindow->iChild1->Position() );
|
|
852 |
if (aWindow->iChild2)
|
|
853 |
DrawWindow(aWindow->iChild2, aPos + aWindow->iChild2->Position() );
|
|
854 |
}
|
|
855 |
|
|
856 |
|
|
857 |
//
|
|
858 |
// Main test loop
|
|
859 |
//
|
|
860 |
void CTAlphaWin::RunTestCaseL(TInt /*aCurTestCase*/)
|
|
861 |
{
|
|
862 |
//User::After(TTimeIntervalMicroSeconds32(1000 * 1000));
|
|
863 |
((CTAlphaWinStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
|
|
864 |
switch (++iTest->iState)
|
|
865 |
{
|
|
866 |
/**
|
|
867 |
|
|
868 |
@SYMTestCaseID GRAPHICS-WSERV-0278
|
|
869 |
|
|
870 |
@SYMDEF DEF081259
|
|
871 |
|
|
872 |
@SYMPREQ 915
|
|
873 |
|
|
874 |
@SYMTestCaseDesc Semi-transparent drawing
|
|
875 |
|
|
876 |
@SYMTestPriority High
|
|
877 |
|
|
878 |
@SYMTestStatus Implemented
|
|
879 |
|
|
880 |
@SYMTestActions Use draw operations with semi-transparent pen or brush colours
|
|
881 |
|
|
882 |
@SYMTestExpectedResults Draw operations must do alpha blending
|
|
883 |
|
|
884 |
*/
|
|
885 |
case 1:
|
|
886 |
{
|
|
887 |
((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0278"));
|
|
888 |
if(TransparencySupportedL() == KErrNotSupported)
|
|
889 |
{
|
|
890 |
LOG_MESSAGE(_L("Test(1) complete - Transparency not supported\n"));
|
|
891 |
TestComplete();
|
|
892 |
break;
|
|
893 |
}
|
|
894 |
TDisplayMode mode = TheClient->iScreen->DisplayMode();
|
|
895 |
if (mode < EColor64K)
|
|
896 |
{
|
|
897 |
LOG_MESSAGE(_L("Test(1) complete - Display mode < EColor64K\n"));
|
|
898 |
TestComplete();
|
|
899 |
break;
|
|
900 |
}
|
|
901 |
_LIT(KSemiTrans64K,"(1) Semi transparent drawing Color64K");
|
|
902 |
iTest->LogSubTest(KSemiTrans64K);
|
|
903 |
TestSemiTransparentDrawingL();
|
|
904 |
break;
|
|
905 |
}
|
|
906 |
|
|
907 |
/**
|
|
908 |
|
|
909 |
@SYMTestCaseID GRAPHICS-WSERV-0287
|
|
910 |
|
|
911 |
@SYMDEF DEF081259
|
|
912 |
|
|
913 |
@SYMPREQ 915
|
|
914 |
|
|
915 |
@SYMTestCaseDesc Invisible. All windows are in EColor16MA display mode.
|
|
916 |
|
|
917 |
@SYMTestPriority High
|
|
918 |
|
|
919 |
@SYMTestStatus Implemented
|
|
920 |
|
|
921 |
@SYMTestActions Transparent alpha channel windows are made invisible and visible both in front and behind one another
|
|
922 |
|
|
923 |
@SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing
|
|
924 |
|
|
925 |
*/
|
|
926 |
case 2:
|
|
927 |
((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0287"));
|
|
928 |
ConfigureDisplayModes(EColor16MA);
|
|
929 |
if(TransparencySupportedL()==KErrNone)
|
|
930 |
{
|
|
931 |
_LIT(KInvisible16MA,"(2) Invisible Color16MA");
|
|
932 |
iTest->LogSubTest(KInvisible16MA);
|
|
933 |
TestInvisible();
|
|
934 |
}
|
|
935 |
break;
|
|
936 |
|
|
937 |
/**
|
|
938 |
|
|
939 |
@SYMTestCaseID GRAPHICS-WSERV-0280
|
|
940 |
|
|
941 |
@SYMDEF DEF081259
|
|
942 |
|
|
943 |
@SYMPREQ 915
|
|
944 |
|
|
945 |
@SYMTestCaseDesc Initial Configuration. All windows are in EColor64K display mode.
|
|
946 |
|
|
947 |
@SYMTestPriority High
|
|
948 |
|
|
949 |
@SYMTestStatus Implemented
|
|
950 |
|
|
951 |
@SYMTestActions Several windows are set to be transparent alpha channel, and given semi-transparent or transparent background colours
|
|
952 |
|
|
953 |
@SYMTestExpectedResults The transparent window configuration matches a reference drawing created using only alpha blending
|
|
954 |
|
|
955 |
*/
|
|
956 |
//Test 3 to 6 can't be run without transparency support
|
|
957 |
case 3:
|
|
958 |
((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0280"));
|
|
959 |
ConfigureDisplayModes(EColor64K);
|
|
960 |
if(TransparencySupportedL()==KErrNone)
|
|
961 |
{
|
|
962 |
_LIT(KInitialConfiguration64K,"(3) Initial configuration Color64K");
|
|
963 |
iTest->LogSubTest(KInitialConfiguration64K);
|
|
964 |
TestInitialConfiguration();
|
|
965 |
}
|
|
966 |
break;
|
|
967 |
/**
|
|
968 |
|
|
969 |
@SYMTestCaseID GRAPHICS-WSERV-0281
|
|
970 |
|
|
971 |
@SYMDEF DEF081259
|
|
972 |
|
|
973 |
@SYMPREQ 915
|
|
974 |
|
|
975 |
@SYMTestCaseDesc Move. All windows are in EColor64K display mode.
|
|
976 |
|
|
977 |
@SYMTestPriority High
|
|
978 |
|
|
979 |
@SYMTestStatus Implemented
|
|
980 |
|
|
981 |
@SYMTestActions Transparent alpha channel windows are moved both in front and behind one another
|
|
982 |
|
|
983 |
@SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing
|
|
984 |
|
|
985 |
*/
|
|
986 |
case 4:
|
|
987 |
((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0281"));
|
|
988 |
if(TransparencySupportedL()==KErrNone)
|
|
989 |
{
|
|
990 |
_LIT(KMove64K,"(4) Move Color64K");
|
|
991 |
iTest->LogSubTest(KMove64K);
|
|
992 |
TestMove();
|
|
993 |
}
|
|
994 |
break;
|
|
995 |
/**
|
|
996 |
|
|
997 |
@SYMTestCaseID GRAPHICS-WSERV-0282
|
|
998 |
|
|
999 |
@SYMDEF DEF081259
|
|
1000 |
|
|
1001 |
@SYMPREQ 915
|
|
1002 |
|
|
1003 |
@SYMTestCaseDesc Redraw. All windows are in EColor64K display mode.
|
|
1004 |
|
|
1005 |
@SYMTestPriority High
|
|
1006 |
|
|
1007 |
@SYMTestStatus Implemented
|
|
1008 |
|
|
1009 |
@SYMTestActions Transparent alpha channel windows are redrawn both in front and behind one another
|
|
1010 |
|
|
1011 |
@SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing
|
|
1012 |
|
|
1013 |
*/
|
|
1014 |
case 5:
|
|
1015 |
((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0282"));
|
|
1016 |
if(TransparencySupportedL()==KErrNone)
|
|
1017 |
{
|
|
1018 |
_LIT(KRedraw64K,"(5) Redraw Color64K");
|
|
1019 |
iTest->LogSubTest(KRedraw64K);
|
|
1020 |
TestRedraw();
|
|
1021 |
}
|
|
1022 |
break;
|
|
1023 |
/**
|
|
1024 |
|
|
1025 |
@SYMTestCaseID GRAPHICS-WSERV-0283-0001
|
|
1026 |
|
|
1027 |
@SYMDEF DEF081259
|
|
1028 |
|
|
1029 |
@SYMPREQ 915
|
|
1030 |
|
|
1031 |
@SYMTestCaseDesc Invisible. All windows are in EColor64K display mode.
|
|
1032 |
|
|
1033 |
@SYMTestPriority High
|
|
1034 |
|
|
1035 |
@SYMTestStatus Implemented
|
|
1036 |
|
|
1037 |
@SYMTestActions Transparent alpha channel windows are made invisible and visible both in front and behind one another
|
|
1038 |
|
|
1039 |
@SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing
|
|
1040 |
|
|
1041 |
*/
|
|
1042 |
case 6:
|
|
1043 |
((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0283-0001"));
|
|
1044 |
if(TransparencySupportedL()==KErrNone)
|
|
1045 |
{
|
|
1046 |
_LIT(KInvisible64K,"(6) Invisible Color64K");
|
|
1047 |
iTest->LogSubTest(KInvisible64K);
|
|
1048 |
TestInvisible();
|
|
1049 |
}
|
|
1050 |
break;
|
|
1051 |
/**
|
|
1052 |
|
|
1053 |
@SYMTestCaseID GRAPHICS-WSERV-0283-0002
|
|
1054 |
|
|
1055 |
@SYMDEF DEF081259
|
|
1056 |
|
|
1057 |
@SYMPREQ 915
|
|
1058 |
|
|
1059 |
@SYMTestCaseDesc Children. All windows are in EColor64K display mode.
|
|
1060 |
|
|
1061 |
@SYMTestPriority High
|
|
1062 |
|
|
1063 |
@SYMTestStatus Implemented
|
|
1064 |
|
|
1065 |
@SYMTestActions Transparent alpha channel windows are given child windows, both transparent and non-transparent,
|
|
1066 |
and are then moved, redrawn, set visible or invisible both in front and behind one another
|
|
1067 |
|
|
1068 |
@SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing
|
|
1069 |
|
|
1070 |
*/
|
|
1071 |
case 7:
|
|
1072 |
((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0283-0002"));
|
|
1073 |
_LIT(KChildren64K,"(7)Children Color64K");
|
|
1074 |
iTest->LogSubTest(KChildren64K);
|
|
1075 |
TestChildrenL();
|
|
1076 |
break;
|
|
1077 |
/**
|
|
1078 |
|
|
1079 |
@SYMTestCaseID GRAPHICS-WSERV-0356
|
|
1080 |
|
|
1081 |
@SYMDEF DEF081259
|
|
1082 |
|
|
1083 |
@SYMPREQ 915
|
|
1084 |
|
|
1085 |
@SYMTestCaseDesc Initial Configuration. All windows are in EColor64k Dispaly Mode
|
|
1086 |
|
|
1087 |
@SYMTestPriority High
|
|
1088 |
|
|
1089 |
@SYMTestStatus Implemented
|
|
1090 |
|
|
1091 |
@SYMTestActions Tests Anti-aliasing of text
|
|
1092 |
|
|
1093 |
@SYMTestExpectedResults Anti-alisaing should behave correctly
|
|
1094 |
|
|
1095 |
*/
|
|
1096 |
case 8:
|
|
1097 |
((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0356"));
|
|
1098 |
_LIT(KAntiAliasedText64K,"(8) AntiAliasedText DEF082251 Color64K");
|
|
1099 |
iTest->LogSubTest(KAntiAliasedText64K);
|
|
1100 |
TestAntiAliasedTextTransparentL();
|
|
1101 |
break;
|
|
1102 |
|
|
1103 |
/**
|
|
1104 |
|
|
1105 |
@SYMTestCaseID GRAPHICS-WSERV-0284
|
|
1106 |
|
|
1107 |
@SYMDEF DEF081259
|
|
1108 |
|
|
1109 |
@SYMPREQ 915
|
|
1110 |
|
|
1111 |
@SYMTestCaseDesc Initial Configuration. All windows are in EColor16MA display mode.
|
|
1112 |
|
|
1113 |
@SYMTestPriority High
|
|
1114 |
|
|
1115 |
@SYMTestStatus Implemented
|
|
1116 |
|
|
1117 |
@SYMTestActions Several windows are set to be transparent alpha channel, and given semi-transparent or transparent background colours
|
|
1118 |
|
|
1119 |
@SYMTestExpectedResults The transparent window configuration matches a reference drawing created using only alpha blending
|
|
1120 |
|
|
1121 |
*/
|
|
1122 |
case 9:
|
|
1123 |
{
|
|
1124 |
((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0284"));
|
|
1125 |
ConfigureDisplayModes(EColor16MA);
|
|
1126 |
TDisplayMode mode1 = TheClient->iScreen->DisplayMode();
|
|
1127 |
_LIT(KInitialConfiguration16MA,"(9)Initial configuration Color16MA");
|
|
1128 |
iTest->LogSubTest(KInitialConfiguration16MA);
|
|
1129 |
TestInitialConfiguration();
|
|
1130 |
break;
|
|
1131 |
}
|
|
1132 |
/**
|
|
1133 |
|
|
1134 |
@SYMTestCaseID GRAPHICS-WSERV-0285
|
|
1135 |
|
|
1136 |
@SYMDEF DEF081259
|
|
1137 |
|
|
1138 |
@SYMPREQ 915
|
|
1139 |
|
|
1140 |
@SYMTestCaseDesc Move. All windows are in EColor16MA display mode.
|
|
1141 |
|
|
1142 |
@SYMTestPriority High
|
|
1143 |
|
|
1144 |
@SYMTestStatus Implemented
|
|
1145 |
|
|
1146 |
@SYMTestActions Transparent alpha channel windows are moved both in front and behind one another
|
|
1147 |
|
|
1148 |
@SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing
|
|
1149 |
|
|
1150 |
*/
|
|
1151 |
case 10:
|
|
1152 |
((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0285"));
|
|
1153 |
_LIT(KMove16MA,"(10)Move Color16MA");
|
|
1154 |
iTest->LogSubTest(KMove16MA);
|
|
1155 |
TestMove();
|
|
1156 |
break;
|
|
1157 |
/**
|
|
1158 |
|
|
1159 |
@SYMTestCaseID GRAPHICS-WSERV-0286
|
|
1160 |
|
|
1161 |
@SYMDEF DEF081259
|
|
1162 |
|
|
1163 |
@SYMPREQ 915
|
|
1164 |
|
|
1165 |
@SYMTestCaseDesc Redraw. All windows are in EColor16MA display mode.
|
|
1166 |
|
|
1167 |
@SYMTestPriority High
|
|
1168 |
|
|
1169 |
@SYMTestStatus Implemented
|
|
1170 |
|
|
1171 |
@SYMTestActions Transparent alpha channel windows are redrawn both in front and behind one another
|
|
1172 |
|
|
1173 |
@SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing
|
|
1174 |
|
|
1175 |
*/
|
|
1176 |
case 11:
|
|
1177 |
((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0286"));
|
|
1178 |
_LIT(KRedraw16MA,"(11)Redraw Color16MA");
|
|
1179 |
iTest->LogSubTest(KRedraw16MA);
|
|
1180 |
TestRedraw();
|
|
1181 |
break;
|
|
1182 |
|
|
1183 |
/**
|
|
1184 |
|
|
1185 |
@SYMTestCaseID GRAPHICS-WSERV-0279
|
|
1186 |
|
|
1187 |
@SYMDEF DEF081259
|
|
1188 |
|
|
1189 |
@SYMPREQ 915
|
|
1190 |
|
|
1191 |
@SYMTestCaseDesc Transparent drawing
|
|
1192 |
|
|
1193 |
@SYMTestPriority High
|
|
1194 |
|
|
1195 |
@SYMTestStatus Implemented
|
|
1196 |
|
|
1197 |
@SYMTestActions Use draw operations with transparent pen or brush colours
|
|
1198 |
|
|
1199 |
@SYMTestExpectedResults Draw operations with transparent pen or brush colours should leave the destination unchanged
|
|
1200 |
|
|
1201 |
*/
|
|
1202 |
|
|
1203 |
case 12:
|
|
1204 |
((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0279"));
|
|
1205 |
ConfigureDisplayModes(EColor64K);
|
|
1206 |
_LIT(KTrans64K,"(12) Transparent drawing Color64K");
|
|
1207 |
iTest->LogSubTest(KTrans64K);
|
|
1208 |
TestTransparentDrawingL();
|
|
1209 |
break;
|
|
1210 |
|
|
1211 |
|
|
1212 |
/**
|
|
1213 |
|
|
1214 |
@SYMTestCaseID GRAPHICS-WSERV-0288
|
|
1215 |
|
|
1216 |
@SYMDEF DEF081259
|
|
1217 |
|
|
1218 |
@SYMPREQ 915
|
|
1219 |
|
|
1220 |
@SYMTestCaseDesc Children. All windows are in EColor16MA display mode.
|
|
1221 |
|
|
1222 |
@SYMTestPriority High
|
|
1223 |
|
|
1224 |
@SYMTestStatus Implemented
|
|
1225 |
|
|
1226 |
@SYMTestActions Transparent alpha channel windows are given child windows, both transparent and non-transparent,
|
|
1227 |
and are then moved, redrawn, set visible or invisible both in front and behind one another
|
|
1228 |
|
|
1229 |
@SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing
|
|
1230 |
|
|
1231 |
*/
|
|
1232 |
case 13:
|
|
1233 |
((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0288"));
|
|
1234 |
_LIT(KChildren16MA,"(13) Children Color16MA");
|
|
1235 |
iTest->LogSubTest(KChildren16MA);
|
|
1236 |
TestChildrenL();
|
|
1237 |
break;
|
|
1238 |
/**
|
|
1239 |
|
|
1240 |
@SYMTestCaseID GRAPHICS-WSERV-0357
|
|
1241 |
|
|
1242 |
@SYMDEF DEF081259
|
|
1243 |
|
|
1244 |
@SYMPREQ 915
|
|
1245 |
|
|
1246 |
@SYMTestCaseDesc Initial Configuration. All windows are in EColor16MA Dispaly Mode
|
|
1247 |
|
|
1248 |
@SYMTestPriority High
|
|
1249 |
|
|
1250 |
@SYMTestStatus Implemented
|
|
1251 |
|
|
1252 |
@SYMTestActions Tests Anti-aliasing of text
|
|
1253 |
|
|
1254 |
@SYMTestExpectedResults Anti-alisaing should behave correctly
|
|
1255 |
|
|
1256 |
*/
|
|
1257 |
case 14:
|
|
1258 |
((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0357"));
|
|
1259 |
_LIT(KAntiAliasedText16MA,"(14) AntiAliasedText DEF082251 Color16MA");
|
|
1260 |
iTest->LogSubTest(KAntiAliasedText16MA);
|
|
1261 |
TestAntiAliasedTextTransparentL();
|
|
1262 |
break;
|
|
1263 |
default:
|
|
1264 |
((CTAlphaWinStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
|
|
1265 |
((CTAlphaWinStep*)iStep)->CloseTMSGraphicsStep();
|
|
1266 |
TestComplete();
|
|
1267 |
break;
|
|
1268 |
}
|
|
1269 |
((CTAlphaWinStep*)iStep)->RecordTestResultL();
|
|
1270 |
}
|
|
1271 |
|
|
1272 |
__WS_CONSTRUCT_STEP__(AlphaWin)
|
|
1273 |
|