From eff5223ae35b738cd0f02ffc37903fede8a54f1c Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Fri, 2 Nov 2018 00:15:20 -0500 Subject: [PATCH] oleaut32/tests: Add a test for marshalling of floats on x86-64. Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/oleaut32/tests/tmarshal.c | 17 +++++++++++++++++ dlls/oleaut32/tests/tmarshal.idl | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/dlls/oleaut32/tests/tmarshal.c b/dlls/oleaut32/tests/tmarshal.c index 75970a1abd5..c92e208795e 100644 --- a/dlls/oleaut32/tests/tmarshal.c +++ b/dlls/oleaut32/tests/tmarshal.c @@ -981,6 +981,17 @@ static HRESULT WINAPI Widget_basetypes_out(IWidget *iface, signed char *c, short return S_OK; } +static HRESULT WINAPI Widget_float_abi(IWidget *iface, float f, double d, int i, float f2, double d2) +{ + ok(f == 1.0f, "Got float %f.\n", f); + ok(d == 2.0, "Got double %f.\n", d); + ok(i == 3, "Got int %d.\n", i); + ok(f2 == 4.0f, "Got float %f.\n", f2); + ok(d2 == 5.0, "Got double %f.\n", d2); + + return S_OK; +} + static HRESULT WINAPI Widget_int_ptr(IWidget *iface, int *in, int *out, int *in_out) { ok(*in == 123, "Got [in] %d.\n", *in); @@ -1361,6 +1372,7 @@ static const struct IWidgetVtbl Widget_VTable = Widget_Coclass, Widget_basetypes_in, Widget_basetypes_out, + Widget_float_abi, Widget_int_ptr, Widget_int_ptr_ptr, Widget_iface_in, @@ -1780,6 +1792,11 @@ static void test_marshal_basetypes(IWidget *widget, IDispatch *disp) pi = &i2; hr = IWidget_myint(widget, 123, &i, &pi); ok(hr == S_OK, "Got hr %#x.\n", hr); + + /* Test that different float ABIs are correctly handled. */ + + hr = IWidget_float_abi(widget, 1.0f, 2.0, 3, 4.0f, 5.0); + ok(hr == S_OK, "Got hr %#x.\n", hr); } static void test_marshal_pointer(IWidget *widget, IDispatch *disp) diff --git a/dlls/oleaut32/tests/tmarshal.idl b/dlls/oleaut32/tests/tmarshal.idl index 6bf969cf090..543d229ce29 100644 --- a/dlls/oleaut32/tests/tmarshal.idl +++ b/dlls/oleaut32/tests/tmarshal.idl @@ -53,6 +53,7 @@ enum IWidget_dispids DISPID_TM_BASETYPES_IN, DISPID_TM_BASETYPES_OUT, + DISPID_TM_FLOAT_ABI, DISPID_TM_INT_PTR, DISPID_TM_INT_PTR_PTR, DISPID_TM_IFACE_IN, @@ -246,6 +247,9 @@ library TestTypelib [out] unsigned char *uc, [out] unsigned short *us, [out] unsigned int *ui, [out] unsigned hyper *uh, [out] float *f, [out] double *d, [out] STATE *st); + [id(DISPID_TM_FLOAT_ABI)] + HRESULT float_abi([in] float f, [in] double d, [in] int i, [in] float f2, [in] double d2); + [id(DISPID_TM_INT_PTR)] HRESULT int_ptr([in] int *in, [out] int *out, [in, out] int *in_out);