Author: akhaldi
Date: Sun Jul 19 22:36:43 2015
New Revision: 68447
URL:
http://svn.reactos.org/svn/reactos?rev=68447&view=rev
Log:
[JSCRIPT_WINETEST] Sync with Wine Staging 1.7.47. CORE-9924
Modified:
trunk/rostests/winetests/jscript/api.js
trunk/rostests/winetests/jscript/run.c
Modified: trunk/rostests/winetests/jscript/api.js
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/jscript/api.js?…
==============================================================================
--- trunk/rostests/winetests/jscript/api.js [iso-8859-1] (original)
+++ trunk/rostests/winetests/jscript/api.js [iso-8859-1] Sun Jul 19 22:36:43 2015
@@ -2013,6 +2013,8 @@
"Date.parse(\"February 31 UTC, 2000 12:31:17 PM\") = " +
Date.parse("February 31 UTC, 2000 12:31:17 PM"));
ok(Date.parse("71 11:32AM Dec 12 UTC BC ") === -64346358480000,
"Date.parse(\"71 11:32AM Dec 12 UTC BC \") = " + Date.parse("71
11:32AM Dec 12 UTC BC "));
ok(Date.parse("23/71/2000 11::32::UTC") === 1010662320000,
"Date.parse(\"23/71/2000 11::32::UTC\") = " +
Date.parse("23/71/2000 11::32::UTC"));
+ok(Date.parse("1970/01/01") === Date.parse("01/01/1970"),
"Date.parse(\"1970/01/01\") = " +
Date.parse("1970/01/01"));
+ok(Date.parse("71/12/14") === Date.parse("12/14/1971"),
"Date.parse(\"71/12/14\") = " + Date.parse("71/12/14"));
ok(typeof(Math.PI) === "number", "typeof(Math.PI) = " +
typeof(Math.PI));
ok(Math.floor(Math.PI*100) === 314, "Math.PI = " + Math.PI);
Modified: trunk/rostests/winetests/jscript/run.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/jscript/run.c?r…
==============================================================================
--- trunk/rostests/winetests/jscript/run.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/jscript/run.c [iso-8859-1] Sun Jul 19 22:36:43 2015
@@ -117,6 +117,7 @@
DEFINE_EXPECT(invoke_func);
DEFINE_EXPECT(DeleteMemberByDispID);
DEFINE_EXPECT(DeleteMemberByDispID_false);
+DEFINE_EXPECT(BindHandler);
#define DISPID_GLOBAL_TESTPROPGET 0x1000
#define DISPID_GLOBAL_TESTPROPPUT 0x1001
@@ -147,6 +148,7 @@
#define DISPID_GLOBAL_DISPEXFUNC 0x101a
#define DISPID_GLOBAL_TESTPROPPUTREF 0x101b
#define DISPID_GLOBAL_GETSCRIPTSTATE 0x101c
+#define DISPID_GLOBAL_BINDEVENTHANDLER 0x101d
#define DISPID_GLOBAL_TESTPROPDELETE 0x2000
#define DISPID_GLOBAL_TESTNOPROPDELETE 0x2001
@@ -275,6 +277,13 @@
}
static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD
grfdex, DISPID *pid)
+{
+ ok(0, "unexpected call\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD
wFlags, DISPPARAMS *pdp,
+ VARIANT *res, EXCEPINFO *pei, IServiceProvider *pspCaller)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
@@ -590,6 +599,75 @@
static IDispatchEx pureDisp = { &pureDispVtbl };
+static HRESULT WINAPI BindEventHandler_QueryInterface(IBindEventHandler *iface, REFIID
riid, void **ppv)
+{
+ ok(0, "unexpected call\n");
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI BindEventHandler_AddRef(IBindEventHandler *iface)
+{
+ return 2;
+}
+
+static ULONG WINAPI BindEventHandler_Release(IBindEventHandler *iface)
+{
+ return 1;
+}
+
+static HRESULT WINAPI BindEventHandler_BindHandler(IBindEventHandler *iface, const WCHAR
*event, IDispatch *disp)
+{
+ CHECK_EXPECT(BindHandler);
+ ok(!strcmp_wa(event, "eventName"), "event = %s\n",
wine_dbgstr_w(event));
+ ok(disp != NULL, "disp = NULL\n");
+ return S_OK;
+}
+
+static const IBindEventHandlerVtbl BindEventHandlerVtbl = {
+ BindEventHandler_QueryInterface,
+ BindEventHandler_AddRef,
+ BindEventHandler_Release,
+ BindEventHandler_BindHandler
+};
+
+static IBindEventHandler BindEventHandler = { &BindEventHandlerVtbl };
+
+static HRESULT WINAPI bindEventHandlerDisp_QueryInterface(IDispatchEx *iface, REFIID
riid, void **ppv)
+{
+ if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDispatch) ||
IsEqualGUID(riid, &IID_IDispatchEx)) {
+ *ppv = iface;
+ return S_OK;
+ }
+
+ if(IsEqualGUID(riid, &IID_IBindEventHandler)) {
+ *ppv = &BindEventHandler;
+ return S_OK;
+ }
+
+ *ppv = NULL;
+ return E_NOINTERFACE;
+}
+
+static IDispatchExVtbl bindEventHandlerDispVtbl = {
+ bindEventHandlerDisp_QueryInterface,
+ DispatchEx_AddRef,
+ DispatchEx_Release,
+ DispatchEx_GetTypeInfoCount,
+ DispatchEx_GetTypeInfo,
+ DispatchEx_GetIDsOfNames,
+ DispatchEx_Invoke,
+ DispatchEx_GetDispID,
+ DispatchEx_InvokeEx,
+ DispatchEx_DeleteMemberByName,
+ DispatchEx_DeleteMemberByDispID,
+ DispatchEx_GetMemberProperties,
+ DispatchEx_GetMemberName,
+ DispatchEx_GetNextDispID,
+ DispatchEx_GetNameSpaceParent
+};
+
+static IDispatchEx bindEventHandlerDisp = { &bindEventHandlerDispVtbl };
+
static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex,
DISPID *pid)
{
if(!strcmp_wa(bstrName, "ok")) {
@@ -767,6 +845,11 @@
if(!strcmp_wa(bstrName, "getScriptState")) {
*pid = DISPID_GLOBAL_GETSCRIPTSTATE;
+ return S_OK;
+ }
+
+ if(!strcmp_wa(bstrName, "bindEventHandler")) {
+ *pid = DISPID_GLOBAL_BINDEVENTHANDLER;
return S_OK;
}
@@ -1134,6 +1217,11 @@
return S_OK;
}
+ case DISPID_GLOBAL_BINDEVENTHANDLER:
+ V_VT(pvarRes) = VT_DISPATCH;
+ V_DISPATCH(pvarRes) = (IDispatch*)&bindEventHandlerDisp;
+ return S_OK;
+
case DISPID_GLOBAL_PROPARGPUT:
CHECK_EXPECT(global_propargput_i);
ok(wFlags == INVOKE_PROPERTYPUT, "wFlags = %x\n", wFlags);
@@ -1981,6 +2069,49 @@
script_engine = NULL;
}
+static void test_automagic(void)
+{
+ IActiveScriptParse *parser;
+ IActiveScript *engine;
+ BSTR str;
+ HRESULT hres;
+
+ script_engine = engine = create_script();
+ if(!engine)
+ return;
+
+ hres = IActiveScript_QueryInterface(engine, &IID_IActiveScriptParse,
(void**)&parser);
+ ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres);
+
+ hres = IActiveScriptParse_InitNew(parser);
+ ok(hres == S_OK, "InitNew failed: %08x\n", hres);
+
+ hres = IActiveScript_SetScriptSite(engine, &ActiveScriptSite);
+ ok(hres == S_OK, "SetScriptSite failed: %08x\n", hres);
+
+ hres = IActiveScript_AddNamedItem(engine, testW,
SCRIPTITEM_ISVISIBLE|SCRIPTITEM_ISSOURCE|SCRIPTITEM_GLOBALMEMBERS);
+ ok(hres == S_OK, "AddNamedItem failed: %08x\n", hres);
+
+ str = a2bstr("function bindEventHandler::eventName() {}\n"
+ "reportSuccess();");
+ hres = IActiveScriptParse_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, 0,
NULL, NULL);
+ ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
+ SysFreeString(str);
+
+ SET_EXPECT(BindHandler);
+ SET_EXPECT(global_success_d);
+ SET_EXPECT(global_success_i);
+ hres = IActiveScript_SetScriptState(engine, SCRIPTSTATE_STARTED);
+ ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_STARTED) failed: %08x\n",
hres);
+ CHECK_CALLED(BindHandler);
+ CHECK_CALLED(global_success_d);
+ CHECK_CALLED(global_success_i);
+
+ IActiveScript_Release(engine);
+ IActiveScriptParse_Release(parser);
+ script_engine = NULL;
+}
+
static HRESULT parse_script_expr(const char *expr, VARIANT *res, IActiveScript
**engine_ret)
{
IActiveScriptParse *parser;
@@ -2021,6 +2152,56 @@
IActiveScript_Release(engine);
}
return hres;
+}
+
+static void test_retval(void)
+{
+ BSTR str = a2bstr("reportSuccess(), true");
+ IActiveScriptParse *parser;
+ IActiveScript *engine;
+ SCRIPTSTATE state;
+ VARIANT res;
+ HRESULT hres;
+
+ engine = create_script();
+
+ hres = IActiveScript_QueryInterface(engine, &IID_IActiveScriptParse,
(void**)&parser);
+ ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres);
+
+ hres = IActiveScriptParse_InitNew(parser);
+ ok(hres == S_OK, "InitNew failed: %08x\n", hres);
+
+ hres = IActiveScript_SetScriptSite(engine, &ActiveScriptSite);
+ ok(hres == S_OK, "SetScriptSite failed: %08x\n", hres);
+
+ SET_EXPECT(GetItemInfo_testVal);
+ hres = IActiveScript_AddNamedItem(engine, test_valW,
+ SCRIPTITEM_ISVISIBLE|SCRIPTITEM_ISSOURCE|SCRIPTITEM_GLOBALMEMBERS);
+ ok(hres == S_OK, "AddNamedItem failed: %08x\n", hres);
+ CHECK_CALLED(GetItemInfo_testVal);
+
+ V_VT(&res) = VT_NULL;
+ SET_EXPECT(global_success_d);
+ SET_EXPECT(global_success_i);
+ hres = IActiveScriptParse_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, 0,
&res, NULL);
+ CHECK_CALLED(global_success_d);
+ CHECK_CALLED(global_success_i);
+ ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
+ ok(V_VT(&res) == VT_EMPTY, "V_VT(&res) = %d\n", V_VT(&res));
+
+ hres = IActiveScript_GetScriptState(engine, &state);
+ ok(hres == S_OK, "GetScriptState failed: %08x\n", hres);
+ ok(state == SCRIPTSTATE_INITIALIZED, "state = %d\n", state);
+
+ hres = IActiveScript_SetScriptState(engine, SCRIPTSTATE_STARTED);
+ ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_STARTED) failed: %08x\n",
hres);
+
+ hres = IActiveScript_Close(engine);
+ ok(hres == S_OK, "Close failed: %08x\n", hres);
+
+ IActiveScriptParse_Release(parser);
+ IActiveScript_Release(engine);
+ SysFreeString(str);
}
static void test_default_value(void)
@@ -2091,6 +2272,7 @@
CHECK_CALLED(global_success_i);
test_default_value();
+ test_retval();
testing_expr = FALSE;
}
@@ -2458,6 +2640,7 @@
test_isvisible(FALSE);
test_isvisible(TRUE);
test_start();
+ test_automagic();
parse_script_af(0, "test.testThis2(this);");
parse_script_af(0, "(function () { test.testThis2(this); })();");