shell32/tests: Fix FO_RENAME tests for old shell32.

This commit is contained in:
Paul Vriens 2010-01-25 13:13:54 +01:00 committed by Alexandre Julliard
parent 0a84bd728a
commit 1bd7956a7d

View File

@ -47,6 +47,8 @@
broken(retval == ret_prewin32),\
"Expected %d, got %d\n", ret, retval)
static BOOL old_shell32 = FALSE;
static CHAR CURR_DIR[MAX_PATH];
static const WCHAR UNICODE_PATH[] = {'c',':','\\',0x00ae,'\0','\0'};
/* "c:\®" can be used in all codepages */
@ -764,6 +766,8 @@ static void test_rename(void)
/* pTo already exist */
shfo.pFrom = "test1.txt\0";
shfo.pTo = "test2.txt\0";
if (old_shell32)
shfo.fFlags |= FOF_NOCONFIRMMKDIR;
retval = SHFileOperationA(&shfo);
if (retval == ERROR_SUCCESS)
{
@ -2235,12 +2239,56 @@ test_shlmenu(void) {
ok (hres == 0x4242, "expected 0x4242 but got %x\n", hres);
}
/* Check for old shell32 (4.0.x) */
static BOOL is_old_shell32(void)
{
SHFILEOPSTRUCTA shfo;
CHAR from[5*MAX_PATH];
CHAR to[5*MAX_PATH];
DWORD retval;
shfo.hwnd = NULL;
shfo.wFunc = FO_COPY;
shfo.pFrom = from;
shfo.pTo = to;
/* FOF_NOCONFIRMMKDIR is needed for old shell32 */
shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI | FOF_MULTIDESTFILES | FOF_NOCONFIRMMKDIR;
shfo.hNameMappings = NULL;
shfo.lpszProgressTitle = NULL;
set_curr_dir_path(from, "test1.txt\0test2.txt\0test3.txt");
set_curr_dir_path(to, "test6.txt\0test7.txt\0");
retval = SHFileOperationA(&shfo);
/* Delete extra files on old shell32 and Vista+*/
DeleteFileA("test6.txt\\test1.txt");
/* Delete extra files on old shell32 */
DeleteFileA("test6.txt\\test2.txt");
DeleteFileA("test6.txt\\test3.txt");
/* Delete extra directory on old shell32 and Vista+ */
RemoveDirectoryA("test6.txt");
/* Delete extra files/directories on Vista+*/
DeleteFileA("test7.txt\\test2.txt");
RemoveDirectoryA("test7.txt");
if (retval == ERROR_SUCCESS)
return TRUE;
return FALSE;
}
START_TEST(shlfileop)
{
InitFunctionPointers();
clean_after_shfo_tests();
init_shfo_tests();
old_shell32 = is_old_shell32();
if (old_shell32)
win_skip("Need to cater for old shell32 (4.0.x) on Win95\n");
clean_after_shfo_tests();
init_shfo_tests();
test_get_file_info();
test_get_file_info_iconlist();