jscript: Add VT_CY type support.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
fadd22ed5a
commit
d22bafa763
|
@ -315,6 +315,12 @@ HRESULT variant_to_jsval(VARIANT *var, jsval_t *r)
|
|||
case VT_R4:
|
||||
*r = jsval_number(V_R4(var));
|
||||
return S_OK;
|
||||
case VT_CY:
|
||||
/* FIXME: Native converts VT_CY to a special kind number type, which is
|
||||
* never converted to VT_I4 when it's converted back to VARIANT. */
|
||||
*r = jsval_number((double)V_CY(var).int64 / 10000.0);
|
||||
WARN("VT_CY: %lf\n", get_number(*r));
|
||||
return S_OK;
|
||||
case VT_UNKNOWN:
|
||||
if(V_UNKNOWN(var)) {
|
||||
IDispatch *disp;
|
||||
|
|
|
@ -215,6 +215,34 @@ ok(tmp === 3, "tmp = " + tmp);
|
|||
ok(d != d, "date d == d");
|
||||
})();
|
||||
|
||||
(function() {
|
||||
/* VT_CY handling */
|
||||
var d;
|
||||
todo_wine_ok(getVT(v_cy(0)) === "VT_R8", "vt v_cy(0) = " + getVT(v_cy(0)));
|
||||
todo_wine_ok(getVT(v_cy(10000)) === "VT_R8", "vt v_cy(10000) = " + getVT(v_cy(0)));
|
||||
d = v_cy(0);
|
||||
todo_wine_ok(getVT(d) === "VT_R8", "vt v_cy(0) = " + getVT(d));
|
||||
todo_wine_ok(getVT(+d) === "VT_R8", "vt +v_cy(0) = " + getVT(d));
|
||||
ok(d == 0, "v_cy(0) != 0\n");
|
||||
ok(d === 0, "v_cy(0) !== 0\n");
|
||||
ok("" + d === "0", "str(v_cy(0)) = " + d);
|
||||
ok(d === d, "date d !== d");
|
||||
|
||||
d = v_cy(1000);
|
||||
ok(getVT(d) === "VT_R8", "vt v_cy(1000) = " + getVT(d));
|
||||
ok(getVT(+d) === "VT_R8", "vt +v_cy(1000) = " + getVT(d));
|
||||
ok(d == 0.1, "v_cy(1000) != 0, d = " + d);
|
||||
ok(d === 0.1, "v_cy(1000) !== 0.1\n");
|
||||
ok("" + d === "0.1", "str(v_cy(1000)) = " + d);
|
||||
ok(d === d, "date d !== d");
|
||||
|
||||
d = v_cy(25000);
|
||||
ok(getVT(d) === "VT_R8", "vt v_cy(25000) = " + getVT(d));
|
||||
ok(getVT(+d) === "VT_R8", "vt +v_cy(25000) = " + getVT(d));
|
||||
ok(d === 2.5, "v_cy(25000) !== 2.5\n");
|
||||
ok("" + d === "2.5", "str(v_cy(25000)) = " + d);
|
||||
})();
|
||||
|
||||
function testRecFunc(x) {
|
||||
ok(testRecFunc.arguments === arguments, "testRecFunc.arguments = " + testRecFunc.arguments);
|
||||
if(x) {
|
||||
|
|
|
@ -167,6 +167,8 @@ DEFINE_EXPECT(BindHandler);
|
|||
#define DISPID_GLOBAL_THROWINT 0x1021
|
||||
#define DISPID_GLOBAL_THROWEI 0x1022
|
||||
#define DISPID_GLOBAL_VDATE 0x1023
|
||||
#define DISPID_GLOBAL_VCY 0x1024
|
||||
#define DISPID_GLOBAL_TODOWINE 0x1025
|
||||
|
||||
#define DISPID_GLOBAL_TESTPROPDELETE 0x2000
|
||||
#define DISPID_GLOBAL_TESTNOPROPDELETE 0x2001
|
||||
|
@ -809,6 +811,11 @@ static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD
|
|||
*pid = DISPID_GLOBAL_TRACE;
|
||||
return S_OK;
|
||||
}
|
||||
if(!lstrcmpW(bstrName, L"todo_wine_ok")) {
|
||||
test_grfdex(grfdex, fdexNameCaseSensitive);
|
||||
*pid = DISPID_GLOBAL_TODOWINE;
|
||||
return S_OK;
|
||||
}
|
||||
if(!lstrcmpW(bstrName, L"reportSuccess")) {
|
||||
CHECK_EXPECT(global_success_d);
|
||||
test_grfdex(grfdex, fdexNameCaseSensitive);
|
||||
|
@ -972,6 +979,11 @@ static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
if(!lstrcmpW(bstrName, L"v_cy")) {
|
||||
*pid = DISPID_GLOBAL_VCY;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if(!lstrcmpW(bstrName, L"testArgTypes")) {
|
||||
*pid = DISPID_GLOBAL_TESTARGTYPES;
|
||||
return S_OK;
|
||||
|
@ -1052,6 +1064,25 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
|
|||
|
||||
return S_OK;
|
||||
|
||||
case DISPID_GLOBAL_TODOWINE:
|
||||
ok(wFlags == INVOKE_FUNC || wFlags == (INVOKE_FUNC|INVOKE_PROPERTYGET), "wFlags = %x\n", wFlags);
|
||||
ok(pdp != NULL, "pdp == NULL\n");
|
||||
ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
|
||||
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
|
||||
ok(pdp->cArgs == 2, "cArgs = %d\n", pdp->cArgs);
|
||||
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
||||
if(wFlags & INVOKE_PROPERTYGET)
|
||||
ok(pvarRes != NULL, "pvarRes == NULL\n");
|
||||
else
|
||||
ok(!pvarRes, "pvarRes != NULL\n");
|
||||
ok(pei != NULL, "pei == NULL\n");
|
||||
|
||||
ok(V_VT(pdp->rgvarg) == VT_BSTR, "V_VT(pdp->rgvarg) = %d\n", V_VT(pdp->rgvarg));
|
||||
ok(V_VT(pdp->rgvarg+1) == VT_BOOL, "V_VT(pdp->rgvarg+1) = %d\n", V_VT(pdp->rgvarg+1));
|
||||
todo_wine ok(V_BOOL(pdp->rgvarg+1), "%s: %s\n", test_name, wine_dbgstr_w(V_BSTR(pdp->rgvarg)));
|
||||
|
||||
return S_OK;
|
||||
|
||||
case DISPID_GLOBAL_TRACE:
|
||||
ok(wFlags == INVOKE_FUNC, "wFlags = %x\n", wFlags);
|
||||
ok(pdp != NULL, "pdp == NULL\n");
|
||||
|
@ -1536,6 +1567,26 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
|
|||
}
|
||||
return S_OK;
|
||||
|
||||
case DISPID_GLOBAL_VCY:
|
||||
ok(wFlags == (DISPATCH_METHOD|DISPATCH_PROPERTYGET), "wFlags = %x\n", wFlags);
|
||||
ok(pdp != NULL, "pdp == NULL\n");
|
||||
ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs);
|
||||
ok(pvarRes != NULL, "pvarRes != NULL\n");
|
||||
V_VT(pvarRes) = VT_CY;
|
||||
switch(V_VT(pdp->rgvarg))
|
||||
{
|
||||
case VT_I4:
|
||||
V_CY(pvarRes).int64 = V_I4(pdp->rgvarg);
|
||||
break;
|
||||
case VT_R8:
|
||||
V_CY(pvarRes).int64 = V_R8(pdp->rgvarg);
|
||||
break;
|
||||
default:
|
||||
ok(0, "vt = %u\n", V_VT(pdp->rgvarg));
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
return S_OK;
|
||||
|
||||
case DISPID_GLOBAL_INTPROP:
|
||||
V_VT(pvarRes) = VT_INT;
|
||||
V_INT(pvarRes) = 22;
|
||||
|
|
Loading…
Reference in New Issue