mshtml: Add IHTMLSelectElement::name property implementation.
This commit is contained in:
parent
0c986f98ad
commit
f7b9dd9525
|
@ -205,40 +205,33 @@ static HRESULT WINAPI HTMLSelectElement_get_multiple(IHTMLSelectElement *iface,
|
|||
static HRESULT WINAPI HTMLSelectElement_put_name(IHTMLSelectElement *iface, BSTR v)
|
||||
{
|
||||
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
||||
return E_NOTIMPL;
|
||||
nsAString str;
|
||||
nsresult nsres;
|
||||
|
||||
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
||||
nsAString_InitDepend(&str, v);
|
||||
nsres = nsIDOMHTMLSelectElement_SetName(This->nsselect, &str);
|
||||
nsAString_Finish(&str);
|
||||
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("SetName failed: %08x\n", nsres);
|
||||
return E_FAIL;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLSelectElement_get_name(IHTMLSelectElement *iface, BSTR *p)
|
||||
{
|
||||
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
|
||||
nsAString name_str;
|
||||
const PRUnichar *name = NULL;
|
||||
nsresult nsres;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
nsAString_Init(&name_str, NULL);
|
||||
|
||||
nsres = nsIDOMHTMLSelectElement_GetName(This->nsselect, &name_str);
|
||||
if(NS_SUCCEEDED(nsres)) {
|
||||
static const WCHAR wszGarbage[] = {'g','a','r','b','a','g','e',0};
|
||||
|
||||
nsAString_GetData(&name_str, &name);
|
||||
|
||||
/*
|
||||
* Native never returns empty string here. If an element has no name,
|
||||
* name of previous element or ramdom data is returned.
|
||||
*/
|
||||
*p = SysAllocString(*name ? name : wszGarbage);
|
||||
}else {
|
||||
ERR("GetName failed: %08x\n", nsres);
|
||||
}
|
||||
|
||||
nsAString_Finish(&name_str);
|
||||
|
||||
TRACE("name=%s\n", debugstr_w(*p));
|
||||
return S_OK;
|
||||
return return_nsstr(nsres, &name_str, p);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLSelectElement_get_options(IHTMLSelectElement *iface, IDispatch **p)
|
||||
|
|
|
@ -2217,6 +2217,37 @@ static void _test_select_set_size(unsigned line, IHTMLSelectElement *select, LON
|
|||
ok_(__FILE__,line) (hres == exhres, "put_size(%d) got %08x, expect %08x\n", val, hres, exhres);
|
||||
}
|
||||
|
||||
#define test_select_name(s,v) _test_select_name(__LINE__,s,v)
|
||||
static void _test_select_name(unsigned line, IHTMLSelectElement *select, const char *extext)
|
||||
{
|
||||
HRESULT hres;
|
||||
BSTR text;
|
||||
|
||||
text = NULL;
|
||||
hres = IHTMLSelectElement_get_name(select, &text);
|
||||
ok_(__FILE__,line) (hres == S_OK, "get_name failed: %08x\n", hres);
|
||||
if(extext) {
|
||||
ok_(__FILE__,line) (text != NULL, "text == NULL\n");
|
||||
ok_(__FILE__,line) (!strcmp_wa(text, extext), "name = %s, expected %s\n",
|
||||
wine_dbgstr_w(text), extext);
|
||||
SysFreeString(text);
|
||||
} else
|
||||
ok_(__FILE__,line) (text == NULL, "text(%p) = %s\n", text, wine_dbgstr_w(text));
|
||||
}
|
||||
|
||||
#define test_select_set_name(s,v) _test_select_set_name(__LINE__,s,v)
|
||||
static void _test_select_set_name(unsigned line, IHTMLSelectElement *select, const char *text)
|
||||
{
|
||||
HRESULT hres;
|
||||
BSTR bstr;
|
||||
|
||||
bstr = a2bstr(text);
|
||||
|
||||
hres = IHTMLSelectElement_put_name(select, bstr);
|
||||
ok_(__FILE__,line) (hres == S_OK, "put_name(%s) failed: %08x\n", wine_dbgstr_w(bstr), hres);
|
||||
SysFreeString(bstr);
|
||||
}
|
||||
|
||||
#define test_range_text(r,t) _test_range_text(__LINE__,r,t)
|
||||
static void _test_range_text(unsigned line, IHTMLTxtRange *range, const char *extext)
|
||||
{
|
||||
|
@ -4914,6 +4945,10 @@ static void test_select_elem(IHTMLSelectElement *select)
|
|||
test_select_set_size(select, 3, S_OK);
|
||||
test_select_size(select, 3);
|
||||
|
||||
test_select_name(select, NULL);
|
||||
test_select_set_name(select, "select-name");
|
||||
test_select_name(select, "select-name");
|
||||
|
||||
test_select_get_disabled(select, VARIANT_FALSE);
|
||||
test_select_set_disabled(select, VARIANT_TRUE);
|
||||
test_select_set_disabled(select, VARIANT_FALSE);
|
||||
|
|
Loading…
Reference in New Issue