From: "Bernhard Übelacker" Subject: [PATCH v2] comdlg32/tests: Avoid test hang by changing current directory. Message-Id: <20220108154346.483342-1-bernhardu@mailbox.org> Date: Sat, 8 Jan 2022 16:43:46 +0100 Signed-off-by: Bernhard Übelacker ---- For some reason this does not show up in the daily testbot runs, but in single test runs after e.g. patch submissions. v2: - Removed changes to IFileDialogEvents_fnOnFolderChange. - Removed some more lines remaining from debugging. Superseedes: https://source.winehq.org/patches/data/222000 --- dlls/comdlg32/tests/itemdlg.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/dlls/comdlg32/tests/itemdlg.c b/dlls/comdlg32/tests/itemdlg.c index c38457a0a13..95bd49143fc 100644 --- a/dlls/comdlg32/tests/itemdlg.c +++ b/dlls/comdlg32/tests/itemdlg.c @@ -2460,8 +2460,38 @@ static void test_overwrite(void) IShellItem_Release(psi_current); } +static void check_current_directory(void) +{ + int ret; + HRESULT hr; + WCHAR current_dir[MAX_PATH] = {0}; + WCHAR common_documents[MAX_PATH] = {0}; + + ret = GetCurrentDirectoryW(MAX_PATH, current_dir); + ok(ret, "GetCurrentDirectoryW failed: GetLastError:0x%08x\n", GetLastError()); + + hr = SHGetFolderPathW(NULL, CSIDL_COMMON_DOCUMENTS, NULL, 0, common_documents); + ok(hr == S_OK, "SHGetFolderPathW failed: Got 0x%08x\n", hr); + + if (lstrcmpW(current_dir, common_documents) == 0) { + hr = SHGetFolderPathW(NULL, CSIDL_MYDOCUMENTS, NULL, 0, current_dir); + ok(hr == S_OK, "SHGetFolderPathW failed: Got 0x%08x\n", hr); + + ret = SetCurrentDirectoryW(current_dir); + ok(ret, "SetCurrentDirectoryW failed: GetLastError:0x%08x\n", GetLastError()); + + trace("Changing directory: %s to %s\n", debugstr_w(common_documents), debugstr_w(current_dir)); + /* The tests test_filename_opendlg will hang with "File not found", + if opened from the public documents directory. + This seems to be caused by the test files being created in public documents, + but the open dialog searches in my documents. */ + } +} + START_TEST(itemdlg) { + check_current_directory(); + OleInitialize(NULL); init_function_pointers(); -- 2.34.1