| sl@0 |      1 | // Copyright (c) 2007-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 | #if !defined(__TSURFACEMANAGER_H__)
 | 
| sl@0 |     23 | #define __TSURFACEMANAGER_H__
 | 
| sl@0 |     24 | 
 | 
| sl@0 |     25 | #include <test/tgraphicsharness.h>
 | 
| sl@0 |     26 | #include <graphics/surface.h>
 | 
| sl@0 |     27 | #include <graphics/surfacemanager.h>
 | 
| sl@0 |     28 | #include "tsmgmultprocessshared.h"
 | 
| sl@0 |     29 | #include "../testdriver/d_sharedchunk.h"
 | 
| sl@0 |     30 | 
 | 
| sl@0 |     31 | class CTSurfaceManager : public CTGraphicsBase
 | 
| sl@0 |     32 | 	{
 | 
| sl@0 |     33 | public:
 | 
| sl@0 |     34 | 	CTSurfaceManager(CTestStep* aStep);
 | 
| sl@0 |     35 | 	~CTSurfaceManager();
 | 
| sl@0 |     36 | protected:
 | 
| sl@0 |     37 | 	//from 	CTGraphicsStep
 | 
| sl@0 |     38 | 	virtual void RunTestCaseL(TInt aCurTestCase);
 | 
| sl@0 |     39 | 
 | 
| sl@0 |     40 | private:
 | 
| sl@0 |     41 | 	void TestCreateSurfaceNewChunk1L();
 | 
| sl@0 |     42 | 	void TestCreateSurfaceNewChunk2L();
 | 
| sl@0 |     43 | 	void TestCreateSurfaceExisitingChunkL();
 | 
| sl@0 |     44 | 	void TestCreateSurfaceChunkWithHolesL();
 | 
| sl@0 |     45 | 	void TestCreateSurfaceExisitingChunk2L();
 | 
| sl@0 |     46 | 	void TestCreateSurfaceExisitingChunk3L();
 | 
| sl@0 |     47 | 	void TestCreateSurfaceExisitingChunk4L();
 | 
| sl@0 |     48 | 	void TestCreateSurfaceAssociatedWithHintPairsL();
 | 
| sl@0 |     49 | 	void TestCreateSurfaceSetReferenceCountL();
 | 
| sl@0 |     50 | 	void TestSharedChunkClosedL();
 | 
| sl@0 |     51 | 	void TestMultipleChannelsL();
 | 
| sl@0 |     52 | 	void TestClosingChannelsL();
 | 
| sl@0 |     53 | 	void TestSynchronizeCacheL();
 | 
| sl@0 |     54 | 	void TestSharedChunkClosed2L();
 | 
| sl@0 |     55 | 	void TestCreateSurfaceInvalidParamsNewChunkL();
 | 
| sl@0 |     56 | 	void TestCreateSurfaceInvalidParamsExisitingChunkL();
 | 
| sl@0 |     57 | 	void TestCreateSurfaceInvalidParamsExisitingChunk2L();
 | 
| sl@0 |     58 | 	void TestInvalidContiguousPropertyL();
 | 
| sl@0 |     59 | 	void TestInvalidCachePropertyL();
 | 
| sl@0 |     60 | 	void TestInvalidSharedChunkL();
 | 
| sl@0 |     61 | 	void TestSynchronizeCacheInvalidParamsL();
 | 
| sl@0 |     62 | 	void TestCreateSurfaceAlignmentsMemoryTypeL();
 | 
| sl@0 |     63 | 	void TestOpenSurfaceL();
 | 
| sl@0 |     64 | 	void TestWriteToTwoBuffersL(); 
 | 
| sl@0 |     65 | 	void TestQuerySurfaceInfoWithoutMappingL();
 | 
| sl@0 |     66 | 	void TestQuerySurfaceInfoAfterMappingL();
 | 
| sl@0 |     67 | 	void TestMapSurfaceL();
 | 
| sl@0 |     68 | 	void TestClosingSurfaceL();  
 | 
| sl@0 |     69 | 	void TestClosingSurfaceDecrementsReferenceCountL();
 | 
| sl@0 |     70 | 	void TestCreateVeryLargeSurfacesL();
 | 
| sl@0 |     71 | 	void TestSurfaceInfoChangedTypeL();
 | 
| sl@0 |     72 | 	void TestMapSurfaceInvalidParamsL();
 | 
| sl@0 |     73 | 	void TestCloseSurfaceInvalidParamsL();
 | 
| sl@0 |     74 | 	void TestCloseSurfaceSameIDTwiceL();
 | 
| sl@0 |     75 | 	void TestCreateSurfaceOomL();
 | 
| sl@0 |     76 | 	void TestGetSurfaceHintInFalseConditionsL();
 | 
| sl@0 |     77 | 	void TestSetSurfaceHintInFalseConditionsL();
 | 
| sl@0 |     78 | 	void TestAddSurfaceHintInFalseConditionsL();
 | 
| sl@0 |     79 | 	void TestGetSurfaceHintL();
 | 
| sl@0 |     80 | 	void TestSetSurfaceHintL();
 | 
| sl@0 |     81 | 	void TestAddSurfaceHintL();
 | 
| sl@0 |     82 | 	void TestDuplicatedHintKeyL();
 | 
| sl@0 |     83 | 	void TestSurfaceLimitL();
 | 
| sl@0 |     84 | 	void TestPerformanceOfSurfaceHintAndCacheL();
 | 
| sl@0 |     85 | 	void TestPerformanceOfSurfaceCreatingAndClosingL();
 | 
| sl@0 |     86 | 	void TestZerosInHintsArrayL();
 | 
| sl@0 |     87 | 	void TestCreateSurfaceWithTooManyHintsL();
 | 
| sl@0 |     88 | 	void TestCreateSurfaceUnMappableL();
 | 
| sl@0 |     89 | 
 | 
| sl@0 |     90 |     void testBooleanTrueL(TBool aCondition, const TText8* aFile, TInt aLine); 
 | 
| sl@0 |     91 | private:
 | 
| sl@0 |     92 | 	void GetSharedChunkHandleL(RSharedChunkLdd& aDevice, RChunk& aHandle, TUint aChunkSize, TUint aChunkAttribs, TUint aContiguousAttrib);
 | 
| sl@0 |     93 | 	void SetupAttributesL(RSurfaceManager::TSurfaceCreationAttributes& attributesParams);
 | 
| sl@0 |     94 | 	void SetAttributesForHintTestL(RSurfaceManager::TSurfaceCreationAttributes& attributesParamsForHintTest);
 | 
| sl@0 |     95 | 	void SetupAttributesForNegativeTestL(RSurfaceManager::TSurfaceCreationAttributes& attributesForNegativeTest);
 | 
| sl@0 |     96 | 	void SetAttributesForNegativeHintTestL(RSurfaceManager::TSurfaceCreationAttributes& attributesForNegativeHintTest);
 | 
| sl@0 |     97 | 	void ChangeAttributes(RSurfaceManager::TSurfaceCreationAttributes* aAttributes, TInt aAlignment, TInt aOffsetToFirstBuffer, TInt aOffsetBetweenBuffers, RSurfaceManager::TCacheAttribute aCacheAttrib);
 | 
| sl@0 |     98 | 	void SurfaceOperation(RSurfaceManager::TSurfaceCreationAttributesBuf& aAttributes);
 | 
| sl@0 |     99 | 	void CheckAttributesL(RSurfaceManager::TSurfaceCreationAttributes& aAttributes);
 | 
| sl@0 |    100 | 	void CheckSizeL(TInt aOffsetToFirstBuffer, TInt aOffsetBetweenBuffers);
 | 
| sl@0 |    101 | 	void CheckHintPair(TSurfaceId& aSurfaceId, RSurfaceManager::THintPair& aHintPairToCheck, RSurfaceManager::THintPair& aHintPairCompareWith);
 | 
| sl@0 |    102 | 	void CheckAlignment(TSurfaceId& aId, TInt aAlign, RSurfaceManager::TCacheAttribute aCached);
 | 
| sl@0 |    103 | 	void ReAllocHintsArrayL(TUint aNumberOfHints);
 | 
| sl@0 |    104 | 	
 | 
| sl@0 |    105 | private:
 | 
| sl@0 |    106 | 	RSurfaceManager iSurfaceManager;
 | 
| sl@0 |    107 | 	TSurfaceId iSurfaceId;
 | 
| sl@0 |    108 | 	RChunk iHandle;
 | 
| sl@0 |    109 | 	RSurfaceManager::TInfoBuf iInfoBuf;
 | 
| sl@0 |    110 | 	RSurfaceManager::TSurfaceInfoV01 iInfo;
 | 
| sl@0 |    111 | 	TInt	iFreq;	
 | 
| sl@0 |    112 | 	RSurfaceManager::THintPair *iHintsArray;
 | 
| sl@0 |    113 | 	};
 | 
| sl@0 |    114 | 
 | 
| sl@0 |    115 | 
 | 
| sl@0 |    116 | class CTSurfaceManagerStep : public CTGraphicsStep
 | 
| sl@0 |    117 | 	{
 | 
| sl@0 |    118 | public:
 | 
| sl@0 |    119 | 	CTSurfaceManagerStep();
 | 
| sl@0 |    120 | protected:	
 | 
| sl@0 |    121 | 	//from CTGraphicsStep
 | 
| sl@0 |    122 | 	virtual CTGraphicsBase* CreateTestL();
 | 
| sl@0 |    123 | 	virtual void TestSetupL();
 | 
| sl@0 |    124 | 	virtual void TestClose();
 | 
| sl@0 |    125 | 	};	
 | 
| sl@0 |    126 | 
 | 
| sl@0 |    127 | _LIT(KTSurfaceManagerStep,"TSurfaceManager");
 | 
| sl@0 |    128 | 
 | 
| sl@0 |    129 | #endif
 |