mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[VBSCRIPT_WINETEST] Sync with Wine Staging 3.9. CORE-14656
This commit is contained in:
parent
bcea8c65d0
commit
c78e873652
1 changed files with 71 additions and 2 deletions
|
@ -974,6 +974,18 @@ static IDispatchExVtbl RefObjVtbl = {
|
|||
|
||||
static IDispatchEx RefObj = { &RefObjVtbl };
|
||||
|
||||
static ULONG global_ref;
|
||||
|
||||
static ULONG WINAPI Global_AddRef(IDispatchEx *iface)
|
||||
{
|
||||
return ++global_ref;
|
||||
}
|
||||
|
||||
static ULONG WINAPI Global_Release(IDispatchEx *iface)
|
||||
{
|
||||
return --global_ref;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
|
||||
{
|
||||
if(!strcmp_wa(bstrName, "ok")) {
|
||||
|
@ -1476,8 +1488,8 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
|
|||
|
||||
static IDispatchExVtbl GlobalVtbl = {
|
||||
DispatchEx_QueryInterface,
|
||||
DispatchEx_AddRef,
|
||||
DispatchEx_Release,
|
||||
Global_AddRef,
|
||||
Global_Release,
|
||||
DispatchEx_GetTypeInfoCount,
|
||||
DispatchEx_GetTypeInfo,
|
||||
DispatchEx_GetIDsOfNames,
|
||||
|
@ -1619,6 +1631,7 @@ static HRESULT WINAPI ActiveScriptSite_GetItemInfo(IActiveScriptSite *iface, LPC
|
|||
ok(0, "unexpected pstrName %s\n", wine_dbgstr_w(pstrName));
|
||||
|
||||
*ppiunkItem = (IUnknown*)&Global;
|
||||
IUnknown_AddRef(*ppiunkItem);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -1804,6 +1817,61 @@ static HRESULT parse_script_ar(const char *src)
|
|||
return hres;
|
||||
}
|
||||
|
||||
static void test_parse_context(void)
|
||||
{
|
||||
IActiveScriptParse *parser;
|
||||
IActiveScript *engine;
|
||||
BSTR str;
|
||||
HRESULT hres;
|
||||
|
||||
static const WCHAR xW[] = {'x',0};
|
||||
static const WCHAR yW[] = {'y',0};
|
||||
|
||||
global_ref = 1;
|
||||
engine = create_and_init_script(0);
|
||||
if(!engine)
|
||||
return;
|
||||
|
||||
hres = IActiveScript_QueryInterface(engine, &IID_IActiveScriptParse, (void**)&parser);
|
||||
ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres);
|
||||
|
||||
/* unknown identifier context is not a valid argument */
|
||||
str = a2bstr("Call reportSuccess()\n");
|
||||
hres = IActiveScriptParse_ParseScriptText(parser, str, yW, NULL, NULL, 0, 0, 0, NULL, NULL);
|
||||
ok(hres == E_INVALIDARG, "ParseScriptText failed: %08x\n", hres);
|
||||
SysFreeString(str);
|
||||
|
||||
str = a2bstr("class Cl\n"
|
||||
" Public Sub ClMethod\n"
|
||||
" Call reportSuccess()\n"
|
||||
" End Sub\n"
|
||||
"End Class\n"
|
||||
"Dim x\n"
|
||||
"set x = new Cl\n");
|
||||
hres = IActiveScriptParse_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
|
||||
ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
|
||||
SysFreeString(str);
|
||||
|
||||
/* known global variable is not a valid context */
|
||||
str = a2bstr("Call reportSuccess()\n");
|
||||
hres = IActiveScriptParse_ParseScriptText(parser, str, xW, NULL, NULL, 0, 0, 0, NULL, NULL);
|
||||
ok(hres == E_INVALIDARG, "ParseScriptText failed: %08x\n", hres);
|
||||
SysFreeString(str);
|
||||
|
||||
SET_EXPECT(global_success_d);
|
||||
SET_EXPECT(global_success_i);
|
||||
str = a2bstr("Call reportSuccess()\n");
|
||||
hres = IActiveScriptParse_ParseScriptText(parser, str, testW, NULL, NULL, 0, 0, 0, NULL, NULL);
|
||||
ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
|
||||
SysFreeString(str);
|
||||
CHECK_CALLED(global_success_d);
|
||||
CHECK_CALLED(global_success_i);
|
||||
|
||||
IActiveScriptParse_Release(parser);
|
||||
close_script(engine);
|
||||
ok(global_ref == 1, "global_ref = %u\n", global_ref);
|
||||
}
|
||||
|
||||
static void parse_script_a(const char *src)
|
||||
{
|
||||
parse_script_af(SCRIPTITEM_GLOBALMEMBERS, src);
|
||||
|
@ -2334,6 +2402,7 @@ static void run_tests(void)
|
|||
test_procedures();
|
||||
test_gc();
|
||||
test_msgbox();
|
||||
test_parse_context();
|
||||
}
|
||||
|
||||
static BOOL check_vbscript(void)
|
||||
|
|
Loading…
Reference in a new issue