Zhenbo Li : mshtml: Add IHTMLOpinionElement::index property' s getter implementation.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Aug 7 10:57:43 CDT 2015
Module: wine
Branch: master
Commit: 312534f26f79dc11ed984fdb2a8cd29f025d740b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=312534f26f79dc11ed984fdb2a8cd29f025d740b
Author: Zhenbo Li <litimetal at gmail.com>
Date: Fri Aug 7 18:12:07 2015 +0800
mshtml: Add IHTMLOpinionElement::index property's getter implementation.
---
dlls/mshtml/htmloption.c | 17 +++++++++++++++--
dlls/mshtml/tests/dom.c | 17 +++++++++++++++++
2 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/htmloption.c b/dlls/mshtml/htmloption.c
index 896f812..54d872c 100644
--- a/dlls/mshtml/htmloption.c
+++ b/dlls/mshtml/htmloption.c
@@ -187,8 +187,21 @@ static HRESULT WINAPI HTMLOptionElement_put_index(IHTMLOptionElement *iface, LON
static HRESULT WINAPI HTMLOptionElement_get_index(IHTMLOptionElement *iface, LONG *p)
{
HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
- FIXME("(%p)->(%p)\n", This, p);
- return E_NOTIMPL;
+ LONG val;
+ nsresult nsres;
+
+ TRACE("(%p)->(%p)\n", This, p);
+
+ if(!p)
+ return E_INVALIDARG;
+
+ nsres = nsIDOMHTMLOptionElement_GetIndex(This->nsoption, &val);
+ if(NS_FAILED(nsres)) {
+ ERR("GetIndex failed: %08x\n", nsres);
+ return E_FAIL;
+ }
+ *p = val;
+ return S_OK;
}
static HRESULT WINAPI HTMLOptionElement_put_text(IHTMLOptionElement *iface, BSTR v)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 51f1f50..f5dee76 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -1676,6 +1676,22 @@ static void _test_option_put_selected(unsigned line, IHTMLOptionElement *option,
_test_option_selected(line, option, b);
}
+#define test_option_get_index(o,s) _test_option_get_index(__LINE__,o,s)
+static void _test_option_get_index(unsigned line, IHTMLOptionElement *option, LONG exval)
+{
+ HRESULT hres;
+ LONG val;
+
+ hres = IHTMLOptionElement_get_index(option, NULL);
+ ok_(__FILE__,line)(hres == E_INVALIDARG, "Expect E_INVALIDARG, got %08x\n", hres);
+
+ val = 12345678;
+ hres = IHTMLOptionElement_get_index(option, &val);
+ ok_(__FILE__,line)(hres == S_OK, "get_index failed: %08x\n", hres);
+ ok_(__FILE__,line)(val == exval || broken(val == 12345678), /* Win2k doesn't touch it*/
+ "value = %d, expected = %d\n", val, exval);
+}
+
#define test_textarea_value(t,v) _test_textarea_value(__LINE__,t,v)
static void _test_textarea_value(unsigned line, IUnknown *unk, const char *exval)
{
@@ -4966,6 +4982,7 @@ static void test_create_option_elem(IHTMLDocument2 *doc)
test_option_put_text(option, "new text");
test_option_put_value(option, "new value");
+ test_option_get_index(option, 0);
test_option_put_selected(option, VARIANT_TRUE);
test_option_put_selected(option, VARIANT_FALSE);
More information about the wine-cvs
mailing list