Roy Shea : qmgr: Implement IBackgroundCopyJob_GetDisplayName with test.

Alexandre Julliard julliard at winehq.org
Tue Feb 26 05:45:23 CST 2008


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

Author: Roy Shea <roy at cs.hmc.edu>
Date:   Mon Feb 25 17:41:35 2008 -0800

qmgr: Implement IBackgroundCopyJob_GetDisplayName with test.

---

 dlls/qmgr/job.c       |   14 ++++++++++++--
 dlls/qmgr/tests/job.c |   18 ++++++++++++++++++
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/dlls/qmgr/job.c b/dlls/qmgr/job.c
index b15f39b..b14783c 100644
--- a/dlls/qmgr/job.c
+++ b/dlls/qmgr/job.c
@@ -194,8 +194,18 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_GetDisplayName(
     IBackgroundCopyJob* iface,
     LPWSTR *pVal)
 {
-    FIXME("Not implemented\n");
-    return E_NOTIMPL;
+    BackgroundCopyJobImpl *This = (BackgroundCopyJobImpl *) iface;
+    int n;
+
+    if (!pVal)
+        return E_INVALIDARG;
+
+    n = (lstrlenW(This->displayName) + 1) * sizeof **pVal;
+    *pVal = CoTaskMemAlloc(n);
+    if (*pVal == NULL)
+        return E_OUTOFMEMORY;
+    memcpy(*pVal, This->displayName, n);
+    return S_OK;
 }
 
 static HRESULT WINAPI BITS_IBackgroundCopyJob_SetDescription(
diff --git a/dlls/qmgr/tests/job.c b/dlls/qmgr/tests/job.c
index 9f216da..65ac06c 100644
--- a/dlls/qmgr/tests/job.c
+++ b/dlls/qmgr/tests/job.c
@@ -99,6 +99,23 @@ static void test_GetType(void)
     ok(type == test_type, "Got incorrect type\n");
 }
 
+/* Test that the display name is properly set */
+static void test_GetName(void)
+{
+    HRESULT hres;
+    LPWSTR displayName;
+
+    hres = IBackgroundCopyJob_GetDisplayName(test_job, &displayName);
+    ok(hres == S_OK, "GetName failed: %08x\n", hres);
+    if(hres != S_OK)
+    {
+        skip("Unable to get display name of test_job.\n");
+        return;
+    }
+    ok(lstrcmpW(displayName, test_displayName) == 0, "Got incorrect type\n");
+    CoTaskMemFree(displayName);
+}
+
 typedef void (*test_t)(void);
 
 START_TEST(job)
@@ -106,6 +123,7 @@ START_TEST(job)
     static const test_t tests[] = {
         test_GetId,
         test_GetType,
+        test_GetName,
         0
     };
     const test_t *test;




More information about the wine-cvs mailing list