vbscript/tests: Use proper helpers for iface calls.

This commit is contained in:
Jacek Caban 2012-07-31 13:21:18 +02:00 committed by Alexandre Julliard
parent bd7db0a9a4
commit aa68bf130e
3 changed files with 81 additions and 33 deletions

View File

@ -30,6 +30,22 @@
#include "wine/test.h"
#ifdef _WIN64
#define IActiveScriptParse_QueryInterface IActiveScriptParse64_QueryInterface
#define IActiveScriptParse_Release IActiveScriptParse64_Release
#define IActiveScriptParse_InitNew IActiveScriptParse64_InitNew
#define IActiveScriptParse_ParseScriptText IActiveScriptParse64_ParseScriptText
#else
#define IActiveScriptParse_QueryInterface IActiveScriptParse32_QueryInterface
#define IActiveScriptParse_Release IActiveScriptParse32_Release
#define IActiveScriptParse_InitNew IActiveScriptParse32_InitNew
#define IActiveScriptParse_ParseScriptText IActiveScriptParse32_ParseScriptText
#endif
extern const CLSID CLSID_VBScript;
#define DEFINE_EXPECT(func) \
@ -693,7 +709,7 @@ static void _parse_script_a(unsigned line, IActiveScriptParse *parser, const cha
HRESULT hres;
str = a2bstr(script);
hres = IActiveScriptParse64_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
hres = IActiveScriptParse_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
SysFreeString(str);
ok_(__FILE__,line)(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
}
@ -704,7 +720,7 @@ static HRESULT parse_script_ae(IActiveScriptParse *parser, const char *script)
HRESULT hres;
str = a2bstr(script);
hres = IActiveScriptParse64_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
hres = IActiveScriptParse_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
SysFreeString(str);
return hres;
@ -737,7 +753,7 @@ static IActiveScriptParse *create_script(BOOL use_sec_mgr)
hres = IActiveScript_QueryInterface(script, &IID_IActiveScriptParse, (void**)&parser);
ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres);
hres = IActiveScriptParse64_InitNew(parser);
hres = IActiveScriptParse_InitNew(parser);
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
hres = IActiveScript_SetScriptSite(script, &ActiveScriptSite);
@ -776,14 +792,14 @@ static void test_CreateObject(void)
CHECK_CALLED(QI_IObjectWithSite);
CHECK_CALLED(reportSuccess);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
parser = create_script(TRUE);
hres = parse_script_ae(parser, "Call CreateObject(\"Wine.TestABC\")");
ok(hres == VB_E_CANNOT_CREATE_OBJ, "hres = %08x\n", hres);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
parser = create_script(TRUE);
QS_SecMgr_hres = E_NOINTERFACE;
@ -793,7 +809,7 @@ static void test_CreateObject(void)
ok(hres == VB_E_CANNOT_CREATE_OBJ, "hres = %08x\n", hres);
CHECK_CALLED(Host_QS_SecMgr);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
parser = create_script(TRUE);
ProcessUrlAction_hres = E_FAIL;
@ -805,7 +821,7 @@ static void test_CreateObject(void)
CHECK_CALLED(Host_QS_SecMgr);
CHECK_CALLED(ProcessUrlAction);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
parser = create_script(TRUE);
ProcessUrlAction_policy = URLPOLICY_DISALLOW;
@ -817,7 +833,7 @@ static void test_CreateObject(void)
CHECK_CALLED(Host_QS_SecMgr);
CHECK_CALLED(ProcessUrlAction);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
parser = create_script(TRUE);
CreateInstance_hres = E_FAIL;
@ -831,7 +847,7 @@ static void test_CreateObject(void)
CHECK_CALLED(ProcessUrlAction);
CHECK_CALLED(CreateInstance);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
parser = create_script(TRUE);
QueryCustomPolicy_hres = E_FAIL;
@ -847,7 +863,7 @@ static void test_CreateObject(void)
CHECK_CALLED(CreateInstance);
CHECK_CALLED(QueryCustomPolicy);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
parser = create_script(TRUE);
QueryCustomPolicy_psize = 6;
@ -866,7 +882,7 @@ static void test_CreateObject(void)
CHECK_CALLED(QI_IObjectWithSite);
CHECK_CALLED(reportSuccess);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
parser = create_script(TRUE);
QueryCustomPolicy_policy = URLPOLICY_DISALLOW;
@ -905,7 +921,7 @@ static void test_CreateObject(void)
CHECK_CALLED(CreateInstance);
CHECK_CALLED(QueryCustomPolicy);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
parser = create_script(FALSE);
@ -917,7 +933,7 @@ static void test_CreateObject(void)
CHECK_CALLED(QI_IObjectWithSite);
CHECK_CALLED(reportSuccess);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
parser = create_script(TRUE);
object_with_site = &ObjectWithSite;
@ -952,7 +968,7 @@ static void test_CreateObject(void)
CHECK_CALLED(QI_IObjectWithSite);
CHECK_CALLED(SetSite);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
}
static BOOL init_key(const char *key_name, const char *def_value, BOOL init)

