qmgr: Implement Skip and Reset for IEnumBackgroundCopyJobs.

This commit is contained in:
Roy Shea 2008-03-03 16:47:21 -08:00 committed by Alexandre Julliard
parent 1317e3115a
commit a0fd05f09e
2 changed files with 71 additions and 4 deletions

View File

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

View File

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