Paul Vriens : comdlg32/tests: Test the correct path length for CDM_GETFOLDERPATH.
Alexandre Julliard
julliard at winehq.org
Wed Sep 16 15:59:41 CDT 2009
Module: wine
Branch: master
Commit: 6a3c56a5890395430619c873e08a01487c0fadfd
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6a3c56a5890395430619c873e08a01487c0fadfd
Author: Paul Vriens <Paul.Vriens.Wine at gmail.com>
Date: Wed Sep 16 11:52:04 2009 +0200
comdlg32/tests: Test the correct path length for CDM_GETFOLDERPATH.
---
dlls/comdlg32/tests/filedlg.c | 62 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 62 insertions(+), 0 deletions(-)
diff --git a/dlls/comdlg32/tests/filedlg.c b/dlls/comdlg32/tests/filedlg.c
index 8c32866..6583130 100644
--- a/dlls/comdlg32/tests/filedlg.c
+++ b/dlls/comdlg32/tests/filedlg.c
@@ -873,6 +873,67 @@ static void test_arrange(void)
}
}
+static CHAR WINDIR[MAX_PATH];
+
+static UINT_PTR CALLBACK path_hook_proc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ LPNMHDR nmh;
+
+ if( msg == WM_NOTIFY)
+ {
+ nmh = (LPNMHDR) lParam;
+ if( nmh->code == CDN_INITDONE)
+ {
+ PostMessage( GetParent(hDlg), WM_COMMAND, IDCANCEL, FALSE);
+ }
+ else if ( nmh->code == CDN_FOLDERCHANGE)
+ {
+ char buf[1024];
+ int ret;
+
+ memset(buf, 0x66, sizeof(buf));
+ ret = SendMessageA( GetParent(hDlg), CDM_GETFOLDERPATH, sizeof(buf), (LPARAM)buf);
+ ok(!lstrcmpA(WINDIR, buf), "Expected '%s', got '%s'\n", WINDIR, buf);
+ ok(lstrlenA(WINDIR) + 1 == ret, "Expected %d, got %d\n", lstrlenA(WINDIR) + 1, ret);
+ }
+ }
+
+ return 0;
+}
+
+static void test_getfolderpath(void)
+{
+ OPENFILENAMEA ofn;
+ BOOL result;
+ char szFileName[MAX_PATH] = "";
+ char szInitialDir[MAX_PATH];
+
+ GetWindowsDirectory(szInitialDir, MAX_PATH);
+ lstrcpyA(WINDIR, szInitialDir);
+
+ ZeroMemory(&ofn, sizeof(ofn));
+
+ ofn.lStructSize = sizeof(ofn);
+ ofn.hwndOwner = NULL;
+ ofn.lpstrFilter = "Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0";
+ ofn.lpstrFile = szFileName;
+ ofn.nMaxFile = MAX_PATH;
+ ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_ENABLEHOOK;
+ ofn.lpstrDefExt = "txt";
+ ofn.lpfnHook = path_hook_proc;
+ ofn.lpstrInitialDir = szInitialDir;
+
+ result = GetOpenFileNameA(&ofn);
+ ok(0 == result, "expected 0, got %d\n", result);
+ ok(0 == CommDlgExtendedError(), "expected 0, got %d\n",
+ CommDlgExtendedError());
+
+ result = GetSaveFileNameA(&ofn);
+ ok(0 == result, "expected 0, got %d\n", result);
+ ok(0 == CommDlgExtendedError(), "expected 0, got %d\n",
+ CommDlgExtendedError());
+}
+
START_TEST(filedlg)
{
test_DialogCancel();
@@ -881,4 +942,5 @@ START_TEST(filedlg)
test_arrange();
test_resize();
test_ok();
+ test_getfolderpath();
}
More information about the wine-cvs
mailing list