os/graphics/graphicstest/uibench/src/tsolidcolour.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 /**
    17  @file
    18  @test
    19  @internalComponent - Internal Symbian test code 
    20 */
    21  
    22 #include "tsolidcolour.h"
    23 
    24 const TInt KIterationsToTest = 250;
    25 
    26 const TRgb KColourSet[] = {KRgbBlack,KRgbGreen,KRgbMagenta,KRgbDarkBlue,KRgbGray,KRgbRed};
    27 const TInt KNumColourSet = TInt(sizeof(KColourSet)/sizeof(KColourSet[0]));
    28 
    29 CTSolidColour::CTSolidColour()
    30 	{
    31 	SetTestStepName(KTSolidColourName);
    32 	}
    33 
    34 /**
    35 Override of base class pure virtual
    36 Our implementation only gets called if the base class doTestStepPreambleL() did
    37 not leave. That being the case, the current test result value will be EPass.
    38 
    39 @return - TVerdict code
    40 */
    41 TVerdict CTSolidColour::doTestStepL()
    42 	{
    43 	SetTestStepID(_L("GRAPHICS-UI-BENCH-0026"));
    44 	DrawSolidColourL();
    45 	RecordTestResultL();
    46 	
    47 	return TestStepResult();
    48 	}
    49 
    50 /**
    51    @SYMTestCaseID
    52    GRAPHICS-UI-BENCH-0026
    53 
    54    @SYMTestCaseDesc
    55    Tests how long it takes to draw a solid colour
    56 
    57    @SYMTestActions
    58    Compare the results over time, and before and after changes to bitmap duplication code.
    59 
    60    @SYMTestExpectedResults
    61    Test should pass and display total test time and time per bitmap
    62 */
    63 void CTSolidColour::DrawSolidColourL()
    64 	{
    65 	TBool orientation[4];
    66 	TRect blockRect(10, 10, 200, 180);
    67 
    68 	for(TInt dispModeIndex = 0; dispModeIndex < KNumValidDisplayModes; dispModeIndex++)
    69 		{
    70 		SetScreenModeL(KValidDisplayModes[dispModeIndex]);			
    71 		iGc->OrientationsAvailable(orientation);
    72 		for (TInt orient = CFbsBitGc::EGraphicsOrientationNormal; orient <= CFbsBitGc::EGraphicsOrientationRotated270; orient++)
    73 			{
    74 			if (orientation[orient])
    75 				{
    76 				iGc->SetOrientation((CFbsBitGc::TGraphicsOrientation)orient);
    77 
    78 				for(TInt count=KNumColourSet-1; count>=0; --count)
    79 					{
    80 					TRgb colour = KColourSet[count];
    81 
    82 					iGc->SetBrushColor(KRgbWhite);
    83 					iGc->Clear();
    84 					iGc->SetBrushColor(colour);
    85 					iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
    86 					iProfiler->InitResults();
    87 					for(TInt lc=KIterationsToTest; lc>=0; --lc)
    88 						{
    89 						iGc->DrawRect(blockRect);
    90 						iProfiler->MarkResultSetL();
    91 						}
    92 					iProfiler->ResultsAnalysis(_L("Rect-Fill"), orient, count, KValidDisplayModes[dispModeIndex], KIterationsToTest);
    93 					}
    94 				}
    95 			}
    96 		}
    97 	}