mshtml: Added IHTMLSelectElement::get_type implementation.

This commit is contained in:
Jacek Caban 2008-06-24 15:24:59 -05:00 committed by Alexandre Julliard
parent 9338979c11
commit 1d6c28459b
2 changed files with 32 additions and 2 deletions

View File

@ -223,8 +223,26 @@ static HRESULT WINAPI HTMLSelectElement_get_selectedIndex(IHTMLSelectElement *if
static HRESULT WINAPI HTMLSelectElement_get_type(IHTMLSelectElement *iface, BSTR *p) static HRESULT WINAPI HTMLSelectElement_get_type(IHTMLSelectElement *iface, BSTR *p)
{ {
HTMLSelectElement *This = HTMLSELECT_THIS(iface); HTMLSelectElement *This = HTMLSELECT_THIS(iface);
FIXME("(%p)->(%p)\n", This, p); const PRUnichar *type;
return E_NOTIMPL; nsAString type_str;
nsresult nsres;
HRESULT hres = S_OK;
TRACE("(%p)->(%p)\n", This, p);
nsAString_Init(&type_str, NULL);
nsres = nsIDOMHTMLSelectElement_GetType(This->nsselect, &type_str);
if(NS_SUCCEEDED(nsres)) {
nsAString_GetData(&type_str, &type);
*p = *type ? SysAllocString(type) : NULL;
}else {
ERR("GetType failed: %08x\n", nsres);
hres = E_FAIL;
}
nsAString_Finish(&type_str);
return hres;
} }
static HRESULT WINAPI HTMLSelectElement_put_value(IHTMLSelectElement *iface, BSTR v) static HRESULT WINAPI HTMLSelectElement_put_value(IHTMLSelectElement *iface, BSTR v)

View File

@ -656,6 +656,17 @@ static void _test_select_set_value(unsigned line, IHTMLSelectElement *select, co
ok_(__FILE__,line) (hres == S_OK, "put_value failed: %08x\n", hres); ok_(__FILE__,line) (hres == S_OK, "put_value failed: %08x\n", hres);
} }
#define test_select_type(s,t) _test_select_type(__LINE__,s,t)
static void _test_select_type(unsigned line, IHTMLSelectElement *select, const char *extype)
{
BSTR type;
HRESULT hres;
hres = IHTMLSelectElement_get_type(select, &type);
ok_(__FILE__,line) (hres == S_OK, "get_type failed: %08x\n", hres);
ok_(__FILE__,line) (!strcmp_wa(type, extype), "type=%s, expected %s\n", dbgstr_w(type), extype);
}
#define test_range_text(r,t) _test_range_text(__LINE__,r,t) #define test_range_text(r,t) _test_range_text(__LINE__,r,t)
static void _test_range_text(unsigned line, IHTMLTxtRange *range, const char *extext) static void _test_range_text(unsigned line, IHTMLTxtRange *range, const char *extext)
{ {
@ -1368,6 +1379,7 @@ static IHTMLElement *get_doc_elem_by_id(IHTMLDocument2 *doc, LPCWSTR id)
static void test_select_elem(IHTMLSelectElement *select) static void test_select_elem(IHTMLSelectElement *select)
{ {
test_select_type(select, "select-one");
test_select_length(select, 2); test_select_length(select, 2);
test_select_selidx(select, 0); test_select_selidx(select, 0);
test_select_put_selidx(select, 1); test_select_put_selidx(select, 1);