From edf423ab8693f0c8883ef9bef1329e2de7465984 Mon Sep 17 00:00:00 2001 From: James Hawkins Date: Thu, 22 Dec 2005 11:16:57 +0100 Subject: [PATCH] shell32: Add tests for SHFileOperation's FO_RENAME command. --- dlls/shell32/tests/shlfileop.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/dlls/shell32/tests/shlfileop.c b/dlls/shell32/tests/shlfileop.c index 1a6edd51949..7a0c22a3612 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 */