From 9fa1570fe67b067a83417e08807612612b8edce3 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 18 Mar 2013 14:06:29 +0100 Subject: [PATCH] mshtml: Added IHTMLButtonElement::name tests. --- dlls/mshtml/tests/dom.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 2e4e3d8c043..54bb68c4761 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -913,6 +913,17 @@ static IHTMLIFrameElement2 *_get_iframe2_iface(unsigned line, IUnknown *unk) return ret; } +#define get_button_iface(u) _get_button_iface(__LINE__,u) +static IHTMLButtonElement *_get_button_iface(unsigned line, IUnknown *unk) +{ + IHTMLButtonElement *ret; + HRESULT hres; + + hres = IUnknown_QueryInterface(unk, &IID_IHTMLButtonElement, (void**)&ret); + ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLButtonElement: %08x\n", hres); + return ret; +} + #define test_node_name(u,n) _test_node_name(__LINE__,u,n) static void _test_node_name(unsigned line, IUnknown *unk, const char *exname) { @@ -5348,6 +5359,45 @@ static void test_defaults(IHTMLDocument2 *doc) test_doc_title(doc, ""); } +#define test_button_name(a,b) _test_button_name(__LINE__,a,b) +static void _test_button_name(unsigned line, IHTMLElement *elem, const char *exname) +{ + IHTMLButtonElement *button = _get_button_iface(line, (IUnknown*)elem); + BSTR str; + HRESULT hres; + + str = (void*)0xdeadbeef; + hres = IHTMLButtonElement_get_name(button, &str); + ok_(__FILE__,line)(hres == S_OK, "get_name failed: %08x\n", hres); + if(exname) + ok_(__FILE__,line)(!strcmp_wa(str, exname), "name = %s, expected %s\n", wine_dbgstr_w(str), exname); + else + ok_(__FILE__,line)(!str, "name = %s, expected NULL\n", wine_dbgstr_w(str)); + SysFreeString(str); + IHTMLButtonElement_Release(button); +} + +#define set_button_name(a,b) _set_button_name(__LINE__,a,b) +static void _set_button_name(unsigned line, IHTMLElement *elem, const char *name) +{ + IHTMLButtonElement *button = _get_button_iface(line, (IUnknown*)elem); + BSTR str = a2bstr(name); + HRESULT hres; + + hres = IHTMLButtonElement_put_name(button, str); + ok_(__FILE__,line)(hres == S_OK, "get_name failed: %08x\n", hres); + SysFreeString(str); + IHTMLButtonElement_Release(button); + + _test_button_name(line, elem, name); +} + +static void test_button_elem(IHTMLElement *elem) +{ + test_button_name(elem, NULL); + set_button_name(elem, "button name"); +} + static void test_tr_elem(IHTMLElement *elem) { IHTMLElementCollection *col; @@ -6097,6 +6147,13 @@ static void test_elems(IHTMLDocument2 *doc) IHTMLElement_Release(elem); } + elem = get_doc_elem_by_id(doc, "btnid"); + ok(elem != NULL, "elem == NULL\n"); + if(elem) { + test_button_elem(elem); + IHTMLElement_Release(elem); + } + elem = get_doc_elem_by_id(doc, "objid"); ok(elem != NULL, "elem == NULL\n"); if(elem) { -- 2.11.4.GIT