sl@0: // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Test alpha channel transparent windows sl@0: // Test that draw operations with non-opaque colours do alpha blending in EColor64K and EColor16MA display modes sl@0: // Test that alpha channel transparent windows are drawn correctly when windows move, redraw, change visibility, etc. sl@0: // In the draw operation tests, the left window draws opaque pink on white background, the right window blends semi-transparent red on white background, sl@0: // and the results are compared. sl@0: // In the transparent window tests, the right window contains several transparent windows, which are moved, redrawn, visibility changed, etc, sl@0: // the left window contains a single window in which we draw what we expect the right window to look like. The results are compared. sl@0: // In each case, the left and right windows should be identical sl@0: // sl@0: // sl@0: sl@0: sl@0: #include "TALPHAWIN.H" sl@0: sl@0: enum sl@0: { sl@0: EOpDrawRect, sl@0: EOpDrawLine, sl@0: EOpDrawEllipse, sl@0: EOpDrawText, sl@0: EOpDrawTextVertical, sl@0: EOpDrawTextAntiAliased, sl@0: EOpBitBlt, sl@0: EOpBitBltMasked, sl@0: ENumDrawOps sl@0: }; sl@0: sl@0: sl@0: enum sl@0: { sl@0: ERed = 0x1, sl@0: EGreen = 0x2, sl@0: EBlue = 0x4, sl@0: sl@0: EAlphaTransparency = 0x8, sl@0: ETransparencyFactor = 0x10, sl@0: // defaults to non-transparent sl@0: sl@0: EOpaque = 0x20, sl@0: ETransparent = 0x40, sl@0: // defaults to semi-transparent sl@0: sl@0: EModeColor64K = 0x80, sl@0: EModeColor16MA = 0x100, sl@0: // defaults to 64k sl@0: sl@0: EInvisible = 0x200, sl@0: sl@0: EActive = 0xf000000 sl@0: }; sl@0: sl@0: sl@0: TRgb ColourFromDrawState(TInt aDrawState) sl@0: { sl@0: TInt red = (aDrawState & ERed) ? 255 : 0; sl@0: TInt green = (aDrawState & EGreen) ? 255 : 0; sl@0: TInt blue = (aDrawState & EBlue) ? 255 : 0; sl@0: TInt alpha = 128; sl@0: if (aDrawState & EOpaque) sl@0: alpha = 255; sl@0: if (aDrawState & ETransparent) sl@0: alpha = 0; sl@0: return TRgb(red, green, blue, alpha); sl@0: } sl@0: sl@0: sl@0: sl@0: // sl@0: // CTAlphaWinTest sl@0: // sl@0: sl@0: CTAlphaWin::CTAlphaWin(CTestStep* aStep): sl@0: CTWsGraphicsBase(aStep) sl@0: { sl@0: } sl@0: sl@0: CTAlphaWin::~CTAlphaWin() sl@0: { sl@0: iTestWin.DeleteAll(); sl@0: delete iRefWin; sl@0: } sl@0: sl@0: void CTAlphaWin::ConstructL() sl@0: { sl@0: if(TransparencySupportedL() == KErrNotSupported) sl@0: return; sl@0: sl@0: TSize winSize = BaseWin->Size(); sl@0: sl@0: iTestWin[0] = CTAlphaWindow::NewL(this, TestWin, TPoint(0,0), winSize, ERed | EGreen | EBlue | EOpaque); sl@0: iTestWin[1] = CTAlphaWindow::NewL(this, TestWin, TPoint(0,0), TSize(winSize.iWidth/2, winSize.iHeight/2), ERed | EAlphaTransparency); sl@0: iTestWin[2] = CTAlphaWindow::NewL(this, TestWin, TPoint(winSize.iWidth/3,0), TSize(winSize.iWidth/2, winSize.iHeight/2), EGreen | EAlphaTransparency); sl@0: iTestWin[3] = CTAlphaWindow::NewL(this, TestWin, TPoint(winSize.iWidth/6, winSize.iHeight/3), TSize(winSize.iWidth/2, winSize.iHeight/2), EBlue | EAlphaTransparency); sl@0: 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); sl@0: sl@0: iRefWin = CTAlphaRefWin::NewL(BaseWin, TPoint(0,0), winSize, iTestWin); sl@0: //Clearing the windows sl@0: BaseWin->ClearWin(); sl@0: TestWin->ClearWin(); sl@0: } sl@0: sl@0: void CTAlphaWin::ConfigureDisplayModes(TDisplayMode aRequiredMode = EColor16M) sl@0: { sl@0: TInt i; sl@0: for (i=0; i<5; i++) sl@0: { sl@0: iTestWin[i]->BaseWin()->SetRequiredDisplayMode(aRequiredMode); sl@0: } sl@0: iRefWin->BaseWin()->SetRequiredDisplayMode(aRequiredMode); sl@0: } sl@0: sl@0: sl@0: void CTAlphaWin::TestSemiTransparentDrawingL() sl@0: { sl@0: TSize winSize = BaseWin->Size(); sl@0: sl@0: // In this window, we draw opaque pink sl@0: CTDrawOpWin* drawWin = CTDrawOpWin::NewL(this, BaseWin, TPoint(0,0), winSize, TRgb(255,127,127,255)); sl@0: sl@0: // In this window, we blend semi-transparent red sl@0: CTDrawOpWin* blendWin = CTDrawOpWin::NewL(this, TestWin, TPoint(0,0), winSize, TRgb(255,0,0,128)); sl@0: sl@0: const TInt tolerance = 9;//8 - wouldn't be enough!! The defect DEF112334 was raised sl@0: for (TInt i=EOpDrawRect; iSetDrawOp(i); sl@0: blendWin->SetDrawOp(i); sl@0: drawWin->DrawNow(); sl@0: blendWin->DrawNow(); sl@0: TheClient->Flush(); sl@0: TheClient->WaitForRedrawsToFinish(); sl@0: sl@0: if((i == EOpDrawTextAntiAliased) && (TheClient->iScreen->DisplayMode() == EColor16MA) || (TheClient->iScreen->DisplayMode() == EColor16MAP)) sl@0: { sl@0: TSize winSize=BaseWin->Size(); sl@0: TRect rect1(BaseWin->BaseWin()->InquireOffset(*TheClient->iGroup->WinTreeNode()),winSize); sl@0: TRect rect2(TestWin->BaseWin()->InquireOffset(*TheClient->iGroup->WinTreeNode()),winSize); sl@0: sl@0: CheckRectL(rect1, rect2, winSize, TheClient->iScreen->DisplayMode(), tolerance, _L("CTAlphaWin::TestSemiTransparentDrawingL()")); sl@0: } sl@0: else sl@0: { sl@0: CheckRect(BaseWin,TestWin,_L("CTAlphaWin::TestSemiTransparentDrawingL()")); sl@0: } sl@0: } sl@0: delete drawWin; sl@0: delete blendWin; sl@0: } sl@0: sl@0: void CTAlphaWin::TestTransparentDrawingL() sl@0: { sl@0: TSize winSize = BaseWin->Size(); sl@0: sl@0: // In this window, we draw opaque white sl@0: CTDrawOpWin* drawWin = CTDrawOpWin::NewL(this, BaseWin, TPoint(0,0), winSize, TRgb(255,255,255,255)); sl@0: sl@0: // In this window, we blend transparent red sl@0: CTDrawOpWin* blendWin = CTDrawOpWin::NewL(this, TestWin, TPoint(0,0), winSize, TRgb(255,0,0,0)); sl@0: sl@0: for (TInt i=EOpDrawRect; iSetDrawOp(i); sl@0: blendWin->SetDrawOp(i); sl@0: drawWin->DrawNow(); sl@0: blendWin->DrawNow(); sl@0: TheClient->Flush(); sl@0: TheClient->WaitForRedrawsToFinish(); sl@0: CheckRect(BaseWin,TestWin,_L("CTAlphaWin::TestTransparentDrawingL()")); sl@0: } sl@0: delete drawWin; sl@0: delete blendWin; sl@0: } sl@0: sl@0: void CTAlphaWin::CheckRectL(const TRect& aRect1, const TRect& aRect2, TSize aSize, TDisplayMode aRequiredMode, TInt aTolerance, const TDesC& aErrorMsg) sl@0: { sl@0: CFbsBitmap *bmp1 = new (ELeave) CFbsBitmap; sl@0: CleanupStack::PushL(bmp1); sl@0: User::LeaveIfError(bmp1->Create(aSize, aRequiredMode)); sl@0: sl@0: CFbsBitmap *bmp2 = new (ELeave) CFbsBitmap; sl@0: CleanupStack::PushL(bmp2); sl@0: User::LeaveIfError(bmp2->Create(aSize, aRequiredMode)); sl@0: sl@0: User::LeaveIfError(TheClient->iScreen->CopyScreenToBitmap(bmp1, aRect1)); sl@0: User::LeaveIfError(TheClient->iScreen->CopyScreenToBitmap(bmp2, aRect2)); sl@0: sl@0: TRgb *rgbBuf1=(TRgb *)User::AllocL(aSize.iWidth*sizeof(TRgb)); sl@0: TRgb *rgbBuf2=(TRgb *)User::Alloc(aSize.iWidth*sizeof(TRgb)); sl@0: if(!rgbBuf2) sl@0: { sl@0: User::Free(rgbBuf1); sl@0: User::Leave(KErrNoMemory); sl@0: } sl@0: TBool equal = ETrue; sl@0: TInt maxDeviation = 0; sl@0: for(TInt yy = 0; yy < aSize.iHeight && equal; yy++) sl@0: { sl@0: TPtr8 ptr1((TUint8 *)rgbBuf1,aSize.iWidth*sizeof(TRgb)); sl@0: bmp1->GetScanLine(ptr1, TPoint(0, yy), aSize.iWidth, ERgb); sl@0: TPtr8 ptr2((TUint8 *)rgbBuf2,aSize.iWidth*sizeof(TRgb)); sl@0: bmp2->GetScanLine(ptr2, TPoint(0, yy), aSize.iWidth, ERgb); sl@0: sl@0: TRgb *rgbBufCur1 = rgbBuf1; sl@0: TRgb *rgbBufCur2 = rgbBuf2; sl@0: for(TInt ii = 0; ii < aSize.iWidth; ii++) sl@0: { sl@0: TInt delta = Abs(rgbBufCur1->Red()-rgbBufCur2->Red()); sl@0: TInt delta1 = Abs(rgbBufCur1->Green()-rgbBufCur2->Green()); sl@0: TInt delta2 = Abs(rgbBufCur1->Blue()-rgbBufCur2->Blue()); sl@0: sl@0: if((delta > aTolerance) || (delta1 > aTolerance) || (delta2 > aTolerance)) sl@0: { sl@0: equal = EFalse; sl@0: } sl@0: TInt maxItermedia = Max(delta1, delta2); sl@0: maxItermedia = Max(maxItermedia, delta); sl@0: maxDeviation = Max(maxItermedia, maxDeviation); sl@0: sl@0: rgbBufCur1++; sl@0: rgbBufCur2++; sl@0: } sl@0: } sl@0: sl@0: User::Free(rgbBuf1); sl@0: User::Free(rgbBuf2); sl@0: sl@0: CleanupStack::PopAndDestroy(2,bmp1); sl@0: sl@0: if (!equal) sl@0: { sl@0: INFO_PRINTF3(_L("%S CheckRectA failed, max deviation %d"), &aErrorMsg, maxDeviation); sl@0: } sl@0: else if(maxDeviation) sl@0: { sl@0: INFO_PRINTF4(_L("%S CheckRectA passed with tolerance %d, max deviation %d"), &aErrorMsg, aTolerance, maxDeviation); sl@0: } sl@0: sl@0: iStep->TEST(equal); sl@0: } sl@0: sl@0: void CTAlphaWin::TestCondition() sl@0: { sl@0: // User::After(1000000);// helpful when debugging sl@0: iRefWin->DrawNow(); sl@0: TheClient->Flush(); sl@0: TheClient->WaitForRedrawsToFinish(); sl@0: CheckRect(BaseWin,TestWin,_L("CTAlphaWin::TestCondition()")); sl@0: } sl@0: sl@0: void CTAlphaWin::TestConditionL() sl@0: { sl@0: iRefWin->DrawNow(); sl@0: TheClient->Flush(); sl@0: TheClient->WaitForRedrawsToFinish(); sl@0: sl@0: const TInt tolerance = 9; sl@0: TSize winSize=BaseWin->Size(); sl@0: TRect rect1(BaseWin->BaseWin()->InquireOffset(*TheClient->iGroup->WinTreeNode()),winSize); sl@0: TRect rect2(TestWin->BaseWin()->InquireOffset(*TheClient->iGroup->WinTreeNode()),winSize); sl@0: CheckRectL(rect1, rect2, winSize, TheClient->iScreen->DisplayMode(), tolerance, _L("CTAlphaWin::TestCondition()")); sl@0: } sl@0: sl@0: void CTAlphaWin::TestInitialConfiguration() sl@0: { sl@0: if(TheClient->iScreen->DisplayMode() == EColor64K) sl@0: { sl@0: TestConditionL(); sl@0: } sl@0: else sl@0: { sl@0: TestCondition(); sl@0: } sl@0: } sl@0: sl@0: void CTAlphaWin::TestMove() sl@0: { sl@0: // Test moving windows, both in front and behind sl@0: for (TInt i = 0; i<5; i++) sl@0: { sl@0: TPoint pos = iTestWin[i]->Position(); sl@0: pos += TPoint(10,10); sl@0: iTestWin[i]->SetPos(pos); sl@0: TestCondition(); sl@0: } sl@0: for (TInt j = 0; j<5; j++) sl@0: { sl@0: TPoint pos = iTestWin[j]->Position(); sl@0: pos -= TPoint(10,10); sl@0: iTestWin[j]->SetPos(pos); sl@0: TestCondition(); sl@0: } sl@0: } sl@0: sl@0: sl@0: void CTAlphaWin::TestRedraw() sl@0: { sl@0: // Test redrawing windows, both in front and behind sl@0: for (TInt i=0; i<5; i++) sl@0: { sl@0: iTestWin[i]->DrawNow(); sl@0: TestCondition(); sl@0: } sl@0: } sl@0: sl@0: sl@0: void CTAlphaWin::TestInvisible() sl@0: { sl@0: // Test making windows visible and invisible, both in front and behind sl@0: for (TInt i=0; i<5; i++) sl@0: { sl@0: iTestWin[i]->SetVisible(EFalse); sl@0: TestCondition(); sl@0: iTestWin[i]->SetVisible(ETrue); sl@0: TestCondition(); sl@0: } sl@0: } sl@0: sl@0: void CTAlphaWin::TestChildrenL() sl@0: { sl@0: struct CTAlphaWinChildren: public TCleanupItem sl@0: { sl@0: static void Destroy(TAny* trg) sl@0: { sl@0: static_cast(trg)->DestroyChildren(); sl@0: } sl@0: CTAlphaWinChildren(CTAlphaWindow*trg): TCleanupItem(Destroy,trg) sl@0: {} sl@0: sl@0: }; sl@0: CleanupStack::PushL(CTAlphaWinChildren(iTestWin[2])); sl@0: iTestWin[2]->CreateChildrenL(3); sl@0: TestCondition(); sl@0: TestMove(); sl@0: CleanupStack::PopAndDestroy(iTestWin[2]); sl@0: } sl@0: sl@0: sl@0: void CTAlphaWin::TestAntiAliasedTextTransparentL() sl@0: { sl@0: sl@0: //Clear the screen sl@0: for (TInt i=0; i<5; i++) sl@0: { sl@0: iTestWin[i]->SetVisible(EFalse); sl@0: } sl@0: iRefWin->SetVisible(EFalse); sl@0: TheClient->iWs.Flush(); sl@0: sl@0: //Create a new test window on the left sl@0: //Create a transparent window: sl@0: TSize winSize = BaseWin->Size(); sl@0: sl@0: RWindow theWin(TestWin->Client()->iWs); sl@0: User::LeaveIfError(theWin.Construct(*(TestWin->WinTreeNode()),(TUint32)&theWin)); sl@0: sl@0: theWin.SetExtent(TPoint(0,0), winSize); sl@0: theWin.SetBackgroundColor(TRgb(127,0,255,127)); sl@0: TDisplayMode mode = EColor16MAP; sl@0: theWin.SetRequiredDisplayMode(mode); sl@0: theWin.SetVisible(ETrue); sl@0: theWin.SetTransparencyAlphaChannel(); sl@0: theWin.Activate(); sl@0: TheClient->iWs.Flush(); sl@0: CleanupClosePushL(theWin); sl@0: sl@0: //get windows screen device. sl@0: CWsScreenDevice *device; sl@0: device = new (ELeave)CWsScreenDevice(TestWin->Client()->iWs);//(TheClient->iWs); sl@0: User::LeaveIfError(device->Construct(iTest->ScreenNumber())); sl@0: CleanupStack::PushL(device); sl@0: sl@0: TFontSpec fs1; sl@0: CFont *font1; sl@0: CFont *font2; sl@0: fs1.iTypeface.iName = KTestFontTypefaceName; sl@0: fs1.iHeight = 16; sl@0: fs1.iFontStyle.SetBitmapType(EDefaultGlyphBitmap); sl@0: int error = TheClient->iScreen->GetNearestFontToDesignHeightInPixels((CFont*&)font1,fs1); sl@0: if (error) sl@0: { sl@0: TheClient->iScreen->ReleaseFont(font1); sl@0: User::Panic(_L("font not created"),error); sl@0: } sl@0: fs1.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap); sl@0: error = TheClient->iScreen->GetNearestFontToDesignHeightInPixels((CFont*&)font2,fs1); sl@0: if (error) sl@0: { sl@0: TheClient->iScreen->ReleaseFont(font1); sl@0: TheClient->iScreen->ReleaseFont(font2); sl@0: User::Panic(_L("font not created"),error); sl@0: } sl@0: sl@0: CWindowGc *gc; sl@0: device->CreateContext(gc); sl@0: CleanupStack::PushL(gc); sl@0: sl@0: theWin.Invalidate(); sl@0: theWin.BeginRedraw(); sl@0: gc->Activate(theWin); sl@0: sl@0: gc->SetPenStyle( CGraphicsContext::ESolidPen ); sl@0: gc->SetPenColor( TRgb( 0, 0, 0, 127 ) ); sl@0: sl@0: //draw text for anti-aliasing needs an open font (scalable). sl@0: int typefaces = TheClient->iScreen->NumTypefaces(); sl@0: sl@0: gc->UseFont(font1); sl@0: gc->SetBrushStyle( CGraphicsContext::ENullBrush ); sl@0: gc->DrawText(_L("Test"),TPoint(10,20)); sl@0: gc->DiscardFont(); sl@0: gc->UseFont(font2); sl@0: gc->DrawText(_L("Test"),TPoint(10,60)); sl@0: gc->DiscardFont(); sl@0: sl@0: //destruction and tidying up sl@0: gc->Deactivate(); sl@0: theWin.EndRedraw(); sl@0: TheClient->iWs.Flush(); sl@0: sl@0: TheClient->iScreen->ReleaseFont(font1); sl@0: TheClient->iScreen->ReleaseFont(font2); sl@0: CleanupStack::PopAndDestroy(gc);//gc sl@0: CleanupStack::PopAndDestroy(device);//device sl@0: sl@0: //do not close the test window yet since there is a comparison sl@0: //required sl@0: sl@0: //now do the same on an off screen bitmap. Then create a window sl@0: //and put the bitmap onto it. sl@0: //create a colour bitmap sl@0: // sl@0: CFbsBitmap *bitmapOne; sl@0: bitmapOne = new (ELeave)CFbsBitmap(); sl@0: CleanupStack::PushL(bitmapOne); sl@0: User::LeaveIfError(bitmapOne->Create(winSize,mode)); sl@0: sl@0: CFbsBitmapDevice *deviceOne=CFbsBitmapDevice::NewL(bitmapOne); sl@0: CleanupStack::PushL(deviceOne); sl@0: sl@0: CFont *font3; sl@0: CFont *font4; sl@0: fs1.iFontStyle.SetBitmapType(EDefaultGlyphBitmap); sl@0: error = TheClient->iScreen->GetNearestFontToDesignHeightInPixels((CFont*&)font3,fs1); sl@0: if (error) sl@0: { sl@0: TheClient->iScreen->ReleaseFont(font3); sl@0: User::Panic(_L("font not created"),error); sl@0: } sl@0: fs1.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap); sl@0: error = TheClient->iScreen->GetNearestFontToDesignHeightInPixels((CFont*&)font4,fs1); sl@0: if (error) sl@0: { sl@0: TheClient->iScreen->ReleaseFont(font3); sl@0: TheClient->iScreen->ReleaseFont(font4); sl@0: User::Panic(_L("font not created"),error); sl@0: } sl@0: CFbsBitGc *bGcOne = CFbsBitGc::NewL(); sl@0: CleanupStack::PushL(bGcOne); sl@0: sl@0: bGcOne->Activate(deviceOne); sl@0: sl@0: bGcOne->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: bGcOne->SetBrushColor(TRgb(127,0,255,127)); sl@0: bGcOne->DrawRect(TRect(0,0,winSize.iWidth,winSize.iHeight)); sl@0: sl@0: bGcOne->SetPenStyle(CGraphicsContext::ESolidPen); sl@0: bGcOne->SetPenColor(TRgb(0,0,0,127)); sl@0: sl@0: bGcOne->UseFont(font3); sl@0: bGcOne->SetBrushStyle( CGraphicsContext::ENullBrush ); sl@0: bGcOne->DrawText(_L("Test"),TPoint(10,20)); sl@0: bGcOne->DiscardFont(); sl@0: bGcOne->UseFont(font4); sl@0: bGcOne->DrawText(_L("Test"),TPoint(10,60)); sl@0: bGcOne->DiscardFont(); sl@0: //destruction and tidying up sl@0: //measure the text sl@0: CFont::TMeasureTextOutput textSize; sl@0: font4->MeasureText(_L("Test"),NULL,&textSize); sl@0: sl@0: TheClient->iScreen->ReleaseFont(font3); sl@0: TheClient->iScreen->ReleaseFont(font4); sl@0: sl@0: //display at the left sl@0: RWindow refWin(BaseWin->Client()->iWs); sl@0: CleanupClosePushL(refWin); sl@0: User::LeaveIfError(refWin.Construct(*(BaseWin->WinTreeNode()),(TUint32)&refWin)); sl@0: sl@0: refWin.SetExtent(TPoint(0,0), winSize); sl@0: refWin.SetRequiredDisplayMode(mode); sl@0: refWin.SetVisible(ETrue); sl@0: refWin.SetTransparencyAlphaChannel(); sl@0: refWin.Activate(); sl@0: TheClient->iWs.Flush(); sl@0: sl@0: //a gc for the ref win sl@0: CWsScreenDevice *refDevice; sl@0: refDevice = new (ELeave)CWsScreenDevice(BaseWin->Client()->iWs); sl@0: User::LeaveIfError(refDevice->Construct(iTest->ScreenNumber())); sl@0: CleanupStack::PushL(refDevice); sl@0: CWindowGc *gcRef; sl@0: refDevice->CreateContext(gcRef); sl@0: CleanupStack::PushL(gcRef); sl@0: sl@0: refWin.Invalidate(); sl@0: refWin.BeginRedraw(); sl@0: gcRef->Activate(refWin); sl@0: gcRef->BitBlt(TPoint(0,0), bitmapOne); sl@0: gcRef->Deactivate(); sl@0: refWin.EndRedraw(); sl@0: TheClient->iWs.Flush(); sl@0: sl@0: TPoint refPos = refWin.AbsPosition(); sl@0: TPoint winPos = theWin.AbsPosition(); sl@0: sl@0: //Compare the anti-aliased text areas sl@0: TInt textLength=textSize.iBounds.iBr.iX; sl@0: TInt textHeight=Abs(textSize.iBounds.iTl.iY); sl@0: sl@0: TRect rect1(refPos.iX+10,refPos.iY+60-textHeight, sl@0: refPos.iX+10+textLength,refPos.iY+60); sl@0: TRect rect2(winPos.iX+10,winPos.iY+60-textHeight, sl@0: winPos.iX+10+textLength,winPos.iY+60); sl@0: sl@0: TBool match = refDevice->RectCompare(rect1,rect2); sl@0: TEST(match); sl@0: sl@0: CleanupStack::PopAndDestroy(gcRef); sl@0: CleanupStack::PopAndDestroy(refDevice); sl@0: CleanupStack::PopAndDestroy(&refWin); sl@0: sl@0: CleanupStack::PopAndDestroy(bGcOne); sl@0: CleanupStack::PopAndDestroy(deviceOne); sl@0: CleanupStack::PopAndDestroy(bitmapOne); sl@0: CleanupStack::PopAndDestroy(&theWin);//theWin sl@0: sl@0: } sl@0: // sl@0: // CTDrawOpWin sl@0: // sl@0: sl@0: CTDrawOpWin* CTDrawOpWin::NewL(CTAlphaWin* aTest, CTWinBase* aParent, TPoint aPos, TSize aSize, TRgb aDrawColour) sl@0: { sl@0: CTDrawOpWin* theWin = new(ELeave) CTDrawOpWin(aTest,aDrawColour); sl@0: sl@0: theWin->ConstructL(*aParent); sl@0: theWin->SetExtL(aPos, aSize); sl@0: theWin->AssignGC(*TheClient->iGc); sl@0: if (TheClient->iScreen->DisplayMode() == EColor16MA) sl@0: { sl@0: theWin->BaseWin()->SetRequiredDisplayMode(EColor16MA); sl@0: } sl@0: else sl@0: { sl@0: theWin->BaseWin()->SetRequiredDisplayMode(EColor64K); sl@0: } sl@0: sl@0: theWin->Activate(); sl@0: theWin->DrawNow(); sl@0: sl@0: return theWin; sl@0: } sl@0: sl@0: CTDrawOpWin::CTDrawOpWin(CTAlphaWin* aTest, TRgb aDrawColour) sl@0: : iTest(aTest), iDrawColour(aDrawColour) sl@0: {} sl@0: sl@0: sl@0: void CTDrawOpWin::SetDrawOp(TInt aDrawOp) sl@0: { sl@0: iDrawOp = aDrawOp; sl@0: } sl@0: sl@0: sl@0: void CTDrawOpWin::Draw() sl@0: { sl@0: _LIT(KText,"Text test"); sl@0: sl@0: iGc->SetPenColor(iDrawColour); sl@0: iGc->SetBrushColor(iDrawColour); sl@0: TSize size = Size(); sl@0: TInt top = 5; sl@0: TInt left = 5; sl@0: TInt bottom = size.iHeight - 5; sl@0: TInt right = size.iWidth - 5; sl@0: TInt square = Min(bottom-top,right-left); sl@0: sl@0: switch (iDrawOp) sl@0: { sl@0: case EOpDrawRect: sl@0: iGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: iGc->SetPenStyle(CGraphicsContext::ENullPen); sl@0: iGc->DrawRect(TRect(left,top,right,bottom)); sl@0: break; sl@0: case EOpDrawLine: sl@0: //!! FAILS sl@0: //!! The endpoint of the line is drawn twice, with the result that it is darker when we do blending sl@0: //!! Not intending to fix at the moment sl@0: /* sl@0: iGc->SetPenStyle(CGraphicsContext::ESolidPen); sl@0: iGc->SetPenSize(TSize(4,4)); sl@0: // The lines must not overlap, otherwise the blended lines will be darker at the overlap sl@0: iGc->DrawLine(TPoint(left+5,top), TPoint(left+square,top)); sl@0: iGc->DrawLine(TPoint(left+5,top+5), TPoint(left+square,top+square)); sl@0: iGc->DrawLine(TPoint(left,top+5), TPoint(left,top+square)); sl@0: */ sl@0: break; sl@0: case EOpDrawEllipse: sl@0: iGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: iGc->SetPenStyle(CGraphicsContext::ENullPen); sl@0: iGc->DrawEllipse(TRect(left,top,right,bottom)); sl@0: break; sl@0: case EOpDrawText: sl@0: case EOpDrawTextVertical: sl@0: { sl@0: iGc->SetBrushStyle(CGraphicsContext::ENullBrush); sl@0: iGc->SetPenStyle(CGraphicsContext::ESolidPen); sl@0: CFont* font; sl@0: TFontSpec fontSpec(KTestFontTypefaceName,200); sl@0: User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInTwips(font, fontSpec)); sl@0: iGc->UseFont(font); sl@0: if (iDrawOp==EOpDrawText) sl@0: iGc->DrawText(KText(), TPoint(5,30)); sl@0: else sl@0: iGc->DrawTextVertical(KText(), TPoint(5,30), EFalse); sl@0: iGc->DiscardFont(); sl@0: TheClient->iScreen->ReleaseFont(font); sl@0: } sl@0: break; sl@0: case EOpDrawTextAntiAliased: sl@0: { sl@0: iGc->SetBrushStyle(CGraphicsContext::ENullBrush); sl@0: iGc->SetPenStyle(CGraphicsContext::ESolidPen); sl@0: CFont* font; sl@0: TFontSpec fontSpec(KTestFontTypefaceName,600); sl@0: fontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightBold); sl@0: fontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap); sl@0: sl@0: User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInTwips(font, fontSpec)); sl@0: iGc->UseFont(font); sl@0: iGc->DrawText(KText(), TPoint(5,30)); sl@0: iGc->DiscardFont(); sl@0: TheClient->iScreen->ReleaseFont(font); sl@0: } sl@0: break; sl@0: case EOpBitBlt: sl@0: break; sl@0: case EOpBitBltMasked: sl@0: break; sl@0: default: sl@0: break; sl@0: }; sl@0: } sl@0: sl@0: sl@0: sl@0: // sl@0: // CTAlphaWindow sl@0: // sl@0: sl@0: CTAlphaWindow::~CTAlphaWindow() sl@0: { sl@0: DestroyChildren(); sl@0: } sl@0: sl@0: CTAlphaWindow* CTAlphaWindow::NewL(CTAlphaWin* aTest, CTWinBase* aParent, TPoint aPos, TSize aSize, TInt aDrawState) sl@0: { sl@0: CTAlphaWindow* theWin = new (ELeave) CTAlphaWindow(aTest); sl@0: sl@0: theWin->ConstructL(*aParent); sl@0: theWin->SetExtL(aPos, aSize); sl@0: theWin->SetDrawState(aDrawState); sl@0: sl@0: theWin->AssignGC(*TheClient->iGc); sl@0: sl@0: theWin->Activate(); sl@0: theWin->iDrawState |= EActive; sl@0: theWin->DrawNow(); sl@0: sl@0: return theWin; sl@0: } sl@0: sl@0: void CTAlphaWindow::SetDrawState(TInt aDrawState) sl@0: { sl@0: TBool active = iDrawState & EActive; sl@0: iDrawState = aDrawState & 0x7fffffff; sl@0: sl@0: TRgb colour = ColourFromDrawState(iDrawState); sl@0: ((RWindow*) DrawableWin())->SetBackgroundColor(colour); sl@0: sl@0: if (iDrawState & EModeColor16MA) sl@0: BaseWin()->SetRequiredDisplayMode(EColor16MA); sl@0: else sl@0: BaseWin()->SetRequiredDisplayMode(EColor64K); sl@0: sl@0: BaseWin()->SetVisible(! (iDrawState & EInvisible)); sl@0: sl@0: if (!active) sl@0: { sl@0: if (iDrawState & EAlphaTransparency) sl@0: ((RWindow*) DrawableWin())->SetTransparencyAlphaChannel(); sl@0: else if (iDrawState & ETransparencyFactor) sl@0: ((RWindow*) DrawableWin())->SetTransparencyFactor(TRgb(128,128,128)); sl@0: } sl@0: sl@0: if (active) sl@0: iDrawState |= EActive; sl@0: } sl@0: sl@0: void CTAlphaWindow::SetVisible(TBool aVisible) sl@0: { sl@0: if (aVisible) sl@0: iDrawState &= ~EInvisible; sl@0: else sl@0: iDrawState |= EInvisible; sl@0: BaseWin()->SetVisible(aVisible); sl@0: } sl@0: sl@0: void CTAlphaWindow::CreateChildrenL(TInt aDepth) sl@0: { sl@0: DestroyChildren(); sl@0: if (aDepth>0) sl@0: { sl@0: TSize size = Size(); sl@0: iChild1 = CTAlphaWindow::NewL(iTest, this, TPoint(size.iWidth/3,0), TSize(2*size.iWidth/3, 2*size.iHeight/3), ERed | EGreen | EBlue | EOpaque); sl@0: iChild2 = CTAlphaWindow::NewL(iTest, this, TPoint(0,size.iHeight/3), TSize(2*size.iWidth/3, 2*size.iHeight/3), ERed | EGreen | EBlue | EAlphaTransparency); sl@0: iChild2->CreateChildrenL(aDepth-1); sl@0: } sl@0: } sl@0: sl@0: void CTAlphaWindow::DestroyChildren() sl@0: { sl@0: if (iChild1) sl@0: { sl@0: iChild1->DestroyChildren(); sl@0: delete iChild1; sl@0: iChild1 = NULL; sl@0: } sl@0: if (iChild2) sl@0: { sl@0: iChild2->DestroyChildren(); sl@0: delete iChild2; sl@0: iChild2 = NULL; sl@0: } sl@0: } sl@0: sl@0: TInt CTAlphaWindow::DrawState() sl@0: { sl@0: return iDrawState; sl@0: } sl@0: sl@0: void CTAlphaWindow::Draw() sl@0: { sl@0: // we draw a diagonal line from top left to bottom right sl@0: // we use the complementary colour to the window background colour sl@0: TInt red = (iDrawState & ERed) ? 0 : 255; sl@0: TInt green = (iDrawState & EGreen) ? 0 : 255; sl@0: TInt blue = (iDrawState & EBlue) ? 0 : 255; sl@0: TRgb color(red,green,blue); sl@0: sl@0: TSize size = Size(); sl@0: iGc->SetPenColor(color); sl@0: iGc->SetPenSize(TSize(4,4)); sl@0: iGc->DrawLine(TPoint(0,0), TPoint(size.iWidth, size.iHeight)); sl@0: } sl@0: sl@0: sl@0: // sl@0: // CTAlphaRefWin sl@0: // sl@0: sl@0: CTAlphaRefWin::CTAlphaRefWin(TFixedArray& aAlphaWin) sl@0: : iAlphaWin(aAlphaWin) sl@0: {} sl@0: sl@0: CTAlphaRefWin* CTAlphaRefWin::NewL(CTWinBase* aParent, TPoint aPos, TSize aSize, TFixedArray& aAlphaWin) sl@0: { sl@0: CTAlphaRefWin* theWin = new(ELeave) CTAlphaRefWin(aAlphaWin); sl@0: sl@0: theWin->ConstructL(*aParent); sl@0: theWin->SetExtL(aPos, aSize); sl@0: theWin->AssignGC(*TheClient->iGc); sl@0: theWin->BaseWin()->SetRequiredDisplayMode(EColor64K); sl@0: sl@0: theWin->Activate(); sl@0: theWin->DrawNow(); sl@0: sl@0: return theWin; sl@0: } sl@0: sl@0: void CTAlphaRefWin::Draw() sl@0: { sl@0: iGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: iGc->SetBrushColor(KRgbWhite); sl@0: iGc->Clear(); sl@0: sl@0: // Note, the order of the windows in the array must correspond to their z-order sl@0: for (TInt i=0; i<5; i++) sl@0: DrawWindow(iAlphaWin[i], iAlphaWin[i]->Position()); sl@0: } sl@0: sl@0: void CTAlphaRefWin::DrawWindow(CTAlphaWindow* aWindow, TPoint aPos) sl@0: { sl@0: TInt drawState = aWindow->DrawState(); sl@0: if ( (drawState & EInvisible) || ! (drawState & EActive) ) sl@0: return; sl@0: sl@0: TRgb colour = ColourFromDrawState(drawState); sl@0: if (drawState & EOpaque) sl@0: colour.SetAlpha(255); sl@0: if (drawState & ETransparent) sl@0: colour.SetAlpha(0); sl@0: iGc->SetBrushColor(colour); sl@0: sl@0: TPoint tl = aPos; sl@0: TPoint br = tl + aWindow->Size(); sl@0: TRect rect(tl,br); sl@0: iGc->Clear(rect); sl@0: sl@0: TInt red = (drawState & ERed) ? 0 : 255; sl@0: TInt green = (drawState & EGreen) ? 0 : 255; sl@0: TInt blue = (drawState & EBlue) ? 0 : 255; sl@0: colour = TRgb(red,green,blue); sl@0: sl@0: iGc->SetClippingRect(rect); sl@0: sl@0: TSize size = Size(); sl@0: iGc->SetPenColor(colour); sl@0: iGc->SetPenSize(TSize(4,4)); sl@0: iGc->DrawLine(tl, br); sl@0: sl@0: iGc->CancelClippingRect(); sl@0: sl@0: if (aWindow->iChild1) sl@0: DrawWindow(aWindow->iChild1, aPos + aWindow->iChild1->Position() ); sl@0: if (aWindow->iChild2) sl@0: DrawWindow(aWindow->iChild2, aPos + aWindow->iChild2->Position() ); sl@0: } sl@0: sl@0: sl@0: // sl@0: // Main test loop sl@0: // sl@0: void CTAlphaWin::RunTestCaseL(TInt /*aCurTestCase*/) sl@0: { sl@0: //User::After(TTimeIntervalMicroSeconds32(1000 * 1000)); sl@0: ((CTAlphaWinStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName); sl@0: switch (++iTest->iState) sl@0: { sl@0: /** sl@0: sl@0: @SYMTestCaseID GRAPHICS-WSERV-0278 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMPREQ 915 sl@0: sl@0: @SYMTestCaseDesc Semi-transparent drawing sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Use draw operations with semi-transparent pen or brush colours sl@0: sl@0: @SYMTestExpectedResults Draw operations must do alpha blending sl@0: sl@0: */ sl@0: case 1: sl@0: { sl@0: ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0278")); sl@0: if(TransparencySupportedL() == KErrNotSupported) sl@0: { sl@0: LOG_MESSAGE(_L("Test(1) complete - Transparency not supported\n")); sl@0: TestComplete(); sl@0: break; sl@0: } sl@0: TDisplayMode mode = TheClient->iScreen->DisplayMode(); sl@0: if (mode < EColor64K) sl@0: { sl@0: LOG_MESSAGE(_L("Test(1) complete - Display mode < EColor64K\n")); sl@0: TestComplete(); sl@0: break; sl@0: } sl@0: _LIT(KSemiTrans64K,"(1) Semi transparent drawing Color64K"); sl@0: iTest->LogSubTest(KSemiTrans64K); sl@0: TestSemiTransparentDrawingL(); sl@0: break; sl@0: } sl@0: sl@0: /** sl@0: sl@0: @SYMTestCaseID GRAPHICS-WSERV-0287 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMPREQ 915 sl@0: sl@0: @SYMTestCaseDesc Invisible. All windows are in EColor16MA display mode. sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Transparent alpha channel windows are made invisible and visible both in front and behind one another sl@0: sl@0: @SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing sl@0: sl@0: */ sl@0: case 2: sl@0: ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0287")); sl@0: ConfigureDisplayModes(EColor16MA); sl@0: if(TransparencySupportedL()==KErrNone) sl@0: { sl@0: _LIT(KInvisible16MA,"(2) Invisible Color16MA"); sl@0: iTest->LogSubTest(KInvisible16MA); sl@0: TestInvisible(); sl@0: } sl@0: break; sl@0: sl@0: /** sl@0: sl@0: @SYMTestCaseID GRAPHICS-WSERV-0280 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMPREQ 915 sl@0: sl@0: @SYMTestCaseDesc Initial Configuration. All windows are in EColor64K display mode. sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Several windows are set to be transparent alpha channel, and given semi-transparent or transparent background colours sl@0: sl@0: @SYMTestExpectedResults The transparent window configuration matches a reference drawing created using only alpha blending sl@0: sl@0: */ sl@0: //Test 3 to 6 can't be run without transparency support sl@0: case 3: sl@0: ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0280")); sl@0: ConfigureDisplayModes(EColor64K); sl@0: if(TransparencySupportedL()==KErrNone) sl@0: { sl@0: _LIT(KInitialConfiguration64K,"(3) Initial configuration Color64K"); sl@0: iTest->LogSubTest(KInitialConfiguration64K); sl@0: TestInitialConfiguration(); sl@0: } sl@0: break; sl@0: /** sl@0: sl@0: @SYMTestCaseID GRAPHICS-WSERV-0281 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMPREQ 915 sl@0: sl@0: @SYMTestCaseDesc Move. All windows are in EColor64K display mode. sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Transparent alpha channel windows are moved both in front and behind one another sl@0: sl@0: @SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing sl@0: sl@0: */ sl@0: case 4: sl@0: ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0281")); sl@0: if(TransparencySupportedL()==KErrNone) sl@0: { sl@0: _LIT(KMove64K,"(4) Move Color64K"); sl@0: iTest->LogSubTest(KMove64K); sl@0: TestMove(); sl@0: } sl@0: break; sl@0: /** sl@0: sl@0: @SYMTestCaseID GRAPHICS-WSERV-0282 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMPREQ 915 sl@0: sl@0: @SYMTestCaseDesc Redraw. All windows are in EColor64K display mode. sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Transparent alpha channel windows are redrawn both in front and behind one another sl@0: sl@0: @SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing sl@0: sl@0: */ sl@0: case 5: sl@0: ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0282")); sl@0: if(TransparencySupportedL()==KErrNone) sl@0: { sl@0: _LIT(KRedraw64K,"(5) Redraw Color64K"); sl@0: iTest->LogSubTest(KRedraw64K); sl@0: TestRedraw(); sl@0: } sl@0: break; sl@0: /** sl@0: sl@0: @SYMTestCaseID GRAPHICS-WSERV-0283-0001 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMPREQ 915 sl@0: sl@0: @SYMTestCaseDesc Invisible. All windows are in EColor64K display mode. sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Transparent alpha channel windows are made invisible and visible both in front and behind one another sl@0: sl@0: @SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing sl@0: sl@0: */ sl@0: case 6: sl@0: ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0283-0001")); sl@0: if(TransparencySupportedL()==KErrNone) sl@0: { sl@0: _LIT(KInvisible64K,"(6) Invisible Color64K"); sl@0: iTest->LogSubTest(KInvisible64K); sl@0: TestInvisible(); sl@0: } sl@0: break; sl@0: /** sl@0: sl@0: @SYMTestCaseID GRAPHICS-WSERV-0283-0002 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMPREQ 915 sl@0: sl@0: @SYMTestCaseDesc Children. All windows are in EColor64K display mode. sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Transparent alpha channel windows are given child windows, both transparent and non-transparent, sl@0: and are then moved, redrawn, set visible or invisible both in front and behind one another sl@0: sl@0: @SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing sl@0: sl@0: */ sl@0: case 7: sl@0: ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0283-0002")); sl@0: _LIT(KChildren64K,"(7)Children Color64K"); sl@0: iTest->LogSubTest(KChildren64K); sl@0: TestChildrenL(); sl@0: break; sl@0: /** sl@0: sl@0: @SYMTestCaseID GRAPHICS-WSERV-0356 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMPREQ 915 sl@0: sl@0: @SYMTestCaseDesc Initial Configuration. All windows are in EColor64k Dispaly Mode sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Tests Anti-aliasing of text sl@0: sl@0: @SYMTestExpectedResults Anti-alisaing should behave correctly sl@0: sl@0: */ sl@0: case 8: sl@0: ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0356")); sl@0: _LIT(KAntiAliasedText64K,"(8) AntiAliasedText DEF082251 Color64K"); sl@0: iTest->LogSubTest(KAntiAliasedText64K); sl@0: TestAntiAliasedTextTransparentL(); sl@0: break; sl@0: sl@0: /** sl@0: sl@0: @SYMTestCaseID GRAPHICS-WSERV-0284 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMPREQ 915 sl@0: sl@0: @SYMTestCaseDesc Initial Configuration. All windows are in EColor16MA display mode. sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Several windows are set to be transparent alpha channel, and given semi-transparent or transparent background colours sl@0: sl@0: @SYMTestExpectedResults The transparent window configuration matches a reference drawing created using only alpha blending sl@0: sl@0: */ sl@0: case 9: sl@0: { sl@0: ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0284")); sl@0: ConfigureDisplayModes(EColor16MA); sl@0: TDisplayMode mode1 = TheClient->iScreen->DisplayMode(); sl@0: _LIT(KInitialConfiguration16MA,"(9)Initial configuration Color16MA"); sl@0: iTest->LogSubTest(KInitialConfiguration16MA); sl@0: TestInitialConfiguration(); sl@0: break; sl@0: } sl@0: /** sl@0: sl@0: @SYMTestCaseID GRAPHICS-WSERV-0285 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMPREQ 915 sl@0: sl@0: @SYMTestCaseDesc Move. All windows are in EColor16MA display mode. sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Transparent alpha channel windows are moved both in front and behind one another sl@0: sl@0: @SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing sl@0: sl@0: */ sl@0: case 10: sl@0: ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0285")); sl@0: _LIT(KMove16MA,"(10)Move Color16MA"); sl@0: iTest->LogSubTest(KMove16MA); sl@0: TestMove(); sl@0: break; sl@0: /** sl@0: sl@0: @SYMTestCaseID GRAPHICS-WSERV-0286 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMPREQ 915 sl@0: sl@0: @SYMTestCaseDesc Redraw. All windows are in EColor16MA display mode. sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Transparent alpha channel windows are redrawn both in front and behind one another sl@0: sl@0: @SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing sl@0: sl@0: */ sl@0: case 11: sl@0: ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0286")); sl@0: _LIT(KRedraw16MA,"(11)Redraw Color16MA"); sl@0: iTest->LogSubTest(KRedraw16MA); sl@0: TestRedraw(); sl@0: break; sl@0: sl@0: /** sl@0: sl@0: @SYMTestCaseID GRAPHICS-WSERV-0279 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMPREQ 915 sl@0: sl@0: @SYMTestCaseDesc Transparent drawing sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Use draw operations with transparent pen or brush colours sl@0: sl@0: @SYMTestExpectedResults Draw operations with transparent pen or brush colours should leave the destination unchanged sl@0: sl@0: */ sl@0: sl@0: case 12: sl@0: ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0279")); sl@0: ConfigureDisplayModes(EColor64K); sl@0: _LIT(KTrans64K,"(12) Transparent drawing Color64K"); sl@0: iTest->LogSubTest(KTrans64K); sl@0: TestTransparentDrawingL(); sl@0: break; sl@0: sl@0: sl@0: /** sl@0: sl@0: @SYMTestCaseID GRAPHICS-WSERV-0288 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMPREQ 915 sl@0: sl@0: @SYMTestCaseDesc Children. All windows are in EColor16MA display mode. sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Transparent alpha channel windows are given child windows, both transparent and non-transparent, sl@0: and are then moved, redrawn, set visible or invisible both in front and behind one another sl@0: sl@0: @SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing sl@0: sl@0: */ sl@0: case 13: sl@0: ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0288")); sl@0: _LIT(KChildren16MA,"(13) Children Color16MA"); sl@0: iTest->LogSubTest(KChildren16MA); sl@0: TestChildrenL(); sl@0: break; sl@0: /** sl@0: sl@0: @SYMTestCaseID GRAPHICS-WSERV-0357 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMPREQ 915 sl@0: sl@0: @SYMTestCaseDesc Initial Configuration. All windows are in EColor16MA Dispaly Mode sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Tests Anti-aliasing of text sl@0: sl@0: @SYMTestExpectedResults Anti-alisaing should behave correctly sl@0: sl@0: */ sl@0: case 14: sl@0: ((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0357")); sl@0: _LIT(KAntiAliasedText16MA,"(14) AntiAliasedText DEF082251 Color16MA"); sl@0: iTest->LogSubTest(KAntiAliasedText16MA); sl@0: TestAntiAliasedTextTransparentL(); sl@0: break; sl@0: default: sl@0: ((CTAlphaWinStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); sl@0: ((CTAlphaWinStep*)iStep)->CloseTMSGraphicsStep(); sl@0: TestComplete(); sl@0: break; sl@0: } sl@0: ((CTAlphaWinStep*)iStep)->RecordTestResultL(); sl@0: } sl@0: sl@0: __WS_CONSTRUCT_STEP__(AlphaWin) sl@0: