sl@0: /* sl@0: * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * T_NearestFontCapability.cpp sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @test sl@0: @internalComponent Internal Symbian test code sl@0: */ sl@0: sl@0: #include "T_GetNearestFontCapability.h" sl@0: #include sl@0: sl@0: _LIT( KFontAvailable, "DejaVu Sans Condensed" ); sl@0: sl@0: /** sl@0: Class test cases for Font Capability testing and checkig panic codes sl@0: */ sl@0: class CTGetNearestFontCapability : public CTGraphicsBase sl@0: { sl@0: public: sl@0: CTGetNearestFontCapability(CTestStep* aStep); sl@0: virtual ~CTGetNearestFontCapability(); sl@0: sl@0: protected: sl@0: //from CTGraphicsStep sl@0: virtual void RunTestCaseL(TInt aCurTestCase); sl@0: virtual void ConstructL(); sl@0: sl@0: private: sl@0: void TestSystemDefaultFont(); sl@0: sl@0: private: sl@0: CFbsTypefaceStore* iTfs; sl@0: }; sl@0: sl@0: // sl@0: // CTGetNearestFontCapability sl@0: // sl@0: CTGetNearestFontCapability::CTGetNearestFontCapability(CTestStep* aStep) : sl@0: CTGraphicsBase(aStep) sl@0: { sl@0: sl@0: } sl@0: sl@0: void CTGetNearestFontCapability::ConstructL() sl@0: { sl@0: iTfs = CFbsTypefaceStore::NewL(NULL); sl@0: } sl@0: sl@0: CTGetNearestFontCapability::~CTGetNearestFontCapability() sl@0: { sl@0: delete iTfs; sl@0: } sl@0: sl@0: void CTGetNearestFontCapability::RunTestCaseL( TInt aCurTestCase ) sl@0: { sl@0: ((CTGetNearestFontCapabilityStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName); sl@0: switch ( aCurTestCase ) sl@0: { sl@0: case 1: sl@0: ((CTGetNearestFontCapabilityStep*)iStep)->SetTestStepID(_L("GRAPHICS-FNTSTORE-0007")); sl@0: INFO_PRINTF1(_L("Test System default font (capability check) Started ")); sl@0: TRAPD(err,TestSystemDefaultFont()); sl@0: if(err != KErrNone) sl@0: TEST(err == KErrPermissionDenied); sl@0: INFO_PRINTF1(_L("Test System default font (capability check) Finished")); sl@0: break; sl@0: sl@0: case 2: sl@0: ((CTGetNearestFontCapabilityStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); sl@0: ((CTGetNearestFontCapabilityStep*)iStep)->CloseTMSGraphicsStep(); sl@0: TestComplete(); sl@0: break; sl@0: } sl@0: ((CTGetNearestFontCapabilityStep*)iStep)->RecordTestResultL(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-FNTSTORE-0007 sl@0: @SYMTestPriority Critical sl@0: @SYMREQ REQ6158 sl@0: sl@0: @SYMTestCaseDesc sl@0: Set the default system font with different capabilities sl@0: sl@0: @SYMTestActions sl@0: 1 - Set the system default typeface with normal capability sl@0: 2 - Set the system default typeface with WriteDeviceData capability sl@0: 3 - Set the system default typeface with no capabilities sl@0: sl@0: @SYMTestExpectedResults sl@0: Leaves with error code KErrPermissionDenied when a client does not have the WriteDeviceData capability. sl@0: */ sl@0: void CTGetNearestFontCapability::TestSystemDefaultFont() sl@0: { sl@0: // Now try to set the system default font sl@0: iTfs->SetSystemDefaultTypefaceNameL(KFontAvailable); sl@0: sl@0: // Set back to empty descriptor sl@0: iTfs->SetSystemDefaultTypefaceNameL(KNullDesC); sl@0: } sl@0: sl@0: //-------------- sl@0: __CONSTRUCT_STEP__(GetNearestFontCapability)