Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/user32/tests/dialog.c | 96 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+)
diff --git a/dlls/user32/tests/dialog.c b/dlls/user32/tests/dialog.c index 33e755b0b7..1632484509 100644 --- a/dlls/user32/tests/dialog.c +++ b/dlls/user32/tests/dialog.c @@ -1602,6 +1602,96 @@ static INT_PTR CALLBACK test_aw_conversion_dlgproc2(HWND hdlg, UINT msg, WPARAM return FALSE; }
+static LRESULT CALLBACK test_aw_conversion_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA); + int mode = HandleToULong(GetPropA(hwnd, "test_mode")); + WCHAR *text = (WCHAR *)lparam; + char *textA = (char *)lparam; + + switch (msg) + { + case WM_SETTEXT: + case WM_WININICHANGE: + case WM_DEVMODECHANGE: + case CB_DIR: + case LB_DIR: + case LB_ADDFILE: + case EM_REPLACESEL: + switch (mode) + { + case DLGPROCTEXT_DLGPROCA: + todo_wine_if(IsWindowUnicode(hwnd)) + ok(textA == testtext, "%s: %s, unexpected text %s.\n", IsWindowUnicode(hwnd) ? "U" : "A", + testmodes[mode], textA); + break; + case DLGPROCTEXT_DLGPROCW: + todo_wine_if(!IsWindowUnicode(hwnd)) + ok(text == testtextW, "%s: %s, unexpected text %s.\n", IsWindowUnicode(hwnd) ? "U" : "A", testmodes[mode], + wine_dbgstr_w(text)); + break; + case DLGPROCTEXT_SNDMSGA: + if (IsWindowUnicode(hwnd)) + ok(text != testtextW && !lstrcmpW(text, testtextW), + "U: %s, unexpected text %s.\n", testmodes[mode], wine_dbgstr_w(text)); + else + ok(textA == testtext, "A: %s, unexpected text %s.\n", testmodes[mode], textA); + break; + case DLGPROCTEXT_SNDMSGW: + if (IsWindowUnicode(hwnd)) + ok(text == testtextW, "U: %s, unexpected text %s.\n", testmodes[mode], wine_dbgstr_w(text)); + else + ok(textA != testtext && !strcmp(textA, testtext), "A: %s, unexpected text %s.\n", + testmodes[mode], textA); + break; + } + break; + } + + return IsWindowUnicode(hwnd) ? CallWindowProcW(oldproc, hwnd, msg, wparam, lparam) : + CallWindowProcA(oldproc, hwnd, msg, wparam, lparam); +} + +static INT_PTR CALLBACK test_aw_conversion_dlgproc3(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) +{ + BOOL is_unicode = !!lparam; + LONG_PTR oldproc; + + switch (msg) + { + case WM_INITDIALOG: + ok(is_unicode == IsWindowUnicode(hdlg), "Unexpected unicode window property.\n"); + + oldproc = SetWindowLongPtrA(hdlg, GWLP_WNDPROC, (LONG_PTR)test_aw_conversion_wndproc); + SetWindowLongPtrA(hdlg, GWLP_USERDATA, oldproc); + ok(!IsWindowUnicode(hdlg), "Unexpected unicode window.\n"); + + dlg_test_aw_message(hdlg, WM_WININICHANGE); + dlg_test_aw_message(hdlg, WM_DEVMODECHANGE); + dlg_test_aw_message(hdlg, CB_DIR); + dlg_test_aw_message(hdlg, LB_DIR); + dlg_test_aw_message(hdlg, LB_ADDFILE); + dlg_test_aw_message(hdlg, EM_REPLACESEL); + dlg_test_aw_message(hdlg, WM_SETTEXT); + + SetWindowLongPtrW(hdlg, GWLP_WNDPROC, (LONG_PTR)test_aw_conversion_wndproc); + ok(IsWindowUnicode(hdlg), "Expected unicode window.\n"); + + dlg_test_aw_message(hdlg, WM_WININICHANGE); + dlg_test_aw_message(hdlg, WM_DEVMODECHANGE); + dlg_test_aw_message(hdlg, CB_DIR); + dlg_test_aw_message(hdlg, LB_DIR); + dlg_test_aw_message(hdlg, LB_ADDFILE); + dlg_test_aw_message(hdlg, EM_REPLACESEL); + dlg_test_aw_message(hdlg, WM_SETTEXT); + + SetWindowLongPtrA(hdlg, GWLP_WNDPROC, oldproc); + EndDialog(hdlg, -123); + return TRUE; + } + return FALSE; +} + static void test_DialogBoxParam(void) { static const WCHAR nameW[] = {'T','E','S','T','_','E','M','P','T','Y','_','D','I','A','L','O','G',0}; @@ -1665,6 +1755,12 @@ static void test_DialogBoxParam(void)
ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_EMPTY_DIALOG", 0, test_aw_conversion_dlgproc2, 0); ok(ret == -123, "Unexpected ret value %ld.\n", ret); + + ret = DialogBoxParamW(GetModuleHandleA(NULL), nameW, 0, test_aw_conversion_dlgproc3, 1); + ok(ret == -123, "Unexpected ret value %ld.\n", ret); + + ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_EMPTY_DIALOG", 0, test_aw_conversion_dlgproc3, 0); + ok(ret == -123, "Unexpected ret value %ld.\n", ret); }
static void test_DisabledDialogTest(void)