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
5ddb1338
Commit
5ddb1338
authored
Dec 20, 2007
by
Lei Zhang
Committed by
Alexandre Julliard
Dec 21, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
quartz: Move aggregation tests into separate file.
parent
eb3fb4bf
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
159 additions
and
119 deletions
+159
-119
Makefile.in
dlls/quartz/tests/Makefile.in
+1
-0
misc.c
dlls/quartz/tests/misc.c
+158
-0
videorenderer.c
dlls/quartz/tests/videorenderer.c
+0
-119
No files found.
dlls/quartz/tests/Makefile.in
View file @
5ddb1338
...
...
@@ -9,6 +9,7 @@ EXTRALIBS = -lstrmiids -luuid
CTESTS
=
\
filtergraph.c
\
memallocator.c
\
misc.c
\
referenceclock.c
\
videorenderer.c
...
...
dlls/quartz/tests/misc.c
0 → 100644
View file @
5ddb1338
/*
* Misc unit tests for Quartz
*
* Copyright (C) 2007 Google (Lei Zhang)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#include "wine/test.h"
#include "dshow.h"
#define QI_SUCCEED(iface, riid, ppv) hr = IUnknown_QueryInterface(iface, &riid, (LPVOID*)&ppv); \
ok(hr == S_OK, "IUnknown_QueryInterface returned %x\n", hr); \
ok(ppv != NULL, "Pointer is NULL\n");
#define QI_FAIL(iface, riid, ppv) hr = IUnknown_QueryInterface(iface, &riid, (LPVOID*)&ppv); \
ok(hr == E_NOINTERFACE, "IUnknown_QueryInterface returned %x\n", hr); \
ok(ppv == NULL, "Pointer is %p\n", ppv);
#define ADDREF_EXPECT(iface, num) if (iface) { \
hr = IUnknown_AddRef(iface); \
ok(hr == num, "IUnknown_AddRef should return %d, got %d\n", num, hr); \
}
#define RELEASE_EXPECT(iface, num) if (iface) { \
hr = IUnknown_Release(iface); \
ok(hr == num, "IUnknown_Release should return %d, got %d\n", num, hr); \
}
static
void
test_aggregation
(
const
CLSID
clsidOuter
,
const
CLSID
clsidInner
,
const
IID
iidOuter
,
const
IID
iidInner
)
{
HRESULT
hr
;
IUnknown
*
pUnkOuter
=
NULL
;
IUnknown
*
pUnkInner
=
NULL
;
IUnknown
*
pUnkInnerFail
=
NULL
;
IUnknown
*
pUnkOuterTest
=
NULL
;
IUnknown
*
pUnkInnerTest
=
NULL
;
IUnknown
*
pUnkAggregatee
=
NULL
;
IUnknown
*
pUnkAggregator
=
NULL
;
IUnknown
*
pUnkTest
=
NULL
;
hr
=
CoCreateInstance
(
&
clsidOuter
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IUnknown
,
(
LPVOID
*
)
&
pUnkOuter
);
ok
(
hr
==
S_OK
,
"CoCreateInstance failed with %x
\n
"
,
hr
);
ok
(
pUnkOuter
!=
NULL
,
"pUnkOuter is NULL
\n
"
);
if
(
!
pUnkOuter
)
{
skip
(
"pUnkOuter is NULL
\n
"
);
return
;
}
/* for aggregation, we should only be able to request IUnknown */
hr
=
CoCreateInstance
(
&
clsidInner
,
pUnkOuter
,
CLSCTX_INPROC_SERVER
,
&
iidInner
,
(
LPVOID
*
)
&
pUnkInnerFail
);
ok
(
hr
==
E_NOINTERFACE
,
"CoCreateInstance returned %x
\n
"
,
hr
);
ok
(
pUnkInnerFail
==
NULL
,
"pUnkInnerFail is not NULL
\n
"
);
/* aggregation, request IUnknown */
hr
=
CoCreateInstance
(
&
clsidInner
,
pUnkOuter
,
CLSCTX_INPROC_SERVER
,
&
IID_IUnknown
,
(
LPVOID
*
)
&
pUnkInner
);
ok
(
hr
==
S_OK
,
"CoCreateInstance returned %x
\n
"
,
hr
);
ok
(
pUnkInner
!=
NULL
,
"pUnkInner is NULL
\n
"
);
if
(
!
pUnkInner
)
{
skip
(
"pUnkInner is NULL
\n
"
);
return
;
}
ADDREF_EXPECT
(
pUnkOuter
,
2
);
ADDREF_EXPECT
(
pUnkInner
,
2
);
RELEASE_EXPECT
(
pUnkOuter
,
1
);
RELEASE_EXPECT
(
pUnkInner
,
1
);
QI_FAIL
(
pUnkOuter
,
iidInner
,
pUnkAggregatee
);
QI_FAIL
(
pUnkInner
,
iidOuter
,
pUnkAggregator
);
/* these QueryInterface calls should work */
QI_SUCCEED
(
pUnkOuter
,
iidOuter
,
pUnkAggregator
);
QI_SUCCEED
(
pUnkOuter
,
IID_IUnknown
,
pUnkOuterTest
);
QI_SUCCEED
(
pUnkInner
,
iidInner
,
pUnkAggregatee
);
QI_SUCCEED
(
pUnkInner
,
IID_IUnknown
,
pUnkInnerTest
);
if
(
!
pUnkAggregator
||
!
pUnkOuterTest
||
!
pUnkAggregatee
\
||
!
pUnkInnerTest
)
{
skip
(
"One of the required interfaces is NULL
\n
"
);
return
;
}
ADDREF_EXPECT
(
pUnkAggregator
,
5
);
ADDREF_EXPECT
(
pUnkOuterTest
,
6
);
ADDREF_EXPECT
(
pUnkAggregatee
,
7
);
ADDREF_EXPECT
(
pUnkInnerTest
,
3
);
RELEASE_EXPECT
(
pUnkAggregator
,
6
);
RELEASE_EXPECT
(
pUnkOuterTest
,
5
);
RELEASE_EXPECT
(
pUnkAggregatee
,
4
);
RELEASE_EXPECT
(
pUnkInnerTest
,
2
);
QI_SUCCEED
(
pUnkAggregator
,
IID_IUnknown
,
pUnkTest
);
QI_SUCCEED
(
pUnkOuterTest
,
IID_IUnknown
,
pUnkTest
);
QI_SUCCEED
(
pUnkAggregatee
,
IID_IUnknown
,
pUnkTest
);
QI_SUCCEED
(
pUnkInnerTest
,
IID_IUnknown
,
pUnkTest
);
QI_FAIL
(
pUnkAggregator
,
iidInner
,
pUnkTest
);
QI_FAIL
(
pUnkOuterTest
,
iidInner
,
pUnkTest
);
QI_FAIL
(
pUnkAggregatee
,
iidInner
,
pUnkTest
);
QI_SUCCEED
(
pUnkInnerTest
,
iidInner
,
pUnkTest
);
QI_SUCCEED
(
pUnkAggregator
,
iidOuter
,
pUnkTest
);
QI_SUCCEED
(
pUnkOuterTest
,
iidOuter
,
pUnkTest
);
QI_SUCCEED
(
pUnkAggregatee
,
iidOuter
,
pUnkTest
);
QI_FAIL
(
pUnkInnerTest
,
iidOuter
,
pUnkTest
);
RELEASE_EXPECT
(
pUnkAggregator
,
10
);
RELEASE_EXPECT
(
pUnkOuterTest
,
9
);
RELEASE_EXPECT
(
pUnkAggregatee
,
8
);
RELEASE_EXPECT
(
pUnkInnerTest
,
2
);
RELEASE_EXPECT
(
pUnkOuter
,
7
);
RELEASE_EXPECT
(
pUnkInner
,
1
);
}
static
void
test_video_renderer_aggregations
(
void
)
{
IID
iids
[]
=
{
IID_IMediaFilter
,
IID_IBaseFilter
,
IID_IBasicVideo
,
IID_IVideoWindow
};
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
iids
)
/
sizeof
(
iids
[
0
]);
i
++
)
{
test_aggregation
(
CLSID_SystemClock
,
CLSID_VideoRenderer
,
IID_IReferenceClock
,
iids
[
i
]);
}
}
START_TEST
(
misc
)
{
CoInitialize
(
NULL
);
test_video_renderer_aggregations
();
}
dlls/quartz/tests/videorenderer.c
View file @
5ddb1338
...
...
@@ -27,15 +27,6 @@
ok(hr == S_OK, "IUnknown_QueryInterface returned %x\n", hr); \
ok(ppv != NULL, "Pointer is NULL\n");
#define QI_FAIL(iface, riid, ppv) hr = IUnknown_QueryInterface(iface, &riid, (LPVOID*)&ppv); \
ok(hr == E_NOINTERFACE, "IUnknown_QueryInterface returned %x\n", hr); \
ok(ppv == NULL, "Pointer is %p\n", ppv);
#define ADDREF_EXPECT(iface, num) if (iface) { \
hr = IUnknown_AddRef(iface); \
ok(hr == num, "IUnknown_AddRef should return %d, got %d\n", num, hr); \
}
#define RELEASE_EXPECT(iface, num) if (iface) { \
hr = IUnknown_Release(iface); \
ok(hr == num, "IUnknown_Release should return %d, got %d\n", num, hr); \
...
...
@@ -43,101 +34,6 @@
static
IUnknown
*
pVideoRenderer
=
NULL
;
static
void
test_aggregation
(
const
CLSID
clsidOuter
,
const
CLSID
clsidInner
,
const
IID
iidOuter
,
const
IID
iidInner
)
{
HRESULT
hr
;
IUnknown
*
pUnkOuter
=
NULL
;
IUnknown
*
pUnkInner
=
NULL
;
IUnknown
*
pUnkInnerFail
=
NULL
;
IUnknown
*
pUnkOuterTest
=
NULL
;
IUnknown
*
pUnkInnerTest
=
NULL
;
IUnknown
*
pUnkAggregatee
=
NULL
;
IUnknown
*
pUnkAggregator
=
NULL
;
IUnknown
*
pUnkTest
=
NULL
;
hr
=
CoCreateInstance
(
&
clsidOuter
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IUnknown
,
(
LPVOID
*
)
&
pUnkOuter
);
ok
(
hr
==
S_OK
,
"CoCreateInstance failed with %x
\n
"
,
hr
);
ok
(
pUnkOuter
!=
NULL
,
"pUnkOuter is NULL
\n
"
);
if
(
!
pUnkOuter
)
{
skip
(
"pUnkOuter is NULL
\n
"
);
return
;
}
/* for aggregation, we should only be able to request IUnknown */
hr
=
CoCreateInstance
(
&
clsidInner
,
pUnkOuter
,
CLSCTX_INPROC_SERVER
,
&
iidInner
,
(
LPVOID
*
)
&
pUnkInnerFail
);
ok
(
hr
==
E_NOINTERFACE
,
"CoCreateInstance returned %x
\n
"
,
hr
);
ok
(
pUnkInnerFail
==
NULL
,
"pUnkInnerFail is not NULL
\n
"
);
/* aggregation, request IUnknown */
hr
=
CoCreateInstance
(
&
clsidInner
,
pUnkOuter
,
CLSCTX_INPROC_SERVER
,
&
IID_IUnknown
,
(
LPVOID
*
)
&
pUnkInner
);
ok
(
hr
==
S_OK
,
"CoCreateInstance returned %x
\n
"
,
hr
);
ok
(
pUnkInner
!=
NULL
,
"pUnkInner is NULL
\n
"
);
if
(
!
pUnkInner
)
{
skip
(
"pUnkInner is NULL
\n
"
);
return
;
}
ADDREF_EXPECT
(
pUnkOuter
,
2
);
ADDREF_EXPECT
(
pUnkInner
,
2
);
RELEASE_EXPECT
(
pUnkOuter
,
1
);
RELEASE_EXPECT
(
pUnkInner
,
1
);
QI_FAIL
(
pUnkOuter
,
iidInner
,
pUnkAggregatee
);
QI_FAIL
(
pUnkInner
,
iidOuter
,
pUnkAggregator
);
/* these QueryInterface calls should work */
QI_SUCCEED
(
pUnkOuter
,
iidOuter
,
pUnkAggregator
);
QI_SUCCEED
(
pUnkOuter
,
IID_IUnknown
,
pUnkOuterTest
);
QI_SUCCEED
(
pUnkInner
,
iidInner
,
pUnkAggregatee
);
QI_SUCCEED
(
pUnkInner
,
IID_IUnknown
,
pUnkInnerTest
);
if
(
!
pUnkAggregator
||
!
pUnkOuterTest
||
!
pUnkAggregatee
\
||
!
pUnkInnerTest
)
{
skip
(
"One of the required interfaces is NULL
\n
"
);
return
;
}
ADDREF_EXPECT
(
pUnkAggregator
,
5
);
ADDREF_EXPECT
(
pUnkOuterTest
,
6
);
ADDREF_EXPECT
(
pUnkAggregatee
,
7
);
ADDREF_EXPECT
(
pUnkInnerTest
,
3
);
RELEASE_EXPECT
(
pUnkAggregator
,
6
);
RELEASE_EXPECT
(
pUnkOuterTest
,
5
);
RELEASE_EXPECT
(
pUnkAggregatee
,
4
);
RELEASE_EXPECT
(
pUnkInnerTest
,
2
);
QI_SUCCEED
(
pUnkAggregator
,
IID_IUnknown
,
pUnkTest
);
QI_SUCCEED
(
pUnkOuterTest
,
IID_IUnknown
,
pUnkTest
);
QI_SUCCEED
(
pUnkAggregatee
,
IID_IUnknown
,
pUnkTest
);
QI_SUCCEED
(
pUnkInnerTest
,
IID_IUnknown
,
pUnkTest
);
QI_FAIL
(
pUnkAggregator
,
iidInner
,
pUnkTest
);
QI_FAIL
(
pUnkOuterTest
,
iidInner
,
pUnkTest
);
QI_FAIL
(
pUnkAggregatee
,
iidInner
,
pUnkTest
);
QI_SUCCEED
(
pUnkInnerTest
,
iidInner
,
pUnkTest
);
QI_SUCCEED
(
pUnkAggregator
,
iidOuter
,
pUnkTest
);
QI_SUCCEED
(
pUnkOuterTest
,
iidOuter
,
pUnkTest
);
QI_SUCCEED
(
pUnkAggregatee
,
iidOuter
,
pUnkTest
);
QI_FAIL
(
pUnkInnerTest
,
iidOuter
,
pUnkTest
);
RELEASE_EXPECT
(
pUnkAggregator
,
10
);
RELEASE_EXPECT
(
pUnkOuterTest
,
9
);
RELEASE_EXPECT
(
pUnkAggregatee
,
8
);
RELEASE_EXPECT
(
pUnkInnerTest
,
2
);
RELEASE_EXPECT
(
pUnkOuter
,
7
);
RELEASE_EXPECT
(
pUnkInner
,
1
);
}
static
int
create_video_renderer
(
void
)
{
HRESULT
hr
;
...
...
@@ -190,20 +86,6 @@ static void test_query_interface(void)
RELEASE_EXPECT
(
pVideoWindow
,
1
);
}
static
void
test_all_aggregations
(
void
)
{
IID
iids
[]
=
{
IID_IMediaFilter
,
IID_IBaseFilter
,
IID_IBasicVideo
,
IID_IVideoWindow
};
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
iids
)
/
sizeof
(
iids
[
0
]);
i
++
)
{
test_aggregation
(
CLSID_SystemClock
,
CLSID_VideoRenderer
,
IID_IReferenceClock
,
iids
[
i
]);
}
}
START_TEST
(
videorenderer
)
{
CoInitialize
(
NULL
);
...
...
@@ -211,7 +93,6 @@ START_TEST(videorenderer)
return
;
test_query_interface
();
test_all_aggregations
();
release_video_renderer
();
}
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