1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2006-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". |
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 TEST(iBitmapDevice->RectCompare(TRect(0,0,KScreenWidth>>1,KScreenHeight), *iBitmapDevice, TRect(KScreenWidth>>1,0,KScreenWidth,KScreenHeight))); |
919 TBool testPassed = 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 } |
920 iBitmapDevice->ReleaseFont(testFont); |
928 iBitmapDevice->ReleaseFont(testFont); |
921 iBitmapDevice->ReleaseFont(refFont); |
929 iBitmapDevice->ReleaseFont(refFont); |
922 |
930 |
923 //monochrome |
931 //monochrome |
924 iGc->Clear(); |
932 iGc->Clear(); |
929 iGc->UseFont(testFont); |
937 iGc->UseFont(testFont); |
930 iGc->DrawText(KTestString, leftMidPoint); |
938 iGc->DrawText(KTestString, leftMidPoint); |
931 User::LeaveIfError(iBitmapDevice->GetNearestFontToDesignHeightInPixels((CFont*&)refFont,refFontSpec)); |
939 User::LeaveIfError(iBitmapDevice->GetNearestFontToDesignHeightInPixels((CFont*&)refFont,refFontSpec)); |
932 iGc->UseFont(refFont); |
940 iGc->UseFont(refFont); |
933 iGc->DrawText(KTestString, rightMidPoint); |
941 iGc->DrawText(KTestString, rightMidPoint); |
934 TEST(iBitmapDevice->RectCompare(TRect(0,0,KScreenWidth>>1,KScreenHeight), *iBitmapDevice, TRect(KScreenWidth>>1,0,KScreenWidth,KScreenHeight))); |
942 testPassed = 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 } |
935 iBitmapDevice->ReleaseFont(testFont); |
951 iBitmapDevice->ReleaseFont(testFont); |
936 iBitmapDevice->ReleaseFont(refFont); |
952 iBitmapDevice->ReleaseFont(refFont); |
937 |
953 |
938 //anti-aliased |
954 //anti-aliased |
939 iGc->Clear(); |
955 iGc->Clear(); |
944 iGc->UseFont(testFont); |
960 iGc->UseFont(testFont); |
945 iGc->DrawText(KTestString, leftMidPoint); |
961 iGc->DrawText(KTestString, leftMidPoint); |
946 User::LeaveIfError(iBitmapDevice->GetNearestFontToDesignHeightInPixels((CFont*&)refFont,refFontSpec)); |
962 User::LeaveIfError(iBitmapDevice->GetNearestFontToDesignHeightInPixels((CFont*&)refFont,refFontSpec)); |
947 iGc->UseFont(refFont); |
963 iGc->UseFont(refFont); |
948 iGc->DrawText(KTestString, rightMidPoint); |
964 iGc->DrawText(KTestString, rightMidPoint); |
949 TEST(iBitmapDevice->RectCompare(TRect(0,0,KScreenWidth>>1,KScreenHeight), *iBitmapDevice, TRect(KScreenWidth>>1,0,KScreenWidth,KScreenHeight))); |
965 testPassed = 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 } |
950 iBitmapDevice->ReleaseFont(testFont); |
974 iBitmapDevice->ReleaseFont(testFont); |
951 iBitmapDevice->ReleaseFont(refFont); |
975 iBitmapDevice->ReleaseFont(refFont); |
952 } |
976 } |
953 /** |
977 /** |
954 Sets the fontspec and gc attributes according to the flags set in STestFontParameters for the test. |
978 Sets the fontspec and gc attributes according to the flags set in STestFontParameters for the test. |