os/graphics/graphicsresourceservices/graphicsresource/test/tgraphicsresourceteststepbase.h
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/graphicsresourceservices/graphicsresource/test/tgraphicsresourceteststepbase.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,104 @@
1.4 +// Copyright (c) 2007-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 +#ifndef TGRAPHICSRESOURCETESTSTEPBASE_H
1.20 +#define TGRAPHICSRESOURCETESTSTEPBASE_H
1.21 +
1.22 +#include "sgimage.h"
1.23 +#include "sgimagecollection.h"
1.24 +#include "sgresource.h"
1.25 +#include "tgraphicsresourcemultiprocessthread.h"
1.26 +#include <e32base.h>
1.27 +#include <test/testexecutestepbase.h>
1.28 +#include <graphics/sgimage_sw.h>
1.29 +#include <graphics/sgimage_chunk.h>
1.30 +#include <test/ttmsgraphicsstep.h>
1.31 +
1.32 +
1.33 +_LIT(KSgTestGenericPanicCategory, "SGRES");
1.34 +_LIT(KSgTestAdapterPanicCategory, "SGRES-ADAPTER");
1.35 +const TInt KMaxPixelFormats = 64;
1.36 +
1.37 +class CTSgTestStepBase : public CTTMSGraphicsStep
1.38 + {
1.39 +public:
1.40 + CTSgTestStepBase();
1.41 + ~CTSgTestStepBase();
1.42 + IMPORT_C void testBooleanTrue(TBool aCondition, const TText8* aFile, TInt aLine);
1.43 +protected:
1.44 + // From CTestStep
1.45 + virtual TVerdict doTestStepPreambleL();
1.46 + virtual TVerdict doTestStepPostambleL();
1.47 +
1.48 + //common utility functions
1.49 + void CreateImageL(RSgImage& aImage);
1.50 + void CreateImageCollectionL(RSgImageCollection& aCollection);
1.51 + TInt CreateSecondProcessAndDoTestL(const TDesC &aProcessName, TSgresTestInfo& aTestInfo);
1.52 + TInt CreateSecondThreadAndDoTestL(TSgresTestInfo aTestInfo);
1.53 + void CreateSecondThreadAndCheckPanicL(TSgresTestInfo aTestInfo, TInt aPanicCode, TExitCategoryName aExitCategory, const TDesC &aThreadName);
1.54 + void CreateSecondProcessAndCheckPanicL(TSgresTestInfo aTestInfo, TInt aPanicCode, TExitCategoryName aExitCategory, const TDesC &aProcessName);
1.55 + void CallGetPixelFormatsL(TSgCpuAccess aCpuAccess, TUint32 aUsage, TBool aShareable, TInt aScreenId);
1.56 + void TestGetPixelFormatCompatibilityGuaranteesL();
1.57 + void CheckPixelFormatPresent(TUidPixelFormat aPixelFormat);
1.58 + void TestOpenDriverL();
1.59 + void TestCloseDriver();
1.60 + static TBool CompareInfos(TSgImageInfo& info1, TSgImageInfo& info2);
1.61 + static TInt SecondThreadStart(TAny* aInfo);
1.62 + static void CloseDriverWhenLeave(TAny* aInfo);
1.63 + void CheckErrorL(TInt aExpectedErrorCode, TInt aActualErrorCode, const TText8* aFile, TInt aLine);
1.64 +
1.65 + //OOM test functions
1.66 + void TestOOM();
1.67 + virtual void DoMemoryTestsL();
1.68 +
1.69 +protected:
1.70 + RThread iSecondThread;
1.71 + TBool iRunningOomTests;
1.72 +private:
1.73 + TInt iPixelFormatCount;
1.74 + TUidPixelFormat iPixelFormatArray[KMaxPixelFormats];
1.75 + };
1.76 +
1.77 +//common variables and functions
1.78 +const TUint16 KImageData[] = {
1.79 + 0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,
1.80 + 0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,
1.81 + 0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,
1.82 + 0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,
1.83 + 0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,
1.84 + 0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,
1.85 + 0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,
1.86 + 0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0
1.87 + };
1.88 +
1.89 +const TInt KNumImagesInCollection = 10;
1.90 +
1.91 +#define TESTWITHFILENAMEANDLINENUMBERL(a, f, l) \
1.92 + {\
1.93 + testBooleanTrueL((a), f, l); \
1.94 + }
1.95 +
1.96 +#if defined(__WINS__)
1.97 +_LIT(KSecondProcess, "tgraphicsresourcesecondprocess.exe");
1.98 +#elif defined(SYMBIAN_GRAPHICS_USE_GPU_MEMORY)
1.99 +_LIT(KSecondProcess, "tgraphicsresourcesecondprocess_mbx.exe");
1.100 +#else
1.101 +_LIT(KSecondProcess, "tgraphicsresourcesecondprocess_sw.exe");
1.102 +#endif
1.103 +
1.104 +_LIT(KSecondThread, "Test_GraphicsResource_SecondThread");
1.105 +_LIT(KSecondThreadSemaphore, "Second Thread Semaphore");
1.106 +
1.107 +#endif