[PATCH] comdlg32/tests: Avoid test hang by changing current directory.
Bernhard Übelacker
bernhardu at mailbox.org
Sat Dec 11 08:59:37 CST 2021
Signed-off-by: Bernhard Übelacker <bernhardu at mailbox.org>
----
For some reason this does not show up in the daily testbot runs,
but in single test runs after e.g. patch submissions.
---
dlls/comdlg32/tests/itemdlg.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/dlls/comdlg32/tests/itemdlg.c b/dlls/comdlg32/tests/itemdlg.c
index c38457a0a13..10be6d14609 100644
--- a/dlls/comdlg32/tests/itemdlg.c
+++ b/dlls/comdlg32/tests/itemdlg.c
@@ -2460,8 +2460,34 @@ static void test_overwrite(void)
IShellItem_Release(psi_current);
}
+static void check_current_directory(void)
+{
+ HRESULT hr;
+ WCHAR current_dir[MAX_PATH] = {};
+ WCHAR documents[MAX_PATH] = {};
+
+ ok(GetCurrentDirectoryW(MAX_PATH, current_dir), "GetCurrentDirectoryW failed: GetLastError:0x%08x\n", GetLastError());
+
+ hr = SHGetFolderPathW(NULL, CSIDL_COMMON_DOCUMENTS, NULL, 0, documents);
+ ok(hr == S_OK, "SHGetFolderPathW failed: Got 0x%08x\n", hr);
+
+ if (lstrcmpW(current_dir, documents) == 0) {
+ hr = SHGetFolderPathW(NULL, CSIDL_MYDOCUMENTS, NULL, 0, documents);
+ ok(hr == S_OK, "SHGetFolderPathW failed: Got 0x%08x\n", hr);
+ ok(SetCurrentDirectoryW(documents), "SetCurrentDirectoryW failed: GetLastError:0x%08x\n", GetLastError());
+ trace("Changing directory to my documents: %s to %s\n",
+ debugstr_w(current_dir), debugstr_w(documents));
+ /* 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.33.0
More information about the wine-devel
mailing list