diff --git a/dlls/usp10/tests/usp10.c b/dlls/usp10/tests/usp10.c index 4c16df56b77..270a0f4b195 100644 --- a/dlls/usp10/tests/usp10.c +++ b/dlls/usp10/tests/usp10.c @@ -2091,6 +2091,7 @@ static void test_ScriptShape(HDC hdc) static void test_ScriptPlace(HDC hdc) { static const WCHAR test1[] = {'t', 'e', 's', 't',0}; + static const WCHAR test2[] = {0x3044, 0x308d, 0x306f,0}; /* Hiragana, Iroha */ BOOL ret; HRESULT hr; SCRIPT_CACHE sc = NULL; @@ -2101,6 +2102,9 @@ static void test_ScriptPlace(HDC hdc) int nb, widths[4]; GOFFSET offset[4]; ABC abc[4]; + HFONT hfont, prev_hfont; + LOGFONTA lf; + TEXTMETRICW tm; hr = ScriptItemize(test1, 4, 2, NULL, NULL, items, NULL); ok(hr == S_OK, "ScriptItemize should return S_OK not %08x\n", hr); @@ -2154,6 +2158,62 @@ static void test_ScriptPlace(HDC hdc) ok(ret, "ExtTextOutW should return TRUE\n"); ScriptFreeCache(&sc); + + /* test CJK bitmap font which has associated font */ + memset(&lf, 0, sizeof(lf)); + strcpy(lf.lfFaceName, "Fixedsys"); + lf.lfCharSet = DEFAULT_CHARSET; + hfont = CreateFontIndirectA(&lf); + prev_hfont = SelectObject(hdc, hfont); + ret = GetTextMetricsW(hdc, &tm); + ok(ret, "GetTextMetrics failed\n"); + + switch(tm.tmCharSet) { + case SHIFTJIS_CHARSET: + case HANGUL_CHARSET: + case GB2312_CHARSET: + case CHINESEBIG5_CHARSET: + { + SIZE sz; + DWORD len = lstrlenW(test2), i, total; + ret = GetTextExtentExPointW(hdc, test2, len, 0, NULL, NULL, &sz); + ok(ret, "GetTextExtentExPoint failed\n"); + + if (sz.cx > len * tm.tmAveCharWidth) + { + hr = ScriptItemize(test2, len, 2, NULL, NULL, items, NULL); + ok(hr == S_OK, "ScriptItemize should return S_OK not %08x\n", hr); + ok(items[0].a.fNoGlyphIndex == FALSE, "fNoGlyphIndex TRUE\n"); + + items[0].a.fNoGlyphIndex = TRUE; + memset(glyphs, 'a', sizeof(glyphs)); + hr = ScriptShape(hdc, &sc, test2, len, ARRAY_SIZE(glyphs), &items[0].a, glyphs, logclust, attrs, &nb); + ok(hr == S_OK, "ScriptShape should return S_OK not %08x\n", hr); + + memset(offset, 'a', sizeof(offset)); + memset(widths, 'a', sizeof(widths)); + hr = ScriptPlace(hdc, &sc, glyphs, ARRAY_SIZE(widths), attrs, &items[0].a, widths, offset, NULL); + ok(hr == S_OK, "ScriptPlace should return S_OK not %08x\n", hr); + + for (total = 0, i = 0; i < nb; i++) + { + ok(offset[i].du == 0, "[%d] expected 0, got %d\n", i, offset[i].du); + ok(offset[i].dv == 0, "[%d] expected 0, got %d\n", i, offset[i].dv); + todo_wine ok(widths[i] > tm.tmAveCharWidth, "[%d] expected greater than %d, got %d\n", + i, tm.tmAveCharWidth, widths[i]); + total += widths[i]; + } + todo_wine ok(total == sz.cx, "expected %d, got %d\n", sz.cx, total); + } + else + skip("Associated font is unavailable\n"); + + break; + } + default: + skip("Non-CJK locale\n"); + } + SelectObject(hdc, prev_hfont); } static void test_ScriptItemIzeShapePlace(HDC hdc, unsigned short pwOutGlyphs[256])