jscript: Support type conversion to VT_UI2.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2019-04-11 16:44:06 +02:00 committed by Alexandre Julliard
parent 02da0edd9d
commit f192f2f1a1
2 changed files with 11 additions and 0 deletions

View File

@ -894,6 +894,14 @@ HRESULT variant_change_type(script_ctx_t *ctx, VARIANT *dst, VARIANT *src, VARTY
}
break;
}
case VT_UI2: {
UINT32 i;
hres = to_uint32(ctx, val, &i);
if(SUCCEEDED(hres))
V_UI2(dst) = i;
break;
}
case VT_R8: {
double n;
hres = to_number(ctx, val, &n);

View File

@ -136,6 +136,9 @@ static void test_change_type(IVariantChangeType *change_type, VARIANT *src, cons
call_change_type(change_type, &v, src, VT_I4);
ok(V_I4(&v) == ex->int_result, "V_I4(v) = %d, expected %d\n", V_I4(&v), ex->int_result);
call_change_type(change_type, &v, src, VT_UI2);
ok(V_UI2(&v) == (UINT16)ex->int_result, "V_UI2(v) = %u, expected %u\n", V_UI2(&v), (UINT16)ex->int_result);
call_change_type(change_type, &v, src, VT_BSTR);
ok(!strcmp_wa(V_BSTR(&v), ex->str_result), "V_BSTR(v) = %s, expected %s\n", wine_dbgstr_w(V_BSTR(&v)), ex->str_result);
VariantClear(&v);