mshtml: Implement complete prop for input elements.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
This commit is contained in:
Gabriel Ivăncescu 2023-04-12 18:34:59 +03:00 committed by Alexandre Julliard
parent 4cb364037f
commit 6b107d4181
3 changed files with 61 additions and 2 deletions

View file

@ -684,8 +684,17 @@ static HRESULT WINAPI HTMLInputElement_get_readyState(IHTMLInputElement *iface,
static HRESULT WINAPI HTMLInputElement_get_complete(IHTMLInputElement *iface, VARIANT_BOOL *p) static HRESULT WINAPI HTMLInputElement_get_complete(IHTMLInputElement *iface, VARIANT_BOOL *p)
{ {
HTMLInputElement *This = impl_from_IHTMLInputElement(iface); HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
FIXME("(%p)->(%p)\n", This, p); cpp_bool complete;
return E_NOTIMPL; 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) static HRESULT WINAPI HTMLInputElement_put_loop(IHTMLInputElement *iface, VARIANT v)

View file

@ -3987,6 +3987,7 @@ static void test_contenteditable(IUnknown *unk)
#define test_input_type(i,t) _test_input_type(__LINE__,i,t) #define test_input_type(i,t) _test_input_type(__LINE__,i,t)
static void _test_input_type(unsigned line, IHTMLInputElement *input, const WCHAR *extype) static void _test_input_type(unsigned line, IHTMLInputElement *input, const WCHAR *extype)
{ {
VARIANT_BOOL b;
BSTR type; BSTR type;
HRESULT hres; 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) (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)); ok_(__FILE__,line) (!lstrcmpW(type, extype), "type=%s, expected %s\n", wine_dbgstr_w(type), wine_dbgstr_w(extype));
SysFreeString(type); 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) #define test_input_name(u, c) _test_input_name(__LINE__,u, c)

View file

@ -2412,6 +2412,7 @@ static void test_inputload(IHTMLDocument2 *doc)
{ {
IHTMLInputElement *input; IHTMLInputElement *input;
IHTMLElement *elem; IHTMLElement *elem;
VARIANT_BOOL b;
VARIANT v; VARIANT v;
BSTR str; BSTR str;
HRESULT hres; 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"); ok(V_DISPATCH(&v) == (IDispatch*)&input_onload_obj, "V_DISPATCH(onload) != input_onload_obj\n");
VariantClear(&v); 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"); str = SysAllocString(L"http://test.winehq.org/tests/winehq_snapshot/index_files/winehq_logo_text.png?v=2");
hres = IHTMLInputElement_put_src(input, str); hres = IHTMLInputElement_put_src(input, str);
ok(hres == S_OK, "put_src failed: %08lx\n", hres); ok(hres == S_OK, "put_src failed: %08lx\n", hres);
SysFreeString(str); 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); SET_EXPECT(input_onload);
pump_msgs(&called_input_onload); pump_msgs(&called_input_onload);
CHECK_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); IHTMLInputElement_Release(input);
} }
@ -2494,15 +2507,37 @@ static void test_link_load(IHTMLDocument2 *doc)
static void test_focus(IHTMLDocument2 *doc) static void test_focus(IHTMLDocument2 *doc)
{ {
IHTMLInputElement *input;
IHTMLElement2 *elem2; IHTMLElement2 *elem2;
IHTMLElement4 *div; IHTMLElement4 *div;
IHTMLElement *elem; IHTMLElement *elem;
VARIANT_BOOL b;
VARIANT v; VARIANT v;
BSTR str;
HRESULT hres; HRESULT hres;
elem = get_elem_id(doc, L"inputid"); elem = get_elem_id(doc, L"inputid");
elem2 = get_elem2_iface((IUnknown*)elem); elem2 = get_elem2_iface((IUnknown*)elem);
hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLInputElement, (void**)&input);
IHTMLElement_Release(elem); 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"); elem = get_elem_id(doc, L"divid");
div = get_elem4_iface((IUnknown*)elem); div = get_elem4_iface((IUnknown*)elem);
@ -2779,7 +2814,9 @@ static void test_unload_event(IHTMLDocument2 *doc)
static void test_submit(IHTMLDocument2 *doc) static void test_submit(IHTMLDocument2 *doc)
{ {
IHTMLElement *elem, *submit; IHTMLElement *elem, *submit;
IHTMLInputElement *input;
IHTMLFormElement *form; IHTMLFormElement *form;
VARIANT_BOOL b;
VARIANT v; VARIANT v;
DWORD cp_cookie; DWORD cp_cookie;
HRESULT hres; HRESULT hres;
@ -2810,6 +2847,14 @@ static void test_submit(IHTMLDocument2 *doc)
submit = get_elem_id(doc, L"submitid"); 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_onclick);
SET_EXPECT(form_onsubmit); SET_EXPECT(form_onsubmit);
hres = IHTMLElement_click(submit); hres = IHTMLElement_click(submit);