jscript: Added VT_I2 tests.

This commit is contained in:
Jacek Caban 2012-05-01 15:05:21 +02:00 committed by Alexandre Julliard
parent c9c8c6165e
commit 13db9a1662
2 changed files with 60 additions and 0 deletions

View File

@ -262,6 +262,8 @@ HRESULT to_primitive(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, VARIANT *ret
WARN("failed\n");
return throw_type_error(ctx, ei, JS_E_TO_PRIMITIVE, NULL);
}
case VT_I2:
assert(0);
default:
FIXME("Unimplemented for vt %d\n", V_VT(v));
return E_NOTIMPL;
@ -444,6 +446,8 @@ HRESULT to_number(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, double *ret)
case VT_BOOL:
*ret = V_BOOL(v) ? 1 : 0;
break;
case VT_I2:
assert(0);
default:
FIXME("unimplemented for vt %d\n", V_VT(v));
return E_NOTIMPL;

View File

@ -66,6 +66,7 @@ DEFINE_EXPECT(global_success_i);
DEFINE_EXPECT(global_notexists_d);
DEFINE_EXPECT(global_propargput_d);
DEFINE_EXPECT(global_propargput_i);
DEFINE_EXPECT(global_testargtypes_i);
DEFINE_EXPECT(puredisp_prop_d);
DEFINE_EXPECT(puredisp_noprop_d);
DEFINE_EXPECT(testobj_delete);
@ -99,6 +100,9 @@ DEFINE_EXPECT(DeleteMemberByDispID);
#define DISPID_GLOBAL_TESTPROPDELETE 0x1010
#define DISPID_GLOBAL_ISNULLBSTR 0x1011
#define DISPID_GLOBAL_PROPARGPUT 0x1012
#define DISPID_GLOBAL_SHORTPROP 0x1013
#define DISPID_GLOBAL_GETSHORT 0x1014
#define DISPID_GLOBAL_TESTARGTYPES 0x1015
#define DISPID_TESTOBJ_PROP 0x2000
#define DISPID_TESTOBJ_ONLYDISPID 0x2001
@ -519,6 +523,21 @@ static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD
return S_OK;
}
if(!strcmp_wa(bstrName, "shortProp")) {
*pid = DISPID_GLOBAL_SHORTPROP;
return S_OK;
}
if(!strcmp_wa(bstrName, "getShort")) {
*pid = DISPID_GLOBAL_GETSHORT;
return S_OK;
}
if(!strcmp_wa(bstrName, "testArgTypes")) {
*pid = DISPID_GLOBAL_TESTARGTYPES;
return S_OK;
}
if(strict_dispid_check && strcmp_wa(bstrName, "t"))
ok(0, "unexpected call %s\n", wine_dbgstr_w(bstrName));
return DISP_E_UNKNOWNNAME;
@ -903,6 +922,39 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
IDispatchEx_Release(dispex);
return S_OK;
}
case DISPID_GLOBAL_SHORTPROP:
case DISPID_GLOBAL_GETSHORT:
V_VT(pvarRes) = VT_I2;
V_I2(pvarRes) = 10;
return S_OK;
case DISPID_GLOBAL_TESTARGTYPES: {
VARIANT args[1];
DISPPARAMS dp = {args, NULL, 1, 0};
HRESULT hres;
CHECK_EXPECT(global_testargtypes_i);
ok(wFlags == DISPATCH_METHOD, "wFlags = %x\n", wFlags);
ok(pdp != NULL, "pdp == NULL\n");
ok(pdp->rgvarg != NULL, "rgvarg != NULL\n");
ok(pdp->cArgs == 3, "cArgs = %d\n", pdp->cArgs);
ok(!pvarRes, "pvarRes != NULL\n");
ok(V_VT(pdp->rgvarg+1) == VT_I4, "V_VT(psp->rgvargs+1) = %d\n", V_VT(pdp->rgvarg));
ok(V_I4(pdp->rgvarg+1) == 10, "V_I4(psp->rgvargs+1) = %d\n", V_I4(pdp->rgvarg));
ok(V_VT(pdp->rgvarg+2) == VT_I4, "V_VT(psp->rgvargs+2) = %d\n", V_VT(pdp->rgvarg+1));
ok(V_I4(pdp->rgvarg+2) == 10, "V_I4(psp->rgvargs+2) = %d\n", V_I4(pdp->rgvarg+1));
ok(V_VT(pdp->rgvarg) == VT_DISPATCH, "V_VT(psp->rgvargs) = %d\n", V_VT(pdp->rgvarg));
V_VT(args) = VT_I2;
V_I2(args) = 2;
hres = IDispatch_Invoke(V_DISPATCH(pdp->rgvarg), DISPID_VALUE, &IID_NULL, 0, DISPATCH_METHOD, &dp, NULL, NULL, NULL);
ok(hres == S_OK, "Invoke failed: %08x\n", hres);
return S_OK;
}
}
ok(0, "unexpected call %x\n", id);
@ -1659,6 +1711,10 @@ static BOOL run_tests(void)
CHECK_CALLED(global_propargput_d);
CHECK_CALLED(global_propargput_i);
SET_EXPECT(global_testargtypes_i);
parse_script_a("testArgTypes(getShort(), shortProp, function(s) {ok(getVT(s) === 'VT_I4', 'not VT_I4');});");
CHECK_CALLED(global_testargtypes_i);
run_from_res("lang.js");
run_from_res("api.js");
run_from_res("regexp.js");