First public contribution.
1 // Copyright (c) 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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 @internalComponent - Internal Symbian test code
23 #include "tflowwindowstest.h"
24 #include "tsmallwindowraster.h"
27 _LIT(KTestStep0006, "GRAPHICS-UI-BENCH-S60-0006");
28 _LIT(KSectNameFlowsTest, "FlowTests");
29 _LIT(KKeyNamePreload, "Preload");
30 _LIT(KKeyNameFiles, "Files");
31 _LIT(KKeyNameWindowWidth, "WindowWidth");
32 _LIT(KKeyNameWindowHeight, "WindowHeight");
34 CTFlowWindowsTest::CTFlowWindowsTest()
36 SetTestStepName(KTFlowWindows);
39 CTFlowWindowsTest::~CTFlowWindowsTest()
42 delete iFlowWindowsController;
45 TVerdict CTFlowWindowsTest::doTestStepPreambleL()
47 CTe_graphicsperformanceSuiteStepBase::doTestStepPreambleL();
49 iPreload = EFalse; // default behaviour
50 GetBoolFromConfig(KSectNameFlowsTest, KKeyNamePreload, iPreload);
53 TEST(GetStringFromConfig(KSectNameFlowsTest,KKeyNameFiles, fileNameList));
54 ExtractListL(fileNameList, iFileNames);
56 TSize windowSize = CTWindow::GetDisplaySizeInPixels();
57 INFO_PRINTF2(_L("Window-width: %d"), windowSize.iWidth);
58 INFO_PRINTF2(_L("Window-height: %d"), windowSize.iHeight);
59 GetIntFromConfig(KSectNameFlowsTest, KKeyNameWindowWidth, windowSize.iWidth);
60 GetIntFromConfig(KSectNameFlowsTest, KKeyNameWindowHeight, windowSize.iHeight);
62 RArray<TPoint> initialPositions;
63 RArray<pTWindowCreatorFunction> windowCreatorFunctions;
64 CleanupClosePushL(initialPositions);
65 CleanupClosePushL(windowCreatorFunctions);
66 TInt numberOfWindows = iFileNames.Count();
67 TPoint initialPosition(0, 0);
68 for (TInt i = 0; i < numberOfWindows; ++i)
70 windowCreatorFunctions.AppendL(CTSmallWindowRaster::NewL);
71 initialPositions.AppendL(initialPosition);
72 initialPosition.iX += windowSize.iWidth;
74 // run the test enough frames to see all the windows go by
75 iIterationsToTest = windowSize.iWidth * numberOfWindows;
76 iFlowWindowsController = CTFlowWindowsController::NewL(iPreload, iFileNames, windowSize, windowCreatorFunctions, initialPositions, EFalse);
78 CleanupStack::PopAndDestroy(2, &initialPositions);
79 return TestStepResult();
83 Override of base class pure virtual
84 Our implementation only gets called if the base class doTestStepPreambleL() did
87 @return - TVerdict code
89 TVerdict CTFlowWindowsTest::doTestStepL()
91 SetTestStepID(KTestStep0006);
92 TRAPD(err, FlowWindowsL());
95 SetTestStepResult(EAbort);
97 return TestStepResult();
102 GRAPHICS-UI-BENCH-S60-0006
105 Tests how long it takes to moves windows over the screen.
108 Creates windows which draw bitmaps and moves them over the screen.
110 @SYMTestExpectedResults
111 Test should pass and write the average framerate of the test to a log file.
113 void CTFlowWindowsTest::FlowWindowsL()
115 iIterationsToTest = 50;
116 iProfiler->InitResults();
117 for (TInt i = 0; i < iIterationsToTest; ++i)
119 iFlowWindowsController->MoveL();
121 iProfiler->MarkResultSetL();
122 TSize windowSize = CTWindow::GetDisplaySizeInPixels();
123 iProfiler->ResultsAnalysisFrameRate(KTestStep0006, 0, 0, 0, iIterationsToTest, windowSize.iWidth * windowSize.iHeight);