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