Roy Shea : qmgr: Implement Skip and Reset for IEnumBackgroundCopyJobs.

Alexandre Julliard julliard at winehq.org
Tue Mar 4 14:31:39 CST 2008


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

Author: Roy Shea <roy at cs.hmc.edu>
Date:   Mon Mar  3 16:47:21 2008 -0800

qmgr: Implement Skip and Reset for IEnumBackgroundCopyJobs.

---

 dlls/qmgr/enum_jobs.c       |   17 +++++++++---
 dlls/qmgr/tests/enum_jobs.c |   58 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+), 4 deletions(-)

diff --git a/dlls/qmgr/enum_jobs.c b/dlls/qmgr/enum_jobs.c
index 98b9cb2..e35730a 100644
--- a/dlls/qmgr/enum_jobs.c
+++ b/dlls/qmgr/enum_jobs.c
@@ -114,15 +114,24 @@ static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_Skip(
     IEnumBackgroundCopyJobs* iface,
     ULONG celt)
 {
-    FIXME("Not implemented\n");
-    return E_NOTIMPL;
+    EnumBackgroundCopyJobsImpl *This = (EnumBackgroundCopyJobsImpl *) iface;
+
+    if (This->numJobs - This->indexJobs < celt)
+    {
+        This->indexJobs = This->numJobs;
+        return S_FALSE;
+    }
+
+    This->indexJobs += celt;
+    return S_OK;
 }
 
 static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_Reset(
     IEnumBackgroundCopyJobs* iface)
 {
-    FIXME("Not implemented\n");
-    return E_NOTIMPL;
+    EnumBackgroundCopyJobsImpl *This = (EnumBackgroundCopyJobsImpl *) iface;
+    This->indexJobs = 0;
+    return S_OK;
 }
 
 static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_Clone(
diff --git a/dlls/qmgr/tests/enum_jobs.c b/dlls/qmgr/tests/enum_jobs.c
index 93aaf15..343d97a 100644
--- a/dlls/qmgr/tests/enum_jobs.c
+++ b/dlls/qmgr/tests/enum_jobs.c
@@ -232,6 +232,61 @@ static void test_Next_errors(void)
     ok(hres != S_OK, "Invalid call to Next succeeded: %08x\n", hres);
 }
 
+/* Test skipping through the jobs in a list */
+static void test_Skip_walkList(void)
+{
+    HRESULT hres;
+    ULONG i;
+
+    for (i = 0; i < test_jobCountB; i++)
+    {
+        hres = IEnumBackgroundCopyJobs_Skip(test_enumJobsB, 1);
+        ok(hres == S_OK, "Skip failed: %08x\n", hres);
+        if(hres != S_OK)
+        {
+            skip("Unable to propely Skip jobs\n");
+            return;
+        }
+    }
+
+    hres = IEnumBackgroundCopyJobs_Skip(test_enumJobsB, 1);
+    ok(hres == S_FALSE, "Skip expected end of list: %08x\n", hres);
+}
+
+/* Test skipping off the end of the list */
+static void test_Skip_offEnd(void)
+{
+    HRESULT hres;
+
+    hres = IEnumBackgroundCopyJobs_Skip(test_enumJobsB, test_jobCountB + 1);
+    ok(hres == S_FALSE, "Skip expected end of list: %08x\n", hres);
+}
+
+/* Test reset */
+static void test_Reset(void)
+{
+    HRESULT hres;
+
+    hres = IEnumBackgroundCopyJobs_Skip(test_enumJobsB, test_jobCountB);
+    ok(hres == S_OK, "Skip failed: %08x\n", hres);
+    if (hres != S_OK)
+    {
+        skip("Skip failed\n");
+        return;
+    }
+
+    hres = IEnumBackgroundCopyJobs_Reset(test_enumJobsB);
+    ok(hres == S_OK, "Reset failed: %08x\n", hres);
+    if(hres != S_OK)
+    {
+        skip("Unable to Reset enumerator\n");
+        return;
+    }
+
+    hres = IEnumBackgroundCopyJobs_Skip(test_enumJobsB, test_jobCountB);
+    ok(hres == S_OK, "Reset failed: %08x\n", hres);
+}
+
 typedef void (*test_t)(void);
 
 START_TEST(enum_jobs)
@@ -242,6 +297,9 @@ START_TEST(enum_jobs)
         test_Next_walkList_1,
         test_Next_walkList_2,
         test_Next_errors,
+        test_Skip_walkList,
+        test_Skip_offEnd,
+        test_Reset,
         0
     };
     const test_t *test;




More information about the wine-cvs mailing list