Commit f8de2787 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

msscript.ocx: Implement ScriptProcedure::get_NumArgs.

parent 28228b39
......@@ -97,6 +97,7 @@ typedef struct {
struct list entry;
BSTR name;
USHORT num_args;
} ScriptProcedure;
struct ScriptProcedureCollection {
......@@ -888,9 +889,12 @@ static HRESULT WINAPI ScriptProcedure_get_NumArgs(IScriptProcedure *iface, LONG
{
ScriptProcedure *This = impl_from_IScriptProcedure(iface);
FIXME("(%p)->(%p)\n", This, pcArgs);
TRACE("(%p)->(%p)\n", This, pcArgs);
return E_NOTIMPL;
if (!pcArgs) return E_POINTER;
*pcArgs = This->num_args;
return S_OK;
}
static HRESULT WINAPI ScriptProcedure_get_HasReturnValue(IScriptProcedure *iface, VARIANT_BOOL *pfHasReturnValue)
......@@ -957,6 +961,7 @@ static HRESULT get_script_procedure(ScriptProcedureCollection *procedures, IType
proc->ref = 1;
proc->hash = hash;
proc->name = str;
proc->num_args = desc->cParams + desc->cParamsOpt;
list_add_tail(proc_list, &proc->entry);
*procedure = &proc->IScriptProcedure_iface;
......
......@@ -3358,6 +3358,11 @@ static void test_IScriptControl_get_Procedures(void)
ok(hr == S_OK, "IScriptProcedure_get_Name failed: 0x%08x.\n", hr);
ok(!lstrcmpW(str, L"add"), "Wrong name, got %s.\n", wine_dbgstr_w(str));
SysFreeString(str);
hr = IScriptProcedure_get_NumArgs(proc, NULL);
ok(hr == E_POINTER, "IScriptProcedure_get_NumArgs returned: 0x%08x.\n", hr);
hr = IScriptProcedure_get_NumArgs(proc, &count);
ok(hr == S_OK, "IScriptProcedure_get_NumArgs failed: 0x%08x.\n", hr);
ok(count == 2, "Wrong NumArgs, got %d.\n", count);
IScriptProcedure_Release(proc);
V_VT(&var) = VT_BSTR;
......@@ -3370,6 +3375,9 @@ static void test_IScriptControl_get_Procedures(void)
ok(hr == S_OK, "IScriptProcedure_get_Name failed: 0x%08x.\n", hr);
ok(!lstrcmpW(str, L"nop"), "Wrong name, got %s.\n", wine_dbgstr_w(str));
SysFreeString(str);
hr = IScriptProcedure_get_NumArgs(proc, &count);
ok(hr == S_OK, "IScriptProcedure_get_NumArgs failed: 0x%08x.\n", hr);
ok(count == 1, "Wrong NumArgs, got %d.\n", count);
IScriptProcedure_Release(proc);
V_VT(&var) = VT_R8;
......@@ -3380,6 +3388,9 @@ static void test_IScriptControl_get_Procedures(void)
ok(hr == S_OK, "IScriptProcedure_get_Name failed: 0x%08x.\n", hr);
ok(!lstrcmpW(str, L"muladd"), "Wrong name, got %s.\n", wine_dbgstr_w(str));
SysFreeString(str);
hr = IScriptProcedure_get_NumArgs(proc, &count);
ok(hr == S_OK, "IScriptProcedure_get_NumArgs failed: 0x%08x.\n", hr);
ok(count == 3, "Wrong NumArgs, got %d.\n", count);
IScriptProcedure_Release(proc);
IScriptProcedureCollection_Release(procs);
......@@ -3569,6 +3580,10 @@ static void test_IScriptControl_get_Procedures(void)
ok(!lstrcmpW(str, custom_engine_funcs[i].name), "Name is not %s, got %s.\n",
wine_dbgstr_w(custom_engine_funcs[i].name), wine_dbgstr_w(str));
SysFreeString(str);
hr = IScriptProcedure_get_NumArgs(proc, &count);
ok(hr == S_OK, "get_NumArgs for %s failed: 0x%08x.\n", wine_dbgstr_w(custom_engine_funcs[i].name), hr);
ok(count == custom_engine_funcs[i].num_args + custom_engine_funcs[i].num_opt_args,
"NumArgs is not %d, got %d.\n", custom_engine_funcs[i].num_args + custom_engine_funcs[i].num_opt_args, count);
IScriptProcedure_Release(proc);
}
......
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