Commit cfe0f970 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

mlang: Add a test for a CodePageToCodePages failure, make it pass under Wine.

parent 1542bbd8
...@@ -1883,7 +1883,6 @@ static HRESULT WINAPI fnIMLangFontLink_CodePageToCodePages( ...@@ -1883,7 +1883,6 @@ static HRESULT WINAPI fnIMLangFontLink_CodePageToCodePages(
BOOL rc; BOOL rc;
TRACE("(%p) Seeking %u\n",This, uCodePage); TRACE("(%p) Seeking %u\n",This, uCodePage);
memset(&cs, 0, sizeof(cs));
rc = TranslateCharsetInfo((DWORD*)uCodePage, &cs, TCI_SRCCODEPAGE); rc = TranslateCharsetInfo((DWORD*)uCodePage, &cs, TCI_SRCCODEPAGE);
...@@ -1891,11 +1890,12 @@ static HRESULT WINAPI fnIMLangFontLink_CodePageToCodePages( ...@@ -1891,11 +1890,12 @@ static HRESULT WINAPI fnIMLangFontLink_CodePageToCodePages(
{ {
*pdwCodePages = cs.fs.fsCsb[0]; *pdwCodePages = cs.fs.fsCsb[0];
TRACE("resulting CodePages 0x%x\n",*pdwCodePages); TRACE("resulting CodePages 0x%x\n",*pdwCodePages);
return S_OK;
} }
else
TRACE("CodePage Not Found\n");
return S_OK; TRACE("CodePage Not Found\n");
*pdwCodePages = 0;
return E_FAIL;
} }
static HRESULT WINAPI fnIMLangFontLink_CodePagesToCodePage( static HRESULT WINAPI fnIMLangFontLink_CodePagesToCodePage(
......
...@@ -640,36 +640,44 @@ static void test_EnumScripts(IMultiLanguage2 *iML2, DWORD flags) ...@@ -640,36 +640,44 @@ static void test_EnumScripts(IMultiLanguage2 *iML2, DWORD flags)
static void IMLangFontLink_Test(IMLangFontLink* iMLFL) static void IMLangFontLink_Test(IMLangFontLink* iMLFL)
{ {
DWORD dwCodePages = 0; DWORD dwCodePages, dwManyCodePages;
DWORD dwManyCodePages = 0; UINT CodePage;
UINT CodePage = 0; HRESULT ret;
ok(IMLangFontLink_CodePageToCodePages(iMLFL, 932, &dwCodePages)==S_OK, dwCodePages = ~0u;
"IMLangFontLink_CodePageToCodePages failed\n"); ret = IMLangFontLink_CodePageToCodePages(iMLFL, -1, &dwCodePages);
ok (dwCodePages != 0, "No CodePages returned\n"); ok(ret == E_FAIL, "IMLangFontLink_CodePageToCodePages should fail: %x\n", ret);
ok(IMLangFontLink_CodePagesToCodePage(iMLFL, dwCodePages, 1035, ok(dwCodePages == 0, "expected 0, got %u\n", dwCodePages);
&CodePage)==S_OK,
"IMLangFontLink_CodePagesToCodePage failed\n"); dwCodePages = 0;
ret = IMLangFontLink_CodePageToCodePages(iMLFL, 932, &dwCodePages);
ok(ret == S_OK, "IMLangFontLink_CodePageToCodePages error %x\n", ret);
ok(dwCodePages == FS_JISJAPAN, "expected FS_JISJAPAN, got %08x\n", dwCodePages);
CodePage = 0;
ret = IMLangFontLink_CodePagesToCodePage(iMLFL, dwCodePages, 1035, &CodePage);
ok(ret == S_OK, "IMLangFontLink_CodePagesToCodePage error %x\n", ret);
ok(CodePage == 932, "Incorrect CodePage Returned (%i)\n",CodePage); ok(CodePage == 932, "Incorrect CodePage Returned (%i)\n",CodePage);
ok(IMLangFontLink_CodePageToCodePages(iMLFL, 1252, &dwCodePages)==S_OK, dwManyCodePages = 0;
"IMLangFontLink_CodePageToCodePages failed\n"); ret = IMLangFontLink_CodePageToCodePages(iMLFL, 1252, &dwManyCodePages);
dwManyCodePages = dwManyCodePages | dwCodePages; ok(ret == S_OK, "IMLangFontLink_CodePageToCodePages error %x\n", ret);
ok(IMLangFontLink_CodePageToCodePages(iMLFL, 1256, &dwCodePages)==S_OK, ok(dwManyCodePages == FS_LATIN1, "expected FS_LATIN1, got %08x\n", dwManyCodePages);
"IMLangFontLink_CodePageToCodePages failed\n"); dwCodePages = 0;
dwManyCodePages = dwManyCodePages | dwCodePages; ret = IMLangFontLink_CodePageToCodePages(iMLFL, 1256, &dwCodePages);
ok(IMLangFontLink_CodePageToCodePages(iMLFL, 874, &dwCodePages)==S_OK, ok(ret == S_OK, "IMLangFontLink_CodePageToCodePages error %x\n", ret);
"IMLangFontLink_CodePageToCodePages failed\n"); ok(dwCodePages == FS_ARABIC, "expected FS_ARABIC, got %08x\n", dwCodePages);
dwManyCodePages = dwManyCodePages | dwCodePages; dwManyCodePages |= dwCodePages;
ret = IMLangFontLink_CodePageToCodePages(iMLFL, 874, &dwCodePages);
ok(IMLangFontLink_CodePagesToCodePage(iMLFL, dwManyCodePages, 1256, ok(ret == S_OK, "IMLangFontLink_CodePageToCodePages error %x\n", ret);
&CodePage)==S_OK, ok(dwCodePages == FS_THAI, "expected FS_THAI, got %08x\n", dwCodePages);
"IMLangFontLink_CodePagesToCodePage failed\n"); dwManyCodePages |= dwCodePages;
ret = IMLangFontLink_CodePagesToCodePage(iMLFL, dwManyCodePages, 1256, &CodePage);
ok(ret == S_OK, "IMLangFontLink_CodePagesToCodePage error %x\n", ret);
ok(CodePage == 1256, "Incorrect CodePage Returned (%i)\n",CodePage); ok(CodePage == 1256, "Incorrect CodePage Returned (%i)\n",CodePage);
ok(IMLangFontLink_CodePagesToCodePage(iMLFL, dwManyCodePages, 936, ret = IMLangFontLink_CodePagesToCodePage(iMLFL, dwManyCodePages, 936, &CodePage);
&CodePage)==S_OK, ok(ret == S_OK, "IMLangFontLink_CodePagesToCodePage error %x\n", ret);
"IMLangFontLink_CodePagesToCodePage failed\n");
ok(CodePage == 1252, "Incorrect CodePage Returned (%i)\n",CodePage); ok(CodePage == 1252, "Incorrect CodePage Returned (%i)\n",CodePage);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment