Jacek Caban : mshtml: Added IHTMLInputElement::put_value implementation.
Alexandre Julliard
julliard at winehq.org
Thu Jun 19 06:39:17 CDT 2008
Module: wine
Branch: master
Commit: 4360ee4d8b1501a3fadd1823f7974de4886c61e3
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4360ee4d8b1501a3fadd1823f7974de4886c61e3
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Jun 18 17:10:15 2008 -0500
mshtml: Added IHTMLInputElement::put_value implementation.
---
dlls/mshtml/htmlinput.c | 14 ++++++++++++--
dlls/mshtml/tests/dom.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/htmlinput.c b/dlls/mshtml/htmlinput.c
index 5b605b3..5674b0b 100644
--- a/dlls/mshtml/htmlinput.c
+++ b/dlls/mshtml/htmlinput.c
@@ -137,8 +137,18 @@ static HRESULT WINAPI HTMLInputElement_get_type(IHTMLInputElement *iface, BSTR *
static HRESULT WINAPI HTMLInputElement_put_value(IHTMLInputElement *iface, BSTR v)
{
HTMLInputElement *This = HTMLINPUT_THIS(iface);
- FIXME("(%p)->(%s)\n", This, debugstr_w(v));
- return E_NOTIMPL;
+ nsAString val_str;
+ nsresult nsres;
+
+ TRACE("(%p)->(%s)\n", This, debugstr_w(v));
+
+ nsAString_Init(&val_str, v);
+ nsres = nsIDOMHTMLInputElement_SetValue(This->nsinput, &val_str);
+ nsAString_Finish(&val_str);
+ if(NS_FAILED(nsres))
+ ERR("SetValue failed: %08x\n", nsres);
+
+ return S_OK;
}
static HRESULT WINAPI HTMLInputElement_get_value(IHTMLInputElement *iface, BSTR *p)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index ac30c12..8bc3861 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -843,6 +843,47 @@ static void _test_input_get_disabled(unsigned line, IHTMLInputElement *input, VA
ok_(__FILE__,line) (disabled == exb, "disabled=%x, expected %x\n", disabled, exb);
}
+#define test_input_value(o,t) _test_input_value(__LINE__,o,t)
+static void _test_input_value(unsigned line, IUnknown *unk, const char *exval)
+{
+ IHTMLInputElement *input;
+ BSTR bstr;
+ HRESULT hres;
+
+ hres = IUnknown_QueryInterface(unk, &IID_IHTMLInputElement, (void**)&input);
+ ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLInputElement: %08x\n", hres);
+ if(FAILED(hres))
+ return;
+
+ hres = IHTMLInputElement_get_value(input, &bstr);
+ ok_(__FILE__,line) (hres == S_OK, "get_value failed: %08x\n", hres);
+ if(exval)
+ ok_(__FILE__,line) (!strcmp_wa(bstr, exval), "value=%s\n", dbgstr_w(bstr));
+ else
+ ok_(__FILE__,line) (!exval, "exval != NULL\n");
+ SysFreeString(bstr);
+ IHTMLInputElement_Release(input);
+}
+
+#define test_input_put_value(o,v) _test_input_put_value(__LINE__,o,v)
+static void _test_input_put_value(unsigned line, IUnknown *unk, const char *val)
+{
+ IHTMLInputElement *input;
+ BSTR bstr;
+ HRESULT hres;
+
+ hres = IUnknown_QueryInterface(unk, &IID_IHTMLInputElement, (void**)&input);
+ ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLInputElement: %08x\n", hres);
+ if(FAILED(hres))
+ return;
+
+ bstr = a2bstr(val);
+ hres = IHTMLInputElement_get_value(input, &bstr);
+ ok_(__FILE__,line) (hres == S_OK, "get_value failed: %08x\n", hres);
+ SysFreeString(bstr);
+ IHTMLInputElement_Release(input);
+}
+
#define get_child_nodes(u) _get_child_nodes(__LINE__,u)
static IHTMLDOMChildrenCollection *_get_child_nodes(unsigned line, IUnknown *unk)
{
@@ -1735,6 +1776,9 @@ static void test_elems(IHTMLDocument2 *doc)
test_node_get_value_str((IUnknown*)elem, NULL);
test_node_put_value_str((IUnknown*)elem, "test");
test_node_get_value_str((IUnknown*)elem, NULL);
+ test_input_value((IUnknown*)elem, NULL);
+ test_input_put_value((IUnknown*)elem, "test");
+ test_input_value((IUnknown*)elem, NULL);
IHTMLInputElement_Release(input);
IHTMLElement_Release(elem);
More information about the wine-cvs
mailing list