Skip to content

Commit

Permalink
#493 Failing test for CSS not passed to SVG renderer.
Browse files Browse the repository at this point in the history
  • Loading branch information
danfickle committed Jul 17, 2020
1 parent cbb81da commit 3b28992
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<html>
<head>
<style>
@page {
size: 200px 400px;
margin: 0;
}
body {
margin: 0;
}
svg {
display: block;
border: 2px solid red;
margin: 2px;
}
svg rect {
/* Ruleset should be passed to all SVGs. */
fill: rgb(0,0,255);
visibility: visible; /* Property valid in both HTML and SVG. */
}
svg .highlight, /* To all SVGs. */
.hl rect { /* To SVGs with class hl. */
fill: rgb(255,0,0);
}
div {
height: 20px;
background-color: orange;
background-color: #000000000; /* Invalid value should not override valid value. */
}
</style>
</head>
<body>
<!-- Reference -->
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 100" style="width: 100px;">
<rect width="150" height="100" style="fill:rgb(0,0,255);" rx="15" />
</svg>

<!-- Should look the same -->
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 100" style="width: 100px;">
<rect width="150" height="100" rx="15" />
</svg>

<!-- Should have red rect -->
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 100" style="width: 100px;">
<rect width="150" height="100" class="highlight" rx="15" />
</svg>

<!-- Should have red rect -->
<svg class="hl" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 100" style="width: 100px;">
<rect width="150" height="100" rx="15" />
</svg>

<div></div>

</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,17 @@ public void testPaddingPercentage() throws IOException {
public void testSvgInWrapperWithNamedPage() throws IOException {
assertTrue(vt.runTest("svg-in-wrapper-with-named-page", TestSupport.WITH_SVG));
}


/**
* Tests that styles applying to internal SVG objects such as rect
* are passed to Batik for rendering.
*/
@Test
@Ignore // SVG styles not being passed to Batik.
public void testIssue493SVGStyles() throws IOException {
assertTrue(vt.runTest("issue-493-svg-styles", TestSupport.WITH_SVG));
}

/**
* Tests that a broken image inside a table cell renders with a zero sized image rather
* than crashing with a NPE. See issue 336.
Expand Down

0 comments on commit 3b28992

Please sign in to comment.