oleaut32/tests: Add some tests for marshalling public typedefs.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2018-11-02 00:15:19 -05:00 committed by Alexandre Julliard
parent b6bee08366
commit 55b1c4301f
2 changed files with 24 additions and 1 deletions

View File

@ -1314,6 +1314,14 @@ static HRESULT WINAPI Widget_mystruct_array(IWidget *iface, MYSTRUCT in[2])
return S_OK; return S_OK;
} }
static HRESULT WINAPI Widget_myint(IWidget *iface, myint_t val, myint_t *ptr, myint_t **ptr_ptr)
{
ok(val == 123, "Got value %d.\n", val);
ok(*ptr == 456, "Got single ptr ref %d.\n", *ptr);
ok(**ptr_ptr == 789, "Got double ptr ref %d.\n", **ptr_ptr);
return S_OK;
}
static const struct IWidgetVtbl Widget_VTable = static const struct IWidgetVtbl Widget_VTable =
{ {
Widget_QueryInterface, Widget_QueryInterface,
@ -1368,6 +1376,7 @@ static const struct IWidgetVtbl Widget_VTable =
Widget_array, Widget_array,
Widget_variant_array, Widget_variant_array,
Widget_mystruct_array, Widget_mystruct_array,
Widget_myint,
}; };
static HRESULT WINAPI StaticWidget_QueryInterface(IStaticWidget *iface, REFIID riid, void **ppvObject) static HRESULT WINAPI StaticWidget_QueryInterface(IStaticWidget *iface, REFIID riid, void **ppvObject)
@ -1689,7 +1698,7 @@ static void test_marshal_basetypes(IWidget *widget, IDispatch *disp)
signed char c; signed char c;
short s; short s;
int i; int i, i2, *pi;
hyper h; hyper h;
unsigned char uc; unsigned char uc;
unsigned short us; unsigned short us;
@ -1763,6 +1772,14 @@ static void test_marshal_basetypes(IWidget *widget, IDispatch *disp)
ok(f == (float)M_LN2, "Got float %f.\n", f); ok(f == (float)M_LN2, "Got float %f.\n", f);
ok(d == M_LN10, "Got double %f.\n", d); ok(d == M_LN10, "Got double %f.\n", d);
ok(st == STATE_UNWIDGETIFIED, "Got state %u.\n", st); ok(st == STATE_UNWIDGETIFIED, "Got state %u.\n", st);
/* Test marshalling of public typedefs. */
i = 456;
i2 = 789;
pi = &i2;
hr = IWidget_myint(widget, 123, &i, &pi);
ok(hr == S_OK, "Got hr %#x.\n", hr);
} }
static void test_marshal_pointer(IWidget *widget, IDispatch *disp) static void test_marshal_pointer(IWidget *widget, IDispatch *disp)

View File

@ -68,6 +68,7 @@ enum IWidget_dispids
DISPID_TM_ARRAY, DISPID_TM_ARRAY,
DISPID_TM_VARIANT_ARRAY, DISPID_TM_VARIANT_ARRAY,
DISPID_TM_STRUCT_ARRAY, DISPID_TM_STRUCT_ARRAY,
DISPID_TM_TYPEDEF,
}; };
static const int DISPID_TM_NEG_RESTRICTED = -26; static const int DISPID_TM_NEG_RESTRICTED = -26;
@ -100,6 +101,8 @@ library TestTypelib
UINT uarr[8]; UINT uarr[8];
} MYSTRUCT; } MYSTRUCT;
typedef [public] int myint_t;
coclass ApplicationObject2; coclass ApplicationObject2;
[ [
@ -295,6 +298,9 @@ library TestTypelib
[id(DISPID_TM_STRUCT_ARRAY)] [id(DISPID_TM_STRUCT_ARRAY)]
HRESULT mystruct_array([in] MYSTRUCT in[2]); HRESULT mystruct_array([in] MYSTRUCT in[2]);
[id(DISPID_TM_TYPEDEF)]
HRESULT myint([in] myint_t val, [in] myint_t *ptr, [in] myint_t **ptr_ptr);
} }
[ [