mirror of
https://github.com/reactos/reactos.git
synced 2025-05-19 17:14:32 +00:00
[MSHTML_WINETEST]
update mshtml winetest to wine 1.1.36 svn path=/trunk/; revision=45136
This commit is contained in:
parent
24cd3eb4cb
commit
27a2254546
9 changed files with 3337 additions and 305 deletions
File diff suppressed because it is too large
Load diff
|
@ -27,6 +27,7 @@
|
||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
#include "ole2.h"
|
#include "ole2.h"
|
||||||
#include "mshtml.h"
|
#include "mshtml.h"
|
||||||
|
#include "mshtmdid.h"
|
||||||
#include "docobj.h"
|
#include "docobj.h"
|
||||||
#include "hlink.h"
|
#include "hlink.h"
|
||||||
#include "dispex.h"
|
#include "dispex.h"
|
||||||
|
@ -61,10 +62,15 @@ DEFINE_EXPECT(body_onclick);
|
||||||
DEFINE_EXPECT(div_onclick);
|
DEFINE_EXPECT(div_onclick);
|
||||||
DEFINE_EXPECT(div_onclick_attached);
|
DEFINE_EXPECT(div_onclick_attached);
|
||||||
DEFINE_EXPECT(timeout);
|
DEFINE_EXPECT(timeout);
|
||||||
|
DEFINE_EXPECT(doccp_onclick);
|
||||||
|
DEFINE_EXPECT(iframe_onreadystatechange_loading);
|
||||||
|
DEFINE_EXPECT(iframe_onreadystatechange_interactive);
|
||||||
|
DEFINE_EXPECT(iframe_onreadystatechange_complete);
|
||||||
|
|
||||||
static HWND container_hwnd = NULL;
|
static HWND container_hwnd = NULL;
|
||||||
static IHTMLWindow2 *window;
|
static IHTMLWindow2 *window;
|
||||||
static IOleDocumentView *view;
|
static IOleDocumentView *view;
|
||||||
|
static BOOL xy_todo;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
LONG x;
|
LONG x;
|
||||||
|
@ -84,12 +90,8 @@ static const char click_doc_str[] =
|
||||||
"<div id=\"clickdiv\" style=\"text-align: center; background: red; font-size: 32\">click here</div>"
|
"<div id=\"clickdiv\" style=\"text-align: center; background: red; font-size: 32\">click here</div>"
|
||||||
"</body></html>";
|
"</body></html>";
|
||||||
|
|
||||||
static const char *debugstr_w(LPCWSTR str)
|
static const char readystate_doc_str[] =
|
||||||
{
|
"<<html><body><iframe id=\"iframe\"></iframe></body></html>";
|
||||||
static char buf[1024];
|
|
||||||
WideCharToMultiByte(CP_ACP, 0, str, -1, buf, sizeof(buf), NULL, NULL);
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *debugstr_guid(REFIID riid)
|
static const char *debugstr_guid(REFIID riid)
|
||||||
{
|
{
|
||||||
|
@ -209,6 +211,18 @@ static IHTMLElement2 *_get_elem2_iface(unsigned line, IUnknown *unk)
|
||||||
return elem2;
|
return elem2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define get_elem3_iface(u) _get_elem3_iface(__LINE__,u)
|
||||||
|
static IHTMLElement3 *_get_elem3_iface(unsigned line, IUnknown *unk)
|
||||||
|
{
|
||||||
|
IHTMLElement3 *elem3;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
hres = IUnknown_QueryInterface(unk, &IID_IHTMLElement3, (void**)&elem3);
|
||||||
|
ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLElement3 iface: %08x\n", hres);
|
||||||
|
|
||||||
|
return elem3;
|
||||||
|
}
|
||||||
|
|
||||||
#define doc_get_body(d) _doc_get_body(__LINE__,d)
|
#define doc_get_body(d) _doc_get_body(__LINE__,d)
|
||||||
static IHTMLElement *_doc_get_body(unsigned line, IHTMLDocument2 *doc)
|
static IHTMLElement *_doc_get_body(unsigned line, IHTMLDocument2 *doc)
|
||||||
{
|
{
|
||||||
|
@ -249,7 +263,7 @@ static void _test_elem_tag(unsigned line, IUnknown *unk, const char *extag)
|
||||||
hres = IHTMLElement_get_tagName(elem, &tag);
|
hres = IHTMLElement_get_tagName(elem, &tag);
|
||||||
IHTMLElement_Release(elem);
|
IHTMLElement_Release(elem);
|
||||||
ok_(__FILE__, line) (hres == S_OK, "get_tagName failed: %08x\n", hres);
|
ok_(__FILE__, line) (hres == S_OK, "get_tagName failed: %08x\n", hres);
|
||||||
ok_(__FILE__, line) (!strcmp_wa(tag, extag), "got tag: %s, expected %s\n", debugstr_w(tag), extag);
|
ok_(__FILE__, line) (!strcmp_wa(tag, extag), "got tag: %s, expected %s\n", wine_dbgstr_w(tag), extag);
|
||||||
|
|
||||||
SysFreeString(tag);
|
SysFreeString(tag);
|
||||||
}
|
}
|
||||||
|
@ -268,6 +282,22 @@ static IHTMLEventObj *_get_event_obj(unsigned line)
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define elem_fire_event(a,b,c) _elem_fire_event(__LINE__,a,b,c)
|
||||||
|
static void _elem_fire_event(unsigned line, IUnknown *unk, const char *event, VARIANT *evobj)
|
||||||
|
{
|
||||||
|
IHTMLElement3 *elem3 = _get_elem3_iface(line, unk);
|
||||||
|
VARIANT_BOOL b;
|
||||||
|
BSTR str;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
b = 100;
|
||||||
|
str = a2bstr(event);
|
||||||
|
hres = IHTMLElement3_fireEvent(elem3, str, evobj, &b);
|
||||||
|
SysFreeString(str);
|
||||||
|
ok_(__FILE__,line)(hres == S_OK, "fireEvent failed: %08x\n", hres);
|
||||||
|
ok_(__FILE__,line)(b == VARIANT_TRUE, "fireEvent returned %x\n", b);
|
||||||
|
}
|
||||||
|
|
||||||
#define test_event_args(a,b,c,d,e,f,g) _test_event_args(__LINE__,a,b,c,d,e,f,g)
|
#define test_event_args(a,b,c,d,e,f,g) _test_event_args(__LINE__,a,b,c,d,e,f,g)
|
||||||
static void _test_event_args(unsigned line, const IID *dispiid, DISPID id, WORD wFlags, DISPPARAMS *pdp,
|
static void _test_event_args(unsigned line, const IID *dispiid, DISPID id, WORD wFlags, DISPPARAMS *pdp,
|
||||||
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
||||||
|
@ -312,8 +342,8 @@ static void _test_attached_event_args(unsigned line, DISPID id, WORD wFlags, DIS
|
||||||
IHTMLEventObj_Release(event);
|
IHTMLEventObj_Release(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define test_event_src(t) _test_event_src(__LINE__,t)
|
#define get_event_src() _get_event_src(__LINE__)
|
||||||
static void _test_event_src(unsigned line, const char *src_tag)
|
static IHTMLElement *_get_event_src(unsigned line)
|
||||||
{
|
{
|
||||||
IHTMLEventObj *event = _get_event_obj(line);
|
IHTMLEventObj *event = _get_event_obj(line);
|
||||||
IHTMLElement *src_elem = NULL;
|
IHTMLElement *src_elem = NULL;
|
||||||
|
@ -323,6 +353,14 @@ static void _test_event_src(unsigned line, const char *src_tag)
|
||||||
IHTMLEventObj_Release(event);
|
IHTMLEventObj_Release(event);
|
||||||
ok_(__FILE__,line) (hres == S_OK, "get_srcElement failed: %08x\n", hres);
|
ok_(__FILE__,line) (hres == S_OK, "get_srcElement failed: %08x\n", hres);
|
||||||
|
|
||||||
|
return src_elem;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define test_event_src(t) _test_event_src(__LINE__,t)
|
||||||
|
static void _test_event_src(unsigned line, const char *src_tag)
|
||||||
|
{
|
||||||
|
IHTMLElement *src_elem = _get_event_src(line);
|
||||||
|
|
||||||
if(src_tag) {
|
if(src_tag) {
|
||||||
ok_(__FILE__,line) (src_elem != NULL, "src_elem = NULL\n");
|
ok_(__FILE__,line) (src_elem != NULL, "src_elem = NULL\n");
|
||||||
_test_elem_tag(line, (IUnknown*)src_elem, src_tag);
|
_test_elem_tag(line, (IUnknown*)src_elem, src_tag);
|
||||||
|
@ -465,10 +503,14 @@ static void _test_event_clientx(unsigned line, IHTMLEventObj *event, LONG exl)
|
||||||
|
|
||||||
hres = IHTMLEventObj_get_clientX(event, &l);
|
hres = IHTMLEventObj_get_clientX(event, &l);
|
||||||
ok_(__FILE__,line)(hres == S_OK, "get_clientX failed: %08x\n", hres);
|
ok_(__FILE__,line)(hres == S_OK, "get_clientX failed: %08x\n", hres);
|
||||||
if(exl == -10) /* don't test the exact value */
|
if(exl == -10) {/* don't test the exact value */
|
||||||
ok_(__FILE__,line)(l > 0, "clientX = %d\n", l);
|
if(xy_todo)
|
||||||
else
|
todo_wine ok_(__FILE__,line)(l > 0, "clientX = %d\n", l);
|
||||||
|
else
|
||||||
|
ok_(__FILE__,line)(l > 0, "clientX = %d\n", l);
|
||||||
|
}else {
|
||||||
ok_(__FILE__,line)(l == exl, "clientX = %d, expected %d\n", l, exl);
|
ok_(__FILE__,line)(l == exl, "clientX = %d, expected %d\n", l, exl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _test_event_clienty(unsigned line, IHTMLEventObj *event, LONG exl)
|
static void _test_event_clienty(unsigned line, IHTMLEventObj *event, LONG exl)
|
||||||
|
@ -478,10 +520,14 @@ static void _test_event_clienty(unsigned line, IHTMLEventObj *event, LONG exl)
|
||||||
|
|
||||||
hres = IHTMLEventObj_get_clientY(event, &l);
|
hres = IHTMLEventObj_get_clientY(event, &l);
|
||||||
ok_(__FILE__,line)(hres == S_OK, "get_clientY failed: %08x\n", hres);
|
ok_(__FILE__,line)(hres == S_OK, "get_clientY failed: %08x\n", hres);
|
||||||
if(exl == -10) /* don't test the exact value */
|
if(exl == -10) {/* don't test the exact value */
|
||||||
ok_(__FILE__,line)(l > 0, "clientY = %d\n", l);
|
if(xy_todo)
|
||||||
else
|
todo_wine ok_(__FILE__,line)(l > 0, "clientY = %d\n", l);
|
||||||
|
else
|
||||||
|
ok_(__FILE__,line)(l > 0, "clientY = %d\n", l);
|
||||||
|
}else {
|
||||||
ok_(__FILE__,line)(l == exl, "clientY = %d, expected %d\n", l, exl);
|
ok_(__FILE__,line)(l == exl, "clientY = %d, expected %d\n", l, exl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _test_event_offsetx(unsigned line, IHTMLEventObj *event, LONG exl)
|
static void _test_event_offsetx(unsigned line, IHTMLEventObj *event, LONG exl)
|
||||||
|
@ -517,10 +563,14 @@ static void _test_event_screenx(unsigned line, IHTMLEventObj *event, LONG exl)
|
||||||
|
|
||||||
hres = IHTMLEventObj_get_screenX(event, &l);
|
hres = IHTMLEventObj_get_screenX(event, &l);
|
||||||
ok_(__FILE__,line)(hres == S_OK, "get_screenX failed: %08x\n", hres);
|
ok_(__FILE__,line)(hres == S_OK, "get_screenX failed: %08x\n", hres);
|
||||||
if(exl == -10) /* don't test the exact value */
|
if(exl == -10) { /* don't test the exact value */
|
||||||
ok_(__FILE__,line)(l > 0, "screenX = %d\n", l);
|
if(xy_todo)
|
||||||
else
|
todo_wine ok_(__FILE__,line)(l > 0, "screenX = %d\n", l);
|
||||||
|
else
|
||||||
|
ok_(__FILE__,line)(l > 0, "screenX = %d\n", l);
|
||||||
|
}else {
|
||||||
ok_(__FILE__,line)(l == exl, "screenX = %d, expected %d\n", l, exl);
|
ok_(__FILE__,line)(l == exl, "screenX = %d, expected %d\n", l, exl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _test_event_screeny(unsigned line, IHTMLEventObj *event, LONG exl)
|
static void _test_event_screeny(unsigned line, IHTMLEventObj *event, LONG exl)
|
||||||
|
@ -530,10 +580,14 @@ static void _test_event_screeny(unsigned line, IHTMLEventObj *event, LONG exl)
|
||||||
|
|
||||||
hres = IHTMLEventObj_get_screenY(event, &l);
|
hres = IHTMLEventObj_get_screenY(event, &l);
|
||||||
ok_(__FILE__,line)(hres == S_OK, "get_screenY failed: %08x\n", hres);
|
ok_(__FILE__,line)(hres == S_OK, "get_screenY failed: %08x\n", hres);
|
||||||
if(exl == -10) /* don't test the exact value */
|
if(exl == -10) { /* don't test the exact value */
|
||||||
ok_(__FILE__,line)(l > 0, "screenY = %d\n", l);
|
if(xy_todo)
|
||||||
else
|
todo_wine ok_(__FILE__,line)(l > 0, "screenY = %d\n", l);
|
||||||
|
else
|
||||||
|
ok_(__FILE__,line)(l > 0, "screenY = %d\n", l);
|
||||||
|
}else {
|
||||||
ok_(__FILE__,line)(l == exl, "screenY = %d, expected %d\n", l, exl);
|
ok_(__FILE__,line)(l == exl, "screenY = %d, expected %d\n", l, exl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _test_event_type(unsigned line, IHTMLEventObj *event, const char *exstr)
|
static void _test_event_type(unsigned line, IHTMLEventObj *event, const char *exstr)
|
||||||
|
@ -690,7 +744,7 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
|
||||||
|
|
||||||
static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
|
static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
|
||||||
{
|
{
|
||||||
ok(0, "unexpected call %s %x\n", debugstr_w(bstrName), grfdex);
|
ok(0, "unexpected call %s %x\n", wine_dbgstr_w(bstrName), grfdex);
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -793,6 +847,54 @@ static HRESULT WINAPI body_onclick(IDispatchEx *iface, DISPID id, LCID lcid, WOR
|
||||||
|
|
||||||
EVENT_HANDLER_FUNC_OBJ(body_onclick);
|
EVENT_HANDLER_FUNC_OBJ(body_onclick);
|
||||||
|
|
||||||
|
static HRESULT WINAPI iframe_onreadystatechange(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
||||||
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
||||||
|
{
|
||||||
|
IHTMLFrameBase2 *iframe;
|
||||||
|
IHTMLElement2 *elem2;
|
||||||
|
IHTMLElement *elem;
|
||||||
|
VARIANT v;
|
||||||
|
BSTR str;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
test_event_args(&DIID_DispHTMLIFrame, id, wFlags, pdp, pvarRes, pei, pspCaller);
|
||||||
|
test_event_src("IFRAME");
|
||||||
|
|
||||||
|
elem = get_event_src();
|
||||||
|
elem2 = get_elem2_iface((IUnknown*)elem);
|
||||||
|
IHTMLElement_Release(elem);
|
||||||
|
|
||||||
|
V_VT(&v) = VT_EMPTY;
|
||||||
|
hres = IHTMLElement2_get_readyState(elem2, &v);
|
||||||
|
ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
|
||||||
|
ok(V_VT(&v) == VT_BSTR, "V_VT(readyState) = %d\n", V_VT(&v));
|
||||||
|
|
||||||
|
hres = IHTMLElement2_QueryInterface(elem2, &IID_IHTMLFrameBase2, (void**)&iframe);
|
||||||
|
IHTMLElement2_Release(elem2);
|
||||||
|
ok(hres == S_OK, "Could not get IHTMLFrameBase2 iface: %08x\n", hres);
|
||||||
|
|
||||||
|
str = NULL;
|
||||||
|
hres = IHTMLFrameBase2_get_readyState(iframe, &str);
|
||||||
|
IHTMLFrameBase2_Release(iframe);
|
||||||
|
ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
|
||||||
|
ok(str != NULL, "readyState == NULL\n");
|
||||||
|
ok(!lstrcmpW(str, V_BSTR(&v)), "ready states differ\n");
|
||||||
|
VariantClear(&v);
|
||||||
|
|
||||||
|
if(!strcmp_wa(str, "loading"))
|
||||||
|
CHECK_EXPECT(iframe_onreadystatechange_loading);
|
||||||
|
else if(!strcmp_wa(str, "interactive"))
|
||||||
|
CHECK_EXPECT(iframe_onreadystatechange_interactive);
|
||||||
|
else if(!strcmp_wa(str, "complete"))
|
||||||
|
CHECK_EXPECT(iframe_onreadystatechange_complete);
|
||||||
|
else
|
||||||
|
ok(0, "unexpected state %s\n", wine_dbgstr_w(str));
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
EVENT_HANDLER_FUNC_OBJ(iframe_onreadystatechange);
|
||||||
|
|
||||||
static HRESULT WINAPI nocall(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
static HRESULT WINAPI nocall(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
||||||
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
||||||
{
|
{
|
||||||
|
@ -802,6 +904,74 @@ static HRESULT WINAPI nocall(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFla
|
||||||
|
|
||||||
EVENT_HANDLER_FUNC_OBJ(nocall);
|
EVENT_HANDLER_FUNC_OBJ(nocall);
|
||||||
|
|
||||||
|
#define CONNECTION_POINT_OBJ(cpname, diid) \
|
||||||
|
static HRESULT WINAPI cpname ## _QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv) \
|
||||||
|
{ \
|
||||||
|
*ppv = NULL; \
|
||||||
|
if(IsEqualGUID(riid, &IID_IUnknown) \
|
||||||
|
|| IsEqualGUID(riid, &IID_IDispatch) \
|
||||||
|
|| IsEqualGUID(riid, &diid)) \
|
||||||
|
*ppv = iface; \
|
||||||
|
else { \
|
||||||
|
ok(0, "unexpected riid %s\n", debugstr_guid(riid)); \
|
||||||
|
return E_NOINTERFACE; \
|
||||||
|
} \
|
||||||
|
return S_OK; \
|
||||||
|
} \
|
||||||
|
static IDispatchExVtbl cpname ## Vtbl = { \
|
||||||
|
cpname ## _QueryInterface, \
|
||||||
|
DispatchEx_AddRef, \
|
||||||
|
DispatchEx_Release, \
|
||||||
|
DispatchEx_GetTypeInfoCount, \
|
||||||
|
DispatchEx_GetTypeInfo, \
|
||||||
|
DispatchEx_GetIDsOfNames, \
|
||||||
|
cpname, \
|
||||||
|
DispatchEx_GetDispID, \
|
||||||
|
DispatchEx_InvokeEx, \
|
||||||
|
DispatchEx_DeleteMemberByName, \
|
||||||
|
DispatchEx_DeleteMemberByDispID, \
|
||||||
|
DispatchEx_GetMemberProperties, \
|
||||||
|
DispatchEx_GetMemberName, \
|
||||||
|
DispatchEx_GetNextDispID, \
|
||||||
|
DispatchEx_GetNameSpaceParent \
|
||||||
|
}; \
|
||||||
|
static IDispatchEx cpname ## _obj = { &cpname ## Vtbl }
|
||||||
|
|
||||||
|
#define test_cp_args(a,b,c,d,e,f) _test_cp_args(__LINE__,a,b,c,d,e,f)
|
||||||
|
static void _test_cp_args(unsigned line, REFIID riid, WORD flags, DISPPARAMS *dp, VARIANT *vres, EXCEPINFO *ei, UINT *argerr)
|
||||||
|
{
|
||||||
|
ok_(__FILE__,line)(IsEqualGUID(&IID_NULL, riid), "riid = %s\n", debugstr_guid(riid));
|
||||||
|
ok_(__FILE__,line)(flags == DISPATCH_METHOD, "flags = %x\n", flags);
|
||||||
|
ok_(__FILE__,line)(dp != NULL, "dp == NULL\n");
|
||||||
|
ok_(__FILE__,line)(!dp->cArgs, "dp->cArgs = %d\n", dp->cArgs);
|
||||||
|
ok_(__FILE__,line)(!dp->rgvarg, "dp->rgvarg = %p\n", dp->rgvarg);
|
||||||
|
ok_(__FILE__,line)(!dp->cNamedArgs, "dp->cNamedArgs = %d\n", dp->cNamedArgs);
|
||||||
|
ok_(__FILE__,line)(!dp->rgdispidNamedArgs, "dp->rgdispidNamedArgs = %p\n", dp->rgdispidNamedArgs);
|
||||||
|
ok_(__FILE__,line)(vres != NULL, "vres == NULL\n");
|
||||||
|
ok_(__FILE__,line)(V_VT(vres) == VT_EMPTY, "V_VT(vres) = %d\n", V_VT(vres));
|
||||||
|
ok_(__FILE__,line)(ei != NULL, "ei == NULL\n");
|
||||||
|
ok_(__FILE__,line)(argerr != NULL, "argerr == NULL\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI doccp(IDispatchEx *iface, DISPID dispIdMember,
|
||||||
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
||||||
|
VARIANT *pVarResult, EXCEPINFO *pei, UINT *puArgErr)
|
||||||
|
{
|
||||||
|
switch(dispIdMember) {
|
||||||
|
case DISPID_HTMLDOCUMENTEVENTS_ONCLICK:
|
||||||
|
CHECK_EXPECT(doccp_onclick);
|
||||||
|
test_cp_args(riid, wFlags, pdp, pVarResult, pei, puArgErr);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ok(0, "unexpected call %d\n", dispIdMember);
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
CONNECTION_POINT_OBJ(doccp, DIID_HTMLDocumentEvents);
|
||||||
|
|
||||||
static HRESULT WINAPI timeoutFunc_Invoke(IDispatchEx *iface, DISPID dispIdMember,
|
static HRESULT WINAPI timeoutFunc_Invoke(IDispatchEx *iface, DISPID dispIdMember,
|
||||||
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
||||||
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
||||||
|
@ -854,9 +1024,51 @@ static void pump_msgs(BOOL *b)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static IConnectionPoint *get_cp(IUnknown *unk, REFIID riid)
|
||||||
|
{
|
||||||
|
IConnectionPointContainer *cp_container;
|
||||||
|
IConnectionPoint *cp;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&cp_container);
|
||||||
|
ok(hres == S_OK, "Could not get IConnectionPointContainer: %08x\n", hres);
|
||||||
|
|
||||||
|
hres = IConnectionPointContainer_FindConnectionPoint(cp_container, riid, &cp);
|
||||||
|
IConnectionPointContainer_Release(cp_container);
|
||||||
|
ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
|
||||||
|
|
||||||
|
return cp;
|
||||||
|
}
|
||||||
|
|
||||||
|
static DWORD register_cp(IUnknown *unk, REFIID riid, IUnknown *sink)
|
||||||
|
{
|
||||||
|
IConnectionPoint *cp;
|
||||||
|
DWORD cookie;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
cp = get_cp(unk, riid);
|
||||||
|
hres = IConnectionPoint_Advise(cp, sink, &cookie);
|
||||||
|
IConnectionPoint_Release(cp);
|
||||||
|
ok(hres == S_OK, "Advise failed: %08x\n", hres);
|
||||||
|
|
||||||
|
return cookie;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void unregister_cp(IUnknown *unk, REFIID riid, DWORD cookie)
|
||||||
|
{
|
||||||
|
IConnectionPoint *cp;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
cp = get_cp(unk, riid);
|
||||||
|
hres = IConnectionPoint_Unadvise(cp, cookie);
|
||||||
|
IConnectionPoint_Release(cp);
|
||||||
|
ok(hres == S_OK, "Unadvise failed: %08x\n", hres);
|
||||||
|
}
|
||||||
|
|
||||||
static void test_onclick(IHTMLDocument2 *doc)
|
static void test_onclick(IHTMLDocument2 *doc)
|
||||||
{
|
{
|
||||||
IHTMLElement *div, *body;
|
IHTMLElement *div, *body;
|
||||||
|
DWORD cp_cookie;
|
||||||
VARIANT v;
|
VARIANT v;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
|
@ -870,6 +1082,10 @@ static void test_onclick(IHTMLDocument2 *doc)
|
||||||
ok(hres == S_OK, "get_onclick failed: %08x\n", hres);
|
ok(hres == S_OK, "get_onclick failed: %08x\n", hres);
|
||||||
ok(V_VT(&v) == VT_NULL, "V_VT(onclick) = %d\n", V_VT(&v));
|
ok(V_VT(&v) == VT_NULL, "V_VT(onclick) = %d\n", V_VT(&v));
|
||||||
|
|
||||||
|
V_VT(&v) = VT_EMPTY;
|
||||||
|
hres = IHTMLElement_put_onclick(div, v);
|
||||||
|
ok(hres == E_NOTIMPL, "put_onclick failed: %08x\n", hres);
|
||||||
|
|
||||||
V_VT(&v) = VT_DISPATCH;
|
V_VT(&v) = VT_DISPATCH;
|
||||||
V_DISPATCH(&v) = (IDispatch*)&div_onclick_obj;
|
V_DISPATCH(&v) = (IDispatch*)&div_onclick_obj;
|
||||||
hres = IHTMLElement_put_onclick(div, v);
|
hres = IHTMLElement_put_onclick(div, v);
|
||||||
|
@ -918,10 +1134,106 @@ static void test_onclick(IHTMLDocument2 *doc)
|
||||||
CHECK_CALLED(document_onclick);
|
CHECK_CALLED(document_onclick);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xy_todo = TRUE;
|
||||||
|
|
||||||
|
SET_EXPECT(div_onclick);
|
||||||
|
SET_EXPECT(div_onclick_attached);
|
||||||
|
SET_EXPECT(body_onclick);
|
||||||
|
SET_EXPECT(document_onclick);
|
||||||
|
|
||||||
|
hres = IHTMLElement_click(div);
|
||||||
|
ok(hres == S_OK, "click failed: %08x\n", hres);
|
||||||
|
|
||||||
|
CHECK_CALLED(div_onclick);
|
||||||
|
CHECK_CALLED(div_onclick_attached);
|
||||||
|
CHECK_CALLED(body_onclick);
|
||||||
|
CHECK_CALLED(document_onclick);
|
||||||
|
|
||||||
|
SET_EXPECT(div_onclick);
|
||||||
|
SET_EXPECT(div_onclick_attached);
|
||||||
|
SET_EXPECT(body_onclick);
|
||||||
|
SET_EXPECT(document_onclick);
|
||||||
|
|
||||||
|
V_VT(&v) = VT_EMPTY;
|
||||||
|
elem_fire_event((IUnknown*)div, "onclick", &v);
|
||||||
|
|
||||||
|
CHECK_CALLED(div_onclick);
|
||||||
|
CHECK_CALLED(div_onclick_attached);
|
||||||
|
CHECK_CALLED(body_onclick);
|
||||||
|
CHECK_CALLED(document_onclick);
|
||||||
|
|
||||||
|
cp_cookie = register_cp((IUnknown*)doc, &DIID_HTMLDocumentEvents, (IUnknown*)&doccp_obj);
|
||||||
|
|
||||||
|
SET_EXPECT(div_onclick);
|
||||||
|
SET_EXPECT(div_onclick_attached);
|
||||||
|
SET_EXPECT(body_onclick);
|
||||||
|
SET_EXPECT(document_onclick);
|
||||||
|
SET_EXPECT(doccp_onclick);
|
||||||
|
|
||||||
|
hres = IHTMLElement_click(div);
|
||||||
|
ok(hres == S_OK, "click failed: %08x\n", hres);
|
||||||
|
|
||||||
|
CHECK_CALLED(div_onclick);
|
||||||
|
CHECK_CALLED(div_onclick_attached);
|
||||||
|
CHECK_CALLED(body_onclick);
|
||||||
|
CHECK_CALLED(document_onclick);
|
||||||
|
CHECK_CALLED(doccp_onclick);
|
||||||
|
|
||||||
|
unregister_cp((IUnknown*)doc, &DIID_HTMLDocumentEvents, cp_cookie);
|
||||||
|
|
||||||
IHTMLElement_Release(div);
|
IHTMLElement_Release(div);
|
||||||
IHTMLElement_Release(body);
|
IHTMLElement_Release(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_onreadystatechange(IHTMLDocument2 *doc)
|
||||||
|
{
|
||||||
|
IHTMLFrameBase *iframe;
|
||||||
|
IHTMLElement2 *elem2;
|
||||||
|
IHTMLElement *elem;
|
||||||
|
VARIANT v;
|
||||||
|
BSTR str;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
elem = get_elem_id(doc, "iframe");
|
||||||
|
elem2 = get_elem2_iface((IUnknown*)elem);
|
||||||
|
IHTMLElement_Release(elem);
|
||||||
|
|
||||||
|
V_VT(&v) = VT_EMPTY;
|
||||||
|
hres = IHTMLElement2_get_onreadystatechange(elem2, &v);
|
||||||
|
ok(hres == S_OK, "get_onreadystatechange failed: %08x\n", hres);
|
||||||
|
ok(V_VT(&v) == VT_NULL, "V_VT(onreadystatechange) = %d\n", V_VT(&v));
|
||||||
|
|
||||||
|
V_VT(&v) = VT_DISPATCH;
|
||||||
|
V_DISPATCH(&v) = (IDispatch*)&iframe_onreadystatechange_obj;
|
||||||
|
hres = IHTMLElement2_put_onreadystatechange(elem2, v);
|
||||||
|
ok(hres == S_OK, "put_onreadystatechange failed: %08x\n", hres);
|
||||||
|
|
||||||
|
V_VT(&v) = VT_EMPTY;
|
||||||
|
hres = IHTMLElement2_get_onreadystatechange(elem2, &v);
|
||||||
|
ok(hres == S_OK, "get_onreadystatechange failed: %08x\n", hres);
|
||||||
|
ok(V_VT(&v) == VT_DISPATCH, "V_VT(onreadystatechange) = %d\n", V_VT(&v));
|
||||||
|
ok(V_DISPATCH(&v) == (IDispatch*)&iframe_onreadystatechange_obj, "unexpected onreadystatechange value\n");
|
||||||
|
|
||||||
|
hres = IHTMLElement2_QueryInterface(elem2, &IID_IHTMLFrameBase, (void**)&iframe);
|
||||||
|
IHTMLElement2_Release(elem2);
|
||||||
|
ok(hres == S_OK, "Could not get IHTMLFrameBase iface: %08x\n", hres);
|
||||||
|
|
||||||
|
hres = IHTMLFrameBase_put_src(iframe, (str = a2bstr("about:blank")));
|
||||||
|
SysFreeString(str);
|
||||||
|
ok(hres == S_OK, "put_src failed: %08x\n", hres);
|
||||||
|
|
||||||
|
SET_EXPECT(iframe_onreadystatechange_loading);
|
||||||
|
SET_EXPECT(iframe_onreadystatechange_interactive);
|
||||||
|
SET_EXPECT(iframe_onreadystatechange_complete);
|
||||||
|
pump_msgs(&called_iframe_onreadystatechange_complete);
|
||||||
|
todo_wine
|
||||||
|
CHECK_CALLED(iframe_onreadystatechange_loading);
|
||||||
|
CHECK_CALLED(iframe_onreadystatechange_interactive);
|
||||||
|
CHECK_CALLED(iframe_onreadystatechange_complete);
|
||||||
|
|
||||||
|
IHTMLFrameBase_Release(iframe);
|
||||||
|
}
|
||||||
|
|
||||||
static void test_timeout(IHTMLDocument2 *doc)
|
static void test_timeout(IHTMLDocument2 *doc)
|
||||||
{
|
{
|
||||||
IHTMLWindow3 *win3;
|
IHTMLWindow3 *win3;
|
||||||
|
@ -1462,12 +1774,23 @@ static void set_client_site(IHTMLDocument2 *doc, BOOL set)
|
||||||
static IHTMLDocument2 *create_document(void)
|
static IHTMLDocument2 *create_document(void)
|
||||||
{
|
{
|
||||||
IHTMLDocument2 *doc;
|
IHTMLDocument2 *doc;
|
||||||
|
IHTMLDocument5 *doc5;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
||||||
&IID_IHTMLDocument2, (void**)&doc);
|
&IID_IHTMLDocument2, (void**)&doc);
|
||||||
ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
|
ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
|
||||||
|
if (FAILED(hres))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
|
||||||
|
if(FAILED(hres)) {
|
||||||
|
win_skip("Could not get IHTMLDocument5 interface, probably too old IE\n");
|
||||||
|
IHTMLDocument2_Release(doc);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
IHTMLDocument5_Release(doc5);
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1478,11 +1801,13 @@ static void run_test(const char *str, testfunc_t test)
|
||||||
{
|
{
|
||||||
IHTMLDocument2 *doc;
|
IHTMLDocument2 *doc;
|
||||||
IHTMLElement *body = NULL;
|
IHTMLElement *body = NULL;
|
||||||
ULONG ref;
|
|
||||||
MSG msg;
|
MSG msg;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
|
xy_todo = FALSE;
|
||||||
doc = create_document();
|
doc = create_document();
|
||||||
|
if (!doc)
|
||||||
|
return;
|
||||||
set_client_site(doc, TRUE);
|
set_client_site(doc, TRUE);
|
||||||
doc_load_string(doc, str);
|
doc_load_string(doc, str);
|
||||||
do_advise((IUnknown*)doc, &IID_IPropertyNotifySink, (IUnknown*)&PropertyNotifySink);
|
do_advise((IUnknown*)doc, &IID_IPropertyNotifySink, (IUnknown*)&PropertyNotifySink);
|
||||||
|
@ -1511,8 +1836,7 @@ static void run_test(const char *str, testfunc_t test)
|
||||||
}
|
}
|
||||||
|
|
||||||
set_client_site(doc, FALSE);
|
set_client_site(doc, FALSE);
|
||||||
ref = IHTMLDocument2_Release(doc);
|
IHTMLDocument2_Release(doc);
|
||||||
ok(!ref, "ref = %d\n", ref);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static LRESULT WINAPI wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
static LRESULT WINAPI wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
|
@ -1548,6 +1872,7 @@ START_TEST(events)
|
||||||
|
|
||||||
run_test(empty_doc_str, test_timeout);
|
run_test(empty_doc_str, test_timeout);
|
||||||
run_test(click_doc_str, test_onclick);
|
run_test(click_doc_str, test_onclick);
|
||||||
|
run_test(readystate_doc_str, test_onreadystatechange);
|
||||||
|
|
||||||
DestroyWindow(container_hwnd);
|
DestroyWindow(container_hwnd);
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
|
|
File diff suppressed because it is too large
Load diff
368
rostests/winetests/mshtml/htmllocation.c
Normal file
368
rostests/winetests/mshtml/htmllocation.c
Normal file
|
@ -0,0 +1,368 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2009 Andrew Eikum for CodeWeavers
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define COBJMACROS
|
||||||
|
#define CONST_VTABLE
|
||||||
|
|
||||||
|
#include <wine/test.h>
|
||||||
|
|
||||||
|
#include "mshtml.h"
|
||||||
|
|
||||||
|
struct location_test {
|
||||||
|
const char *name;
|
||||||
|
const WCHAR *url;
|
||||||
|
|
||||||
|
const char *href;
|
||||||
|
const char *protocol;
|
||||||
|
const char *host;
|
||||||
|
const char *hostname;
|
||||||
|
const char *port;
|
||||||
|
const char *pathname;
|
||||||
|
const char *search;
|
||||||
|
const char *hash;
|
||||||
|
};
|
||||||
|
|
||||||
|
static const WCHAR http_url[] = {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g','?','s','e','a','r','c','h','#','h','a','s','h',0};
|
||||||
|
static const struct location_test http_test = {
|
||||||
|
"HTTP",
|
||||||
|
http_url,
|
||||||
|
"http://www.winehq.org/?search#hash",
|
||||||
|
"http:",
|
||||||
|
"www.winehq.org:80",
|
||||||
|
"www.winehq.org",
|
||||||
|
"80",
|
||||||
|
"",
|
||||||
|
"?search",
|
||||||
|
"#hash"
|
||||||
|
};
|
||||||
|
|
||||||
|
static const WCHAR http_file_url[] = {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','f','i','l','e','?','s','e','a','r','c','h','#','h','a','s','h',0};
|
||||||
|
static const struct location_test http_file_test = {
|
||||||
|
"HTTP with file",
|
||||||
|
http_file_url,
|
||||||
|
"http://www.winehq.org/file?search#hash",
|
||||||
|
"http:",
|
||||||
|
"www.winehq.org:80",
|
||||||
|
"www.winehq.org",
|
||||||
|
"80",
|
||||||
|
"file",
|
||||||
|
"?search",
|
||||||
|
"#hash"
|
||||||
|
};
|
||||||
|
|
||||||
|
static const WCHAR ftp_url[] = {'f','t','p',':','/','/','f','t','p','.','w','i','n','e','h','q','.','o','r','g','/',0};
|
||||||
|
static const struct location_test ftp_test = {
|
||||||
|
"FTP",
|
||||||
|
ftp_url,
|
||||||
|
"ftp://ftp.winehq.org/",
|
||||||
|
"ftp:",
|
||||||
|
"ftp.winehq.org:21",
|
||||||
|
"ftp.winehq.org",
|
||||||
|
"21",
|
||||||
|
"",
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static const WCHAR ftp_file_url[] = {'f','t','p',':','/','/','f','t','p','.','w','i','n','e','h','q','.','o','r','g','/','f','i','l','e',0};
|
||||||
|
static const struct location_test ftp_file_test = {
|
||||||
|
"FTP with file",
|
||||||
|
ftp_file_url,
|
||||||
|
"ftp://ftp.winehq.org/file",
|
||||||
|
"ftp:",
|
||||||
|
"ftp.winehq.org:21",
|
||||||
|
"ftp.winehq.org",
|
||||||
|
"21",
|
||||||
|
"file",
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static const WCHAR file_url[] = {'f','i','l','e',':','/','/','C',':','\\','w','i','n','d','o','w','s','\\','w','i','n','.','i','n','i',0};
|
||||||
|
static const struct location_test file_test = {
|
||||||
|
"FILE",
|
||||||
|
file_url,
|
||||||
|
"file:///C:/windows/win.ini",
|
||||||
|
"file:",
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
"",
|
||||||
|
"C:\\windows\\win.ini",
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static int str_eq_wa(LPCWSTR strw, const char *stra)
|
||||||
|
{
|
||||||
|
CHAR buf[512];
|
||||||
|
|
||||||
|
if(strw == NULL || stra == NULL){
|
||||||
|
if((void*)strw == (void*)stra)
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
|
||||||
|
return !lstrcmpA(stra, buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_href(IHTMLLocation *loc, const struct location_test *test)
|
||||||
|
{
|
||||||
|
HRESULT hres;
|
||||||
|
BSTR str;
|
||||||
|
|
||||||
|
hres = IHTMLLocation_get_href(loc, NULL);
|
||||||
|
ok(hres == E_POINTER,
|
||||||
|
"%s: get_href should have failed with E_POINTER (0x%08x), was: 0x%08x\n",
|
||||||
|
test->name, E_POINTER, hres);
|
||||||
|
|
||||||
|
hres = IHTMLLocation_get_href(loc, &str);
|
||||||
|
ok(hres == S_OK, "%s: get_href failed: 0x%08x\n", test->name, hres);
|
||||||
|
if(hres == S_OK)
|
||||||
|
ok(str_eq_wa(str, test->href),
|
||||||
|
"%s: expected retrieved href to be L\"%s\", was: %s\n",
|
||||||
|
test->name, test->href, wine_dbgstr_w(str));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_protocol(IHTMLLocation *loc, const struct location_test *test)
|
||||||
|
{
|
||||||
|
HRESULT hres;
|
||||||
|
BSTR str;
|
||||||
|
|
||||||
|
hres = IHTMLLocation_get_protocol(loc, NULL);
|
||||||
|
ok(hres == E_POINTER,
|
||||||
|
"%s: get_protocol should have failed with E_POINTER (0x%08x), was: 0x%08x\n",
|
||||||
|
test->name, E_POINTER, hres);
|
||||||
|
|
||||||
|
hres = IHTMLLocation_get_protocol(loc, &str);
|
||||||
|
ok(hres == S_OK, "%s: get_protocol failed: 0x%08x\n", test->name, hres);
|
||||||
|
if(hres == S_OK)
|
||||||
|
ok(str_eq_wa(str, test->protocol),
|
||||||
|
"%s: expected retrieved protocol to be L\"%s\", was: %s\n",
|
||||||
|
test->name, test->protocol, wine_dbgstr_w(str));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_host(IHTMLLocation *loc, const struct location_test *test)
|
||||||
|
{
|
||||||
|
HRESULT hres;
|
||||||
|
BSTR str;
|
||||||
|
|
||||||
|
hres = IHTMLLocation_get_host(loc, NULL);
|
||||||
|
ok(hres == E_POINTER,
|
||||||
|
"%s: get_host should have failed with E_POINTER (0x%08x), was: 0x%08x\n",
|
||||||
|
test->name, E_POINTER, hres);
|
||||||
|
|
||||||
|
hres = IHTMLLocation_get_host(loc, &str);
|
||||||
|
ok(hres == S_OK, "%s: get_host failed: 0x%08x\n", test->name, hres);
|
||||||
|
if(hres == S_OK)
|
||||||
|
ok(str_eq_wa(str, test->host),
|
||||||
|
"%s: expected retrieved host to be L\"%s\", was: %s\n",
|
||||||
|
test->name, test->host, wine_dbgstr_w(str));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_hostname(IHTMLLocation *loc, const struct location_test *test)
|
||||||
|
{
|
||||||
|
HRESULT hres;
|
||||||
|
BSTR str;
|
||||||
|
|
||||||
|
hres = IHTMLLocation_get_hostname(loc, NULL);
|
||||||
|
ok(hres == E_POINTER,
|
||||||
|
"%s: get_hostname should have failed with E_POINTER (0x%08x), was: 0x%08x\n",
|
||||||
|
test->name, E_POINTER, hres);
|
||||||
|
|
||||||
|
hres = IHTMLLocation_get_hostname(loc, &str);
|
||||||
|
ok(hres == S_OK, "%s: get_hostname failed: 0x%08x\n", test->name, hres);
|
||||||
|
if(hres == S_OK)
|
||||||
|
ok(str_eq_wa(str, test->hostname),
|
||||||
|
"%s: expected retrieved hostname to be L\"%s\", was: %s\n",
|
||||||
|
test->name, test->hostname, wine_dbgstr_w(str));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_port(IHTMLLocation *loc, const struct location_test *test)
|
||||||
|
{
|
||||||
|
HRESULT hres;
|
||||||
|
BSTR str;
|
||||||
|
|
||||||
|
hres = IHTMLLocation_get_port(loc, NULL);
|
||||||
|
ok(hres == E_POINTER,
|
||||||
|
"%s: get_port should have failed with E_POINTER (0x%08x), was: 0x%08x\n",
|
||||||
|
test->name, E_POINTER, hres);
|
||||||
|
|
||||||
|
hres = IHTMLLocation_get_port(loc, &str);
|
||||||
|
ok(hres == S_OK, "%s: get_port failed: 0x%08x\n", test->name, hres);
|
||||||
|
if(hres == S_OK)
|
||||||
|
ok(str_eq_wa(str, test->port),
|
||||||
|
"%s: expected retrieved port to be L\"%s\", was: %s\n",
|
||||||
|
test->name, test->port, wine_dbgstr_w(str));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_pathname(IHTMLLocation *loc, const struct location_test *test)
|
||||||
|
{
|
||||||
|
HRESULT hres;
|
||||||
|
BSTR str;
|
||||||
|
|
||||||
|
hres = IHTMLLocation_get_pathname(loc, NULL);
|
||||||
|
ok(hres == E_POINTER,
|
||||||
|
"%s: get_pathname should have failed with E_POINTER (0x%08x), was: 0x%08x\n",
|
||||||
|
test->name, E_POINTER, hres);
|
||||||
|
|
||||||
|
hres = IHTMLLocation_get_pathname(loc, &str);
|
||||||
|
ok(hres == S_OK, "%s: get_pathname failed: 0x%08x\n", test->name, hres);
|
||||||
|
if(hres == S_OK)
|
||||||
|
ok(str_eq_wa(str, test->pathname),
|
||||||
|
"%s: expected retrieved pathname to be L\"%s\", was: %s\n",
|
||||||
|
test->name, test->pathname, wine_dbgstr_w(str));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_search(IHTMLLocation *loc, const struct location_test *test)
|
||||||
|
{
|
||||||
|
HRESULT hres;
|
||||||
|
BSTR str;
|
||||||
|
|
||||||
|
hres = IHTMLLocation_get_search(loc, NULL);
|
||||||
|
ok(hres == E_POINTER,
|
||||||
|
"%s: get_search should have failed with E_POINTER (0x%08x), was: 0x%08x\n",
|
||||||
|
test->name, E_POINTER, hres);
|
||||||
|
|
||||||
|
hres = IHTMLLocation_get_search(loc, &str);
|
||||||
|
ok(hres == S_OK, "%s: get_search failed: 0x%08x\n", test->name, hres);
|
||||||
|
if(hres == S_OK)
|
||||||
|
ok(str_eq_wa(str, test->search),
|
||||||
|
"%s: expected retrieved search to be L\"%s\", was: %s\n",
|
||||||
|
test->name, test->search, wine_dbgstr_w(str));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_hash(IHTMLLocation *loc, const struct location_test *test)
|
||||||
|
{
|
||||||
|
HRESULT hres;
|
||||||
|
BSTR str;
|
||||||
|
|
||||||
|
hres = IHTMLLocation_get_hash(loc, NULL);
|
||||||
|
ok(hres == E_POINTER,
|
||||||
|
"%s: get_hash should have failed with E_POINTER (0x%08x), was: 0x%08x\n",
|
||||||
|
test->name, E_POINTER, hres);
|
||||||
|
|
||||||
|
hres = IHTMLLocation_get_hash(loc, &str);
|
||||||
|
ok(hres == S_OK, "%s: get_hash failed: 0x%08x\n", test->name, hres);
|
||||||
|
if(hres == S_OK)
|
||||||
|
ok(str_eq_wa(str, test->hash),
|
||||||
|
"%s: expected retrieved hash to be L\"%s\", was: %s\n",
|
||||||
|
test->name, test->hash, wine_dbgstr_w(str));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void perform_test(const struct location_test* test)
|
||||||
|
{
|
||||||
|
HRESULT hres;
|
||||||
|
IBindCtx *bc;
|
||||||
|
IMoniker *url_mon;
|
||||||
|
IPersistMoniker *persist_mon;
|
||||||
|
IHTMLDocument2 *doc;
|
||||||
|
IHTMLDocument6 *doc6;
|
||||||
|
IHTMLLocation *location;
|
||||||
|
|
||||||
|
hres = CreateBindCtx(0, &bc);
|
||||||
|
ok(hres == S_OK, "%s: CreateBindCtx failed: 0x%08x\n", test->name, hres);
|
||||||
|
if(FAILED(hres))
|
||||||
|
return;
|
||||||
|
|
||||||
|
hres = CreateURLMoniker(NULL, test->url, &url_mon);
|
||||||
|
ok(hres == S_OK, "%s: CreateURLMoniker failed: 0x%08x\n", test->name, hres);
|
||||||
|
if(FAILED(hres)){
|
||||||
|
IBindCtx_Release(bc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hres = CoCreateInstance(&CLSID_HTMLDocument, NULL,
|
||||||
|
CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER, &IID_IHTMLDocument2,
|
||||||
|
(void**)&doc);
|
||||||
|
ok(hres == S_OK, "%s: CoCreateInstance failed: 0x%08x\n", test->name, hres);
|
||||||
|
if(FAILED(hres)){
|
||||||
|
IMoniker_Release(url_mon);
|
||||||
|
IBindCtx_Release(bc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument6, (void**)&doc6);
|
||||||
|
if(hres == S_OK){
|
||||||
|
IHTMLDocument6_Release(doc6);
|
||||||
|
}else{
|
||||||
|
win_skip("%s: Could not get IHTMLDocument6, probably too old IE. Requires IE 8+\n", test->name);
|
||||||
|
IMoniker_Release(url_mon);
|
||||||
|
IBindCtx_Release(bc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistMoniker,
|
||||||
|
(void**)&persist_mon);
|
||||||
|
ok(hres == S_OK, "%s: IHTMlDocument2_QueryInterface failed: 0x%08x\n", test->name, hres);
|
||||||
|
if(FAILED(hres)){
|
||||||
|
IHTMLDocument2_Release(doc);
|
||||||
|
IMoniker_Release(url_mon);
|
||||||
|
IBindCtx_Release(bc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hres = IPersistMoniker_Load(persist_mon, FALSE, url_mon, bc,
|
||||||
|
STGM_SHARE_EXCLUSIVE | STGM_READWRITE);
|
||||||
|
ok(hres == S_OK, "%s: IPersistMoniker_Load failed: 0x%08x\n", test->name, hres);
|
||||||
|
if(FAILED(hres)){
|
||||||
|
IPersistMoniker_Release(persist_mon);
|
||||||
|
IHTMLDocument2_Release(doc);
|
||||||
|
IMoniker_Release(url_mon);
|
||||||
|
IBindCtx_Release(bc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hres = IHTMLDocument2_get_location(doc, &location);
|
||||||
|
ok(hres == S_OK, "%s: IHTMLDocument2_get_location failed: 0x%08x\n", test->name, hres);
|
||||||
|
if(FAILED(hres)){
|
||||||
|
IPersistMoniker_Release(persist_mon);
|
||||||
|
IHTMLDocument2_Release(doc);
|
||||||
|
IMoniker_Release(url_mon);
|
||||||
|
IBindCtx_Release(bc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
test_href(location, test);
|
||||||
|
test_protocol(location, test);
|
||||||
|
test_host(location, test);
|
||||||
|
test_hostname(location, test);
|
||||||
|
test_port(location, test);
|
||||||
|
test_pathname(location, test);
|
||||||
|
test_search(location, test);
|
||||||
|
test_hash(location, test);
|
||||||
|
|
||||||
|
IHTMLLocation_Release(location);
|
||||||
|
IPersistMoniker_Release(persist_mon);
|
||||||
|
IHTMLDocument2_Release(doc);
|
||||||
|
IMoniker_Release(url_mon);
|
||||||
|
IBindCtx_Release(bc);
|
||||||
|
}
|
||||||
|
|
||||||
|
START_TEST(htmllocation)
|
||||||
|
{
|
||||||
|
CoInitialize(NULL);
|
||||||
|
|
||||||
|
perform_test(&http_test);
|
||||||
|
perform_test(&http_file_test);
|
||||||
|
perform_test(&ftp_test);
|
||||||
|
perform_test(&ftp_file_test);
|
||||||
|
perform_test(&file_test);
|
||||||
|
|
||||||
|
CoUninitialize();
|
||||||
|
}
|
20
rostests/winetests/mshtml/jstest.html
Normal file
20
rostests/winetests/mshtml/jstest.html
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script>
|
||||||
|
function ok(b,m) {
|
||||||
|
return external.ok(b, m);
|
||||||
|
}
|
||||||
|
|
||||||
|
function runTest() {
|
||||||
|
obj = new Object();
|
||||||
|
ok(obj === window.obj, "obj !== window.obj");
|
||||||
|
|
||||||
|
ok(typeof(divid) === "object", "typeof(divid) = " + typeof(divid));
|
||||||
|
|
||||||
|
external.reportSuccess();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<body onload="runTest();">
|
||||||
|
<div id="divid"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -7,16 +7,20 @@
|
||||||
<file>dom.c</file>
|
<file>dom.c</file>
|
||||||
<file>events.c</file>
|
<file>events.c</file>
|
||||||
<file>htmldoc.c</file>
|
<file>htmldoc.c</file>
|
||||||
|
<file>htmllocation.c</file>
|
||||||
<file>misc.c</file>
|
<file>misc.c</file>
|
||||||
<file>protocol.c</file>
|
<file>protocol.c</file>
|
||||||
<file>script.c</file>
|
<file>script.c</file>
|
||||||
<file>testlist.c</file>
|
<file>testlist.c</file>
|
||||||
|
<file>rsrc.rc</file>
|
||||||
<library>wine</library>
|
<library>wine</library>
|
||||||
<library>uuid</library>
|
<library>uuid</library>
|
||||||
<library>strmiids</library>
|
<library>strmiids</library>
|
||||||
|
<library>wininet</library>
|
||||||
<library>ole32</library>
|
<library>ole32</library>
|
||||||
<library>oleaut32</library>
|
<library>oleaut32</library>
|
||||||
<library>user32</library>
|
<library>user32</library>
|
||||||
|
<library>gdi32</library>
|
||||||
<library>urlmon</library>
|
<library>urlmon</library>
|
||||||
<library>advapi32</library>
|
<library>advapi32</library>
|
||||||
<library>ntdll</library>
|
<library>ntdll</library>
|
||||||
|
|
20
rostests/winetests/mshtml/rsrc.rc
Normal file
20
rostests/winetests/mshtml/rsrc.rc
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2009 Jacek Caban
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* @makedep: jstest.html */
|
||||||
|
jstest.html HTML "jstest.html"
|
File diff suppressed because it is too large
Load diff
|
@ -9,6 +9,7 @@
|
||||||
extern void func_dom(void);
|
extern void func_dom(void);
|
||||||
extern void func_events(void);
|
extern void func_events(void);
|
||||||
extern void func_htmldoc(void);
|
extern void func_htmldoc(void);
|
||||||
|
extern void func_htmllocation(void);
|
||||||
extern void func_misc(void);
|
extern void func_misc(void);
|
||||||
extern void func_protocol(void);
|
extern void func_protocol(void);
|
||||||
extern void func_script(void);
|
extern void func_script(void);
|
||||||
|
@ -18,6 +19,7 @@ const struct test winetest_testlist[] =
|
||||||
{ "dom", func_dom },
|
{ "dom", func_dom },
|
||||||
{ "events", func_events },
|
{ "events", func_events },
|
||||||
{ "htmldoc", func_htmldoc },
|
{ "htmldoc", func_htmldoc },
|
||||||
|
{ "htmllocation", func_htmllocation },
|
||||||
{ "misc", func_misc },
|
{ "misc", func_misc },
|
||||||
{ "protocol", func_protocol },
|
{ "protocol", func_protocol },
|
||||||
{ "script", func_script },
|
{ "script", func_script },
|
||||||
|
|
Loading…
Reference in a new issue