Module: wine Branch: master Commit: cfe0f97067581ddd28ed19964d81b259104e5edc URL: http://source.winehq.org/git/wine.git/?a=commit;h=cfe0f97067581ddd28ed19964d...
Author: Dmitry Timoshkov dmitry@codeweavers.com Date: Sun Aug 3 14:21:35 2008 +0900
mlang: Add a test for a CodePageToCodePages failure, make it pass under Wine.
---
dlls/mlang/mlang.c | 8 +++--- dlls/mlang/tests/mlang.c | 60 ++++++++++++++++++++++++++-------------------- 2 files changed, 38 insertions(+), 30 deletions(-)
diff --git a/dlls/mlang/mlang.c b/dlls/mlang/mlang.c index 412427e..0170631 100644 --- a/dlls/mlang/mlang.c +++ b/dlls/mlang/mlang.c @@ -1883,7 +1883,6 @@ static HRESULT WINAPI fnIMLangFontLink_CodePageToCodePages( BOOL rc;
TRACE("(%p) Seeking %u\n",This, uCodePage); - memset(&cs, 0, sizeof(cs));
rc = TranslateCharsetInfo((DWORD*)uCodePage, &cs, TCI_SRCCODEPAGE);
@@ -1891,11 +1890,12 @@ static HRESULT WINAPI fnIMLangFontLink_CodePageToCodePages( { *pdwCodePages = cs.fs.fsCsb[0]; 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( diff --git a/dlls/mlang/tests/mlang.c b/dlls/mlang/tests/mlang.c index b173842..c0f9b88 100644 --- a/dlls/mlang/tests/mlang.c +++ b/dlls/mlang/tests/mlang.c @@ -640,36 +640,44 @@ static void test_EnumScripts(IMultiLanguage2 *iML2, DWORD flags)
static void IMLangFontLink_Test(IMLangFontLink* iMLFL) { - DWORD dwCodePages = 0; - DWORD dwManyCodePages = 0; - UINT CodePage = 0; - - ok(IMLangFontLink_CodePageToCodePages(iMLFL, 932, &dwCodePages)==S_OK, - "IMLangFontLink_CodePageToCodePages failed\n"); - ok (dwCodePages != 0, "No CodePages returned\n"); - ok(IMLangFontLink_CodePagesToCodePage(iMLFL, dwCodePages, 1035, - &CodePage)==S_OK, - "IMLangFontLink_CodePagesToCodePage failed\n"); + DWORD dwCodePages, dwManyCodePages; + UINT CodePage; + HRESULT ret; + + dwCodePages = ~0u; + ret = IMLangFontLink_CodePageToCodePages(iMLFL, -1, &dwCodePages); + ok(ret == E_FAIL, "IMLangFontLink_CodePageToCodePages should fail: %x\n", ret); + ok(dwCodePages == 0, "expected 0, got %u\n", dwCodePages); + + 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(IMLangFontLink_CodePageToCodePages(iMLFL, 1252, &dwCodePages)==S_OK, - "IMLangFontLink_CodePageToCodePages failed\n"); - dwManyCodePages = dwManyCodePages | dwCodePages; - ok(IMLangFontLink_CodePageToCodePages(iMLFL, 1256, &dwCodePages)==S_OK, - "IMLangFontLink_CodePageToCodePages failed\n"); - dwManyCodePages = dwManyCodePages | dwCodePages; - ok(IMLangFontLink_CodePageToCodePages(iMLFL, 874, &dwCodePages)==S_OK, - "IMLangFontLink_CodePageToCodePages failed\n"); - dwManyCodePages = dwManyCodePages | dwCodePages; - - ok(IMLangFontLink_CodePagesToCodePage(iMLFL, dwManyCodePages, 1256, - &CodePage)==S_OK, - "IMLangFontLink_CodePagesToCodePage failed\n"); + dwManyCodePages = 0; + ret = IMLangFontLink_CodePageToCodePages(iMLFL, 1252, &dwManyCodePages); + ok(ret == S_OK, "IMLangFontLink_CodePageToCodePages error %x\n", ret); + ok(dwManyCodePages == FS_LATIN1, "expected FS_LATIN1, got %08x\n", dwManyCodePages); + dwCodePages = 0; + ret = IMLangFontLink_CodePageToCodePages(iMLFL, 1256, &dwCodePages); + ok(ret == S_OK, "IMLangFontLink_CodePageToCodePages error %x\n", ret); + ok(dwCodePages == FS_ARABIC, "expected FS_ARABIC, got %08x\n", dwCodePages); + dwManyCodePages |= dwCodePages; + ret = IMLangFontLink_CodePageToCodePages(iMLFL, 874, &dwCodePages); + ok(ret == S_OK, "IMLangFontLink_CodePageToCodePages error %x\n", ret); + ok(dwCodePages == FS_THAI, "expected FS_THAI, got %08x\n", dwCodePages); + 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(IMLangFontLink_CodePagesToCodePage(iMLFL, dwManyCodePages, 936, - &CodePage)==S_OK, - "IMLangFontLink_CodePagesToCodePage failed\n"); + ret = IMLangFontLink_CodePagesToCodePage(iMLFL, dwManyCodePages, 936, &CodePage); + ok(ret == S_OK, "IMLangFontLink_CodePagesToCodePage error %x\n", ret); ok(CodePage == 1252, "Incorrect CodePage Returned (%i)\n",CodePage); }