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
24da40fa
Commit
24da40fa
authored
Nov 21, 2011
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Nov 22, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qedit/tests: Add SampleGrabber COM aggregation test.
parent
35b9c42f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
0 deletions
+68
-0
mediadet.c
dlls/qedit/tests/mediadet.c
+68
-0
No files found.
dlls/qedit/tests/mediadet.c
View file @
24da40fa
...
...
@@ -19,6 +19,7 @@
*/
#define COBJMACROS
#define CONST_VTABLE
#include "initguid.h"
#include "ole2.h"
...
...
@@ -28,6 +29,47 @@
#include "qedit.h"
#include "rc.h"
/* Outer IUnknown for COM aggregation tests */
struct
unk_impl
{
IUnknown
IUnknown_iface
;
LONG
ref
;
IUnknown
*
inner_unk
;
};
static
inline
struct
unk_impl
*
impl_from_IUnknown
(
IUnknown
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
struct
unk_impl
,
IUnknown_iface
);
}
static
HRESULT
WINAPI
unk_QueryInterface
(
IUnknown
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
struct
unk_impl
*
This
=
impl_from_IUnknown
(
iface
);
return
IUnknown_QueryInterface
(
This
->
inner_unk
,
riid
,
ppv
);
}
static
ULONG
WINAPI
unk_AddRef
(
IUnknown
*
iface
)
{
struct
unk_impl
*
This
=
impl_from_IUnknown
(
iface
);
return
InterlockedIncrement
(
&
This
->
ref
);
}
static
ULONG
WINAPI
unk_Release
(
IUnknown
*
iface
)
{
struct
unk_impl
*
This
=
impl_from_IUnknown
(
iface
);
return
InterlockedDecrement
(
&
This
->
ref
);
}
static
const
IUnknownVtbl
unk_vtbl
=
{
unk_QueryInterface
,
unk_AddRef
,
unk_Release
};
static
WCHAR
test_avi_filename
[
MAX_PATH
];
static
WCHAR
test_sound_avi_filename
[
MAX_PATH
];
...
...
@@ -294,6 +336,31 @@ static void test_mediadet(void)
DeleteFileW
(
test_sound_avi_filename
);
}
static
void
test_samplegrabber
(
void
)
{
struct
unk_impl
unk_obj
=
{{
&
unk_vtbl
},
19
,
NULL
};
ISampleGrabber
*
sg
;
ULONG
refcount
;
HRESULT
hr
;
/* COM aggregation */
hr
=
CoCreateInstance
(
&
CLSID_SampleGrabber
,
&
unk_obj
.
IUnknown_iface
,
CLSCTX_INPROC_SERVER
,
&
IID_IUnknown
,
(
void
**
)
&
unk_obj
.
inner_unk
);
todo_wine
ok
(
hr
==
S_OK
,
"CoCreateInstance failed: %08x
\n
"
,
hr
);
if
(
hr
!=
S_OK
)
return
;
hr
=
IUnknown_QueryInterface
(
unk_obj
.
inner_unk
,
&
IID_ISampleGrabber
,
(
void
**
)
&
sg
);
ok
(
hr
==
S_OK
,
"QueryInterface for IID_ISampleGrabber failed: %08x
\n
"
,
hr
);
refcount
=
ISampleGrabber_AddRef
(
sg
);
ok
(
refcount
==
unk_obj
.
ref
,
"SampleGrabber just pretends to support COM aggregation
\n
"
);
refcount
=
ISampleGrabber_Release
(
sg
);
ok
(
refcount
==
unk_obj
.
ref
,
"SampleGrabber just pretends to support COM aggregation
\n
"
);
refcount
=
ISampleGrabber_Release
(
sg
);
ok
(
refcount
==
19
,
"Refcount should be back at 19 but is %u
\n
"
,
refcount
);
IUnknown_Release
(
unk_obj
.
inner_unk
);
}
START_TEST
(
mediadet
)
{
if
(
!
init_tests
())
...
...
@@ -304,5 +371,6 @@ START_TEST(mediadet)
CoInitialize
(
NULL
);
test_mediadet
();
test_samplegrabber
();
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