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

Alexandre Julliard julliard at winehq.org
Fri Feb 29 06:16:56 CST 2008


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

Author: Roy Shea <roy at cs.hmc.edu>
Date:   Thu Feb 28 18:58:32 2008 -0800

qmgr: Implement Skip and Reset for IEnumBackgroundCopyFiles.

---

 dlls/qmgr/enum_files.c       |   18 +++++++++++---
 dlls/qmgr/tests/enum_files.c |   51 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+), 4 deletions(-)

diff --git a/dlls/qmgr/enum_files.c b/dlls/qmgr/enum_files.c
index 6602f68..082b541 100644
--- a/dlls/qmgr/enum_files.c
+++ b/dlls/qmgr/enum_files.c
@@ -114,19 +114,29 @@ static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_Next(
     return fetched == celt ? S_OK : S_FALSE;
 }
 
+/* Skip over one or more files in the file enumerator */
 static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_Skip(
     IEnumBackgroundCopyFiles* iface,
     ULONG celt)
 {
-    FIXME("Not implemented\n");
-    return E_NOTIMPL;
+    EnumBackgroundCopyFilesImpl *This = (EnumBackgroundCopyFilesImpl *) iface;
+
+    if (celt > This->numFiles - This->indexFiles)
+    {
+        This->indexFiles = This->numFiles;
+        return S_FALSE;
+    }
+
+    This->indexFiles += celt;
+    return S_OK;
 }
 
 static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_Reset(
     IEnumBackgroundCopyFiles* iface)
 {
-    FIXME("Not implemented\n");
-    return E_NOTIMPL;
+    EnumBackgroundCopyFilesImpl *This = (EnumBackgroundCopyFilesImpl *) iface;
+    This->indexFiles = 0;
+    return S_OK;
 }
 
 static HRESULT WINAPI BITS_IEnumBackgroundCopyFiles_Clone(
diff --git a/dlls/qmgr/tests/enum_files.c b/dlls/qmgr/tests/enum_files.c
index 452aad6..ff2cb16 100644
--- a/dlls/qmgr/tests/enum_files.c
+++ b/dlls/qmgr/tests/enum_files.c
@@ -214,6 +214,54 @@ static void test_Next_errors(void)
     ok(hres == E_INVALIDARG, "Invalid call to Next succeeded: %08x\n", hres);
 }
 
+/* Test skipping through the files in a list */
+static void test_Skip_walkList(void)
+{
+    HRESULT hres;
+    ULONG i;
+
+    for (i = 0; i < test_fileCount; i++)
+    {
+        hres = IEnumBackgroundCopyFiles_Skip(test_enumFiles, 1);
+        ok(hres == S_OK, "Skip failed: %08x\n", hres);
+        if(hres != S_OK)
+        {
+            skip("Unable to propely Skip files\n");
+            return;
+        }
+    }
+
+    hres = IEnumBackgroundCopyFiles_Skip(test_enumFiles, 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 = IEnumBackgroundCopyFiles_Skip(test_enumFiles, test_fileCount + 1);
+    ok(hres == S_FALSE, "Skip expected end of list: %08x\n", hres);
+}
+
+/* Test resetting the file enumerator */
+static void test_Reset(void)
+{
+    HRESULT hres;
+
+    hres = IEnumBackgroundCopyFiles_Skip(test_enumFiles, test_fileCount);
+    ok(hres == S_OK, "Skip failed: %08x\n", hres);
+    hres = IEnumBackgroundCopyFiles_Reset(test_enumFiles);
+    ok(hres == S_OK, "Reset failed: %08x\n", hres);
+    if(hres != S_OK)
+    {
+        skip("Unable to Reset enumerator\n");
+        return;
+    }
+    hres = IEnumBackgroundCopyFiles_Skip(test_enumFiles, test_fileCount);
+    ok(hres == S_OK, "Reset failed: %08x\n", hres);
+}
+
 typedef void (*test_t)(void);
 
 START_TEST(enum_files)
@@ -224,6 +272,9 @@ START_TEST(enum_files)
         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