graphicshwdrivers/surfacemgr/test/src/tsurfacemanager.cpp
changeset 188 1b081cb0800b
parent 36 01a6848ebfd7
equal deleted inserted replaced
187:9f66f99ee56f 188:1b081cb0800b
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    19  @file
    19  @file
    20  @test
    20  @test
    21  @internalComponent - Internal Symbian test code
    21  @internalComponent - Internal Symbian test code
    22 */
    22 */
    23 
    23 
       
    24 
    24 #include "tsurfacemanager.h"
    25 #include "tsurfacemanager.h"
    25 #include <e32base.h>
    26 #include <e32base.h>
    26 #include <e32cons.h>
    27 #include <e32cons.h>
    27 #include <e32test.h>
    28 #include <e32test.h>
    28 #include <e32std.h>
    29 #include <e32std.h>
    29 #include <e32cmn.h>	  
    30 #include <e32cmn.h>	  
    30 #include <hal.h>
    31 #include <hal.h>
    31 #include <e32def_private.h>
    32 #include <e32def_private.h>
       
    33 #include <graphics/surface_hints.h>
       
    34 
       
    35 using namespace surfaceHints;
    32 
    36 
    33 const TInt KCountLimit = 10000;
    37 const TInt KCountLimit = 10000;
    34 
    38 
    35 CTSurfaceManager::CTSurfaceManager(CTestStep* aStep):
    39 CTSurfaceManager::CTSurfaceManager(CTestStep* aStep):
    36 	CTGraphicsBase(aStep)
    40 	CTGraphicsBase(aStep)
  3186 	TSurfaceId surfaceId;
  3190 	TSurfaceId surfaceId;
  3187 	TEST(KErrNone == iSurfaceManager.CreateSurface(buf, surfaceId));
  3191 	TEST(KErrNone == iSurfaceManager.CreateSurface(buf, surfaceId));
  3188 	
  3192 	
  3189 	//Add HintPair1
  3193 	//Add HintPair1
  3190 	RSurfaceManager::THintPair hintPair1;
  3194 	RSurfaceManager::THintPair hintPair1;
  3191 	hintPair1.iKey.iUid = 0x123257;
  3195 	hintPair1.Set(TUid::Uid(KSurfaceContent), EStillImage, ETrue);
  3192 	hintPair1.iValue = 300;
       
  3193 	hintPair1.iMutable = ETrue;
       
  3194 	TEST(KErrNone == iSurfaceManager.AddSurfaceHint(surfaceId, hintPair1));
  3196 	TEST(KErrNone == iSurfaceManager.AddSurfaceHint(surfaceId, hintPair1));
  3195 	
  3197 	
  3196 	RSurfaceManager::THintPair hintPairCheck1;
  3198 	RSurfaceManager::THintPair hintPairCheck1;
  3197 	hintPairCheck1.iKey.iUid = 0x123257;
  3199 	hintPairCheck1.iKey.iUid = KSurfaceContent;
  3198 	CheckHintPair(surfaceId, hintPairCheck1, hintPair1);
  3200 	CheckHintPair(surfaceId, hintPairCheck1, hintPair1);
  3199 	
  3201 	
  3200 	//Add HintPair2
  3202 	//Add HintPair2
  3201 	RSurfaceManager::THintPair hintPair2;
  3203 	RSurfaceManager::THintPair hintPair2;
  3202 	hintPair2.iKey.iUid = 0x123267;
  3204 	hintPair2.iKey.iUid = KSurfaceProtection;
  3203 	hintPair2.iValue = 100;
  3205 	hintPair2.iValue = EAllowAnalog | EAllowDigital;
  3204 	hintPair2.iMutable = EFalse;
  3206 	hintPair2.iMutable = EFalse;
  3205 	TEST(KErrNone == iSurfaceManager.AddSurfaceHint(surfaceId, hintPair2));
  3207 	TEST(KErrNone == iSurfaceManager.AddSurfaceHint(surfaceId, hintPair2));
  3206 		
  3208 		
  3207 	RSurfaceManager::THintPair hintPairCheck2;
  3209 	RSurfaceManager::THintPair hintPairCheck2;
  3208 	hintPairCheck2.iKey.iUid = 0x123267;
  3210 	hintPairCheck2.iKey.iUid = KSurfaceProtection;
  3209 	CheckHintPair(surfaceId, hintPairCheck2, hintPair2);
  3211 	CheckHintPair(surfaceId, hintPairCheck2, hintPair2);
  3210 	CheckHintPair(surfaceId, hintPairCheck1, hintPair1);
  3212 	CheckHintPair(surfaceId, hintPairCheck1, hintPair1);
  3211 
  3213 
  3212 	//Add HintPair3
  3214 	//Add HintPair3
  3213 	RSurfaceManager::THintPair hintPair3;
  3215 	RSurfaceManager::THintPair hintPair3;
  3214 	hintPair3.iKey.iUid = 0x123324;
  3216 	hintPair3.Set(TUid::Uid(KSurfaceCharacteristics), ENotPersistable, EFalse);
  3215 	hintPair3.iValue = 500;
       
  3216 	hintPair3.iMutable = ETrue;
       
  3217 	TEST(KErrNone == iSurfaceManager.AddSurfaceHint(surfaceId, hintPair3));
  3217 	TEST(KErrNone == iSurfaceManager.AddSurfaceHint(surfaceId, hintPair3));
  3218 	
  3218 	
  3219 	RSurfaceManager::THintPair hintPairCheck3;
  3219 	RSurfaceManager::THintPair hintPairCheck3;
  3220 	hintPairCheck3.iKey.iUid = 0x123324;
  3220 	hintPairCheck3.iKey.iUid = KSurfaceCharacteristics;
  3221 	CheckHintPair(surfaceId, hintPairCheck3, hintPair3);
  3221 	CheckHintPair(surfaceId, hintPairCheck3, hintPair3);
  3222 	CheckHintPair(surfaceId, hintPairCheck2, hintPair2);
  3222 	CheckHintPair(surfaceId, hintPairCheck2, hintPair2);
  3223 	CheckHintPair(surfaceId, hintPairCheck1, hintPair1);
  3223 	CheckHintPair(surfaceId, hintPairCheck1, hintPair1);
  3224 	
  3224 	
  3225 	//Add HintPair4
  3225 	//Add HintPair4
  4437     
  4437     
  4438     testBooleanTrue(aCondition, aFile, aLine);
  4438     testBooleanTrue(aCondition, aFile, aLine);
  4439     if(!aCondition)
  4439     if(!aCondition)
  4440         User::Leave(TEST_ERROR_CODE);   // leave with standard error code
  4440         User::Leave(TEST_ERROR_CODE);   // leave with standard error code
  4441     }
  4441     }
       
  4442