Signed-off-by: Fabian Maurer dark.shadow4@web.de --- dlls/comctl32/tests/resources.h | 5 +++ dlls/comctl32/tests/rsrc.rc | 17 +++++++++ dlls/comctl32/tests/taskdialog.c | 62 ++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+)
diff --git a/dlls/comctl32/tests/resources.h b/dlls/comctl32/tests/resources.h index 3a89cd7baf..0e4ff6702c 100644 --- a/dlls/comctl32/tests/resources.h +++ b/dlls/comctl32/tests/resources.h @@ -48,4 +48,9 @@ #define IDC_PS_COMBO1 1020 #define IDC_PS_PUSHBUTTON1 1021
+#define IDC_TASKDIALOG_CREATE 1030 +#define IDC_TASKDIALOG_TEXT_TITLE 1031 +#define IDC_TASKDIALOG_TEXT_MAIN 1032 +#define IDC_TASKDIALOG_TEXT_CONTENT 1033 + #endif /* __WINE_COMCTL32_TEST_RESOURCES_H */ diff --git a/dlls/comctl32/tests/rsrc.rc b/dlls/comctl32/tests/rsrc.rc index 959130e2f1..fad3f71858 100644 --- a/dlls/comctl32/tests/rsrc.rc +++ b/dlls/comctl32/tests/rsrc.rc @@ -173,3 +173,20 @@ FONT 8, "MS Shell Dlg" PUSHBUTTON "Cancel", IDCANCEL, 100, 60, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP EDITTEXT 1000, 5, 5, 150, 50, WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL | ES_AUTOVSCROLL | ES_WANTRETURN } + +TAKDIALOG_CREATOR DIALOG 0, 0, 600, 500 +STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | DS_CENTER +CAPTION "Taskdialog Creator" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Title:", -1, 5, 5, 70, 15, BS_CENTER + EDITTEXT IDC_TASKDIALOG_TEXT_TITLE, 75, 5, 450, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_WANTRETURN + + LTEXT "Main Instruction:", -1, 5, 25, 70, 50, BS_CENTER + EDITTEXT IDC_TASKDIALOG_TEXT_MAIN, 75, 25, 450, 50, WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL | ES_MULTILINE | ES_WANTRETURN + + LTEXT "Content:", -1, 5, 80, 70, 50, BS_CENTER + EDITTEXT IDC_TASKDIALOG_TEXT_CONTENT, 75, 80, 450, 50, WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL | ES_MULTILINE | ES_WANTRETURN + + PUSHBUTTON "Create Taskdialog", IDC_TASKDIALOG_CREATE, 260, 460, 80, 30, WS_CHILD | WS_VISIBLE | WS_TABSTOP +} diff --git a/dlls/comctl32/tests/taskdialog.c b/dlls/comctl32/tests/taskdialog.c index 432b89bd15..3b78f4fbf7 100644 --- a/dlls/comctl32/tests/taskdialog.c +++ b/dlls/comctl32/tests/taskdialog.c @@ -28,6 +28,7 @@ #include "wine/test.h" #include "v6util.h" #include "msg.h" +#include "resources.h"
#define WM_TD_CALLBACK (WM_APP) /* Custom dummy message to wrap callback notifications */
@@ -374,6 +375,61 @@ static void test_timer(void) pTaskDialogIndirect(&info, NULL, NULL, NULL); }
+/* Caller must free the buffer */ +static WCHAR* control_get_text(HWND hdlg, int id_control) +{ + HWND hwnd_control = GetDlgItem(hdlg, id_control); + int text_length = GetWindowTextLengthW(hwnd_control); + WCHAR *text = heap_alloc((text_length + 1) * sizeof(WCHAR)); + GetWindowTextW(hwnd_control, text, text_length + 1); + return text; +} + +static void taskdialog_creator_create(HWND hdlg) +{ + TASKDIALOGCONFIG info = { 0 }; + WCHAR *text_title; + WCHAR *text_main_instruction; + WCHAR *text_content; + + text_title = control_get_text(hdlg, IDC_TASKDIALOG_TEXT_TITLE); + text_main_instruction = control_get_text(hdlg, IDC_TASKDIALOG_TEXT_MAIN); + text_content = control_get_text(hdlg, IDC_TASKDIALOG_TEXT_CONTENT); + + info.cbSize = sizeof(TASKDIALOGCONFIG); + info.hwndParent = hdlg; + info.pszWindowTitle = text_title; + info.pszMainInstruction = text_main_instruction; + info.pszContent = text_content; + + pTaskDialogIndirect(&info, NULL, NULL, NULL); + + heap_free(text_title); + heap_free(text_main_instruction); + heap_free(text_content); +} + +static INT_PTR CALLBACK taskdialog_creator_proc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) +{ + switch (msg) + { + case WM_COMMAND: + if (HIWORD(wparam) == BN_CLICKED && LOWORD(wparam) == IDC_TASKDIALOG_CREATE) + { + taskdialog_creator_create(hdlg); + } + break; + case WM_CLOSE: + EndDialog(hdlg, 0); + break; + + default: + break; + } + + return FALSE; +} + START_TEST(taskdialog) { ULONG_PTR ctx_cookie; @@ -405,6 +461,12 @@ START_TEST(taskdialog) ok(pTaskDialogIndirect == ptr_ordinal, "got wrong pointer for ordinal 345, %p expected %p\n", ptr_ordinal, pTaskDialogIndirect);
+ if (winetest_interactive) + { + DialogBoxParamA(GetModuleHandleA(NULL), "TAKDIALOG_CREATOR", NULL, taskdialog_creator_proc, 0); + return; + } + init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
test_invalid_parameters();