Commit 4e167e7e authored by Florian Will's avatar Florian Will Committed by Alexandre Julliard

comdlg32/tests: Fix itemdlg tests on Windows.

The wine testbot runs tests with C:\Users\Public\Documents as the working directory. Itemdlg tests create test files in the working directory and then try to select them for opening in an IFileOpenDialog. The dialog has its SetFolder method called to point it to the current working directory before showing the dialog, in order for the test code to find the test files it had created there just before opening the dialog. On Windows, this failed because calling the dialog's SetFolder method with C:\Users\Public\Documents doesn't work as expected. The dialog points to the C:\Users\[CURRENT_USER]\Documents directory instead. Subsequently, the test would be unable to select the test file because it doesn't exist in that directory. So the dialog wouldn't accept the file and close itself to finish the test, but show an error message instead, resulting in a test timeout. To fix this, set the current working directory to the temporary directory before calling individual itemdlg test_* functions.
parent 1d9de160
......@@ -2467,6 +2467,16 @@ START_TEST(itemdlg)
if(test_instantiation())
{
DWORD result_tmpdir;
BOOL result_set_dir;
WCHAR tmpdir[MAX_PATH];
/* Windows refuses to open a dialog for C:\Users\Public\Documents, so change to tmp */
result_tmpdir = GetTempPathW(MAX_PATH, tmpdir);
ok(result_tmpdir != 0, "got %ld\n", result_tmpdir);
result_set_dir = SetCurrentDirectoryW(tmpdir);
ok(result_set_dir, "failed to set dir\n");
test_basics();
test_advise();
test_events();
......
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