[2/2] shell32/tests: Check if error status is reset after successful file copy

Olivier F. R. Dierick o.dierick at piezo-forte.be
Wed Apr 20 19:12:16 CDT 2016


See bug 36838 for comments and discussion.

Conformance test about the state of LastError after a successful shell
file operation.

>From 2c7d449867b94570e23b171f5ea8404d99923587 Mon Sep 17 00:00:00 2001
From: "Olivier F. R. Dierick" <o.dierick at piezo-forte.be>
Date: Tue, 28 Jul 2015 22:27:00 +0200
Subject: Check if error status is reset after successful file copy

Signed-off-by: Olivier F. R. Dierick <o.dierick at piezo-forte.be>
---
 dlls/shell32/tests/shlfileop.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/dlls/shell32/tests/shlfileop.c
b/dlls/shell32/tests/shlfileop.c
index d33ad5b..36f3051 100644
--- a/dlls/shell32/tests/shlfileop.c
+++ b/dlls/shell32/tests/shlfileop.c
@@ -1819,6 +1819,18 @@ static void test_copy(void)
         ok(DeleteFileA("abcdefgh.abc"), "Expected file to exist\n");
     ok(DeleteFileA("dir\\abcdefgh.abc"), "Expected file to exist\n");
     ok(RemoveDirectoryA("dir"), "Expected dir to exist\n");
+
+    /* check if error status is reset after successful file copy */
+    clean_after_shfo_tests();
+    init_shfo_tests();
+    shfo.pFrom = "test1.txt\0";
+    shfo.pTo = "testdir2\0";
+    shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
+    SetLastError(0xdeadbeef);
+    retval = SHFileOperationA(&shfo);
+    ok(retval == ERROR_SUCCESS, "File copy failed with %d\n", retval);
+    ok(!shfo.fAnyOperationsAborted, "Didn't expect aborted operations
\n");
+    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d
\n", GetLastError());
 }
 
 /* tests the FO_MOVE action */
-- 
1.7.10.4

-- 
        Olivier F. R. Dierick
        o.dierick at piezo-forte.be




More information about the wine-patches mailing list