Huw Davies : user32/tests: Use the correct codepage for WM_CHAR tests.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jun 12 07:36:13 CDT 2015


Module: wine
Branch: master
Commit: 30c529c9f7baf683faf66a100a1e754949720aad
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=30c529c9f7baf683faf66a100a1e754949720aad

Author: Huw Davies <huw at codeweavers.com>
Date:   Fri Jun 12 10:34:32 2015 +0100

user32/tests: Use the correct codepage for WM_CHAR tests.

---

 dlls/user32/tests/msg.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 5ef3840..5cbfec8 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -11964,6 +11964,18 @@ static void test_SetForegroundWindow(void)
     DestroyWindow(hwnd);
 }
 
+static DWORD get_input_codepage( void )
+{
+    DWORD cp;
+    int ret;
+    HKL hkl = GetKeyboardLayout( 0 );
+
+    ret = GetLocaleInfoW( LOWORD(hkl), LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
+                          (WCHAR *)&cp, sizeof(cp) / sizeof(WCHAR) );
+    if (!ret) cp = CP_ACP;
+    return cp;
+}
+
 static void test_dbcs_wm_char(void)
 {
     BYTE dbch[2];
@@ -11977,6 +11989,7 @@ static void test_dbcs_wm_char(void)
     UINT i, j, k;
     struct message wmCharSeq[2];
     BOOL ret;
+    DWORD cp = get_input_codepage();
 
     if (!pGetCPInfoExA)
     {
@@ -11984,7 +11997,7 @@ static void test_dbcs_wm_char(void)
         return;
     }
 
-    pGetCPInfoExA( CP_ACP, 0, &cpinfo );
+    pGetCPInfoExA( cp, 0, &cpinfo );
     if (cpinfo.MaxCharSize != 2)
     {
         skip( "Skipping DBCS WM_CHAR test in SBCS codepage '%s'\n", cpinfo.CodePageName );
@@ -12002,8 +12015,8 @@ static void test_dbcs_wm_char(void)
                 WCHAR wstr[2];
                 str[0] = j;
                 str[1] = k;
-                if (MultiByteToWideChar( CP_ACP, 0, str, 2, wstr, 2 ) == 1 &&
-                    WideCharToMultiByte( CP_ACP, 0, wstr, 1, str, 2, NULL, NULL ) == 2 &&
+                if (MultiByteToWideChar( cp, 0, str, 2, wstr, 2 ) == 1 &&
+                    WideCharToMultiByte( cp, 0, wstr, 1, str, 2, NULL, NULL ) == 2 &&
                     (BYTE)str[0] == j && (BYTE)str[1] == k &&
                     HIBYTE(wstr[0]) && HIBYTE(wstr[0]) != 0xff)
                 {




More information about the wine-cvs mailing list