Module: wine Branch: master Commit: be287422ce8b8f11c388484527368bbc9a8fbd30 URL: http://source.winehq.org/git/wine.git/?a=commit;h=be287422ce8b8f11c388484527...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Sun Mar 5 13:44:58 2017 +0300
gdi32/tests: Test that otmfsType field is cleaned up from reserved bits.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Huw Davies huw@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/gdi32/tests/font.c | 41 +++++++++++++++++++++++++++++++++++++++++ dlls/gdi32/tests/wine_test.sfd | 2 +- dlls/gdi32/tests/wine_test.ttf | Bin 1776 -> 1776 bytes 3 files changed, 42 insertions(+), 1 deletion(-)
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index 91ea932..834078e 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -5646,6 +5646,46 @@ todo_wine ReleaseDC(NULL, hdc); }
+static void test_fstype_fixup(void) +{ + HDC hdc; + LOGFONTA lf; + HFONT hfont, hfont_prev; + DWORD ret; + OUTLINETEXTMETRICA *otm; + DWORD otm_size; + + memset(&lf, 0, sizeof(lf)); + lf.lfHeight = 72; + lstrcpyA(lf.lfFaceName, "wine_test"); + + SetLastError(0xdeadbeef); + 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"); + + otm_size = GetOutlineTextMetricsA(hdc, 0, NULL); + otm = HeapAlloc(GetProcessHeap(), 0, otm_size); + otm->otmSize = sizeof(*otm); + ret = GetOutlineTextMetricsA(hdc, otm->otmSize, otm); + ok(ret == otm->otmSize, "expected %u, got %u, error %d\n", otm->otmSize, ret, GetLastError()); + + /* Test font has fsType set to 0x7fff, test that reserved bits are filtered out, + valid bits are 1, 2, 3, 8, 9. */ +todo_wine + ok((otm->otmfsType & ~0x30e) == 0, "fsType %#x\n", otm->otmfsType); + + HeapFree(GetProcessHeap(), 0, otm); + + SelectObject(hdc, hfont_prev); + DeleteObject(hfont); + ReleaseDC(NULL, hdc); +} + static void test_CreateScalableFontResource(void) { char ttf_name[MAX_PATH]; @@ -5729,6 +5769,7 @@ static void test_CreateScalableFontResource(void)
test_GetGlyphOutline_empty_contour(); test_GetGlyphOutline_metric_clipping(); + test_fstype_fixup();
ret = pRemoveFontResourceExA(fot_name, FR_PRIVATE, 0); 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 c985b43..79a0a4d 100644 --- a/dlls/gdi32/tests/wine_test.sfd +++ b/dlls/gdi32/tests/wine_test.sfd @@ -15,7 +15,7 @@ LayerCount: 2 Layer: 0 1 "Back" 1 Layer: 1 1 "Fore" 0 XUID: [1021 905 592216984 1247726] -FSType: 0 +FSType: 32767 OS2Version: 2 OS2_WeightWidthSlopeOnly: 0 OS2_UseTypoMetrics: 1 diff --git a/dlls/gdi32/tests/wine_test.ttf b/dlls/gdi32/tests/wine_test.ttf index 1562a32..d09ae3d 100644 Binary files a/dlls/gdi32/tests/wine_test.ttf and b/dlls/gdi32/tests/wine_test.ttf differ