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
c299f09e
Commit
c299f09e
authored
Mar 31, 2019
by
Zebediah Figura
Committed by
Alexandre Julliard
Apr 01, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32/tests: Test marshalling of complex structs.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ad2cba9d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
1 deletion
+65
-1
tmarshal.c
dlls/oleaut32/tests/tmarshal.c
+45
-0
tmarshal.idl
dlls/oleaut32/tests/tmarshal.idl
+20
-1
No files found.
dlls/oleaut32/tests/tmarshal.c
View file @
c299f09e
...
@@ -1441,6 +1441,28 @@ static HRESULT WINAPI Widget_rect(IWidget *iface, RECT in, RECT *out, RECT *in_p
...
@@ -1441,6 +1441,28 @@ static HRESULT WINAPI Widget_rect(IWidget *iface, RECT in, RECT *out, RECT *in_p
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
WINAPI
Widget_complex_struct
(
IWidget
*
iface
,
struct
complex
in
)
{
HRESULT
hr
;
ok
(
in
.
c
==
98
,
"Got char %d.
\n
"
,
in
.
c
);
ok
(
in
.
i
==
76543
,
"Got int %d.
\n
"
,
in
.
i
);
ok
(
*
in
.
pi
==
2
,
"Got int pointer %d.
\n
"
,
*
in
.
pi
);
ok
(
**
in
.
ppi
==
10
,
"Got int double pointer %d.
\n
"
,
**
in
.
ppi
);
hr
=
ISomethingFromDispatch_anotherfn
(
in
.
iface
);
ok
(
hr
==
0x01234567
,
"Got wrong hr %#x.
\n
"
,
hr
);
hr
=
ISomethingFromDispatch_anotherfn
(
*
in
.
iface_ptr
);
ok
(
hr
==
0x01234567
,
"Got wrong hr %#x.
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
in
.
bstr
,
test_bstr2
),
"Got string %s.
\n
"
,
wine_dbgstr_w
(
in
.
bstr
));
ok
(
V_VT
(
&
in
.
var
)
==
VT_I4
,
"Got wrong type %u.
\n
"
,
V_VT
(
&
in
.
var
));
ok
(
V_I4
(
&
in
.
var
)
==
123
,
"Got wrong value %d.
\n
"
,
V_I4
(
&
in
.
var
));
ok
(
!
memcmp
(
&
in
.
mystruct
,
&
test_mystruct1
,
sizeof
(
MYSTRUCT
)),
"Structs didn't match.
\n
"
);
ok
(
!
memcmp
(
in
.
arr
,
test_array1
,
sizeof
(
array_t
)),
"Arrays didn't match.
\n
"
);
ok
(
in
.
myint
==
456
,
"Got int %d.
\n
"
,
in
.
myint
);
return
S_OK
;
}
static
HRESULT
WINAPI
Widget_array
(
IWidget
*
iface
,
array_t
in
,
array_t
out
,
array_t
in_out
)
static
HRESULT
WINAPI
Widget_array
(
IWidget
*
iface
,
array_t
in
,
array_t
out
,
array_t
in_out
)
{
{
static
const
array_t
empty
=
{
0
};
static
const
array_t
empty
=
{
0
};
...
@@ -1600,6 +1622,7 @@ static const struct IWidgetVtbl Widget_VTable =
...
@@ -1600,6 +1622,7 @@ static const struct IWidgetVtbl Widget_VTable =
Widget_mystruct_ptr_ptr
,
Widget_mystruct_ptr_ptr
,
Widget_thin_struct
,
Widget_thin_struct
,
Widget_rect
,
Widget_rect
,
Widget_complex_struct
,
Widget_array
,
Widget_array
,
Widget_variant_array
,
Widget_variant_array
,
Widget_mystruct_array
,
Widget_mystruct_array
,
...
@@ -2500,6 +2523,9 @@ static void test_marshal_struct(IWidget *widget, IDispatch *disp)
...
@@ -2500,6 +2523,9 @@ static void test_marshal_struct(IWidget *widget, IDispatch *disp)
{
{
MYSTRUCT
out
,
in_ptr
,
in_out
,
*
in_ptr_ptr
;
MYSTRUCT
out
,
in_ptr
,
in_out
,
*
in_ptr_ptr
;
RECT
rect_out
,
rect_in_ptr
,
rect_in_out
;
RECT
rect_out
,
rect_in_ptr
,
rect_in_out
;
ISomethingFromDispatch
*
sfd
;
struct
complex
complex
;
int
i
,
i2
,
*
pi
=
&
i2
;
HRESULT
hr
;
HRESULT
hr
;
memcpy
(
&
out
,
&
test_mystruct2
,
sizeof
(
MYSTRUCT
));
memcpy
(
&
out
,
&
test_mystruct2
,
sizeof
(
MYSTRUCT
));
...
@@ -2531,6 +2557,25 @@ static void test_marshal_struct(IWidget *widget, IDispatch *disp)
...
@@ -2531,6 +2557,25 @@ static void test_marshal_struct(IWidget *widget, IDispatch *disp)
ok
(
EqualRect
(
&
rect_out
,
&
test_rect5
),
"Rects didn't match.
\n
"
);
ok
(
EqualRect
(
&
rect_out
,
&
test_rect5
),
"Rects didn't match.
\n
"
);
ok
(
EqualRect
(
&
rect_in_ptr
,
&
test_rect3
),
"Rects didn't match.
\n
"
);
ok
(
EqualRect
(
&
rect_in_ptr
,
&
test_rect3
),
"Rects didn't match.
\n
"
);
ok
(
EqualRect
(
&
rect_in_out
,
&
test_rect7
),
"Rects didn't match.
\n
"
);
ok
(
EqualRect
(
&
rect_in_out
,
&
test_rect7
),
"Rects didn't match.
\n
"
);
/* Test complex structs. */
complex
.
c
=
98
;
complex
.
i
=
76543
;
i
=
2
;
complex
.
pi
=
&
i
;
i2
=
10
;
complex
.
ppi
=
&
pi
;
complex
.
iface
=
create_disp_obj
();
sfd
=
create_disp_obj
();
complex
.
iface_ptr
=
&
sfd
;
complex
.
bstr
=
SysAllocString
(
test_bstr2
);
V_VT
(
&
complex
.
var
)
=
VT_I4
;
V_I4
(
&
complex
.
var
)
=
123
;
memcpy
(
&
complex
.
mystruct
,
&
test_mystruct1
,
sizeof
(
MYSTRUCT
));
memcpy
(
complex
.
arr
,
test_array1
,
sizeof
(
array_t
));
complex
.
myint
=
456
;
hr
=
IWidget_complex_struct
(
widget
,
complex
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
}
}
static
void
test_marshal_array
(
IWidget
*
widget
,
IDispatch
*
disp
)
static
void
test_marshal_array
(
IWidget
*
widget
,
IDispatch
*
disp
)
...
...
dlls/oleaut32/tests/tmarshal.idl
View file @
c299f09e
...
@@ -65,6 +65,7 @@ enum IWidget_dispids
...
@@ -65,6 +65,7 @@ enum IWidget_dispids
DISPID_TM_STRUCT_PTR_PTR
,
DISPID_TM_STRUCT_PTR_PTR
,
DISPID_TM_THIN_STRUCT
,
DISPID_TM_THIN_STRUCT
,
DISPID_TM_RECT
,
DISPID_TM_RECT
,
DISPID_TM_COMPLEX_STRUCT
,
DISPID_TM_ARRAY
,
DISPID_TM_ARRAY
,
DISPID_TM_VARIANT_ARRAY
,
DISPID_TM_VARIANT_ARRAY
,
DISPID_TM_STRUCT_ARRAY
,
DISPID_TM_STRUCT_ARRAY
,
...
@@ -105,6 +106,8 @@ library TestTypelib
...
@@ -105,6 +106,8 @@ library TestTypelib
typedef
[
public
]
int
myint_t
;
typedef
[
public
]
int
myint_t
;
typedef
int
array_t
[
4
]
;
coclass
ApplicationObject2
;
coclass
ApplicationObject2
;
[
[
...
@@ -335,7 +338,23 @@ library TestTypelib
...
@@ -335,7 +338,23 @@ library TestTypelib
[
id
(
DISPID_TM_RECT
)
]
[
id
(
DISPID_TM_RECT
)
]
HRESULT
rect
(
[
in
]
RECT
in
,
[
out
]
RECT
*
out
,
[
in
]
RECT
*
in_ptr
,
[
in
,
out
]
RECT
*
in_out
)
;
HRESULT
rect
(
[
in
]
RECT
in
,
[
out
]
RECT
*
out
,
[
in
]
RECT
*
in_ptr
,
[
in
,
out
]
RECT
*
in_out
)
;
typedef
int
array_t
[
4
]
;
struct
complex
{
char
c
;
int
i
;
int
*
pi
;
int
**
ppi
;
ISomethingFromDispatch
*
iface
;
ISomethingFromDispatch
**
iface_ptr
;
BSTR
bstr
;
VARIANT
var
;
MYSTRUCT
mystruct
;
array_t
arr
;
myint_t
myint
;
}
;
[
id
(
DISPID_TM_COMPLEX_STRUCT
)
]
HRESULT
complex_struct
(
[
in
]
struct
complex
in
)
;
[
id
(
DISPID_TM_ARRAY
)
]
[
id
(
DISPID_TM_ARRAY
)
]
HRESULT
array
(
[
in
]
array_t
in
,
[
out
]
array_t
out
,
[
in
,
out
]
array_t
in_out
)
;
HRESULT
array
(
[
in
]
array_t
in
,
[
out
]
array_t
out
,
[
in
,
out
]
array_t
in_out
)
;
...
...
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