Paul Vriens : wininet/tests: Add another test.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Feb 27 06:45:59 CST 2007


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

Author: Paul Vriens <paul.vriens.wine at gmail.com>
Date:   Mon Feb 26 19:47:24 2007 +0100

wininet/tests: Add another test.

---

 dlls/wininet/tests/ftp.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/dlls/wininet/tests/ftp.c b/dlls/wininet/tests/ftp.c
index fc86bb1..b10e8d1 100644
--- a/dlls/wininet/tests/ftp.c
+++ b/dlls/wininet/tests/ftp.c
@@ -236,6 +236,7 @@ static void test_getfile(void)
 {
     BOOL      bRet;
     HINTERNET hInternet, hFtp, hConnect;
+    HANDLE    hFile;
 
     /* The order of checking is:
      *
@@ -317,7 +318,29 @@ static void test_getfile(void)
         "Local file should not have been created\n");
     DeleteFileA("should_be_non_existing_deadbeef");
 
-    /* Remote file doesn't exist */
+    /* Remote file doesn't exist (and local doesn't exist as well) */
+    SetLastError(0xdeadbeef);
+    bRet = FtpGetFileA(hFtp, "should_be_non_existing_deadbeef", "should_also_be_non_existing_deadbeef", FALSE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0);
+    ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");
+    todo_wine
+    {
+    ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
+        "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
+    /* Currently Wine always creates the local file (even on failure) which is not correct, hence the test */
+    ok (GetFileAttributesA("should_also_be_non_existing_deadbeef") == INVALID_FILE_ATTRIBUTES,
+        "Local file should not have been created\n");
+    }
+    DeleteFileA("should_also_be_non_existing_deadbeef");
+
+    /* Same call as the previous but now the local file does exists. Windows just removes the file if the call fails
+     * even if the local existed before!
+     */
+
+    /* Create a temporary local file */
+    SetLastError(0xdeadbeef);
+    hFile = CreateFileA("should_also_be_non_existing_deadbeef", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
+    ok ( hFile != NULL, "Error creating a local file : %d\n", GetLastError());
+    CloseHandle(hFile);
     SetLastError(0xdeadbeef);
     bRet = FtpGetFileA(hFtp, "should_be_non_existing_deadbeef", "should_also_be_non_existing_deadbeef", FALSE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0);
     ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");




More information about the wine-cvs mailing list