Dmitry Timoshkov : shell32/tests: Add a couple of SHFileOperation(FO_MOVE) tests for a directory.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Mar 19 09:59:03 CDT 2015


Module: wine
Branch: master
Commit: 5614ae23ee07c0b895f82559844c40686893a7a9
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5614ae23ee07c0b895f82559844c40686893a7a9

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Thu Mar 19 17:30:47 2015 +0800

shell32/tests: Add a couple of SHFileOperation(FO_MOVE) tests for a directory.

---

 dlls/shell32/tests/shlfileop.c | 46 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/dlls/shell32/tests/shlfileop.c b/dlls/shell32/tests/shlfileop.c
index 6bb28e1..fa83adf 100644
--- a/dlls/shell32/tests/shlfileop.c
+++ b/dlls/shell32/tests/shlfileop.c
@@ -164,6 +164,9 @@ static void clean_after_shfo_tests(void)
     DeleteFileA("test4.txt\\test1.txt");
     DeleteFileA("test4.txt\\test2.txt");
     DeleteFileA("test4.txt\\test3.txt");
+    DeleteFileA("test4.txt\\one.txt");
+    DeleteFileA("test4.txt\\nested\\two.txt");
+    RemoveDirectoryA("test4.txt\\nested");
     RemoveDirectoryA("test4.txt");
     DeleteFileA("testdir2\\one.txt");
     DeleteFileA("testdir2\\test1.txt");
@@ -1826,6 +1829,49 @@ static void test_move(void)
     CHAR to[5*MAX_PATH];
     DWORD retval;
 
+    clean_after_shfo_tests();
+    init_shfo_tests();
+
+    shfo.hwnd = NULL;
+    shfo.wFunc = FO_MOVE;
+    shfo.pFrom = from;
+    shfo.pTo = to;
+    shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI | FOF_NOCONFIRMMKDIR;
+    shfo.hNameMappings = NULL;
+    shfo.lpszProgressTitle = NULL;
+    shfo.fAnyOperationsAborted = FALSE;
+
+    set_curr_dir_path(from, "testdir2\\*.*\0");
+    set_curr_dir_path(to, "test4.txt\\*.*\0");
+    retval = SHFileOperationA(&shfo);
+    ok(retval != 0, "SHFileOperation should fail\n");
+    ok(!shfo.fAnyOperationsAborted, "fAnyOperationsAborted %d\n", shfo.fAnyOperationsAborted);
+
+    ok(file_exists("testdir2"), "dir should not be moved\n");
+    ok(file_exists("testdir2\\one.txt"), "file should not be moved\n");
+    ok(file_exists("testdir2\\nested"), "dir should not be moved\n");
+    ok(file_exists("testdir2\\nested\\two.txt"), "file should not be moved\n");
+
+    set_curr_dir_path(from, "testdir2\\*.*\0");
+    set_curr_dir_path(to, "test4.txt\0");
+    retval = SHFileOperationA(&shfo);
+    ok(!retval, "SHFileOperation error %#x\n", retval);
+    ok(!shfo.fAnyOperationsAborted, "fAnyOperationsAborted %d\n", shfo.fAnyOperationsAborted);
+
+    ok(file_exists("testdir2"), "dir should not be moved\n");
+    ok(!file_exists("testdir2\\one.txt"), "file should be moved\n");
+todo_wine
+    ok(!file_exists("testdir2\\nested"), "dir should be moved\n");
+    ok(!file_exists("testdir2\\nested\\two.txt"), "file should be moved\n");
+
+    ok(file_exists("test4.txt"), "dir should exist\n");
+    ok(file_exists("test4.txt\\one.txt"), "file should exist\n");
+    ok(file_exists("test4.txt\\nested"), "dir should exist\n");
+    ok(file_exists("test4.txt\\nested\\two.txt"), "file should exist\n");
+
+    clean_after_shfo_tests();
+    init_shfo_tests();
+
     shfo.hwnd = NULL;
     shfo.wFunc = FO_MOVE;
     shfo.pFrom = from;




More information about the wine-cvs mailing list