From 45a80c8cd1d0cb2dfa3d5afaadbfd22f41ee5cef Mon Sep 17 00:00:00 2001 From: Qian Hong Date: Mon, 5 Aug 2013 23:56:37 +0800 Subject: [PATCH 2/6] imm32/tests: Added tests for ImmDestroyIMCC. To: wine-patches Reply-To: wine-devel Cc: Qian Hong --- dlls/imm32/tests/imm32.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/dlls/imm32/tests/imm32.c b/dlls/imm32/tests/imm32.c index 2cdc662..6965d5f 100644 --- a/dlls/imm32/tests/imm32.c +++ b/dlls/imm32/tests/imm32.c @@ -757,6 +757,38 @@ static void test_ImmGetIMCCLockCount(void) ImmDestroyIMCC(imcc); } +static void test_ImmDestroyIMCC(void) +{ + HIMCC imcc; + DWORD ret, count, size; + VOID *p; + + imcc = ImmCreateIMCC(sizeof(CANDIDATEINFO)); + count = ImmGetIMCCLockCount(imcc); + ok(count == 0, "expect 0, returned %d\n", count); + p = ImmLockIMCC(imcc); + ok(p != NULL, "ImmLockIMCC failed!\n"); + count = ImmGetIMCCLockCount(imcc); + ok(count == 1, "expect 1, returned %d\n", count); + size = ImmGetIMCCSize(imcc); + ok(size == sizeof(CANDIDATEINFO), "expect %d, returned %d\n", sizeof(CANDIDATEINFO), size); + p = ImmDestroyIMCC(imcc); + ok(p == NULL, "Destroy an locked IMCC should success!\n"); + p = ImmLockIMCC(imcc); + todo_wine ok(p == NULL, "Lock a destroyed IMCC should fail!\n"); + ret = ImmUnlockIMCC(imcc); + todo_wine ok(ret == FALSE, "Unlock a destroyed IMCC should return FALSE!\n"); + count = ImmGetIMCCLockCount(imcc); + todo_wine ok(count == 0, "Get lock count of a destroyed IMCC should return 0!\n"); + size = ImmGetIMCCSize(imcc); + todo_wine ok(size == 0, "Get size of a destroyed IMCC should return 0!\n"); + SetLastError(0xdeadbeef); + p = ImmDestroyIMCC(imcc); + todo_wine ok(p != NULL, "returned NULL\n"); + ret = GetLastError(); + todo_wine ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret); +} + static void test_ImmMessages(void) { CANDIDATEFORM cf; @@ -918,6 +950,7 @@ START_TEST(imm32) { test_ImmDefaultHwnd(); test_ImmGetIMCLockCount(); test_ImmGetIMCCLockCount(); + test_ImmDestroyIMCC(); msg_spy_cleanup(); /* Reinitialize the hooks to capture all windows */ msg_spy_init(NULL); -- 1.7.9.5