Commit a0fd05f0 authored by Roy Shea's avatar Roy Shea Committed by Alexandre Julliard

qmgr: Implement Skip and Reset for IEnumBackgroundCopyJobs.

parent 1317e311
......@@ -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(
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment