Skip to content

Commit

Permalink
#336 - Tests around broken images and images with display: block.
Browse files Browse the repository at this point in the history
Currently broken image links are causing a NPE.
  • Loading branch information
danfickle committed Mar 17, 2019
1 parent c605ec1 commit fef8e73
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 0 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<html>
<head>
<style>
@page {
size: 200px 200px;
margin: 0;
}
body {
margin: 0;
}
</style>
</head>
<body>
<span style="display: inline-block; border: 1px solid green;"><img src="../../demos/images/flyingsaucer.png" /></span>
<span style="display: inline-block; border: 1px solid red;"><img src="this-image-does-not-exist.png" /></span>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<html>
<head>
<style>
@page {
size: 200px 200px;
margin: 0;
}
body {
margin: 0;
}
</style>
</head>
<body>
<table>
<tr><td style="border: 1px solid green;"><img src="../../demos/images/flyingsaucer.png" /></td></tr>
<tr><td style="border: 1px solid red;"><img src="this-image-does-not-exist.png" /></td></tr>
</table>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<html>
<head>
<style>
@page {
size: 200px 100px;
margin: 5px;
}
</style>
</head>
<body>
<img style="display: block; border: 2px solid red;" src="../../demos/images/flyingsaucer.png" />
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,34 @@ public void testSvgInWrapperWithNamedPage() throws IOException {
assertTrue(vt.runTest("svg-in-wrapper-with-named-page", 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.
*/
@Test
@Ignore
public void testBrokenImgInTableCell() throws IOException {
assertTrue(vt.runTest("broken-img-in-table-cell"));
}

/**
* Tests that a broken image inside an inline block does not show and
* does not crash. See issue 336.
*/
@Test
@Ignore
public void testBrokenImgInInlineBlock() throws IOException {
assertTrue(vt.runTest("broken-img-in-inline-block"));
}

/**
* Tests that an image can have display: block and break over two pages.
*/
@Test
public void testReplacedImgDisplayBlock() throws IOException {
assertTrue(vt.runTest("replaced-img-display-block"));
}

// TODO:
// + Elements that appear just on generated overflow pages.
// + content property (page counters, etc)
Expand Down

0 comments on commit fef8e73

Please sign in to comment.