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

Alexandre Julliard julliard at winehq.org
Wed Oct 22 08:00:13 CDT 2008


Module: wine
Branch: master
Commit: faa956f53765e4d31c2cf5f304bbaa13eca8eda9
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=faa956f53765e4d31c2cf5f304bbaa13eca8eda9

Author: Aric Stewart <aric at codeweavers.com>
Date:   Tue Oct 21 13:10:59 2008 -0500

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

---

 dlls/comdlg32/tests/Makefile.in |    2 ++
 dlls/comdlg32/tests/filedlg.c   |   30 ++++++++++++++++++++++++++++++
 dlls/comdlg32/tests/rsrc.rc     |   34 ++++++++++++++++++++++++++++++++++
 3 files changed, 66 insertions(+), 0 deletions(-)

diff --git a/dlls/comdlg32/tests/Makefile.in b/dlls/comdlg32/tests/Makefile.in
index fae9717..11ee930 100644
--- a/dlls/comdlg32/tests/Makefile.in
+++ b/dlls/comdlg32/tests/Makefile.in
@@ -9,6 +9,8 @@ CTESTS = \
 	filedlg.c \
 	printdlg.c
 
+RC_SRCS = rsrc.rc
+
 @MAKE_TEST_RULES@
 
 @DEPENDENCIES@  # everything below this line is overwritten by make depend
diff --git a/dlls/comdlg32/tests/filedlg.c b/dlls/comdlg32/tests/filedlg.c
index 86895dc..6cfcd17 100644
--- a/dlls/comdlg32/tests/filedlg.c
+++ b/dlls/comdlg32/tests/filedlg.c
@@ -205,6 +205,16 @@ cleanup:
     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)
 {
     OPENFILENAMEA ofn = {0};
@@ -222,8 +232,28 @@ static void test_create_view_window2(void)
     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)
 {
     test_DialogCancel();
     test_create_view_window2();
+    test_create_view_template();
 }
diff --git a/dlls/comdlg32/tests/rsrc.rc b/dlls/comdlg32/tests/rsrc.rc
new file mode 100644
index 0000000..51415fd
--- /dev/null
+++ b/dlls/comdlg32/tests/rsrc.rc
@@ -0,0 +1,34 @@
+/* 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
+}




More information about the wine-cvs mailing list