90 lines
3.0 KiB
C
90 lines
3.0 KiB
C
/* 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 *);
|
|
static HRESULT (WINAPI *pTaskDialog)(HWND, HINSTANCE, const WCHAR *, const WCHAR *, const WCHAR *,
|
|
TASKDIALOG_COMMON_BUTTON_FLAGS, const WCHAR *, int *);
|
|
|
|
static void test_invalid_parameters(void)
|
|
{
|
|
TASKDIALOGCONFIG info = { 0 };
|
|
HRESULT hr;
|
|
|
|
hr = pTaskDialogIndirect(NULL, NULL, NULL, NULL);
|
|
ok(hr == E_INVALIDARG, "Unexpected return value %#x.\n", hr);
|
|
|
|
info.cbSize = 0;
|
|
hr = pTaskDialogIndirect(&info, NULL, NULL, NULL);
|
|
ok(hr == E_INVALIDARG, "Unexpected return value %#x.\n", hr);
|
|
|
|
info.cbSize = sizeof(TASKDIALOGCONFIG) - 1;
|
|
hr = pTaskDialogIndirect(&info, NULL, NULL, NULL);
|
|
ok(hr == E_INVALIDARG, "Unexpected return value %#x.\n", hr);
|
|
|
|
info.cbSize = sizeof(TASKDIALOGCONFIG) + 1;
|
|
hr = pTaskDialogIndirect(&info, NULL, NULL, NULL);
|
|
ok(hr == E_INVALIDARG, "Unexpected return value %#x.\n", hr);
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
pTaskDialog = (void *)GetProcAddress(hinst, "TaskDialog");
|
|
|
|
ptr_ordinal = GetProcAddress(hinst, (const char *)344);
|
|
ok(pTaskDialog == ptr_ordinal, "got wrong pointer for ordinal 344, %p expected %p\n",
|
|
ptr_ordinal, pTaskDialog);
|
|
|
|
ptr_ordinal = GetProcAddress(hinst, (const char *)345);
|
|
ok(pTaskDialogIndirect == ptr_ordinal, "got wrong pointer for ordinal 345, %p expected %p\n",
|
|
ptr_ordinal, pTaskDialogIndirect);
|
|
|
|
test_invalid_parameters();
|
|
|
|
unload_v6_module(ctx_cookie, hCtx);
|
|
}
|