From b095b1f67e0d2f1729320e2b9d8e9c3d9bf0047c Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 22 Aug 2013 15:58:47 +0200 Subject: [PATCH] mshtml: Added better IHTMLCurrentStyle2::get_hasLayout stub. --- dlls/mshtml/htmlcurstyle.c | 7 +++++-- dlls/mshtml/tests/style.c | 26 +++++++++++++++++++++++--- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/dlls/mshtml/htmlcurstyle.c b/dlls/mshtml/htmlcurstyle.c index f7736059442..71d57a19e32 100644 --- a/dlls/mshtml/htmlcurstyle.c +++ b/dlls/mshtml/htmlcurstyle.c @@ -979,8 +979,11 @@ static HRESULT WINAPI HTMLCurrentStyle2_get_textUnderlinePosition(IHTMLCurrentSt static HRESULT WINAPI HTMLCurrentStyle2_get_hasLayout(IHTMLCurrentStyle2 *iface, VARIANT_BOOL *p) { HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle2(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + FIXME("(%p)->(%p) returning true\n", This, p); + + *p = VARIANT_TRUE; + return S_OK; } static HRESULT WINAPI HTMLCurrentStyle2_get_scrollbarBaseColor(IHTMLCurrentStyle2 *iface, VARIANT *p) diff --git a/dlls/mshtml/tests/style.c b/dlls/mshtml/tests/style.c index 3e2ef894b84..a32991b51cb 100644 --- a/dlls/mshtml/tests/style.c +++ b/dlls/mshtml/tests/style.c @@ -73,6 +73,17 @@ static IHTMLElement2 *_get_elem2_iface(unsigned line, IUnknown *unk) return elem; } +#define get_current_style2_iface(u) _get_current_style2_iface(__LINE__,u) +static IHTMLCurrentStyle2 *_get_current_style2_iface(unsigned line, IUnknown *unk) +{ + IHTMLCurrentStyle2 *current_style2; + HRESULT hres; + + hres = IUnknown_QueryInterface(unk, &IID_IHTMLCurrentStyle2, (void**)¤t_style2); + ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLElement2: %08x\n", hres); + return current_style2; +} + static IHTMLElement *get_element_by_id(IHTMLDocument2 *doc, const char *id) { HRESULT hres; @@ -2100,9 +2111,7 @@ static void test_style_filters(IHTMLElement *elem) hres = IHTMLElement2_get_currentStyle(elem2, ¤t_style); ok(hres == S_OK, "get_style failed: %08x\n", hres); - hres = IHTMLCurrentStyle_QueryInterface(current_style, &IID_IHTMLCurrentStyle2, (void**)¤t_style2); - IHTMLCurrentStyle_Release(current_style); - ok(hres == S_OK, "Could not get IHTMLCurrentStyle2 iface: %08x\n", hres); + current_style2 = get_current_style2_iface((IUnknown*)current_style); test_style_filter(style, NULL); test_current_style_filter(current_style2, NULL); @@ -2131,6 +2140,8 @@ static void test_style_filters(IHTMLElement *elem) static void test_current_style(IHTMLCurrentStyle *current_style) { + IHTMLCurrentStyle2 *current_style2; + VARIANT_BOOL b; BSTR str; HRESULT hres; VARIANT v; @@ -2390,6 +2401,15 @@ static void test_current_style(IHTMLCurrentStyle *current_style) ok(hres == S_OK, "get_textIndent failed: %08x\n", hres); ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v)); VariantClear(&v); + + current_style2 = get_current_style2_iface((IUnknown*)current_style); + + b = 100; + hres = IHTMLCurrentStyle2_get_hasLayout(current_style2, &b); + ok(hres == S_OK, "get_hasLayout failed: %08x\n", hres); + ok(b == VARIANT_TRUE, "hasLayout = %x\n", b); + + IHTMLCurrentStyle2_Release(current_style2); } static const char basic_test_str[] = "
";