Alistair Leslie-Hughes : vbscript/tests: Show IActiveScriptSite OnScriptError is called on error.
Module: wine Branch: master Commit: ae119b4205121d3bdcfcfb270700093ac9a22deb URL: http://source.winehq.org/git/wine.git/?a=commit;h=ae119b4205121d3bdcfcfb2707... Author: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Date: Thu Oct 29 19:11:47 2015 +1100 vbscript/tests: Show IActiveScriptSite OnScriptError is called on error. Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/vbscript/tests/run.c | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/dlls/vbscript/tests/run.c b/dlls/vbscript/tests/run.c index a86711a..d8c5467 100644 --- a/dlls/vbscript/tests/run.c +++ b/dlls/vbscript/tests/run.c @@ -100,6 +100,7 @@ DEFINE_EXPECT(Next); DEFINE_EXPECT(GetWindow); DEFINE_EXPECT(GetUIBehavior); DEFINE_EXPECT(EnableModeless); +DEFINE_EXPECT(OnScriptError); #define DISPID_GLOBAL_REPORTSUCCESS 1000 #define DISPID_GLOBAL_TRACE 1001 @@ -138,6 +139,7 @@ static const char *test_name = "(null)"; static int test_counter; static SCRIPTUICHANDLING uic_handling = SCRIPTUICHANDLING_NOUIERROR; static IDispatchEx testObj; +static HRESULT onerror_hres = E_NOTIMPL; static BSTR a2bstr(const char *str) { @@ -1623,7 +1625,12 @@ static HRESULT WINAPI ActiveScriptSite_OnStateChange(IActiveScriptSite *iface, S static HRESULT WINAPI ActiveScriptSite_OnScriptError(IActiveScriptSite *iface, IActiveScriptError *pscripterror) { - return E_NOTIMPL; + HRESULT hr = onerror_hres; + CHECK_EXPECT(OnScriptError); + + onerror_hres = E_NOTIMPL; + + return hr; } static HRESULT WINAPI ActiveScriptSite_OnEnterScript(IActiveScriptSite *iface) @@ -1927,18 +1934,22 @@ static void test_msgbox(void) SET_EXPECT(GetUIBehavior); SET_EXPECT(GetWindow); SET_EXPECT(EnableModeless); + SET_EXPECT(OnScriptError); hres = parse_script_ar("MsgBox \"testing...\""); ok(FAILED(hres), "script not failed\n"); CHECK_CALLED(GetUIBehavior); CHECK_CALLED(GetWindow); CHECK_CALLED(EnableModeless); + todo_wine CHECK_CALLED(OnScriptError); uic_handling = SCRIPTUICHANDLING_NOUIERROR; SET_EXPECT(GetUIBehavior); + SET_EXPECT(OnScriptError); hres = parse_script_ar("MsgBox \"testing...\""); ok(FAILED(hres), "script not failed\n"); CHECK_CALLED(GetUIBehavior); + todo_wine CHECK_CALLED(OnScriptError); } static HRESULT test_global_vars_ref(BOOL use_close) @@ -2184,8 +2195,10 @@ static void run_tests(void) parse_htmlscript_a("<!--\ndim x\nx=1\n-->\n"); parse_htmlscript_a("<!--\ndim x\n-->\n<!--\nx=1\n-->\n"); + SET_EXPECT(OnScriptError); hres = parse_script_ar("<!--"); ok(FAILED(hres), "script didn't fail\n"); + todo_wine CHECK_CALLED(OnScriptError); SET_EXPECT(global_success_d); SET_EXPECT(global_success_i); @@ -2208,19 +2221,39 @@ static void run_tests(void) test_global_vars_ref(TRUE); test_global_vars_ref(FALSE); + SET_EXPECT(OnScriptError); hres = parse_script_ar("throwInt(&h80080008&)"); ok(hres == 0x80080008, "hres = %08x\n", hres); + todo_wine CHECK_CALLED(OnScriptError); /* DISP_E_BADINDEX */ + SET_EXPECT(OnScriptError); hres = parse_script_ar("throwInt(&h8002000b&)"); ok(hres == MAKE_VBSERROR(9), "hres = %08x\n", hres); + todo_wine CHECK_CALLED(OnScriptError); + SET_EXPECT(OnScriptError); hres = parse_script_ar("throwInt(&h800a0009&)"); ok(hres == MAKE_VBSERROR(9), "hres = %08x\n", hres); + todo_wine CHECK_CALLED(OnScriptError); + + onerror_hres = S_OK; + SET_EXPECT(OnScriptError); + hres = parse_script_ar("throwInt(&h800a0009&)"); + todo_wine ok(hres == SCRIPT_E_REPORTED, "hres = %08x\n", hres); + todo_wine CHECK_CALLED(OnScriptError); /* E_NOTIMPL */ + SET_EXPECT(OnScriptError); hres = parse_script_ar("throwInt(&h80004001&)"); ok(hres == MAKE_VBSERROR(445), "hres = %08x\n", hres); + todo_wine CHECK_CALLED(OnScriptError); + + onerror_hres = S_OK; + SET_EXPECT(OnScriptError); + hres = parse_script_ar("throwInt(&h80004001&)"); + todo_wine ok(hres == SCRIPT_E_REPORTED, "hres = %08x\n", hres); + todo_wine CHECK_CALLED(OnScriptError); SET_EXPECT(global_testoptionalarg_i); parse_script_a("call testOptionalArg(1,,2)"); @@ -2255,8 +2288,10 @@ static void run_tests(void) parse_script_a("x = y\n" "Call ok(getVT(x) = \"VT_EMPTY*\", \"getVT(x) = \" & getVT(x))\n" "Call ok(getVT(y) = \"VT_EMPTY*\", \"getVT(y) = \" & getVT(y))"); + SET_EXPECT(OnScriptError); hres = parse_script_ar("x = y(\"a\")"); ok(FAILED(hres), "script didn't fail\n"); + todo_wine CHECK_CALLED(OnScriptError); run_from_res("lang.vbs"); run_from_res("api.vbs");
participants (1)
-
Alexandre Julliard