|
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)); |
|
374 TInt mode=theWin.SetRequiredDisplayMode(EColor16MA); |
|
375 theWin.SetVisible(ETrue); |
|
376 theWin.SetTransparencyAlphaChannel(); |
|
377 theWin.Activate(); |
|
378 TheClient->iWs.Flush(); |
|
379 CleanupClosePushL(theWin); |
|
380 |
|
381 //get windows screen device. |
|
382 CWsScreenDevice *device; |
|
383 device = new (ELeave)CWsScreenDevice(TestWin->Client()->iWs);//(TheClient->iWs); |
|
384 User::LeaveIfError(device->Construct(iTest->ScreenNumber())); |
|
385 CleanupStack::PushL(device); |
|
386 |
|
387 TFontSpec fs1; |
|
388 CFont *font1; |
|
389 CFont *font2; |
|
390 fs1.iTypeface.iName = KTestFontTypefaceName; |
|
391 fs1.iHeight = 16; |
|
392 fs1.iFontStyle.SetBitmapType(EDefaultGlyphBitmap); |
|
393 int error = TheClient->iScreen->GetNearestFontToDesignHeightInPixels((CFont*&)font1,fs1); |
|
394 if (error) |
|
395 { |
|
396 TheClient->iScreen->ReleaseFont(font1); |
|
397 User::Panic(_L("font not created"),error); |
|
398 } |
|
399 fs1.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap); |
|
400 error = TheClient->iScreen->GetNearestFontToDesignHeightInPixels((CFont*&)font2,fs1); |
|
401 if (error) |
|
402 { |
|
403 TheClient->iScreen->ReleaseFont(font1); |
|
404 TheClient->iScreen->ReleaseFont(font2); |
|
405 User::Panic(_L("font not created"),error); |
|
406 } |
|
407 |
|
408 CWindowGc *gc; |
|
409 device->CreateContext(gc); |
|
410 CleanupStack::PushL(gc); |
|
411 |
|
412 theWin.Invalidate(); |
|
413 theWin.BeginRedraw(); |
|
414 gc->Activate(theWin); |
|
415 |
|
416 gc->SetPenStyle( CGraphicsContext::ESolidPen ); |
|
417 gc->SetPenColor( TRgb( 0, 0, 0, 127 ) ); |
|
418 |
|
419 //draw text for anti-aliasing needs an open font (scalable). |
|
420 int typefaces = TheClient->iScreen->NumTypefaces(); |
|
421 |
|
422 gc->UseFont(font1); |
|
423 gc->SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
424 gc->DrawText(_L("Test"),TPoint(10,20)); |
|
425 gc->DiscardFont(); |
|
426 gc->UseFont(font2); |
|
427 gc->DrawText(_L("Test"),TPoint(10,60)); |
|
428 gc->DiscardFont(); |
|
429 |
|
430 //destruction and tidying up |
|
431 gc->Deactivate(); |
|
432 theWin.EndRedraw(); |
|
433 TheClient->iWs.Flush(); |
|
434 |
|
435 TheClient->iScreen->ReleaseFont(font1); |
|
436 TheClient->iScreen->ReleaseFont(font2); |
|
437 CleanupStack::PopAndDestroy(gc);//gc |
|
438 CleanupStack::PopAndDestroy(device);//device |
|
439 |
|
440 //do not close the test window yet since there is a comparison |
|
441 //required |
|
442 |
|
443 //now do the same on an off screen bitmap. Then create a window |
|
444 //and put the bitmap onto it. |
|
445 //create a colour bitmap |
|
446 // |
|
447 CFbsBitmap *bitmapOne; |
|
448 bitmapOne = new (ELeave)CFbsBitmap(); |
|
449 CleanupStack::PushL(bitmapOne); |
|
450 User::LeaveIfError(bitmapOne->Create(winSize,static_cast<TDisplayMode>(mode))); |
|
451 |
|
452 CFbsBitmapDevice *deviceOne=CFbsBitmapDevice::NewL(bitmapOne); |
|
453 CleanupStack::PushL(deviceOne); |
|
454 |
|
455 CFont *font3; |
|
456 CFont *font4; |
|
457 fs1.iFontStyle.SetBitmapType(EDefaultGlyphBitmap); |
|
458 error = TheClient->iScreen->GetNearestFontToDesignHeightInPixels((CFont*&)font3,fs1); |
|
459 if (error) |
|
460 { |
|
461 TheClient->iScreen->ReleaseFont(font3); |
|
462 User::Panic(_L("font not created"),error); |
|
463 } |
|
464 fs1.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap); |
|
465 error = TheClient->iScreen->GetNearestFontToDesignHeightInPixels((CFont*&)font4,fs1); |
|
466 if (error) |
|
467 { |
|
468 TheClient->iScreen->ReleaseFont(font3); |
|
469 TheClient->iScreen->ReleaseFont(font4); |
|
470 User::Panic(_L("font not created"),error); |
|
471 } |
|
472 CFbsBitGc *bGcOne = CFbsBitGc::NewL(); |
|
473 CleanupStack::PushL(bGcOne); |
|
474 |
|
475 bGcOne->Activate(deviceOne); |
|
476 |
|
477 bGcOne->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
478 bGcOne->SetBrushColor(TRgb(127,0,255,127)); |
|
479 bGcOne->DrawRect(TRect(0,0,winSize.iWidth,winSize.iHeight)); |
|
480 |
|
481 bGcOne->SetPenStyle(CGraphicsContext::ESolidPen); |
|
482 bGcOne->SetPenColor(TRgb(0,0,0,127)); |
|
483 |
|
484 bGcOne->UseFont(font3); |
|
485 bGcOne->SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
486 bGcOne->DrawText(_L("Test"),TPoint(10,20)); |
|
487 bGcOne->DiscardFont(); |
|
488 bGcOne->UseFont(font4); |
|
489 bGcOne->DrawText(_L("Test"),TPoint(10,60)); |
|
490 bGcOne->DiscardFont(); |
|
491 //destruction and tidying up |
|
492 //measure the text |
|
493 CFont::TMeasureTextOutput textSize; |
|
494 font4->MeasureText(_L("Test"),NULL,&textSize); |
|
495 |
|
496 TheClient->iScreen->ReleaseFont(font3); |
|
497 TheClient->iScreen->ReleaseFont(font4); |
|
498 |
|
499 //display at the left |
|
500 RWindow refWin(BaseWin->Client()->iWs); |
|
501 CleanupClosePushL(refWin); |
|
502 User::LeaveIfError(refWin.Construct(*(BaseWin->WinTreeNode()),(TUint32)&refWin)); |
|
503 |
|
504 refWin.SetExtent(TPoint(0,0), winSize); |
|
505 refWin.SetRequiredDisplayMode(static_cast<TDisplayMode>(mode)); |
|
506 refWin.SetVisible(ETrue); |
|
507 refWin.SetTransparencyAlphaChannel(); |
|
508 refWin.Activate(); |
|
509 TheClient->iWs.Flush(); |
|
510 |
|
511 //a gc for the ref win |
|
512 CWsScreenDevice *refDevice; |
|
513 refDevice = new (ELeave)CWsScreenDevice(BaseWin->Client()->iWs); |
|
514 User::LeaveIfError(refDevice->Construct(iTest->ScreenNumber())); |
|
515 CleanupStack::PushL(refDevice); |
|
516 CWindowGc *gcRef; |
|
517 refDevice->CreateContext(gcRef); |
|
518 CleanupStack::PushL(gcRef); |
|
519 |
|
520 refWin.Invalidate(); |
|
521 refWin.BeginRedraw(); |
|
522 gcRef->Activate(refWin); |
|
523 gcRef->BitBlt(TPoint(0,0), bitmapOne); |
|
524 gcRef->Deactivate(); |
|
525 refWin.EndRedraw(); |
|
526 TheClient->iWs.Flush(); |
|
527 |
|
528 TPoint refPos = refWin.AbsPosition(); |
|
529 TPoint winPos = theWin.AbsPosition(); |
|
530 |
|
531 //Compare the anti-aliased text areas |
|
532 TInt textLength=textSize.iBounds.iBr.iX; |
|
533 TInt textHeight=Abs(textSize.iBounds.iTl.iY); |
|
534 |
|
535 TRect rect1(refPos.iX+10,refPos.iY+60-textHeight, |
|
536 refPos.iX+10+textLength,refPos.iY+60); |
|
537 TRect rect2(winPos.iX+10,winPos.iY+60-textHeight, |
|
538 winPos.iX+10+textLength,winPos.iY+60); |
|
539 |
|
540 TBool match = refDevice->RectCompare(rect1,rect2); |
|
541 TEST(match); |
|
542 |
|
543 CleanupStack::PopAndDestroy(gcRef); |
|
544 CleanupStack::PopAndDestroy(refDevice); |
|
545 CleanupStack::PopAndDestroy(&refWin); |
|
546 |
|
547 CleanupStack::PopAndDestroy(bGcOne); |
|
548 CleanupStack::PopAndDestroy(deviceOne); |
|
549 CleanupStack::PopAndDestroy(bitmapOne); |
|
550 CleanupStack::PopAndDestroy(&theWin);//theWin |
|
551 |
|
552 } |
|
553 // |
|
554 // CTDrawOpWin |
|
555 // |
|
556 |
|
557 CTDrawOpWin* CTDrawOpWin::NewL(CTAlphaWin* aTest, CTWinBase* aParent, TPoint aPos, TSize aSize, TRgb aDrawColour) |
|
558 { |
|
559 CTDrawOpWin* theWin = new(ELeave) CTDrawOpWin(aTest,aDrawColour); |
|
560 |
|
561 theWin->ConstructL(*aParent); |
|
562 theWin->SetExtL(aPos, aSize); |
|
563 theWin->AssignGC(*TheClient->iGc); |
|
564 if (TheClient->iScreen->DisplayMode() == EColor16MA) |
|
565 { |
|
566 theWin->BaseWin()->SetRequiredDisplayMode(EColor16MA); |
|
567 } |
|
568 else |
|
569 { |
|
570 theWin->BaseWin()->SetRequiredDisplayMode(EColor64K); |
|
571 } |
|
572 |
|
573 theWin->Activate(); |
|
574 theWin->DrawNow(); |
|
575 |
|
576 return theWin; |
|
577 } |
|
578 |
|
579 CTDrawOpWin::CTDrawOpWin(CTAlphaWin* aTest, TRgb aDrawColour) |
|
580 : iTest(aTest), iDrawColour(aDrawColour) |
|
581 {} |
|
582 |
|
583 |
|
584 void CTDrawOpWin::SetDrawOp(TInt aDrawOp) |
|
585 { |
|
586 iDrawOp = aDrawOp; |
|
587 } |
|
588 |
|
589 |
|
590 void CTDrawOpWin::Draw() |
|
591 { |
|
592 _LIT(KText,"Text test"); |
|
593 |
|
594 iGc->SetPenColor(iDrawColour); |
|
595 iGc->SetBrushColor(iDrawColour); |
|
596 TSize size = Size(); |
|
597 TInt top = 5; |
|
598 TInt left = 5; |
|
599 TInt bottom = size.iHeight - 5; |
|
600 TInt right = size.iWidth - 5; |
|
601 TInt square = Min(bottom-top,right-left); |
|
602 |
|
603 switch (iDrawOp) |
|
604 { |
|
605 case EOpDrawRect: |
|
606 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
607 iGc->SetPenStyle(CGraphicsContext::ENullPen); |
|
608 iGc->DrawRect(TRect(left,top,right,bottom)); |
|
609 break; |
|
610 case EOpDrawLine: |
|
611 //!! FAILS |
|
612 //!! The endpoint of the line is drawn twice, with the result that it is darker when we do blending |
|
613 //!! Not intending to fix at the moment |
|
614 /* |
|
615 iGc->SetPenStyle(CGraphicsContext::ESolidPen); |
|
616 iGc->SetPenSize(TSize(4,4)); |
|
617 // The lines must not overlap, otherwise the blended lines will be darker at the overlap |
|
618 iGc->DrawLine(TPoint(left+5,top), TPoint(left+square,top)); |
|
619 iGc->DrawLine(TPoint(left+5,top+5), TPoint(left+square,top+square)); |
|
620 iGc->DrawLine(TPoint(left,top+5), TPoint(left,top+square)); |
|
621 */ |
|
622 break; |
|
623 case EOpDrawEllipse: |
|
624 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
625 iGc->SetPenStyle(CGraphicsContext::ENullPen); |
|
626 iGc->DrawEllipse(TRect(left,top,right,bottom)); |
|
627 break; |
|
628 case EOpDrawText: |
|
629 case EOpDrawTextVertical: |
|
630 { |
|
631 iGc->SetBrushStyle(CGraphicsContext::ENullBrush); |
|
632 iGc->SetPenStyle(CGraphicsContext::ESolidPen); |
|
633 CFont* font; |
|
634 TFontSpec fontSpec(KTestFontTypefaceName,200); |
|
635 User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInTwips(font, fontSpec)); |
|
636 iGc->UseFont(font); |
|
637 if (iDrawOp==EOpDrawText) |
|
638 iGc->DrawText(KText(), TPoint(5,30)); |
|
639 else |
|
640 iGc->DrawTextVertical(KText(), TPoint(5,30), EFalse); |
|
641 iGc->DiscardFont(); |
|
642 TheClient->iScreen->ReleaseFont(font); |
|
643 } |
|
644 break; |
|
645 case EOpDrawTextAntiAliased: |
|
646 { |
|
647 iGc->SetBrushStyle(CGraphicsContext::ENullBrush); |
|
648 iGc->SetPenStyle(CGraphicsContext::ESolidPen); |
|
649 CFont* font; |
|
650 TFontSpec fontSpec(KTestFontTypefaceName,600); |
|
651 fontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightBold); |
|
652 fontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap); |
|
653 |
|
654 User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInTwips(font, fontSpec)); |
|
655 iGc->UseFont(font); |
|
656 iGc->DrawText(KText(), TPoint(5,30)); |
|
657 iGc->DiscardFont(); |
|
658 TheClient->iScreen->ReleaseFont(font); |
|
659 } |
|
660 break; |
|
661 case EOpBitBlt: |
|
662 break; |
|
663 case EOpBitBltMasked: |
|
664 break; |
|
665 default: |
|
666 break; |
|
667 }; |
|
668 } |
|
669 |
|
670 |
|
671 |
|
672 // |
|
673 // CTAlphaWindow |
|
674 // |
|
675 |
|
676 CTAlphaWindow::~CTAlphaWindow() |
|
677 { |
|
678 DestroyChildren(); |
|
679 } |
|
680 |
|
681 CTAlphaWindow* CTAlphaWindow::NewL(CTAlphaWin* aTest, CTWinBase* aParent, TPoint aPos, TSize aSize, TInt aDrawState) |
|
682 { |
|
683 CTAlphaWindow* theWin = new (ELeave) CTAlphaWindow(aTest); |
|
684 |
|
685 theWin->ConstructL(*aParent); |
|
686 theWin->SetExtL(aPos, aSize); |
|
687 theWin->SetDrawState(aDrawState); |
|
688 |
|
689 theWin->AssignGC(*TheClient->iGc); |
|
690 |
|
691 theWin->Activate(); |
|
692 theWin->iDrawState |= EActive; |
|
693 theWin->DrawNow(); |
|
694 |
|
695 return theWin; |
|
696 } |
|
697 |
|
698 void CTAlphaWindow::SetDrawState(TInt aDrawState) |
|
699 { |
|
700 TBool active = iDrawState & EActive; |
|
701 iDrawState = aDrawState & 0x7fffffff; |
|
702 |
|
703 TRgb colour = ColourFromDrawState(iDrawState); |
|
704 ((RWindow*) DrawableWin())->SetBackgroundColor(colour); |
|
705 |
|
706 if (iDrawState & EModeColor16MA) |
|
707 BaseWin()->SetRequiredDisplayMode(EColor16MA); |
|
708 else |
|
709 BaseWin()->SetRequiredDisplayMode(EColor64K); |
|
710 |
|
711 BaseWin()->SetVisible(! (iDrawState & EInvisible)); |
|
712 |
|
713 if (!active) |
|
714 { |
|
715 if (iDrawState & EAlphaTransparency) |
|
716 ((RWindow*) DrawableWin())->SetTransparencyAlphaChannel(); |
|
717 else if (iDrawState & ETransparencyFactor) |
|
718 ((RWindow*) DrawableWin())->SetTransparencyFactor(TRgb(128,128,128)); |
|
719 } |
|
720 |
|
721 if (active) |
|
722 iDrawState |= EActive; |
|
723 } |
|
724 |
|
725 void CTAlphaWindow::SetVisible(TBool aVisible) |
|
726 { |
|
727 if (aVisible) |
|
728 iDrawState &= ~EInvisible; |
|
729 else |
|
730 iDrawState |= EInvisible; |
|
731 BaseWin()->SetVisible(aVisible); |
|
732 } |
|
733 |
|
734 void CTAlphaWindow::CreateChildrenL(TInt aDepth) |
|
735 { |
|
736 DestroyChildren(); |
|
737 if (aDepth>0) |
|
738 { |
|
739 TSize size = Size(); |
|
740 iChild1 = CTAlphaWindow::NewL(iTest, this, TPoint(size.iWidth/3,0), TSize(2*size.iWidth/3, 2*size.iHeight/3), ERed | EGreen | EBlue | EOpaque); |
|
741 iChild2 = CTAlphaWindow::NewL(iTest, this, TPoint(0,size.iHeight/3), TSize(2*size.iWidth/3, 2*size.iHeight/3), ERed | EGreen | EBlue | EAlphaTransparency); |
|
742 iChild2->CreateChildrenL(aDepth-1); |
|
743 } |
|
744 } |
|
745 |
|
746 void CTAlphaWindow::DestroyChildren() |
|
747 { |
|
748 if (iChild1) |
|
749 { |
|
750 iChild1->DestroyChildren(); |
|
751 delete iChild1; |
|
752 iChild1 = NULL; |
|
753 } |
|
754 if (iChild2) |
|
755 { |
|
756 iChild2->DestroyChildren(); |
|
757 delete iChild2; |
|
758 iChild2 = NULL; |
|
759 } |
|
760 } |
|
761 |
|
762 TInt CTAlphaWindow::DrawState() |
|
763 { |
|
764 return iDrawState; |
|
765 } |
|
766 |
|
767 void CTAlphaWindow::Draw() |
|
768 { |
|
769 // we draw a diagonal line from top left to bottom right |
|
770 // we use the complementary colour to the window background colour |
|
771 TInt red = (iDrawState & ERed) ? 0 : 255; |
|
772 TInt green = (iDrawState & EGreen) ? 0 : 255; |
|
773 TInt blue = (iDrawState & EBlue) ? 0 : 255; |
|
774 TRgb color(red,green,blue); |
|
775 |
|
776 TSize size = Size(); |
|
777 iGc->SetPenColor(color); |
|
778 iGc->SetPenSize(TSize(4,4)); |
|
779 iGc->DrawLine(TPoint(0,0), TPoint(size.iWidth, size.iHeight)); |
|
780 } |
|
781 |
|
782 |
|
783 // |
|
784 // CTAlphaRefWin |
|
785 // |
|
786 |
|
787 CTAlphaRefWin::CTAlphaRefWin(TFixedArray<CTAlphaWindow*,5>& aAlphaWin) |
|
788 : iAlphaWin(aAlphaWin) |
|
789 {} |
|
790 |
|
791 CTAlphaRefWin* CTAlphaRefWin::NewL(CTWinBase* aParent, TPoint aPos, TSize aSize, TFixedArray<CTAlphaWindow*,5>& aAlphaWin) |
|
792 { |
|
793 CTAlphaRefWin* theWin = new(ELeave) CTAlphaRefWin(aAlphaWin); |
|
794 |
|
795 theWin->ConstructL(*aParent); |
|
796 theWin->SetExtL(aPos, aSize); |
|
797 theWin->AssignGC(*TheClient->iGc); |
|
798 theWin->BaseWin()->SetRequiredDisplayMode(EColor64K); |
|
799 |
|
800 theWin->Activate(); |
|
801 theWin->DrawNow(); |
|
802 |
|
803 return theWin; |
|
804 } |
|
805 |
|
806 void CTAlphaRefWin::Draw() |
|
807 { |
|
808 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
809 iGc->SetBrushColor(KRgbWhite); |
|
810 iGc->Clear(); |
|
811 |
|
812 // Note, the order of the windows in the array must correspond to their z-order |
|
813 for (TInt i=0; i<5; i++) |
|
814 DrawWindow(iAlphaWin[i], iAlphaWin[i]->Position()); |
|
815 } |
|
816 |
|
817 void CTAlphaRefWin::DrawWindow(CTAlphaWindow* aWindow, TPoint aPos) |
|
818 { |
|
819 TInt drawState = aWindow->DrawState(); |
|
820 if ( (drawState & EInvisible) || ! (drawState & EActive) ) |
|
821 return; |
|
822 |
|
823 TRgb colour = ColourFromDrawState(drawState); |
|
824 if (drawState & EOpaque) |
|
825 colour.SetAlpha(255); |
|
826 if (drawState & ETransparent) |
|
827 colour.SetAlpha(0); |
|
828 iGc->SetBrushColor(colour); |
|
829 |
|
830 TPoint tl = aPos; |
|
831 TPoint br = tl + aWindow->Size(); |
|
832 TRect rect(tl,br); |
|
833 iGc->Clear(rect); |
|
834 |
|
835 TInt red = (drawState & ERed) ? 0 : 255; |
|
836 TInt green = (drawState & EGreen) ? 0 : 255; |
|
837 TInt blue = (drawState & EBlue) ? 0 : 255; |
|
838 colour = TRgb(red,green,blue); |
|
839 |
|
840 iGc->SetClippingRect(rect); |
|
841 |
|
842 TSize size = Size(); |
|
843 iGc->SetPenColor(colour); |
|
844 iGc->SetPenSize(TSize(4,4)); |
|
845 iGc->DrawLine(tl, br); |
|
846 |
|
847 iGc->CancelClippingRect(); |
|
848 |
|
849 if (aWindow->iChild1) |
|
850 DrawWindow(aWindow->iChild1, aPos + aWindow->iChild1->Position() ); |
|
851 if (aWindow->iChild2) |
|
852 DrawWindow(aWindow->iChild2, aPos + aWindow->iChild2->Position() ); |
|
853 } |
|
854 |
|
855 |
|
856 // |
|
857 // Main test loop |
|
858 // |
|
859 void CTAlphaWin::RunTestCaseL(TInt /*aCurTestCase*/) |
|
860 { |
|
861 //User::After(TTimeIntervalMicroSeconds32(1000 * 1000)); |
|
862 ((CTAlphaWinStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName); |
|
863 switch (++iTest->iState) |
|
864 { |
|
865 /** |
|
866 |
|
867 @SYMTestCaseID GRAPHICS-WSERV-0278 |
|
868 |
|
869 @SYMDEF DEF081259 |
|
870 |
|
871 @SYMPREQ 915 |
|
872 |
|
873 @SYMTestCaseDesc Semi-transparent drawing |
|
874 |
|
875 @SYMTestPriority High |
|
876 |
|
877 @SYMTestStatus Implemented |
|
878 |
|
879 @SYMTestActions Use draw operations with semi-transparent pen or brush colours |
|
880 |
|
881 @SYMTestExpectedResults Draw operations must do alpha blending |
|
882 |
|
883 */ |
|
884 case 1: |
|
885 { |
|
886 ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0278")); |
|
887 if(TransparencySupportedL() == KErrNotSupported) |
|
888 { |
|
889 LOG_MESSAGE(_L("Test(1) complete - Transparency not supported\n")); |
|
890 TestComplete(); |
|
891 break; |
|
892 } |
|
893 TDisplayMode mode = TheClient->iScreen->DisplayMode(); |
|
894 if (mode < EColor64K) |
|
895 { |
|
896 LOG_MESSAGE(_L("Test(1) complete - Display mode < EColor64K\n")); |
|
897 TestComplete(); |
|
898 break; |
|
899 } |
|
900 _LIT(KSemiTrans64K,"(1) Semi transparent drawing Color64K"); |
|
901 iTest->LogSubTest(KSemiTrans64K); |
|
902 TestSemiTransparentDrawingL(); |
|
903 break; |
|
904 } |
|
905 |
|
906 /** |
|
907 |
|
908 @SYMTestCaseID GRAPHICS-WSERV-0287 |
|
909 |
|
910 @SYMDEF DEF081259 |
|
911 |
|
912 @SYMPREQ 915 |
|
913 |
|
914 @SYMTestCaseDesc Invisible. All windows are in EColor16MA display mode. |
|
915 |
|
916 @SYMTestPriority High |
|
917 |
|
918 @SYMTestStatus Implemented |
|
919 |
|
920 @SYMTestActions Transparent alpha channel windows are made invisible and visible both in front and behind one another |
|
921 |
|
922 @SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing |
|
923 |
|
924 */ |
|
925 case 2: |
|
926 ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0287")); |
|
927 ConfigureDisplayModes(EColor16MA); |
|
928 if(TransparencySupportedL()==KErrNone) |
|
929 { |
|
930 _LIT(KInvisible16MA,"(2) Invisible Color16MA"); |
|
931 iTest->LogSubTest(KInvisible16MA); |
|
932 TestInvisible(); |
|
933 } |
|
934 break; |
|
935 |
|
936 /** |
|
937 |
|
938 @SYMTestCaseID GRAPHICS-WSERV-0280 |
|
939 |
|
940 @SYMDEF DEF081259 |
|
941 |
|
942 @SYMPREQ 915 |
|
943 |
|
944 @SYMTestCaseDesc Initial Configuration. All windows are in EColor64K display mode. |
|
945 |
|
946 @SYMTestPriority High |
|
947 |
|
948 @SYMTestStatus Implemented |
|
949 |
|
950 @SYMTestActions Several windows are set to be transparent alpha channel, and given semi-transparent or transparent background colours |
|
951 |
|
952 @SYMTestExpectedResults The transparent window configuration matches a reference drawing created using only alpha blending |
|
953 |
|
954 */ |
|
955 //Test 3 to 6 can't be run without transparency support |
|
956 case 3: |
|
957 ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0280")); |
|
958 ConfigureDisplayModes(EColor64K); |
|
959 if(TransparencySupportedL()==KErrNone) |
|
960 { |
|
961 _LIT(KInitialConfiguration64K,"(3) Initial configuration Color64K"); |
|
962 iTest->LogSubTest(KInitialConfiguration64K); |
|
963 TestInitialConfiguration(); |
|
964 } |
|
965 break; |
|
966 /** |
|
967 |
|
968 @SYMTestCaseID GRAPHICS-WSERV-0281 |
|
969 |
|
970 @SYMDEF DEF081259 |
|
971 |
|
972 @SYMPREQ 915 |
|
973 |
|
974 @SYMTestCaseDesc Move. All windows are in EColor64K display mode. |
|
975 |
|
976 @SYMTestPriority High |
|
977 |
|
978 @SYMTestStatus Implemented |
|
979 |
|
980 @SYMTestActions Transparent alpha channel windows are moved both in front and behind one another |
|
981 |
|
982 @SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing |
|
983 |
|
984 */ |
|
985 case 4: |
|
986 ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0281")); |
|
987 if(TransparencySupportedL()==KErrNone) |
|
988 { |
|
989 _LIT(KMove64K,"(4) Move Color64K"); |
|
990 iTest->LogSubTest(KMove64K); |
|
991 TestMove(); |
|
992 } |
|
993 break; |
|
994 /** |
|
995 |
|
996 @SYMTestCaseID GRAPHICS-WSERV-0282 |
|
997 |
|
998 @SYMDEF DEF081259 |
|
999 |
|
1000 @SYMPREQ 915 |
|
1001 |
|
1002 @SYMTestCaseDesc Redraw. All windows are in EColor64K display mode. |
|
1003 |
|
1004 @SYMTestPriority High |
|
1005 |
|
1006 @SYMTestStatus Implemented |
|
1007 |
|
1008 @SYMTestActions Transparent alpha channel windows are redrawn both in front and behind one another |
|
1009 |
|
1010 @SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing |
|
1011 |
|
1012 */ |
|
1013 case 5: |
|
1014 ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0282")); |
|
1015 if(TransparencySupportedL()==KErrNone) |
|
1016 { |
|
1017 _LIT(KRedraw64K,"(5) Redraw Color64K"); |
|
1018 iTest->LogSubTest(KRedraw64K); |
|
1019 TestRedraw(); |
|
1020 } |
|
1021 break; |
|
1022 /** |
|
1023 |
|
1024 @SYMTestCaseID GRAPHICS-WSERV-0283-0001 |
|
1025 |
|
1026 @SYMDEF DEF081259 |
|
1027 |
|
1028 @SYMPREQ 915 |
|
1029 |
|
1030 @SYMTestCaseDesc Invisible. All windows are in EColor64K display mode. |
|
1031 |
|
1032 @SYMTestPriority High |
|
1033 |
|
1034 @SYMTestStatus Implemented |
|
1035 |
|
1036 @SYMTestActions Transparent alpha channel windows are made invisible and visible both in front and behind one another |
|
1037 |
|
1038 @SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing |
|
1039 |
|
1040 */ |
|
1041 case 6: |
|
1042 ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0283-0001")); |
|
1043 if(TransparencySupportedL()==KErrNone) |
|
1044 { |
|
1045 _LIT(KInvisible64K,"(6) Invisible Color64K"); |
|
1046 iTest->LogSubTest(KInvisible64K); |
|
1047 TestInvisible(); |
|
1048 } |
|
1049 break; |
|
1050 /** |
|
1051 |
|
1052 @SYMTestCaseID GRAPHICS-WSERV-0283-0002 |
|
1053 |
|
1054 @SYMDEF DEF081259 |
|
1055 |
|
1056 @SYMPREQ 915 |
|
1057 |
|
1058 @SYMTestCaseDesc Children. All windows are in EColor64K display mode. |
|
1059 |
|
1060 @SYMTestPriority High |
|
1061 |
|
1062 @SYMTestStatus Implemented |
|
1063 |
|
1064 @SYMTestActions Transparent alpha channel windows are given child windows, both transparent and non-transparent, |
|
1065 and are then moved, redrawn, set visible or invisible both in front and behind one another |
|
1066 |
|
1067 @SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing |
|
1068 |
|
1069 */ |
|
1070 case 7: |
|
1071 ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0283-0002")); |
|
1072 _LIT(KChildren64K,"(7)Children Color64K"); |
|
1073 iTest->LogSubTest(KChildren64K); |
|
1074 TestChildrenL(); |
|
1075 break; |
|
1076 /** |
|
1077 |
|
1078 @SYMTestCaseID GRAPHICS-WSERV-0356 |
|
1079 |
|
1080 @SYMDEF DEF081259 |
|
1081 |
|
1082 @SYMPREQ 915 |
|
1083 |
|
1084 @SYMTestCaseDesc Initial Configuration. All windows are in EColor64k Dispaly Mode |
|
1085 |
|
1086 @SYMTestPriority High |
|
1087 |
|
1088 @SYMTestStatus Implemented |
|
1089 |
|
1090 @SYMTestActions Tests Anti-aliasing of text |
|
1091 |
|
1092 @SYMTestExpectedResults Anti-alisaing should behave correctly |
|
1093 |
|
1094 */ |
|
1095 case 8: |
|
1096 ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0356")); |
|
1097 _LIT(KAntiAliasedText64K,"(8) AntiAliasedText DEF082251 Color64K"); |
|
1098 iTest->LogSubTest(KAntiAliasedText64K); |
|
1099 TestAntiAliasedTextTransparentL(); |
|
1100 break; |
|
1101 |
|
1102 /** |
|
1103 |
|
1104 @SYMTestCaseID GRAPHICS-WSERV-0284 |
|
1105 |
|
1106 @SYMDEF DEF081259 |
|
1107 |
|
1108 @SYMPREQ 915 |
|
1109 |
|
1110 @SYMTestCaseDesc Initial Configuration. All windows are in EColor16MA display mode. |
|
1111 |
|
1112 @SYMTestPriority High |
|
1113 |
|
1114 @SYMTestStatus Implemented |
|
1115 |
|
1116 @SYMTestActions Several windows are set to be transparent alpha channel, and given semi-transparent or transparent background colours |
|
1117 |
|
1118 @SYMTestExpectedResults The transparent window configuration matches a reference drawing created using only alpha blending |
|
1119 |
|
1120 */ |
|
1121 case 9: |
|
1122 { |
|
1123 ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0284")); |
|
1124 ConfigureDisplayModes(EColor16MA); |
|
1125 TDisplayMode mode1 = TheClient->iScreen->DisplayMode(); |
|
1126 _LIT(KInitialConfiguration16MA,"(9)Initial configuration Color16MA"); |
|
1127 iTest->LogSubTest(KInitialConfiguration16MA); |
|
1128 TestInitialConfiguration(); |
|
1129 break; |
|
1130 } |
|
1131 /** |
|
1132 |
|
1133 @SYMTestCaseID GRAPHICS-WSERV-0285 |
|
1134 |
|
1135 @SYMDEF DEF081259 |
|
1136 |
|
1137 @SYMPREQ 915 |
|
1138 |
|
1139 @SYMTestCaseDesc Move. All windows are in EColor16MA display mode. |
|
1140 |
|
1141 @SYMTestPriority High |
|
1142 |
|
1143 @SYMTestStatus Implemented |
|
1144 |
|
1145 @SYMTestActions Transparent alpha channel windows are moved both in front and behind one another |
|
1146 |
|
1147 @SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing |
|
1148 |
|
1149 */ |
|
1150 case 10: |
|
1151 ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0285")); |
|
1152 _LIT(KMove16MA,"(10)Move Color16MA"); |
|
1153 iTest->LogSubTest(KMove16MA); |
|
1154 TestMove(); |
|
1155 break; |
|
1156 /** |
|
1157 |
|
1158 @SYMTestCaseID GRAPHICS-WSERV-0286 |
|
1159 |
|
1160 @SYMDEF DEF081259 |
|
1161 |
|
1162 @SYMPREQ 915 |
|
1163 |
|
1164 @SYMTestCaseDesc Redraw. All windows are in EColor16MA display mode. |
|
1165 |
|
1166 @SYMTestPriority High |
|
1167 |
|
1168 @SYMTestStatus Implemented |
|
1169 |
|
1170 @SYMTestActions Transparent alpha channel windows are redrawn both in front and behind one another |
|
1171 |
|
1172 @SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing |
|
1173 |
|
1174 */ |
|
1175 case 11: |
|
1176 ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0286")); |
|
1177 _LIT(KRedraw16MA,"(11)Redraw Color16MA"); |
|
1178 iTest->LogSubTest(KRedraw16MA); |
|
1179 TestRedraw(); |
|
1180 break; |
|
1181 |
|
1182 /** |
|
1183 |
|
1184 @SYMTestCaseID GRAPHICS-WSERV-0279 |
|
1185 |
|
1186 @SYMDEF DEF081259 |
|
1187 |
|
1188 @SYMPREQ 915 |
|
1189 |
|
1190 @SYMTestCaseDesc Transparent drawing |
|
1191 |
|
1192 @SYMTestPriority High |
|
1193 |
|
1194 @SYMTestStatus Implemented |
|
1195 |
|
1196 @SYMTestActions Use draw operations with transparent pen or brush colours |
|
1197 |
|
1198 @SYMTestExpectedResults Draw operations with transparent pen or brush colours should leave the destination unchanged |
|
1199 |
|
1200 */ |
|
1201 |
|
1202 case 12: |
|
1203 ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0279")); |
|
1204 ConfigureDisplayModes(EColor64K); |
|
1205 _LIT(KTrans64K,"(12) Transparent drawing Color64K"); |
|
1206 iTest->LogSubTest(KTrans64K); |
|
1207 TestTransparentDrawingL(); |
|
1208 break; |
|
1209 |
|
1210 |
|
1211 /** |
|
1212 |
|
1213 @SYMTestCaseID GRAPHICS-WSERV-0288 |
|
1214 |
|
1215 @SYMDEF DEF081259 |
|
1216 |
|
1217 @SYMPREQ 915 |
|
1218 |
|
1219 @SYMTestCaseDesc Children. All windows are in EColor16MA display mode. |
|
1220 |
|
1221 @SYMTestPriority High |
|
1222 |
|
1223 @SYMTestStatus Implemented |
|
1224 |
|
1225 @SYMTestActions Transparent alpha channel windows are given child windows, both transparent and non-transparent, |
|
1226 and are then moved, redrawn, set visible or invisible both in front and behind one another |
|
1227 |
|
1228 @SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing |
|
1229 |
|
1230 */ |
|
1231 case 13: |
|
1232 ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0288")); |
|
1233 _LIT(KChildren16MA,"(13) Children Color16MA"); |
|
1234 iTest->LogSubTest(KChildren16MA); |
|
1235 TestChildrenL(); |
|
1236 break; |
|
1237 /** |
|
1238 |
|
1239 @SYMTestCaseID GRAPHICS-WSERV-0357 |
|
1240 |
|
1241 @SYMDEF DEF081259 |
|
1242 |
|
1243 @SYMPREQ 915 |
|
1244 |
|
1245 @SYMTestCaseDesc Initial Configuration. All windows are in EColor16MA Dispaly Mode |
|
1246 |
|
1247 @SYMTestPriority High |
|
1248 |
|
1249 @SYMTestStatus Implemented |
|
1250 |
|
1251 @SYMTestActions Tests Anti-aliasing of text |
|
1252 |
|
1253 @SYMTestExpectedResults Anti-alisaing should behave correctly |
|
1254 |
|
1255 */ |
|
1256 case 14: |
|
1257 ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0357")); |
|
1258 _LIT(KAntiAliasedText16MA,"(14) AntiAliasedText DEF082251 Color16MA"); |
|
1259 iTest->LogSubTest(KAntiAliasedText16MA); |
|
1260 TestAntiAliasedTextTransparentL(); |
|
1261 break; |
|
1262 default: |
|
1263 ((CTAlphaWinStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); |
|
1264 ((CTAlphaWinStep*)iStep)->CloseTMSGraphicsStep(); |
|
1265 TestComplete(); |
|
1266 break; |
|
1267 } |
|
1268 ((CTAlphaWinStep*)iStep)->RecordTestResultL(); |
|
1269 } |
|
1270 |
|
1271 __WS_CONSTRUCT_STEP__(AlphaWin) |
|
1272 |