[COMDLG32_WINETEST] Sync with Wine Staging 3.17. CORE-15127

This commit is contained in:
Amine Khaldi 2018-10-01 12:45:40 +01:00
parent eaac1cc75f
commit e08ae510d5
2 changed files with 29 additions and 9 deletions

View File

@ -1120,9 +1120,6 @@ static void test_extension(void)
test_extension_helper(&ofn, "TestFilter (*.*.def)\0*.*.def\0", "deadbeef.xyz");
}
#undef ARRAY_SIZE
static BOOL WINAPI test_null_enum(HWND hwnd, LPARAM lParam)
{
/* Find the textbox and send a filename so IDOK will work.

View File

@ -536,6 +536,8 @@ static void test_basics(void)
const WCHAR fname2[] = {'f','n','a','m','e','2', 0};
const WCHAR fspec2[] = {'*','.','e','x','e',0};
COMDLG_FILTERSPEC filterspec[2] = {{fname1, fspec1}, {fname2, fspec2}};
const DWORD invalid_fos[] = {0x1, 0x10, 0x400, 0x80000, 0x400000, 0x800000, 0x1000000, 0x4000000, 0x8000000};
INT i;
/* This should work on every platform with IFileDialog */
SHGetDesktopFolder(&psfdesktop);
@ -586,6 +588,23 @@ static void test_basics(void)
ok(fdoptions == (FOS_OVERWRITEPROMPT | FOS_NOREADONLYRETURN | FOS_PATHMUSTEXIST | FOS_NOCHANGEDIR),
"Unexpected default options: 0x%08x\n", fdoptions);
/* Check SetOptions invalid options handling */
for (i = 0; i < ARRAY_SIZE(invalid_fos); i++)
{
hr = IFileOpenDialog_SetOptions(pfod, invalid_fos[i]);
ok(hr == E_INVALIDARG, "got 0x%08x.\n", hr);
hr = IFileOpenDialog_GetOptions(pfod, &fdoptions);
ok(hr == S_OK, "got 0x%08x.\n", hr);
ok(fdoptions == (FOS_PATHMUSTEXIST | FOS_FILEMUSTEXIST | FOS_NOCHANGEDIR), "got %08x\n", fdoptions);
hr = IFileSaveDialog_SetOptions(pfsd, invalid_fos[i]);
ok(hr == E_INVALIDARG, "got 0x%08x.\n", hr);
hr = IFileSaveDialog_GetOptions(pfsd, &fdoptions);
ok(hr == S_OK, "got 0x%08x.\n", hr);
ok(fdoptions == (FOS_OVERWRITEPROMPT | FOS_NOREADONLYRETURN | FOS_PATHMUSTEXIST | FOS_NOCHANGEDIR),
"got %08x\n", fdoptions);
}
/* GetResult */
hr = IFileOpenDialog_GetResult(pfod, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x.\n", hr);
@ -1032,10 +1051,14 @@ static void test_advise_helper(IFileDialog *pfd)
pfde = IFileDialogEvents_Constructor();
pfdeimpl = impl_from_IFileDialogEvents(pfde);
hr = IFileDialog_Advise(pfd, NULL, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
hr = IFileDialog_Advise(pfd, pfde, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
/* Null pointer tests crash on Windows 10 16299 or newer */
if (0)
{
hr = IFileDialog_Advise(pfd, NULL, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
hr = IFileDialog_Advise(pfd, pfde, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
}
hr = IFileDialog_Advise(pfd, NULL, &cookie[0]);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
ok(pfdeimpl->ref == 1, "got ref %d\n", pfdeimpl->ref);
@ -1046,7 +1069,7 @@ static void test_advise_helper(IFileDialog *pfd)
for(i = 0; i < 10; i++) {
hr = IFileDialog_Advise(pfd, pfde, &cookie[i]);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(cookie[i] == i+1, "Got cookie: %d\n", cookie[i]);
ok(cookie[i] == i+cookie[0], "Got cookie: %d\n", cookie[i]);
}
ok(pfdeimpl->ref == 10+1, "got ref %d\n", pfdeimpl->ref);
ensure_zero_events(pfdeimpl);
@ -1079,7 +1102,7 @@ static void test_advise_helper(IFileDialog *pfd)
hr = IFileDialog_Advise(pfd, pfde, &cookie[0]);
ok(hr == S_OK, "got 0x%08x\n", hr);
todo_wine ok(cookie[0] == 1, "got cookie: %d\n", cookie[0]);
ok(cookie[0] >= 1, "got cookie: %d\n", cookie[0]);
ok(pfdeimpl->ref == 1+1, "got ref %d\n", pfdeimpl->ref);
ensure_zero_events(pfdeimpl);