From 33171f3b5d902c588e1ac6dc535b9c6e8406b37d Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 16 Apr 2012 13:49:22 +0200 Subject: [PATCH] mshtml: Added IHTMLStyle::removeAttribute tests. --- dlls/mshtml/tests/jstest.html | 11 +++++++++++ dlls/mshtml/tests/style.c | 25 +++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/dlls/mshtml/tests/jstest.html b/dlls/mshtml/tests/jstest.html index b465491b2fc..abda45e73f6 100644 --- a/dlls/mshtml/tests/jstest.html +++ b/dlls/mshtml/tests/jstest.html @@ -62,6 +62,16 @@ function test_document_name_as_index() { ok(!("formid" in document), "formid is in document"); } +function test_remove_style_attribute() { + var s = document.body.style, b; + + s.somevar = "test"; + b = s.removeAttribute("somevar", 1); + ok(b, "removeAttribute returned " + b + " expected true"); + b = s.removeAttribute("somevar", 1); + ok(b === false, "removeAttribute returned " + b + " expected false"); +} + var globalVar = false; function runTest() { @@ -75,6 +85,7 @@ function runTest() { test_select_index(); test_createDocumentFragment(); test_document_name_as_index(); + test_remove_style_attribute(); var r = window.execScript("globalVar = true;"); ok(r === undefined, "execScript returned " + r); diff --git a/dlls/mshtml/tests/style.c b/dlls/mshtml/tests/style.c index cecdd20fffd..6a31665ca00 100644 --- a/dlls/mshtml/tests/style.c +++ b/dlls/mshtml/tests/style.c @@ -242,6 +242,19 @@ static void _test_style_set_csstext(unsigned line, IHTMLStyle *style, const char SysFreeString(tmp); } +#define test_style_remove_attribute(a,b,c) _test_style_remove_attribute(__LINE__,a,b,c) +static void _test_style_remove_attribute(unsigned line, IHTMLStyle *style, const char *attr, VARIANT_BOOL exb) +{ + BSTR str = a2bstr(attr); + VARIANT_BOOL b = 100; + HRESULT hres; + + hres = IHTMLStyle_removeAttribute(style, str, 1, &b); + SysFreeString(str); + ok_(__FILE__,line)(hres == S_OK, "removeAttribute failed: %08x\n", hres); + ok_(__FILE__,line)(b == exb, "removeAttribute returned %x, expected %x\n", b, exb); +} + static void test_set_csstext(IHTMLStyle *style) { VARIANT v; @@ -1883,6 +1896,13 @@ static void test_body_style(IHTMLStyle *style) ok(!strcmp_wa(str, "always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str)); SysFreeString(str); + test_style_remove_attribute(style, "pageBreakBefore", VARIANT_TRUE); + test_style_remove_attribute(style, "pageBreakBefore", VARIANT_FALSE); + + hres = IHTMLStyle_get_pageBreakBefore(style, &str); + ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres); + ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str)); + hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2); ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres); if(SUCCEEDED(hres)) { @@ -1984,6 +2004,11 @@ static void test_style_filters(IHTMLElement *elem) test_style_filter(style, "alpha(opacity=100)"); set_style_filter(style, "xxx(a,b,c) alpha(opacity=100)"); set_style_filter(style, NULL); + set_style_filter(style, "alpha(opacity=100)"); + test_style_remove_attribute(style, "filter", VARIANT_TRUE); + test_style_remove_attribute(style, "filter", VARIANT_FALSE); + test_style_filter(style, NULL); + IHTMLCurrentStyle2_Release(current_style2); IHTMLStyle_Release(style); -- 2.11.4.GIT