graphicsresourceservices/graphicsresource/test/tgraphicsresourceteststepbase.h
author William Roberts <williamr@symbian.org>
Thu, 03 Jun 2010 17:39:46 +0100
branchNewGraphicsArchitecture
changeset 87 0709f76d91e5
parent 0 5d03bc08d59c
permissions -rw-r--r--
Add MMP files to build libOpenVG_sw.lib which uses LINKAS to redirect to libOpenVG.dll (and the same for libEGL_sw.lib and libOpenVGU_sw.lib). Only the libEGL_sw.lib redirection isn't activated - this can't happen until there is a merged libEGL.dll which supports the OpenWF synchronisation and also implements the graphical support functions. The overall aim is to eliminate the *_sw.dll implementations, at least as a compile-time way of choosing a software-only implementation.The correct way to choose is to put the right set of libraries into a ROM with suitable renaming, and in the emulator to use the "switching DLL" technique to pick the right set. As the Symbian Foundation doesn't have any alternative implementations, we don't need the switching DLLs and we can build directly to the correct name.

// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
//

#ifndef TGRAPHICSRESOURCETESTSTEPBASE_H
#define TGRAPHICSRESOURCETESTSTEPBASE_H

#include "sgimage.h"
#include "sgimagecollection.h"
#include "sgresource.h"
#include "tgraphicsresourcemultiprocessthread.h"
#include <e32base.h>
#include <test/testexecutestepbase.h>
#include <graphics/sgimage_sw.h>
#include <graphics/sgimage_chunk.h>
#include <test/ttmsgraphicsstep.h>


_LIT(KSgTestGenericPanicCategory, "SGRES");
_LIT(KSgTestAdapterPanicCategory, "SGRES-ADAPTER");
const TInt KMaxPixelFormats = 64;

class CTSgTestStepBase : public CTTMSGraphicsStep
	{
public:
	CTSgTestStepBase();
	~CTSgTestStepBase();
	IMPORT_C void testBooleanTrue(TBool aCondition, const TText8* aFile, TInt aLine);
protected:
	// From CTestStep
	virtual TVerdict doTestStepPreambleL(); 
	virtual TVerdict doTestStepPostambleL();	
	
	//common utility functions
	void CreateImageL(RSgImage& aImage);
	void CreateImageCollectionL(RSgImageCollection& aCollection);
	TInt CreateSecondProcessAndDoTestL(const TDesC &aProcessName, TSgresTestInfo& aTestInfo);
	TInt CreateSecondThreadAndDoTestL(TSgresTestInfo aTestInfo);
	void CreateSecondThreadAndCheckPanicL(TSgresTestInfo aTestInfo, TInt aPanicCode, TExitCategoryName aExitCategory, const TDesC &aThreadName);
	void CreateSecondProcessAndCheckPanicL(TSgresTestInfo aTestInfo, TInt aPanicCode, TExitCategoryName aExitCategory, const TDesC &aProcessName);
	void CallGetPixelFormatsL(TSgCpuAccess aCpuAccess, TUint32 aUsage, TBool aShareable, TInt aScreenId);
	void TestGetPixelFormatCompatibilityGuaranteesL();
	void CheckPixelFormatPresent(TUidPixelFormat aPixelFormat);
	void TestOpenDriverL();
	void TestCloseDriver();
	static TBool CompareInfos(TSgImageInfo& info1, TSgImageInfo& info2);
	static TInt SecondThreadStart(TAny* aInfo);
	static void CloseDriverWhenLeave(TAny* aInfo);
	void CheckErrorL(TInt aExpectedErrorCode, TInt aActualErrorCode, const TText8* aFile, TInt aLine);
	
	//OOM test functions
	void TestOOM();
	virtual void DoMemoryTestsL();
	
protected:	
	RThread iSecondThread;
	TBool iRunningOomTests;
private:
	TInt iPixelFormatCount;
	TUidPixelFormat iPixelFormatArray[KMaxPixelFormats];
	};

//common variables and functions
const TUint16 KImageData[] = {
			0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,
			0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,
			0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,
			0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,
			0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,
			0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,
			0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,
			0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0,0x7E0
			};

const TInt KNumImagesInCollection = 10;

#define TESTWITHFILENAMEANDLINENUMBERL(a, f, l) \
	{\
	testBooleanTrueL((a), f, l); \
	}

#if	defined(__WINS__)
_LIT(KSecondProcess, "tgraphicsresourcesecondprocess.exe");
#elif defined(SYMBIAN_GRAPHICS_USE_GPU_MEMORY)
_LIT(KSecondProcess, "tgraphicsresourcesecondprocess_mbx.exe");
#else
_LIT(KSecondProcess, "tgraphicsresourcesecondprocess_sw.exe");
#endif

_LIT(KSecondThread, "Test_GraphicsResource_SecondThread");
_LIT(KSecondThreadSemaphore, "Second Thread Semaphore");

#endif