imm32/tests: Add ImmGetDescription tests
Bruno Jesus
00cpxxx at gmail.com
Wed Feb 29 21:37:05 CST 2012
-------------- next part --------------
From 6478fa4a63ad1cc7fe8d13e0175e7cf5cfe73fcb Mon Sep 17 00:00:00 2001
From: Bruno Jesus <00cpxxx at gmail.com>
Date: Thu, 1 Mar 2012 01:28:38 -0300
Subject: imm32/tests: Add ImmGetDescription tests
Tests required for bug
http://bugs.winehq.org/show_bug.cgi?id=28423
The tests show that wine needs to fix 2 different bugs: one in the ascii version which is returning one byte more than expected and the other in the way the parameters are validated (hkl).
Tested manually in winxp and windows7.
---
dlls/imm32/tests/imm32.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/dlls/imm32/tests/imm32.c b/dlls/imm32/tests/imm32.c
index eca4d5e..7fa8551 100644
--- a/dlls/imm32/tests/imm32.c
+++ b/dlls/imm32/tests/imm32.c
@@ -573,6 +573,51 @@ static void test_ImmGetContext(void)
ok(ImmReleaseContext(hwnd, himc), "ImmReleaseContext failed\n");
}
+static void test_ImmGetDescription(void)
+{
+ HKL hkl;
+ WCHAR japime[] = { 'E', '0', '0', '1', '0', '4', '1', '1', 0 };
+ WCHAR descW[100];
+ CHAR descA[100];
+ UINT ret, lret;
+
+ /* FIXME: invalid keyboard layouts should not pass */
+ ret = ImmGetDescriptionW(NULL, NULL, 0);
+ todo_wine ok(!ret, "ImmGetDescriptionW failed, expected 0 received %d.\n", ret);
+
+ /* load a language with valid IMM descriptions */
+ hkl = LoadKeyboardLayoutW(japime, KLF_ACTIVATE);
+ todo_wine ok(hkl != 0, "LoadKeyboardLayoutW failed, expected != 0.\n");
+
+ ret = ImmGetDescriptionW(hkl, NULL, 0);
+ if(!ret)
+ {
+ win_skip("ImmGetDescriptionW is not working for current loaded keyboard.\n");
+ return;
+ }
+
+ ret = ImmGetDescriptionW(hkl, descW, 0);
+ ok(ret, "ImmGetDescriptionW failed, expected != 0 received 0.\n");
+
+ lret = ImmGetDescriptionW(hkl, descW, ret + 1);
+ ok(lret, "ImmGetDescriptionW failed, expected != 0 received 0.\n");
+ ok(lret == ret, "ImmGetDescriptionW failed to return the correct amount of data. Expected %d, got %d.\n", ret, lret);
+
+ lret = ImmGetDescriptionA(hkl, descA, ret + 1);
+ ok(lret, "ImmGetDescriptionA failed, expected != 0 received 0.\n");
+ todo_wine ok(lret == ret, "ImmGetDescriptionA failed to return the correct amount of data. Expected %d, got %d.\n", ret, lret);
+
+ ret /= 2; /* try to copy partially */
+ lret = ImmGetDescriptionW(hkl, descW, ret + 1);
+ ok(lret, "ImmGetDescriptionW failed, expected != 0 received 0.\n");
+ ok(lret == ret, "ImmGetDescriptionW failed to return the correct amount of data. Expected %d, got %d.\n", ret, lret);
+
+ ret = ImmGetDescriptionW(hkl, descW, 1);
+ ok(!ret, "ImmGetDescriptionW failed, expected 0 received %d.\n", ret);
+
+ UnloadKeyboardLayout(hkl);
+}
+
START_TEST(imm32) {
if (init())
{
@@ -584,6 +629,7 @@ START_TEST(imm32) {
test_ImmThreads();
test_ImmIsUIMessage();
test_ImmGetContext();
+ test_ImmGetDescription();
}
cleanup();
}
--
1.7.2.5
More information about the wine-patches
mailing list