Jacek Caban : mshtml: Added IHTMLSelectElement::item implementation.
Alexandre Julliard
julliard at winehq.org
Tue May 11 12:09:40 CDT 2010
Module: wine
Branch: master
Commit: 5847928bc63faec8ffcdbd0a36ce32a056d48b53
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5847928bc63faec8ffcdbd0a36ce32a056d48b53
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue May 11 17:57:39 2010 +0200
mshtml: Added IHTMLSelectElement::item implementation.
---
dlls/mshtml/htmlselect.c | 15 ++++++++++++++-
dlls/mshtml/tests/dom.c | 37 ++++++++++++++++++++++++++++++++++++-
2 files changed, 50 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c
index b9be897..f3aa36f 100644
--- a/dlls/mshtml/htmlselect.c
+++ b/dlls/mshtml/htmlselect.c
@@ -445,7 +445,20 @@ static HRESULT WINAPI HTMLSelectElement_item(IHTMLSelectElement *iface, VARIANT
VARIANT index, IDispatch **pdisp)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
- FIXME("(%p)->(v v %p)\n", This, pdisp);
+
+ TRACE("(%p)->(%s %s %p)\n", This, debugstr_variant(&name), debugstr_variant(&index), pdisp);
+
+ if(!pdisp)
+ return E_POINTER;
+ *pdisp = NULL;
+
+ if(V_VT(&name) == VT_I4) {
+ if(V_I4(&name) < 0)
+ return E_INVALIDARG;
+ return htmlselect_item(This, V_I4(&name), pdisp);
+ }
+
+ FIXME("Unsupported args\n");
return E_NOTIMPL;
}
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index a66b13c..c91adda 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -2906,7 +2906,8 @@ static IHTMLElement *get_doc_elem_by_id(IHTMLDocument2 *doc, const char *id)
static void test_select_elem(IHTMLSelectElement *select)
{
- IDispatch *disp;
+ IDispatch *disp, *disp2;
+ VARIANT name, index;
HRESULT hres;
test_select_type(select, "select-one");
@@ -2927,6 +2928,40 @@ static void test_select_elem(IHTMLSelectElement *select)
ok(disp != NULL, "options == NULL\n");
ok(iface_cmp((IUnknown*)disp, (IUnknown*)select), "disp != select\n");
IDispatch_Release(disp);
+
+ V_VT(&index) = VT_EMPTY;
+ V_VT(&name) = VT_I4;
+ V_I4(&name) = -1;
+ disp = (void*)0xdeadbeef;
+ hres = IHTMLSelectElement_item(select, name, index, &disp);
+ ok(hres == E_INVALIDARG, "item failed: %08x, expected E_INVALIDARG\n", hres);
+ ok(!disp, "disp = %p\n", disp);
+
+ V_I4(&name) = 2;
+ disp = (void*)0xdeadbeef;
+ hres = IHTMLSelectElement_item(select, name, index, &disp);
+ ok(hres == S_OK, "item failed: %08x\n", hres);
+ ok(!disp, "disp = %p\n", disp);
+
+ V_I4(&name) = 1;
+ hres = IHTMLSelectElement_item(select, name, index, NULL);
+ ok(hres == E_POINTER, "item failed: %08x, expected E_POINTER\n", hres);
+
+ disp = NULL;
+ hres = IHTMLSelectElement_item(select, name, index, &disp);
+ ok(hres == S_OK, "item failed: %08x\n", hres);
+ ok(disp != NULL, "disp = NULL\n");
+ test_disp((IUnknown*)disp, &DIID_DispHTMLOptionElement, NULL);
+
+ V_VT(&index) = VT_I4;
+ V_I4(&index) = 1;
+ disp2 = NULL;
+ hres = IHTMLSelectElement_item(select, name, index, &disp2);
+ ok(hres == S_OK, "item failed: %08x\n", hres);
+ ok(disp2 != NULL, "disp = NULL\n");
+ ok(iface_cmp((IUnknown*)disp, (IUnknown*)disp2), "disp != disp2\n");
+ IDispatch_Release(disp2);
+ IDispatch_Release(disp);
}
static void test_create_option_elem(IHTMLDocument2 *doc)
More information about the wine-cvs
mailing list