os/graphics/graphicstest/uibench/s60/src/tests_copyrect/tcopyrect.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) 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
sl@0
    23
#include "tcopyrect.h"
sl@0
    24
sl@0
    25
sl@0
    26
const TInt KIterationsToTest = 100;
sl@0
    27
_LIT(KTestStep0017,"GRAPHICS-UI-BENCH-S60-0017");
sl@0
    28
sl@0
    29
sl@0
    30
CTCopyRect::CTCopyRect()
sl@0
    31
	{
sl@0
    32
	SetTestStepName(KTCopyRect);
sl@0
    33
	}
sl@0
    34
	
sl@0
    35
CTCopyRect::~CTCopyRect()	
sl@0
    36
	{
sl@0
    37
	// empty
sl@0
    38
	}
sl@0
    39
sl@0
    40
/**
sl@0
    41
Override of base class pure virtual
sl@0
    42
Our implementation only gets called if the base class doTestStepPreambleL() did
sl@0
    43
not leave. That being the case, the current test result value will be EPass.
sl@0
    44
sl@0
    45
@return - TVerdict code
sl@0
    46
*/
sl@0
    47
TVerdict CTCopyRect::doTestStepL()
sl@0
    48
    {
sl@0
    49
    SetTestStepID(KTestStep0017);
sl@0
    50
    TRAPD(err, CopyRectL());
sl@0
    51
    if (err != KErrNone)
sl@0
    52
        {
sl@0
    53
        SetTestStepResult(EAbort);
sl@0
    54
        }
sl@0
    55
    return TestStepResult();
sl@0
    56
	}
sl@0
    57
sl@0
    58
/**
sl@0
    59
@SYMTestCaseID
sl@0
    60
GRAPHICS-UI-BENCH-S60-0017
sl@0
    61
sl@0
    62
@SYMTestCaseDesc
sl@0
    63
Tests how long it takes to copy a rectangle to a different location with CFbsBitGc.
sl@0
    64
The test runs with the display modes EColor16MAP, EColor16MA, EColor16MU and EColor64K.
sl@0
    65
sl@0
    66
@SYMTestActions
sl@0
    67
Copy a rectangular area several times and measure the time it takes.
sl@0
    68
sl@0
    69
@SYMTestExpectedResults
sl@0
    70
Test should pass and display the average framerate.
sl@0
    71
*/
sl@0
    72
void CTCopyRect::CopyRectL()
sl@0
    73
    {
sl@0
    74
    for (TInt dispModeIndex = KNumValidDisplayModes - 1; dispModeIndex >= 0; --dispModeIndex)
sl@0
    75
        {
sl@0
    76
        SetScreenModeL(KValidDisplayModes[dispModeIndex]);
sl@0
    77
        iSourceRect = TRect(TPoint(0, 1), iScreenDevice->SizeInPixels());   
sl@0
    78
        iSourceRect.Resize(0, -2);
sl@0
    79
        iProfiler->InitResults();
sl@0
    80
        for(TInt i = 0; i < KIterationsToTest; ++i)
sl@0
    81
            {
sl@0
    82
            iGc->CopyRect(TPoint(0,1),iSourceRect);
sl@0
    83
            iScreenDevice->Update();
sl@0
    84
            }        
sl@0
    85
        iProfiler->MarkResultSetL();
sl@0
    86
        iProfiler->ResultsAnalysisFrameRate(KTestStep0017, 0, 0, iScreenDevice->BitmapDevice().DisplayMode(),
sl@0
    87
                KIterationsToTest, iSourceRect.Size().iWidth * iSourceRect.Size().iHeight);   
sl@0
    88
        }    
sl@0
    89
    }