Jacek Caban : mshtml: Added IHTMLSelectElement::get_type implementation.

Alexandre Julliard julliard at winehq.org
Wed Jun 25 04:47:14 CDT 2008


Module: wine
Branch: master
Commit: 1d6c28459be7c44d9aa897f9b5ac1e523523f021
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1d6c28459be7c44d9aa897f9b5ac1e523523f021

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Jun 24 15:24:59 2008 -0500

mshtml: Added IHTMLSelectElement::get_type implementation.

---

 dlls/mshtml/htmlselect.c |   22 ++++++++++++++++++++--
 dlls/mshtml/tests/dom.c  |   12 ++++++++++++
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c
index 9bd2693..a432b6d 100644
--- a/dlls/mshtml/htmlselect.c
+++ b/dlls/mshtml/htmlselect.c
@@ -223,8 +223,26 @@ static HRESULT WINAPI HTMLSelectElement_get_selectedIndex(IHTMLSelectElement *if
 static HRESULT WINAPI HTMLSelectElement_get_type(IHTMLSelectElement *iface, BSTR *p)
 {
     HTMLSelectElement *This = HTMLSELECT_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    const PRUnichar *type;
+    nsAString type_str;
+    nsresult nsres;
+    HRESULT hres = S_OK;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    nsAString_Init(&type_str, NULL);
+    nsres = nsIDOMHTMLSelectElement_GetType(This->nsselect, &type_str);
+    if(NS_SUCCEEDED(nsres)) {
+        nsAString_GetData(&type_str, &type);
+        *p = *type ? SysAllocString(type) : NULL;
+    }else {
+        ERR("GetType failed: %08x\n", nsres);
+        hres = E_FAIL;
+    }
+
+    nsAString_Finish(&type_str);
+
+    return hres;
 }
 
 static HRESULT WINAPI HTMLSelectElement_put_value(IHTMLSelectElement *iface, BSTR v)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 3c51ec7..5a3101b 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -656,6 +656,17 @@ static void _test_select_set_value(unsigned line, IHTMLSelectElement *select, co
     ok_(__FILE__,line) (hres == S_OK, "put_value failed: %08x\n", hres);
 }
 
+#define test_select_type(s,t) _test_select_type(__LINE__,s,t)
+static void _test_select_type(unsigned line, IHTMLSelectElement *select, const char *extype)
+{
+    BSTR type;
+    HRESULT hres;
+
+    hres = IHTMLSelectElement_get_type(select, &type);
+    ok_(__FILE__,line) (hres == S_OK, "get_type failed: %08x\n", hres);
+    ok_(__FILE__,line) (!strcmp_wa(type, extype), "type=%s, expected %s\n", dbgstr_w(type), extype);
+}
+
 #define test_range_text(r,t) _test_range_text(__LINE__,r,t)
 static void _test_range_text(unsigned line, IHTMLTxtRange *range, const char *extext)
 {
@@ -1368,6 +1379,7 @@ static IHTMLElement *get_doc_elem_by_id(IHTMLDocument2 *doc, LPCWSTR id)
 
 static void test_select_elem(IHTMLSelectElement *select)
 {
+    test_select_type(select, "select-one");
     test_select_length(select, 2);
     test_select_selidx(select, 0);
     test_select_put_selidx(select, 1);




More information about the wine-cvs mailing list