Andre Wisplinghoff : user32: Add a test for ToUnicode.

Alexandre Julliard julliard at winehq.org
Wed Aug 20 08:14:04 CDT 2008


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

Author: Andre Wisplinghoff <andre.wisplinghoff at gmail.com>
Date:   Tue Aug  5 14:20:24 2008 +0200

user32: Add a test for ToUnicode.

---

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

diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c
index 7227eb7..8d60d21 100644
--- a/dlls/user32/tests/input.c
+++ b/dlls/user32/tests/input.c
@@ -1166,6 +1166,44 @@ static void test_key_map(void)
     }
 }
 
+static void test_ToUnicode(void)
+{
+    WCHAR wStr[2];
+    BYTE state[256];
+    const BYTE SC_RETURN = 0x1c, SC_TAB = 0x0f;
+    const BYTE HIGHEST_BIT = 0x80;
+    int i, ret;
+    for(i=0; i<256; i++)
+        state[i]=0;
+
+    SetLastError(0xdeadbeef);
+    ret = ToUnicode(VK_RETURN, SC_RETURN, 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] |= HIGHEST_BIT;
+    state[VK_LCONTROL] |= HIGHEST_BIT;
+
+    ret = ToUnicode(VK_TAB, SC_TAB, 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, SC_RETURN, 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] |= HIGHEST_BIT;
+    state[VK_LSHIFT] |= HIGHEST_BIT;
+    ret = ToUnicode(VK_RETURN, SC_RETURN, 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 +1217,7 @@ START_TEST(input)
     test_keynames();
     test_mouse_ll_hook();
     test_key_map();
+    test_ToUnicode();
 
     if(pGetMouseMovePointsEx)
         test_GetMouseMovePointsEx();




More information about the wine-cvs mailing list