|
From: Ronald B. <rb...@rb...> - 2013-05-14 19:01:15
|
Hi Wiebe,
think i have fixed your problems.
A new snapshot build of cssparser is available at sonatype. Please try and report back....
Thanks for your support and the test cases.
RBRi
--------------------------
Wetator
Smart web application testing
http://www.wetator.org
On Mon, 13 May 2013 10:34:20 -0300 Wiebe Ruiter wrote:
>
>
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Good day. First, thanks for the cssparser project. It is a big help.
>At the moment I am encountering two parsing bugs which are stopping me
>in my current project.
>
>One day I'll get my head around the javacc parser format; right now I
>cannot. I did however created a testcase to show the problem I am
>seeing. Is there any worksround for this bug ? Is there any way I can
>patch the javacc files to handle these situations ?
>
>- -----start testcase-----
>package com.docner.editgui;
>
>import com.steadystate.css.dom.CSSStyleRuleImpl;
>import com.steadystate.css.parser.CSSOMParser;
>import com.steadystate.css.parser.SACParserCSS3;
>import java.io.IOException;
>import java.io.StringReader;
>import static org.junit.Assert.*;
>import org.junit.Before;
>import org.junit.Test;
>import org.w3c.css.sac.InputSource;
>import org.w3c.dom.css.CSSRule;
>import org.w3c.dom.css.CSSStyleDeclaration;
>import org.w3c.dom.css.CSSStyleSheet;
>
>/**
> *
> * @author wiebe
> */
>public class CssParserBugs {
>
> private CSSOMParser parser;
>
> @Before
> public void setUp() {
> parser = new CSSOMParser(new SACParserCSS3());
> }
>
> @Test
> public void testThatCssParserCanHandleTransformRotate() throws
>IOException {
> String stylesheet = ".flipped {\n"
> + " transform: rotateY(180deg);\n"
> + "}\n"
> + "";
>
> CSSStyleDeclaration style = readStyle(stylesheet);
> assertEquals("rotateY(180deg)",
>style.getPropertyCSSValue("transform"));
> }
>
> @Test
> public void testThatCssParserCanHandleRGBA() throws IOException {
> String stylesheet = "#footer {\n"
> + " width:900px;\n"
> + " height:52px;\n"
> + " left: 32px;\n"
> + " top: 530px;\n"
> + " position: absolute;\n"
> + " background-color:rgba(0,0,0,0.2); \n"
> + "}\n"
> + "";
>
> CSSStyleDeclaration style = readStyle(stylesheet);
> assertEquals("rgba(0,0,0,0.2)",
>style.getPropertyCSSValue("background-color"));
> }
>
> protected CSSStyleDeclaration readStyle(String stylesheet) throws
>IOException {
> StringReader reader = new StringReader(stylesheet);
> InputSource source = new InputSource(reader);
> CSSStyleSheet sheet = parser.parseStyleSheet(source, null, null);
> CSSRule rule = sheet.getCssRules().item(0);
> CSSStyleRuleImpl styleRule = (CSSStyleRuleImpl) rule;
> CSSStyleDeclaration style = styleRule.getStyle();
> return style;
> }
>}
>- -----finish testcase-----
>
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG/MacGPG2 v2.0.18 (Darwin)
>Comment: GPGTools - http://gpgtools.org
>Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
>iQIcBAEBAgAGBQJRkOvcAAoJEGfAtLaF4C04n/wP/0sZkZLFgBsqHKlT9rAl38Xb
>mRQ8qPuBzYJ3UNQU4gH4qjvbsxTWJUl5uL2EgAnrGtfxrILE+UZjyzkzSA3c8SVm
>lNCpex1G21VbWKy1dSPA/eGQ4p389rUfo3djSkEJplHe1SVjT+1cN6qCDOdG4qLJ
>8aoJRdLGG4Y8H6XWSLLKnMnCvfzXOr3+awJXPbV6KmmfblwZXrQ8jsfdwTZgBp0a
>gX89IROX6tUBmu73rL/symXsO8bKPIHl1tgY2ibhc10XZ02h7u6p7SDUfpUViTiq
>9/iewdPJWQ0I4nOeqdCQI4eenggYRgJUcvgy3ZUfXhIwNKJGwqqGrOWw8jseikyd
>XI4xp43rheGK7YhSEJLldi4JtMIUNEoQHZQn7VaX3/uKCMe4GOnZKzuzTHi/S0d1
>w2BpolN6NR3XWqjPIePia1D+zMTkGO9qsBwl6FXP6O0vtfQSiL/M8XbXjBw3pYqp
>S5jgk46PvBXKwJG6AxSwX1o1//nSICs8UXjHpO07WjTLtpqUTpY8kQOeqnEzuJkX
>h9X+nMiJqs45MKvVJHORBric8avPiHvc0yDgi2nMKUSebryv8KZqqrvzqK3BW1ib
>RFdohqUbhR5XG0hfumotYxus8DNyQbKUGw8HQijR1iuQBJOjzywWB9vzLV7CenT7
>WWdgYVLpr5qomoZ1gl/U
>=d/gB
>-----END PGP SIGNATURE-----
>
>
|