os/graphics/graphicstest/uibench/s60/src/tests_copyrect/tcopyrect.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/graphicstest/uibench/s60/src/tests_copyrect/tcopyrect.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,89 @@
     1.4 +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +/**
    1.20 + @file
    1.21 + @test
    1.22 + @internalComponent - Internal Symbian test code 
    1.23 +*/
    1.24 +
    1.25 +
    1.26 +#include "tcopyrect.h"
    1.27 +
    1.28 +
    1.29 +const TInt KIterationsToTest = 100;
    1.30 +_LIT(KTestStep0017,"GRAPHICS-UI-BENCH-S60-0017");
    1.31 +
    1.32 +
    1.33 +CTCopyRect::CTCopyRect()
    1.34 +	{
    1.35 +	SetTestStepName(KTCopyRect);
    1.36 +	}
    1.37 +	
    1.38 +CTCopyRect::~CTCopyRect()	
    1.39 +	{
    1.40 +	// empty
    1.41 +	}
    1.42 +
    1.43 +/**
    1.44 +Override of base class pure virtual
    1.45 +Our implementation only gets called if the base class doTestStepPreambleL() did
    1.46 +not leave. That being the case, the current test result value will be EPass.
    1.47 +
    1.48 +@return - TVerdict code
    1.49 +*/
    1.50 +TVerdict CTCopyRect::doTestStepL()
    1.51 +    {
    1.52 +    SetTestStepID(KTestStep0017);
    1.53 +    TRAPD(err, CopyRectL());
    1.54 +    if (err != KErrNone)
    1.55 +        {
    1.56 +        SetTestStepResult(EAbort);
    1.57 +        }
    1.58 +    return TestStepResult();
    1.59 +	}
    1.60 +
    1.61 +/**
    1.62 +@SYMTestCaseID
    1.63 +GRAPHICS-UI-BENCH-S60-0017
    1.64 +
    1.65 +@SYMTestCaseDesc
    1.66 +Tests how long it takes to copy a rectangle to a different location with CFbsBitGc.
    1.67 +The test runs with the display modes EColor16MAP, EColor16MA, EColor16MU and EColor64K.
    1.68 +
    1.69 +@SYMTestActions
    1.70 +Copy a rectangular area several times and measure the time it takes.
    1.71 +
    1.72 +@SYMTestExpectedResults
    1.73 +Test should pass and display the average framerate.
    1.74 +*/
    1.75 +void CTCopyRect::CopyRectL()
    1.76 +    {
    1.77 +    for (TInt dispModeIndex = KNumValidDisplayModes - 1; dispModeIndex >= 0; --dispModeIndex)
    1.78 +        {
    1.79 +        SetScreenModeL(KValidDisplayModes[dispModeIndex]);
    1.80 +        iSourceRect = TRect(TPoint(0, 1), iScreenDevice->SizeInPixels());   
    1.81 +        iSourceRect.Resize(0, -2);
    1.82 +        iProfiler->InitResults();
    1.83 +        for(TInt i = 0; i < KIterationsToTest; ++i)
    1.84 +            {
    1.85 +            iGc->CopyRect(TPoint(0,1),iSourceRect);
    1.86 +            iScreenDevice->Update();
    1.87 +            }        
    1.88 +        iProfiler->MarkResultSetL();
    1.89 +        iProfiler->ResultsAnalysisFrameRate(KTestStep0017, 0, 0, iScreenDevice->BitmapDevice().DisplayMode(),
    1.90 +                KIterationsToTest, iSourceRect.Size().iWidth * iSourceRect.Size().iHeight);   
    1.91 +        }    
    1.92 +    }