comdlg32/tests: Test the correct path length for CDM_GETFOLDERPATH.
This commit is contained in:
parent
e997909ba7
commit
6a3c56a589
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue