Commit faa956f5 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

comdlg32/tests: Add a test for GetOpenFileName with a dialog template.

parent 37bbe9d4
...@@ -9,6 +9,8 @@ CTESTS = \ ...@@ -9,6 +9,8 @@ CTESTS = \
filedlg.c \ filedlg.c \
printdlg.c printdlg.c
RC_SRCS = rsrc.rc
@MAKE_TEST_RULES@ @MAKE_TEST_RULES@
@DEPENDENCIES@ # everything below this line is overwritten by make depend @DEPENDENCIES@ # everything below this line is overwritten by make depend
...@@ -205,6 +205,16 @@ cleanup: ...@@ -205,6 +205,16 @@ cleanup:
return 0; return 0;
} }
static LONG_PTR WINAPI template_hook(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (msg == WM_NOTIFY)
{
if (((LPNMHDR)lParam)->code == CDN_FOLDERCHANGE)
PostMessage(GetParent(dlg), WM_COMMAND, IDCANCEL, 0);
}
return 0;
}
static void test_create_view_window2(void) static void test_create_view_window2(void)
{ {
OPENFILENAMEA ofn = {0}; OPENFILENAMEA ofn = {0};
...@@ -222,8 +232,28 @@ static void test_create_view_window2(void) ...@@ -222,8 +232,28 @@ static void test_create_view_window2(void)
ok(!ret, "CommDlgExtendedError returned %#x\n", ret); ok(!ret, "CommDlgExtendedError returned %#x\n", ret);
} }
static void test_create_view_template(void)
{
OPENFILENAMEA ofn = {0};
char filename[1024] = {0};
DWORD ret;
ofn.lStructSize = sizeof(ofn);
ofn.lpstrFile = filename;
ofn.nMaxFile = 1042;
ofn.lpfnHook = (LPOFNHOOKPROC)template_hook;
ofn.Flags = OFN_ENABLEHOOK | OFN_EXPLORER| OFN_ENABLETEMPLATE;
ofn.hInstance = GetModuleHandleW(NULL);
ofn.lpTemplateName = "template1";
ret = GetOpenFileNameA(&ofn);
ok(!ret, "GetOpenFileNameA returned %#x\n", ret);
ret = CommDlgExtendedError();
ok(!ret, "CommDlgExtendedError returned %#x\n", ret);
}
START_TEST(filedlg) START_TEST(filedlg)
{ {
test_DialogCancel(); test_DialogCancel();
test_create_view_window2(); test_create_view_window2();
test_create_view_template();
} }
/* Resources for the common dialog unit test suite.
*
* Copyright 2008 CodeWeavers, Aric Stewart
*
* 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 "windef.h"
#include "winuser.h"
TEMPLATE1 DIALOG LOADONCALL MOVEABLE DISCARDABLE 5, 43, 227, 215
STYLE WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS
FONT 8, "MS Shell Dlg"
{
LTEXT "Path:",-1,28,4,36,8
LTEXT "Text1",-1,4,16,20,40
LTEXT "Selected:",-1,32,49,40,8
EDITTEXT 55,74,47,200,12,ES_AUTOHSCROLL
LTEXT "Text2",-1,232,20,65,8
LTEXT "",-1,28,16,204,31
EDITTEXT 56,65,2,200,12,ES_AUTOHSCROLL
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment