From fe3d38d1a0e19e503048f8338f8f26cd0668d364 Mon Sep 17 00:00:00 2001 From: Adam Petaccia <adam@tpetaccia.com> Date: Sat, 21 Jun 2008 13:02:56 -0400 Subject: [PATCH] gdiplus: Tests for new font functions. --- dlls/gdiplus/tests/font.c | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/dlls/gdiplus/tests/font.c b/dlls/gdiplus/tests/font.c index 5cc9bc2156b..93efbc4eb45 100644 --- a/dlls/gdiplus/tests/font.c +++ b/dlls/gdiplus/tests/font.c @@ -38,6 +38,46 @@ static const char *debugstr_w(LPCWSTR str) return buf; } + +static void test_createfont(void) +{ + GpFontFamily* fontfamily = NULL; + GpFont* font = NULL; + GpStatus stat; + Unit unit; + UINT i; + REAL size; + + stat = GdipCreateFontFamilyFromName(nonexistant, NULL, &fontfamily); + expect (FontFamilyNotFound, stat); + stat = GdipDeleteFont(font); + expect (InvalidParameter, stat); + stat = GdipCreateFontFamilyFromName(arial, NULL, &fontfamily); + expect (Ok, stat); + stat = GdipCreateFont(fontfamily, 12, FontStyleRegular, UnitPoint, &font); + expect (Ok, stat); + stat = GdipGetFontUnit (font, &unit); + expect (Ok, stat); + expect (UnitPoint, unit); + + /* Test to see if returned size is based on unit (its not) */ + GdipGetFontSize(font, &size); + ok (size == 12, "Expected 12, got %f\n", size); + GdipDeleteFont(font); + + /* Make sure everything is converted correctly for all Units */ + for (i = UnitWorld; i <=UnitMillimeter; i++) + { + if (i == UnitDisplay) continue; /* Crashes WindowsXP, wtf? */ + GdipCreateFont(fontfamily, 24, FontStyleRegular, i, &font); + GdipGetFontSize (font, &size); + ok (size == 24, "Expected 24, got %f (with unit: %d)\n", size, i); + GdipGetFontUnit (font, &unit); + expect (i, unit); + GdipDeleteFont(font); + } +} + static void test_logfont(void) { LOGFONTW lfw, lfw2; @@ -207,6 +247,7 @@ START_TEST(font) GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); + test_createfont(); test_logfont(); test_fontfamily(); test_getgenerics(); -- GitLab