2017-03-17 15:38:05 +01:00
|
|
|
/* 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 *);
|
2017-06-01 08:38:14 +02:00
|
|
|
static HRESULT (WINAPI *pTaskDialog)(HWND, HINSTANCE, const WCHAR *, const WCHAR *, const WCHAR *,
|
|
|
|
TASKDIALOG_COMMON_BUTTON_FLAGS, const WCHAR *, int *);
|
2017-03-17 15:38:05 +01:00
|
|
|
|
2017-09-20 13:50:01 +02:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2017-03-17 15:38:05 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2017-06-01 08:38:14 +02:00
|
|
|
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);
|
|
|
|
|
2017-03-17 15:38:05 +01:00
|
|
|
ptr_ordinal = GetProcAddress(hinst, (const char *)345);
|
|
|
|
ok(pTaskDialogIndirect == ptr_ordinal, "got wrong pointer for ordinal 345, %p expected %p\n",
|
|
|
|
ptr_ordinal, pTaskDialogIndirect);
|
|
|
|
|
2017-09-20 13:50:01 +02:00
|
|
|
test_invalid_parameters();
|
|
|
|
|
2017-03-17 15:38:05 +01:00
|
|
|
unload_v6_module(ctx_cookie, hCtx);
|
|
|
|
}
|