James Hawkins : shell32: Add tests for SHFileOperation's FO_RENAME command.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Dec 22 07:07:34 CST 2005


Module: wine
Branch: refs/heads/master
Commit: edf423ab8693f0c8883ef9bef1329e2de7465984
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=edf423ab8693f0c8883ef9bef1329e2de7465984

Author: James Hawkins <truiken at gmail.com>
Date:   Thu Dec 22 11:16:57 2005 +0100

shell32: Add tests for SHFileOperation's FO_RENAME command.

---

 dlls/shell32/tests/shlfileop.c |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/dlls/shell32/tests/shlfileop.c b/dlls/shell32/tests/shlfileop.c
index 1a6edd5..7a0c22a 100644
--- a/dlls/shell32/tests/shlfileop.c
+++ b/dlls/shell32/tests/shlfileop.c
@@ -323,6 +323,40 @@ static void test_rename(void)
     set_curr_dir_path(to, "test4.txt\0");
     retval = SHFileOperationA(&shfo);
     ok(!retval, "Rename dir back failed, retval = %ld\n", retval);
+
+    /* try to rename more than one file to a single file */
+    shfo.pFrom = "test1.txt\0test2.txt\0";
+    shfo.pTo = "a.txt\0";
+    retval = SHFileOperationA(&shfo);
+    ok(retval == ERROR_GEN_FAILURE, "Expected ERROR_GEN_FAILURE, got %ld\n", retval);
+    ok(file_exists("test1.txt"), "Expected test1.txt to exist\n");
+    ok(file_exists("test2.txt"), "Expected test2.txt to exist\n");
+
+    /* pFrom is valid, but pTo is empty */
+    shfo.pFrom = "test1.txt\0";
+    shfo.pTo = "\0";
+    retval = SHFileOperationA(&shfo);
+    todo_wine
+    {
+        ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %ld\n", retval);
+    }
+    ok(file_exists("test1.txt"), "Expected test1.txt to exist\n");
+
+    /* pFrom is empty */
+    shfo.pFrom = "\0";
+    retval = SHFileOperationA(&shfo);
+    todo_wine
+    {
+        ok(retval == ERROR_ACCESS_DENIED, "Expected ERROR_ACCESS_DENIED, got %ld\n", retval);
+    }
+
+    /* pFrom is NULL */
+    shfo.pFrom = NULL;
+    retval = SHFileOperationA(&shfo);
+    todo_wine
+    {
+        ok(retval == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %ld\n", retval);
+    }
 }
 
 /* tests the FO_COPY action */




More information about the wine-cvs mailing list