mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
mshtml: Added IHTMLElement::language property implementation.
This commit is contained in:
parent
120422e93b
commit
c6c0c6b52a
3 changed files with 54 additions and 4 deletions
|
@ -837,18 +837,24 @@ static HRESULT WINAPI HTMLElement_get_title(IHTMLElement *iface, BSTR *p)
|
|||
return return_nsstr(nsres, &title_str, p);
|
||||
}
|
||||
|
||||
static const WCHAR languageW[] = {'l','a','n','g','u','a','g','e',0};
|
||||
|
||||
static HRESULT WINAPI HTMLElement_put_language(IHTMLElement *iface, BSTR v)
|
||||
{
|
||||
HTMLElement *This = impl_from_IHTMLElement(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
||||
|
||||
return elem_string_attr_setter(This, languageW, v);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLElement_get_language(IHTMLElement *iface, BSTR *p)
|
||||
{
|
||||
HTMLElement *This = impl_from_IHTMLElement(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
return elem_string_attr_getter(This, languageW, TRUE, p);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLElement_put_onselectstart(IHTMLElement *iface, VARIANT v)
|
||||
|
|
|
@ -3138,6 +3138,36 @@ static void _test_elem_id(unsigned line, IUnknown *unk, const char *exid)
|
|||
SysFreeString(id);
|
||||
}
|
||||
|
||||
#define test_elem_language(e,i) _test_elem_language(__LINE__,e,i)
|
||||
static void _test_elem_language(unsigned line, IHTMLElement *elem, const char *exlang)
|
||||
{
|
||||
BSTR lang = (void*)0xdeadbeef;
|
||||
HRESULT hres;
|
||||
|
||||
hres = IHTMLElement_get_language(elem, &lang);
|
||||
ok_(__FILE__,line) (hres == S_OK, "get_language failed: %08x\n", hres);
|
||||
|
||||
if(exlang)
|
||||
ok_(__FILE__,line) (!strcmp_wa(lang, exlang), "unexpected language %s\n", wine_dbgstr_w(lang));
|
||||
else
|
||||
ok_(__FILE__,line) (!lang, "language=%s\n", wine_dbgstr_w(lang));
|
||||
|
||||
SysFreeString(lang);
|
||||
}
|
||||
|
||||
#define set_elem_language(e,i) _set_elem_language(__LINE__,e,i)
|
||||
static void _set_elem_language(unsigned line, IHTMLElement *elem, const char *lang)
|
||||
{
|
||||
BSTR str = a2bstr(lang);
|
||||
HRESULT hres;
|
||||
|
||||
hres = IHTMLElement_put_language(elem, str);
|
||||
ok_(__FILE__,line) (hres == S_OK, "get_language failed: %08x\n", hres);
|
||||
SysFreeString(str);
|
||||
|
||||
_test_elem_language(line, elem, lang);
|
||||
}
|
||||
|
||||
#define test_elem_put_id(u,i) _test_elem_put_id(__LINE__,u,i)
|
||||
static void _test_elem_put_id(unsigned line, IUnknown *unk, const char *new_id)
|
||||
{
|
||||
|
@ -7135,6 +7165,8 @@ static void test_elems(IHTMLDocument2 *doc)
|
|||
hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLScriptElement, (void**)&script);
|
||||
ok(hres == S_OK, "Could not get IHTMLScriptElement interface: %08x\n", hres);
|
||||
|
||||
test_elem_language(elem, NULL);
|
||||
|
||||
if(hres == S_OK)
|
||||
{
|
||||
VARIANT_BOOL vb;
|
||||
|
@ -7174,6 +7206,9 @@ static void test_elems(IHTMLDocument2 *doc)
|
|||
}
|
||||
|
||||
IHTMLScriptElement_Release(script);
|
||||
|
||||
set_elem_language(elem, "vbscript");
|
||||
set_elem_language(elem, "xxx");
|
||||
}
|
||||
|
||||
elem = get_elem_by_id(doc, "in", TRUE);
|
||||
|
|
|
@ -215,6 +215,14 @@ function test_whitespace_nodes() {
|
|||
"t.rows[0].cells[0].childNodes.length = " + t.rows[0].cells[0].childNodes.length);
|
||||
}
|
||||
|
||||
function test_language_attribute() {
|
||||
document.body.innerHTML = '<div id="did" language="test"></div>';
|
||||
var elem = document.getElementById("did");
|
||||
ok(elem.language === "test", "elem.language = " + elem.language);
|
||||
elem.language = 1;
|
||||
ok(elem.language === "1", "elem.language = " + elem.language);
|
||||
}
|
||||
|
||||
var globalVar = false;
|
||||
|
||||
function runTests() {
|
||||
|
@ -238,6 +246,7 @@ function runTests() {
|
|||
test_forin();
|
||||
test_customtag();
|
||||
test_whitespace_nodes();
|
||||
test_language_attribute();
|
||||
|
||||
var r = window.execScript("globalVar = true;");
|
||||
ok(r === undefined, "execScript returned " + r);
|
||||
|
|
Loading…
Reference in a new issue