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