View File

@ -27,6 +27,22 @@
#include "wine/test.h"
#ifdef _WIN64
#define IActiveScriptParse_QueryInterface IActiveScriptParse64_QueryInterface
#define IActiveScriptParse_Release IActiveScriptParse64_Release
#define IActiveScriptParse_InitNew IActiveScriptParse64_InitNew
#define IActiveScriptParse_ParseScriptText IActiveScriptParse64_ParseScriptText
#else
#define IActiveScriptParse_QueryInterface IActiveScriptParse32_QueryInterface
#define IActiveScriptParse_Release IActiveScriptParse32_Release
#define IActiveScriptParse_InitNew IActiveScriptParse32_InitNew
#define IActiveScriptParse_ParseScriptText IActiveScriptParse32_ParseScriptText
#endif
extern const CLSID CLSID_VBScript;
#define DEFINE_EXPECT(func) \
@ -1230,7 +1246,7 @@ static HRESULT parse_script(DWORD flags, BSTR script_str)
return hres;
}
hres = IActiveScriptParse64_InitNew(parser);
hres = IActiveScriptParse_InitNew(parser);
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
hres = IActiveScript_SetScriptSite(engine, &ActiveScriptSite);
@ -1250,14 +1266,14 @@ static HRESULT parse_script(DWORD flags, BSTR script_str)
test_counter = 0;
hres = IActiveScriptParse64_ParseScriptText(parser, script_str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
hres = IActiveScriptParse_ParseScriptText(parser, script_str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
IActiveScript_Close(engine);
IDispatch_Release(script_disp);
IActiveScript_Release(engine);
ref = IUnknown_Release(parser);
ref = IActiveScriptParse_Release(parser);
ok(!ref, "ref=%d\n", ref);
return hres;
}
@ -1294,7 +1310,7 @@ static void test_gc(void)
hres = IActiveScript_QueryInterface(engine, &IID_IActiveScriptParse, (void**)&parser);
ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres);
hres = IActiveScriptParse64_InitNew(parser);
hres = IActiveScriptParse_InitNew(parser);
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
hres = IActiveScript_SetScriptSite(engine, &ActiveScriptSite);
@ -1319,7 +1335,7 @@ static void test_gc(void)
"set x.ref = x\n"
"set x = nothing\n");
hres = IActiveScriptParse64_ParseScriptText(parser, src, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
hres = IActiveScriptParse_ParseScriptText(parser, src, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
SysFreeString(src);
@ -1330,7 +1346,7 @@ static void test_gc(void)
CHECK_CALLED(global_success_i);
IActiveScript_Release(engine);
IUnknown_Release(parser);
IActiveScriptParse_Release(parser);
}
static HRESULT test_global_vars_ref(BOOL use_close)
@ -1353,7 +1369,7 @@ static HRESULT test_global_vars_ref(BOOL use_close)
return hres;
}
hres = IActiveScriptParse64_InitNew(parser);
hres = IActiveScriptParse_InitNew(parser);
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
hres = IActiveScript_SetScriptSite(engine, &ActiveScriptSite);
@ -1368,7 +1384,7 @@ static HRESULT test_global_vars_ref(BOOL use_close)
refobj_ref = 0;
script_str = a2bstr("Dim x\nset x = RefObj\n");
hres = IActiveScriptParse64_ParseScriptText(parser, script_str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
hres = IActiveScriptParse_ParseScriptText(parser, script_str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
SysFreeString(script_str);
ok(refobj_ref, "refobj_ref = 0\n");
@ -1385,7 +1401,7 @@ static HRESULT test_global_vars_ref(BOOL use_close)
IActiveScript_Release(engine);
ref = IUnknown_Release(parser);
ref = IActiveScriptParse_Release(parser);
ok(!ref, "ref=%d\n", ref);
return hres;
}

View File

@ -27,6 +27,22 @@
#include "wine/test.h"
#ifdef _WIN64
#define IActiveScriptParse_QueryInterface IActiveScriptParse64_QueryInterface
#define IActiveScriptParse_Release IActiveScriptParse64_Release
#define IActiveScriptParse_InitNew IActiveScriptParse64_InitNew
#define IActiveScriptParse_ParseScriptText IActiveScriptParse64_ParseScriptText
#else
#define IActiveScriptParse_QueryInterface IActiveScriptParse32_QueryInterface
#define IActiveScriptParse_Release IActiveScriptParse32_Release
#define IActiveScriptParse_InitNew IActiveScriptParse32_InitNew
#define IActiveScriptParse_ParseScriptText IActiveScriptParse32_ParseScriptText
#endif
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
#define DEFINE_EXPECT(func) \
@ -344,13 +360,13 @@ static void test_vbscript(void)
test_state(vbscript, SCRIPTSTATE_UNINITIALIZED);
SET_EXPECT(OnStateChange_INITIALIZED);
hres = IActiveScriptParse64_InitNew(parser);
hres = IActiveScriptParse_InitNew(parser);
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
CHECK_CALLED(OnStateChange_INITIALIZED);
test_state(vbscript, SCRIPTSTATE_INITIALIZED);
hres = IActiveScriptParse64_InitNew(parser);
hres = IActiveScriptParse_InitNew(parser);
ok(hres == E_UNEXPECTED, "InitNew failed: %08x, expected E_UNEXPECTED\n", hres);
SET_EXPECT(OnStateChange_CONNECTED);
@ -372,7 +388,7 @@ static void test_vbscript(void)
test_state(vbscript, SCRIPTSTATE_CLOSED);
test_no_script_dispatch(vbscript);
IActiveScriptParse64_Release(parser);
IActiveScriptParse_Release(parser);
ref = IActiveScript_Release(vbscript);
ok(!ref, "ref = %d\n", ref);
@ -396,7 +412,7 @@ static void test_vbscript_uninitializing(void)
test_state(script, SCRIPTSTATE_UNINITIALIZED);
hres = IActiveScriptParse64_InitNew(parse);
hres = IActiveScriptParse_InitNew(parse);
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
SET_EXPECT(GetLCID);
@ -408,7 +424,7 @@ static void test_vbscript_uninitializing(void)
test_state(script, SCRIPTSTATE_INITIALIZED);
hres = IActiveScriptParse64_ParseScriptText(parse, script_textW, NULL, NULL, NULL, 0, 1, 0x42, NULL, NULL);
hres = IActiveScriptParse_ParseScriptText(parse, script_textW, NULL, NULL, NULL, 0, 1, 0x42, NULL, NULL);
ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
hres = IActiveScript_SetScriptSite(script, &ActiveScriptSite);
@ -484,7 +500,7 @@ static void test_vbscript_uninitializing(void)
test_state(script, SCRIPTSTATE_CLOSED);
IUnknown_Release(parse);
IActiveScriptParse_Release(parse);
ref = IActiveScript_Release(script);
ok(!ref, "ref = %d\n", ref);
@ -513,7 +529,7 @@ static void test_vbscript_release(void)
test_state(vbscript, SCRIPTSTATE_UNINITIALIZED);
SET_EXPECT(OnStateChange_INITIALIZED);
hres = IActiveScriptParse64_InitNew(parser);
hres = IActiveScriptParse_InitNew(parser);
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
CHECK_CALLED(OnStateChange_INITIALIZED);
@ -526,7 +542,7 @@ static void test_vbscript_release(void)
test_state(vbscript, SCRIPTSTATE_CONNECTED);
IActiveScriptParse64_Release(parser);
IActiveScriptParse_Release(parser);
SET_EXPECT(OnStateChange_DISCONNECTED);
SET_EXPECT(OnStateChange_INITIALIZED);
@ -573,7 +589,7 @@ static void test_vbscript_initializing(void)
CHECK_CALLED(GetLCID);
SET_EXPECT(OnStateChange_INITIALIZED);
hres = IActiveScriptParse64_InitNew(parse);
hres = IActiveScriptParse_InitNew(parse);
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
CHECK_CALLED(OnStateChange_INITIALIZED);
@ -587,7 +603,7 @@ static void test_vbscript_initializing(void)
test_state(script, SCRIPTSTATE_CLOSED);
IUnknown_Release(parse);
IActiveScriptParse_Release(parse);
ref = IActiveScript_Release(script);
ok(!ref, "ref = %d\n", ref);