Commit 568f2695 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added IHTMLDOMNode::put_nodeValue implementation.

parent 26e23bdd
......@@ -460,7 +460,26 @@ static HRESULT WINAPI HTMLDOMNode_get_nodeName(IHTMLDOMNode *iface, BSTR *p)
static HRESULT WINAPI HTMLDOMNode_put_nodeValue(IHTMLDOMNode *iface, VARIANT v)
{
HTMLDOMNode *This = HTMLDOMNODE_THIS(iface);
FIXME("(%p)->()\n", This);
TRACE("(%p)->()\n", This);
switch(V_VT(&v)) {
case VT_BSTR: {
nsAString val_str;
TRACE("bstr %s\n", debugstr_w(V_BSTR(&v)));
nsAString_Init(&val_str, V_BSTR(&v));
nsIDOMNode_SetNodeValue(This->nsnode, &val_str);
nsAString_Finish(&val_str);
return S_OK;
}
default:
FIXME("unsupported vt %d\n", V_VT(&v));
}
return E_NOTIMPL;
}
......
......@@ -390,13 +390,10 @@ static IHTMLDOMNode *_get_node_iface(unsigned line, IUnknown *unk)
#define test_node_name(u,n) _test_node_name(__LINE__,u,n)
static void _test_node_name(unsigned line, IUnknown *unk, const char *exname)
{
IHTMLDOMNode *node;
IHTMLDOMNode *node = _get_node_iface(line, unk);
BSTR name;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IHTMLDOMNode, (void**)&node);
ok_(__FILE__, line) (hres == S_OK, "QueryInterface(IID_IHTMLNode) failed: %08x\n", hres);
hres = IHTMLDOMNode_get_nodeName(node, &name);
IHTMLDOMNode_Release(node);
ok_(__FILE__, line) (hres == S_OK, "get_nodeName failed: %08x\n", hres);
......@@ -798,14 +795,10 @@ static void _test_elem_collection(unsigned line, IHTMLElementCollection *col,
#define get_first_child(n) _get_first_child(__LINE__,n)
static IHTMLDOMNode *_get_first_child(unsigned line, IUnknown *unk)
{
IHTMLDOMNode *node, *child = NULL;
IHTMLDOMNode *node = _get_node_iface(line, unk);
IHTMLDOMNode *child = NULL;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IHTMLDOMNode, (void**)&node);
ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLDOMNode: %08x\n", hres);
if(FAILED(hres))
return NULL;
hres = IHTMLDOMNode_get_firstChild(node, &child);
IHTMLDOMNode_Release(node);
ok_(__FILE__,line) (hres == S_OK, "get_firstChild failed: %08x\n", hres);
......@@ -816,13 +809,10 @@ static IHTMLDOMNode *_get_first_child(unsigned line, IUnknown *unk)
#define get_node_type(n) _get_node_type(__LINE__,n)
static long _get_node_type(unsigned line, IUnknown *unk)
{
IHTMLDOMNode *node;
IHTMLDOMNode *node = _get_node_iface(line, unk);
long type = -1;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IHTMLDOMNode, (void**)&node);
ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLDOMNode: %08x\n", hres);
hres = IHTMLDOMNode_get_nodeType(node, &type);
ok(hres == S_OK, "get_nodeType failed: %08x\n", hres);
......@@ -845,16 +835,11 @@ static void _test_input_get_disabled(unsigned line, IHTMLInputElement *input, VA
#define get_child_nodes(u) _get_child_nodes(__LINE__,u)
static IHTMLDOMChildrenCollection *_get_child_nodes(unsigned line, IUnknown *unk)
{
IHTMLDOMNode *node = _get_node_iface(line, unk);
IHTMLDOMChildrenCollection *col = NULL;
IHTMLDOMNode *node;
IDispatch *disp;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IHTMLDOMNode, (void**)&node);
ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLDOMNode: %08x\n", hres);
if(FAILED(hres))
return NULL;
hres = IHTMLDOMNode_get_childNodes(node, &disp);
IHTMLDOMNode_Release(node);
ok_(__FILE__,line) (hres == S_OK, "get_childNodes failed: %08x\n", hres);
......@@ -878,9 +863,8 @@ static IHTMLDOMNode *_get_child_item(unsigned line, IHTMLDOMChildrenCollection *
hres = IHTMLDOMChildrenCollection_item(col, idx, &disp);
ok(hres == S_OK, "item failed: %08x\n", hres);
hres = IDispatch_QueryInterface(disp, &IID_IHTMLDOMNode, (void**)&node);
node = _get_node_iface(line, (IUnknown*)disp);
IDispatch_Release(disp);
ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLDOMNode: %08x\n", hres);
return node;
}
......@@ -940,6 +924,22 @@ static void _test_node_get_value_str(unsigned line, IUnknown *unk, const char *e
VariantClear(&var);
}
#define test_node_put_value_str(u,v) _test_node_put_value_str(__LINE__,u,v)
static void _test_node_put_value_str(unsigned line, IUnknown *unk, const char *val)
{
IHTMLDOMNode *node = _get_node_iface(line, unk);
VARIANT var;
HRESULT hres;
V_VT(&var) = VT_BSTR;
V_BSTR(&var) = a2bstr(val);
hres = IHTMLDOMNode_put_nodeValue(node, var);
ok_(__FILE__,line) (hres == S_OK, "get_nodeValue failed: %08x, expected VT_BSTR\n", hres);
IHTMLDOMNode_Release(node);
VariantClear(&var);
}
static void test_elem_col_item(IHTMLElementCollection *col, LPCWSTR n,
const elem_type_t *elem_types, long len)
{
......@@ -1706,6 +1706,8 @@ static void test_elems(IHTMLDocument2 *doc)
test_input_get_disabled(input, VARIANT_FALSE);
test_node_get_value_str((IUnknown*)elem, NULL);
test_node_put_value_str((IUnknown*)elem, "test");
test_node_get_value_str((IUnknown*)elem, NULL);
IHTMLInputElement_Release(input);
IHTMLElement_Release(elem);
......@@ -1727,6 +1729,8 @@ static void test_elems(IHTMLDocument2 *doc)
ok(type == 3, "type=%ld\n", type);
test_node_get_value_str((IUnknown*)node, "text test");
test_node_put_value_str((IUnknown*)elem, "test text");
test_node_get_value_str((IUnknown*)node, "text test");
IHTMLDOMNode_Release(node);
}
......@@ -1868,7 +1872,7 @@ static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, D
if(!lstrcmpW(state, completeW))
doc_complete = TRUE;
SysFreeString(state);
SysFreeString(state);
}
return S_OK;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment