Module: wine Branch: master Commit: 3658b8450911028413d1c8b6c36c71be43eee23c URL: http://source.winehq.org/git/wine.git/?a=commit;h=3658b8450911028413d1c8b6c3...
Author: Greg Geldorp ggeldorp@vmware.com Date: Tue Jan 11 13:07:03 2011 +0100
gdi32/tests: Skip tests on unexpected font code page.
---
dlls/gdi32/tests/font.c | 23 ++++++++++++++++++----- 1 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index bd4d97d..28bdcc2 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -1558,6 +1558,7 @@ static BOOL get_glyph_indices(INT charset, UINT code_page, WORD *idx, UINT count INT cs; DWORD i, ret; char name[64]; + DWORD (WINAPI *pGdiGetCodePage)(HDC);
assert(count <= 128);
@@ -1599,6 +1600,16 @@ static BOOL get_glyph_indices(INT charset, UINT code_page, WORD *idx, UINT count } ok(csi.ciACP == code_page, "expected %d, got %d\n", code_page, csi.ciACP);
+ pGdiGetCodePage = (void *) GetProcAddress(GetModuleHandleA("gdi32.dll"), + "GdiGetCodePage"); + if (pGdiGetCodePage != NULL && pGdiGetCodePage(hdc) != code_page) + { + skip("Font code page %d, looking for code page %d\n", + pGdiGetCodePage(hdc), code_page); + ReleaseDC(0, hdc); + return FALSE; + } + if (unicode) { char ansi_buf[128]; @@ -1610,7 +1621,8 @@ static BOOL get_glyph_indices(INT charset, UINT code_page, WORD *idx, UINT count
SetLastError(0xdeadbeef); ret = pGetGlyphIndicesW(hdc, unicode_buf, count, idx, 0); - ok(ret == count, "GetGlyphIndicesW error %u\n", GetLastError()); + ok(ret == count, "GetGlyphIndicesW expected %d got %d, error %u\n", + count, ret, GetLastError()); } else { @@ -1620,7 +1632,8 @@ static BOOL get_glyph_indices(INT charset, UINT code_page, WORD *idx, UINT count
SetLastError(0xdeadbeef); ret = pGetGlyphIndicesA(hdc, ansi_buf, count, idx, 0); - ok(ret == count, "GetGlyphIndicesA error %u\n", GetLastError()); + ok(ret == count, "GetGlyphIndicesA expected %d got %d, error %u\n", + count, ret, GetLastError()); }
SelectObject(hdc, hfont_old); @@ -1668,9 +1681,9 @@ static void test_font_charset(void) break; } } - get_glyph_indices(cd[i].charset, cd[i].code_page, cd[i].font_idxA, 128, FALSE); - get_glyph_indices(cd[i].charset, cd[i].code_page, cd[i].font_idxW, 128, TRUE); - ok(!memcmp(cd[i].font_idxA, cd[i].font_idxW, 128*sizeof(WORD)), "%d: indices don't match\n", i); + if (get_glyph_indices(cd[i].charset, cd[i].code_page, cd[i].font_idxA, 128, FALSE) && + get_glyph_indices(cd[i].charset, cd[i].code_page, cd[i].font_idxW, 128, TRUE)) + ok(!memcmp(cd[i].font_idxA, cd[i].font_idxW, 128*sizeof(WORD)), "%d: indices don't match\n", i); }
ok(memcmp(cd[0].font_idxW, cd[1].font_idxW, 128*sizeof(WORD)), "0 vs 1: indices shouldn't match\n");