mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-15 03:04:47 +00:00
mshtml: Implement onload
prop for input elements.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
This commit is contained in:
parent
2865a5f113
commit
12213e13ab
|
@ -719,15 +719,19 @@ static HRESULT WINAPI HTMLInputElement_get_align(IHTMLInputElement *iface, BSTR
|
|||
static HRESULT WINAPI HTMLInputElement_put_onload(IHTMLInputElement *iface, VARIANT v)
|
||||
{
|
||||
HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
|
||||
FIXME("(%p)->()\n", This);
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->()\n", This);
|
||||
|
||||
return set_node_event(&This->element.node, EVENTID_LOAD, &v);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLInputElement_get_onload(IHTMLInputElement *iface, VARIANT *p)
|
||||
{
|
||||
HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
return get_node_event(&This->element.node, EVENTID_LOAD, p);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLInputElement_put_onerror(IHTMLInputElement *iface, VARIANT v)
|
||||
|
|
|
@ -83,6 +83,7 @@ DEFINE_EXPECT(iframe_onreadystatechange_complete);
|
|||
DEFINE_EXPECT(iframedoc_onreadystatechange);
|
||||
DEFINE_EXPECT(img_onload);
|
||||
DEFINE_EXPECT(img_onerror);
|
||||
DEFINE_EXPECT(input_onload);
|
||||
DEFINE_EXPECT(link_onload);
|
||||
DEFINE_EXPECT(input_onfocus);
|
||||
DEFINE_EXPECT(input_onblur);
|
||||
|
@ -146,6 +147,9 @@ static const char readystate_doc_ie9_str[] =
|
|||
static const char img_doc_str[] =
|
||||
"<html><body><img id=\"imgid\"></img></body></html>";
|
||||
|
||||
static const char input_image_doc_str[] =
|
||||
"<html><body><input type=\"image\" id=\"inputid\"></input></body></html>";
|
||||
|
||||
static const char link_doc_str[] =
|
||||
"<html><body><link id=\"linkid\" rel=\"stylesheet\" type=\"text/css\"></link></body></html>";
|
||||
|
||||
|
@ -1086,6 +1090,17 @@ static HRESULT WINAPI img_onload(IDispatchEx *iface, DISPID id, LCID lcid, WORD
|
|||
|
||||
EVENT_HANDLER_FUNC_OBJ(img_onload);
|
||||
|
||||
static HRESULT WINAPI input_onload(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
||||
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
||||
{
|
||||
CHECK_EXPECT(input_onload);
|
||||
test_event_args(&DIID_DispHTMLInputElement, id, wFlags, pdp, pvarRes, pei, pspCaller);
|
||||
test_event_src(L"INPUT");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
EVENT_HANDLER_FUNC_OBJ(input_onload);
|
||||
|
||||
static HRESULT WINAPI link_onload(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
||||
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
||||
{
|
||||
|
@ -2349,6 +2364,48 @@ static void test_imgload(IHTMLDocument2 *doc)
|
|||
IHTMLImgElement_Release(img);
|
||||
}
|
||||
|
||||
static void test_inputload(IHTMLDocument2 *doc)
|
||||
{
|
||||
IHTMLInputElement *input;
|
||||
IHTMLElement *elem;
|
||||
VARIANT v;
|
||||
BSTR str;
|
||||
HRESULT hres;
|
||||
|
||||
elem = get_elem_id(doc, L"inputid");
|
||||
hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLInputElement, (void**)&input);
|
||||
IHTMLElement_Release(elem);
|
||||
ok(hres == S_OK, "Could not get IHTMLInputElement iface: %08lx\n", hres);
|
||||
|
||||
V_VT(&v) = VT_EMPTY;
|
||||
hres = IHTMLInputElement_get_onload(input, &v);
|
||||
ok(hres == S_OK, "get_onload failed: %08lx\n", hres);
|
||||
ok(V_VT(&v) == VT_NULL, "V_VT(onload) = %d\n", V_VT(&v));
|
||||
|
||||
V_VT(&v) = VT_DISPATCH;
|
||||
V_DISPATCH(&v) = (IDispatch*)&input_onload_obj;
|
||||
hres = IHTMLInputElement_put_onload(input, v);
|
||||
ok(hres == S_OK, "put_onload failed: %08lx\n", hres);
|
||||
|
||||
V_VT(&v) = VT_EMPTY;
|
||||
hres = IHTMLInputElement_get_onload(input, &v);
|
||||
ok(hres == S_OK, "get_onload failed: %08lx\n", hres);
|
||||
ok(V_VT(&v) == VT_DISPATCH, "V_VT(onload) = %d\n", V_VT(&v));
|
||||
ok(V_DISPATCH(&v) == (IDispatch*)&input_onload_obj, "V_DISPATCH(onload) != input_onload_obj\n");
|
||||
VariantClear(&v);
|
||||
|
||||
str = SysAllocString(L"http://test.winehq.org/tests/winehq_snapshot/index_files/winehq_logo_text.png?v=2");
|
||||
hres = IHTMLInputElement_put_src(input, str);
|
||||
ok(hres == S_OK, "put_src failed: %08lx\n", hres);
|
||||
SysFreeString(str);
|
||||
|
||||
SET_EXPECT(input_onload);
|
||||
pump_msgs(&called_input_onload);
|
||||
CHECK_CALLED(input_onload);
|
||||
|
||||
IHTMLInputElement_Release(input);
|
||||
}
|
||||
|
||||
static void test_link_load(IHTMLDocument2 *doc)
|
||||
{
|
||||
IHTMLLinkElement *link;
|
||||
|
@ -5776,6 +5833,7 @@ START_TEST(events)
|
|||
run_test(readystate_doc_str, test_onreadystatechange);
|
||||
run_test(readystate_doc_ie9_str, test_onreadystatechange);
|
||||
run_test(img_doc_str, test_imgload);
|
||||
run_test(input_image_doc_str, test_inputload);
|
||||
run_test(link_doc_str, test_link_load);
|
||||
run_test(input_doc_str, test_focus);
|
||||
run_test(empty_doc_str, test_submit);
|
||||
|
|
Loading…
Reference in a new issue