109 _LIT(KTest2,"SubTest %d: DEF039331"); |
108 _LIT(KTest2,"SubTest %d: DEF039331"); |
110 _LIT(KTest3,"SubTest %d: DEF039650"); |
109 _LIT(KTest3,"SubTest %d: DEF039650"); |
111 _LIT(KTest4,"SubTest %d: CFbsBitmap::GetPixel() performance"); |
110 _LIT(KTest4,"SubTest %d: CFbsBitmap::GetPixel() performance"); |
112 _LIT(KTest5,"SubTest %d: Rotate/Move text"); |
111 _LIT(KTest5,"SubTest %d: Rotate/Move text"); |
113 _LIT(KTest6,"SubTest %d: SwapWidthAndHeight"); |
112 _LIT(KTest6,"SubTest %d: SwapWidthAndHeight"); |
114 _LIT(KTest7,"SubTest %d: Create multiple screens"); |
|
115 _LIT(KTest8,"SubTest %d: Clear with non-zero origin"); |
113 _LIT(KTest8,"SubTest %d: Clear with non-zero origin"); |
116 _LIT(KTest9,"SubTest %d: DEF115395: DrawBitmap & DrawBitmapMasked with a sourceRect out of the Bitmap bounds"); |
114 _LIT(KTest9,"SubTest %d: DEF115395: DrawBitmap & DrawBitmapMasked with a sourceRect out of the Bitmap bounds"); |
117 _LIT(KTest10,"SubTest %d: INC119063: General test CopyRect rewrite for low color depth (8,4,2, pixels per byte)"); |
115 _LIT(KTest10,"SubTest %d: INC119063: General test CopyRect rewrite for low color depth (8,4,2, pixels per byte)"); |
118 _LIT(KTest11,"SubTest %d: INC120917: Dirty Mask Bitmap not remapped in BitBltMasked"); |
116 _LIT(KTest11,"SubTest %d: INC120917: Dirty Mask Bitmap not remapped in BitBltMasked"); |
119 _LIT(KTest12,"SubTest %d: Zero-sized brush pattern bitmaps"); |
117 _LIT(KTest12,"SubTest %d: Zero-sized brush pattern bitmaps"); |
153 ((CTDefect2Step*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0071")); |
151 ((CTDefect2Step*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0071")); |
154 INFO_PRINTF2(KTest6,aCurTestCase); |
152 INFO_PRINTF2(KTest6,aCurTestCase); |
155 SwapWidthAndHeightL(); |
153 SwapWidthAndHeightL(); |
156 break; |
154 break; |
157 case 7: |
155 case 7: |
158 ((CTDefect2Step*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0072")); |
156 // Test case moved to tmultiscreens.cpp |
159 INFO_PRINTF2(KTest7,aCurTestCase); |
|
160 CreateScreenDeviceL(); |
|
161 break; |
157 break; |
162 case 8: |
158 case 8: |
163 ((CTDefect2Step*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0073")); |
159 ((CTDefect2Step*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0073")); |
164 INFO_PRINTF2(KTest8,aCurTestCase); |
160 INFO_PRINTF2(KTest8,aCurTestCase); |
165 NonZeroOriginClearL(); |
161 NonZeroOriginClearL(); |
2068 TInt err = iBmpDevice->SwapWidthAndHeight(); |
2064 TInt err = iBmpDevice->SwapWidthAndHeight(); |
2069 TEST(err == KErrNone); |
2065 TEST(err == KErrNone); |
2070 }//end of - for(TInt ii=0;ii<TInt(sizeof(testMode)/sizeof(testMode[0]));ii++) |
2066 }//end of - for(TInt ii=0;ii<TInt(sizeof(testMode)/sizeof(testMode[0]));ii++) |
2071 } |
2067 } |
2072 |
2068 |
2073 /** |
|
2074 @SYMTestCaseID GRAPHICS-BITGDI-0072 |
|
2075 |
|
2076 @SYMDEF |
|
2077 |
|
2078 @SYMTestCaseDesc Multiple screen test |
|
2079 |
|
2080 @SYMTestPriority High |
|
2081 |
|
2082 @SYMTestStatus Implemented |
|
2083 |
|
2084 @SYMTestActions creates some screens in different modes then writes some rotated text to them and test. |
|
2085 |
|
2086 @SYMTestExpectedResults Test should perform graphics operations succesfully. |
|
2087 */ |
|
2088 void CTDefect2::CreateScreenDeviceL() |
|
2089 { |
|
2090 TDisplayMode testMode[] = {EColor4K, EColor64K, EColor16M, EColor16MU, EColor256, EColor16MA, EColor16MAP};//tested display modes |
|
2091 for(TInt ii=0;ii<TInt(sizeof(testMode)/sizeof(testMode[0]));ii++) |
|
2092 { |
|
2093 TInt screenCnt = 0; |
|
2094 TEST(HAL::Get(0, HALData::EDisplayNumberOfScreens, screenCnt) == KErrNone); |
|
2095 for(TInt screenNo=0;screenNo<screenCnt;++screenNo) |
|
2096 { |
|
2097 TInt err = CreateScrDevAndContext(screenNo, testMode[ii]); |
|
2098 if(err == KErrNone) |
|
2099 { |
|
2100 DoRotateMoveTextL(); |
|
2101 } |
|
2102 DeleteGraphicsContext(); |
|
2103 DeleteScreenDevice(); |
|
2104 } |
|
2105 } |
|
2106 } |
|
2107 |
2069 |
2108 void CTDefect2::CreateScrDevAndContextL() |
2070 void CTDefect2::CreateScrDevAndContextL() |
2109 { |
2071 { |
2110 DeleteGraphicsContext(); |
2072 DeleteGraphicsContext(); |
2111 DeleteScreenDevice(); |
2073 DeleteScreenDevice(); |
2123 TInt CTDefect2::CreateScrDevAndContext(TInt aScreenNo, TDisplayMode aDisplayMode) |
2085 TInt CTDefect2::CreateScrDevAndContext(TInt aScreenNo, TDisplayMode aDisplayMode) |
2124 { |
2086 { |
2125 DeleteGraphicsContext(); |
2087 DeleteGraphicsContext(); |
2126 DeleteScreenDevice(); |
2088 DeleteScreenDevice(); |
2127 TRAPD(err, iScrDev = CFbsScreenDevice::NewL(aScreenNo, aDisplayMode)); |
2089 TRAPD(err, iScrDev = CFbsScreenDevice::NewL(aScreenNo, aDisplayMode)); |
2128 if(err == KErrNotSupported) |
2090 if ( !iScrDev ) |
2129 { |
2091 { |
|
2092 TESTE( err == KErrNotSupported, err ); |
2130 return err; |
2093 return err; |
2131 } |
2094 } |
2132 TEST(err == KErrNone); |
2095 TEST(err == KErrNone); |
2133 TEST(iScrDev->ScreenNo() == aScreenNo); |
2096 TEST(iScrDev->ScreenNo() == aScreenNo); |
2134 err = iScrDev->CreateContext((CGraphicsContext*&)iGc); |
2097 err = iScrDev->CreateContext((CGraphicsContext*&)iGc); |
|
2098 if ( !iGc ) |
|
2099 { |
|
2100 return err; |
|
2101 } |
2135 TEST(err == KErrNone); |
2102 TEST(err == KErrNone); |
2136 iGc->SetUserDisplayMode(aDisplayMode); |
2103 iGc->SetUserDisplayMode(aDisplayMode); |
2137 iScrDev->ChangeScreenDevice(NULL); |
2104 iScrDev->ChangeScreenDevice(NULL); |
2138 iScrDev->SetAutoUpdate(EFalse); |
2105 iScrDev->SetAutoUpdate(EFalse); |
2139 iSize = iScrDev->SizeInPixels(); |
2106 iSize = iScrDev->SizeInPixels(); |
2406 const TReal32 KTolerance=0.10; // Percent difference permitted |
2373 const TReal32 KTolerance=0.10; // Percent difference permitted |
2407 TInt cFbsScreenDeviceResult = 1; |
2374 TInt cFbsScreenDeviceResult = 1; |
2408 TInt cWsScreenDeviceResult = 1; |
2375 TInt cWsScreenDeviceResult = 1; |
2409 TReal32 percentDifference = 0.0; |
2376 TReal32 percentDifference = 0.0; |
2410 CreateScrDevAndContextL(); |
2377 CreateScrDevAndContextL(); |
|
2378 TBool testResult = EFalse; |
2411 |
2379 |
2412 RWsSession wsSession; |
2380 RWsSession wsSession; |
2413 if (KErrNone == wsSession.Connect()) |
2381 if (KErrNone == wsSession.Connect()) |
2414 { |
2382 { |
2415 CWsScreenDevice* wsScrDev = new (ELeave) CWsScreenDevice(wsSession); |
2383 CWsScreenDevice* wsScrDev = new (ELeave) CWsScreenDevice(wsSession); |
2418 // first compare results of the two class's HorizontalPixelsToTwips and pass |
2386 // first compare results of the two class's HorizontalPixelsToTwips and pass |
2419 // the test if they are within tolerance |
2387 // the test if they are within tolerance |
2420 cFbsScreenDeviceResult = iScrDev->HorizontalPixelsToTwips(KHorizontalTestPixels); |
2388 cFbsScreenDeviceResult = iScrDev->HorizontalPixelsToTwips(KHorizontalTestPixels); |
2421 cWsScreenDeviceResult = wsScrDev->HorizontalPixelsToTwips(KHorizontalTestPixels); |
2389 cWsScreenDeviceResult = wsScrDev->HorizontalPixelsToTwips(KHorizontalTestPixels); |
2422 percentDifference = Abs((TReal32)(cFbsScreenDeviceResult - cWsScreenDeviceResult)/cFbsScreenDeviceResult*100.0); |
2390 percentDifference = Abs((TReal32)(cFbsScreenDeviceResult - cWsScreenDeviceResult)/cFbsScreenDeviceResult*100.0); |
2423 TEST(percentDifference < KTolerance); |
2391 testResult = (percentDifference < KTolerance); |
|
2392 if ( !testResult ) |
|
2393 { |
|
2394 _LIT(KHorizPixelsToTwipsDesc, "%d horizontal pixels converted to twips by screen device: FBS=%d, WS=%d"); |
|
2395 WARN_PRINTF4(KHorizPixelsToTwipsDesc, KHorizontalTestPixels, cFbsScreenDeviceResult, cWsScreenDeviceResult); |
|
2396 } |
|
2397 TEST( testResult ); |
2424 |
2398 |
2425 // convert the CWsScreenDevice result back again using each class's HorizontalTwipsToPixels |
2399 // convert the CWsScreenDevice result back again using each class's HorizontalTwipsToPixels |
2426 // and pass the test if these results are within tolerance |
2400 // and pass the test if these results are within tolerance |
2427 cFbsScreenDeviceResult = iScrDev->HorizontalTwipsToPixels(cWsScreenDeviceResult); |
2401 TInt numTwipsToTest = cWsScreenDeviceResult; |
2428 cWsScreenDeviceResult = wsScrDev->HorizontalTwipsToPixels(cWsScreenDeviceResult); |
2402 cFbsScreenDeviceResult = iScrDev->HorizontalTwipsToPixels(numTwipsToTest); |
|
2403 cWsScreenDeviceResult = wsScrDev->HorizontalTwipsToPixels(numTwipsToTest); |
2429 percentDifference = Abs((TReal32)(cFbsScreenDeviceResult - cWsScreenDeviceResult)/cFbsScreenDeviceResult*100.0); |
2404 percentDifference = Abs((TReal32)(cFbsScreenDeviceResult - cWsScreenDeviceResult)/cFbsScreenDeviceResult*100.0); |
2430 TEST(percentDifference < KTolerance); |
2405 testResult = (percentDifference < KTolerance); |
|
2406 if ( !testResult ) |
|
2407 { |
|
2408 _LIT(KHorizTwipsToPixelsDesc, "%d horizontal twips converted to pixels by screen device: FBS=%d, WS=%d"); |
|
2409 WARN_PRINTF4(KHorizTwipsToPixelsDesc, numTwipsToTest, cFbsScreenDeviceResult, cWsScreenDeviceResult); |
|
2410 } |
|
2411 TEST( testResult ); |
2431 |
2412 |
2432 // next compare results of the two class's VerticalPixelsToTwips and pass the test |
2413 // next compare results of the two class's VerticalPixelsToTwips and pass the test |
2433 // if they are within tolerance |
2414 // if they are within tolerance |
2434 cFbsScreenDeviceResult = iScrDev->VerticalPixelsToTwips(KVerticalTestPixels); |
2415 cFbsScreenDeviceResult = iScrDev->VerticalPixelsToTwips(KVerticalTestPixels); |
2435 cWsScreenDeviceResult= wsScrDev->VerticalPixelsToTwips(KVerticalTestPixels); |
2416 cWsScreenDeviceResult= wsScrDev->VerticalPixelsToTwips(KVerticalTestPixels); |
2436 percentDifference = Abs((TReal32)(cFbsScreenDeviceResult - cWsScreenDeviceResult)/cFbsScreenDeviceResult*100.0); |
2417 percentDifference = Abs((TReal32)(cFbsScreenDeviceResult - cWsScreenDeviceResult)/cFbsScreenDeviceResult*100.0); |
2437 TEST(percentDifference < KTolerance); |
2418 testResult = (percentDifference < KTolerance); |
|
2419 if ( !testResult ) |
|
2420 { |
|
2421 _LIT(KVertPixelsToTwipsDesc, "%d vertical pixels converted to twips by screen device: FBS=%d, WS=%d"); |
|
2422 WARN_PRINTF4(KVertPixelsToTwipsDesc, KVerticalTestPixels, cFbsScreenDeviceResult, cWsScreenDeviceResult); |
|
2423 } |
|
2424 TEST( testResult ); |
2438 |
2425 |
2439 // convert the CWsScreenDevice result back again using each class's VerticalTwipsToPixels |
2426 // convert the CWsScreenDevice result back again using each class's VerticalTwipsToPixels |
2440 // and pass the test if these results are within tolerance |
2427 // and pass the test if these results are within tolerance |
2441 cFbsScreenDeviceResult = iScrDev->VerticalTwipsToPixels(cWsScreenDeviceResult); |
2428 numTwipsToTest = cWsScreenDeviceResult; |
2442 cWsScreenDeviceResult = wsScrDev->VerticalTwipsToPixels(cWsScreenDeviceResult); |
2429 cFbsScreenDeviceResult = iScrDev->VerticalTwipsToPixels(numTwipsToTest); |
|
2430 cWsScreenDeviceResult = wsScrDev->VerticalTwipsToPixels(numTwipsToTest); |
2443 percentDifference = Abs((TReal32)(cFbsScreenDeviceResult - cWsScreenDeviceResult)/cFbsScreenDeviceResult*100.0); |
2431 percentDifference = Abs((TReal32)(cFbsScreenDeviceResult - cWsScreenDeviceResult)/cFbsScreenDeviceResult*100.0); |
2444 TEST(percentDifference < KTolerance); |
2432 testResult = (percentDifference < KTolerance); |
|
2433 if ( !testResult ) |
|
2434 { |
|
2435 _LIT(KVertTwipsToPixelsDesc, "%d vertical twips converted to pixels by screen device: FBS=%d, WS=%d"); |
|
2436 WARN_PRINTF4(KVertTwipsToPixelsDesc, numTwipsToTest, cFbsScreenDeviceResult, cWsScreenDeviceResult); |
|
2437 } |
|
2438 TEST( testResult ); |
2445 |
2439 |
2446 delete wsScrDev; |
2440 delete wsScrDev; |
2447 wsSession.Close(); |
2441 wsSession.Close(); |
2448 } |
2442 } |
2449 else |
2443 else |