mshtml: Implement IHTMLStyle put_fontStyle.

This commit is contained in:
Alistair Leslie-Hughes 2008-12-11 22:16:28 +11:00 committed by Alexandre Julliard
parent 16fb8fd843
commit f82df0ac63
2 changed files with 43 additions and 2 deletions

View File

@ -133,6 +133,8 @@ static const WCHAR valLineThrough[] =
{'l','i','n','e','-','t','h','r','o','u','g','h',0};
static const WCHAR valUnderline[] =
{'u','n','d','e','r','l','i','n','e',0};
static const WCHAR szNormal[] =
{'n','o','r','m','a','l',0};
static const WCHAR px_formatW[] = {'%','d','p','x',0};
static const WCHAR emptyW[] = {0};
@ -515,8 +517,19 @@ static HRESULT WINAPI HTMLStyle_get_fontFamily(IHTMLStyle *iface, BSTR *p)
static HRESULT WINAPI HTMLStyle_put_fontStyle(IHTMLStyle *iface, BSTR v)
{
HTMLStyle *This = HTMLSTYLE_THIS(iface);
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
return E_NOTIMPL;
static const WCHAR szItalic[] = {'i','t','a','l','i','c',0};
static const WCHAR szOblique[] = {'o','b','l','i','q','u','e',0};
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
/* fontStyle can only be one of the follow values. */
if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(szItalic, v) == 0 ||
strcmpiW(szOblique, v) == 0)
{
return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_STYLE, v, 0);
}
return E_INVALIDARG;
}
static HRESULT WINAPI HTMLStyle_get_fontStyle(IHTMLStyle *iface, BSTR *p)

View File

@ -2294,6 +2294,7 @@ static void test_default_style(IHTMLStyle *style)
HRESULT hres;
float f;
BSTR sOverflowDefault;
BSTR sDefault;
test_disp((IUnknown*)style, &DIID_DispHTMLStyle);
test_ifaces((IUnknown*)style, style_iids);
@ -2636,6 +2637,33 @@ static void test_default_style(IHTMLStyle *style)
ok(V_I4(&v) == 1, "V_I4(v) = %d\n", V_I4(&v));
VariantClear(&v);
/* fontStyle */
hres = IHTMLStyle_get_fontStyle(style, &sDefault);
ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
str = a2bstr("test");
hres = IHTMLStyle_put_fontStyle(style, str);
ok(hres == E_INVALIDARG, "put_fontStyle failed: %08x\n", hres);
SysFreeString(str);
str = a2bstr("italic");
hres = IHTMLStyle_put_fontStyle(style, str);
ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
SysFreeString(str);
str = a2bstr("oblique");
hres = IHTMLStyle_put_fontStyle(style, str);
ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
SysFreeString(str);
str = a2bstr("normal");
hres = IHTMLStyle_put_fontStyle(style, str);
ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
SysFreeString(str);
hres = IHTMLStyle_put_fontStyle(style, sDefault);
ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
/* overflow */
hres = IHTMLStyle_get_overflow(style, NULL);
ok(hres == E_INVALIDARG, "get_overflow failed: %08x\n", hres);