SHFileOperation Test fix

Rolf Kalbermatter rolf.kalbermatter at citeng.com
Sun Mar 30 17:33:42 CST 2003


This patch should make the current shell32 test succeed on Win 98/ME/2K/XP.

Comments are welcome as to how this test could be done even nicer!

Changelog
  * dlls/shell32/tests/shlfileop.c
    Fix test to succeed in Win 98/2K and most probably ME/XP as well

License: X11/LGPL

Rolf Kalbermatter

Index: dlls/shell32/tests/shlfileop.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/tests/shlfileop.c,v
retrieving revision 1.6
diff -u -r1.6 shlfileop.c
--- dlls/shell32/tests/shlfileop.c	14 Jan 2003 23:43:42 -0000	1.6
+++ dlls/shell32/tests/shlfileop.c	30 Mar 2003 23:24:17 -0000
@@ -211,6 +211,7 @@
     CHAR from[MAX_PATH];
     CHAR to[MAX_PATH];
     FILEOP_FLAGS tmp_flags;
+    DWORD retval;
 
     shfo.hwnd = NULL;
     shfo.wFunc = FO_COPY;
@@ -278,13 +279,23 @@
     ok(file_exists(".\\testdir2\\test2.txt"), "The file is copied");
     clean_after_shfo_tests();
 
+    /* Copying multiple files with one not existing as source, fails the
+       entire operation in Win98/ME/2K/XP, but not in 95/NT */
     init_shfo_tests();
     tmp_flags = shfo.fFlags;
     set_curr_dir_path(from, "test1.txt\0test10.txt\0test2.txt\0");
     ok(!file_exists(".\\testdir2\\test1.txt"), "The file is not copied yet");
     ok(!file_exists(".\\testdir2\\test2.txt"), "The file is not copied yet");
-    ok(!SHFileOperationA(&shfo), "Files are copied to other directory ");
-    ok(file_exists(".\\testdir2\\test1.txt"), "The file is copied");
+    retval = SHFileOperationA(&shfo);
+    if (!retval)
+      /* Win 95/NT returns success but copies only the files up to the nonexisting source */
+      ok(file_exists(".\\testdir2\\test1.txt"), "The file is not copied");
+    else
+    {
+      /* Win 98/ME/2K/XP fail the entire operation with return code 1026 if one source file does not exist */
+      ok(retval == 1026, "Files are copied to other directory ");
+      ok(!file_exists(".\\testdir2\\test1.txt"), "The file is copied");
+    }
     ok(!file_exists(".\\testdir2\\test2.txt"), "The file is copied");
     shfo.fFlags = tmp_flags;
 }




More information about the wine-patches mailing list