fontservices/textbase/tgdi/TTYPES.H
changeset 45 662fa7de7023
equal deleted inserted replaced
41:ea44a32a96bc 45:662fa7de7023
       
     1 // Copyright (c) 1998-2010 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 /**
       
    17  @file
       
    18  @test
       
    19  @internalComponent Internal Symbian test code
       
    20 */
       
    21 
       
    22 #ifndef __TTYPES_H__
       
    23 #define __TTYPES_H__
       
    24 
       
    25 #include <gdi.h>
       
    26 #include "TGraphicsHarness.h"
       
    27 
       
    28 class CTTypes : public CTGraphicsBase
       
    29 	{
       
    30 public:
       
    31 	CTTypes(CTestStep* aStep);
       
    32 	~CTTypes();
       
    33 	void InitialiseWriteStream();
       
    34 	void ResetWriteStream();
       
    35 	void InitialiseReadStream();
       
    36 	void ResetReadStream();
       
    37 
       
    38 protected:
       
    39 //from 	CTGraphicsStep
       
    40 	virtual void RunTestCaseL(TInt aCurTestCase);
       
    41 	virtual void ConstructL();
       
    42 	};
       
    43 
       
    44 class MTestMap : public MGraphicsDeviceMap
       
    45 	{
       
    46 	virtual TInt HorizontalTwipsToPixels(TInt aTwips) const {return(aTwips);}
       
    47 	virtual TInt VerticalTwipsToPixels(TInt aTwips) const {return(aTwips);}
       
    48 	virtual TInt HorizontalPixelsToTwips(TInt aPixels) const {return(aPixels);}
       
    49 	virtual TInt VerticalPixelsToTwips(TInt aPixels) const {return(aPixels);}
       
    50 	TInt GetNearestFontInTwips(CFont*&, const TFontSpec&) { return KErrNotSupported; }
       
    51 	virtual void ReleaseFont(CFont*) {}
       
    52 	};
       
    53 
       
    54 class CTestPicture : public CPicture
       
    55 	{
       
    56 public:
       
    57 	virtual void Draw(CGraphicsContext&,const TPoint&,const TRect&,MGraphicsDeviceMap*) const {}
       
    58 	virtual void ExternalizeL(RWriteStream& /*aStream*/) const {}
       
    59 	virtual void GetOriginalSizeInTwips(TSize& aSize) const {aSize.iWidth=100;aSize.iHeight=100;}
       
    60 	virtual TBool NativePixelSize(TSize& aSize) { aSize = iSize; return ETrue; }
       
    61 	TSize iSize;
       
    62 	};
       
    63 
       
    64 class CTestPicture2 : public CPicture
       
    65 	{
       
    66 public:
       
    67 	virtual void Draw(CGraphicsContext&,const TPoint&,const TRect&,MGraphicsDeviceMap*) const {}
       
    68 	virtual void ExternalizeL(RWriteStream& /*aStream*/) const {}
       
    69 	virtual void GetOriginalSizeInTwips(TSize& aSize) const {aSize.iWidth=100;aSize.iHeight=100;}
       
    70 	};
       
    71 
       
    72 class TestPicture
       
    73 	{
       
    74 public:
       
    75 	TestPicture(CTTypes* aTest);
       
    76 	~TestPicture();
       
    77 	void Test();
       
    78 private:
       
    79 	CTestPicture* iPicture;
       
    80 	CTTypes* iTest;
       
    81 	};
       
    82 
       
    83 class CTestPalette : public CPalette
       
    84 	{
       
    85 public:
       
    86 	enum {eNumColors=256};
       
    87 public:
       
    88 	inline static CTestPalette* NewL() {return STATIC_CAST(CTestPalette*,CPalette::NewL(eNumColors));}
       
    89 	TBool TestGetPtr();
       
    90 	};
       
    91 
       
    92 class TestPalette
       
    93 	{
       
    94 public:
       
    95 	TestPalette(CTTypes* aTest);
       
    96 	~TestPalette();
       
    97 	void Test();
       
    98 	void TestGeneral();
       
    99 	void TestDefaults();
       
   100 	void TestGetPtr();
       
   101 private:
       
   102 	CPalette* iPalette;
       
   103 	CTestPalette* iPalette2;
       
   104 	CTTypes* iTest;
       
   105 	};
       
   106 
       
   107 class TTestFontAccess
       
   108 	{
       
   109 public:
       
   110 	CFont* iFont;
       
   111 	TInt iAccessCount;
       
   112 	};
       
   113 
       
   114 class CTestTypefaceStore : public CTypefaceStore
       
   115 	{
       
   116 public:
       
   117 	CTestTypefaceStore(CTTypes* aTest);
       
   118 	void ConstructTestL();
       
   119 	TInt Count();
       
   120 	TInt AccessCount(TInt aIndex);
       
   121 	void AddFont(CFont*);
       
   122 	void OpenFont(CFont*);
       
   123 	// CTypefaceStore implementation
       
   124 	TInt GetNearestFontInTwips(CFont*&, const TFontSpec&) { return KErrNone; }
       
   125 	TInt GetNearestFontToDesignHeightInTwips(CFont*&, const TFontSpec&) { return KErrNone; }
       
   126 	TInt GetNearestFontToMaxHeightInTwips(CFont*&, const TFontSpec&, TInt) { return KErrNone; }
       
   127 	virtual TInt NumTypefaces() const {return(0);}
       
   128 	virtual void TypefaceSupport(TTypefaceSupport&,TInt) const {}
       
   129 	virtual TInt FontHeightInTwips(TInt,TInt) const {return(0);}
       
   130 	virtual TBool IsSameFont(CFont* aFirstFont,CFont* aSecondFont) {return(aFirstFont==aSecondFont);}
       
   131 private:
       
   132 	CTTypes* iTest;	
       
   133 	};
       
   134 
       
   135 class TestTFStore
       
   136 	{
       
   137 public:
       
   138 	TestTFStore(CTTypes* aTest);
       
   139 	void Test();
       
   140 private:
       
   141 	CTestTypefaceStore iTTFStore;
       
   142 	CTTypes* iTest;
       
   143 	};
       
   144 
       
   145 class TestFontCache
       
   146 	{
       
   147 public:
       
   148 	TestFontCache(CTTypes* aTest);
       
   149 	void Test();
       
   150 	void TestL();
       
   151 public:
       
   152 	CFontCache* iCache;
       
   153 	CTTypes* iTest;
       
   154 	};
       
   155 
       
   156 class TestLine
       
   157 	{
       
   158 public:
       
   159 	TestLine(const TPoint& aStart,const TPoint& aFinish, CTTypes* aTest);
       
   160 	void Test();
       
   161 	void TestSingleStep();
       
   162 	void TestSingleScanLine();
       
   163 	void TestNextStep();
       
   164 	void TestJumpToRect();
       
   165 	void TestJumpToXCoord();
       
   166 	void TestJumpToYCoord();
       
   167 private:
       
   168 	TLinearDDA iLine;
       
   169 	TPoint iStart;
       
   170 	TPoint iFinish;
       
   171 	CTTypes* iTest;
       
   172 	};
       
   173 
       
   174 class TestTypeface
       
   175 	{
       
   176 public:
       
   177 	TestTypeface(const TBuf<KMaxTypefaceNameLength>& aName,TUint32 aFlags, CTTypes* aTest);
       
   178 	void Test();
       
   179 	void TestStream();
       
   180 private:
       
   181     TBuf<KMaxTypefaceNameLength> iName;
       
   182 	TUint32 iFlags;
       
   183 	CTTypes* iTest;
       
   184 	};
       
   185 
       
   186 class TestMargins
       
   187 	{
       
   188 public:
       
   189 	TestMargins(TInt aLeft,TInt aRight,TInt aTop,TInt aBottom, CTTypes* aTest);
       
   190 	void Test();
       
   191 	void TestStream();
       
   192 private:
       
   193 	TInt iLeft;
       
   194 	TInt iRight;
       
   195 	TInt iTop;
       
   196 	TInt iBottom;
       
   197 	CTTypes* iTest;
       
   198 	};
       
   199 
       
   200 class TestPageSpec
       
   201 	{
       
   202 public:
       
   203 	TestPageSpec(TPageSpec::TPageOrientation anOrientation,const TSize& aSize, CTTypes* aTest);
       
   204 	void Test();
       
   205 	void TestStream();
       
   206 private:
       
   207 	TSize iPortraitPageSize;
       
   208 	TPageSpec::TPageOrientation iOrientation;
       
   209 	CTTypes* iTest;
       
   210 	};
       
   211 
       
   212 class TestFontEffect
       
   213 	{
       
   214 public:
       
   215 	TestFontEffect(CTTypes* aTest) : 
       
   216 		iTest(aTest)
       
   217 		{
       
   218 		
       
   219 		}
       
   220 	void Test();
       
   221 	CTTypes* iTest;
       
   222 	};
       
   223 
       
   224 class TestTFontStyle
       
   225 	{
       
   226 public:
       
   227 	TestTFontStyle(CTTypes* aTest) : 
       
   228 		iTest(aTest)
       
   229 		{
       
   230 		
       
   231 		}
       
   232 	void Test();
       
   233 private:
       
   234 	void Test(TFontStyle& aFontStyle);
       
   235 	void TestStream(const TFontStyle& aFontStyle);
       
   236 	void TestStyle(TFontStyle& aFontStyle);
       
   237 	TBool TestPosture(TFontStyle& aFontStyle);
       
   238 	TBool TestStrokeWeight(TFontStyle& aFontStyle);
       
   239 	TBool TestPrintPosition(TFontStyle& aFontStyle);
       
   240 	TBool VerifyStyle(const TFontStyle& aFontStyle, TFontPosture aFontPosture, TFontStrokeWeight aFontStrokeWeight, TFontPrintPosition aFontPrintPosition);
       
   241 	void TestBitmapType(TFontStyle& aFontStyle);
       
   242 	void TestFontEffect(TFontStyle& aFontStyle);
       
   243 	void VerifyFontEffect(TFontStyle& aFontStyle);
       
   244 protected:
       
   245 	CTTypes* iTest;
       
   246 	};
       
   247 
       
   248 class TestFontSpec
       
   249 	{
       
   250 public:
       
   251 	TestFontSpec(const TTypeface& aTypeface,TInt aHeight,TFontStyle aStyle, CTTypes* aTest);
       
   252 	void Test();
       
   253 	void TestStream();
       
   254 private:
       
   255 	TTypeface iTypeface;
       
   256 	TInt iHeight;
       
   257 	TFontStyle iStyle;
       
   258 	CTTypes* iTest;
       
   259 	};
       
   260 
       
   261 class TestRgb
       
   262 	{
       
   263 public:
       
   264 	TestRgb(TUint8 r1,TUint8 g1,TUint8 b1, CTTypes* aTest);
       
   265 	void Test();
       
   266 private:
       
   267 	void TestSet();
       
   268 	void TestGet();
       
   269 	void TestComp();
       
   270 	void TestStream();
       
   271 private:
       
   272 	TInt iR;
       
   273 	TInt iG;
       
   274 	TInt iB;
       
   275 	CTTypes* iTest;
       
   276 	};
       
   277 
       
   278 class TestZoomFactor
       
   279 	{
       
   280 public:
       
   281 	TestZoomFactor(CTTypes* aTest, TInt aZoomFactor=TZoomFactor::EZoomOneToOne);
       
   282 	void Test();
       
   283 private:
       
   284 	TInt iZoomFactor;
       
   285 	CTTypes* iTest;
       
   286 	};
       
   287 
       
   288 class TestDisplayModeUtils
       
   289 	{
       
   290 public:
       
   291 	TestDisplayModeUtils(CTTypes* aTest) :
       
   292 		iTest(aTest)
       
   293 		{
       
   294 		}
       
   295 	void Test();
       
   296 private:
       
   297 	CTTypes* iTest;	
       
   298 	};
       
   299 
       
   300 
       
   301 
       
   302 
       
   303 class CTTypesStep : public CTGraphicsStep
       
   304 	{
       
   305 public:
       
   306 	CTTypesStep();
       
   307 protected:	
       
   308 	//from CTGraphicsStep
       
   309 	virtual CTGraphicsBase* CreateTestL();
       
   310 	};
       
   311 
       
   312 _LIT(KTTypesStep,"TTypes");
       
   313 
       
   314 
       
   315 #endif