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
39f416cd
Commit
39f416cd
authored
Mar 28, 2012
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Mar 28, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20/tests: Add COM aggregation tests for CreateTextServices().
parent
67389533
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
0 deletions
+65
-0
txtsrv.c
dlls/riched20/tests/txtsrv.c
+65
-0
No files found.
dlls/riched20/tests/txtsrv.c
View file @
39f416cd
...
...
@@ -21,6 +21,7 @@
*/
#define COBJMACROS
#define CONST_VTABLE
#include <stdio.h>
#include <stdarg.h>
...
...
@@ -811,6 +812,69 @@ static void test_IIDs(void)
"unexpected value for IID_ITextHost2: %s
\n
"
,
debugstr_guid
(
pIID_ITextHost2
));
}
/* 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
void
test_COM
(
void
)
{
struct
unk_impl
unk_obj
=
{{
&
unk_vtbl
},
19
,
NULL
};
struct
ITextHostTestImpl
texthost
=
{{
&
itextHostVtbl
},
1
};
ITextServices
*
textsrv
;
ULONG
refcount
;
HRESULT
hr
;
/* COM aggregation */
hr
=
pCreateTextServices
(
&
unk_obj
.
IUnknown_iface
,
&
texthost
.
ITextHost_iface
,
&
unk_obj
.
inner_unk
);
ok
(
hr
==
S_OK
,
"CreateTextServices failed: %08x
\n
"
,
hr
);
hr
=
IUnknown_QueryInterface
(
unk_obj
.
inner_unk
,
pIID_ITextServices
,
(
void
**
)
&
textsrv
);
ok
(
hr
==
S_OK
,
"QueryInterface for IID_ITextServices failed: %08x
\n
"
,
hr
);
refcount
=
ITextServices_AddRef
(
textsrv
);
ok
(
refcount
==
unk_obj
.
ref
,
"CreateTextServices just pretends to support COM aggregation
\n
"
);
refcount
=
ITextServices_Release
(
textsrv
);
ok
(
refcount
==
unk_obj
.
ref
,
"CreateTextServices just pretends to support COM aggregation
\n
"
);
refcount
=
ITextServices_Release
(
textsrv
);
ok
(
refcount
==
19
,
"Refcount should be back at 19 but is %u
\n
"
,
refcount
);
IUnknown_Release
(
unk_obj
.
inner_unk
);
}
START_TEST
(
txtsrv
)
{
...
...
@@ -827,6 +891,7 @@ START_TEST( txtsrv )
pCreateTextServices
=
(
void
*
)
GetProcAddress
(
hmoduleRichEdit
,
"CreateTextServices"
);
test_IIDs
();
test_COM
();
if
(
init_texthost
())
{
...
...
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