Commit 6b107d41 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Implement `complete` prop for input elements.

parent 4cb36403
......@@ -684,8 +684,17 @@ static HRESULT WINAPI HTMLInputElement_get_readyState(IHTMLInputElement *iface,
static HRESULT WINAPI HTMLInputElement_get_complete(IHTMLInputElement *iface, VARIANT_BOOL *p)
{
HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
cpp_bool complete;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
nsres = nsIDOMHTMLInputElement_GetComplete(This->nsinput, &complete);
if(NS_FAILED(nsres))
return map_nsresult(nsres);
*p = variant_bool(complete);
return S_OK;
}
static HRESULT WINAPI HTMLInputElement_put_loop(IHTMLInputElement *iface, VARIANT v)
......
......@@ -3987,6 +3987,7 @@ static void test_contenteditable(IUnknown *unk)
#define test_input_type(i,t) _test_input_type(__LINE__,i,t)
static void _test_input_type(unsigned line, IHTMLInputElement *input, const WCHAR *extype)
{
VARIANT_BOOL b;
BSTR type;
HRESULT hres;
......@@ -3994,6 +3995,10 @@ static void _test_input_type(unsigned line, IHTMLInputElement *input, const WCHA
ok_(__FILE__,line) (hres == S_OK, "get_type failed: %08lx\n", hres);
ok_(__FILE__,line) (!lstrcmpW(type, extype), "type=%s, expected %s\n", wine_dbgstr_w(type), wine_dbgstr_w(extype));
SysFreeString(type);
hres = IHTMLInputElement_get_complete(input, &b);
ok_(__FILE__,line) (hres == S_OK, "get_complete failed: %08lx\n", hres);
ok(b == VARIANT_FALSE, "complete = %x\n", b);
}
#define test_input_name(u, c) _test_input_name(__LINE__,u, c)
......
......@@ -2412,6 +2412,7 @@ static void test_inputload(IHTMLDocument2 *doc)
{
IHTMLInputElement *input;
IHTMLElement *elem;
VARIANT_BOOL b;
VARIANT v;
BSTR str;
HRESULT hres;
......@@ -2438,15 +2439,27 @@ static void test_inputload(IHTMLDocument2 *doc)
ok(V_DISPATCH(&v) == (IDispatch*)&input_onload_obj, "V_DISPATCH(onload) != input_onload_obj\n");
VariantClear(&v);
hres = IHTMLInputElement_get_complete(input, &b);
ok(hres == S_OK, "get_complete failed: %08lx\n", hres);
ok(b == VARIANT_FALSE, "complete = %x\n", b);
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);
hres = IHTMLInputElement_get_complete(input, &b);
ok(hres == S_OK, "get_complete failed: %08lx\n", hres);
ok(b == VARIANT_FALSE, "complete = %x\n", b);
SET_EXPECT(input_onload);
pump_msgs(&called_input_onload);
CHECK_CALLED(input_onload);
hres = IHTMLInputElement_get_complete(input, &b);
ok(hres == S_OK, "get_complete failed: %08lx\n", hres);
ok(b == VARIANT_TRUE, "complete = %x\n", b);
IHTMLInputElement_Release(input);
}
......@@ -2494,15 +2507,37 @@ static void test_link_load(IHTMLDocument2 *doc)
static void test_focus(IHTMLDocument2 *doc)
{
IHTMLInputElement *input;
IHTMLElement2 *elem2;
IHTMLElement4 *div;
IHTMLElement *elem;
VARIANT_BOOL b;
VARIANT v;
BSTR str;
HRESULT hres;
elem = get_elem_id(doc, L"inputid");
elem2 = get_elem2_iface((IUnknown*)elem);
hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLInputElement, (void**)&input);
IHTMLElement_Release(elem);
ok(hres == S_OK, "Could not get IHTMLInputElement iface: %08lx\n", hres);
hres = IHTMLInputElement_get_complete(input, &b);
ok(hres == S_OK, "get_complete failed: %08lx\n", hres);
ok(b == VARIANT_FALSE, "complete = %x\n", b);
str = SysAllocString(L"http://test.winehq.org/tests/winehq_snapshot/index_files/winehq_logo_text.png?v=3");
hres = IHTMLInputElement_put_src(input, str);
ok(hres == S_OK, "put_src failed: %08lx\n", hres);
SysFreeString(str);
pump_msgs(NULL);
hres = IHTMLInputElement_get_complete(input, &b);
ok(hres == S_OK, "get_complete failed: %08lx\n", hres);
ok(b == VARIANT_FALSE, "complete = %x\n", b);
IHTMLInputElement_Release(input);
elem = get_elem_id(doc, L"divid");
div = get_elem4_iface((IUnknown*)elem);
......@@ -2779,7 +2814,9 @@ static void test_unload_event(IHTMLDocument2 *doc)
static void test_submit(IHTMLDocument2 *doc)
{
IHTMLElement *elem, *submit;
IHTMLInputElement *input;
IHTMLFormElement *form;
VARIANT_BOOL b;
VARIANT v;
DWORD cp_cookie;
HRESULT hres;
......@@ -2810,6 +2847,14 @@ static void test_submit(IHTMLDocument2 *doc)
submit = get_elem_id(doc, L"submitid");
hres = IHTMLElement_QueryInterface(submit, &IID_IHTMLInputElement, (void**)&input);
ok(hres == S_OK, "Could not get IHTMLInputElement iface: %08lx\n", hres);
hres = IHTMLInputElement_get_complete(input, &b);
ok(hres == S_OK, "get_complete failed: %08lx\n", hres);
ok(b == VARIANT_FALSE, "complete = %x\n", b);
IHTMLInputElement_Release(input);
SET_EXPECT(form_onclick);
SET_EXPECT(form_onsubmit);
hres = IHTMLElement_click(submit);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment