jscript: Added support for VT_UI2 VARIANT types.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2017-11-01 16:43:37 +01:00 committed by Alexandre Julliard
parent 25c78b61de
commit 4fc0f2aa38
2 changed files with 8 additions and 2 deletions

View File

@ -297,6 +297,9 @@ HRESULT variant_to_jsval(VARIANT *var, jsval_t *r)
case VT_I2:
*r = jsval_number(V_I2(var));
return S_OK;
case VT_UI2:
*r = jsval_number(V_UI2(var));
return S_OK;
case VT_INT:
*r = jsval_number(V_INT(var));
return S_OK;

View File

@ -1315,7 +1315,7 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
return S_OK;
case DISPID_GLOBAL_TESTARGTYPES: {
VARIANT args[7], v;
VARIANT args[8], v;
DISPPARAMS dp = {args, NULL, sizeof(args)/sizeof(*args), 0};
HRESULT hres;
@ -1357,6 +1357,8 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
V_VARIANTREF(args+5) = &v;
V_VT(args+6) = VT_R4;
V_R4(args+6) = 0.5;
V_VT(args+7) = VT_UI2;
V_R4(args+7) = 3;
V_VT(&v) = VT_I4;
V_I4(&v) = 2;
hres = IDispatch_Invoke(V_DISPATCH(pdp->rgvarg), DISPID_VALUE, &IID_NULL, 0, DISPATCH_METHOD, &dp, NULL, NULL, NULL);
@ -2647,7 +2649,7 @@ static BOOL run_tests(void)
SET_EXPECT(global_testargtypes_i);
parse_script_a("testArgTypes(dispUnk, intProp(), intProp, getShort(), shortProp,"
"function(r4,i4ref,ui4,nullunk,d,i,s) {"
"function(ui2,r4,i4ref,ui4,nullunk,d,i,s) {"
" ok(getVT(i) === 'VT_I4', 'getVT(i) = ' + getVT(i));"
" ok(getVT(s) === 'VT_I4', 'getVT(s) = ' + getVT(s));"
" ok(getVT(d) === 'VT_DISPATCH', 'getVT(d) = ' + getVT(d));"
@ -2659,6 +2661,7 @@ static BOOL run_tests(void)
" ok(i4ref === 2, 'i4ref = ' + i4ref);"
" ok(r4 === 0.5, 'r4 = ' + r4);"
" ok(getVT(r4) === 'VT_R8', 'getVT(r4) = ' + getVT(r4));"
" ok(getVT(ui2) === 'VT_I4', 'getVT(ui2) = ' + getVT(ui2));"
"});");
CHECK_CALLED(global_testargtypes_i);