Commit 4b04d357 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

imm32/tests: Add explicit ImmLoadIME / ImmFreeLayout calls.

parent 99cbab72
...@@ -2981,7 +2981,7 @@ static HKL ime_install(void) ...@@ -2981,7 +2981,7 @@ static HKL ime_install(void)
return hkl; return hkl;
} }
static void ime_cleanup( HKL hkl ) static void ime_cleanup( HKL hkl, BOOL free )
{ {
HMODULE module = GetModuleHandleW( L"winetest_ime.dll" ); HMODULE module = GetModuleHandleW( L"winetest_ime.dll" );
WCHAR buffer[MAX_PATH], value[MAX_PATH]; WCHAR buffer[MAX_PATH], value[MAX_PATH];
...@@ -2992,6 +2992,8 @@ static void ime_cleanup( HKL hkl ) ...@@ -2992,6 +2992,8 @@ static void ime_cleanup( HKL hkl )
todo_wine todo_wine
ok( ret, "UnloadKeyboardLayout failed, error %lu\n", GetLastError() ); ok( ret, "UnloadKeyboardLayout failed, error %lu\n", GetLastError() );
if (free) ok_ret( 1, ImmFreeLayout( hkl ) );
swprintf( buffer, ARRAY_SIZE(buffer), L"System\\CurrentControlSet\\Control\\Keyboard Layouts\\%08x", hkl ); swprintf( buffer, ARRAY_SIZE(buffer), L"System\\CurrentControlSet\\Control\\Keyboard Layouts\\%08x", hkl );
ret = RegDeleteKeyW( HKEY_LOCAL_MACHINE, buffer ); ret = RegDeleteKeyW( HKEY_LOCAL_MACHINE, buffer );
ok( !ret, "RegDeleteKeyW returned %#lx, error %lu\n", ret, GetLastError() ); ok( !ret, "RegDeleteKeyW returned %#lx, error %lu\n", ret, GetLastError() );
...@@ -3094,7 +3096,7 @@ static void test_ImmInstallIME(void) ...@@ -3094,7 +3096,7 @@ static void test_ImmInstallIME(void)
ret = ImmFreeLayout( hkl ); ret = ImmFreeLayout( hkl );
ok( ret, "ImmFreeLayout returned %#x\n", ret ); ok( ret, "ImmFreeLayout returned %#x\n", ret );
ime_cleanup( hkl ); ime_cleanup( hkl, FALSE );
ime_info.fdwProperty = 0; ime_info.fdwProperty = 0;
...@@ -3120,7 +3122,7 @@ static void test_ImmInstallIME(void) ...@@ -3120,7 +3122,7 @@ static void test_ImmInstallIME(void)
ret = ImmFreeLayout( hkl ); ret = ImmFreeLayout( hkl );
ok( ret, "ImmFreeLayout returned %#x\n", ret ); ok( ret, "ImmFreeLayout returned %#x\n", ret );
ime_cleanup( hkl ); ime_cleanup( hkl, FALSE );
cleanup: cleanup:
SET_ENABLE( IME_DLL_PROCESS_ATTACH, FALSE ); SET_ENABLE( IME_DLL_PROCESS_ATTACH, FALSE );
...@@ -3159,7 +3161,7 @@ static void test_ImmIsIME(void) ...@@ -3159,7 +3161,7 @@ static void test_ImmIsIME(void)
todo_ImeInquire = FALSE; todo_ImeInquire = FALSE;
todo_ImeDestroy = FALSE; todo_ImeDestroy = FALSE;
ime_cleanup( hkl ); ime_cleanup( hkl, FALSE );
cleanup: cleanup:
SET_ENABLE( IME_DLL_PROCESS_ATTACH, FALSE ); SET_ENABLE( IME_DLL_PROCESS_ATTACH, FALSE );
...@@ -3254,7 +3256,7 @@ static void test_ImmGetProperty(void) ...@@ -3254,7 +3256,7 @@ static void test_ImmGetProperty(void)
todo_ImeDestroy = FALSE; todo_ImeDestroy = FALSE;
called_ImeDestroy = FALSE; called_ImeDestroy = FALSE;
ime_cleanup( hkl ); ime_cleanup( hkl, FALSE );
cleanup: cleanup:
SET_ENABLE( ImeInquire, FALSE ); SET_ENABLE( ImeInquire, FALSE );
...@@ -3327,7 +3329,7 @@ static void test_ImmGetDescription(void) ...@@ -3327,7 +3329,7 @@ static void test_ImmGetDescription(void)
ok( ret == 12, "ImmGetDescriptionA returned %lu\n", ret ); ok( ret == 12, "ImmGetDescriptionA returned %lu\n", ret );
ok( !strcmp( bufferA, "WineTest IME" ), "got bufferA %s\n", debugstr_a(bufferA) ); ok( !strcmp( bufferA, "WineTest IME" ), "got bufferA %s\n", debugstr_a(bufferA) );
ime_cleanup( hkl ); ime_cleanup( hkl, FALSE );
cleanup: cleanup:
SET_ENABLE( IME_DLL_PROCESS_ATTACH, FALSE ); SET_ENABLE( IME_DLL_PROCESS_ATTACH, FALSE );
...@@ -3406,7 +3408,7 @@ static void test_ImmGetIMEFileName(void) ...@@ -3406,7 +3408,7 @@ static void test_ImmGetIMEFileName(void)
ok( ret == 12, "ImmGetIMEFileNameA returned %lu\n", ret ); ok( ret == 12, "ImmGetIMEFileNameA returned %lu\n", ret );
ok( !strcmp( bufferA, expectA ), "got bufferA %s\n", debugstr_a(bufferA) ); ok( !strcmp( bufferA, expectA ), "got bufferA %s\n", debugstr_a(bufferA) );
ime_cleanup( hkl ); ime_cleanup( hkl, FALSE );
cleanup: cleanup:
SET_ENABLE( IME_DLL_PROCESS_ATTACH, FALSE ); SET_ENABLE( IME_DLL_PROCESS_ATTACH, FALSE );
...@@ -3514,7 +3516,7 @@ static void test_ImmEscape( BOOL unicode ) ...@@ -3514,7 +3516,7 @@ static void test_ImmEscape( BOOL unicode )
winetest_pop_context(); winetest_pop_context();
} }
ime_cleanup( hkl ); ime_cleanup( hkl, FALSE );
cleanup: cleanup:
SET_ENABLE( ImeEscape, FALSE ); SET_ENABLE( ImeEscape, FALSE );
...@@ -3582,7 +3584,7 @@ static void test_ImmEnumRegisterWord( BOOL unicode ) ...@@ -3582,7 +3584,7 @@ static void test_ImmEnumRegisterWord( BOOL unicode )
ok_ret( 0xdeadbeef, ImmEnumRegisterWordA( hkl, enum_register_wordA, "Reading", 0xdeadbeef, "String", NULL ) ); ok_ret( 0xdeadbeef, ImmEnumRegisterWordA( hkl, enum_register_wordA, "Reading", 0xdeadbeef, "String", NULL ) );
CHECK_CALLED( ImeEnumRegisterWord ); CHECK_CALLED( ImeEnumRegisterWord );
ime_cleanup( hkl ); ime_cleanup( hkl, FALSE );
cleanup: cleanup:
SET_ENABLE( ImeEnumRegisterWord, FALSE ); SET_ENABLE( ImeEnumRegisterWord, FALSE );
...@@ -3644,7 +3646,7 @@ static void test_ImmRegisterWord( BOOL unicode ) ...@@ -3644,7 +3646,7 @@ static void test_ImmRegisterWord( BOOL unicode )
ok_ret( 0, ImmRegisterWordA( hkl, NULL, 0, "String" ) ); ok_ret( 0, ImmRegisterWordA( hkl, NULL, 0, "String" ) );
CHECK_CALLED( ImeRegisterWord ); CHECK_CALLED( ImeRegisterWord );
ime_cleanup( hkl ); ime_cleanup( hkl, FALSE );
cleanup: cleanup:
SET_ENABLE( ImeRegisterWord, FALSE ); SET_ENABLE( ImeRegisterWord, FALSE );
...@@ -3721,7 +3723,7 @@ skip_null: ...@@ -3721,7 +3723,7 @@ skip_null:
} }
CHECK_CALLED( ImeGetRegisterWordStyle ); CHECK_CALLED( ImeGetRegisterWordStyle );
ime_cleanup( hkl ); ime_cleanup( hkl, FALSE );
cleanup: cleanup:
SET_ENABLE( ImeGetRegisterWordStyle, FALSE ); SET_ENABLE( ImeGetRegisterWordStyle, FALSE );
...@@ -3783,7 +3785,7 @@ static void test_ImmUnregisterWord( BOOL unicode ) ...@@ -3783,7 +3785,7 @@ static void test_ImmUnregisterWord( BOOL unicode )
ok_ret( 0, ImmUnregisterWordA( hkl, NULL, 0, "String" ) ); ok_ret( 0, ImmUnregisterWordA( hkl, NULL, 0, "String" ) );
CHECK_CALLED( ImeUnregisterWord ); CHECK_CALLED( ImeUnregisterWord );
ime_cleanup( hkl ); ime_cleanup( hkl, FALSE );
cleanup: cleanup:
SET_ENABLE( ImeUnregisterWord, FALSE ); SET_ENABLE( ImeUnregisterWord, FALSE );
...@@ -3852,6 +3854,7 @@ static void test_ImmActivateLayout(void) ...@@ -3852,6 +3854,7 @@ static void test_ImmActivateLayout(void)
ok_ret( 1, ImmActivateLayout( hkl ) ); ok_ret( 1, ImmActivateLayout( hkl ) );
ok_seq( activate_seq ); ok_seq( activate_seq );
CHECK_CALLED( ImeInquire ); CHECK_CALLED( ImeInquire );
ok_ret( 1, ImmLoadIME( hkl ) );
ok_eq( hkl, GetKeyboardLayout( 0 ), HKL, "%p" ); ok_eq( hkl, GetKeyboardLayout( 0 ), HKL, "%p" );
...@@ -3865,7 +3868,7 @@ static void test_ImmActivateLayout(void) ...@@ -3865,7 +3868,7 @@ static void test_ImmActivateLayout(void)
ok_eq( old_hkl, GetKeyboardLayout( 0 ), HKL, "%p" ); ok_eq( old_hkl, GetKeyboardLayout( 0 ), HKL, "%p" );
ime_cleanup( hkl ); ime_cleanup( hkl, FALSE );
ok_seq( empty_sequence ); ok_seq( empty_sequence );
...@@ -3892,6 +3895,9 @@ static void test_ImmActivateLayout(void) ...@@ -3892,6 +3895,9 @@ static void test_ImmActivateLayout(void)
todo_wine todo_wine
CHECK_CALLED( ImeInquire ); CHECK_CALLED( ImeInquire );
ok_seq( activate_with_window_seq ); ok_seq( activate_with_window_seq );
todo_ImeInquire = TRUE;
ok_ret( 1, ImmLoadIME( hkl ) );
todo_ImeInquire = FALSE;
ok_eq( hkl, GetKeyboardLayout( 0 ), HKL, "%p" ); ok_eq( hkl, GetKeyboardLayout( 0 ), HKL, "%p" );
...@@ -3900,15 +3906,8 @@ static void test_ImmActivateLayout(void) ...@@ -3900,15 +3906,8 @@ static void test_ImmActivateLayout(void)
ok_eq( old_hkl, GetKeyboardLayout( 0 ), HKL, "%p" ); ok_eq( old_hkl, GetKeyboardLayout( 0 ), HKL, "%p" );
ime_cleanup( hkl );
ok_seq( empty_sequence );
/* ImmActivateLayout leaks the IME, we need to free it manually */
SET_EXPECT( ImeDestroy ); SET_EXPECT( ImeDestroy );
ret = ImmFreeLayout( hkl ); ime_cleanup( hkl, TRUE );
ok( ret, "ImmFreeLayout returned %u\n", ret );
todo_wine
CHECK_CALLED( ImeDestroy ); CHECK_CALLED( ImeDestroy );
ok_seq( empty_sequence ); ok_seq( empty_sequence );
...@@ -4015,6 +4014,7 @@ static void test_ImmCreateInputContext(void) ...@@ -4015,6 +4014,7 @@ static void test_ImmCreateInputContext(void)
if (!(hkl = ime_install())) goto cleanup; if (!(hkl = ime_install())) goto cleanup;
ok_ret( 1, ImmLoadIME( hkl ) );
/* Activating the layout calls ImeSelect 1 on existing HIMC */ /* Activating the layout calls ImeSelect 1 on existing HIMC */
...@@ -4063,8 +4063,7 @@ static void test_ImmCreateInputContext(void) ...@@ -4063,8 +4063,7 @@ static void test_ImmCreateInputContext(void)
ok_eq( old_hkl, GetKeyboardLayout( 0 ), HKL, "%p" ); ok_eq( old_hkl, GetKeyboardLayout( 0 ), HKL, "%p" );
ok_ret( 1, ImmFreeLayout( hkl ) ); ime_cleanup( hkl, TRUE );
ime_cleanup( hkl );
ok_seq( empty_sequence ); ok_seq( empty_sequence );
cleanup: cleanup:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment