Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Ferrillo
wine
Commits
24da40fa
Commit
24da40fa
authored
13 years ago
by
Michael Stefaniuc
Committed by
Alexandre Julliard
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
qedit/tests: Add SampleGrabber COM aggregation test.
parent
35b9c42f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/qedit/tests/mediadet.c
+68
-0
68 additions, 0 deletions
dlls/qedit/tests/mediadet.c
with
68 additions
and
0 deletions
dlls/qedit/tests/mediadet.c
+
68
−
0
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
();
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment