1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/graphicsdeviceinterface/bitgdi/tbit/TAUTO.CPP Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,1140 @@
1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +
1.20 +#include <hal.h>
1.21 +#include <e32test.h>
1.22 +#include <bitdraw.h>
1.23 +#include <graphics/gdi/gdiconsts.h>
1.24 +#include "TAUTO.H"
1.25 +#include <graphics/fbsdefs.h>
1.26 +
1.27 +
1.28 +TInt PanicTestThread(TAny* aOption);
1.29 +
1.30 +enum TPanicOption
1.31 + {
1.32 + EFirst,
1.33 + EPolygonFiller,
1.34 + EBitmapDevice,
1.35 + EDrawBmp1,
1.36 + EDrawBmp2,
1.37 + EDrawBmp3,
1.38 + EGcDevice1,
1.39 + EGcDevice2,
1.40 + EGcRegion1,
1.41 + EGcRegion2,
1.42 + EUseBrush1,
1.43 + EUseBrush2,
1.44 + EUseBrush3,
1.45 + EUseFont,
1.46 + EDrawText1,
1.47 + EDrawText2,
1.48 + EDrawText3,
1.49 + ELast
1.50 + };
1.51 +
1.52 +
1.53 +CTAuto::CTAuto(CTestStep* aStep):
1.54 + CTGraphicsBase(aStep),
1.55 + iScreenDevice(NULL),
1.56 + iHalfScreen()
1.57 + {
1.58 + iTestRect[0].SetRect(21,10,22,50);
1.59 + iTestRect[1].SetRect(10,21,50,22);
1.60 + iTestRect[2].SetRect(11,20,90,30);
1.61 + iTestRect[3].SetRect(10,71,90,80);
1.62 + iTestRect[4].SetRect(20,10,31,90);
1.63 + iTestRect[5].SetRect(70,10,80,91);
1.64 + iTestRect[6].SetRect(10,10,90,90);
1.65 + iTestRect[7].SetRect(32,32,96,96);
1.66 +
1.67 + INFO_PRINTF1(_L(" "));
1.68 + }
1.69 +
1.70 +CTAuto::~CTAuto()
1.71 + {
1.72 +
1.73 + }
1.74 +
1.75 +void CTAuto::RunTestCaseL(const TInt aCurTestCase)
1.76 + {
1.77 + ((CTAutoStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
1.78 + switch(aCurTestCase)
1.79 + {
1.80 + case 1:
1.81 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0025"));
1.82 + TestMem(EGray2);
1.83 + break;
1.84 + case 2:
1.85 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0025"));
1.86 + TestMem(EGray4);
1.87 + break;
1.88 + case 3:
1.89 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0025"));
1.90 + TestMem(EGray16);
1.91 + break;
1.92 + case 4:
1.93 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0025"));
1.94 + TestMem(EGray256);
1.95 + break;
1.96 + case 5:
1.97 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0025"));
1.98 + TestMem(EColor16);
1.99 + break;
1.100 + case 6:
1.101 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0025"));
1.102 + TestMem(EColor256);
1.103 + break;
1.104 + case 7:
1.105 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0025"));
1.106 + TestMem(EColor4K);
1.107 + break;
1.108 + case 8:
1.109 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0025"));
1.110 + TestMem(EColor64K);
1.111 + break;
1.112 + case 9:
1.113 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0025"));
1.114 + TestMem(EColor16M);
1.115 + break;
1.116 + case 10:
1.117 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0025"));
1.118 + TestMem(EColor16MU);
1.119 + break;
1.120 + case 11:
1.121 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0026"));
1.122 + TestMapL(EGray2,15);
1.123 + break;
1.124 + case 12:
1.125 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0026"));
1.126 + TestMapL(EGray4,5);
1.127 + break;
1.128 + case 13:
1.129 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0026"));
1.130 + TestMapL(EGray16,5);
1.131 + break;
1.132 + case 14:
1.133 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0026"));
1.134 + TestMapL(EGray256,5);
1.135 + break;
1.136 + case 15:
1.137 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0026"));
1.138 + TestMapL(EColor16,5);
1.139 + break;
1.140 + case 16:
1.141 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0026"));
1.142 + TestMapL(EColor256,3);
1.143 + break;
1.144 + case 17:
1.145 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0026"));
1.146 + TestMapL(EColor4K,5);
1.147 + break;
1.148 + case 18:
1.149 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0026"));
1.150 + TestMapL(EColor64K,4);
1.151 + break;
1.152 + case 19:
1.153 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0026"));
1.154 + TestMapL(EColor16M,4);
1.155 + break;
1.156 + case 20:
1.157 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0026"));
1.158 + TestMapL(EColor16MU,4);
1.159 + break;
1.160 + case 21:
1.161 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0027"));
1.162 + TestBmpL(EGray2);
1.163 + break;
1.164 + case 22:
1.165 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0027"));
1.166 + TestBmpL(EGray4);
1.167 + break;
1.168 + case 23:
1.169 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0027"));
1.170 + TestBmpL(EGray16);
1.171 + break;
1.172 + case 24:
1.173 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0027"));
1.174 + TestBmpL(EGray256);
1.175 + break;
1.176 + case 25:
1.177 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0027"));
1.178 + TestBmpL(EColor16);
1.179 + break;
1.180 + case 26:
1.181 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0027"));
1.182 + TestBmpL(EColor256);
1.183 + break;
1.184 + case 27:
1.185 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0027"));
1.186 + TestBmpL(EColor4K);
1.187 + break;
1.188 + case 28:
1.189 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0027"));
1.190 + TestBmpL(EColor64K);
1.191 + break;
1.192 + case 29:
1.193 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0027"));
1.194 + TestBmpL(EColor16M);
1.195 + break;
1.196 + case 30:
1.197 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0027"));
1.198 + TestBmpL(EColor16MU);
1.199 + break;
1.200 + case 31:
1.201 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0027"));
1.202 + TestBmpL(EColor16MA);
1.203 + break;
1.204 + case 32:
1.205 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0025"));
1.206 + TestMem(EColor16MA);
1.207 + break;
1.208 + case 33:
1.209 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0026"));
1.210 + TestMapL(EColor16MA,4);
1.211 + break;
1.212 + case 34:
1.213 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0027"));
1.214 + TestBmpL(EColor16MAP);
1.215 + break;
1.216 + case 35:
1.217 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0025"));
1.218 + TestMem(EColor16MAP);
1.219 + break;
1.220 + case 36:
1.221 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0026"));
1.222 + TestMapL(EColor16MAP,4);
1.223 + break;
1.224 + case 37:
1.225 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0029"));
1.226 + TestFadingL();
1.227 + INFO_PRINTF2(_L("TestCase %d - Passed Fading Test\r\n"),aCurTestCase);
1.228 + break;
1.229 + case 38:
1.230 + ((CTAutoStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0028"));
1.231 + TestPanics();
1.232 + break;
1.233 + case 39: //exit
1.234 + ((CTAutoStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
1.235 + ((CTAutoStep*)iStep)->CloseTMSGraphicsStep();
1.236 + TestComplete();
1.237 + break;
1.238 + }
1.239 + ((CTAutoStep*)iStep)->RecordTestResultL();
1.240 + }
1.241 +
1.242 +
1.243 +/**
1.244 + @SYMTestCaseID GRAPHICS-BITGDI-0025
1.245 +
1.246 + @SYMDEF
1.247 +
1.248 + @SYMTestCaseDesc Tests the memory allocation cleanup after allocations fails
1.249 +
1.250 + @SYMTestPriority High
1.251 +
1.252 + @SYMTestStatus Implemented
1.253 +
1.254 + @SYMTestActions sets memory allocation to fail then checks it is cleaned up correctly
1.255 +
1.256 + @SYMTestExpectedResults Memory should be successfully cleaned up
1.257 +*/
1.258 +void CTAuto::TestMem(TDisplayMode aDispMode)
1.259 + {
1.260 + LowLevelDevice(aDispMode,EFalse);
1.261 + BitmapDevice(aDispMode);
1.262 + LowLevelDevice(aDispMode,ETrue);
1.263 + ScreenDevice(aDispMode);
1.264 +
1.265 + INFO_PRINTF2(_L("Mode %d passed memory test\r\n"),aDispMode);
1.266 + }
1.267 +
1.268 +void CTAuto::ScreenDevice(TDisplayMode aDispMode)
1.269 + {
1.270 + CFbsScreenDevice* device = NULL;
1.271 + for (TInt count = 1; ; count++)
1.272 + {
1.273 + __UHEAP_SETFAIL(RHeap::EDeterministic,count);
1.274 + __UHEAP_MARK;
1.275 + TRAPD(err,device = CFbsScreenDevice::NewL(_L("scdv"),aDispMode));
1.276 + if (err == KErrNotSupported)
1.277 + {
1.278 + __UHEAP_MARKEND;
1.279 + break;
1.280 + }
1.281 + else if(err == KErrNoMemory)
1.282 + {
1.283 + __UHEAP_MARKEND;
1.284 + }
1.285 + else if (err == KErrNone)
1.286 + {
1.287 + delete device;
1.288 + __UHEAP_MARKEND;
1.289 + break;
1.290 + }
1.291 + else
1.292 + {
1.293 + __UHEAP_MARKEND;
1.294 + User::Panic(_L("CFbsScreenDevice test failed "),err);
1.295 + }
1.296 + }
1.297 +
1.298 + __UHEAP_RESET;
1.299 + }
1.300 +
1.301 +void CTAuto::BitmapDevice(TDisplayMode aDispMode)
1.302 + {
1.303 + CFbsBitmap bmp;
1.304 + TInt ret = bmp.Create(TSize(1,1),aDispMode);
1.305 + if (ret != KErrNone)
1.306 + User::Panic(_L("Failed to create bitmap"),ret);
1.307 +
1.308 + CFbsBitmapDevice* device = NULL;
1.309 + for (TInt count = 1; ; count++)
1.310 + {
1.311 + __UHEAP_SETFAIL(RHeap::EDeterministic,count);
1.312 + __UHEAP_MARK;
1.313 + TRAPD(err,device = CFbsBitmapDevice::NewL(&bmp));
1.314 + if(err == KErrNotSupported)
1.315 + {
1.316 + __UHEAP_MARKEND;
1.317 + break;
1.318 + }
1.319 + else if(err == KErrNoMemory)
1.320 + {
1.321 + __UHEAP_MARKEND;
1.322 + }
1.323 + else if (err == KErrNone)
1.324 + {
1.325 + delete device;
1.326 + __UHEAP_MARKEND;
1.327 + break;
1.328 + }
1.329 + else
1.330 + {
1.331 + __UHEAP_MARKEND;
1.332 + User::Panic(_L("CFbsBitmapDevice test failed "),err);
1.333 + }
1.334 + }
1.335 +
1.336 + __UHEAP_RESET;
1.337 + }
1.338 +
1.339 +void CTAuto::LowLevelDevice(TDisplayMode aDispMode,TBool aScreen)
1.340 + {
1.341 + TInt address = NULL;
1.342 + TSize size(0,0);
1.343 + TInt ret = HAL::Get(KDefaultScreenNo, HALData::EDisplayMemoryAddress,address);
1.344 + if (ret == KErrNone)
1.345 + ret = HAL::Get(KDefaultScreenNo, HALData::EDisplayXPixels,size.iWidth);
1.346 + if (ret == KErrNone)
1.347 + ret = HAL::Get(KDefaultScreenNo, HALData::EDisplayYPixels,size.iHeight);
1.348 + if (ret != KErrNone)
1.349 + User::Panic(_L("CFbsDrawDevice test failed "),ret);
1.350 +
1.351 + TPckgBuf<TScreenInfoV01> s;
1.352 + s().iScreenAddressValid = ETrue;
1.353 + s().iScreenAddress = REINTERPRET_CAST(TAny*,address);
1.354 + s().iScreenSize = size;
1.355 +
1.356 + CFbsDrawDevice* fdd = NULL;
1.357 +
1.358 + for(TInt count = 1; ; count++)
1.359 + {
1.360 + __UHEAP_SETFAIL(RHeap::EDeterministic,count);
1.361 + __UHEAP_MARK;
1.362 +
1.363 + if (aScreen)
1.364 + {
1.365 + TRAP(ret,fdd = CFbsDrawDevice::NewScreenDeviceL(s(),aDispMode));
1.366 + }
1.367 + else
1.368 + {
1.369 + TRAP(ret, fdd = CFbsDrawDevice::NewBitmapDeviceL(s(), aDispMode, CFbsBitmap::ScanLineLength(size.iWidth, aDispMode)));
1.370 + }
1.371 +
1.372 + if (ret == KErrNotSupported)
1.373 + {
1.374 + __UHEAP_MARKEND;
1.375 + break;
1.376 + }
1.377 + else if (ret == KErrNoMemory)
1.378 + {
1.379 + __UHEAP_MARKEND;
1.380 + }
1.381 + else if (ret == KErrNone)
1.382 + {
1.383 + delete fdd;
1.384 + __UHEAP_MARKEND;
1.385 + break;
1.386 + }
1.387 + else
1.388 + {
1.389 + __UHEAP_MARKEND;
1.390 + User::Panic(_L("CFbsDrawDevice test failed "),ret);
1.391 + }
1.392 + }
1.393 +
1.394 + __UHEAP_RESET;
1.395 + }
1.396 +
1.397 +
1.398 +/**
1.399 + @SYMTestCaseID GRAPHICS-BITGDI-0026
1.400 +
1.401 + @SYMDEF
1.402 +
1.403 + @SYMTestCaseDesc Colour mapping testing
1.404 +
1.405 + @SYMTestPriority High
1.406 +
1.407 + @SYMTestStatus Implemented
1.408 +
1.409 + @SYMTestActions attempts to map four shades of grey to greys in a colourmap
1.410 +
1.411 + @SYMTestExpectedResults All pixels should map to the colourmap correctly
1.412 +*/
1.413 +//
1.414 +//
1.415 +//
1.416 +void CTAuto::TestMapL(TDisplayMode aDispMode,TInt aShadowFactor)
1.417 + {
1.418 + TRAPD(err,iScreenDevice = CFbsScreenDevice::NewL(_L("scdv"),aDispMode));
1.419 + if (err == KErrNotSupported)
1.420 + return;
1.421 + User::LeaveIfError(err);
1.422 +
1.423 + User::LeaveIfError(iScreenDevice->CreateContext(iScreenGc));
1.424 + iScreenDevice->ChangeScreenDevice(NULL);
1.425 +
1.426 + TestMapColors();
1.427 + TestShadowArea(aShadowFactor);
1.428 + TestFadeArea();
1.429 +
1.430 + delete iScreenGc;
1.431 + delete iScreenDevice;
1.432 +
1.433 + INFO_PRINTF2(_L("Mode %d passed colour map test\r\n"),aDispMode);
1.434 + }
1.435 +
1.436 +void CTAuto::TestMapColors()
1.437 + {
1.438 + TRgb colormap[4];
1.439 + TRgb screencolor;
1.440 + TInt x,y;
1.441 +
1.442 + for (TInt count = 0; count < KNumRects; count++)
1.443 + {
1.444 + for (TInt color = 0; color < 4 && iScreenDevice->DisplayMode() != EGray2; color++)
1.445 + {
1.446 + Clear(TRgb::Gray4(color));
1.447 + TRect r(iTestRect[count]);
1.448 + colormap[0] = TRgb::Gray4(color);
1.449 + colormap[1] = TRgb::Gray4(3-color);
1.450 + colormap[2] = colormap[1];
1.451 + colormap[3] = colormap[0];
1.452 + if (iScreenDevice->DisplayMode() == EColor64K)
1.453 + {
1.454 + colormap[0] = TRgb::Color64K(colormap[0].Color64K());
1.455 + colormap[1] = TRgb::Color64K(colormap[1].Color64K());
1.456 + colormap[2] = colormap[1];
1.457 + colormap[3] = colormap[0];
1.458 + }
1.459 + iScreenGc->MapColors(r,colormap,2);
1.460 +
1.461 + for(y=0;y<r.iTl.iY;y++)
1.462 + for(x=0;x<100;x++)
1.463 + {
1.464 + iScreenDevice->GetPixel(screencolor,TPoint(x,y));
1.465 + TEST(screencolor.Gray4() == color);
1.466 + }
1.467 + for(y=r.iTl.iY;y<r.iBr.iY;y++)
1.468 + for(x=0;x<r.iTl.iX;x++)
1.469 + {
1.470 + iScreenDevice->GetPixel(screencolor,TPoint(x,y));
1.471 + TEST(screencolor.Gray4() == color);
1.472 + }
1.473 + for(y=r.iTl.iY;y<r.iBr.iY;y++)
1.474 + for(x=r.iBr.iX;x<100;x++)
1.475 + {
1.476 + iScreenDevice->GetPixel(screencolor,TPoint(x,y));
1.477 + TEST(screencolor.Gray4() == color);
1.478 + }
1.479 + for(y=r.iBr.iY;y<100;y++)
1.480 + for(x=0;x<100;x++)
1.481 + {
1.482 + iScreenDevice->GetPixel(screencolor,TPoint(x,y));
1.483 + TEST(screencolor.Gray4() == color);
1.484 + }
1.485 + for(y=r.iTl.iY;y<r.iBr.iY;y++)
1.486 + for(x=r.iTl.iX;x<r.iBr.iX;x++)
1.487 + {
1.488 + iScreenDevice->GetPixel(screencolor,TPoint(x,y));
1.489 + TEST(screencolor.Gray4() == 3-color);
1.490 + }
1.491 + iScreenGc->MapColors(r,colormap,2);
1.492 + for(y=r.iTl.iY;y<r.iBr.iY;y++)
1.493 + for(x=r.iTl.iX;x<r.iBr.iX;x++)
1.494 + {
1.495 + iScreenDevice->GetPixel(screencolor,TPoint(x,y));
1.496 + TEST(screencolor.Gray4() == color);
1.497 + }
1.498 + }
1.499 + }
1.500 + }
1.501 +
1.502 +void CTAuto::TestShadowArea(TInt aShadowFactor)
1.503 + {
1.504 + TRgb screencolor;
1.505 + TInt x,y;
1.506 +
1.507 + for (TInt count = 0; count < KNumRects; count++)
1.508 + {
1.509 + for (TInt color = 0; color < 4; color++)
1.510 + {
1.511 + if (color > 0 && iScreenDevice->DisplayMode() == EGray2)
1.512 + color = 3;
1.513 +
1.514 + Clear(TRgb::Gray4(color));
1.515 + TRect r(iTestRect[count]);
1.516 + TRegionFix<1> reg(r);
1.517 +
1.518 + iScreenGc->ShadowArea(®);
1.519 +
1.520 + for(y=0;y<r.iTl.iY;y++)
1.521 + for(x=0;x<100;x++)
1.522 + {
1.523 + iScreenDevice->GetPixel(screencolor,TPoint(x,y));
1.524 + TEST(screencolor.Gray4() == color);
1.525 + }
1.526 +
1.527 + for(y=r.iTl.iY;y<r.iBr.iY;y++)
1.528 + for(x=0;x<r.iTl.iX;x++)
1.529 + {
1.530 + iScreenDevice->GetPixel(screencolor,TPoint(x,y));
1.531 + TEST(screencolor.Gray4() == color);
1.532 + }
1.533 +
1.534 + for(y=r.iTl.iY;y<r.iBr.iY;y++)
1.535 + for(x=r.iBr.iX;x<100;x++)
1.536 + {
1.537 + iScreenDevice->GetPixel(screencolor,TPoint(x,y));
1.538 + TEST(screencolor.Gray4() == color);
1.539 + }
1.540 +
1.541 + for(y=r.iBr.iY;y<100;y++)
1.542 + for(x=0;x<100;x++)
1.543 + {
1.544 + iScreenDevice->GetPixel(screencolor,TPoint(x,y));
1.545 + TEST(screencolor.Gray4() == color);
1.546 + }
1.547 +
1.548 + for(y=r.iTl.iY;y<r.iBr.iY;y++)
1.549 + for(x=r.iTl.iX;x<r.iBr.iX;x++)
1.550 + {
1.551 + iScreenDevice->GetPixel(screencolor,TPoint(x,y));
1.552 + TEST(screencolor.Gray16() == Max(0,color * 5 - aShadowFactor));
1.553 + }
1.554 + }
1.555 + }
1.556 + }
1.557 +
1.558 +void CTAuto::TestFadeArea()
1.559 + {
1.560 + DoTestFadeArea(0,255);
1.561 + DoTestFadeArea(0,127);
1.562 + DoTestFadeArea(128,255);
1.563 + DoTestFadeArea(64,192);
1.564 + }
1.565 +
1.566 +void CTAuto::DoTestFadeArea(TUint8 aBlackMap,TUint8 aWhiteMap)
1.567 + {
1.568 + iScreenGc->SetFadingParameters(aBlackMap,aWhiteMap);
1.569 +
1.570 + DoTestFadeArea(KRgbWhite,FadeColor(KRgbWhite,aBlackMap,aWhiteMap));
1.571 + DoTestFadeArea(KRgbBlack,FadeColor(KRgbBlack,aBlackMap,aWhiteMap));
1.572 +
1.573 + if (iScreenDevice->DisplayMode() == EGray2)
1.574 + return; // EGray2 mode dithers so only check black & white
1.575 +
1.576 + DoTestFadeArea(KRgbGray,FadeColor(KRgbGray,aBlackMap,aWhiteMap));
1.577 + DoTestFadeArea(KRgbDarkGray,FadeColor(KRgbDarkGray,aBlackMap,aWhiteMap));
1.578 +
1.579 + if (iScreenDevice->DisplayMode() == EGray4)
1.580 + return; // EGray4 mode dithers so only check four gray scales
1.581 +
1.582 + DoTestFadeArea(KRgbRed,FadeColor(KRgbRed,aBlackMap,aWhiteMap));
1.583 + DoTestFadeArea(KRgbGreen,FadeColor(KRgbGreen,aBlackMap,aWhiteMap));
1.584 + DoTestFadeArea(KRgbBlue,FadeColor(KRgbBlue,aBlackMap,aWhiteMap));
1.585 + }
1.586 +
1.587 +void CTAuto::DoTestFadeArea(TRgb aColor,TRgb aFadedColor)
1.588 + {
1.589 + TRgb screencolor;
1.590 + TInt x,y;
1.591 +
1.592 + for (TInt count = 0; count < KNumRects; count++)
1.593 + {
1.594 + Clear(aColor);
1.595 + aColor = MapColorToDisplayMode(aColor);
1.596 +
1.597 + TRect r(iTestRect[count]);
1.598 + TRegionFix<1> reg(r);
1.599 +
1.600 + iScreenGc->FadeArea(®);
1.601 +
1.602 + for(y=0;y<r.iTl.iY;y++)
1.603 + for(x=0;x<100;x++)
1.604 + {
1.605 + iScreenDevice->GetPixel(screencolor,TPoint(x,y));
1.606 + TEST(screencolor == aColor);
1.607 + }
1.608 +
1.609 + for(y=r.iTl.iY;y<r.iBr.iY;y++)
1.610 + for(x=0;x<r.iTl.iX;x++)
1.611 + {
1.612 + iScreenDevice->GetPixel(screencolor,TPoint(x,y));
1.613 + TEST(screencolor == aColor);
1.614 + }
1.615 +
1.616 + for(y=r.iTl.iY;y<r.iBr.iY;y++)
1.617 + for(x=r.iBr.iX;x<100;x++)
1.618 + {
1.619 + iScreenDevice->GetPixel(screencolor,TPoint(x,y));
1.620 + TEST(screencolor == aColor);
1.621 + }
1.622 +
1.623 + for(y=r.iBr.iY;y<100;y++)
1.624 + for(x=0;x<100;x++)
1.625 + {
1.626 + iScreenDevice->GetPixel(screencolor,TPoint(x,y));
1.627 + TEST(screencolor == aColor);
1.628 + }
1.629 +
1.630 + for(y=r.iTl.iY;y<r.iBr.iY;y++)
1.631 + for(x=r.iTl.iX;x<r.iBr.iX;x++)
1.632 + {
1.633 + iScreenDevice->GetPixel(screencolor,TPoint(x,y));
1.634 + TEST(screencolor == aFadedColor);
1.635 + }
1.636 + }
1.637 + }
1.638 +
1.639 +TRgb CTAuto::FadeColor(TRgb aColor,TInt aBlackMap,TInt aWhiteMap)
1.640 + {
1.641 + aColor = MapColorToDisplayMode(aColor);
1.642 +
1.643 + TInt red = ((aColor.Red() * (aWhiteMap - aBlackMap + 1)) >> 8) + aBlackMap;
1.644 + TInt green = ((aColor.Green() * (aWhiteMap - aBlackMap + 1)) >> 8) + aBlackMap;
1.645 + TInt blue = ((aColor.Blue() * (aWhiteMap - aBlackMap + 1)) >> 8) + aBlackMap;
1.646 +
1.647 + aColor = TRgb(red,green,blue);
1.648 +
1.649 + aColor = MapColorToDisplayMode(aColor);
1.650 +
1.651 + return aColor;
1.652 + }
1.653 +
1.654 +TRgb CTAuto::MapColorToDisplayMode(TRgb aColor)
1.655 + {
1.656 + switch (iScreenDevice->DisplayMode())
1.657 + {
1.658 + case EGray2:
1.659 + aColor = TRgb::Gray2(aColor.Gray2());
1.660 + break;
1.661 + case EGray4:
1.662 + aColor = TRgb::Gray4(aColor.Gray4());
1.663 + break;
1.664 + case EGray16:
1.665 + aColor = TRgb::Gray16(aColor.Gray16());
1.666 + break;
1.667 + case EGray256:
1.668 + aColor = TRgb::Gray256(aColor.Gray256());
1.669 + break;
1.670 + case EColor16:
1.671 + aColor = TRgb::Color16(aColor.Color16());
1.672 + break;
1.673 + case EColor256:
1.674 + aColor = TRgb::Color256(aColor.Color256());
1.675 + break;
1.676 + case EColor4K:
1.677 + aColor = TRgb::Color4K(aColor.Color4K());
1.678 + break;
1.679 + case EColor64K:
1.680 + aColor = TRgb::Color64K(aColor.Color64K());
1.681 + break;
1.682 + case EColor16M:
1.683 + aColor = TRgb::Color16M(aColor.Color16M());
1.684 + break;
1.685 + case EColor16MU:
1.686 + aColor = TRgb::Color16MU(aColor.Color16MU());
1.687 + break;
1.688 + case EColor16MA:
1.689 + aColor = TRgb::Color16MA(aColor.Color16MA());
1.690 + break;
1.691 + case EColor16MAP:
1.692 + aColor = TRgb::Color16MAP(aColor.Color16MAP());
1.693 + break;
1.694 + default:
1.695 + User::Invariant();
1.696 + break;
1.697 + }
1.698 +
1.699 + return aColor;
1.700 + }
1.701 +
1.702 +void CTAuto::Clear(TRgb aColor)
1.703 + {
1.704 + iScreenGc->SetBrushColor(aColor);
1.705 + iScreenGc->Clear();
1.706 + }
1.707 +
1.708 +
1.709 +/**
1.710 + @SYMTestCaseID GRAPHICS-BITGDI-0027
1.711 +
1.712 + @SYMDEF
1.713 +
1.714 + @SYMTestCaseDesc tests drawing a bitmap to the screen in various colour modes
1.715 +
1.716 + @SYMTestPriority High
1.717 +
1.718 + @SYMTestStatus Implemented
1.719 +
1.720 + @SYMTestActions draws to a bitmaps gc and the screens gc then compares the result on a per pixel basis
1.721 +
1.722 + @SYMTestExpectedResults bitmap and screen should be identical
1.723 +*/
1.724 +//
1.725 +// Bitmap drawing testing
1.726 +//
1.727 +void CTAuto::TestBmpL(TDisplayMode aDispMode)
1.728 + {
1.729 + TRAPD(err,iScreenDevice = CFbsScreenDevice::NewL(_L("scdv"),aDispMode));
1.730 + if (err == KErrNotSupported)
1.731 + return;
1.732 + User::LeaveIfError(err);
1.733 + iScreenDevice->ChangeScreenDevice(NULL);
1.734 + User::LeaveIfError(iScreenDevice->CreateContext((CGraphicsContext*&)iScreenGc));
1.735 +
1.736 + iHalfScreen = iScreenDevice->SizeInPixels();
1.737 + iHalfScreen.iWidth /= 2;
1.738 +
1.739 + CFbsBitmap bitmap;
1.740 + User::LeaveIfError(bitmap.Create(iHalfScreen,aDispMode));
1.741 +
1.742 + CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(&bitmap);
1.743 + CleanupStack::PushL(bitmapDevice);
1.744 + CFbsBitGc* bitmapGc = NULL;
1.745 + User::LeaveIfError(bitmapDevice->CreateContext(bitmapGc));
1.746 + CleanupStack::PushL(bitmapGc);
1.747 +
1.748 + TestGc(iScreenGc,iHalfScreen);
1.749 + TestGc(bitmapGc,iHalfScreen);
1.750 +
1.751 + iScreenGc->BitBlt(TPoint(iHalfScreen.iWidth,0),&bitmap);
1.752 +
1.753 + TRgb* left = new(ELeave) TRgb[iHalfScreen.iWidth];
1.754 + TRgb* right = new(ELeave) TRgb[iHalfScreen.iWidth];
1.755 +
1.756 + TPtr8 leftBuf(REINTERPRET_CAST(TUint8*,left),iHalfScreen.iWidth * sizeof(TRgb),iHalfScreen.iWidth * sizeof(TRgb));
1.757 + TPtr8 rightBuf(REINTERPRET_CAST(TUint8*,right),iHalfScreen.iWidth * sizeof(TRgb),iHalfScreen.iWidth * sizeof(TRgb));
1.758 +
1.759 + for (TInt row = 0; row < iHalfScreen.iHeight; row++)
1.760 + {
1.761 + iScreenDevice->GetScanLine(leftBuf,TPoint(0,row),iHalfScreen.iWidth,ERgb);
1.762 + bitmap.GetScanLine(rightBuf,TPoint(iHalfScreen.iWidth,row),iHalfScreen.iWidth,ERgb);
1.763 +
1.764 + TRgb* leftPtr = left;
1.765 + TRgb* rightPtr = right;
1.766 +
1.767 + for (TInt col = 0; col < iHalfScreen.iWidth; col++)
1.768 + {
1.769 + if (leftPtr[0] != rightPtr[0])
1.770 + User::Panic(_L("Screen/bitmap mismatch!"),KErrGeneral);
1.771 +
1.772 + leftPtr++;
1.773 + rightPtr++;
1.774 + }
1.775 + }
1.776 +
1.777 + delete[] left;
1.778 + delete[] right;
1.779 + CleanupStack::PopAndDestroy(2); // bitmapGc,bitmapDevice
1.780 + delete iScreenGc;
1.781 + delete iScreenDevice;
1.782 +
1.783 + iScreenDevice = NULL;
1.784 + iScreenGc = NULL;
1.785 +
1.786 + bitmap.Reset();
1.787 +
1.788 + INFO_PRINTF2(_L("Mode %d passed bitmap drawing test\r\n"),aDispMode);
1.789 + }
1.790 +
1.791 +void CTAuto::TestGc(CFbsBitGc* aGc,const TSize& aSize)
1.792 + {
1.793 + aGc->SetPenStyle(CGraphicsContext::ENullPen);
1.794 + aGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1.795 + aGc->SetBrushColor(KRgbBlack);
1.796 + aGc->DrawRect(TRect(TPoint(),iScreenDevice->SizeInPixels()));
1.797 + aGc->SetPenStyle(CGraphicsContext::ESolidPen);
1.798 + aGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1.799 +
1.800 + Colors(aGc,aSize);
1.801 + Shapes(aGc,aSize);
1.802 + }
1.803 +
1.804 +void CTAuto::Colors(CFbsBitGc* aGc,const TSize& aSize)
1.805 + {
1.806 + TInt i=0;
1.807 + TInt w=aSize.iWidth;
1.808 + TInt h=aSize.iHeight;
1.809 + TInt xinc = w / 16;
1.810 + TInt lx = 0;
1.811 + TInt rx = xinc - 1;
1.812 +
1.813 + for(i=0;i<256;i++)
1.814 + {
1.815 + aGc->SetPenColor(TRgb::Gray256(i));
1.816 + aGc->SetBrushColor(TRgb::Gray256(i));
1.817 + aGc->DrawRect(TRect(lx,i*h/256,rx,(i+1)*h/256));
1.818 + }
1.819 + lx += xinc;
1.820 + rx += xinc;
1.821 + for(i=0;i<16;i++)
1.822 + {
1.823 + aGc->SetPenColor(TRgb::Gray16(i));
1.824 + aGc->SetBrushColor(TRgb::Gray16(i));
1.825 + aGc->DrawRect(TRect(lx,i*h/16,rx,(i+1)*h/16));
1.826 + }
1.827 + lx += xinc;
1.828 + rx += xinc;
1.829 + for(i=0;i<4;i++)
1.830 + {
1.831 + aGc->SetPenColor(TRgb::Gray4(i));
1.832 + aGc->SetBrushColor(TRgb::Gray4(i));
1.833 + aGc->DrawRect(TRect(lx,i*h/4,rx,(i+1)*h/4));
1.834 + }
1.835 + lx += xinc;
1.836 + rx += xinc;
1.837 + for(i=0;i<256;i++)
1.838 + {
1.839 + aGc->SetPenColor(TRgb(i,0,0));
1.840 + aGc->SetBrushColor(TRgb(i,0,0));
1.841 + aGc->DrawRect(TRect(lx,i*h/256,rx,(i+1)*h/256));
1.842 + }
1.843 + lx += xinc;
1.844 + rx += xinc;
1.845 + for(i=0;i<256;i++)
1.846 + {
1.847 + aGc->SetPenColor(TRgb(0,i,0));
1.848 + aGc->SetBrushColor(TRgb(0,i,0));
1.849 + aGc->DrawRect(TRect(lx,i*h/256,rx,(i+1)*h/256));
1.850 + }
1.851 + lx += xinc;
1.852 + rx += xinc;
1.853 + for(i=0;i<256;i++)
1.854 + {
1.855 + aGc->SetPenColor(TRgb(0,0,i));
1.856 + aGc->SetBrushColor(TRgb(0,0,i));
1.857 + aGc->DrawRect(TRect(lx,i*h/256,rx,(i+1)*h/256));
1.858 + }
1.859 + lx += xinc;
1.860 + rx += xinc;
1.861 + for(i=0;i<256;i++)
1.862 + {
1.863 + aGc->SetPenColor(TRgb::Color256(i));
1.864 + aGc->SetBrushColor(TRgb::Color256(i));
1.865 + aGc->DrawRect(TRect(lx,i*h/256,rx,(i+1)*h/256));
1.866 + }
1.867 + lx += xinc;
1.868 + rx += xinc;
1.869 + for(i=0;i<16;i++)
1.870 + {
1.871 + aGc->SetPenColor(TRgb::Color16(i));
1.872 + aGc->SetBrushColor(TRgb::Color16(i));
1.873 + aGc->DrawRect(TRect(lx,i*h/16,rx,(i+1)*h/16));
1.874 + }
1.875 +
1.876 + }
1.877 +
1.878 +void CTAuto::Shapes(CFbsBitGc* aGc,const TSize& aSize)
1.879 + {
1.880 + aGc->SetBrushStyle(CGraphicsContext::ENullBrush);
1.881 + aGc->SetPenColor(KRgbWhite);
1.882 +
1.883 + TInt w=aSize.iWidth;
1.884 + TInt h=aSize.iHeight;
1.885 +
1.886 + CArrayFixFlat<TPoint>* poly=new(ELeave) CArrayFixFlat<TPoint>(4);
1.887 + TInt a=w>>1;
1.888 + TInt b=a+(a>>1);
1.889 + TPoint temppt(w*5/8,h/48);
1.890 + poly->AppendL(temppt);
1.891 + temppt.SetXY(b-1,h*11/48);
1.892 + poly->AppendL(temppt);
1.893 + temppt.SetXY(a+1,h*11/48);
1.894 + poly->AppendL(temppt);
1.895 + temppt.SetXY(w*5/8,h/48);
1.896 + poly->AppendL(temppt);
1.897 + aGc->DrawPolyLine(poly);
1.898 + delete poly;
1.899 +
1.900 + aGc->DrawRect(TRect(a+1,h*7/24,b,h*12/24));
1.901 + aGc->DrawRoundRect(TRect(a+1,h*13/24,b,h*18/24),TSize(w/16,h/12));
1.902 + aGc->DrawEllipse(TRect(a+1,h*19/24,b,h*24/24));
1.903 + aGc->DrawArc(TRect(b+1,h*1/24,w-1,h*6/24),TPoint(w*15/16,h*6/24),TPoint(w*13/16,h*6/24));
1.904 + aGc->DrawPie(TRect(b+1,h*7/24,w-1,h*12/24),TPoint(w*13/16,h*7/24),TPoint(w*15/16,h*7/24));
1.905 + aGc->DrawEllipse(TRect(b+1,h*13/24,w-1,h*18/24));
1.906 + aGc->DrawEllipse(TRect(b+1,h*20/24,w-1,h*23/24));
1.907 + }
1.908 +
1.909 +
1.910 +/**
1.911 + @SYMTestCaseID GRAPHICS-BITGDI-0028
1.912 +
1.913 + @SYMDEF
1.914 +
1.915 + @SYMTestCaseDesc Tests various graphic panics
1.916 +
1.917 + @SYMTestPriority High
1.918 +
1.919 + @SYMTestStatus Implemented
1.920 +
1.921 + @SYMTestActions Starts a thread that causes various graphic panics depending on the chosen option
1.922 +
1.923 + @SYMTestExpectedResults The thread should panic each time for each chosen option
1.924 +*/
1.925 +void CTAuto::TestPanics()
1.926 + {
1.927 + for (TInt opt = EFirst + 1; opt < ELast; opt++)
1.928 + {
1.929 + StartThread(opt);
1.930 + INFO_PRINTF2(_L("Panic test %d passed\r\n"),opt);
1.931 + }
1.932 + }
1.933 +
1.934 +void CTAuto::StartThread(TInt aOption)
1.935 + {
1.936 + RThread thrd;
1.937 + TRequestStatus stat;
1.938 + TBuf<256> threadNameBuf;
1.939 + _LIT(KThreadNameFormat, "ptt%d");
1.940 + threadNameBuf.Format(KThreadNameFormat, aOption);
1.941 + TInt threadCreationVal = thrd.Create(threadNameBuf,PanicTestThread,KDefaultStackSize,0x2000,0x20000,(TAny*)aOption);
1.942 + TEST(threadCreationVal==KErrNone);
1.943 + thrd.SetPriority(EPriorityMuchMore);
1.944 + thrd.Logon(stat);
1.945 + User::SetJustInTime(EFalse);
1.946 + thrd.Resume();
1.947 + User::WaitForRequest(stat);
1.948 + thrd.Close();
1.949 + User::SetJustInTime(ETrue);
1.950 + }
1.951 +
1.952 +
1.953 +/**
1.954 + @SYMTestCaseID GRAPHICS-BITGDI-0029
1.955 +
1.956 + @SYMDEF
1.957 +
1.958 + @SYMTestCaseDesc tests fading functionality
1.959 +
1.960 + @SYMTestPriority High
1.961 +
1.962 + @SYMTestStatus Implemented
1.963 +
1.964 + @SYMTestActions Tests fading functionality by drawing two rectangles with different alpha values and compares the results
1.965 +
1.966 + @SYMTestExpectedResults the two bitmaps should be identical after the operations
1.967 +*/
1.968 +void CTAuto::TestFadingL()
1.969 + {
1.970 + TBool res = EFalse;
1.971 + TRect rectbitmap1(0,0,100,50);
1.972 + TRect rectbitmap2(25,0,75,100);
1.973 +
1.974 + CFbsBitmap* bitmap=new(ELeave) CFbsBitmap;
1.975 + CleanupStack::PushL(bitmap);
1.976 + User::LeaveIfError(bitmap->Create(TSize(100,100), EColor64K));
1.977 +
1.978 + CFbsBitmapDevice* device=CFbsBitmapDevice::NewL(bitmap);
1.979 + CleanupStack::PushL(device);
1.980 +
1.981 + CFbsBitGc* gc;
1.982 + User::LeaveIfError(device->CreateContext(gc));
1.983 + CleanupStack::PushL(gc);
1.984 +
1.985 + CFbsBitmap* bitmap2=new(ELeave) CFbsBitmap;
1.986 + CleanupStack::PushL(bitmap2);
1.987 + User::LeaveIfError(bitmap2->Create(TSize(100,100), EColor64K));
1.988 +
1.989 + CFbsBitmapDevice* device2=CFbsBitmapDevice::NewL(bitmap2);
1.990 + CleanupStack::PushL(device2);
1.991 +
1.992 + CFbsBitGc* gc2;
1.993 + User::LeaveIfError(device2->CreateContext(gc2));
1.994 + CleanupStack::PushL(gc2);
1.995 +
1.996 + gc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1.997 + gc->SetPenColor(TRgb(0,0,0,0));
1.998 +
1.999 + //Draws rectangle with Alpha Value 0 when Fading is turned OFF
1.1000 + gc->SetBrushColor(TRgb(0,0,255,255));
1.1001 + gc->DrawRect(rectbitmap2);
1.1002 +
1.1003 + //Draws rectangle with Alpha Value 255 when Fading is turned OFF
1.1004 + gc->SetBrushColor(TRgb(255,0,0,0));
1.1005 + gc->DrawRect(rectbitmap1);
1.1006 +
1.1007 + gc2->SetBrushStyle(CGraphicsContext::ESolidBrush);
1.1008 + gc2->SetPenColor(TRgb(0,0,0,0));
1.1009 +
1.1010 +
1.1011 + //Draws rectangle with Alpha Value 255 when Fading is turned OFF
1.1012 + gc2->SetBrushColor(TRgb(0,0,255,255));
1.1013 + gc2->DrawRect(rectbitmap2);
1.1014 +
1.1015 + //Draws rectangle with Alpha Value 0 when Fading is turned ON
1.1016 + //Fade Option Turned ON
1.1017 + gc2->SetFaded(ETrue);
1.1018 + gc2->SetBrushColor(TRgb(255,0,0,0));
1.1019 + gc2->DrawRect(rectbitmap1);
1.1020 +
1.1021 + TRect rect(0,0,100,100);
1.1022 + res = device->RectCompare(rect,*device2,rect);
1.1023 +
1.1024 + CleanupStack::PopAndDestroy(6, bitmap);
1.1025 + TEST(res);
1.1026 + }
1.1027 +
1.1028 +TInt PanicTestThread(TAny* aOption)
1.1029 + {
1.1030 + CTrapCleanup::New();
1.1031 + RFbsSession::Connect();
1.1032 +
1.1033 + CFbsScreenDevice* screendevice=NULL;
1.1034 + CFbsBitGc* bitgc=NULL;
1.1035 + CPolygonFiller* polyfill=NULL;
1.1036 + RRegion region;
1.1037 + const TInt option = TInt(aOption);
1.1038 + TInt ret;
1.1039 +
1.1040 + switch (option)
1.1041 + {
1.1042 + case EPolygonFiller:
1.1043 + polyfill=(CPolygonFiller*)User::Alloc(sizeof(CPolygonFiller));
1.1044 + new(polyfill) CPolygonFiller;
1.1045 + break;
1.1046 + case EDrawBmp1:
1.1047 + case EDrawBmp2:
1.1048 + case EDrawBmp3:
1.1049 + case EDrawText1:
1.1050 + case EDrawText2:
1.1051 + case EDrawText3:
1.1052 + TRAP(ret,screendevice=CFbsScreenDevice::NewL(_L("scdv"),EColor256));
1.1053 + if (ret == KErrNotSupported)
1.1054 + TRAP(ret,screendevice=CFbsScreenDevice::NewL(_L("scdv"),EGray4));
1.1055 + if (ret == KErrNotSupported)
1.1056 + TRAP(ret,screendevice=CFbsScreenDevice::NewL(_L("scdv"),EColor4K));
1.1057 + if (ret != KErrNone)
1.1058 + User::Panic(_L("screendevice failed"),ret);
1.1059 + screendevice->CreateContext((CGraphicsContext*&)bitgc);
1.1060 + break;
1.1061 + case EGcDevice1:
1.1062 + case EGcDevice2:
1.1063 + case EGcRegion1:
1.1064 + case EGcRegion2:
1.1065 + case EUseBrush1:
1.1066 + case EUseBrush2:
1.1067 + case EUseBrush3:
1.1068 + case EUseFont:
1.1069 + TRAP(ret,bitgc=CFbsBitGc::NewL());
1.1070 + break;
1.1071 + };
1.1072 +
1.1073 + switch (option)
1.1074 + {
1.1075 + case EPolygonFiller:
1.1076 + polyfill->Construct(NULL,CGraphicsContext::EAlternate);
1.1077 + break;
1.1078 + case EBitmapDevice:
1.1079 + (void)CFbsBitmapDevice::NewL(NULL);
1.1080 + break;
1.1081 + case EDrawBmp1:
1.1082 + bitgc->DrawBitmap(TPoint(0,0),NULL);
1.1083 + break;
1.1084 + case EDrawBmp2:
1.1085 + bitgc->DrawBitmap(TRect(0,0,0,0),NULL);
1.1086 + break;
1.1087 + case EDrawBmp3:
1.1088 + bitgc->DrawBitmap(TRect(0,0,0,0),NULL,TRect(0,0,0,0));
1.1089 + break;
1.1090 + case EGcDevice1:
1.1091 + bitgc->Resized();
1.1092 + break;
1.1093 + case EGcDevice2:
1.1094 + bitgc->MapColors(TRect(0,0,0,0),NULL,0,EFalse);
1.1095 + break;
1.1096 + case EGcRegion1:
1.1097 + region.ForceError();
1.1098 + bitgc->SetClippingRegion(®ion);
1.1099 + break;
1.1100 + case EGcRegion2:
1.1101 + region.AddRect(TRect(-1,-1,1,1));
1.1102 + bitgc->SetClippingRegion(®ion);
1.1103 + break;
1.1104 + case EUseBrush1:
1.1105 + bitgc->UseBrushPattern(NULL);
1.1106 + break;
1.1107 + case EUseBrush2:
1.1108 + bitgc->UseBrushPattern((CFbsBitmap*)bitgc);
1.1109 + break;
1.1110 + case EUseBrush3:
1.1111 + bitgc->UseBrushPattern(0);
1.1112 + break;
1.1113 + case EUseFont:
1.1114 + bitgc->UseFont(NULL);
1.1115 + break;
1.1116 + case EDrawText1:
1.1117 + bitgc->DrawText(_L("abc"),TPoint(0,0));
1.1118 + break;
1.1119 + case EDrawText2:
1.1120 + bitgc->DrawText(_L("abc"),TRect(0,0,1,1),0,0);
1.1121 + break;
1.1122 + case EDrawText3:
1.1123 + bitgc->DrawTextVertical(_L("abc"),EFalse);
1.1124 + break;
1.1125 + default:
1.1126 + User::Panic(_L("Default panic"),KErrGeneral);
1.1127 + };
1.1128 +
1.1129 + return KErrNone;
1.1130 + }
1.1131 +//-------
1.1132 +__CONSTRUCT_STEP__(Auto)
1.1133 +
1.1134 +void CTAutoStep::TestSetupL()
1.1135 + {
1.1136 + FbsStartup();
1.1137 + User::LeaveIfError(RFbsSession::Connect());
1.1138 + }
1.1139 +
1.1140 +void CTAutoStep::TestClose()
1.1141 + {
1.1142 + RFbsSession::Disconnect();
1.1143 + }