[1/2] user32: Add a test for ToUnicode

Andre Wisplinghoff andre.wisplinghoff at gmail.com
Tue Jul 29 08:47:29 CDT 2008


These two patches are aimed at fixing bug 14248. Additionally, 
CTRL+SHIFT+Return handling is fixed.
The test passes on Vista.

Best Regards,
Andre Wisplinghoff

---
 dlls/user32/tests/input.c |   31 ++++++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c
index 7227eb7..9be8d66 100644
--- a/dlls/user32/tests/input.c
+++ b/dlls/user32/tests/input.c
@@ -1166,6 +1165,35 @@ static void test_key_map(void)
     }
 }
 
+void test_ToUnicode()
+{
+    WCHAR wStr[2];
+    BYTE state[256];
+    int i, ret;
+    for(i=0; i<256; i++)
+        state[i]=0;
+
+    ret = ToUnicode(VK_RETURN /* vkey code */, 0x1c /* scancode */, 
state /* keyboard state */, wStr, 2, 0);
+    ok(ret == 1, "ToUnicode for Return key didn't return 1 (was %i)\n", 
ret);
+    if(ret == 1)
+        ok(wStr[0]=='\r', "Unicode for CTRL + Return was %i (expected 
13)\n", wStr[0]);
+    state[VK_CONTROL] |= 0x80; // set the highest bit
+    state[VK_LCONTROL] |= 0x80;
+
+    ret = ToUnicode(VK_TAB, 0x0f, state, wStr, 2, 0);
+    ok(ret == 0, "ToUnicode for CTRL + Tab didn't return 0 (was %i)\n", 
ret);
+
+    ret = ToUnicode(VK_RETURN, 0x1c, state, wStr, 2, 0);
+    ok(ret == 1, "ToUnicode for CTRL + Return didn't return 1 (was 
%i)", ret);
+    if(ret == 1)
+        ok(wStr[0]=='\n', "Unicode for CTRL + Return was %i (expected 
10)\n", wStr[0]);
+
+    state[VK_SHIFT] |= 0x80;
+    state[VK_LSHIFT] |= 0x80;
+    ret = ToUnicode(VK_RETURN, 0x1c, state, wStr, 2, 0);
+    ok(ret == 0, "ToUnicode for CTRL + SHIFT + Return didn't return 0 
(was %i)\n", ret);
+}
+
 START_TEST(input)
 {
     init_function_pointers();
@@ -1179,6 +1207,7 @@ START_TEST(input)
     test_keynames();
     test_mouse_ll_hook();
     test_key_map();
+    test_ToUnicode();
 
     if(pGetMouseMovePointsEx)
         test_GetMouseMovePointsEx();
-- 
1.5.6.4



More information about the wine-patches mailing list