Jacek Caban : mshtml: Added IHTMLStyle::removeAttribute tests.
Alexandre Julliard
julliard at winehq.org
Mon Apr 16 13:35:46 CDT 2012
Module: wine
Branch: master
Commit: 33171f3b5d902c588e1ac6dc535b9c6e8406b37d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=33171f3b5d902c588e1ac6dc535b9c6e8406b37d
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Apr 16 13:49:22 2012 +0200
mshtml: Added IHTMLStyle::removeAttribute tests.
---
dlls/mshtml/tests/jstest.html | 11 +++++++++++
dlls/mshtml/tests/style.c | 25 +++++++++++++++++++++++++
2 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/dlls/mshtml/tests/jstest.html b/dlls/mshtml/tests/jstest.html
index b465491..abda45e 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 cecdd20..6a31665 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);
More information about the wine-cvs
mailing list