From: Florian Will florian.will@gmail.com
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. Switch back to the previous working directory after tests finish. --- dlls/comdlg32/tests/itemdlg.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/dlls/comdlg32/tests/itemdlg.c b/dlls/comdlg32/tests/itemdlg.c index bba869ad091..fd21fff2e6f 100644 --- a/dlls/comdlg32/tests/itemdlg.c +++ b/dlls/comdlg32/tests/itemdlg.c @@ -2467,6 +2467,19 @@ START_TEST(itemdlg)
if(test_instantiation()) { + UINT result_workdir; + DWORD result_tmpdir; + BOOL result_set_dir; + WCHAR tmpdir[MAX_PATH], workdir[MAX_PATH]; + + /* Windows refuses to open a dialog for C:\Users\Public\Documents, so change to tmp */ + result_workdir = GetCurrentDirectoryW(MAX_PATH, workdir); + ok(result_workdir != 0, "got %d\n", result_workdir); + 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(); @@ -2474,6 +2487,9 @@ START_TEST(itemdlg) test_customize(); test_persistent_state(); test_overwrite(); + + result_set_dir = SetCurrentDirectoryW(workdir); + ok(result_set_dir, "failed to set dir\n"); } else skip("Skipping all Item Dialog tests.\n");