[PATCH] vbscript/tests: Show IActiveScriptSite OnScriptError is called on error
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Tue Oct 27 22:55:09 CDT 2015
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
dlls/vbscript/tests/run.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 46 insertions(+), 1 deletion(-)
diff --git a/dlls/vbscript/tests/run.c b/dlls/vbscript/tests/run.c
index a86711a..6e25879 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 BOOL overwrite_return = FALSE;
static BSTR a2bstr(const char *str)
{
@@ -1623,7 +1625,22 @@ static HRESULT WINAPI ActiveScriptSite_OnStateChange(IActiveScriptSite *iface, S
static HRESULT WINAPI ActiveScriptSite_OnScriptError(IActiveScriptSite *iface, IActiveScriptError *pscripterror)
{
- return E_NOTIMPL;
+ HRESULT hr;
+ EXCEPINFO ei = {0};
+
+ CHECK_EXPECT(OnScriptError);
+
+ hr = IActiveScriptError_GetExceptionInfo(pscripterror, &ei);
+ ok(hr == S_OK, "GetExceptionInfo %x\n", hr);
+
+ if(overwrite_return)
+ {
+ overwrite_return = FALSE;
+ return S_OK;
+ }
+
+ /* We return the EXCEPINFO error since returning S_OK means we have handled the error */
+ return ei.scode;
}
static HRESULT WINAPI ActiveScriptSite_OnEnterScript(IActiveScriptSite *iface)
@@ -1927,18 +1944,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 +2205,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 +2231,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);
+
+ overwrite_return = TRUE;
+ 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);
+
+ overwrite_return = TRUE;
+ 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 +2298,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");
--
1.9.1
More information about the wine-patches
mailing list