[4/4] qmgr: Implement IBackgroundCopyJob_GetProgress.

Dan Hipschman dsh at linux.ucla.edu
Mon Mar 3 18:48:08 CST 2008


Implement IBackgroundCopyJob_GetProgress.

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

---
 dlls/qmgr/job.c       |   15 ++++++++++++---
 dlls/qmgr/tests/job.c |   22 ++++++++++++++++++++++
 2 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/dlls/qmgr/job.c b/dlls/qmgr/job.c
index 20d72dd..8e3bce4 100644
--- a/dlls/qmgr/job.c
+++ b/dlls/qmgr/job.c
@@ -163,8 +163,17 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_GetProgress(
     IBackgroundCopyJob* iface,
     BG_JOB_PROGRESS *pVal)
 {
-    FIXME("Not implemented\n");
-    return E_NOTIMPL;
+    BackgroundCopyJobImpl *This = (BackgroundCopyJobImpl *) iface;
+
+    if (!pVal)
+        return E_INVALIDARG;
+
+    pVal->BytesTotal = This->jobProgress.BytesTotal;
+    pVal->BytesTransferred = This->jobProgress.BytesTransferred;
+    pVal->FilesTotal = This->jobProgress.FilesTotal;
+    pVal->FilesTransferred = This->jobProgress.FilesTransferred;
+
+    return S_OK;
 }
 
 static HRESULT WINAPI BITS_IBackgroundCopyJob_GetTimes(
@@ -432,7 +441,7 @@ HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type,
     memcpy(pJobId, &This->jobId, sizeof(GUID));
 
     list_init(&This->files);
-    This->jobProgress.BytesTotal = BG_SIZE_UNKNOWN;
+    This->jobProgress.BytesTotal = 0;
     This->jobProgress.BytesTransferred = 0;
     This->jobProgress.FilesTotal = 0;
     This->jobProgress.FilesTransferred = 0;
diff --git a/dlls/qmgr/tests/job.c b/dlls/qmgr/tests/job.c
index 6fcf681..26cbfe9 100644
--- a/dlls/qmgr/tests/job.c
+++ b/dlls/qmgr/tests/job.c
@@ -218,6 +218,27 @@ static void test_EnumFiles(void)
     ok(res == 0, "Bad ref count on release: %u\n", res);
 }
 
+/* Test getting job progress */
+static void test_GetProgress_preTransfer(void)
+{
+    HRESULT hres;
+    BG_JOB_PROGRESS progress;
+
+    hres = IBackgroundCopyJob_GetProgress(test_job, &progress);
+    ok(hres == S_OK, "GetProgress failed: 0x%08x\n", hres);
+    if (hres != S_OK)
+    {
+        skip("Unable to get job progress\n");
+        teardown();
+        return;
+    }
+
+    ok(progress.BytesTotal == 0, "Incorrect BytesTotal: %llu\n", progress.BytesTotal);
+    ok(progress.BytesTransferred == 0, "Incorrect BytesTransferred: %llu\n", progress.BytesTransferred);
+    ok(progress.FilesTotal == 0, "Incorrect FilesTotal: %u\n", progress.FilesTotal);
+    ok(progress.FilesTransferred == 0, "Incorrect FilesTransferred %u\n", progress.FilesTransferred);
+}
+
 typedef void (*test_t)(void);
 
 START_TEST(job)
@@ -228,6 +249,7 @@ START_TEST(job)
         test_GetName,
         test_AddFile,
         test_EnumFiles,
+        test_GetProgress_preTransfer,
         0
     };
     const test_t *test;



More information about the wine-patches mailing list