+
+ /* Test composition results input by IMM API */
+ prop = ImmGetProperty(GetKeyboardLayout(0), IGP_SETCOMPSTR);
+ if (!(prop & SCS_CAP_COMPSTR)) {
+ /* Wine's IME doesn't support SCS_SETSTR in ImmSetCompositionString */
+ skip("This IME doesn't support SCS_SETSTR\n");
+ }
+ else {
+ ime_composition_test.old_wnd_proc =
+ (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
+ (LONG_PTR)test_ime_wnd_proc);
+ imc = ImmGetContext(hwnd);
+ msg_spy_flush_msgs();
+
+ ret = ImmSetCompositionStringW(imc, SCS_SETSTR,
+ string, sizeof(string), NULL,0);
+ ok(ret, "ImmSetCompositionStringW failed\n");
+ wlen = ImmGetCompositionStringW(imc, GCS_COMPSTR,
+ wstring, sizeof(wstring));
+ if (wlen > 0) {
+ ret = ImmNotifyIME(imc, NI_COMPOSITIONSTR, CPS_COMPLETE, 0);
+ ok(ret, "ImmNotifyIME(CPS_COMPLETE) failed\n");
+ msg_spy_flush_msgs();
+ ok(ime_composition_test.catch_result_str,
+ "WM_IME_COMPOSITION(GCS_RESULTSTR) isn't sent\n");
+ }
+ else
+ win_skip("Composition string isn't available\n");
+ ImmReleaseContext(hwnd, imc);
+ SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
+ (LONG_PTR)ime_composition_test.old_wnd_proc);
+ msg_spy_flush_msgs();
+ }
+
+ /* Test composition results input by hand */
+ memset(&ime_composition_test, 0, sizeof(ime_composition_test));
+ if (winetest_interactive) {
+ HWND hwndMain, hwndChild;
+ MSG msg;
+ const DWORD MY_TIMER = 0xcaffe;
+
+ hwndMain = CreateWindowExA(WS_EX_CLIENTEDGE, wndcls,
+ "IME composition test",
+ WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+ CW_USEDEFAULT, CW_USEDEFAULT, 320, 160,
+ NULL, NULL, GetModuleHandleA(NULL), NULL);
+ hwndChild = CreateWindowExA(0, "static",
+ "Input a DBCS character here using IME.",
+ WS_CHILD | WS_VISIBLE,
+ 0, 0, 320, 100, hwndMain, NULL,
+ GetModuleHandleA(NULL), NULL);
+
+ ime_composition_test.old_wnd_proc =
+ (WNDPROC)SetWindowLongPtrA(hwndChild, GWLP_WNDPROC,
+ (LONG_PTR)test_ime_wnd_proc);
+
+ SetFocus(hwndChild);
+
+ ime_composition_test.timer_id = MY_TIMER;
+ ime_composition_test.start = GetTickCount();
+ SetTimer(hwndChild, ime_composition_test.timer_id, 100, NULL);
+ while (GetMessageA(&msg, NULL, 0, 0)) {
+ TranslateMessage(&msg);
+ DispatchMessageA(&msg);
+ if (!IsWindow(hwndMain))
+ break;
+ }
+ if (!ime_composition_test.catch_result_str)
+ skip("WM_IME_COMPOSITION(GCS_RESULTSTR) isn't tested\n");
+ msg_spy_flush_msgs();
+ }