Module: wine Branch: master Commit: 95ded555e0daf54ad404de3d69f20483b65c781b URL: http://source.winehq.org/git/wine.git/?a=commit;h=95ded555e0daf54ad404de3d69...
Author: Jacek Caban jacek@codeweavers.com Date: Fri May 7 15:19:48 2010 +0200
mshtml: Added IHTMLFormElement::get_length implementation.
---
dlls/mshtml/htmlform.c | 15 +++++++++++++-- dlls/mshtml/tests/dom.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/htmlform.c b/dlls/mshtml/htmlform.c index 6886056..c33937d 100644 --- a/dlls/mshtml/htmlform.c +++ b/dlls/mshtml/htmlform.c @@ -238,8 +238,19 @@ static HRESULT WINAPI HTMLFormElement_put_length(IHTMLFormElement *iface, LONG v static HRESULT WINAPI HTMLFormElement_get_length(IHTMLFormElement *iface, LONG *p) { HTMLFormElement *This = HTMLFORM_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + PRInt32 length; + nsresult nsres; + + TRACE("(%p)->(%p)\n", This, p); + + nsres = nsIDOMHTMLFormElement_GetLength(This->nsform, &length); + if(NS_FAILED(nsres)) { + ERR("GetLength failed: %08x\n", nsres); + return E_FAIL; + } + + *p = length; + return S_OK; }
static HRESULT WINAPI HTMLFormElement__newEnum(IHTMLFormElement *iface, IUnknown **p) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 58ecec2..6f33ee2 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -684,6 +684,17 @@ static IHTMLSelectElement *_get_select_iface(unsigned line, IUnknown *unk) return select; }
+#define get_form_iface(u) _get_form_iface(__LINE__,u) +static IHTMLFormElement *_get_form_iface(unsigned line, IUnknown *unk) +{ + IHTMLFormElement *form; + HRESULT hres; + + hres = IUnknown_QueryInterface(unk, &IID_IHTMLFormElement, (void**)&form); + ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLFormElement: %08x\n", hres); + return form; +} + #define get_text_iface(u) _get_text_iface(__LINE__,u) static IHTMLDOMTextNode *_get_text_iface(unsigned line, IUnknown *unk) { @@ -2389,6 +2400,20 @@ static void _test_elem_client_rect(unsigned line, IUnknown *unk) IHTMLElement2_Release(elem); }
+#define test_form_length(e,l) _test_form_length(__LINE__,e,l) +static void _test_form_length(unsigned line, IUnknown *unk, LONG exlen) +{ + IHTMLFormElement *form = _get_form_iface(line, unk); + LONG len = 0xdeadbeef; + HRESULT hres; + + hres = IHTMLFormElement_get_length(form, &len); + ok_(__FILE__,line)(hres == S_OK, "get_length failed: %08x\n", hres); + ok_(__FILE__,line)(len == exlen, "length=%d, expected %d\n", len, exlen); + + IHTMLFormElement_Release(form); +} + #define get_elem_doc(e) _get_elem_doc(__LINE__,e) static IHTMLDocument2 *_get_elem_doc(unsigned line, IUnknown *unk) { @@ -5818,6 +5843,13 @@ static void test_elems(IHTMLDocument2 *doc)
IHTMLElement_Release(elem);
+ elem = get_doc_elem_by_id(doc, "frm"); + ok(elem != NULL, "elem == NULL\n"); + if(elem) { + test_form_length((IUnknown*)elem, 0); + IHTMLElement_Release(elem); + } + test_stylesheets(doc); test_create_option_elem(doc); test_create_img_elem(doc);