[1/2] user32: Add a test for ToUnicode (try 4)

Andre Wisplinghoff andre.wisplinghoff at gmail.com
Thu Jul 31 07:57:53 CDT 2008


Sorry my last patch was still wrapped... had some trouble with Thunderbird.

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

diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c
index 7227eb7..7c58992 100644
--- a/dlls/user32/tests/input.c
+++ b/dlls/user32/tests/input.c
@@ -1166,6 +1166,42 @@ 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;
+
+    SetLastError(0xdeadbeef);
+    ret = ToUnicode(VK_RETURN /* vkey code */, 0x1c /* scancode */, 
state /* keyboard state */, wStr, 2, 0);
+    if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+    {
+        skip("ToUnicode is not implemented\n");
+        return;
+    }
+
+    ok(ret == 1, "ToUnicode for Return key didn't return 1 (was %i)\n", 
ret);
+    if(ret == 1)
+        ok(wStr[0]=='\r', "ToUnicode 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);
+    todo_wine 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', "ToUnicode 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);
+    todo_wine ok(ret == 0, "ToUnicode for CTRL + SHIFT + Return didn't 
return 0 (was %i)\n", ret);
+}
+
 START_TEST(input)
 {
     init_function_pointers();
@@ -1179,6 +1215,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