[2/5] qmgr: Implement Skip and Reset for IEnumBackgroundCopyFiles.
Dan Hipschman
dsh at linux.ucla.edu
Thu Feb 28 20:58:32 CST 2008
Implement IEnumBackgroundCopyFiles_Skip.
From: Roy Shea <roy at cs.hmc.edu>
Date: Thu Dec 20 18:38:31 CST 2007
---
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 63a939f..2961668 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 3e69789..954468e 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-patches
mailing list