Fabian Maurer : comctl32/taskdialog: Move TaskDialogIndirect and its tests into own source files.
Module: wine Branch: master Commit: e2245bcd3ca6c9851a51be1ebdaaa49c1a1fdee5 URL: http://source.winehq.org/git/wine.git/?a=commit;h=e2245bcd3ca6c9851a51be1ebd... Author: Fabian Maurer <dark.shadow4(a)web.de> Date: Fri Mar 17 17:38:05 2017 +0300 comctl32/taskdialog: Move TaskDialogIndirect and its tests into own source files. Signed-off-by: Fabian Maurer <dark.shadow4(a)web.de> Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/comctl32/Makefile.in | 1 + dlls/comctl32/commctrl.c | 39 --------------------- dlls/comctl32/taskdialog.c | 76 ++++++++++++++++++++++++++++++++++++++++ dlls/comctl32/tests/Makefile.in | 1 + dlls/comctl32/tests/misc.c | 19 ---------- dlls/comctl32/tests/taskdialog.c | 58 ++++++++++++++++++++++++++++++ 6 files changed, 136 insertions(+), 58 deletions(-) diff --git a/dlls/comctl32/Makefile.in b/dlls/comctl32/Makefile.in index 27f9741..e1a6812 100644 --- a/dlls/comctl32/Makefile.in +++ b/dlls/comctl32/Makefile.in @@ -30,6 +30,7 @@ C_SRCS = \ string.c \ syslink.c \ tab.c \ + taskdialog.c \ theme_button.c \ theme_combo.c \ theme_dialog.c \ diff --git a/dlls/comctl32/commctrl.c b/dlls/comctl32/commctrl.c index 2a4cd42..d3ba314 100644 --- a/dlls/comctl32/commctrl.c +++ b/dlls/comctl32/commctrl.c @@ -1622,45 +1622,6 @@ int WINAPI DrawShadowText(HDC hdc, LPCWSTR text, UINT length, RECT *rect, DWORD } /*********************************************************************** - * TaskDialogIndirect [COMCTL32.@] - */ -HRESULT WINAPI TaskDialogIndirect(const TASKDIALOGCONFIG *pTaskConfig, int *pnButton, - int *pnRadioButton, BOOL *pfVerificationFlagChecked) -{ - UINT uType = 0; - INT ret; - FIXME("%p, %p, %p, %p\n", pTaskConfig, pnButton, pnRadioButton, pfVerificationFlagChecked); - - if (pTaskConfig->dwCommonButtons & TDCBF_YES_BUTTON && - pTaskConfig->dwCommonButtons & TDCBF_NO_BUTTON && - pTaskConfig->dwCommonButtons & TDCBF_CANCEL_BUTTON) - uType |= MB_YESNOCANCEL; - else - if (pTaskConfig->dwCommonButtons & TDCBF_YES_BUTTON && - pTaskConfig->dwCommonButtons & TDCBF_NO_BUTTON) - uType |= MB_YESNO; - else - if (pTaskConfig->dwCommonButtons & TDCBF_RETRY_BUTTON && - pTaskConfig->dwCommonButtons & TDCBF_CANCEL_BUTTON) - uType |= MB_RETRYCANCEL; - else - if (pTaskConfig->dwCommonButtons & TDCBF_OK_BUTTON && - pTaskConfig->dwCommonButtons & TDCBF_CANCEL_BUTTON) - uType |= MB_OKCANCEL; - else - if (pTaskConfig->dwCommonButtons & TDCBF_OK_BUTTON) - uType |= MB_OK; - ret = MessageBoxW(pTaskConfig->hwndParent, pTaskConfig->pszMainInstruction, - pTaskConfig->pszWindowTitle, uType); - FIXME("dwCommonButtons=%x uType=%x ret=%x\n", pTaskConfig->dwCommonButtons, uType, ret); - - if (pnButton) *pnButton = ret; - if (pnRadioButton) *pnRadioButton = pTaskConfig->nDefaultButton; - if (pfVerificationFlagChecked) *pfVerificationFlagChecked = TRUE; - return S_OK; -} - -/*********************************************************************** * LoadIconWithScaleDown [COMCTL32.@] */ HRESULT WINAPI LoadIconWithScaleDown(HINSTANCE hinst, const WCHAR *name, int cx, int cy, HICON *icon) diff --git a/dlls/comctl32/taskdialog.c b/dlls/comctl32/taskdialog.c new file mode 100644 index 0000000..15824d3 --- /dev/null +++ b/dlls/comctl32/taskdialog.c @@ -0,0 +1,76 @@ +/* + * Task dialog control + * + * Copyright 2017 Fabian Maurer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + * + */ + +#include <stdarg.h> +#include <string.h> + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "commctrl.h" +#include "winerror.h" +#include "comctl32.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(taskdialog); + +/*********************************************************************** + * TaskDialogIndirect [COMCTL32.@] + */ +HRESULT WINAPI TaskDialogIndirect(const TASKDIALOGCONFIG *taskconfig, int *button, + int *radio_button, BOOL *verification_flag_checked) +{ + UINT type = 0; + INT ret; + + TRACE("%p, %p, %p, %p\n", taskconfig, button, radio_button, verification_flag_checked); + + if (taskconfig->dwCommonButtons & TDCBF_YES_BUTTON && + taskconfig->dwCommonButtons & TDCBF_NO_BUTTON && + taskconfig->dwCommonButtons & TDCBF_CANCEL_BUTTON) + type |= MB_YESNOCANCEL; + else + if (taskconfig->dwCommonButtons & TDCBF_YES_BUTTON && + taskconfig->dwCommonButtons & TDCBF_NO_BUTTON) + type |= MB_YESNO; + else + if (taskconfig->dwCommonButtons & TDCBF_RETRY_BUTTON && + taskconfig->dwCommonButtons & TDCBF_CANCEL_BUTTON) + type |= MB_RETRYCANCEL; + else + if (taskconfig->dwCommonButtons & TDCBF_OK_BUTTON && + taskconfig->dwCommonButtons & TDCBF_CANCEL_BUTTON) + type |= MB_OKCANCEL; + else + if (taskconfig->dwCommonButtons & TDCBF_OK_BUTTON) + type |= MB_OK; + + ret = MessageBoxW(taskconfig->hwndParent, taskconfig->pszMainInstruction, + taskconfig->pszWindowTitle, type); + + FIXME("dwCommonButtons=%x type=%x ret=%x\n", taskconfig->dwCommonButtons, type, ret); + + if (button) *button = ret; + if (radio_button) *radio_button = taskconfig->nDefaultButton; + if (verification_flag_checked) *verification_flag_checked = TRUE; + + return S_OK; +} diff --git a/dlls/comctl32/tests/Makefile.in b/dlls/comctl32/tests/Makefile.in index cb2fdf3..5faf1f8 100644 --- a/dlls/comctl32/tests/Makefile.in +++ b/dlls/comctl32/tests/Makefile.in @@ -22,6 +22,7 @@ C_SRCS = \ subclass.c \ syslink.c \ tab.c \ + taskdialog.c \ toolbar.c \ tooltips.c \ trackbar.c \ diff --git a/dlls/comctl32/tests/misc.c b/dlls/comctl32/tests/misc.c index 5cc6c29..a6939bd 100644 --- a/dlls/comctl32/tests/misc.c +++ b/dlls/comctl32/tests/misc.c @@ -200,24 +200,6 @@ static void test_Alloc(void) ok(res == TRUE, "Expected TRUE, got %d\n", res); } -static void test_TaskDialogIndirect(void) -{ - HINSTANCE hinst; - void *ptr, *ptr2; - - hinst = LoadLibraryA("comctl32.dll"); - - ptr = GetProcAddress(hinst, "TaskDialogIndirect"); - if (!ptr) - { - win_skip("TaskDialogIndirect not exported by name\n"); - return; - } - - ptr2 = GetProcAddress(hinst, (const CHAR*)345); - ok(ptr == ptr2, "got wrong pointer for ordinal 345, %p expected %p\n", ptr2, ptr); -} - static void test_LoadIconWithScaleDown(void) { static const WCHAR nonexisting_fileW[] = {'n','o','n','e','x','i','s','t','i','n','g','.','i','c','o',0}; @@ -402,7 +384,6 @@ START_TEST(misc) return; test_builtin_classes(); - test_TaskDialogIndirect(); test_LoadIconWithScaleDown(); unload_v6_module(ctx_cookie, hCtx); diff --git a/dlls/comctl32/tests/taskdialog.c b/dlls/comctl32/tests/taskdialog.c new file mode 100644 index 0000000..8a9d164 --- /dev/null +++ b/dlls/comctl32/tests/taskdialog.c @@ -0,0 +1,58 @@ +/* Unit tests for the task dialog control. + * + * Copyright 2017 Fabian Maurer for the Wine project + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "commctrl.h" + +#include "wine/test.h" +#include "v6util.h" + +static HRESULT (WINAPI *pTaskDialogIndirect)(const TASKDIALOGCONFIG *, int *, int *, BOOL *); + +START_TEST(taskdialog) +{ + ULONG_PTR ctx_cookie; + void *ptr_ordinal; + HINSTANCE hinst; + HANDLE hCtx; + + if (!load_v6_module(&ctx_cookie, &hCtx)) + return; + + /* Check if task dialogs are available */ + hinst = LoadLibraryA("comctl32.dll"); + + pTaskDialogIndirect = (void *)GetProcAddress(hinst, "TaskDialogIndirect"); + if (!pTaskDialogIndirect) + { + win_skip("TaskDialogIndirect not exported by name\n"); + unload_v6_module(ctx_cookie, hCtx); + return; + } + + ptr_ordinal = GetProcAddress(hinst, (const char *)345); + ok(pTaskDialogIndirect == ptr_ordinal, "got wrong pointer for ordinal 345, %p expected %p\n", + ptr_ordinal, pTaskDialogIndirect); + + unload_v6_module(ctx_cookie, hCtx); +}
participants (1)
-
Alexandre Julliard