Commit c28244a9 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

oleaut32/tests: Add a test for calling a varargs method using typelib marshaller.

parent 2952822e
......@@ -839,6 +839,13 @@ static HRESULT WINAPI Widget_neg_restrict(IWidget* iface, INT *i)
return S_OK;
}
static HRESULT WINAPI Widget_VarArg_Run(
IWidget *iface, BSTR name, SAFEARRAY *params, VARIANT *result)
{
trace("VarArg_Run(%p,%p,%p)\n", name, params, result);
return S_OK;
}
static const struct IWidgetVtbl Widget_VTable =
{
Widget_QueryInterface,
......@@ -876,7 +883,8 @@ static const struct IWidgetVtbl Widget_VTable =
Widget_put_prop_opt_arg,
Widget_put_prop_req_arg,
Widget_pos_restrict,
Widget_neg_restrict
Widget_neg_restrict,
Widget_VarArg_Run
};
static HRESULT WINAPI StaticWidget_QueryInterface(IStaticWidget *iface, REFIID riid, void **ppvObject)
......@@ -1492,7 +1500,7 @@ static void test_typelibmarshal(void)
dispparams.rgdispidNamedArgs = NULL;
dispparams.rgvarg = vararg;
hr = IDispatch_Invoke(pDispatch, DISPID_TM_VARARG, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, &dispparams, NULL, NULL, NULL);
ok_ole_success(hr, ITypeInfo_Invoke);
ok_ole_success(hr, IDispatch_Invoke);
/* call VarArg, even one (non-optional, non-safearray) named argument is not allowed */
dispidNamed = 0;
......@@ -1502,6 +1510,23 @@ static void test_typelibmarshal(void)
ok(hr == DISP_E_NONAMEDARGS, "IDispatch_Invoke should have returned DISP_E_NONAMEDARGS instead of 0x%08x\n", hr);
dispidNamed = DISPID_PROPERTYPUT;
/* call VarArg_Run */
VariantInit(&vararg[1]);
V_VT(&vararg[1]) = VT_BSTR;
V_BSTR(&vararg[1]) = SysAllocString(szCat);
VariantInit(&vararg[0]);
V_VT(&vararg[0]) = VT_BSTR;
V_BSTR(&vararg[0]) = SysAllocString(NULL);
dispparams.cNamedArgs = 0;
dispparams.cArgs = 2;
dispparams.rgdispidNamedArgs = NULL;
dispparams.rgvarg = vararg;
hr = IDispatch_Invoke(pDispatch, DISPID_TM_VARARG_RUN, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, &dispparams, NULL, NULL, NULL);
todo_wine
ok_ole_success(hr, IDispatch_Invoke);
SysFreeString(V_BSTR(&vararg[1]));
SysFreeString(V_BSTR(&vararg[0]));
/* call Error */
dispparams.cNamedArgs = 0;
dispparams.cArgs = 0;
......
......@@ -179,6 +179,9 @@ library TestTypelib
[id(DISPID_TM_NEG_RESTRICTED), restricted]
HRESULT neg_restrict([out, retval] INT *i);
[id(DISPID_TM_VARARG_RUN), vararg]
HRESULT VarArg_Run([in] BSTR name, [in] SAFEARRAY(VARIANT) params, [out, retval] VARIANT *result);
}
[
......
......@@ -44,6 +44,7 @@
#define DISPID_TM_RESTRICTED 25
#define DISPID_TM_NEG_RESTRICTED -26
#define DISPID_TM_TESTSECONDIFACE 27
#define DISPID_TM_VARARG_RUN 28
#define DISPID_NOA_BSTRRET 1
#define DISPID_NOA_ERROR 2
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment