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
a18be1ae
Commit
a18be1ae
authored
Apr 14, 2019
by
Zebediah Figura
Committed by
Alexandre Julliard
Apr 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qedit/tests: Test that reference counts are shared between interfaces.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
975eabff
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
27 deletions
+16
-27
mediadet.c
dlls/qedit/tests/mediadet.c
+0
-27
samplegrabber.c
dlls/qedit/tests/samplegrabber.c
+16
-0
No files found.
dlls/qedit/tests/mediadet.c
View file @
a18be1ae
...
...
@@ -526,9 +526,6 @@ static void test_samplegrabber(void)
struct
unk_impl
unk_obj
=
{{
&
unk_vtbl
},
19
,
NULL
};
ISampleGrabber
*
sg
;
IBaseFilter
*
bf
;
IMediaFilter
*
mf
;
IPersist
*
persist
;
IUnknown
*
unk
;
IPin
*
pin
;
IMemInputPin
*
inpin
;
IEnumPins
*
pins
;
...
...
@@ -556,36 +553,12 @@ static void test_samplegrabber(void)
(
void
**
)
&
sg
);
ok
(
hr
==
E_NOINTERFACE
,
"SampleGrabber create failed: %08x, expected E_NOINTERFACE
\n
"
,
hr
);
/* Same refcount for all SampleGrabber interfaces */
hr
=
CoCreateInstance
(
&
CLSID_SampleGrabber
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_ISampleGrabber
,
(
void
**
)
&
sg
);
ok
(
hr
==
S_OK
,
"SampleGrabber create failed: %08x, expected S_OK
\n
"
,
hr
);
refcount
=
ISampleGrabber_AddRef
(
sg
);
ok
(
refcount
==
2
,
"refcount == %u, expected 2
\n
"
,
refcount
);
hr
=
ISampleGrabber_QueryInterface
(
sg
,
&
IID_IBaseFilter
,
(
void
**
)
&
bf
);
ok
(
hr
==
S_OK
,
"QueryInterface for IID_IBaseFilter failed: %08x
\n
"
,
hr
);
refcount
=
IBaseFilter_AddRef
(
bf
);
ok
(
refcount
==
4
,
"refcount == %u, expected 4
\n
"
,
refcount
);
refcount
=
IBaseFilter_Release
(
bf
);
hr
=
ISampleGrabber_QueryInterface
(
sg
,
&
IID_IMediaFilter
,
(
void
**
)
&
mf
);
ok
(
hr
==
S_OK
,
"QueryInterface for IID_IMediaFilter failed: %08x
\n
"
,
hr
);
refcount
=
IMediaFilter_AddRef
(
mf
);
ok
(
refcount
==
5
,
"refcount == %u, expected 5
\n
"
,
refcount
);
refcount
=
IMediaFilter_Release
(
mf
);
hr
=
ISampleGrabber_QueryInterface
(
sg
,
&
IID_IPersist
,
(
void
**
)
&
persist
);
ok
(
hr
==
S_OK
,
"QueryInterface for IID_IPersist failed: %08x
\n
"
,
hr
);
refcount
=
IPersist_AddRef
(
persist
);
ok
(
refcount
==
6
,
"refcount == %u, expected 6
\n
"
,
refcount
);
refcount
=
IPersist_Release
(
persist
);
hr
=
ISampleGrabber_QueryInterface
(
sg
,
&
IID_IUnknown
,
(
void
**
)
&
unk
);
ok
(
hr
==
S_OK
,
"QueryInterface for IID_IUnknown failed: %08x
\n
"
,
hr
);
refcount
=
IUnknown_AddRef
(
unk
);
ok
(
refcount
==
7
,
"refcount == %u, expected 7
\n
"
,
refcount
);
refcount
=
IUnknown_Release
(
unk
);
hr
=
ISampleGrabber_SetCallback
(
sg
,
&
my_sg_cb
,
0
);
ok
(
hr
==
S_OK
,
"SetCallback failed: %08x
\n
"
,
hr
);
...
...
dlls/qedit/tests/samplegrabber.c
View file @
a18be1ae
...
...
@@ -32,19 +32,35 @@ static IBaseFilter *create_sample_grabber(void)
return
filter
;
}
static
ULONG
get_refcount
(
void
*
iface
)
{
IUnknown
*
unknown
=
iface
;
IUnknown_AddRef
(
unknown
);
return
IUnknown_Release
(
unknown
);
}
#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c)
static
void
check_interface_
(
unsigned
int
line
,
void
*
iface_ptr
,
REFIID
iid
,
BOOL
supported
)
{
IUnknown
*
iface
=
iface_ptr
;
HRESULT
hr
,
expected_hr
;
ULONG
ref
,
expect_ref
;
IUnknown
*
unk
;
expected_hr
=
supported
?
S_OK
:
E_NOINTERFACE
;
expect_ref
=
get_refcount
(
iface
);
hr
=
IUnknown_QueryInterface
(
iface
,
iid
,
(
void
**
)
&
unk
);
ok_
(
__FILE__
,
line
)(
hr
==
expected_hr
,
"Got hr %#x, expected %#x.
\n
"
,
hr
,
expected_hr
);
if
(
SUCCEEDED
(
hr
))
{
ref
=
get_refcount
(
iface
);
ok_
(
__FILE__
,
line
)(
ref
==
expect_ref
+
1
,
"Expected %u references, got %u.
\n
"
,
expect_ref
+
1
,
ref
);
ref
=
get_refcount
(
unk
);
ok_
(
__FILE__
,
line
)(
ref
==
expect_ref
+
1
,
"Expected %u references, got %u.
\n
"
,
expect_ref
+
1
,
ref
);
IUnknown_Release
(
unk
);
}
}
static
void
test_interfaces
(
void
)
...
...
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