From f7a6c512a0c7a7fd103ddc83ddec44ebfddcad33 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Sun, 1 Mar 2009 20:26:59 +1100 Subject: [PATCH] mshtml: Implement IHTMLStyle_put_textDecoration. --- dlls/mshtml/htmlstyle.c | 14 ++++++++++++-- dlls/mshtml/tests/dom.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c index a7eff56b9e2..90ff0895ec7 100644 --- a/dlls/mshtml/htmlstyle.c +++ b/dlls/mshtml/htmlstyle.c @@ -924,8 +924,18 @@ static HRESULT WINAPI HTMLStyle_get_letterSpacing(IHTMLStyle *iface, VARIANT *p) static HRESULT WINAPI HTMLStyle_put_textDecoration(IHTMLStyle *iface, BSTR v) { HTMLStyle *This = HTMLSTYLE_THIS(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(v)); - return E_NOTIMPL; + + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + + /* textDecoration can only be one of the following */ + if(!v || strcmpiW(styleNone, v) == 0 || strcmpiW(valUnderline, v) == 0 || + strcmpiW(valOverline, v) == 0 || strcmpiW(valLineThrough, v) == 0 || + strcmpiW(valBlink, v) == 0) + { + return set_style_attr(This, STYLEID_TEXT_DECORATION , v, 0); + } + + return E_INVALIDARG; } static HRESULT WINAPI HTMLStyle_get_textDecoration(IHTMLStyle *iface, BSTR *p) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index c0fb0091ab6..66740240b1b 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -2798,6 +2798,48 @@ static void test_default_style(IHTMLStyle *style) hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_FALSE); ok(hres == S_OK, "textDecorationBlink failed: %08x\n", hres); + hres = IHTMLStyle_get_textDecoration(style, &sDefault); + ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres); + + str = a2bstr("invalid"); + hres = IHTMLStyle_put_textDecoration(style, str); + ok(hres == E_INVALIDARG, "put_textDecoration failed: %08x\n", hres); + SysFreeString(str); + + str = a2bstr("none"); + hres = IHTMLStyle_put_textDecoration(style, str); + ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres); + SysFreeString(str); + + str = a2bstr("underline"); + hres = IHTMLStyle_put_textDecoration(style, str); + ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres); + SysFreeString(str); + + str = a2bstr("overline"); + hres = IHTMLStyle_put_textDecoration(style, str); + ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres); + SysFreeString(str); + + str = a2bstr("line-through"); + hres = IHTMLStyle_put_textDecoration(style, str); + ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres); + SysFreeString(str); + + str = a2bstr("blink"); + hres = IHTMLStyle_put_textDecoration(style, str); + ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres); + SysFreeString(str); + + hres = IHTMLStyle_get_textDecoration(style, &str); + ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres); + ok(!strcmp_wa(str, "blink"), "str != blink\n"); + SysFreeString(str); + + hres = IHTMLStyle_put_textDecoration(style, sDefault); + ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres); + SysFreeString(sDefault); + hres = IHTMLStyle_get_posWidth(style, NULL); ok(hres == E_POINTER, "get_posWidth failed: %08x\n", hres); -- 2.11.4.GIT