mlang: Implement IMLangFontLink_GetStrCodePages.
This commit is contained in:
parent
6aa216fb57
commit
b86552f58d
|
@ -1912,9 +1912,34 @@ static HRESULT WINAPI fnIMLangFontLink_GetStrCodePages(
|
|||
DWORD* pdwCodePages,
|
||||
long* pcchCodePages)
|
||||
{
|
||||
FIXME("(pszSrc=%s, cchSrc=%ld, dwPriorityCodePages=%d) stub\n", debugstr_w(pszSrc), cchSrc, dwPriorityCodePages);
|
||||
*pdwCodePages = 0;
|
||||
*pcchCodePages = 1;
|
||||
long i;
|
||||
DWORD cps = 0;
|
||||
|
||||
TRACE("(%p)->%s %ld %x %p %p\n", iface, debugstr_wn(pszSrc,cchSrc),cchSrc,dwPriorityCodePages,pdwCodePages,pcchCodePages);
|
||||
|
||||
if (pdwCodePages) *pdwCodePages = 0;
|
||||
if (pcchCodePages) *pcchCodePages = 0;
|
||||
|
||||
if (!pszSrc || !cchSrc || cchSrc < 0)
|
||||
return E_INVALIDARG;
|
||||
|
||||
for (i = 0; i < cchSrc; i++)
|
||||
{
|
||||
DWORD cp;
|
||||
HRESULT ret;
|
||||
|
||||
ret = fnIMLangFontLink_GetCharCodePages(iface, pszSrc[i], &cp);
|
||||
if (ret != S_OK) return E_FAIL;
|
||||
|
||||
if (!cps) cps = cp;
|
||||
else cps &= cp;
|
||||
|
||||
/* FIXME: not tested */
|
||||
if (dwPriorityCodePages & cps) break;
|
||||
}
|
||||
|
||||
if (pdwCodePages) *pdwCodePages = cps;
|
||||
if (pcchCodePages) *pcchCodePages = i;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -3179,10 +3204,8 @@ static HRESULT WINAPI fnIMLangFontLink2_GetStrCodePages( IMLangFontLink2* This,
|
|||
const WCHAR *pszSrc, long cchSrc, DWORD dwPriorityCodePages,
|
||||
DWORD *pdwCodePages, long *pcchCodePages)
|
||||
{
|
||||
FIXME("(%p)->%s %li %x %p %p\n",This, debugstr_wn(pszSrc,cchSrc),cchSrc,dwPriorityCodePages,pdwCodePages,pcchCodePages);
|
||||
*pdwCodePages = 0;
|
||||
*pcchCodePages = 1;
|
||||
return S_OK;
|
||||
return fnIMLangFontLink_GetStrCodePages((IMLangFontLink *)This,
|
||||
pszSrc, cchSrc, dwPriorityCodePages, pdwCodePages, pcchCodePages);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI fnIMLangFontLink2_CodePageToCodePages(IMLangFontLink2* This,
|
||||
|
|
|
@ -211,7 +211,7 @@ static void test_multibyte_to_unicode_translations(IMultiLanguage2 *iML2)
|
|||
ok(lenA == expected_len, "expected lenA %u, got %u\n", expected_len, lenA);
|
||||
}
|
||||
|
||||
static inline void cpinfo_cmp(MIMECPINFO *cpinfo1, MIMECPINFO *cpinfo2)
|
||||
static void cpinfo_cmp(MIMECPINFO *cpinfo1, MIMECPINFO *cpinfo2)
|
||||
{
|
||||
ok(cpinfo1->dwFlags == cpinfo2->dwFlags, "dwFlags mismatch: %08x != %08x\n", cpinfo1->dwFlags, cpinfo2->dwFlags);
|
||||
ok(cpinfo1->uiCodePage == cpinfo2->uiCodePage, "uiCodePage mismatch: %u != %u\n", cpinfo1->uiCodePage, cpinfo2->uiCodePage);
|
||||
|
@ -538,7 +538,7 @@ static void test_EnumCodePages(IMultiLanguage2 *iML2, DWORD flags)
|
|||
IEnumCodePage_Release(iEnumCP);
|
||||
}
|
||||
|
||||
static inline void scriptinfo_cmp(SCRIPTINFO *sinfo1, SCRIPTINFO *sinfo2)
|
||||
static void scriptinfo_cmp(SCRIPTINFO *sinfo1, SCRIPTINFO *sinfo2)
|
||||
{
|
||||
ok(sinfo1->ScriptId == sinfo2->ScriptId, "ScriptId mismatch: %d != %d\n", sinfo1->ScriptId, sinfo2->ScriptId);
|
||||
ok(sinfo1->uiCodePage == sinfo2->uiCodePage, "uiCodePage mismatch: %u != %u\n", sinfo1->uiCodePage, sinfo2->uiCodePage);
|
||||
|
@ -649,6 +649,8 @@ static void IMLangFontLink_Test(IMLangFontLink* iMLFL)
|
|||
DWORD dwCodePages, dwManyCodePages;
|
||||
DWORD dwCmpCodePages;
|
||||
UINT CodePage;
|
||||
static const WCHAR str[3] = { 'd', 0x0436, 0xff90 };
|
||||
long processed;
|
||||
HRESULT ret;
|
||||
|
||||
dwCodePages = ~0u;
|
||||
|
@ -693,21 +695,89 @@ static void IMLangFontLink_Test(IMLangFontLink* iMLFL)
|
|||
dwCmpCodePages = FS_LATIN1 | FS_LATIN2 | FS_CYRILLIC | FS_GREEK | FS_TURKISH
|
||||
| FS_HEBREW | FS_ARABIC | FS_BALTIC | FS_VIETNAMESE | FS_THAI
|
||||
| FS_JISJAPAN | FS_CHINESESIMP | FS_WANSUNG | FS_CHINESETRAD;
|
||||
ok(IMLangFontLink_GetCharCodePages(iMLFL, 'd', &dwCodePages) == S_OK,
|
||||
"IMLangFontLink_GetCharCodePages failed\n");
|
||||
ok(dwCodePages == dwCmpCodePages, "Incorrect CodePages returned (%i)\n", dwCodePages);
|
||||
ret = IMLangFontLink_GetCharCodePages(iMLFL, 'd', &dwCodePages);
|
||||
ok(ret == S_OK, "IMLangFontLink_GetCharCodePages error %x\n", ret);
|
||||
ok(dwCodePages == dwCmpCodePages, "expected %x, got %x\n", dwCmpCodePages, dwCodePages);
|
||||
|
||||
dwCodePages = 0;
|
||||
processed = 0;
|
||||
ret = IMLangFontLink_GetStrCodePages(iMLFL, &str[0], 1, 0, &dwCodePages, &processed);
|
||||
ok(ret == S_OK, "IMLangFontLink_GetStrCodePages error %x\n", ret);
|
||||
ok(dwCodePages == dwCmpCodePages, "expected %x, got %x\n", dwCmpCodePages, dwCodePages);
|
||||
ok(processed == 1, "expected 1, got %ld\n", processed);
|
||||
|
||||
/* Cyrillic */
|
||||
dwCmpCodePages = FS_CYRILLIC | FS_JISJAPAN | FS_CHINESESIMP | FS_WANSUNG;
|
||||
ok(IMLangFontLink_GetCharCodePages(iMLFL, 0x0436, &dwCodePages) == S_OK,
|
||||
"IMLangFontLink_GetCharCodePages failed\n");
|
||||
ok(dwCodePages == dwCmpCodePages, "Incorrect CodePages returned (%i)\n", dwCodePages);
|
||||
ret = IMLangFontLink_GetCharCodePages(iMLFL, 0x0436, &dwCodePages);
|
||||
ok(ret == S_OK, "IMLangFontLink_GetCharCodePages error %x\n", ret);
|
||||
ok(dwCodePages == dwCmpCodePages, "expected %x, got %x\n", dwCmpCodePages, dwCodePages);
|
||||
|
||||
dwCodePages = 0;
|
||||
processed = 0;
|
||||
ret = IMLangFontLink_GetStrCodePages(iMLFL, &str[1], 1, 0, &dwCodePages, &processed);
|
||||
ok(ret == S_OK, "IMLangFontLink_GetStrCodePages error %x\n", ret);
|
||||
ok(dwCodePages == dwCmpCodePages, "expected %x, got %x\n", dwCmpCodePages, dwCodePages);
|
||||
ok(processed == 1, "expected 1, got %ld\n", processed);
|
||||
|
||||
/* Japanese */
|
||||
dwCmpCodePages = FS_JISJAPAN;
|
||||
ok(IMLangFontLink_GetCharCodePages(iMLFL, 0xff90, &dwCodePages) == S_OK,
|
||||
"IMLangFontLink_GetCharCodePages failed\n");
|
||||
ok(dwCodePages == dwCmpCodePages, "Incorrect CodePages returned (%i)\n", dwCodePages);
|
||||
ret = IMLangFontLink_GetCharCodePages(iMLFL, 0xff90, &dwCodePages);
|
||||
ok(ret == S_OK, "IMLangFontLink_GetCharCodePages error %x\n", ret);
|
||||
ok(dwCodePages == dwCmpCodePages, "expected %x, got %x\n", dwCmpCodePages, dwCodePages);
|
||||
|
||||
dwCodePages = 0;
|
||||
processed = 0;
|
||||
ret = IMLangFontLink_GetStrCodePages(iMLFL, &str[2], 1, 0, &dwCodePages, &processed);
|
||||
ok(ret == S_OK, "IMLangFontLink_GetStrCodePages error %x\n", ret);
|
||||
ok(dwCodePages == dwCmpCodePages, "expected %x, got %x\n", dwCmpCodePages, dwCodePages);
|
||||
ok(processed == 1, "expected 1, got %ld\n", processed);
|
||||
|
||||
dwCmpCodePages = FS_CYRILLIC | FS_JISJAPAN | FS_CHINESESIMP | FS_WANSUNG;
|
||||
dwCodePages = 0;
|
||||
processed = 0;
|
||||
ret = IMLangFontLink_GetStrCodePages(iMLFL, str, 2, 0, &dwCodePages, &processed);
|
||||
ok(ret == S_OK, "IMLangFontLink_GetStrCodePages error %x\n", ret);
|
||||
ok(dwCodePages == dwCmpCodePages, "expected %x, got %x\n", dwCmpCodePages, dwCodePages);
|
||||
ok(processed == 2, "expected 2, got %ld\n", processed);
|
||||
|
||||
dwCmpCodePages = FS_JISJAPAN;
|
||||
dwCodePages = 0;
|
||||
processed = 0;
|
||||
ret = IMLangFontLink_GetStrCodePages(iMLFL, str, 3, 0, &dwCodePages, &processed);
|
||||
ok(ret == S_OK, "IMLangFontLink_GetStrCodePages error %x\n", ret);
|
||||
ok(dwCodePages == dwCmpCodePages, "expected %x, got %x\n", dwCmpCodePages, dwCodePages);
|
||||
ok(processed == 3, "expected 3, got %ld\n", processed);
|
||||
|
||||
dwCodePages = 0xffff;
|
||||
processed = -1;
|
||||
ret = IMLangFontLink_GetStrCodePages(iMLFL, &str[2], 1, 0, &dwCodePages, &processed);
|
||||
ok(ret == S_OK, "IMLangFontLink_GetStrCodePages error %x\n", ret);
|
||||
ok(dwCodePages == dwCmpCodePages, "expected %x, got %x\n", dwCmpCodePages, dwCodePages);
|
||||
ok(processed == 1, "expected 0, got %ld\n", processed);
|
||||
|
||||
ret = IMLangFontLink_GetStrCodePages(iMLFL, &str[2], 1, 0, NULL, NULL);
|
||||
ok(ret == S_OK, "IMLangFontLink_GetStrCodePages error %x\n", ret);
|
||||
|
||||
dwCodePages = 0xffff;
|
||||
processed = -1;
|
||||
ret = IMLangFontLink_GetStrCodePages(iMLFL, str, -1, 0, &dwCodePages, &processed);
|
||||
ok(ret == E_INVALIDARG, "IMLangFontLink_GetStrCodePages should fail: %x\n", ret);
|
||||
ok(dwCodePages == 0, "expected %x, got %x\n", dwCmpCodePages, dwCodePages);
|
||||
ok(processed == 0, "expected 0, got %ld\n", processed);
|
||||
|
||||
dwCodePages = 0xffff;
|
||||
processed = -1;
|
||||
ret = IMLangFontLink_GetStrCodePages(iMLFL, NULL, 1, 0, &dwCodePages, &processed);
|
||||
ok(ret == E_INVALIDARG, "IMLangFontLink_GetStrCodePages should fail: %x\n", ret);
|
||||
ok(dwCodePages == 0, "expected %x, got %x\n", dwCmpCodePages, dwCodePages);
|
||||
ok(processed == 0, "expected 0, got %ld\n", processed);
|
||||
|
||||
dwCodePages = 0xffff;
|
||||
processed = -1;
|
||||
ret = IMLangFontLink_GetStrCodePages(iMLFL, str, 0, 0, &dwCodePages, &processed);
|
||||
ok(ret == E_INVALIDARG, "IMLangFontLink_GetStrCodePages should fail: %x\n", ret);
|
||||
ok(dwCodePages == 0, "expected %x, got %x\n", dwCmpCodePages, dwCodePages);
|
||||
ok(processed == 0, "expected 0, got %ld\n", processed);
|
||||
}
|
||||
|
||||
/* copied from libs/wine/string.c */
|
||||
|
@ -1395,7 +1465,7 @@ static void test_GetScriptFontInfo(IMLangFontLink2 *font_link)
|
|||
hr = IMLangFontLink2_GetScriptFontInfo(font_link, sidLatin, SCRIPTCONTF_FIXED_FONT, &nfonts, sfi);
|
||||
ok(hr == S_OK, "GetScriptFontInfo failed %u\n", GetLastError());
|
||||
ok(nfonts == 1, "got %u, expected 1\n", nfonts);
|
||||
ok(sfi[0].scripts, "unexpected result\n");
|
||||
ok(sfi[0].scripts != 0, "unexpected result\n");
|
||||
ok(sfi[0].wszFont[0], "unexpected result\n");
|
||||
|
||||
nfonts = 1;
|
||||
|
@ -1403,7 +1473,7 @@ static void test_GetScriptFontInfo(IMLangFontLink2 *font_link)
|
|||
hr = IMLangFontLink2_GetScriptFontInfo(font_link, sidLatin, SCRIPTCONTF_PROPORTIONAL_FONT, &nfonts, sfi);
|
||||
ok(hr == S_OK, "GetScriptFontInfo failed %u\n", GetLastError());
|
||||
ok(nfonts == 1, "got %u, expected 1\n", nfonts);
|
||||
ok(sfi[0].scripts, "unexpected result\n");
|
||||
ok(sfi[0].scripts != 0, "unexpected result\n");
|
||||
ok(sfi[0].wszFont[0], "unexpected result\n");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue