os/graphics/graphicsdeviceinterface/gdi/tgdi/TGlyphSel.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef __TGLYPHSEL_H_
    17 #define __TGLYPHSEL_H_
    18 
    19 
    20 #include "TGraphicsContext.h"
    21 #include "TGraphicsHarness.h"
    22 
    23 
    24 class TStopWatch
    25 	{
    26 public:
    27 	inline void Start();
    28 	inline TUint Stop();
    29 private:
    30 	TTime iTime;
    31 	};
    32 
    33 void TStopWatch::Start()
    34 	{
    35 	iTime.UniversalTime();
    36 	}
    37 
    38 TUint TStopWatch::Stop()
    39 	{
    40 	TTime t;
    41 	t.UniversalTime();
    42 	TInt64 i = ((t.MicroSecondsFrom(iTime).Int64()) + 500)/1000;
    43 	return I64LOW(i);
    44 	}
    45 
    46 //	Forward declaration
    47 struct TTestInput_PositionParam6;
    48 class CTGlyphSelection : public CTGraphicsBase
    49 /**
    50  This is a unit test class. Its responsibilites are to define and
    51  execute test cases that exercise CFont::GetCharacterPosition() 
    52  functionality.
    53 @internalComponent
    54 @test
    55 */
    56 	{
    57 public:
    58 
    59 	// House keeping methods for test setup and shutdown.
    60 	CTGlyphSelection(CTestStep* aStep);
    61 	~CTGlyphSelection();
    62 protected:
    63 //from 	CTGraphicsStep
    64 	virtual void RunTestCaseL(TInt aCurTestCase);
    65 	virtual void ConstructL();
    66 	
    67 	void CreateTestGraphicsContextL();
    68 	void TestPerformance();
    69 
    70 	// Test case methods testing specific functionality.
    71 	void TestCtrlCharsIgnored();
    72 	void TestApiBoundaries();
    73 	void TestLatinChars();
    74 	void TestGlyphs(CFont* aFont, CFont::TPositionParam& aParam,
    75 		const TPtrC16& aText, const TPtrC16& aExpectedGlyphs);
    76 	
    77 	//TestIndicChars() is main function to perform testing for all Indic languages and calls all the indic language functions.
    78 	 
    79 	void TestIndicCharsL();
    80 	void TestHindiChars(CFbsFont* aFont);
    81 	void TestKannadaChars(CFbsFont* aFont);
    82 	void TestMarathiChars(CFbsFont* aFont);
    83 	void TestGujaratiChars(CFbsFont* aFont);
    84 	void TestBengaliChars(CFbsFont* aFont);
    85 	void TestTamilChars(CFbsFont* aFont);
    86 	void TestTeluguChars(CFbsFont* aFont);
    87 	void TestIndicPunctuation(CFbsFont* aFont);
    88 	void TestIndicPunctuationGlyphs(CFbsFont* aFont, CFont::TPositionParam& aParam,
    89 		const TPtrC16& aText, const TPtrC16& aExpectedGlyphs);
    90 	
    91 	//Gurumukhi and Malayalam support
    92 	void ExecuteIndicGurmukhiMalayalamTests();
    93 	void DoEachGurmukhiMalayalamCase( const TTestInput_PositionParam6* aArray, const CFbsFont& aFont );
    94 	void TestGurmukhiDigit( const CFbsFont& aFont );
    95 	void TestGurmukhiAndLatin( const CFbsFont& aFont );
    96 	void TestGurmukhiModifierAfterConsonantViramaZWJ( const CFbsFont& aFont );
    97 	void TestGurmukhiWithConsonantInitial( const CFbsFont& aFont );
    98 	void TestGurmukhiWithVowelInitial( const CFbsFont& aFont );
    99 	void TestMalayalamDigit( const CFbsFont& aFont );
   100 	void TestMalayalamAndLatin( const CFbsFont& aFont );
   101 	void TestMalayalamModifierAfterConsonantViramaZWJ( const CFbsFont& aFont );
   102 	void TestMalayalamWithConsonantInitial( const CFbsFont& aFont );
   103 	void TestMalayalamWithVowelInitial( const CFbsFont& aFont );
   104 	
   105 	void TestVietnameseChars();
   106 	void TestSoftHyphen();
   107 	void TestSurrogates();
   108 	void TestNonBmpCharsL();
   109 	void TestNonBmpCharsInGB18030(CFbsFont* aFont);
   110 	void TestCombiningLatinChars();
   111 	void TestTextDirection();
   112 	void TestAllUnicodeChars();
   113 	void TestLigaturesWithDiacritics();
   114 	void TestIsolatedCombiningLatinChars();
   115 	void TestContextInShapeInfo();
   116 
   117 	// Test cases methods testing Thai functionality.
   118 	void ExecuteThaiTests();
   119 	void TestThai_SimpleChars();
   120 	void TestThai_ValidGlyphClusters();
   121 	void TestThai_InvalidGlyphClusters();
   122 	void TestThai_INC118424();
   123 	
   124 	void TestMeasureText();
   125 
   126 	void TestCodepoint(TUint aCodepoint, CFont* aFont);
   127 	
   128 	void GenerateGurmukhiMalayalamData( const TDesC& filename, const TTestInput_PositionParam6* aArray, const CFbsFont& aFont );
   129 
   130 public:
   131 	// Context data needed for the test cases in this class.
   132 	CTestFont* iTestFont;
   133 	CTestGraphicsDevice* iTestGraphicsDevice;
   134 	CTestGraphicsContext* iTestGraphicsContext;
   135 private:
   136     RFs iFs;
   137 	};
   138 
   139 class CTGlyphSelectionStep : public CTGraphicsStep
   140 	{
   141 public:
   142 	CTGlyphSelectionStep();
   143 protected:	
   144 	//from CTGraphicsStep
   145 	virtual CTGraphicsBase* CreateTestL();
   146 	void TestSetupL();
   147 	};
   148 
   149 _LIT(KTGlyphSelectionStep,"TGlyphSelection");
   150 
   151 
   152 #endif //__TGLYPHSEL_H_
   153