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