1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/textandloc/fontservices/fontstore/tfs/T_FontMetrics.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,686 @@
1.4 +/*
1.5 +* Copyright (c) 2005-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 +*
1.19 +*/
1.20 +
1.21 +
1.22 +/**
1.23 + @file
1.24 + @test
1.25 + @internalComponent Internal Symbian test code
1.26 +*/
1.27 +
1.28 +#include <ecom/ecom.h>
1.29 +#include <gdi.h>
1.30 +#include "T_FontMetrics.h"
1.31 +#include <graphics/openfontrasterizer.h>
1.32 +#include <graphics/openfontconstants.h>
1.33 +#include <graphics/gdi/glyphsample.h>
1.34 +
1.35 +const TInt CTFontMetrics::KRequiredHeight = 24;
1.36 +_LIT(KTypefaceName, "DejaVu Sans Condensed");
1.37 +_LIT(KFontFilePath, "z:\\resource\\fonts\\DejaVuSansCondensed.ttf");
1.38 +
1.39 +LOCAL_C void ResetAndDestroyRImplInfoPtrArray(TAny* aPtr)
1.40 + {
1.41 + RImplInfoPtrArray* array = reinterpret_cast <RImplInfoPtrArray*> (aPtr);
1.42 + array->ResetAndDestroy();
1.43 + }
1.44 +
1.45 +CTFontMetrics::CTFontMetrics(CTestStep* aStep) :
1.46 + CTGraphicsBase(aStep)
1.47 + {
1.48 + }
1.49 +
1.50 +void CTFontMetrics::ConstructL()
1.51 + {
1.52 + iHeap = UserHeap::ChunkHeap(NULL, 0x10000, 0x10000);
1.53 + if (NULL == iHeap)
1.54 + User::Leave(KErrNoMemory);
1.55 + iHeap->__DbgMarkStart();
1.56 + iFontStore = CFontStore::NewL(iHeap);
1.57 + InstallRasterizerL();
1.58 + AddFileL();
1.59 + }
1.60 +
1.61 +CTFontMetrics::~CTFontMetrics()
1.62 + {
1.63 + delete iFontStore;
1.64 + iHeap->__DbgMarkEnd(0);
1.65 + iHeap->Close();
1.66 + User::Heap().Check();
1.67 + REComSession::FinalClose();
1.68 + }
1.69 +
1.70 +/**
1.71 +Create a rasterizer and install it in the font store.
1.72 +*/
1.73 +void CTFontMetrics::InstallRasterizerL()
1.74 + {
1.75 + RImplInfoPtrArray implementationArray;
1.76 + TCleanupItem cleanup(ResetAndDestroyRImplInfoPtrArray, &implementationArray);
1.77 + CleanupStack::PushL(cleanup);
1.78 + const TUid uid = {KUidOpenFontRasterizerPlunginInterface};
1.79 +
1.80 + TRAPD(error, REComSession::ListImplementationsL(uid, implementationArray));
1.81 + TEST(error == KErrNone);
1.82 + TEST(0 < implementationArray.Count());
1.83 +
1.84 + COpenFontRasterizer* rasterizer =
1.85 + COpenFontRasterizer::NewL(implementationArray[0]->ImplementationUid());
1.86 + TRAP(error, iFontStore->InstallRasterizerL(rasterizer));
1.87 + if (error)
1.88 + {
1.89 + delete rasterizer;
1.90 + TEST(error == KErrNone);
1.91 + }
1.92 + CleanupStack::PopAndDestroy(&implementationArray);
1.93 + }
1.94 +
1.95 +void CTFontMetrics::AddFileL()
1.96 + {
1.97 + iFontStore->AddFileL(KFontFilePath);
1.98 + }
1.99 +
1.100 +TOpenFontSpec CTFontMetrics::GetTOpenFontSpec()
1.101 + {
1.102 + TOpenFontSpec openFontSpec;
1.103 + openFontSpec.SetName(KTypefaceName);
1.104 + openFontSpec.SetHeight(KRequiredHeight);
1.105 + openFontSpec.SetItalic(EFalse);
1.106 + openFontSpec.SetBold(EFalse);
1.107 + return openFontSpec;
1.108 + }
1.109 +
1.110 +void CTFontMetrics::RunTestCaseL(TInt aCurTestCase)
1.111 + {
1.112 + ((CTFontMetricsStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
1.113 + switch ( aCurTestCase )
1.114 + {
1.115 + case 1:
1.116 + ((CTFontMetricsStep*)iStep)->SetTestStepID(_L("GRAPHICS-FNTSTORE-0029"));
1.117 + FontAccessInCTypefaceStore();
1.118 + break;
1.119 + case 2:
1.120 + ((CTFontMetricsStep*)iStep)->SetTestStepID(_L("GRAPHICS-FNTSTORE-0002"));
1.121 + TLanguage2GlyphSample();
1.122 + break;
1.123 + case 3:
1.124 + ((CTFontMetricsStep*)iStep)->SetTestStepID(_L("GRAPHICS-FNTSTORE-0003"));
1.125 + GetNearestFontToDesignHeightInPixels();
1.126 + break;
1.127 + case 4:
1.128 + ((CTFontMetricsStep*)iStep)->SetTestStepID(_L("GRAPHICS-FNTSTORE-0004"));
1.129 + GetNearestFontToMaxHeightInPixels();
1.130 + break;
1.131 + case 5:
1.132 + ((CTFontMetricsStep*)iStep)->SetTestStepID(_L("GRAPHICS-FNTSTORE-0030"));
1.133 + TestINC086513();
1.134 + break;
1.135 + case 6:
1.136 + ((CTFontMetricsStep*)iStep)->SetTestStepID(_L("GRAPHICS-FNTSTORE-0020"));
1.137 + TestGetNearestFontToMaxHeightInPixels();
1.138 + break;
1.139 + case 7:
1.140 + ((CTFontMetricsStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
1.141 + ((CTFontMetricsStep*)iStep)->CloseTMSGraphicsStep();
1.142 + TestComplete();
1.143 + break;
1.144 + }
1.145 + ((CTFontMetricsStep*)iStep)->RecordTestResultL();
1.146 + }
1.147 +
1.148 +/**
1.149 + @SYMTestCaseID GRAPHICS-FNTSTORE-0002
1.150 +
1.151 + @SYMPREQ PREQ533
1.152 +
1.153 + @SYMREQ REQ3800
1.154 +
1.155 + @SYMTestCaseDesc Verifying GlyphSample::TLanguage2TScript and GlyphSample::TScript2GlyphSample
1.156 + with different TLanguage values.
1.157 +
1.158 + @SYMTestPriority Critical
1.159 +
1.160 + @SYMTestStatus Implemented
1.161 +
1.162 + @SYMTestActions (1) Call TLanguage2TScript and then TScript2GlyphSample
1.163 + with boundary cases ELangTest, ELangNone, ELangMaximum.
1.164 + (2) Call TLanguage2TScript and then TScript2GlyphSample
1.165 + with languages belonging to unsupported scripts.
1.166 + (3) Call TLanguage2TScript and then TScript2GlyphSample
1.167 + with languages belonging to Latin script.
1.168 + (4) Repeat (3) for all other supported scripts.
1.169 +
1.170 + @SYMTestExpectedResults (1) and (2) - NULL
1.171 + (3) and (4) - Languages belonging to the same script should return
1.172 + the same address value pointing to the same set of glyph samples.
1.173 +*/
1.174 +void CTFontMetrics::TLanguage2GlyphSample()
1.175 + {
1.176 + // boundary cases
1.177 + TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangTest)).Ptr());
1.178 + TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangNone)).Ptr());
1.179 + TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangMaximum)).Ptr());
1.180 + // Not yet supported
1.181 + TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangAmharic)).Ptr());
1.182 + TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangTigrinya)).Ptr());
1.183 + TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangArmenian)).Ptr());
1.184 + TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangTagalog)).Ptr());
1.185 + TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangBengali)).Ptr());
1.186 + TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangBurmese)).Ptr());
1.187 + TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangGeorgian)).Ptr());
1.188 + TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangGujarati)).Ptr());
1.189 + TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangKannada)).Ptr());
1.190 + TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangKhmer)).Ptr());
1.191 + TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangLao)).Ptr());
1.192 + TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangMalayalam)).Ptr());
1.193 + TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangMongolian)).Ptr());
1.194 + TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangPunjabi)).Ptr());
1.195 + TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangSinhalese)).Ptr());
1.196 + TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangTamil)).Ptr());
1.197 + TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangTelugu)).Ptr());
1.198 + TEST(NULL == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangTibetan)).Ptr());
1.199 + // Latin
1.200 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangFrench)));
1.201 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangGerman)));
1.202 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangSpanish)));
1.203 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangItalian)));
1.204 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangSwedish)));
1.205 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangDanish)));
1.206 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangNorwegian)));
1.207 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangFinnish)));
1.208 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangAmerican)));
1.209 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangSwissFrench)));
1.210 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangSwissGerman)));
1.211 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangPortuguese)));
1.212 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangTurkish)));
1.213 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangIcelandic)));
1.214 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangHungarian)));
1.215 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangDutch)));
1.216 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangBelgianFlemish)));
1.217 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangAustralian)));
1.218 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangBelgianFrench)));
1.219 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangAustrian)));
1.220 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangNewZealand)));
1.221 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangInternationalFrench)));
1.222 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangCzech)));
1.223 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangSlovak)));
1.224 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangPolish)));
1.225 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangSlovenian)));
1.226 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangAfrikaans)));
1.227 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangAlbanian)));
1.228 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangCatalan)));
1.229 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangCroatian)));
1.230 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangCanadianEnglish)));
1.231 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangInternationalEnglish)));
1.232 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangSouthAfricanEnglish)));
1.233 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEstonian)));
1.234 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangCanadianFrench)));
1.235 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangScotsGaelic)));
1.236 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangIndonesian)));
1.237 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangIrish)));
1.238 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangSwissItalian)));
1.239 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangLatvian)));
1.240 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangLithuanian)));
1.241 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangMalay)));
1.242 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangMoldavian)));
1.243 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangNorwegianNynorsk)));
1.244 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangBrazilianPortuguese)));
1.245 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangRomanian)));
1.246 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangSomali)));
1.247 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangInternationalSpanish)));
1.248 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangLatinAmericanSpanish)));
1.249 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangSwahili)));
1.250 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangFinlandSwedish)));
1.251 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangCyprusTurkish)));
1.252 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangVietnamese)));
1.253 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangWelsh)));
1.254 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangEnglish)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangZulu)));
1.255 + // Greek
1.256 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangGreek)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangCyprusGreek)));
1.257 + // Cyrillic
1.258 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangRussian)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangBelarussian)));
1.259 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangRussian)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangBulgarian)));
1.260 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangRussian)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangKazakh)));
1.261 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangRussian)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangMacedonian)));
1.262 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangRussian)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangSerbian)));
1.263 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangRussian)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangTurkmen)));
1.264 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangRussian)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangUkrainian)));
1.265 + // Hebrew
1.266 + TEST(NULL != GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangHebrew)).Ptr());
1.267 + // Arabic
1.268 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangArabic)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangFarsi)));
1.269 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangArabic)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangUrdu)));
1.270 + // Devanagari
1.271 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangHindi)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangMarathi)));
1.272 + // Thai
1.273 + TEST(NULL != GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangThai)).Ptr());
1.274 + // HanIdeographs
1.275 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangTaiwanChinese)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangHongKongChinese)));
1.276 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangTaiwanChinese)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangPrcChinese)));
1.277 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangTaiwanChinese)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangJapanese)));
1.278 + TEST(GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangTaiwanChinese)) == GlyphSample::TScript2GlyphSample(GlyphSample::TLanguage2TScript(ELangKorean)));
1.279 + }
1.280 +
1.281 +/**
1.282 + @SYMTestCaseID GRAPHICS-FNTSTORE-0003
1.283 +
1.284 + @SYMPREQ PREQ533
1.285 +
1.286 + @SYMREQ REQ3800
1.287 +
1.288 + @SYMTestCaseDesc Verifying font's metrics created by CFontStore::GetNearestFontToDesignHeightInPixels
1.289 + with different TLanguage values.
1.290 +
1.291 + @SYMTestPriority Critical
1.292 +
1.293 + @SYMTestStatus Implemented
1.294 +
1.295 + @SYMTestActions (1) Call GetNearestFontToDesignHeightInPixels with ELangNone.
1.296 + (2) Call CFont's HeightInPixels, AscentInPixels, DescentInPixels, FontCapitalAscent,
1.297 + FontStandardDescent, FontMaxAscent, FontMaxDescent, FontMaxHeight, and FontLineGap
1.298 + to verify the font metrics of the returned font object.
1.299 + (3) Repeat (1) and (2) with a Latin-based language, a Greek-based language, and a
1.300 + Cyrillic-based language for the TLanguage parameter.
1.301 +
1.302 + @SYMTestExpectedResults See returned values in Verify_GetNearestFontToDesignHeightInPixels.
1.303 +*/
1.304 +void CTFontMetrics::GetNearestFontToDesignHeightInPixels()
1.305 + {
1.306 + INFO_PRINTF3(_L("iKPixelWidthInTwips = %d; iKPixelHeightInTwips = %d"),
1.307 + iFontStore->iKPixelWidthInTwips, iFontStore->iKPixelHeightInTwips);
1.308 +
1.309 + TOpenFontSpec openFontSpec = GetTOpenFontSpec();
1.310 +
1.311 + INFO_PRINTF1(_L("GetNearestFontToDesignHeightInPixels().ELangNone"));
1.312 + CFont* font = NULL;
1.313 + openFontSpec.SetScriptTypeForMetrics(ELangNone);
1.314 + iFontStore->GetNearestFontToDesignHeightInPixels(font, openFontSpec);
1.315 + Verify_GetNearestFontToDesignHeightInPixels(*font, openFontSpec.ScriptTypeForMetrics());
1.316 + iFontStore->ReleaseFont(font);
1.317 +
1.318 + INFO_PRINTF1(_L("GetNearestFontToDesignHeightInPixels().ELangFinnish"));
1.319 + font = NULL;
1.320 + openFontSpec.SetScriptTypeForMetrics(ELangFinnish);
1.321 + iFontStore->GetNearestFontToDesignHeightInPixels(font, openFontSpec);
1.322 + Verify_GetNearestFontToDesignHeightInPixels(*font, openFontSpec.ScriptTypeForMetrics());
1.323 + iFontStore->ReleaseFont(font);
1.324 +
1.325 + INFO_PRINTF1(_L("GetNearestFontToDesignHeightInPixels().ELangGreek"));
1.326 + font = NULL;
1.327 + openFontSpec.SetScriptTypeForMetrics(ELangGreek);
1.328 + iFontStore->GetNearestFontToDesignHeightInPixels(font, openFontSpec);
1.329 + Verify_GetNearestFontToDesignHeightInPixels(*font, openFontSpec.ScriptTypeForMetrics());
1.330 + iFontStore->ReleaseFont(font);
1.331 +
1.332 + INFO_PRINTF1(_L("GetNearestFontToDesignHeightInPixels().ELangRussian"));
1.333 + font = NULL;
1.334 + openFontSpec.SetScriptTypeForMetrics(ELangRussian);
1.335 + iFontStore->GetNearestFontToDesignHeightInPixels(font, openFontSpec);
1.336 + Verify_GetNearestFontToDesignHeightInPixels(*font, openFontSpec.ScriptTypeForMetrics());
1.337 + iFontStore->ReleaseFont(font);
1.338 + }
1.339 +
1.340 +void CTFontMetrics::Verify_GetNearestFontToDesignHeightInPixels(const CFont& aFont, TInt aScript)
1.341 + {
1.342 + VerifyTypefaceNameAndID(aFont);
1.343 + INFO_PRINTF4(_L("HeightInPixels() = %d; AscentInPixels() = %d; DescentInPixels() = %d"),
1.344 + aFont.HeightInPixels(), aFont.AscentInPixels(), aFont.DescentInPixels());
1.345 + INFO_PRINTF4(_L("FontCapitalAscent() = %d; FontStandardDescent() = %d; FontMaxAscent() = %d"),
1.346 + aFont.FontCapitalAscent(), aFont.FontStandardDescent(), aFont.FontMaxAscent());
1.347 + INFO_PRINTF4(_L("FontMaxDescent() = %d; FontMaxHeight() = %d; FontLineGap() = %d"),
1.348 + aFont.FontMaxDescent(), aFont.FontMaxHeight(), aFont.FontLineGap());
1.349 + // Old metrics
1.350 + TEST(KRequiredHeight == aFont.HeightInPixels());
1.351 + TEST(19 == aFont.AscentInPixels());
1.352 + TEST(KRequiredHeight - aFont.AscentInPixels() == aFont.DescentInPixels());
1.353 + // New metrics
1.354 + TEST(18 == aFont.FontCapitalAscent());
1.355 + TEST(5 == aFont.FontStandardDescent());
1.356 + if (GlyphSample::EScriptNone == aScript ||
1.357 + GlyphSample::EScriptLatin == aScript ||
1.358 + GlyphSample::EScriptGreek == aScript ||
1.359 + GlyphSample::EScriptCyrillic == aScript)
1.360 + {
1.361 + TEST(28 == aFont.FontMaxAscent());
1.362 + TEST(8 == aFont.FontMaxDescent());
1.363 + TEST(42 == aFont.FontLineGap());
1.364 + }
1.365 + else TEST(1 == 0);
1.366 + TEST(aFont.FontMaxAscent() + aFont.FontMaxDescent() == aFont.FontMaxHeight());
1.367 + INFO_PRINTF2(_L("MaxCharWidthInPixels() returns %d"), aFont.MaxCharWidthInPixels());
1.368 + }
1.369 +
1.370 +/**
1.371 + @SYMTestCaseID GRAPHICS-FNTSTORE-0004
1.372 +
1.373 + @SYMPREQ PREQ533
1.374 +
1.375 + @SYMREQ REQ3800
1.376 +
1.377 + @SYMTestCaseDesc Verifying font's metrics created by CFontStore::GetNearestFontToMaxHeightInPixels
1.378 + with different TLanguage values.
1.379 +
1.380 + @SYMTestPriority Critical
1.381 +
1.382 + @SYMTestStatus Implemented
1.383 +
1.384 + @SYMTestActions (1) Call GetNearestFontToMaxHeightInPixels with ELangNone.
1.385 + (2) Call CFont's HeightInPixels, AscentInPixels, DescentInPixels, FontCapitalAscent,
1.386 + FontStandardDescent, FontMaxAscent, FontMaxDescent, FontMaxHeight, and FontLineGap
1.387 + to verify the font metrics of the returned font object.
1.388 + (3) Repeat (1) and (2) with a Latin-based language, a Greek-based language, and a
1.389 + Cyrillic-based language for the TLanguage parameter.
1.390 +
1.391 + @SYMTestExpectedResults See returned values in Verify_GetNearestFontToMaxHeightInPixels.
1.392 +*/
1.393 +void CTFontMetrics::GetNearestFontToMaxHeightInPixels()
1.394 + {
1.395 + TOpenFontSpec openFontSpec = GetTOpenFontSpec();
1.396 +
1.397 + INFO_PRINTF1(_L("GetNearestFontToMaxHeightInPixels().ELangNone"));
1.398 + CFont* font = NULL;
1.399 + openFontSpec.SetScriptTypeForMetrics(ELangNone);
1.400 + iFontStore->GetNearestFontToMaxHeightInPixels(font, openFontSpec, KRequiredHeight);
1.401 + Verify_GetNearestFontToMaxHeightInPixels(*font, openFontSpec.ScriptTypeForMetrics());
1.402 + iFontStore->ReleaseFont(font);
1.403 +
1.404 + INFO_PRINTF1(_L("GetNearestFontToMaxHeightInPixels().ELangFinnish"));
1.405 + font = NULL;
1.406 + openFontSpec.SetScriptTypeForMetrics(ELangFinnish);
1.407 + iFontStore->GetNearestFontToMaxHeightInPixels(font, openFontSpec, KRequiredHeight);
1.408 + Verify_GetNearestFontToMaxHeightInPixels(*font, openFontSpec.ScriptTypeForMetrics());
1.409 + iFontStore->ReleaseFont(font);
1.410 +
1.411 + INFO_PRINTF1(_L("GetNearestFontToMaxHeightInPixels().ELangGreek"));
1.412 + font = NULL;
1.413 + openFontSpec.SetScriptTypeForMetrics(ELangGreek);
1.414 + iFontStore->GetNearestFontToMaxHeightInPixels(font, openFontSpec, KRequiredHeight);
1.415 + Verify_GetNearestFontToMaxHeightInPixels(*font, openFontSpec.ScriptTypeForMetrics());
1.416 + iFontStore->ReleaseFont(font);
1.417 +
1.418 + INFO_PRINTF1(_L("GetNearestFontToMaxHeightInPixels().ELangRussian"));
1.419 + font = NULL;
1.420 + openFontSpec.SetScriptTypeForMetrics(ELangRussian);
1.421 + iFontStore->GetNearestFontToMaxHeightInPixels(font, openFontSpec, KRequiredHeight);
1.422 + Verify_GetNearestFontToMaxHeightInPixels(*font, openFontSpec.ScriptTypeForMetrics());
1.423 + iFontStore->ReleaseFont(font);
1.424 + }
1.425 +
1.426 +void CTFontMetrics::Verify_GetNearestFontToMaxHeightInPixels(const CFont& aFont, TInt aScript)
1.427 + {
1.428 + VerifyTypefaceNameAndID(aFont);
1.429 + INFO_PRINTF4(_L("HeightInPixels() = %d; AscentInPixels() = %d; DescentInPixels() = %d"),
1.430 + aFont.HeightInPixels(), aFont.AscentInPixels(), aFont.DescentInPixels());
1.431 + INFO_PRINTF4(_L("FontCapitalAscent() = %d; FontStandardDescent() = %d; FontMaxAscent() = %d"),
1.432 + aFont.FontCapitalAscent(), aFont.FontStandardDescent(), aFont.FontMaxAscent());
1.433 + INFO_PRINTF4(_L("FontMaxDescent() = %d; FontMaxHeight() = %d; FontLineGap() = %d"),
1.434 + aFont.FontMaxDescent(), aFont.FontMaxHeight(), aFont.FontLineGap());
1.435 + if (GlyphSample::EScriptNone == aScript)
1.436 + {
1.437 + // Old metrics
1.438 + TEST(16 == aFont.HeightInPixels());
1.439 + TEST(13 == aFont.AscentInPixels());
1.440 + TEST(16 - 13 == aFont.DescentInPixels());
1.441 + // New metrics
1.442 + TEST(12 == aFont.FontCapitalAscent());
1.443 + TEST(3 == aFont.FontStandardDescent());
1.444 + TEST(19 == aFont.FontMaxAscent());
1.445 + TEST(6 == aFont.FontMaxDescent());
1.446 + TEST(KRequiredHeight + 1 == aFont.FontMaxHeight());
1.447 + TEST(31 == aFont.FontLineGap());
1.448 + }
1.449 + else if (GlyphSample::EScriptLatin == aScript ||
1.450 + GlyphSample::EScriptGreek == aScript ||
1.451 + GlyphSample::EScriptCyrillic == aScript)
1.452 + {
1.453 + // Old metrics
1.454 + TEST(24 == aFont.HeightInPixels());
1.455 + TEST(19 == aFont.AscentInPixels());
1.456 + TEST(24 - 19 == aFont.DescentInPixels());
1.457 + // New metrics
1.458 + TEST(18 == aFont.FontCapitalAscent());
1.459 + TEST(5 == aFont.FontStandardDescent());
1.460 + TEST(28 == aFont.FontMaxAscent());
1.461 + TEST(8 == aFont.FontMaxDescent());
1.462 + TEST(KRequiredHeight + 12 == aFont.FontMaxHeight());
1.463 + TEST(42 == aFont.FontLineGap());
1.464 + }
1.465 + else TEST(1 == 0);
1.466 + INFO_PRINTF2(_L("MaxCharWidthInPixels() returns %d"), aFont.MaxCharWidthInPixels());
1.467 + }
1.468 +
1.469 +void CTFontMetrics::VerifyTypefaceNameAndID(const CFont& aFont)
1.470 + {
1.471 + const TUid uid = {268435523};
1.472 + TEST(uid == aFont.TypeUid());
1.473 + TEST(!aFont.FontSpecInTwips().iTypeface.iName.CompareC(KTypefaceName));
1.474 + }
1.475 +
1.476 +/**
1.477 + @SYMTestCaseID
1.478 + GRAPHICS-FNTSTORE-0029
1.479 +
1.480 + @SYMTestCaseDesc
1.481 + Tests if CTypefaceStore::iFontAccess generates false positives and
1.482 + thus prevents GetNearestFontToDesignHeightInPixels from returning the correct fonts.
1.483 +
1.484 + @SYMTestActions
1.485 + 1. Creates a TOpenFontSpec object.
1.486 + 2. Sets name, height, italic and bold
1.487 + 3. Setting design height to some arbitrary value.
1.488 + 4. Gets the font which is the nearest to the given font specification.
1.489 + 5. Checks for errors.
1.490 + 6. Verifies that existing font object created with the GetNearestFontToDesignHeightInPixels
1.491 + (having the wrong font metrics) should not prevent us from getting a new font object
1.492 + with the GetNearestFontToMaxHeightInPixels.
1.493 + 7. Calling the GetNearestFontToMaxHeightInPixels function with
1.494 + different languages should still refer to the same font object,
1.495 + unless the language has an impact on metrics.
1.496 +
1.497 + @SYMTestExpectedResults
1.498 + Test should pass
1.499 +*/
1.500 +void CTFontMetrics::FontAccessInCTypefaceStore()
1.501 + {
1.502 + TOpenFontSpec openFontSpec = GetTOpenFontSpec();
1.503 + const TInt KMaxHeight = 24;
1.504 +
1.505 + TInt rc = KErrGeneral;
1.506 +
1.507 + CFont* font01 = NULL;
1.508 + rc = iFontStore->GetNearestFontToDesignHeightInPixels(font01, openFontSpec);
1.509 + TEST(KErrNone == rc);
1.510 + TEST(NULL != font01);
1.511 +
1.512 + CFont* font02 = NULL;
1.513 + rc = iFontStore->GetNearestFontToDesignHeightInPixels(font02, openFontSpec);
1.514 + TEST(KErrNone == rc);
1.515 + TEST(NULL != font02);
1.516 +
1.517 + CFont* font03 = NULL;
1.518 + rc = iFontStore->GetNearestFontToMaxHeightInPixels(font03, openFontSpec, KMaxHeight);
1.519 + TEST(KErrNone == rc);
1.520 + TEST(NULL != font03);
1.521 +
1.522 + // Setting design height to some arbitrary value
1.523 + CFont* font04 = NULL;
1.524 + openFontSpec.SetHeight(0);
1.525 + rc = iFontStore->GetNearestFontToMaxHeightInPixels(font04, openFontSpec, KMaxHeight);
1.526 + TEST(KErrNone == rc);
1.527 + TEST(NULL != font04);
1.528 +
1.529 + // Setting design height to some arbitrary value
1.530 + CFont* font05 = NULL;
1.531 + openFontSpec.SetHeight(font03->HeightInPixels());
1.532 + rc = iFontStore->GetNearestFontToMaxHeightInPixels(font05, openFontSpec, KMaxHeight);
1.533 + TEST(KErrNone == rc);
1.534 + TEST(NULL != font05);
1.535 +
1.536 + // Setting design height to that of an old-API generated font object
1.537 + CFont* font06 = NULL;
1.538 + openFontSpec.SetHeight(font01->HeightInPixels());
1.539 + rc = iFontStore->GetNearestFontToMaxHeightInPixels(font06, openFontSpec, KMaxHeight);
1.540 + TEST(KErrNone == rc);
1.541 + TEST(NULL != font06);
1.542 +
1.543 + CFont* font07 = NULL;
1.544 + openFontSpec.SetScriptTypeForMetrics(ELangEnglish);
1.545 + rc = iFontStore->GetNearestFontToMaxHeightInPixels(font07, openFontSpec, KMaxHeight);
1.546 + TEST(KErrNone == rc);
1.547 + TEST(NULL != font07);
1.548 +
1.549 + CFont* font08 = NULL;
1.550 + openFontSpec.SetScriptTypeForMetrics(ELangSwedish);
1.551 + rc = iFontStore->GetNearestFontToMaxHeightInPixels(font08, openFontSpec, KMaxHeight);
1.552 + TEST(KErrNone == rc);
1.553 + TEST(NULL != font08);
1.554 +
1.555 + // Using the same font specifications should return font objects from cache.
1.556 + TEST(font01 == font02);
1.557 + TEST(font03 == font04);
1.558 + TEST(font03 == font05);
1.559 + // Design height should be ignored when calling the GetNearestFontToMaxHeight... API.
1.560 + TEST(font01 != font03);
1.561 + // The existing font object created with the GetNearestFontToDesignHeight... API
1.562 + // (thus having the wrong font metrics) should NOT prevent us from getting a new font
1.563 + // object with the GetNearestFontToMaxHeight... API (with improved metrics.)
1.564 + TEST(font01 != font06);
1.565 + // Languages belonging to the same script should return the same font object.
1.566 + TEST(font07 == font08);
1.567 + // Calling the GetNearestFontToMaxHeight... API with
1.568 + // languages belonging to different scripts may refer to different font objects.
1.569 + // (Actually different with DejaVu fonts between no script specified and latin script.)
1.570 + TEST(font06 != font07);
1.571 +
1.572 + iFontStore->ReleaseFont(font01);
1.573 + iFontStore->ReleaseFont(font02);
1.574 + iFontStore->ReleaseFont(font03);
1.575 + iFontStore->ReleaseFont(font04);
1.576 + iFontStore->ReleaseFont(font05);
1.577 + iFontStore->ReleaseFont(font06);
1.578 + iFontStore->ReleaseFont(font07);
1.579 + iFontStore->ReleaseFont(font08);
1.580 + }
1.581 +
1.582 +/**
1.583 + @SYMTestCaseID
1.584 + GRAPHICS-FNTSTORE-0030
1.585 +
1.586 + @SYMTestCaseDesc
1.587 + Tests if two loaded fonts are the same if their glyphs are the same.
1.588 + Second request for the font with different flags should give reference to the
1.589 + same font.
1.590 +
1.591 + @SYMTestActions
1.592 + 1. Creates a TOpenFontSpec object and sets name, height, italic and bold.
1.593 + 2. Gets the font which is the nearest to the given font specification.
1.594 + 3. Checks for errors.
1.595 + 4. Gets the font specification in twips.
1.596 + 5. Gets the font which is the nearest to the given font specification.
1.597 + 6. Checks for errors.
1.598 + 7. Verifies the fonts are the same.
1.599 + 8. Releases the fonts.
1.600 +
1.601 + @SYMTestExpectedResults
1.602 + The fonts should be the same.
1.603 +*/
1.604 +void CTFontMetrics::TestINC086513()
1.605 + {
1.606 + TOpenFontSpec openFontSpec = GetTOpenFontSpec();
1.607 + CFont* theFont = NULL;
1.608 + TInt rc = iFontStore->GetNearestFontToDesignHeightInPixels(theFont, openFontSpec);
1.609 + TEST(KErrNone == rc);
1.610 + TFontSpec fontSpec = theFont->FontSpecInTwips();
1.611 + TTypeface typeface;
1.612 + typeface.iName=fontSpec.iTypeface.iName;
1.613 + typeface.SetIsProportional(!fontSpec.iTypeface.IsProportional());
1.614 + CFont* theFont1 = NULL;
1.615 + rc = iFontStore->GetNearestFontToDesignHeightInPixels(theFont1, openFontSpec);
1.616 + TEST(rc==KErrNone);
1.617 +
1.618 + TEST(theFont1==theFont);//fonts should be the same
1.619 +
1.620 + iFontStore->ReleaseFont(theFont1);
1.621 + iFontStore->ReleaseFont(theFont);
1.622 + }
1.623 +
1.624 +/*
1.625 +This test first marks a font as 'in use' and later tries to
1.626 +delete all the fonts in the font store by sending the special
1.627 +code KNullUid. Before this would crash the server because
1.628 +there are still fonts in use, but now it would just return safely.
1.629 +*/
1.630 +void CTFontMetrics::TestPDEF099034()
1.631 + {
1.632 + INFO_PRINTF1(_L("Trying to remove all fonts in the font store\r\n"));
1.633 +
1.634 + TOpenFontSpec openFontSpec = GetTOpenFontSpec();
1.635 + CFont* font = NULL;
1.636 + TInt ret = iFontStore->GetNearestFontToDesignHeightInPixels(font, openFontSpec);
1.637 + TEST(ret == KErrNone);
1.638 +
1.639 + TUid uid;
1.640 + uid.iUid=0;
1.641 + iFontStore->RemoveFile(uid);
1.642 +
1.643 + iFontStore->ReleaseFont(font);
1.644 + }
1.645 +
1.646 +/**
1.647 + @SYMTestCaseID GRAPHICS-FNTSTORE-0020
1.648 +
1.649 + @SYMDEF DEF101441
1.650 +
1.651 + @SYMTestCaseDesc Tests GetNearestFontToMaxHeightInPixels with boundary max height and above.
1.652 + Tests GetNearestFontToMaxHeightInPixels with boundary min height i,e 1.
1.653 +
1.654 + @SYMTestPriority High
1.655 +
1.656 + @SYMTestStatus Implemented
1.657 +
1.658 + @SYMTestActions 1. Call GetNearestFontToMaxHeightInPixels with max height as 1025
1.659 + 2 Call GetNearestFontToMaxHeightInPixels with max height as 1
1.660 + 3. Call GetNearestFontToMaxHeightInPixels with max height as 1024
1.661 + API Calls:
1.662 + CFontStore::GetNearestFontToMaxHeightInPixels()
1.663 +
1.664 + @SYMTestExpectedResults 1. For first call it should return KErrTooBig
1.665 + 2. For second call it should return KErrArgument
1.666 + 3. For Third call it should create the font with out any problem
1.667 + return KErrNone.
1.668 +*/
1.669 +void CTFontMetrics::TestGetNearestFontToMaxHeightInPixels()
1.670 + {
1.671 + TOpenFontSpec openFontSpec = GetTOpenFontSpec();
1.672 + CFont* theFont = NULL;
1.673 +
1.674 + TInt rc = iFontStore->GetNearestFontToMaxHeightInPixels(theFont, openFontSpec, 1025);
1.675 + TEST(KErrTooBig == rc);
1.676 + TEST(NULL == theFont);
1.677 +
1.678 + rc = iFontStore->GetNearestFontToMaxHeightInPixels(theFont, openFontSpec, 1);
1.679 + TEST(KErrArgument == rc);
1.680 + TEST(NULL == theFont);
1.681 +
1.682 + rc = iFontStore->GetNearestFontToMaxHeightInPixels(theFont, openFontSpec, 1024);
1.683 + TEST(NULL != theFont);
1.684 +
1.685 + iFontStore->ReleaseFont(theFont);
1.686 + }
1.687 +
1.688 +//--------------
1.689 +__CONSTRUCT_STEP__(FontMetrics)