mshtml: Implement IHTMLStyle_put_fontWeight.

This commit is contained in:
Alistair Leslie-Hughes 2009-02-04 16:32:31 +11:00 committed by Alexandre Julliard
parent 9056d4d2d4
commit 20bd88895c
2 changed files with 105 additions and 2 deletions

View file

@ -618,8 +618,35 @@ static HRESULT WINAPI HTMLStyle_get_fontVariant(IHTMLStyle *iface, BSTR *p)
static HRESULT WINAPI HTMLStyle_put_fontWeight(IHTMLStyle *iface, BSTR v)
{
HTMLStyle *This = HTMLSTYLE_THIS(iface);
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
return E_NOTIMPL;
static const WCHAR styleBold[] = {'b','o','l','d',0};
static const WCHAR styleBolder[] = {'b','o','l','d','e','r',0};
static const WCHAR styleLighter[] = {'l','i','g','h','t','e','r',0};
static const WCHAR style100[] = {'1','0','0',0};
static const WCHAR style200[] = {'2','0','0',0};
static const WCHAR style300[] = {'3','0','0',0};
static const WCHAR style400[] = {'4','0','0',0};
static const WCHAR style500[] = {'5','0','0',0};
static const WCHAR style600[] = {'6','0','0',0};
static const WCHAR style700[] = {'7','0','0',0};
static const WCHAR style800[] = {'8','0','0',0};
static const WCHAR style900[] = {'9','0','0',0};
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
/* fontWeight can only be one of the following */
if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(styleBold, v) == 0 ||
strcmpiW(styleBolder, v) == 0 || strcmpiW(styleLighter, v) == 0 ||
strcmpiW(style100, v) == 0 || strcmpiW(style200, v) == 0 ||
strcmpiW(style300, v) == 0 || strcmpiW(style400, v) == 0 ||
strcmpiW(style500, v) == 0 || strcmpiW(style600, v) == 0 ||
strcmpiW(style700, v) == 0 || strcmpiW(style800, v) == 0 ||
strcmpiW(style900, v) == 0
)
{
return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_WEIGHT, v, 0);
}
return E_INVALIDARG;
}
static HRESULT WINAPI HTMLStyle_get_fontWeight(IHTMLStyle *iface, BSTR *p)

View file

@ -2431,6 +2431,82 @@ static void test_default_style(IHTMLStyle *style)
ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
ok(!str, "fontWeight = %s\n", dbgstr_w(str));
hres = IHTMLStyle_get_fontWeight(style, &sDefault);
ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
str = a2bstr("test");
hres = IHTMLStyle_put_fontWeight(style, str);
ok(hres == E_INVALIDARG, "put_fontWeight failed: %08x\n", hres);
SysFreeString(str);
str = a2bstr("bold");
hres = IHTMLStyle_put_fontWeight(style, str);
ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
SysFreeString(str);
str = a2bstr("bolder");
hres = IHTMLStyle_put_fontWeight(style, str);
ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
SysFreeString(str);
str = a2bstr("lighter");
hres = IHTMLStyle_put_fontWeight(style, str);
ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
SysFreeString(str);
str = a2bstr("100");
hres = IHTMLStyle_put_fontWeight(style, str);
ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
SysFreeString(str);
str = a2bstr("200");
hres = IHTMLStyle_put_fontWeight(style, str);
ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
SysFreeString(str);
str = a2bstr("300");
hres = IHTMLStyle_put_fontWeight(style, str);
ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
SysFreeString(str);
str = a2bstr("400");
hres = IHTMLStyle_put_fontWeight(style, str);
ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
SysFreeString(str);
str = a2bstr("500");
hres = IHTMLStyle_put_fontWeight(style, str);
ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
SysFreeString(str);
str = a2bstr("600");
hres = IHTMLStyle_put_fontWeight(style, str);
ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
SysFreeString(str);
str = a2bstr("700");
hres = IHTMLStyle_put_fontWeight(style, str);
ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
SysFreeString(str);
str = a2bstr("800");
hres = IHTMLStyle_put_fontWeight(style, str);
ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
SysFreeString(str);
str = a2bstr("900");
hres = IHTMLStyle_put_fontWeight(style, str);
ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
SysFreeString(str);
hres = IHTMLStyle_get_fontWeight(style, &str);
ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
ok(!strcmp_wa(str, "900"), "str != style900\n");
SysFreeString(str);
hres = IHTMLStyle_put_fontWeight(style, sDefault);
ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
/* font Variant */
hres = IHTMLStyle_get_fontVariant(style, NULL);
ok(hres == E_INVALIDARG, "get_fontVariant failed: %08x\n", hres);