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