graphicsdeviceinterface/gdi/tgdi/TTYPES.CPP
changeset 183 6a1564a2f3e6
parent 0 5d03bc08d59c
equal deleted inserted replaced
168:2bd88482bfe5 183:6a1564a2f3e6
     1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1998-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    21 RFs fs;
    21 RFs fs;
    22 CDirectFileStore* writestore=NULL;
    22 CDirectFileStore* writestore=NULL;
    23 CDirectFileStore* readstore=NULL;
    23 CDirectFileStore* readstore=NULL;
    24 RStoreWriteStream writestrm;
    24 RStoreWriteStream writestrm;
    25 RStoreReadStream readstrm;
    25 RStoreReadStream readstrm;
    26 
       
    27 TestTypeface::TestTypeface(
       
    28 	const TBuf<KMaxTypefaceNameLength>& aName,
       
    29 	TUint32 aFlags,
       
    30 	CTTypes* aTest) :
       
    31 	iName(aName),
       
    32 	iFlags(aFlags),
       
    33 	iTest(aTest)
       
    34 	{}
       
    35 
       
    36 /**
       
    37 	TestTypeface::Test
       
    38 	Tests functionality contained within TTypeface, settings various attributes
       
    39 	on the typeface & retrieving them to confirm the result
       
    40 	The test also streams the typeface to file, via CDirectFileStore calls & retrieves again 
       
    41 	from the store to confirm result
       
    42 */
       
    43 void TestTypeface::Test()
       
    44 	{
       
    45 	TTypeface typeface1;
       
    46 	typeface1.iName = iName;
       
    47 	const TBool prop = iFlags & TTypeface::EProportional;
       
    48 	const TBool seri = iFlags & TTypeface::ESerif;
       
    49 	const TBool symb = iFlags & TTypeface::ESymbol;
       
    50 
       
    51 	typeface1.SetIsProportional(prop);
       
    52 	iTest->TEST(typeface1.IsProportional() == prop);
       
    53 
       
    54 	typeface1.SetIsSerif(seri);
       
    55 	iTest->TEST(typeface1.IsSerif() == seri);
       
    56 	iTest->TEST(typeface1.IsProportional() == prop);
       
    57 
       
    58 	typeface1.SetIsSymbol(symb);
       
    59 	iTest->TEST(typeface1.IsSymbol() == symb);
       
    60 	iTest->TEST(typeface1.IsProportional() == prop);
       
    61 	iTest->TEST(typeface1.IsSerif() == seri);
       
    62 
       
    63 	TTypeface typeface2;
       
    64 	typeface2.iName = iName;
       
    65 	typeface2.SetIsProportional(prop);
       
    66 	typeface2.SetIsSerif(seri);
       
    67 	typeface2.SetIsSymbol(symb);
       
    68 	iTest->TEST(typeface1 == typeface2);
       
    69 
       
    70 	TestStream();
       
    71 
       
    72 	for (TInt i = 0; i < 8; i++)
       
    73 		{
       
    74 		typeface1.SetAttributes(i);
       
    75 		iTest->TEST(typeface1.Attributes() == i);
       
    76 		}
       
    77 
       
    78 	for (TInt i = 0; i < 16; i++)
       
    79 		{
       
    80 		typeface1.SetScriptTypeForMetrics(i);
       
    81 		iTest->TEST(typeface1.ScriptTypeForMetrics() == i);
       
    82 		}
       
    83 	
       
    84 	// test for PDEF124646. The test shouldn't cause any thread panic when passing in 
       
    85 	// a big value of an invalid TLanguage index. If the fix is not present this test will crash.
       
    86 	
       
    87 	for (TInt ii = 1; ii < 1000000; ii *= 10)
       
    88 		{
       
    89 		typeface1.SetScriptTypeForMetrics(static_cast<TLanguage>(ii));	
       
    90 		}
       
    91 	}
       
    92 
       
    93 /**
       
    94 	TestTypeface::TestStream
       
    95 	Called by the TestTypeface::Test method, this function
       
    96 	sets attributes on a typeface & streams the object to file, via CDirectFileStore calls.
       
    97 	It then retrieves the typeface from the store to confirm result
       
    98 */
       
    99 void TestTypeface::TestStream()
       
   100 	{
       
   101 	TTypeface typeface1;
       
   102 	typeface1.iName = iName;
       
   103 	typeface1.SetIsProportional(TTypeface::EProportional & iFlags);
       
   104 	typeface1.SetIsSerif(TTypeface::ESerif & iFlags);
       
   105 	typeface1.SetIsSymbol(TTypeface::ESymbol & iFlags);
       
   106 	iTest->InitialiseWriteStream();
       
   107 	TRAPD(ret, typeface1.ExternalizeL(writestrm));
       
   108 	iTest->TEST2(ret, KErrNone);
       
   109 	iTest->ResetWriteStream();
       
   110 
       
   111 	TTypeface typeface2;
       
   112 	iTest->InitialiseReadStream();
       
   113 	TRAP(ret, typeface2.InternalizeL(readstrm));
       
   114 	iTest->TEST2(ret, KErrNone);
       
   115 	iTest->ResetReadStream();
       
   116 	iTest->TEST(typeface1 == typeface2);
       
   117 	}
       
   118 
       
   119 TestMargins::TestMargins(TInt aLeft,TInt aRight,TInt aTop,TInt aBottom, CTTypes* aTest):
       
   120 	iLeft(aLeft),
       
   121 	iRight(aRight),
       
   122 	iTop(aTop),
       
   123 	iBottom(aBottom),
       
   124 	iTest(aTest)
       
   125 	{}
       
   126 
       
   127 /**
       
   128 	TestMargins::Test
       
   129 	Tests functionality contained within the TMargins class, settings various attributes
       
   130 	on the margins & streaming the object to file, via CDirectFileStore calls. 
       
   131 	The TMargins object is then retrieved from the store & compared within original to confirm result
       
   132 */
       
   133 void TestMargins::Test()
       
   134 	{
       
   135 	TestStream();
       
   136 	}
       
   137 
       
   138 /**
       
   139 	TestMargins::TestStream
       
   140 	Tests functionality contained within the TMargins class, settings various attributes
       
   141 	on the margins & streaming the object to file, via CDirectFileStore calls. 
       
   142 	The TMargins object is then retrieved from the store & compared within original to confirm result
       
   143 */
       
   144 void TestMargins::TestStream()
       
   145 	{
       
   146 	TMargins tm;
       
   147 	tm.iLeft=iLeft;
       
   148 	tm.iRight=iRight;
       
   149 	tm.iTop=iTop;
       
   150 	tm.iBottom=iBottom;
       
   151 	iTest->InitialiseWriteStream();
       
   152 	TRAPD(ret,tm.ExternalizeL(writestrm));
       
   153 	iTest->TEST2(ret, KErrNone);
       
   154 	iTest->ResetWriteStream();
       
   155 	TMargins tm2;
       
   156 	tm2.iLeft=0;
       
   157 	tm2.iRight=0;
       
   158 	tm2.iTop=0;
       
   159 	tm2.iBottom=0;
       
   160 	iTest->InitialiseReadStream();
       
   161 	TRAP(ret,tm2.InternalizeL(readstrm));
       
   162 	iTest->TEST2(ret, KErrNone);
       
   163 	iTest->ResetReadStream();
       
   164 	iTest->TEST(tm.iLeft==tm2.iLeft);
       
   165 	iTest->TEST(tm.iRight==tm2.iRight);
       
   166 	iTest->TEST(tm.iTop==tm2.iTop);
       
   167 	iTest->TEST(tm.iBottom==tm2.iBottom);
       
   168 	}
       
   169 	
       
   170 //---------
       
   171 /**
       
   172    @SYMTestCaseID          GRAPHICS-GDI-0001
       
   173 
       
   174    @SYMPREQ                PREQ1301
       
   175 
       
   176    @SYMREQ                 REQ5381
       
   177 
       
   178    @SYMTestCaseDesc        Getting/setting font effects with FontEffect
       
   179 
       
   180    @SYMTestPriority        Critical
       
   181 
       
   182    @SYMTestStatus          Implemented
       
   183 
       
   184    @SYMTestActions         (1) Call SetEffect with attributes EAlgorithmicBold and EFalse
       
   185                            (2) Call IsEffectOn with attribute EAlgorithmicBold to check (1)
       
   186                            (3) Call SetEffect with attributes EAlgorithmicBold and ETrue
       
   187                            (4) Call IsEffectOn with attribute EAlgorithmicBold to check (3)
       
   188                            (5) Repeat (1) - (4) with all supported font effects attributes
       
   189 
       
   190    @SYMTestExpectedResults Getters should return the expected results set by setters
       
   191                            (2) IsEffectOn should return a value EFalse
       
   192                            (4) IsEffectOn should return a value ETrue
       
   193 */
       
   194 void TestFontEffect::Test()
       
   195 	{
       
   196 	TUint32 fontEffect = FontEffect::ENone;
       
   197 	
       
   198 	FontEffect::SetEffect(FontEffect::EAlgorithmicBold, EFalse, fontEffect);
       
   199 	iTest->TEST(!FontEffect::IsEffectOn(FontEffect::EAlgorithmicBold, fontEffect));
       
   200 	FontEffect::SetEffect(FontEffect::EAlgorithmicBold, ETrue, fontEffect);
       
   201 	iTest->TEST( FontEffect::IsEffectOn(FontEffect::EAlgorithmicBold, fontEffect));
       
   202 
       
   203 	FontEffect::SetEffect(FontEffect::EDropShadow, EFalse, fontEffect);
       
   204 	iTest->TEST(!FontEffect::IsEffectOn(FontEffect::EDropShadow, fontEffect));
       
   205 	FontEffect::SetEffect(FontEffect::EDropShadow, ETrue, fontEffect);
       
   206 	iTest->TEST( FontEffect::IsEffectOn(FontEffect::EDropShadow, fontEffect));
       
   207 
       
   208 	FontEffect::SetEffect(FontEffect::EOutline, EFalse, fontEffect);
       
   209 	iTest->TEST(!FontEffect::IsEffectOn(FontEffect::EOutline, fontEffect));
       
   210 	FontEffect::SetEffect(FontEffect::EOutline, ETrue, fontEffect);
       
   211 	iTest->TEST( FontEffect::IsEffectOn(FontEffect::EOutline, fontEffect));
       
   212 
       
   213 	FontEffect::SetEffect(FontEffect::EEmbossed, EFalse, fontEffect);
       
   214 	iTest->TEST(!FontEffect::IsEffectOn(FontEffect::EEmbossed, fontEffect));
       
   215 	FontEffect::SetEffect(FontEffect::EEmbossed, ETrue, fontEffect);
       
   216 	iTest->TEST( FontEffect::IsEffectOn(FontEffect::EEmbossed, fontEffect));
       
   217 
       
   218 	FontEffect::SetEffect(FontEffect::EEngraved, EFalse, fontEffect);
       
   219 	iTest->TEST(!FontEffect::IsEffectOn(FontEffect::EEngraved, fontEffect));
       
   220 	FontEffect::SetEffect(FontEffect::EEngraved, ETrue, fontEffect);
       
   221 	iTest->TEST( FontEffect::IsEffectOn(FontEffect::EEngraved, fontEffect));
       
   222 
       
   223 	FontEffect::SetEffect(FontEffect::ESoftEdge, EFalse, fontEffect);
       
   224 	iTest->TEST(!FontEffect::IsEffectOn(FontEffect::ESoftEdge, fontEffect));
       
   225 	FontEffect::SetEffect(FontEffect::ESoftEdge, ETrue, fontEffect);
       
   226 	iTest->TEST( FontEffect::IsEffectOn(FontEffect::ESoftEdge, fontEffect));
       
   227 	}
       
   228 
       
   229 void TestTFontStyle::Test()
       
   230 	{
       
   231 	TFontStyle fontStyle00;
       
   232 	TFontStyle fontStyle01(EPostureUpright, EStrokeWeightNormal, EPrintPosNormal);
       
   233 	TFontStyle fontStyle02(EPostureItalic,  EStrokeWeightNormal, EPrintPosNormal);
       
   234 	TFontStyle fontStyle03(EPostureUpright, EStrokeWeightBold,   EPrintPosNormal);
       
   235 	TFontStyle fontStyle04(EPostureItalic,  EStrokeWeightBold,   EPrintPosNormal);
       
   236 	TFontStyle fontStyle05(EPostureUpright, EStrokeWeightNormal, EPrintPosSuperscript);
       
   237 	TFontStyle fontStyle06(EPostureItalic,  EStrokeWeightNormal, EPrintPosSuperscript);
       
   238 	TFontStyle fontStyle07(EPostureUpright, EStrokeWeightBold,   EPrintPosSuperscript);
       
   239 	TFontStyle fontStyle08(EPostureItalic,  EStrokeWeightBold,   EPrintPosSuperscript);
       
   240 	TFontStyle fontStyle09(EPostureUpright, EStrokeWeightNormal, EPrintPosSubscript);
       
   241 	TFontStyle fontStyle10(EPostureItalic,  EStrokeWeightNormal, EPrintPosSubscript);
       
   242 	TFontStyle fontStyle11(EPostureUpright, EStrokeWeightBold,   EPrintPosSubscript);
       
   243 	TFontStyle fontStyle12(EPostureItalic,  EStrokeWeightBold,   EPrintPosSubscript);
       
   244 
       
   245 	Test(fontStyle00);
       
   246 	Test(fontStyle01);
       
   247 	Test(fontStyle02);
       
   248 	Test(fontStyle03);
       
   249 	Test(fontStyle04);
       
   250 	Test(fontStyle05);
       
   251 	Test(fontStyle06);
       
   252 	Test(fontStyle07);
       
   253 	Test(fontStyle08);
       
   254 	Test(fontStyle09);
       
   255 	Test(fontStyle10);
       
   256 	Test(fontStyle11);
       
   257 	Test(fontStyle12);
       
   258 	}
       
   259 
       
   260 /**
       
   261 	TestFontStyle::Test
       
   262 	Tests functionality contained within the TFontStyle class.
       
   263 	a TFontStyle object is streamed to & from a file store (via CDirectFileStore) & the results are compared. 
       
   264 	Attributes such as Posture, Stroke, Position, BitmapType etc are set & the result verified
       
   265 */
       
   266 void TestTFontStyle::Test(TFontStyle& aFontStyle)
       
   267 	{
       
   268 	TestStream(aFontStyle);
       
   269 	TestStyle(aFontStyle);
       
   270 	TestBitmapType(aFontStyle);
       
   271 	TestFontEffect(aFontStyle);
       
   272 	}
       
   273 
       
   274 /**
       
   275 	TestFontStyle::TestStream
       
   276 	Streams a TFontStyle object is to & from a file store (via CDirectFileStore) & the results are compared. 
       
   277 */
       
   278 void TestTFontStyle::TestStream(const TFontStyle& aFontStyle)
       
   279 	{
       
   280 	iTest -> InitialiseWriteStream();
       
   281 	TRAPD(ret, aFontStyle.ExternalizeL(writestrm));
       
   282 	iTest -> TEST2(ret, KErrNone);
       
   283 	iTest -> ResetWriteStream();
       
   284 	TFontStyle fontStyle;
       
   285 	iTest -> InitialiseReadStream();
       
   286 	TRAP(ret, fontStyle.InternalizeL(readstrm));
       
   287 	iTest -> TEST2(ret, KErrNone);
       
   288 	iTest -> ResetReadStream();
       
   289 	iTest -> TEST(aFontStyle == fontStyle);
       
   290 	}
       
   291 
       
   292 /**
       
   293 	TestFontStyle::TestStyle
       
   294 	Tests key attributes of a TFontStyle object by settings Posture, Stroke, Print position & verifiying the result
       
   295 */
       
   296 void TestTFontStyle::TestStyle(TFontStyle& aFontStyle)
       
   297 	{
       
   298 	iTest -> TEST(TestPosture(aFontStyle));
       
   299 	iTest -> TEST(TestStrokeWeight(aFontStyle));
       
   300 	iTest -> TEST(TestPrintPosition(aFontStyle));
       
   301 	}
       
   302 
       
   303 /**
       
   304 	TestFontStyle::TestPosture
       
   305 	Tests Posture attribute of a TFontStyle object by setting a particular value that opposes the original posture & verifiying the new setting
       
   306 */
       
   307 TBool TestTFontStyle::TestPosture(TFontStyle& aFontStyle)
       
   308 	{
       
   309 	if (EPostureUpright == aFontStyle.Posture())
       
   310 		{
       
   311 		aFontStyle.SetPosture(EPostureItalic);
       
   312 		return VerifyStyle(aFontStyle, EPostureItalic, aFontStyle.StrokeWeight(), aFontStyle.PrintPosition());
       
   313 		}
       
   314 	else if (EPostureItalic == aFontStyle.Posture())
       
   315 		{
       
   316 		aFontStyle.SetPosture(EPostureUpright);
       
   317 		return VerifyStyle(aFontStyle, EPostureUpright, aFontStyle.StrokeWeight(), aFontStyle.PrintPosition());
       
   318 		}
       
   319 	return EFalse;
       
   320 	}
       
   321 
       
   322 /**
       
   323 	TestFontStyle::TestStrokeWeight
       
   324 	Tests Stroke attribute of a TFontStyle object by setting a particular value that opposes the original stroke & verifiying the new setting
       
   325 */
       
   326 TBool TestTFontStyle::TestStrokeWeight(TFontStyle& aFontStyle)
       
   327 	{
       
   328 	if (EStrokeWeightNormal == aFontStyle.StrokeWeight())
       
   329 		{
       
   330 		aFontStyle.SetStrokeWeight(EStrokeWeightBold);
       
   331 		return VerifyStyle(aFontStyle, aFontStyle.Posture(), EStrokeWeightBold, aFontStyle.PrintPosition());
       
   332 		}
       
   333 	else if (EStrokeWeightBold == aFontStyle.StrokeWeight())
       
   334 		{
       
   335 		aFontStyle.SetStrokeWeight(EStrokeWeightNormal);
       
   336 		return VerifyStyle(aFontStyle, aFontStyle.Posture(), EStrokeWeightNormal, aFontStyle.PrintPosition());
       
   337 		}
       
   338 	return EFalse;
       
   339 	}
       
   340 
       
   341 /**
       
   342 	TestFontStyle::TestPrintPosition
       
   343 	Tests Print Position attribute of a TFontStyle object by setting a particular value that opposes the original position & verifiying the new setting
       
   344 */
       
   345 TBool TestTFontStyle::TestPrintPosition(TFontStyle& aFontStyle)
       
   346 	{
       
   347 	if (EPrintPosNormal == aFontStyle.PrintPosition())
       
   348 		{
       
   349 		aFontStyle.SetPrintPosition(EPrintPosSuperscript);
       
   350 		return VerifyStyle(aFontStyle, aFontStyle.Posture(), aFontStyle.StrokeWeight(), EPrintPosSuperscript);
       
   351 		}
       
   352 	else if (EPrintPosSuperscript == aFontStyle.PrintPosition())
       
   353 		{
       
   354 		aFontStyle.SetPrintPosition(EPrintPosSubscript);
       
   355 		return VerifyStyle(aFontStyle, aFontStyle.Posture(), aFontStyle.StrokeWeight(), EPrintPosSubscript);
       
   356 		}
       
   357 	else if (EPrintPosSubscript == aFontStyle.PrintPosition())
       
   358 		{
       
   359 		aFontStyle.SetPrintPosition(EPrintPosNormal);
       
   360 		return VerifyStyle(aFontStyle, aFontStyle.Posture(), aFontStyle.StrokeWeight(), EPrintPosNormal);
       
   361 		}
       
   362 	return EFalse;
       
   363 	}
       
   364 
       
   365 /**
       
   366 	TestFontStyle::VerifyStyle
       
   367 	Verifies the various attributes in a TFontStyle object
       
   368 */
       
   369 TBool TestTFontStyle::VerifyStyle(
       
   370 	const TFontStyle&	aFontStyle,
       
   371 	TFontPosture		aFontPosture,
       
   372 	TFontStrokeWeight	aFontStrokeWeight,
       
   373 	TFontPrintPosition	aFontPrintPosition)
       
   374 	{
       
   375 	return
       
   376 		aFontPosture       == aFontStyle.Posture() &&
       
   377 		aFontStrokeWeight  == aFontStyle.StrokeWeight() &&
       
   378 		aFontPrintPosition == aFontStyle.PrintPosition();
       
   379 	}
       
   380 
       
   381 /**
       
   382 	TestFontStyle::TestBitmapType
       
   383 	Sets the BitmapType attribute for a TFontStyle object to different values & verifies the result is recorded
       
   384 */
       
   385 void TestTFontStyle::TestBitmapType(TFontStyle& aFontStyle)
       
   386 	{
       
   387 	aFontStyle.SetBitmapType(EDefaultGlyphBitmap);
       
   388 	iTest -> TEST(EDefaultGlyphBitmap == aFontStyle.BitmapType());
       
   389 	aFontStyle.SetBitmapType(EMonochromeGlyphBitmap);
       
   390 	iTest -> TEST(EMonochromeGlyphBitmap == aFontStyle.BitmapType());
       
   391 	aFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
       
   392 	iTest -> TEST(EAntiAliasedGlyphBitmap == aFontStyle.BitmapType());
       
   393 	}
       
   394 
       
   395 /**
       
   396    @SYMTestCaseID          GRAPHICS-GDI-0002
       
   397 
       
   398    @SYMPREQ                PREQ1301
       
   399 
       
   400    @SYMREQ                 REQ5381
       
   401 
       
   402    @SYMTestCaseDesc        Getting/setting font effects on TFontStyle
       
   403 
       
   404    @SYMTestPriority        Critical
       
   405 
       
   406    @SYMTestStatus          Implemented
       
   407 
       
   408    @SYMTestActions         (1) Call SetEffects with attributes EAlgorithmicBold and EFalse
       
   409                            (2) Call IsEffectOn with attribute EAlgorithmicBold to check (1)
       
   410                            (3) Call SetEffects with attributes EAlgorithmicBold and ETrue
       
   411                            (4) Call IsEffectOn with attribute EAlgorithmicBold to check (3)
       
   412                            (5) Call SetEffects/Effects to verify the attribute set in (3)
       
   413                            (6) Repeat (1) - (5) with all supported font effects attributes
       
   414 
       
   415    @SYMTestExpectedResults Getters should return the expected results set by setters
       
   416                            (2) IsEffectOn should return a value EFalse
       
   417                            (4) IsEffectOn should return a value ETrue
       
   418                            (5) Effects should return the value set by SetEffects
       
   419 */
       
   420 void TestTFontStyle::TestFontEffect(TFontStyle& aFontStyle)
       
   421 	{
       
   422 	aFontStyle.SetEffects(FontEffect::EAlgorithmicBold, EFalse);
       
   423 	iTest -> TEST(!aFontStyle.IsEffectOn(FontEffect::EAlgorithmicBold));
       
   424 	aFontStyle.SetEffects(FontEffect::EAlgorithmicBold, ETrue);
       
   425 	iTest -> TEST( aFontStyle.IsEffectOn(FontEffect::EAlgorithmicBold));
       
   426 	VerifyFontEffect(aFontStyle);
       
   427 
       
   428 	aFontStyle.SetEffects(FontEffect::EDropShadow, EFalse);
       
   429 	iTest -> TEST(!aFontStyle.IsEffectOn(FontEffect::EDropShadow));
       
   430 	aFontStyle.SetEffects(FontEffect::EDropShadow, ETrue);
       
   431 	iTest -> TEST( aFontStyle.IsEffectOn(FontEffect::EDropShadow));
       
   432 	VerifyFontEffect(aFontStyle);
       
   433 
       
   434 	aFontStyle.SetEffects(FontEffect::EOutline, EFalse);
       
   435 	iTest -> TEST(!aFontStyle.IsEffectOn(FontEffect::EOutline));
       
   436 	aFontStyle.SetEffects(FontEffect::EOutline, ETrue);
       
   437 	iTest -> TEST( aFontStyle.IsEffectOn(FontEffect::EOutline));
       
   438 	VerifyFontEffect(aFontStyle);
       
   439 
       
   440 	aFontStyle.SetEffects(FontEffect::EEmbossed, EFalse);
       
   441 	iTest -> TEST(!aFontStyle.IsEffectOn(FontEffect::EEmbossed));
       
   442 	aFontStyle.SetEffects(FontEffect::EEmbossed, ETrue);
       
   443 	iTest -> TEST( aFontStyle.IsEffectOn(FontEffect::EEmbossed));
       
   444 	VerifyFontEffect(aFontStyle);
       
   445 
       
   446 	aFontStyle.SetEffects(FontEffect::EEngraved, EFalse);
       
   447 	iTest -> TEST(!aFontStyle.IsEffectOn(FontEffect::EEngraved));
       
   448 	aFontStyle.SetEffects(FontEffect::EEngraved, ETrue);
       
   449 	iTest -> TEST( aFontStyle.IsEffectOn(FontEffect::EEngraved));
       
   450 	VerifyFontEffect(aFontStyle);
       
   451 
       
   452 	aFontStyle.SetEffects(FontEffect::ESoftEdge, EFalse);
       
   453 	iTest -> TEST(!aFontStyle.IsEffectOn(FontEffect::ESoftEdge));
       
   454 	aFontStyle.SetEffects(FontEffect::ESoftEdge, ETrue);
       
   455 	iTest -> TEST( aFontStyle.IsEffectOn(FontEffect::ESoftEdge));
       
   456 	VerifyFontEffect(aFontStyle);
       
   457 	}
       
   458 
       
   459 void TestTFontStyle::VerifyFontEffect(TFontStyle& aFontStyle)
       
   460 	{
       
   461 	const TUint32 effects = aFontStyle.Effects();
       
   462 	aFontStyle.SetEffects(effects);
       
   463 	iTest -> TEST(effects == aFontStyle.Effects());
       
   464 	}
       
   465 
       
   466 //-----------
    26 //-----------
   467 TestPageSpec::TestPageSpec(TPageSpec::TPageOrientation aOrientation,const TSize& aSize, CTTypes* aTest):
    27 TestPageSpec::TestPageSpec(TPageSpec::TPageOrientation aOrientation,const TSize& aSize, CTTypes* aTest):
   468 	iPortraitPageSize(aSize),
    28 	iPortraitPageSize(aSize),
   469 	iOrientation(aOrientation),
    29 	iOrientation(aOrientation),
   470 	iTest(aTest)
    30 	iTest(aTest)
   504 	TPageSpec::TPageOrientation tpo2=tps2.iOrientation;
    64 	TPageSpec::TPageOrientation tpo2=tps2.iOrientation;
   505 	iTest->TEST(tpo==tpo2);
    65 	iTest->TEST(tpo==tpo2);
   506 	TSize tpss=tps.iPortraitPageSize;
    66 	TSize tpss=tps.iPortraitPageSize;
   507 	TSize tpss2=tps2.iPortraitPageSize;
    67 	TSize tpss2=tps2.iPortraitPageSize;
   508 	iTest->TEST(tpss==tpss2);
    68 	iTest->TEST(tpss==tpss2);
   509 	}
       
   510 
       
   511 /**
       
   512 	TestFontSSpec::Test
       
   513 	Tests functionality contained within the TFontSpec class.
       
   514 	a TFontSpec object is streamed to & from a file store (via CDirectFileStore) & the results are compared. 
       
   515 	Attributes such as typeface, font height, style are set & the result verified
       
   516 */
       
   517 TestFontSpec::TestFontSpec(const TTypeface& aTypeface,TInt aHeight,TFontStyle aStyle, CTTypes* aTest):
       
   518 	iTypeface(aTypeface),
       
   519 	iHeight(aHeight),
       
   520 	iStyle(aStyle),
       
   521 	iTest(aTest)
       
   522 	{}
       
   523 
       
   524 void TestFontSpec::Test()
       
   525 	{
       
   526 	TFontSpec fontspec;
       
   527 	fontspec.iTypeface=iTypeface;
       
   528 	fontspec.iHeight=iHeight;
       
   529 	fontspec.iFontStyle=iStyle;
       
   530 	TFontSpec fontspec2(iTypeface.iName,iHeight);
       
   531 	fontspec2.iTypeface=iTypeface;
       
   532 	fontspec2.iFontStyle=iStyle;
       
   533 	iTest->TEST(fontspec==fontspec2);
       
   534 	TestStream();
       
   535 	}
       
   536 
       
   537 void TestFontSpec::TestStream()
       
   538 	{
       
   539 	TFontSpec fs(iTypeface.iName,iHeight);
       
   540 	fs.iTypeface=iTypeface;
       
   541 	fs.iFontStyle=iStyle;
       
   542 	iTest->InitialiseWriteStream();
       
   543 	TRAPD(ret,fs.ExternalizeL(writestrm));
       
   544 	iTest->TEST2(ret, KErrNone);
       
   545 	iTest->ResetWriteStream();
       
   546 	TFontSpec fs2;
       
   547 	iTest->InitialiseReadStream();
       
   548 	TRAP(ret,fs2.InternalizeL(readstrm));
       
   549 	iTest->TEST2(ret, KErrNone);
       
   550 	iTest->ResetReadStream();
       
   551 	iTest->TEST(fs==fs2);
       
   552 	}
    69 	}
   553 
    70 
   554 
    71 
   555 TestRgb::TestRgb(TUint8 r1,TUint8 g1,TUint8 b1, CTTypes* aTest):
    72 TestRgb::TestRgb(TUint8 r1,TUint8 g1,TUint8 b1, CTTypes* aTest):
   556 	iR(r1),
    73 	iR(r1),
   750 		__UHEAP_MARKEND;
   267 		__UHEAP_MARKEND;
   751 		}
   268 		}
   752 		break;
   269 		break;
   753 	case 2:
   270 	case 2:
   754 		{
   271 		{
   755 		INFO_PRINTF1(_L("TTypeface"));
   272 		INFO_PRINTF1(_L("TTypeface is moved to TextBase"));
   756 		TestTypeface ttf1(_L(""), 0, this);
       
   757 		TestTypeface ttf2(_L("Font name"), 1, this);
       
   758 		TestTypeface ttf3(_L("Font name"), 2, this);
       
   759 		TestTypeface ttf4(_L("Font name"), 3, this);
       
   760 		TestTypeface ttf5(_L("Font name"), 4, this);
       
   761 		TestTypeface ttf6(_L("Font name"), 5, this);
       
   762 		TestTypeface ttf7(_L("Font name"), 6, this);
       
   763 		TestTypeface ttf8(_L("Another font name"), 7, this);
       
   764 		ttf1.Test();
       
   765 		ttf2.Test();
       
   766 		ttf3.Test();
       
   767 		ttf4.Test();
       
   768 		ttf5.Test();
       
   769 		ttf6.Test();
       
   770 		ttf7.Test();
       
   771 		ttf8.Test();
       
   772 		}
   273 		}
   773 		break;
   274 		break;
   774 	case 3:
   275 	case 3:
   775 		{
   276 		{
   776 		TestMargins tm1(0,0,0,0, this);
   277 		INFO_PRINTF1(_L("TMargins is moved to TextBase"));
   777 		TestMargins tm2(10,20,30,40, this);
       
   778 		TestMargins tm3(-10,-20,-30,-40, this);
       
   779 		INFO_PRINTF1(_L("TMargins"));
       
   780 		tm1.Test();
       
   781 		tm2.Test();
       
   782 		tm3.Test();
       
   783 		}
   278 		}
   784 		break;
   279 		break;
   785 	case 4:
   280 	case 4:
   786 		{
   281 		{
   787 		TestPageSpec tps1(TPageSpec::EPortrait,TSize(0,0), this);
   282 		TestPageSpec tps1(TPageSpec::EPortrait,TSize(0,0), this);
   799 		tps6.Test();
   294 		tps6.Test();
   800 		}
   295 		}
   801 		break;
   296 		break;
   802 	case 5:
   297 	case 5:
   803 		{
   298 		{
   804 		INFO_PRINTF1(_L("FontEffect"));
   299 		INFO_PRINTF1(_L("FontEffect is moved to TextBase"));
   805         	((CTTypesStep*)iStep)->SetTestStepID(_L("GRAPHICS-GDI-0002"));
       
   806 		TestFontEffect te(this); 
       
   807 		((CTTypesStep*)iStep)->RecordTestResultL();
       
   808 		te.Test();
       
   809 		}
   300 		}
   810 		break;
   301 		break;
   811 	case 6:
   302 	case 6:
   812 		{
   303 		{
   813 		INFO_PRINTF1(_L("TFontSyle"));
   304 		INFO_PRINTF1(_L("TFontSyle is moved to TextBase"));
   814 		TestTFontStyle ts(this);
       
   815 		ts.Test();
       
   816 		}
   305 		}
   817 		break;
   306 		break;
   818 	case 7:
   307 	case 7:
   819 		{
   308 		{
   820 		TTypeface typeface;
   309 		INFO_PRINTF1(_L("TFontSpec is moved to TextBase"));
   821 		typeface.iName=_L("Font name");
       
   822 		TFontStyle fontstyle;
       
   823 		TestFontSpec tfspec(typeface,200,fontstyle, this);
       
   824 		INFO_PRINTF1(_L("TFontSpec"));
       
   825 		tfspec.Test();
       
   826 		}
   310 		}
   827 		break;
   311 		break;
   828 	case 8:
   312 	case 8:
   829 		{
   313 		{
   830 		TestLine tl1(TPoint(10,10),TPoint(90,90), this);
   314 		TestLine tl1(TPoint(10,10),TPoint(90,90), this);
   854 		tl12.Test();
   338 		tl12.Test();
   855 		}
   339 		}
   856 		break;
   340 		break;
   857 	case 9:
   341 	case 9:
   858 		{
   342 		{
   859 		INFO_PRINTF1(_L("CTypefaceStore"));
   343 		INFO_PRINTF1(_L("CTypefaceStore  is moved to TextBase"));
   860 		TestTFStore ttfs(this);
       
   861 		ttfs.Test();
       
   862 		}
   344 		}
   863 		break;
   345 		break;
   864 	case 10:
   346 	case 10:
   865 		{
   347 		{
   866 		INFO_PRINTF1(_L("CFontCache"));
   348 		INFO_PRINTF1(_L("CFontCache is moved to TextBase"));
   867 		TestFontCache tfc(this);
       
   868 		tfc.Test();
       
   869 		}
   349 		}
   870 		break;
   350 		break;
   871 	case 11:
   351 	case 11:
   872 		{
   352 		{
   873 		INFO_PRINTF1(_L("CScaleCropPicture"));
   353 		INFO_PRINTF1(_L("CScaleCropPicture"));