[4/5] qmgr: Implement IBackgroundCopyFile_GetProgress.

Dan Hipschman dsh at linux.ucla.edu
Thu Feb 28 21:00:12 CST 2008


Implement IBackgroundCopyFile_GetProgress.

From: Roy Shea <roy at cs.hmc.edu>
Date: Thu Dec 20 18:38:31 CST 2007

---
 dlls/qmgr/file.c       |   13 +++++++++++--
 dlls/qmgr/qmgr.h       |    1 +
 dlls/qmgr/tests/file.c |   19 +++++++++++++++++++
 3 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/dlls/qmgr/file.c b/dlls/qmgr/file.c
index ad5546f..93ffba4 100644
--- a/dlls/qmgr/file.c
+++ b/dlls/qmgr/file.c
@@ -103,8 +103,13 @@ static HRESULT WINAPI BITS_IBackgroundCopyFile_GetProgress(
     IBackgroundCopyFile* iface,
     BG_FILE_PROGRESS *pVal)
 {
-    FIXME("Not implemented\n");
-    return E_NOTIMPL;
+    BackgroundCopyFileImpl *This = (BackgroundCopyFileImpl *) iface;
+
+    pVal->BytesTotal = This->fileProgress.BytesTotal;
+    pVal->BytesTransferred = This->fileProgress.BytesTransferred;
+    pVal->Completed = This->fileProgress.Completed;
+
+    return S_OK;
 }
 
 static const IBackgroundCopyFileVtbl BITS_IBackgroundCopyFile_Vtbl =
@@ -152,6 +157,10 @@ HRESULT BackgroundCopyFileConstructor(LPCWSTR remoteName,
     This->lpVtbl = &BITS_IBackgroundCopyFile_Vtbl;
     This->ref = 1;
 
+    This->fileProgress.BytesTotal = BG_SIZE_UNKNOWN;
+    This->fileProgress.BytesTransferred = 0;
+    This->fileProgress.Completed = FALSE;
+
     *ppObj = &This->lpVtbl;
     return S_OK;
 }
diff --git a/dlls/qmgr/qmgr.h b/dlls/qmgr/qmgr.h
index 3036f7a..ddf9eee 100644
--- a/dlls/qmgr/qmgr.h
+++ b/dlls/qmgr/qmgr.h
@@ -65,6 +65,7 @@ typedef struct
     const IBackgroundCopyFileVtbl *lpVtbl;
     LONG ref;
     BG_FILE_INFO info;
+    BG_FILE_PROGRESS fileProgress;
     struct list entryFromJob;
 } BackgroundCopyFileImpl;
 
diff --git a/dlls/qmgr/tests/file.c b/dlls/qmgr/tests/file.c
index b1fb954..6b47b9e 100644
--- a/dlls/qmgr/tests/file.c
+++ b/dlls/qmgr/tests/file.c
@@ -145,6 +145,24 @@ static void test_GetLocalName(void)
     CoTaskMemFree(name);
 }
 
+/* Test getting the progress of a file*/
+static void test_GetProgress_PreTransfer(void)
+{
+    HRESULT hres;
+    BG_FILE_PROGRESS progress;
+
+    hres = IBackgroundCopyFile_GetProgress(test_file, &progress);
+    ok(hres == S_OK, "GetProgress failed: %08x\n", hres);
+    if(hres != S_OK)
+    {
+        skip("Unable to get progress of test_file.\n");
+        return;
+    }
+    ok(progress.BytesTotal == BG_SIZE_UNKNOWN, "Got incorrect total size: %llu\n", progress.BytesTotal);
+    ok(progress.BytesTransferred == 0, "Got incorrect number of transfered bytes: %llu\n", progress.BytesTransferred);
+    ok(progress.Completed == FALSE, "Got incorret completion status\n");
+}
+
 typedef void (*test_t)(void);
 
 START_TEST(file)
@@ -152,6 +170,7 @@ START_TEST(file)
     static const test_t tests[] = {
         test_GetRemoteName,
         test_GetLocalName,
+        test_GetProgress_PreTransfer,
         0
     };
     const test_t *test;



More information about the wine-patches mailing list