Module: wine Branch: master Commit: 4f07c49547cc110323b9201c51514d4f10c11b7c URL: http://source.winehq.org/git/wine.git/?a=commit;h=4f07c49547cc110323b9201c51...
Author: Piotr Caban piotr@codeweavers.com Date: Tue Nov 13 16:51:51 2012 +0100
gdi32: Added GetGlyphOutlineW tests on glyph that contains empty contour.
---
dlls/gdi32/tests/font.c | 42 ++++++++++++++++++++++++++++++++++++++++ dlls/gdi32/tests/wine_test.sfd | 29 +++++++++++++++++++++++++- dlls/gdi32/tests/wine_test.ttf | Bin 1552 -> 1652 bytes 3 files changed, 69 insertions(+), 2 deletions(-)
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index 4d41388..1064ce2 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -4277,6 +4277,46 @@ static BOOL write_ttf_file(const char *fontname, char *tmp_name) return ret; }
+static void test_GetGlyphOutline_empty_contour(void) +{ + HDC hdc; + LOGFONTA lf; + HFONT hfont, hfont_prev; + TTPOLYGONHEADER *header; + GLYPHMETRICS gm; + char buf[1024]; + DWORD ret; + + memset(&lf, 0, sizeof(lf)); + lf.lfHeight = 72; + lstrcpyA(lf.lfFaceName, "wine_test"); + + hfont = CreateFontIndirectA(&lf); + ok(hfont != 0, "CreateFontIndirectA error %u\n", GetLastError()); + + hdc = GetDC(NULL); + + hfont_prev = SelectObject(hdc, hfont); + ok(hfont_prev != NULL, "SelectObject failed\n"); + + ret = GetGlyphOutlineW(hdc, 0xa8, GGO_NATIVE, &gm, 0, NULL, &mat); + ok(ret == 228, "GetGlyphOutline returned %d, expected 228\n", ret); + + header = (TTPOLYGONHEADER*)buf; + ret = GetGlyphOutlineW(hdc, 0xa8, GGO_NATIVE, &gm, sizeof(buf), buf, &mat); + ok(ret == 228, "GetGlyphOutline returned %d, expected 228\n", ret); + ok(header->cb == 36, "header->cb = %d, expected 36\n", header->cb); + ok(header->dwType == TT_POLYGON_TYPE, "header->dwType = %d, expected TT_POLYGON_TYPE\n", header->dwType); + header = (TTPOLYGONHEADER*)((char*)header+header->cb); + ok(header->cb == 96, "header->cb = %d, expected 96\n", header->cb); + header = (TTPOLYGONHEADER*)((char*)header+header->cb); + ok(header->cb == 96, "header->cb = %d, expected 96\n", header->cb); + + SelectObject(hdc, hfont_prev); + DeleteObject(hfont); + ReleaseDC(NULL, hdc); +} + static void test_CreateScalableFontResource(void) { char ttf_name[MAX_PATH]; @@ -4358,6 +4398,8 @@ todo_wine ret = is_truetype_font_installed("wine_test"); ok(ret, "font wine_test should be enumerated\n");
+ test_GetGlyphOutline_empty_contour(); + ret = pRemoveFontResourceExA(fot_name, FR_PRIVATE, 0); todo_wine ok(!ret, "RemoveFontResourceEx() with not matching flags should fail\n"); diff --git a/dlls/gdi32/tests/wine_test.sfd b/dlls/gdi32/tests/wine_test.sfd index 5b73545..5adf7cf 100644 --- a/dlls/gdi32/tests/wine_test.sfd +++ b/dlls/gdi32/tests/wine_test.sfd @@ -20,7 +20,7 @@ OS2Version: 2 OS2_WeightWidthSlopeOnly: 0 OS2_UseTypoMetrics: 1 CreationTime: 1288336343 -ModificationTime: 1288336873 +ModificationTime: 1352483620 PfmFamily: 17 TTFWeight: 500 TTFWidth: 5 @@ -86,7 +86,7 @@ DisplaySize: -24 AntiAlias: 1 FitToEm: 1 WinInfo: 65 65 19 -BeginChars: 65539 4 +BeginChars: 65539 5
StartChar: .notdef Encoding: 65536 -1 0 @@ -176,5 +176,30 @@ Width: 0 Flags: W LayerCount: 2 EndChar + +StartChar: dieresis +Encoding: 168 168 0 +Width: 1000 +VWidth: 0 +Flags: HW +LayerCount: 2 +Fore +SplineSet +620.215 824.429 m 1,0,1 + 760.84 777.554 760.84 777.554 713.965 636.929 c 1,2,-1 + 620.215 824.429 l 1,0,1 +154.883 324.971 m 0,3,-1 +254.492 773.213 m 1,4,5 + 310.707 834.805 310.707 834.805 374.609 767.354 c 1,6,7 + 410.471 728.672 410.471 728.672 374.609 691.182 c 0,8,9 + 308.375 621.934 308.375 621.934 254.492 688.252 c 0,10,11 + 216.406 735.127 216.406 735.127 254.492 773.213 c 1,4,5 +254.492 773.213 m 1,12,13 + 216.406 735.127 216.406 735.127 254.492 688.252 c 0,14,15 + 308.375 621.934 308.375 621.934 374.609 691.182 c 0,16,17 + 410.471 728.672 410.471 728.672 374.609 767.354 c 1,18,19 + 310.707 834.805 310.707 834.805 254.492 773.213 c 1,12,13 +EndSplineSet +EndChar EndChars EndSplineFont diff --git a/dlls/gdi32/tests/wine_test.ttf b/dlls/gdi32/tests/wine_test.ttf index badef18..1e546eb 100644 Binary files a/dlls/gdi32/tests/wine_test.ttf and b/dlls/gdi32/tests/wine_test.ttf differ