os/textandloc/fontservices/fontstore/tfs/T_GetNearestFontCapability.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/textandloc/fontservices/fontstore/tfs/T_GetNearestFontCapability.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,120 @@
     1.4 +/*
     1.5 +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +* T_NearestFontCapability.cpp
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +/**
    1.24 + @file
    1.25 + @test
    1.26 + @internalComponent Internal Symbian test code
    1.27 +*/
    1.28 +
    1.29 +#include "T_GetNearestFontCapability.h"
    1.30 +#include <hal.h>
    1.31 +
    1.32 +_LIT( KFontAvailable, "DejaVu Sans Condensed" );
    1.33 +
    1.34 +/**
    1.35 +Class test cases for Font Capability testing and checkig panic codes
    1.36 +*/
    1.37 +class CTGetNearestFontCapability : public CTGraphicsBase
    1.38 +	{
    1.39 +public:
    1.40 +	CTGetNearestFontCapability(CTestStep* aStep);	
    1.41 +	virtual ~CTGetNearestFontCapability();
    1.42 +
    1.43 +protected:
    1.44 +//from 	CTGraphicsStep
    1.45 +	virtual void RunTestCaseL(TInt aCurTestCase);
    1.46 +	virtual void ConstructL();
    1.47 +
    1.48 +private:
    1.49 +	void TestSystemDefaultFont();
    1.50 +
    1.51 +private:
    1.52 +	CFbsTypefaceStore* iTfs;	
    1.53 +	};
    1.54 +
    1.55 +//
    1.56 +// CTGetNearestFontCapability
    1.57 +//
    1.58 +CTGetNearestFontCapability::CTGetNearestFontCapability(CTestStep* aStep) :
    1.59 +	CTGraphicsBase(aStep)
    1.60 +	{
    1.61 +	
    1.62 +	}
    1.63 +
    1.64 +void CTGetNearestFontCapability::ConstructL()
    1.65 +	{
    1.66 +	iTfs = CFbsTypefaceStore::NewL(NULL);	
    1.67 +	}	
    1.68 +	
    1.69 + CTGetNearestFontCapability::~CTGetNearestFontCapability()
    1.70 + 	{
    1.71 + 	delete iTfs; 	
    1.72 + 	}
    1.73 +	
    1.74 +void CTGetNearestFontCapability::RunTestCaseL( TInt aCurTestCase )
    1.75 +	{	
    1.76 +	((CTGetNearestFontCapabilityStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
    1.77 +	switch ( aCurTestCase )
    1.78 +		{		
    1.79 +	case 1:
    1.80 +		((CTGetNearestFontCapabilityStep*)iStep)->SetTestStepID(_L("GRAPHICS-FNTSTORE-0007"));
    1.81 +		INFO_PRINTF1(_L("Test System default font (capability check) Started "));
    1.82 +		TRAPD(err,TestSystemDefaultFont());
    1.83 +		if(err != KErrNone)
    1.84 +			TEST(err == KErrPermissionDenied);
    1.85 +		INFO_PRINTF1(_L("Test System default font (capability check) Finished"));
    1.86 +	break;
    1.87 +	
    1.88 +	case 2:
    1.89 +        	((CTGetNearestFontCapabilityStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
    1.90 +		((CTGetNearestFontCapabilityStep*)iStep)->CloseTMSGraphicsStep();
    1.91 +		TestComplete();		
    1.92 +		break;
    1.93 +		}
    1.94 +	((CTGetNearestFontCapabilityStep*)iStep)->RecordTestResultL();
    1.95 +	}
    1.96 +
    1.97 +/**
    1.98 +@SYMTestCaseID GRAPHICS-FNTSTORE-0007
    1.99 +@SYMTestPriority Critical
   1.100 +@SYMREQ REQ6158
   1.101 +
   1.102 +@SYMTestCaseDesc 
   1.103 +Set the default system font with different capabilities
   1.104 +
   1.105 +@SYMTestActions 
   1.106 +1 - Set the system default typeface with normal capability
   1.107 +2 - Set the system default typeface with WriteDeviceData capability
   1.108 +3 - Set the system default typeface with no capabilities
   1.109 +
   1.110 +@SYMTestExpectedResults 
   1.111 +Leaves with error code KErrPermissionDenied when a client does not have the WriteDeviceData capability.
   1.112 +*/
   1.113 +void CTGetNearestFontCapability::TestSystemDefaultFont()
   1.114 +	{			
   1.115 +	// Now try to set the system default font
   1.116 +	iTfs->SetSystemDefaultTypefaceNameL(KFontAvailable);
   1.117 +	
   1.118 +	// Set back to empty descriptor
   1.119 +	iTfs->SetSystemDefaultTypefaceNameL(KNullDesC);
   1.120 +	}
   1.121 +
   1.122 +//--------------
   1.123 +__CONSTRUCT_STEP__(GetNearestFontCapability)