graphicsdeviceinterface/bitgdi/tbit/toutlineandshadowfonts.cpp
branchRCL_3
changeset 164 25ffed67c7ef
parent 163 bbf46f59e123
equal deleted inserted replaced
163:bbf46f59e123 164:25ffed67c7ef
     1 // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2006-2009 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".
   914 	iGc->UseFont(testFont);
   914 	iGc->UseFont(testFont);
   915 	iGc->DrawText(KTestString, leftMidPoint);
   915 	iGc->DrawText(KTestString, leftMidPoint);
   916 	User::LeaveIfError(iBitmapDevice->GetNearestFontToDesignHeightInPixels((CFont*&)refFont,refFontSpec));
   916 	User::LeaveIfError(iBitmapDevice->GetNearestFontToDesignHeightInPixels((CFont*&)refFont,refFontSpec));
   917 	iGc->UseFont(refFont);
   917 	iGc->UseFont(refFont);
   918 	iGc->DrawText(KTestString, rightMidPoint);
   918 	iGc->DrawText(KTestString, rightMidPoint);
   919 	TBool testPassed = iBitmapDevice->RectCompare(TRect(0,0,KScreenWidth>>1,KScreenHeight), *iBitmapDevice, TRect(KScreenWidth>>1,0,KScreenWidth,KScreenHeight));
   919 	TEST(iBitmapDevice->RectCompare(TRect(0,0,KScreenWidth>>1,KScreenHeight), *iBitmapDevice, TRect(KScreenWidth>>1,0,KScreenWidth,KScreenHeight)));
   920 	TEST(testPassed);
       
   921 	if (!testPassed)
       
   922 		{
       
   923 		TFontSpec fontSpec = testFont->FontSpecInTwips();
       
   924 		INFO_PRINTF3(_L("Test font: %S, height in twips = %d"), &fontSpec.iTypeface.Name(), fontSpec.iHeight);
       
   925 		fontSpec = refFont->FontSpecInTwips();
       
   926 		INFO_PRINTF3(_L("Ref font: %S, height in twips = %d"), &fontSpec.iTypeface.Name(), fontSpec.iHeight);
       
   927 		}
       
   928 	iBitmapDevice->ReleaseFont(testFont);
   920 	iBitmapDevice->ReleaseFont(testFont);
   929 	iBitmapDevice->ReleaseFont(refFont);
   921 	iBitmapDevice->ReleaseFont(refFont);
   930 	
   922 	
   931 	//monochrome
   923 	//monochrome
   932 	iGc->Clear();
   924 	iGc->Clear();
   937 	iGc->UseFont(testFont);
   929 	iGc->UseFont(testFont);
   938 	iGc->DrawText(KTestString, leftMidPoint);
   930 	iGc->DrawText(KTestString, leftMidPoint);
   939 	User::LeaveIfError(iBitmapDevice->GetNearestFontToDesignHeightInPixels((CFont*&)refFont,refFontSpec));
   931 	User::LeaveIfError(iBitmapDevice->GetNearestFontToDesignHeightInPixels((CFont*&)refFont,refFontSpec));
   940 	iGc->UseFont(refFont);
   932 	iGc->UseFont(refFont);
   941 	iGc->DrawText(KTestString, rightMidPoint);
   933 	iGc->DrawText(KTestString, rightMidPoint);
   942 	testPassed = iBitmapDevice->RectCompare(TRect(0,0,KScreenWidth>>1,KScreenHeight), *iBitmapDevice, TRect(KScreenWidth>>1,0,KScreenWidth,KScreenHeight));
   934 	TEST(iBitmapDevice->RectCompare(TRect(0,0,KScreenWidth>>1,KScreenHeight), *iBitmapDevice, TRect(KScreenWidth>>1,0,KScreenWidth,KScreenHeight)));
   943 	TEST(testPassed);
       
   944 	if (!testPassed)
       
   945 		{
       
   946 		TFontSpec fontSpec = testFont->FontSpecInTwips();
       
   947 		INFO_PRINTF3(_L("Test font: %S, height in twips = %d"), &fontSpec.iTypeface.Name(), fontSpec.iHeight);
       
   948 		fontSpec = refFont->FontSpecInTwips();
       
   949 		INFO_PRINTF3(_L("Ref font: %S, height in twips = %d"), &fontSpec.iTypeface.Name(), fontSpec.iHeight);
       
   950 		}
       
   951 	iBitmapDevice->ReleaseFont(testFont);
   935 	iBitmapDevice->ReleaseFont(testFont);
   952 	iBitmapDevice->ReleaseFont(refFont);
   936 	iBitmapDevice->ReleaseFont(refFont);
   953 	
   937 	
   954 	//anti-aliased
   938 	//anti-aliased
   955 	iGc->Clear();
   939 	iGc->Clear();
   960 	iGc->UseFont(testFont);
   944 	iGc->UseFont(testFont);
   961 	iGc->DrawText(KTestString, leftMidPoint);
   945 	iGc->DrawText(KTestString, leftMidPoint);
   962 	User::LeaveIfError(iBitmapDevice->GetNearestFontToDesignHeightInPixels((CFont*&)refFont,refFontSpec));
   946 	User::LeaveIfError(iBitmapDevice->GetNearestFontToDesignHeightInPixels((CFont*&)refFont,refFontSpec));
   963 	iGc->UseFont(refFont);
   947 	iGc->UseFont(refFont);
   964 	iGc->DrawText(KTestString, rightMidPoint);
   948 	iGc->DrawText(KTestString, rightMidPoint);
   965 	testPassed = iBitmapDevice->RectCompare(TRect(0,0,KScreenWidth>>1,KScreenHeight), *iBitmapDevice, TRect(KScreenWidth>>1,0,KScreenWidth,KScreenHeight));
   949 	TEST(iBitmapDevice->RectCompare(TRect(0,0,KScreenWidth>>1,KScreenHeight), *iBitmapDevice, TRect(KScreenWidth>>1,0,KScreenWidth,KScreenHeight)));
   966 	TEST(testPassed);
       
   967 	if (!testPassed)
       
   968 		{
       
   969 		TFontSpec fontSpec = testFont->FontSpecInTwips();
       
   970 		INFO_PRINTF3(_L("Test font: %S, height in twips = %d"), &fontSpec.iTypeface.Name(), fontSpec.iHeight);
       
   971 		fontSpec = refFont->FontSpecInTwips();
       
   972 		INFO_PRINTF3(_L("Ref font: %S, height in twips = %d"), &fontSpec.iTypeface.Name(), fontSpec.iHeight);
       
   973 		}
       
   974 	iBitmapDevice->ReleaseFont(testFont);
   950 	iBitmapDevice->ReleaseFont(testFont);
   975 	iBitmapDevice->ReleaseFont(refFont);
   951 	iBitmapDevice->ReleaseFont(refFont);
   976 	}
   952 	}
   977 /**
   953 /**
   978 Sets the fontspec and gc attributes according to the flags set in STestFontParameters for the test.
   954 Sets the fontspec and gc attributes according to the flags set in STestFontParameters for the test.