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
be916a7e
Commit
be916a7e
authored
Feb 26, 2019
by
Zebediah Figura
Committed by
Alexandre Julliard
Feb 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
quartz/tests/avisplit: Clean up test_query_interface().
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
874c5508
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
72 deletions
+44
-72
avisplit.c
dlls/quartz/tests/avisplit.c
+44
-72
No files found.
dlls/quartz/tests/avisplit.c
View file @
be916a7e
/*
*
Unit tests for the avi splitter function
s
*
AVI splitter filter unit test
s
*
* Copyright (C) 2007 Google (Lei Zhang)
* Copyright (C) 2008 Google (Maarten Lankhorst)
...
...
@@ -20,62 +20,56 @@
*/
#define COBJMACROS
#include "wine/test.h"
#include "dshow.h"
#include "tlhelp32.h"
static
IUnknown
*
pAviSplitter
=
NULL
;
#include "wine/test.h"
static
BOOL
create_avi
splitter
(
void
)
static
IBaseFilter
*
create_avi_
splitter
(
void
)
{
HRESULT
hr
;
hr
=
CoCreateInstance
(
&
CLSID_AviSplitter
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IUnknown
,
(
LPVOID
*
)
&
pAviSplitte
r
);
return
(
hr
==
S_OK
&&
pAviSplitter
!=
NULL
)
;
IBaseFilter
*
filter
=
NULL
;
HRESULT
hr
=
CoCreateInstance
(
&
CLSID_AviSplitter
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IBaseFilter
,
(
void
**
)
&
filter
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
h
r
);
return
filter
;
}
static
void
release_avisplitter
(
void
)
#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
)
{
HRESULT
hr
;
Sleep
(
1000
);
hr
=
IUnknown_Release
(
pAviSplitter
);
IUnknown
*
iface
=
iface_ptr
;
HRESULT
hr
,
expected_hr
;
IUnknown
*
unk
;
/* Looks like wine has a reference leak somewhere on test_threads tests,
* it passes in windows
*/
ok
(
hr
==
0
,
"IUnknown_Release failed with %d
\n
"
,
(
INT
)
hr
);
expected_hr
=
supported
?
S_OK
:
E_NOINTERFACE
;
while
(
hr
>
0
)
hr
=
IUnknown_Release
(
pAviSplitter
);
pAviSplitter
=
NULL
;
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
))
IUnknown_Release
(
unk
);
}
static
void
test_
query_interface
(
void
)
static
void
test_
interfaces
(
void
)
{
HRESULT
hr
;
ULONG
ref
;
IUnknown
*
iface
=
NULL
;
#define TEST_INTERFACE(riid,expected) do { \
hr = IUnknown_QueryInterface(pAviSplitter, &riid, (void**)&iface); \
ok( hr == expected, #riid" should %s got %08X\n", expected==S_OK ? "exist" : "not be present", GetLastError() ); \
if (hr == S_OK) { \
ref = IUnknown_Release(iface); \
ok(ref == 1, "Reference is %u, expected 1\n", ref); \
} \
iface = NULL; \
} while(0)
TEST_INTERFACE
(
IID_IBaseFilter
,
S_OK
);
TEST_INTERFACE
(
IID_IMediaSeeking
,
E_NOINTERFAC
E
);
TEST_INTERFACE
(
IID_IKsPropertySet
,
E_NOINTERFAC
E
);
TEST_INTERFACE
(
IID_IMediaPosition
,
E_NOINTERFAC
E
);
TEST_INTERFACE
(
IID_IQualityControl
,
E_NOINTERFAC
E
);
TEST_INTERFACE
(
IID_IQualProp
,
E_NOINTERFACE
);
#undef TEST_INTERFACE
IBaseFilter
*
filter
=
create_avi_splitter
()
;
check_interface
(
filter
,
&
IID_IBaseFilter
,
TRUE
)
;
check_interface
(
filter
,
&
IID_IMediaFilter
,
TRUE
);
check_interface
(
filter
,
&
IID_IPersist
,
TRUE
);
check_interface
(
filter
,
&
IID_IUnknown
,
TRUE
);
check_interface
(
filter
,
&
IID_IAMFilterMiscFlags
,
FALSE
);
check_interface
(
filter
,
&
IID_IBasicAudio
,
FALSE
);
check_interface
(
filter
,
&
IID_IBasicVideo
,
FALSE
);
check_interface
(
filter
,
&
IID_IKsPropertySet
,
FALSE
);
check_interface
(
filter
,
&
IID_IMediaPosition
,
FALSE
);
check_interface
(
filter
,
&
IID_IMediaSeeking
,
FALSE
);
check_interface
(
filter
,
&
IID_IPersistPropertyBag
,
FALSE
);
check_interface
(
filter
,
&
IID_IPin
,
FALSE
);
check_interface
(
filter
,
&
IID_IQualityControl
,
FALS
E
);
check_interface
(
filter
,
&
IID_IQualProp
,
FALS
E
);
check_interface
(
filter
,
&
IID_IReferenceClock
,
FALS
E
);
check_interface
(
filter
,
&
IID_IVideoWindow
,
FALS
E
);
IBaseFilter_Release
(
filter
);
}
static
void
test_pin
(
IPin
*
pin
)
...
...
@@ -93,19 +87,11 @@ static void test_pin(IPin *pin)
static
void
test_basefilter
(
void
)
{
IEnumPins
*
pin_enum
=
NULL
;
IBaseFilter
*
base
=
NULL
;
IBaseFilter
*
base
=
create_avi_splitter
()
;
IPin
*
pins
[
2
];
ULONG
ref
;
HRESULT
hr
;
IUnknown_QueryInterface
(
pAviSplitter
,
&
IID_IBaseFilter
,
(
void
**
)
&
base
);
if
(
base
==
NULL
)
{
/* test_query_interface handles this case */
skip
(
"No IBaseFilter
\n
"
);
return
;
}
hr
=
IBaseFilter_EnumPins
(
base
,
NULL
);
ok
(
hr
==
E_POINTER
,
"hr = %08x and not E_POINTER
\n
"
,
hr
);
...
...
@@ -169,7 +155,7 @@ static WCHAR *load_resource(const WCHAR *name)
static
void
test_filter_graph
(
void
)
{
IFileSourceFilter
*
pfile
=
NULL
;
IBaseFilter
*
preader
=
NULL
,
*
pavi
=
NULL
;
IBaseFilter
*
preader
=
NULL
,
*
pavi
=
create_avi_splitter
()
;
IEnumPins
*
enumpins
=
NULL
;
IPin
*
filepin
=
NULL
,
*
avipin
=
NULL
;
HRESULT
hr
;
...
...
@@ -202,7 +188,7 @@ static void test_filter_graph(void)
return
;
}
hr
=
IUnknown_QueryInterface
(
p
AviSplitter
,
&
IID_IFileSourceFilter
,
hr
=
IUnknown_QueryInterface
(
p
avi
,
&
IID_IFileSourceFilter
,
(
void
**
)
&
pfile
);
ok
(
hr
==
E_NOINTERFACE
,
"Avi splitter returns unexpected error: %08x
\n
"
,
hr
);
...
...
@@ -222,12 +208,6 @@ static void test_filter_graph(void)
if
(
hr
!=
S_OK
)
goto
fail
;
hr
=
IUnknown_QueryInterface
(
pAviSplitter
,
&
IID_IBaseFilter
,
(
void
**
)
&
pavi
);
ok
(
hr
==
S_OK
,
"Could not get base filter: %08x
\n
"
,
hr
);
if
(
hr
!=
S_OK
)
goto
fail
;
hr
=
IFileSourceFilter_Load
(
pfile
,
filename
,
NULL
);
if
(
hr
!=
S_OK
)
{
...
...
@@ -418,17 +398,9 @@ START_TEST(avisplit)
{
CoInitialize
(
NULL
);
if
(
!
create_avisplitter
())
{
skip
(
"Could not create avisplitter
\n
"
);
return
;
}
test_query_interface
();
test_interfaces
();
test_basefilter
();
test_filter_graph
();
release_avisplitter
();
CoUninitialize
();
}
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