sl@0: // Copyright (c) 2004-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: // sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include "TScdvScaling.h" sl@0: sl@0: sl@0: sl@0: //Test line properties: sl@0: //[iX, iY] - the starting point of the line sl@0: //iLength - line length sl@0: struct TLineProps sl@0: { sl@0: TInt iX; sl@0: TInt iY; sl@0: TInt iLength; sl@0: }; sl@0: // sl@0: //Constants sl@0: // sl@0: //This structure defines [TDrawMode <-> clear screen color value] relation sl@0: //When the test uses KDrawMode[i].iDrawMode, then the screen will be cleared using sl@0: //KDrawMode[i].iClearColorVal value sl@0: struct TDrawModeProps sl@0: { sl@0: CGraphicsContext::TDrawMode iDrawMode; sl@0: // keep the color value 8-bit in both EColor256 and EColor64K, special care need sl@0: // to be done when filling the buffer, e.g color=0x55 sl@0: // in EColor256 clearing means filling 0x55 0x55 0x55 etc, but sl@0: // in EColor64K it has to be 0x0055 0x0055 0x0055 etc sl@0: TUint8 iClearColorVal; sl@0: }; sl@0: const TDrawModeProps KDrawMode[] = sl@0: { sl@0: {CGraphicsContext::EDrawModePEN, 0xFF}, sl@0: {CGraphicsContext::EDrawModeAND, 0x37}, sl@0: {CGraphicsContext::EDrawModeXOR, 0x38}, sl@0: {CGraphicsContext::EDrawModeOR, 0xB1}, sl@0: {CGraphicsContext::EDrawModeNOTSCREEN, 0xC0}, sl@0: {CGraphicsContext::EDrawModeNOTPEN, 0x1D} sl@0: }; sl@0: const TInt KDrawModesCnt = sizeof(KDrawMode) / sizeof(KDrawMode[0]); sl@0: //Shadow/Fade modes sl@0: const CFbsDrawDevice::TShadowMode KShadowMode[] = sl@0: { sl@0: CFbsDrawDevice::EShadow, sl@0: CFbsDrawDevice::EFade, sl@0: CFbsDrawDevice::EShadowFade sl@0: }; sl@0: const TInt KShadowModesCnt = sizeof(KShadowMode) / sizeof(KShadowMode[0]); sl@0: //Test pixel color value sl@0: const TUint8 KTestColorVal = 0x55; sl@0: //All possible orientations sl@0: const CFbsDrawDevice::TOrientation KOrientation[] = sl@0: { sl@0: CFbsDrawDevice::EOrientationNormal, sl@0: CFbsDrawDevice::EOrientationRotated90, sl@0: CFbsDrawDevice::EOrientationRotated180, sl@0: CFbsDrawDevice::EOrientationRotated270 sl@0: }; sl@0: const TInt KOrientationsCnt = sizeof(KOrientation) / sizeof(KOrientation[0]); sl@0: //Width and Height of legacy application screen sl@0: const TInt KLegacyAppSizeWidth = 60; sl@0: const TInt KLegacyAppSizeHeight = 40; sl@0: //Scaling factors: X and Y sl@0: const TInt KScalingFactorX = 3; sl@0: const TInt KScalingFactorY = 2; sl@0: const TInt KMaxScalingFactor = 3; //Max of previous 2 values sl@0: sl@0: // sl@0: //Declarations sl@0: // sl@0: GLDEF_C TInt ByteSize(TDisplayMode aDisplayMode,TInt aWidth) sl@0: { sl@0: TInt wordSize=aWidth; sl@0: switch(aDisplayMode) sl@0: { sl@0: case EGray2: sl@0: wordSize = (wordSize + 31) / 32; sl@0: break; sl@0: case EGray4: sl@0: wordSize = (wordSize + 15) / 16; sl@0: break; sl@0: case EGray16: sl@0: case EColor16: sl@0: wordSize = (wordSize + 7) / 8; sl@0: break; sl@0: case EGray256: sl@0: case EColor256: sl@0: wordSize = (wordSize + 3) / 4; sl@0: break; sl@0: case EColor4K: sl@0: case EColor64K: sl@0: wordSize = (wordSize + 1) / 2; sl@0: break; sl@0: case EColor16M: sl@0: wordSize = ((wordSize + 3) / 4) * 3; sl@0: break; sl@0: case EColor16MU: sl@0: case EColor16MA: sl@0: //Doesn't need changing sl@0: break; sl@0: default: sl@0: break; sl@0: }; sl@0: return wordSize * 4; sl@0: } sl@0: sl@0: static inline TInt ByteSize(TDisplayMode aDisplayMode, TSize aSize) sl@0: { sl@0: return ByteSize(aDisplayMode,aSize.iWidth) * aSize.iHeight; sl@0: } sl@0: sl@0: template sl@0: inline void MemFill(TPixelType* aBuffer, TInt aSize, TPixelType aValue) sl@0: { sl@0: TPixelType* p = aBuffer; sl@0: TInt i = 0; sl@0: while (i++ class CTScaling: public CTGraphicsBase sl@0: { sl@0: public: sl@0: CTScaling(CTestStep *aTest, TDisplayMode aDisplayMode); sl@0: ~CTScaling(); sl@0: void RunTestCaseL(TInt aCurTestCase); sl@0: private: sl@0: void ConstructL(); sl@0: void CreateScreenDeviceL(); sl@0: void SetScalingSettings(const TPoint& aOrigin, TInt aFx, TInt aFy, TInt aDivX, TInt aDivY); sl@0: void CheckLine(const TLineProps& aLineProps, const TPoint& aOrg, const TDrawModeProps& aDrawModeProps, TPixelType aClearColorValue); sl@0: void CheckWriteRgbMulti(const TRect& aRcProps, const TPoint& aOrg, const TDrawModeProps& aDrawModeProps, TPixelType aClearColorValue); sl@0: void CheckRgbAlphaLine(const TLineProps& aLineProps, const TPoint& aOrg, TPixelType aClearColorValue); sl@0: void CheckRect(const TRect& aRc, const TPoint& aOrg, TPixelType aClearColorValue); sl@0: void WriteLine(); sl@0: void ClearScreen(const TDrawModeProps& aDrawModeProps); sl@0: void SetTestData(); sl@0: void CheckChangedPixels(TInt aChangedPixelsCnt, TPixelType aClearColorVal); sl@0: void CheckWriteBinary(const TPoint& aPt, const TPoint& aOrg, TPixelType aClearColorValue, TInt aLength, TInt aHeight); sl@0: void CheckVertLine(const TLineProps& aLineProps, const TPoint& aOrg, TPixelType aClearColorValue); sl@0: void WriteRgb(); sl@0: void WriteRgbMulti(); sl@0: void WriteRgbAlphaLine(); sl@0: void WriteBinary(); sl@0: void WriteBinaryLineVertical(); sl@0: void WriteBinaryLine(); sl@0: void WriteRgbAlphaMulti(); sl@0: void ShadowArea(); sl@0: void WriteRgbAlphaLine2(); sl@0: void TestScalingSettingsInterface(); sl@0: void PerformanceTest(); sl@0: private: sl@0: //Test data array sl@0: TPixelType iTestData[KLegacyAppSizeWidth]; sl@0: //The device used in the tests sl@0: CFbsDrawDevice* iDrawDevice; sl@0: //Width and Height of the screen sl@0: TSize iPhysSize; sl@0: //The test allocates block of memory for a screen with PhysSize size sl@0: //mode. iBits will point to the allocated memory block. sl@0: TPixelType* iBits; sl@0: TDisplayMode iDisplayMode; sl@0: //The scaling interface sl@0: MScalingSettings* iScalingSettings; sl@0: //The origin interface sl@0: MDrawDeviceOrigin* iOriginInterface; sl@0: TInt iCurOrientation; sl@0: TInt iScalingFactorX; sl@0: TInt iScalingFactorY; sl@0: }; sl@0: typedef CTScaling CTestNone; sl@0: typedef CTScaling CTestColor256; sl@0: typedef CTScaling CTestColor64K; sl@0: sl@0: sl@0: sl@0: // sl@0: //Test code sl@0: // sl@0: /*template sl@0: CTScaling* CTScaling::NewL(TDisplayMode aDisplayMode) sl@0: { sl@0: CTScaling* self = new (ELeave) CTScaling; sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(aDisplayMode); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: */ sl@0: sl@0: template sl@0: CTScaling::CTScaling(CTestStep *aTest, TDisplayMode aDisplayMode) : sl@0: CTGraphicsBase(aTest), sl@0: iDisplayMode(aDisplayMode) sl@0: { sl@0: INFO_PRINTF1(_L("Scaling tests")); sl@0: } sl@0: sl@0: sl@0: template sl@0: void CTScaling::ConstructL() sl@0: { sl@0: CreateScreenDeviceL(); sl@0: } sl@0: sl@0: template sl@0: CTScaling::~CTScaling() sl@0: { sl@0: ((CTScalingStep*)iStep)->CloseTMSGraphicsStep(); sl@0: delete[] iBits; sl@0: delete iDrawDevice; sl@0: } sl@0: sl@0: template sl@0: void CTScaling::SetScalingSettings(const TPoint& aOrigin, TInt aFx, TInt aFy, TInt aDivX, TInt aDivY) sl@0: { sl@0: TEST(iDrawDevice != NULL); sl@0: if(!iScalingSettings) sl@0: { sl@0: TInt err = iDrawDevice->GetInterface(KScalingSettingsInterfaceID, sl@0: reinterpret_cast (iScalingSettings)); sl@0: TEST2(err, KErrNone); sl@0: } sl@0: TEST(iScalingSettings != NULL); sl@0: TInt err = iScalingSettings->Set(aFx, aFy, aDivX, aDivY); sl@0: TEST2(err, KErrNone); sl@0: if(!iOriginInterface) sl@0: { sl@0: TInt err = iDrawDevice->GetInterface(KDrawDeviceOriginInterfaceID, sl@0: reinterpret_cast (iOriginInterface)); sl@0: TEST2(err, KErrNone); sl@0: } sl@0: TEST(iOriginInterface != NULL); sl@0: err = iOriginInterface->Set(aOrigin); sl@0: TEST2(err, KErrNone); sl@0: } sl@0: sl@0: //Clears the screen initializing each screen pixel with aDrawModeProps.iClearColorVal value sl@0: template sl@0: void CTScaling::ClearScreen(const TDrawModeProps& aDrawModeProps) sl@0: { sl@0: ::MemFill(iBits, ::ByteSize(EColor256, iPhysSize), TPixelType(aDrawModeProps.iClearColorVal)); sl@0: } sl@0: sl@0: //Initializes iTestData array with KTestColorVal value sl@0: template sl@0: void CTScaling::SetTestData() sl@0: { sl@0: ::MemFill(iTestData, KLegacyAppSizeWidth, TPixelType(KTestColorVal)); sl@0: } sl@0: sl@0: template sl@0: void CTScaling::CheckChangedPixels(TInt aChangedPixelsCnt, TPixelType aClearColorVal) sl@0: { sl@0: const TInt KByteSize = ::ByteSize(EColor256, iPhysSize); sl@0: TInt changedPixelsCnt = 0; sl@0: for(TInt ii=0;ii sl@0: void CTScaling::CheckLine(const TLineProps& aLineProps, sl@0: const TPoint& aOrg, sl@0: const TDrawModeProps& aDrawModeProps, sl@0: TPixelType aClearColorValue) sl@0: { sl@0: TPixelType data[KLegacyAppSizeWidth * KMaxScalingFactor]; sl@0: TInt ii; sl@0: for(ii=0;iiReadLine(aOrg.iX + aLineProps.iX * iScalingFactorX, sl@0: aOrg.iY + aLineProps.iY * iScalingFactorY + ii, sl@0: aLineProps.iLength * iScalingFactorX, sl@0: data, sl@0: iDisplayMode); sl@0: const TInt length=aLineProps.iLength*iScalingFactorX; sl@0: TInt firstErr=length; sl@0: TInt numErrs=0; sl@0: for(TInt jj=0;jj0) sl@0: { sl@0: _LIT(KLog,"Line %d (of %d) of length %d has %d errors first one at %d, ClearCol=0x%x"); sl@0: INFO_PRINTF7(KLog,ii,iScalingFactorY,length,numErrs,firstErr,aClearColorValue); sl@0: } sl@0: } sl@0: TInt changedPixelsCnt = iScalingFactorY * aLineProps.iLength * iScalingFactorX; sl@0: CheckChangedPixels(changedPixelsCnt, aDrawModeProps.iClearColorVal); sl@0: } sl@0: sl@0: //Checks the rectangle filled using CFbsScreenDevice::WriteRgbMulti. sl@0: //The screen lines pixel values are tested against aClearColorValue value. sl@0: //Then the screen is testsed pixel by pixel that nothing is written outside the tested rectangle. sl@0: template sl@0: void CTScaling::CheckWriteRgbMulti(const TRect& aRcProps, sl@0: const TPoint& aOrg, sl@0: const TDrawModeProps& aDrawModeProps, sl@0: TPixelType aClearColorValue) sl@0: { sl@0: TPixelType data[KLegacyAppSizeWidth * KMaxScalingFactor]; sl@0: TInt ii; sl@0: TInt xx = aOrg.iX + aRcProps.iTl.iX * iScalingFactorX; sl@0: TInt yy = aOrg.iY + aRcProps.iTl.iY * iScalingFactorY; sl@0: for(ii=0;ii<(iScalingFactorY * aRcProps.Height());++ii) sl@0: { sl@0: Mem::Fill(data, sizeof(data), 0x00); sl@0: iDrawDevice->ReadLine(xx, yy+ii, aRcProps.Width()*iScalingFactorX, data, iDisplayMode); sl@0: const TInt width=aRcProps.Width()*iScalingFactorX; sl@0: TInt firstErr=width; sl@0: TInt numErrs=0; sl@0: for(TInt jj=0;jj0) sl@0: { sl@0: _LIT(KLog,"Line %d of width %d has %d errors first one at %d, ClearCol=0x%x"); sl@0: INFO_PRINTF6(KLog,ii,width,numErrs,firstErr,aClearColorValue); sl@0: } sl@0: } sl@0: TInt changedPixelsCnt = iScalingFactorY * aRcProps.Width() * aRcProps.Height() * iScalingFactorX; sl@0: CheckChangedPixels(changedPixelsCnt, aDrawModeProps.iClearColorVal); sl@0: } sl@0: sl@0: //Checks a set of horisontal lines , which starting point is sl@0: //[aOrg.iX + aLineProps.iX * iScalingFactorX, aOrg.iY + aLineProps.iY * iScalingFactorY] sl@0: //and length is aLineProps.iLength * iScalingFactorX. For each nexh line y-coordinate sl@0: //is incremented by 1. sl@0: //The screen lines pixel values are tested against aClearColorValue value. sl@0: //Then the screen is testsed pixel by pixel that nothing is written outside the tested lines. sl@0: template sl@0: void CTScaling::CheckRgbAlphaLine(const TLineProps& aLineProps, sl@0: const TPoint& aOrg, sl@0: TPixelType aClearColorValue) sl@0: { sl@0: TPixelType data[KLegacyAppSizeWidth * KMaxScalingFactor]; sl@0: for(TInt ii=0;iiReadLine(aOrg.iX + aLineProps.iX * iScalingFactorX, sl@0: aOrg.iY + aLineProps.iY * iScalingFactorY + ii, sl@0: aLineProps.iLength * iScalingFactorX, sl@0: data, sl@0: iDisplayMode); sl@0: const TInt length=aLineProps.iLength*iScalingFactorX; sl@0: TInt firstErr=length; sl@0: TInt numErrs=0; sl@0: for(TInt jj=0;jj<(aLineProps.iLength * iScalingFactorX);++jj) sl@0: { sl@0: //TEST(data[jj]!=aClearColorValue); sl@0: if (data[jj]==aClearColorValue) sl@0: { sl@0: ++numErrs; sl@0: if (jj0) sl@0: { sl@0: _LIT(KLog,"Line %d of length %d has %d errors first one at %d, ClearCol=0x%x"); sl@0: INFO_PRINTF6(KLog,ii,length,numErrs,firstErr,aClearColorValue); sl@0: } sl@0: } sl@0: TInt changedPixelsCnt = iScalingFactorY * aLineProps.iLength * iScalingFactorX; sl@0: CheckChangedPixels(changedPixelsCnt, aClearColorValue); sl@0: } sl@0: sl@0: //Checks the rectangle filled using CFbsScreenDevice::WriteBinary. sl@0: //The screen lines pixel values are tested against aClearColorValue value. sl@0: //Then the screen is testsed pixel by pixel that nothing is written outside the tested rectangle. sl@0: template sl@0: void CTScaling::CheckWriteBinary(const TPoint& aPt, sl@0: const TPoint& aOrg, sl@0: TPixelType aClearColorValue, sl@0: TInt aLength, TInt aHeight) sl@0: { sl@0: TPixelType data[KLegacyAppSizeWidth * KMaxScalingFactor]; sl@0: TInt ii; sl@0: TInt xx = aOrg.iX + aPt.iX * iScalingFactorX; sl@0: TInt yy = aOrg.iY + aPt.iY * iScalingFactorY; sl@0: for(ii=0;ii<(iScalingFactorY * aHeight);++ii) sl@0: { sl@0: Mem::Fill(data, sizeof(data), 0x00); sl@0: iDrawDevice->ReadLine(xx, yy + ii, aLength * iScalingFactorX, data, iDisplayMode); sl@0: const TInt length=aLength*iScalingFactorX; sl@0: TInt firstErr=length; sl@0: TInt numErrs=0; sl@0: for(TInt jj=0;jj0) sl@0: { sl@0: _LIT(KLog,"Line %d of length %d has %d errors first one at %d, ClearCol=0x%x"); sl@0: INFO_PRINTF6(KLog,ii,length,numErrs,firstErr,aClearColorValue); sl@0: } sl@0: } sl@0: TInt changedPixelsCnt = iScalingFactorY * aLength * aHeight * iScalingFactorX; sl@0: CheckChangedPixels(changedPixelsCnt, aClearColorValue); sl@0: } sl@0: sl@0: //Checks a set of vertical lines , which starting point is sl@0: //[aOrg.iX + aLineProps.iX * iScalingFactorX, aOrg.iY + aLineProps.iY * iScalingFactorY] sl@0: //and length is aLineProps.iLength * iScalingFactorX. For each nexh line y-coordinate sl@0: //is incremented by 1. sl@0: //The screen lines pixel values are tested against aClearColorValue value. sl@0: //Then the screen is testsed pixel by pixel that nothing is written outside the tested lines. sl@0: template sl@0: void CTScaling::CheckVertLine(const TLineProps& aLineProps, const TPoint& aOrg, TPixelType aClearColorValue) sl@0: { sl@0: TInt x = aOrg.iX + aLineProps.iX * iScalingFactorX; sl@0: TInt y = aOrg.iY + aLineProps.iY * iScalingFactorY; sl@0: for(TInt i=0;iReadPixel(x + i, y + j); sl@0: switch (iDisplayMode) sl@0: { sl@0: case EColor64K: sl@0: TEST(val.Color64K() != aClearColorValue); sl@0: break; sl@0: sl@0: case EColor256: sl@0: TEST(val.Color256() != aClearColorValue); sl@0: break; sl@0: sl@0: default: sl@0: TEST(EFalse); sl@0: } sl@0: } sl@0: } sl@0: TInt changedPixelsCnt = iScalingFactorX * aLineProps.iLength * iScalingFactorY; sl@0: CheckChangedPixels(changedPixelsCnt, aClearColorValue); sl@0: } sl@0: sl@0: //Checks the rectangle filled using CFbsScreenDevice::ShadowArea sl@0: //The screen lines pixel values are tested against aClearColorValue value. sl@0: //Then the screen is testsed pixel by pixel that nothing is written outside the tested rectangle. sl@0: template sl@0: void CTScaling::CheckRect(const TRect& aRc, const TPoint& aOrg, TPixelType aClearColorValue) sl@0: { sl@0: TPixelType data[KLegacyAppSizeWidth * KMaxScalingFactor]; sl@0: TInt i; sl@0: TInt x = aOrg.iX + aRc.iTl.iX * iScalingFactorX; sl@0: TInt y = aOrg.iY + aRc.iTl.iY * iScalingFactorY; sl@0: for(i=0;i<(iScalingFactorY * aRc.Height());++i) sl@0: { sl@0: Mem::Fill(data, sizeof(data), 0x00); sl@0: iDrawDevice->ReadLine(x, y + i, aRc.Width() * iScalingFactorX, data, iDisplayMode); sl@0: for(TInt j=0;j<(aRc.Width() * iScalingFactorX);++j) sl@0: { sl@0: TEST(data[j] != aClearColorValue); sl@0: } sl@0: } sl@0: TInt changedPixelsCnt = iScalingFactorY * aRc.Width() * aRc.Height() * iScalingFactorX; sl@0: CheckChangedPixels(changedPixelsCnt, aClearColorValue); sl@0: } sl@0: sl@0: //CFbsScreenDevice::WriteLine() and CFbsScreenDevice::ReadLine() test. sl@0: //(Set of test lines) X (Set of origins) X (Set of drawing modes) number of test cases. sl@0: template sl@0: void CTScaling::WriteLine() sl@0: { sl@0: INFO_PRINTF1(_L("CFbsDrawDevice::WriteLine")); sl@0: sl@0: TLineProps lineProps[] = sl@0: { sl@0: {0, 0, KLegacyAppSizeWidth - 1}, sl@0: {0, KLegacyAppSizeHeight - 1, KLegacyAppSizeWidth - 1}, sl@0: {10, 20, KLegacyAppSizeWidth / 2}, sl@0: {-2, -5, 20}, sl@0: {-3, 1, 21}, sl@0: {2, -2, 11}, sl@0: {0, -4, 31}, sl@0: {-1, 11, 11} sl@0: }; sl@0: const TInt KLinesCnt = sizeof(lineProps) / sizeof(lineProps[0]); sl@0: TPoint ptOrg[] = sl@0: { sl@0: TPoint(13, 21), sl@0: TPoint(10, 17) sl@0: }; sl@0: const TInt KOriginsCnt = sizeof(ptOrg) / sizeof(ptOrg[0]); sl@0: for(TInt ll=0;llWriteLine(lineProps[line].iX, lineProps[line].iY, sl@0: lineProps[line].iLength, sl@0: reinterpret_cast (iTestData), sl@0: KDrawMode[kk].iDrawMode); sl@0: if(KDrawMode[kk].iDrawMode == CGraphicsContext::EDrawModePEN) sl@0: { sl@0: TPixelType writtenData[KLegacyAppSizeWidth]; sl@0: Mem::FillZ(writtenData, sizeof(writtenData)); sl@0: iDrawDevice->ReadLine(lineProps[line].iX, lineProps[line].iY, sl@0: lineProps[line].iLength, sl@0: writtenData, iDisplayMode); sl@0: for(TInt ii=0;ii sl@0: void CTScaling::WriteRgb() sl@0: { sl@0: INFO_PRINTF1(_L("CFbsDrawDevice::WriteRgb")); sl@0: sl@0: TPoint pt[] = sl@0: { sl@0: TPoint(0, 0), sl@0: TPoint(KLegacyAppSizeWidth - 1, 0), sl@0: TPoint(0, KLegacyAppSizeHeight - 1), sl@0: TPoint(KLegacyAppSizeWidth - 1, KLegacyAppSizeHeight - 1), sl@0: TPoint(KLegacyAppSizeWidth / 2, KLegacyAppSizeHeight / 2), sl@0: TPoint(-2, -3), sl@0: TPoint(0, -1), sl@0: TPoint(-3, 0) sl@0: }; sl@0: const TInt KPointsCnt = sizeof(pt) / sizeof(pt[0]); sl@0: TPoint ptOrg[] = sl@0: { sl@0: TPoint(9, 22), sl@0: TPoint(17, 11) sl@0: }; sl@0: const TInt KOriginsCnt = sizeof(ptOrg) / sizeof(ptOrg[0]); sl@0: for(TInt l=0;lWriteRgb(pt[i].iX, pt[i].iY, val, KDrawMode[k].iDrawMode); sl@0: if(KDrawMode[k].iDrawMode == CGraphicsContext::EDrawModePEN) sl@0: { sl@0: TRgb writtenVal = iDrawDevice->ReadPixel(pt[i].iX, pt[i].iY); sl@0: switch (iDisplayMode) sl@0: { sl@0: case EColor64K: sl@0: TEST(writtenVal == TRgb::Color64K(val.Color64K())); sl@0: break; sl@0: sl@0: case EColor256: sl@0: TEST(writtenVal == val); sl@0: break; sl@0: sl@0: default: sl@0: TEST(EFalse); sl@0: } sl@0: } sl@0: SetScalingSettings(TPoint(0, 0), 1, 1, 1, 1); sl@0: TLineProps props; sl@0: props.iX = pt[i].iX; sl@0: props.iY = pt[i].iY; sl@0: props.iLength = 1; sl@0: CheckLine(props, ptOrg[l], KDrawMode[k], KDrawMode[k].iClearColorVal); sl@0: } sl@0: } sl@0: } sl@0: } sl@0: sl@0: //CFbsScreenDevice::WriteRgbMulti() test. sl@0: template sl@0: void CTScaling::WriteRgbMulti() sl@0: { sl@0: INFO_PRINTF1(_L("CFbsDrawDevice::WriteRgbMulti")); sl@0: sl@0: TRect rcProps[] = sl@0: { sl@0: TRect(TPoint(0, 0), TSize(KLegacyAppSizeWidth - 1, KLegacyAppSizeHeight - 1)), sl@0: TRect(TPoint(17, 11), TSize(KLegacyAppSizeWidth / 2, KLegacyAppSizeHeight / 2)), sl@0: TRect(TPoint(-1, -4), TSize(31, 12)), sl@0: TRect(TPoint(-3, -1), TSize(11, 11)), sl@0: TRect(TPoint(0, -2), TSize(6, 17)) sl@0: }; sl@0: const TInt KRcCnt = sizeof(rcProps) / sizeof(rcProps[0]); sl@0: TPoint ptOrg[] = sl@0: { sl@0: TPoint(21, 29), sl@0: TPoint(12, 14) sl@0: }; sl@0: const TInt KOriginsCnt = sizeof(ptOrg) / sizeof(ptOrg[0]); sl@0: for(TInt l=0;lWriteRgbMulti(rcProps[i].iTl.iX, rcProps[i].iTl.iY, sl@0: rcProps[i].Width(), rcProps[i].Height(), sl@0: val, sl@0: KDrawMode[k].iDrawMode); sl@0: SetScalingSettings(TPoint(0, 0), 1, 1, 1, 1); sl@0: CheckWriteRgbMulti(rcProps[i], ptOrg[l], KDrawMode[k], KDrawMode[k].iClearColorVal); sl@0: } sl@0: } sl@0: } sl@0: } sl@0: sl@0: //CFbsScreenDevice::WriteRgbAlphaLine() test. sl@0: //(Set of test lines) X (Set of origins) X (Set of drawing modes) number of test cases. sl@0: template sl@0: void CTScaling::WriteRgbAlphaLine() sl@0: { sl@0: INFO_PRINTF1(_L("CFbsDrawDevice::WriteRgbAlphaLine")); sl@0: sl@0: TLineProps lineProps[] = sl@0: { sl@0: {0, 0, KLegacyAppSizeWidth - 1}, sl@0: {0, KLegacyAppSizeHeight - 1, KLegacyAppSizeWidth - 1}, sl@0: {17, 3, KLegacyAppSizeWidth / 2}, sl@0: {-1, -2, 11}, sl@0: {-4, -5, 1}, sl@0: {0, -1, 3}, sl@0: {1, -3, 7} sl@0: }; sl@0: const TInt KLinesCnt = sizeof(lineProps) / sizeof(lineProps[0]); sl@0: TPoint ptOrg[] = sl@0: { sl@0: TPoint(19, 17), sl@0: TPoint(29, 25) sl@0: }; sl@0: const TInt KOriginsCnt = sizeof(ptOrg) / sizeof(ptOrg[0]); sl@0: for(TInt l=0;lWriteRgbAlphaLine(lineProps[i].iX, lineProps[i].iY, sl@0: lineProps[i].iLength, rgbBuff, maskBuff, CGraphicsContext::EDrawModePEN); sl@0: SetScalingSettings(TPoint(0, 0), 1, 1, 1, 1); sl@0: CheckRgbAlphaLine(lineProps[i], ptOrg[l], KDrawMode[k].iClearColorVal); sl@0: } sl@0: } sl@0: } sl@0: } sl@0: sl@0: //CFbsScreenDevice::WriteBinary() test. sl@0: template sl@0: void CTScaling::WriteBinary() sl@0: { sl@0: INFO_PRINTF1(_L("CFbsDrawDevice::WriteBinary")); sl@0: sl@0: TPoint pt[] = sl@0: { sl@0: TPoint(0, 0), sl@0: TPoint(27, 19), sl@0: TPoint(-4, -4), sl@0: TPoint(-1, -2), sl@0: TPoint(-1, -2), sl@0: TPoint(5, -5), sl@0: TPoint(-5, 0) sl@0: }; sl@0: const TInt KPtCnt = sizeof(pt) / sizeof(pt[0]); sl@0: TPoint ptOrg[] = sl@0: { sl@0: TPoint(19, 24), sl@0: TPoint(29, 26) sl@0: }; sl@0: const TInt KOriginsCnt = sizeof(ptOrg) / sizeof(ptOrg[0]); sl@0: for(TInt l=0;lWriteBinary(pt[i].iX, pt[i].iY, buff, KLength, KHeight, sl@0: val, KDrawMode[k].iDrawMode); sl@0: SetScalingSettings(TPoint(0, 0), 1, 1, 1, 1); sl@0: CheckWriteBinary(pt[i], ptOrg[l], KDrawMode[k].iClearColorVal, KLength, KHeight); sl@0: } sl@0: } sl@0: } sl@0: } sl@0: sl@0: //CFbsScreenDevice::WriteBinaryLineVertical() test. sl@0: template sl@0: void CTScaling::WriteBinaryLineVertical() sl@0: { sl@0: INFO_PRINTF1(_L("CFbsDrawDevice::WriteBinaryLineVertical")); sl@0: sl@0: TLineProps lineProps[] = sl@0: { sl@0: {0, 0, KLegacyAppSizeHeight - 1}, sl@0: {KLegacyAppSizeWidth - 1, 0, KLegacyAppSizeHeight - 1}, sl@0: {17, 3, 23}, sl@0: {-2, -5, 10}, sl@0: {-6, 24, 11}, sl@0: {18, -6, 12}, sl@0: {0, -3, 13}, sl@0: {-1, 0, 14} sl@0: }; sl@0: const TInt KLinesCnt = sizeof(lineProps) / sizeof(lineProps[0]); sl@0: TPoint ptOrg[] = sl@0: { sl@0: TPoint(22, 22), sl@0: TPoint(19, 20) sl@0: }; sl@0: const TInt KOriginsCnt = sizeof(ptOrg) / sizeof(ptOrg[0]); sl@0: for(TInt l=0;lWriteBinaryLineVertical(lineProps[i].iX, lineProps[i].iY, sl@0: buff, lineProps[i].iLength, val, sl@0: KDrawMode[k].iDrawMode, EFalse); sl@0: SetScalingSettings(TPoint(0, 0), 1, 1, 1, 1); sl@0: CheckVertLine(lineProps[i], ptOrg[l], KDrawMode[k].iClearColorVal); sl@0: } sl@0: } sl@0: } sl@0: } sl@0: sl@0: //CFbsScreenDevice::WriteBinaryLine() test. sl@0: template sl@0: void CTScaling::WriteBinaryLine() sl@0: { sl@0: INFO_PRINTF1(_L("CFbsDrawDevice::WriteBinaryLiine")); sl@0: sl@0: TPoint pt[] = sl@0: { sl@0: TPoint(0, 0), sl@0: TPoint(1, 7), sl@0: TPoint(18, -8), sl@0: TPoint(-7, 26), sl@0: TPoint(-4, -7), sl@0: TPoint(0, -2), sl@0: TPoint(34, -1), sl@0: TPoint(-1, 17) sl@0: }; sl@0: const TInt KPtCnt = sizeof(pt) / sizeof(pt[0]); sl@0: TPoint ptOrg[] = sl@0: { sl@0: TPoint(21, 35), sl@0: TPoint(40, 28) sl@0: }; sl@0: const TInt KOriginsCnt = sizeof(ptOrg) / sizeof(ptOrg[0]); sl@0: for(TInt l=0;lWriteBinaryLine(pt[i].iX, pt[i].iY, buff, KLength, sl@0: val, KDrawMode[k].iDrawMode); sl@0: SetScalingSettings(TPoint(0, 0), 1, 1, 1, 1); sl@0: CheckWriteBinary(pt[i], ptOrg[l], KDrawMode[k].iClearColorVal, KLength, KHeight); sl@0: } sl@0: } sl@0: } sl@0: } sl@0: sl@0: //CFbsScreenDevice::WriteRgbAlphaMulti() test. sl@0: template sl@0: void CTScaling::WriteRgbAlphaMulti() sl@0: { sl@0: INFO_PRINTF1(_L("CFbsDrawDevice::WriteRgbAlphaMulti")); sl@0: sl@0: TLineProps lineProps[] = sl@0: { sl@0: {0, 0, KLegacyAppSizeWidth - 1}, sl@0: {0, KLegacyAppSizeHeight - 1, KLegacyAppSizeWidth - 1}, sl@0: {17, 3, KLegacyAppSizeWidth / 2}, sl@0: {-8, -8, 11}, sl@0: {-3, 15, 12}, sl@0: {29, -4, 13}, sl@0: {0, -3, 14}, sl@0: {-5, 0, 15} sl@0: }; sl@0: const TInt KLinesCnt = sizeof(lineProps) / sizeof(lineProps[0]); sl@0: TPoint ptOrg[] = sl@0: { sl@0: TPoint(24, 17), sl@0: TPoint(27, 20) sl@0: }; sl@0: const TInt KOriginsCnt = sizeof(ptOrg) / sizeof(ptOrg[0]); sl@0: for(TInt l=0;lWriteRgbAlphaMulti(lineProps[i].iX, lineProps[i].iY, sl@0: lineProps[i].iLength, val, maskBuff); sl@0: SetScalingSettings(TPoint(0, 0), 1, 1, 1, 1); sl@0: CheckRgbAlphaLine(lineProps[i], ptOrg[l], KDrawMode[k].iClearColorVal); sl@0: } sl@0: } sl@0: } sl@0: } sl@0: sl@0: //CFbsScreenDevice::ShadowArea() test. sl@0: template sl@0: void CTScaling::ShadowArea() sl@0: { sl@0: INFO_PRINTF1(_L("CFbsDrawDevice::ShadowArea")); sl@0: sl@0: TRect rcProps[] = sl@0: { sl@0: TRect(TPoint(0, 0), TSize(KLegacyAppSizeWidth - 1, KLegacyAppSizeHeight - 1)), sl@0: TRect(TPoint(17, 11), TSize(KLegacyAppSizeWidth / 2, KLegacyAppSizeHeight / 2)), sl@0: TRect(TPoint(-1, -1), TSize(1, 1)), sl@0: TRect(TPoint(-4, -5), TSize(11, 8)), sl@0: TRect(TPoint(0, -6), TSize(3, 23)), sl@0: TRect(TPoint(-7, 0), TSize(24, 2)), sl@0: TRect(TPoint(5, -2), TSize(8, 9)), sl@0: TRect(TPoint(-4, 16), TSize(11, 8)) sl@0: }; sl@0: const TInt KRcCnt = sizeof(rcProps) / sizeof(rcProps[0]); sl@0: TPoint ptOrg[] = sl@0: { sl@0: TPoint(25, 24), sl@0: TPoint(31, 29) sl@0: }; sl@0: const TInt KOriginsCnt = sizeof(ptOrg) / sizeof(ptOrg[0]); sl@0: for(TInt l=0;lSetShadowMode(KShadowMode[m]); sl@0: ClearScreen(drawModeProps); sl@0: SetTestData(); sl@0: SetScalingSettings(ptOrg[l], KScalingFactorX, KScalingFactorY, 1, 1); sl@0: iDrawDevice->ShadowArea(rcProps[i]); sl@0: SetScalingSettings(TPoint(0, 0), 1, 1, 1, 1); sl@0: CheckRect(rcProps[i], ptOrg[l], drawModeProps.iClearColorVal); sl@0: } sl@0: } sl@0: } sl@0: } sl@0: iDrawDevice->SetShadowMode(CFbsDrawDevice::ENoShadow); sl@0: } sl@0: sl@0: //CFbsScreenDevice::WriteRgbAlphaLine() test. sl@0: template sl@0: void CTScaling::WriteRgbAlphaLine2() sl@0: { sl@0: INFO_PRINTF1(_L("CFbsDrawDevice::WriteRgbAlphaLine-2")); sl@0: sl@0: TLineProps lineProps[] = sl@0: { sl@0: {0, 0, KLegacyAppSizeWidth - 1}, sl@0: {0, KLegacyAppSizeHeight - 1, KLegacyAppSizeWidth - 1}, sl@0: {17, 3, KLegacyAppSizeWidth / 2}, sl@0: {-1, -7, 11}, sl@0: {0, -5, 12}, sl@0: {-3, 0, 13}, sl@0: {15, -7, 14}, sl@0: {-1, -7, 15}, sl@0: {-1, -7, 16} sl@0: }; sl@0: const TInt KLinesCnt = sizeof(lineProps) / sizeof(lineProps[0]); sl@0: TPoint ptOrg[] = sl@0: { sl@0: TPoint(18, 28), sl@0: TPoint(15, 15) sl@0: }; sl@0: const TInt KOriginsCnt = sizeof(ptOrg) / sizeof(ptOrg[0]); sl@0: for(TInt l=0;lWriteRgbAlphaLine(lineProps[i].iX, lineProps[i].iY, sl@0: lineProps[i].iLength, rgbBuff1, rgbBuff2, maskBuff, sl@0: KDrawMode[k].iDrawMode); sl@0: SetScalingSettings(TPoint(0, 0), 1, 1, 1, 1); sl@0: CheckRgbAlphaLine(lineProps[i], ptOrg[l], KDrawMode[k].iClearColorVal); sl@0: } sl@0: } sl@0: } sl@0: } sl@0: sl@0: template sl@0: void CTScaling::TestScalingSettingsInterface() sl@0: { sl@0: INFO_PRINTF1(_L("MScalingSettings functionality test")); sl@0: TEST(iDrawDevice != NULL); sl@0: sl@0: MScalingSettings* scalingSettings = NULL; sl@0: TInt err = iDrawDevice->GetInterface(KScalingSettingsInterfaceID, sl@0: reinterpret_cast (scalingSettings)); sl@0: TEST2(err, KErrNone); sl@0: TEST(scalingSettings != NULL); sl@0: sl@0: TEST(scalingSettings->IsScalingOff()); sl@0: sl@0: const TInt factorXIn = 10, factorYIn = 13, divisorXIn = 1, divisorYIn = 1; sl@0: TInt factorXOut = -1, factorYOut = -1, divisorXOut = -1, divisorYOut = -1; sl@0: sl@0: err = scalingSettings->Set(factorXIn, factorYIn, divisorXIn, divisorYIn); sl@0: TEST2(err, KErrNone); sl@0: TEST(!scalingSettings->IsScalingOff()); sl@0: scalingSettings->Get(factorXOut, factorYOut, divisorXOut, divisorYOut); sl@0: sl@0: TEST(factorXOut == factorXOut); sl@0: TEST(factorYIn == factorYOut); sl@0: TEST(divisorXIn == divisorXOut); sl@0: TEST(divisorYIn == divisorYOut); sl@0: sl@0: MDrawDeviceOrigin* originInterface = NULL; sl@0: err = iDrawDevice->GetInterface(KDrawDeviceOriginInterfaceID, sl@0: reinterpret_cast (originInterface)); sl@0: TEST2(err, KErrNone); sl@0: TEST(originInterface != NULL); sl@0: sl@0: const TPoint ptOriginIn(20, 45); sl@0: TPoint ptOriginOut; sl@0: err = originInterface->Set(ptOriginIn); sl@0: TEST2(err, KErrNone); sl@0: originInterface->Get(ptOriginOut); sl@0: TEST(ptOriginIn == ptOriginOut); sl@0: sl@0: SetScalingSettings(TPoint(0, 0), 1, 1, 1, 1); sl@0: } sl@0: sl@0: //Creates screen device and initializes ::DrawDevice global variable. sl@0: template sl@0: void CTScaling::CreateScreenDeviceL() sl@0: { sl@0: if (iDisplayMode == ENone) sl@0: return; sl@0: sl@0: TInt address = NULL; sl@0: User::LeaveIfError(HAL::Get(KDefaultScreenNo, HALData::EDisplayMemoryAddress,address)); sl@0: User::LeaveIfError(HAL::Get(KDefaultScreenNo, HALData::EDisplayXPixels, iPhysSize.iWidth)); sl@0: User::LeaveIfError(HAL::Get(KDefaultScreenNo, HALData::EDisplayYPixels, iPhysSize.iHeight)); sl@0: __ASSERT_DEBUG(iPhysSize.iWidth > 0 && iPhysSize.iHeight > 0 && address != NULL, User::Invariant()); sl@0: sl@0: TPckgBuf info; sl@0: info().iScreenAddressValid = ETrue; sl@0: info().iScreenAddress = reinterpret_cast (address); sl@0: info().iScreenSize = iPhysSize; sl@0: sl@0: iDrawDevice = CFbsDrawDevice::NewScreenDeviceL(info(), iDisplayMode); sl@0: TestScalingSettingsInterface(); sl@0: iBits = new (ELeave) TPixelType[::ByteSize(EColor256, iPhysSize)]; sl@0: iDrawDevice->SetUserDisplayMode(iDisplayMode); sl@0: iDrawDevice->SetAutoUpdate(EFalse); sl@0: iDrawDevice->SetBits(iBits); sl@0: sl@0: sl@0: } sl@0: sl@0: template sl@0: void CTScaling::PerformanceTest() sl@0: { sl@0: INFO_PRINTF1(_L("CFbsDrawDevice, scaling - WriteRgb() performance test")); sl@0: sl@0: const TInt KDrawingsCnt = 1000000; sl@0: TInt i, x, y; sl@0: sl@0: TUint time1 = User::TickCount(); sl@0: x = y = 0; sl@0: for(i=0;i 50) sl@0: { sl@0: x = 0; sl@0: if(++y > 50) sl@0: { sl@0: y = 0; sl@0: } sl@0: } sl@0: TRgb val(0x11, 0x12, i); sl@0: iDrawDevice->WriteRgb(x, y, val, CGraphicsContext::EDrawModePEN); sl@0: } sl@0: time1 = User::TickCount() - time1; sl@0: sl@0: TPoint ptOrigin(5, 3); sl@0: SetScalingSettings(ptOrigin, KScalingFactorX, KScalingFactorY, 1, 1); sl@0: sl@0: TUint time2 = User::TickCount(); sl@0: x = y = 0; sl@0: for(i=0;i 50) sl@0: { sl@0: x = 0; sl@0: if(++y > 50) sl@0: { sl@0: y = 0; sl@0: } sl@0: } sl@0: TRgb val(0x11, 0x12, i); sl@0: iDrawDevice->WriteRgb(x, y, val, CGraphicsContext::EDrawModePEN); sl@0: } sl@0: time2 = User::TickCount() - time2; sl@0: sl@0: SetScalingSettings(TPoint(0, 0), 1, 1, 1, 1); sl@0: sl@0: RDebug::Print(_L("Non-scaled device, time=%d\r\n"), time1); sl@0: RDebug::Print(_L("Scaled device, time=%d\r\n"), time2); sl@0: } sl@0: sl@0: template sl@0: void CTScaling::RunTestCaseL(TInt aCurTestCase) sl@0: { sl@0: // EColor64K and EColor256 is not supported, stop the test sl@0: if (iDisplayMode == ENone) sl@0: { sl@0: INFO_PRINTF1(_L("EColor64K and EColor256 are not supported, The test is not run")); sl@0: TestComplete(); sl@0: } sl@0: sl@0: else sl@0: { sl@0: ((CTScalingStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName); sl@0: switch(aCurTestCase) sl@0: { sl@0: case 1: sl@0: { sl@0: if(iCurOrientation >= KOrientationsCnt) sl@0: { sl@0: ((CTScalingStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); sl@0: TestComplete(); sl@0: } sl@0: else sl@0: { sl@0: ((CTScalingStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); sl@0: if (iCurOrientation==CFbsDrawDevice::EOrientationRotated90 || iCurOrientation==CFbsDrawDevice::EOrientationRotated270) sl@0: { sl@0: iScalingFactorX=KScalingFactorY; sl@0: iScalingFactorY=KScalingFactorX; sl@0: } sl@0: else sl@0: { sl@0: iScalingFactorX=KScalingFactorX; sl@0: iScalingFactorY=KScalingFactorY; sl@0: } sl@0: INFO_PRINTF3(_L("Set scalling %d,%d"),iScalingFactorX,iScalingFactorY); sl@0: if(iDrawDevice->SetOrientation(KOrientation[iCurOrientation])) sl@0: { sl@0: INFO_PRINTF2(_L("Set orientation: ===EOrientation%S==="),&RotationName(iCurOrientation)); sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF2(_L("Failed to set orientation: ===EOrientation%S==="),&RotationName(iCurOrientation)); sl@0: ResetCounter(); sl@0: } sl@0: iCurOrientation++; sl@0: } sl@0: } sl@0: break; sl@0: case 2: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-SCREENDRIVER-0022 sl@0: */ sl@0: ((CTScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-SCREENDRIVER-0022")); sl@0: WriteLine(); sl@0: break; sl@0: case 3: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-SCREENDRIVER-0023 sl@0: */ sl@0: ((CTScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-SCREENDRIVER-0023")); sl@0: WriteRgb(); sl@0: break; sl@0: case 4: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-SCREENDRIVER-0024 sl@0: */ sl@0: ((CTScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-SCREENDRIVER-0024")); sl@0: WriteRgbMulti(); sl@0: break; sl@0: case 5: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-SCREENDRIVER-0025 sl@0: */ sl@0: ((CTScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-SCREENDRIVER-0025")); sl@0: WriteRgbAlphaLine(); sl@0: break; sl@0: case 6: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-SCREENDRIVER-0026 sl@0: */ sl@0: ((CTScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-SCREENDRIVER-0026")); sl@0: WriteBinary(); sl@0: break; sl@0: case 7: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-SCREENDRIVER-0027 sl@0: */ sl@0: ((CTScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-SCREENDRIVER-0027")); sl@0: WriteBinaryLineVertical(); sl@0: break; sl@0: case 8: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-SCREENDRIVER-0028 sl@0: */ sl@0: ((CTScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-SCREENDRIVER-0028")); sl@0: WriteBinaryLine(); sl@0: break; sl@0: case 9: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-SCREENDRIVER-0029 sl@0: */ sl@0: ((CTScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-SCREENDRIVER-0029")); sl@0: WriteRgbAlphaMulti(); sl@0: break; sl@0: case 10: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-SCREENDRIVER-0030 sl@0: */ sl@0: ((CTScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-SCREENDRIVER-0030")); sl@0: ShadowArea(); sl@0: break; sl@0: case 11: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-SCREENDRIVER-0031 sl@0: */ sl@0: ((CTScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-SCREENDRIVER-0031")); sl@0: WriteRgbAlphaLine2(); sl@0: break; sl@0: case 12: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-SCREENDRIVER-0032 sl@0: */ sl@0: ((CTScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-SCREENDRIVER-0032")); sl@0: PerformanceTest(); sl@0: break; sl@0: case 13: sl@0: ((CTScalingStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); sl@0: ResetCounter(); sl@0: break; sl@0: } sl@0: ((CTScalingStep*)iStep)->RecordTestResultL(); sl@0: } sl@0: } sl@0: sl@0: static TDisplayMode GetDisplayModeL() sl@0: { sl@0: TDisplayMode mode = EColor64K; sl@0: CFbsDrawDevice* device = NULL; sl@0: TRAPD(err, device = CFbsDrawDevice::NewScreenDeviceL(KDefaultScreenNo, mode)); sl@0: if (err!=KErrNone) sl@0: { sl@0: mode = EColor256; sl@0: TRAPD(err, device = CFbsDrawDevice::NewScreenDeviceL(KDefaultScreenNo, mode)); sl@0: sl@0: if (err == KErrNotSupported) sl@0: { sl@0: return ENone; sl@0: } sl@0: } sl@0: delete device; sl@0: return mode; sl@0: } sl@0: sl@0: //--------------- sl@0: CTScalingStep::CTScalingStep() sl@0: { sl@0: SetTestStepName(KTScalingStep); sl@0: } sl@0: sl@0: CTGraphicsBase* CTScalingStep::CreateTestL() sl@0: { sl@0: CTGraphicsBase* theTest = NULL; sl@0: switch (GetDisplayModeL()) sl@0: { sl@0: case EColor64K: sl@0: { sl@0: INFO_PRINTF1(_L("Scaling - EColor64K")); sl@0: theTest = new (ELeave) CTestColor64K(this, EColor64K); sl@0: } sl@0: break; sl@0: sl@0: case EColor256: sl@0: { sl@0: INFO_PRINTF1(_L("Scaling - EColor256")); sl@0: theTest = new (ELeave) CTestColor256(this, EColor256); sl@0: } sl@0: break; sl@0: sl@0: default: sl@0: INFO_PRINTF1(_L("EColor64K and EColor256 are not supported")); sl@0: theTest = new (ELeave) CTestNone(this, ENone); sl@0: } sl@0: return theTest; sl@0: } sl@0: sl@0: void CTScalingStep::TestSetupL() sl@0: { sl@0: TInt temp = 0; sl@0: HAL::Get(KDefaultScreenNo, HALData::EDisplayColors, temp);//force HAL memory allocation sl@0: sl@0: }