mshtml: Added IHTMLDOMNode::get_nodeValue implementation.

This commit is contained in:
Jacek Caban 2008-06-18 17:06:00 -05:00 committed by Alexandre Julliard
parent 0cb99eef5a
commit 26e23bdd07
2 changed files with 55 additions and 2 deletions

View File

@ -467,8 +467,25 @@ static HRESULT WINAPI HTMLDOMNode_put_nodeValue(IHTMLDOMNode *iface, VARIANT v)
static HRESULT WINAPI HTMLDOMNode_get_nodeValue(IHTMLDOMNode *iface, VARIANT *p)
{
HTMLDOMNode *This = HTMLDOMNODE_THIS(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
const PRUnichar *val;
nsAString val_str;
TRACE("(%p)->(%p)\n", This, p);
nsAString_Init(&val_str, NULL);
nsIDOMNode_GetNodeValue(This->nsnode, &val_str);
nsAString_GetData(&val_str, &val);
if(*val) {
V_VT(p) = VT_BSTR;
V_BSTR(p) = SysAllocString(val);
}else {
V_VT(p) = VT_NULL;
}
nsAString_Finish(&val_str);
return S_OK;
}
static HRESULT WINAPI HTMLDOMNode_get_firstChild(IHTMLDOMNode *iface, IHTMLDOMNode **p)

View File

@ -376,6 +376,17 @@ static IHTMLElement *_get_elem_iface(unsigned line, IUnknown *unk)
return elem;
}
#define get_node_iface(u) _get_node_iface(__LINE__,u)
static IHTMLDOMNode *_get_node_iface(unsigned line, IUnknown *unk)
{
IHTMLDOMNode *node;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IHTMLDOMNode, (void**)&node);
ok_(__FILE__,line) (hres == S_OK, "Coule not get IHTMLDOMNode: %08x\n", hres);
return node;
}
#define test_node_name(u,n) _test_node_name(__LINE__,u,n)
static void _test_node_name(unsigned line, IUnknown *unk, const char *exname)
{
@ -908,6 +919,27 @@ static void _test_elem_put_id(unsigned line, IUnknown *unk, const char *new_id)
_test_elem_id(line, unk, new_id);
}
#define test_node_get_value_str(u,e) _test_node_get_value_str(__LINE__,u,e)
static void _test_node_get_value_str(unsigned line, IUnknown *unk, const char *exval)
{
IHTMLDOMNode *node = _get_node_iface(line, unk);
VARIANT var;
HRESULT hres;
hres = IHTMLDOMNode_get_nodeValue(node, &var);
IHTMLDOMNode_Release(node);
ok_(__FILE__,line) (hres == S_OK, "get_nodeValue failed: %08x, expected VT_BSTR\n", hres);
if(exval) {
ok_(__FILE__,line) (V_VT(&var) == VT_BSTR, "vt=%d\n", V_VT(&var));
ok_(__FILE__,line) (!strcmp_wa(V_BSTR(&var), exval), "unexpected value %s\n", dbgstr_w(V_BSTR(&var)));
}else {
ok_(__FILE__,line) (V_VT(&var) == VT_NULL, "vt=%d, expected VT_NULL\n", V_VT(&var));
}
VariantClear(&var);
}
static void test_elem_col_item(IHTMLElementCollection *col, LPCWSTR n,
const elem_type_t *elem_types, long len)
{
@ -1673,6 +1705,8 @@ static void test_elems(IHTMLDocument2 *doc)
test_elem_put_id((IUnknown*)elem, "newin");
test_input_get_disabled(input, VARIANT_FALSE);
test_node_get_value_str((IUnknown*)elem, NULL);
IHTMLInputElement_Release(input);
IHTMLElement_Release(elem);
}
@ -1692,6 +1726,8 @@ static void test_elems(IHTMLDocument2 *doc)
type = get_node_type((IUnknown*)node);
ok(type == 3, "type=%ld\n", type);
test_node_get_value_str((IUnknown*)node, "text test");
IHTMLDOMNode_Release(node);
}