fontservices/fontstore/tfs/T_GetNearestFontCapability.cpp
changeset 0 1fb32624e06b
equal deleted inserted replaced
-1:000000000000 0:1fb32624e06b
       
     1 /*
       
     2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 * T_NearestFontCapability.cpp
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 /**
       
    21  @file
       
    22  @test
       
    23  @internalComponent Internal Symbian test code
       
    24 */
       
    25 
       
    26 #include "T_GetNearestFontCapability.h"
       
    27 #include <hal.h>
       
    28 
       
    29 _LIT( KFontAvailable, "DejaVu Sans Condensed" );
       
    30 
       
    31 /**
       
    32 Class test cases for Font Capability testing and checkig panic codes
       
    33 */
       
    34 class CTGetNearestFontCapability : public CTGraphicsBase
       
    35 	{
       
    36 public:
       
    37 	CTGetNearestFontCapability(CTestStep* aStep);	
       
    38 	virtual ~CTGetNearestFontCapability();
       
    39 
       
    40 protected:
       
    41 //from 	CTGraphicsStep
       
    42 	virtual void RunTestCaseL(TInt aCurTestCase);
       
    43 	virtual void ConstructL();
       
    44 
       
    45 private:
       
    46 	void TestSystemDefaultFont();
       
    47 
       
    48 private:
       
    49 	CFbsTypefaceStore* iTfs;	
       
    50 	};
       
    51 
       
    52 //
       
    53 // CTGetNearestFontCapability
       
    54 //
       
    55 CTGetNearestFontCapability::CTGetNearestFontCapability(CTestStep* aStep) :
       
    56 	CTGraphicsBase(aStep)
       
    57 	{
       
    58 	
       
    59 	}
       
    60 
       
    61 void CTGetNearestFontCapability::ConstructL()
       
    62 	{
       
    63 	iTfs = CFbsTypefaceStore::NewL(NULL);	
       
    64 	}	
       
    65 	
       
    66  CTGetNearestFontCapability::~CTGetNearestFontCapability()
       
    67  	{
       
    68  	delete iTfs; 	
       
    69  	}
       
    70 	
       
    71 void CTGetNearestFontCapability::RunTestCaseL( TInt aCurTestCase )
       
    72 	{	
       
    73 	((CTGetNearestFontCapabilityStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
       
    74 	switch ( aCurTestCase )
       
    75 		{		
       
    76 	case 1:
       
    77 		((CTGetNearestFontCapabilityStep*)iStep)->SetTestStepID(_L("GRAPHICS-FNTSTORE-0007"));
       
    78 		INFO_PRINTF1(_L("Test System default font (capability check) Started "));
       
    79 		TRAPD(err,TestSystemDefaultFont());
       
    80 		if(err != KErrNone)
       
    81 			TEST(err == KErrPermissionDenied);
       
    82 		INFO_PRINTF1(_L("Test System default font (capability check) Finished"));
       
    83 	break;
       
    84 	
       
    85 	case 2:
       
    86         	((CTGetNearestFontCapabilityStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
       
    87 		((CTGetNearestFontCapabilityStep*)iStep)->CloseTMSGraphicsStep();
       
    88 		TestComplete();		
       
    89 		break;
       
    90 		}
       
    91 	((CTGetNearestFontCapabilityStep*)iStep)->RecordTestResultL();
       
    92 	}
       
    93 
       
    94 /**
       
    95 @SYMTestCaseID GRAPHICS-FNTSTORE-0007
       
    96 @SYMTestPriority Critical
       
    97 @SYMREQ REQ6158
       
    98 
       
    99 @SYMTestCaseDesc 
       
   100 Set the default system font with different capabilities
       
   101 
       
   102 @SYMTestActions 
       
   103 1 - Set the system default typeface with normal capability
       
   104 2 - Set the system default typeface with WriteDeviceData capability
       
   105 3 - Set the system default typeface with no capabilities
       
   106 
       
   107 @SYMTestExpectedResults 
       
   108 Leaves with error code KErrPermissionDenied when a client does not have the WriteDeviceData capability.
       
   109 */
       
   110 void CTGetNearestFontCapability::TestSystemDefaultFont()
       
   111 	{			
       
   112 	// Now try to set the system default font
       
   113 	iTfs->SetSystemDefaultTypefaceNameL(KFontAvailable);
       
   114 	
       
   115 	// Set back to empty descriptor
       
   116 	iTfs->SetSystemDefaultTypefaceNameL(KNullDesC);
       
   117 	}
       
   118 
       
   119 //--------------
       
   120 __CONSTRUCT_STEP__(GetNearestFontCapability)