Commit 1b7a3dae authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

comdlg32/tests: Use GetOpenFileNameA instead of GetOpenFileNameW.

parent 7c1124e4
...@@ -988,59 +988,49 @@ static void test_resizable2(void) ...@@ -988,59 +988,49 @@ static void test_resizable2(void)
static void test_mru(void) static void test_mru(void)
{ {
ok_wndproc_testcase testcase = {0}; ok_wndproc_testcase testcase = {0};
OPENFILENAMEW ofn = {sizeof(OPENFILENAMEW)}; OPENFILENAME ofn = {sizeof(OPENFILENAME)};
const char *test_dir_nameA = "C:\\mru_test"; const char *test_dir_name = "C:\\mru_test";
const WCHAR test_file_name[] = const char *test_file_name = "test.txt";
{'t','e','s','t','.','t','x','t',0}; const char *test_full_path = "C:\\mru_test\\test.txt";
const WCHAR test_full_path[] = char filename_buf[MAX_PATH];
{'C',':','\\','m','r','u','_','t','e','s','t','\\','t','e','s','t','.','t','x','t',0};
const WCHAR template1W[] =
{'t','e','m','p','l','a','t','e','1',0};
WCHAR filename_buf[MAX_PATH];
DWORD ret; DWORD ret;
ofn.lpstrFile = filename_buf; ofn.lpstrFile = filename_buf;
ofn.nMaxFile = sizeof(filename_buf); ofn.nMaxFile = sizeof(filename_buf);
ofn.lpTemplateName = template1W; ofn.lpTemplateName = "template1";
ofn.hInstance = GetModuleHandle(NULL); ofn.hInstance = GetModuleHandle(NULL);
ofn.Flags = OFN_ENABLEHOOK | OFN_EXPLORER | OFN_ENABLETEMPLATE | OFN_NOCHANGEDIR; ofn.Flags = OFN_ENABLEHOOK | OFN_EXPLORER | OFN_ENABLETEMPLATE | OFN_NOCHANGEDIR;
ofn.lCustData = (LPARAM)&testcase; ofn.lCustData = (LPARAM)&testcase;
ofn.lpfnHook = (LPOFNHOOKPROC)test_ok_wndproc; ofn.lpfnHook = (LPOFNHOOKPROC)test_ok_wndproc;
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CreateDirectoryA(test_dir_nameA, NULL); ret = CreateDirectoryA(test_dir_name, NULL);
ok(ret == TRUE, "CreateDirectoryA should have succeeded: %d\n", GetLastError()); ok(ret == TRUE, "CreateDirectoryA should have succeeded: %d\n", GetLastError());
/* "teach" comdlg32 about this directory */ /* "teach" comdlg32 about this directory */
lstrcpyW(filename_buf, test_full_path); strcpy(filename_buf, test_full_path);
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = GetOpenFileNameW(&ofn); ret = GetOpenFileNameA(&ofn);
if(!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED){ ok(ret, "GetOpenFileNameA should have succeeded: %d\n", GetLastError());
win_skip("Platform doesn't implement GetOpenFileNameW\n");
RemoveDirectoryA(test_dir_nameA);
return;
}
ok(ret, "GetOpenFileNameW should have succeeded: %d\n", GetLastError());
ok(testcase.actclose, "Open File dialog should have closed.\n");
ret = CommDlgExtendedError(); ret = CommDlgExtendedError();
ok(!ret, "CommDlgExtendedError returned %x\n", ret); ok(!ret, "CommDlgExtendedError returned %x\n", ret);
ok(!lstrcmpW(ofn.lpstrFile, test_full_path), "Expected to get %s, got %s\n", ok(testcase.actclose, "Open File dialog should have closed.\n");
wine_dbgstr_w(test_full_path), wine_dbgstr_w(ofn.lpstrFile)); ok(!strcmp(ofn.lpstrFile, test_full_path), "Expected to get %s, got %s\n", test_full_path, ofn.lpstrFile);
/* get a filename without a full path. it should return the file in /* get a filename without a full path. it should return the file in
* test_dir_name, not in the CWD */ * test_dir_name, not in the CWD */
lstrcpyW(filename_buf, test_file_name); strcpy(filename_buf, test_file_name);
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = GetOpenFileNameW(&ofn); ret = GetOpenFileNameA(&ofn);
ok(ret, "GetOpenFileNameW should have succeeded: %d\n", GetLastError()); ok(ret, "GetOpenFileNameA should have succeeded: %d\n", GetLastError());
ok(testcase.actclose, "Open File dialog should have closed.\n");
ret = CommDlgExtendedError(); ret = CommDlgExtendedError();
ok(!ret, "CommDlgExtendedError returned %x\n", ret); ok(!ret, "CommDlgExtendedError returned %x\n", ret);
if(lstrcmpW(ofn.lpstrFile, test_full_path) != 0) ok(testcase.actclose, "Open File dialog should have closed.\n");
if(strcmp(ofn.lpstrFile, test_full_path) != 0)
win_skip("Platform doesn't save MRU data\n"); win_skip("Platform doesn't save MRU data\n");
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = RemoveDirectoryA(test_dir_nameA); ret = RemoveDirectoryA(test_dir_name);
ok(ret == TRUE, "RemoveDirectoryA should have succeeded: %d\n", GetLastError()); ok(ret == TRUE, "RemoveDirectoryA should have succeeded: %d\n", GetLastError());
} }
......
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