qmgr: Implement Skip and Reset for IEnumBackgroundCopyFiles.

This commit is contained in:
Roy Shea 2008-02-28 18:58:32 -08:00 committed by Alexandre Julliard
parent 980e00c63b
commit 5c4776c2a3
2 changed files with 65 additions and 4 deletions

View file

@ -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(

View file

@ -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;