Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
1317e311
Commit
1317e311
authored
Mar 03, 2008
by
Dan Hipschman
Committed by
Alexandre Julliard
Mar 04, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qmgr: Implement IEnumBackgroundCopyJobs_Next.
parent
8dfba77c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
141 additions
and
4 deletions
+141
-4
enum_jobs.c
dlls/qmgr/enum_jobs.c
+29
-3
enum_jobs.c
dlls/qmgr/tests/enum_jobs.c
+112
-1
No files found.
dlls/qmgr/enum_jobs.c
View file @
1317e311
...
...
@@ -73,15 +73,41 @@ static ULONG WINAPI BITS_IEnumBackgroundCopyJobs_Release(
return
ref
;
}
/*** IEnumBackgroundCopyJobs methods ***/
static
HRESULT
WINAPI
BITS_IEnumBackgroundCopyJobs_Next
(
IEnumBackgroundCopyJobs
*
iface
,
ULONG
celt
,
IBackgroundCopyJob
**
rgelt
,
ULONG
*
pceltFetched
)
{
FIXME
(
"Not implemented
\n
"
);
return
E_NOTIMPL
;
EnumBackgroundCopyJobsImpl
*
This
=
(
EnumBackgroundCopyJobsImpl
*
)
iface
;
ULONG
fetched
;
ULONG
i
;
IBackgroundCopyJob
*
job
;
fetched
=
min
(
celt
,
This
->
numJobs
-
This
->
indexJobs
);
if
(
pceltFetched
)
*
pceltFetched
=
fetched
;
else
{
/* We need to initialize this array if the caller doesn't request
the length because length_is will default to celt. */
for
(
i
=
0
;
i
<
celt
;
++
i
)
rgelt
[
i
]
=
NULL
;
/* pceltFetched can only be NULL if celt is 1 */
if
(
celt
!=
1
)
return
E_INVALIDARG
;
}
/* Fill in the array of objects */
for
(
i
=
0
;
i
<
fetched
;
++
i
)
{
job
=
This
->
jobs
[
This
->
indexJobs
++
];
IBackgroundCopyJob_AddRef
(
job
);
rgelt
[
i
]
=
job
;
}
return
fetched
==
celt
?
S_OK
:
S_FALSE
;
}
static
HRESULT
WINAPI
BITS_IEnumBackgroundCopyJobs_Skip
(
...
...
dlls/qmgr/tests/enum_jobs.c
View file @
1317e311
/*
* Unit test suite for Enum Background Copy Jobs Interface
*
* Copyright 2007 Google (Roy Shea)
* Copyright 2007 Google (Roy Shea
, Dan Hipschman
)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -31,6 +31,7 @@ static const WCHAR test_displayNameB[] = {'T','e','s','t','B', 0};
static
IBackgroundCopyManager
*
test_manager
;
static
IBackgroundCopyJob
*
test_jobA
;
static
IBackgroundCopyJob
*
test_jobB
;
static
ULONG
test_jobCountB
;
static
IEnumBackgroundCopyJobs
*
test_enumJobsA
;
static
IEnumBackgroundCopyJobs
*
test_enumJobsB
;
static
GUID
test_jobIdA
;
...
...
@@ -73,6 +74,10 @@ static BOOL setup(void)
if
(
hres
!=
S_OK
)
return
FALSE
;
hres
=
IEnumBackgroundCopyJobs_GetCount
(
test_enumJobsB
,
&
test_jobCountB
);
if
(
hres
!=
S_OK
)
return
FALSE
;
return
TRUE
;
}
...
...
@@ -125,12 +130,118 @@ static void test_GetCount(void)
ok
(
jobCountB
==
jobCountA
+
1
,
"Got incorrect count
\n
"
);
}
/* Test Next with a NULL pceltFetched*/
static
void
test_Next_walkListNull
(
void
)
{
HRESULT
hres
;
IBackgroundCopyJob
*
job
;
ULONG
i
;
/* Fetch the available jobs */
for
(
i
=
0
;
i
<
test_jobCountB
;
i
++
)
{
hres
=
IEnumBackgroundCopyJobs_Next
(
test_enumJobsB
,
1
,
&
job
,
NULL
);
ok
(
hres
==
S_OK
,
"Next failed: %08x
\n
"
,
hres
);
if
(
hres
!=
S_OK
)
{
skip
(
"Unable to get job from Next
\n
"
);
return
;
}
IBackgroundCopyJob_Release
(
job
);
}
/* Attempt to fetch one more than the number of available jobs */
hres
=
IEnumBackgroundCopyJobs_Next
(
test_enumJobsB
,
1
,
&
job
,
NULL
);
ok
(
hres
==
S_FALSE
,
"Next off end of available jobs failed: %08x
\n
"
,
hres
);
}
/* Test Next */
static
void
test_Next_walkList_1
(
void
)
{
HRESULT
hres
;
IBackgroundCopyJob
*
job
;
ULONG
fetched
;
ULONG
i
;
/* Fetch the available jobs */
for
(
i
=
0
;
i
<
test_jobCountB
;
i
++
)
{
fetched
=
0
;
hres
=
IEnumBackgroundCopyJobs_Next
(
test_enumJobsB
,
1
,
&
job
,
&
fetched
);
ok
(
hres
==
S_OK
,
"Next failed: %08x
\n
"
,
hres
);
if
(
hres
!=
S_OK
)
{
skip
(
"Unable to get job from Next
\n
"
);
return
;
}
ok
(
fetched
==
1
,
"Next returned the incorrect number of jobs: %08x
\n
"
,
hres
);
IBackgroundCopyJob_Release
(
job
);
}
/* Attempt to fetch one more than the number of available jobs */
fetched
=
0
;
hres
=
IEnumBackgroundCopyJobs_Next
(
test_enumJobsB
,
1
,
&
job
,
&
fetched
);
ok
(
hres
==
S_FALSE
,
"Next off end of available jobs failed: %08x
\n
"
,
hres
);
ok
(
fetched
==
0
,
"Next returned the incorrect number of jobs: %08x
\n
"
,
hres
);
}
/* Test Next by requesting multiple files at a time */
static
void
test_Next_walkList_2
(
void
)
{
HRESULT
hres
;
IBackgroundCopyJob
**
jobs
;
ULONG
fetched
;
ULONG
i
;
jobs
=
HeapAlloc
(
GetProcessHeap
(),
0
,
test_jobCountB
*
sizeof
*
jobs
);
if
(
!
jobs
)
{
skip
(
"Couldn't allocate memory
\n
"
);
return
;
}
for
(
i
=
0
;
i
<
test_jobCountB
;
i
++
)
jobs
[
i
]
=
NULL
;
fetched
=
0
;
hres
=
IEnumBackgroundCopyJobs_Next
(
test_enumJobsB
,
test_jobCountB
,
jobs
,
&
fetched
);
ok
(
hres
==
S_OK
,
"Next failed: %08x
\n
"
,
hres
);
if
(
hres
!=
S_OK
)
{
skip
(
"Unable to get file from test_enumJobs
\n
"
);
return
;
}
ok
(
fetched
==
test_jobCountB
,
"Next returned the incorrect number of jobs: %08x
\n
"
,
hres
);
for
(
i
=
0
;
i
<
test_jobCountB
;
i
++
)
{
ok
(
jobs
[
i
]
!=
NULL
,
"Next returned NULL
\n
"
);
if
(
jobs
[
i
])
IBackgroundCopyFile_Release
(
jobs
[
i
]);
}
}
/* Test Next Error conditions */
static
void
test_Next_errors
(
void
)
{
HRESULT
hres
;
IBackgroundCopyJob
*
jobs
[
2
];
/* E_INVALIDARG: pceltFetched can ONLY be NULL if celt is 1 */
hres
=
IEnumBackgroundCopyJobs_Next
(
test_enumJobsB
,
2
,
jobs
,
NULL
);
ok
(
hres
!=
S_OK
,
"Invalid call to Next succeeded: %08x
\n
"
,
hres
);
}
typedef
void
(
*
test_t
)(
void
);
START_TEST
(
enum_jobs
)
{
static
const
test_t
tests
[]
=
{
test_GetCount
,
test_Next_walkListNull
,
test_Next_walkList_1
,
test_Next_walkList_2
,
test_Next_errors
,
0
};
const
test_t
*
test
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment