Qian Hong : imm32/tests: Added tests for ImmDestroyContext.

Alexandre Julliard julliard at winehq.org
Fri Aug 16 14:23:47 CDT 2013


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

Author: Qian Hong <qhong at codeweavers.com>
Date:   Mon Aug 12 22:10:52 2013 +0800

imm32/tests: Added tests for ImmDestroyContext.

---

 dlls/imm32/tests/imm32.c |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/dlls/imm32/tests/imm32.c b/dlls/imm32/tests/imm32.c
index 13b9bc1..62bdb64 100644
--- a/dlls/imm32/tests/imm32.c
+++ b/dlls/imm32/tests/imm32.c
@@ -774,6 +774,34 @@ static void test_ImmGetIMCCLockCount(void)
     ImmDestroyIMCC(imcc);
 }
 
+static void test_ImmDestroyContext(void)
+{
+    HIMC imc;
+    DWORD ret, count;
+    INPUTCONTEXT *ic;
+
+    imc = ImmCreateContext();
+    count = ImmGetIMCLockCount(imc);
+    ok(count == 0, "expect 0, returned %d\n", count);
+    ic = ImmLockIMC(imc);
+    ok(ic != NULL, "ImmLockIMC failed!\n");
+    count = ImmGetIMCLockCount(imc);
+    ok(count == 1, "expect 1, returned %d\n", count);
+    ret = ImmDestroyContext(imc);
+    ok(ret == TRUE, "Destroy a locked IMC should success!\n");
+    ic = ImmLockIMC(imc);
+    todo_wine ok(ic == NULL, "Lock a destroyed IMC should fail!\n");
+    ret = ImmUnlockIMC(imc);
+    todo_wine ok(ret == FALSE, "Unlock a destroyed IMC should fail!\n");
+    count = ImmGetIMCLockCount(imc);
+    todo_wine ok(count == 0, "Get lock count of a destroyed IMC should return 0!\n");
+    SetLastError(0xdeadbeef);
+    ret = ImmDestroyContext(imc);
+    todo_wine ok(ret == FALSE, "Destroy a destroyed IMC should fail!\n");
+    ret = GetLastError();
+    todo_wine ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
+}
+
 static void test_ImmDestroyIMCC(void)
 {
     HIMCC imcc;
@@ -967,6 +995,7 @@ START_TEST(imm32) {
         test_ImmDefaultHwnd();
         test_ImmGetIMCLockCount();
         test_ImmGetIMCCLockCount();
+        test_ImmDestroyContext();
         test_ImmDestroyIMCC();
         msg_spy_cleanup();
         /* Reinitialize the hooks to capture all windows */




More information about the wine-cvs mailing list