diff options
author | Mehdi Houshmand <mehdi@apache.org> | 2012-10-30 09:26:59 +0000 |
---|---|---|
committer | Mehdi Houshmand <mehdi@apache.org> | 2012-10-30 09:26:59 +0000 |
commit | 7d6311b01e8a4b94913f5ddff514f15f049f99b5 (patch) | |
tree | 217d2e2b3094ada2ad939cd914d905f9b8bbf818 /test/java | |
parent | 7e09a8037fc79d14550c301ea039f9163a735b19 (diff) | |
download | xmlgraphics-fop-7d6311b01e8a4b94913f5ddff514f15f049f99b5.tar.gz xmlgraphics-fop-7d6311b01e8a4b94913f5ddff514f15f049f99b5.zip |
Bugzilla#45822: Changed the dashed borders to appear more like dashes and less like dotted-borders
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1403643 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/java')
3 files changed, 95 insertions, 4 deletions
diff --git a/test/java/org/apache/fop/render/intermediate/BorderPainterTestCase.java b/test/java/org/apache/fop/render/intermediate/BorderPainterTestCase.java index ab5c18c9e..f0e9522d9 100644 --- a/test/java/org/apache/fop/render/intermediate/BorderPainterTestCase.java +++ b/test/java/org/apache/fop/render/intermediate/BorderPainterTestCase.java @@ -23,10 +23,6 @@ import java.io.IOException; import org.junit.Test; -import org.apache.fop.fo.Constants; -import org.apache.fop.traits.BorderProps; -import org.apache.fop.traits.BorderProps.Mode; - import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.doThrow; @@ -36,6 +32,10 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; +import org.apache.fop.fo.Constants; +import org.apache.fop.traits.BorderProps; +import org.apache.fop.traits.BorderProps.Mode; + public class BorderPainterTestCase { private static final BorderProps BORDER_PROPS = new BorderProps(Constants.EN_SOLID, 10, 50, 50, diff --git a/test/java/org/apache/fop/render/pdf/PDFBorderPainterTestCase.java b/test/java/org/apache/fop/render/pdf/PDFBorderPainterTestCase.java new file mode 100644 index 000000000..5acad9837 --- /dev/null +++ b/test/java/org/apache/fop/render/pdf/PDFBorderPainterTestCase.java @@ -0,0 +1,47 @@ +package org.apache.fop.render.pdf; + +import java.awt.Color; +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertTrue; + +import org.apache.fop.fo.Constants; +import org.apache.fop.pdf.PDFDocument; + +public class PDFBorderPainterTestCase { + + private PDFContentGenerator generator; + private ByteArrayOutputStream outStream; + private PDFGraphicsPainter borderPainter; + + @Before + public void setUp() { + outStream = new ByteArrayOutputStream(); + generator = new PDFContentGenerator(new PDFDocument("test"), outStream, null); + borderPainter = new PDFGraphicsPainter(generator); + } + + /** + * This test will fail if either of the below statements isn't true: + * org.apache.fop.render.intermediate.BorderPainter.DASHED_BORDER_SPACE_RATIO = 0.5f:q + * org.apache.fop.render.intermediate.BorderPainter.DASHED_BORDER_LENGTH_FACTOR = 4.0f. + */ + @Test + public void testDrawBorderLine() throws Exception { + borderPainter.drawBorderLine(0, 0, 40000, 1000, true, true, + Constants.EN_DASHED, Color.BLACK); + generator.flushPDFDoc(); + OutputStream outStream = new ByteArrayOutputStream(); + outStream = generator.getStream().getBufferOutputStream(); + assertTrue(((ByteArrayOutputStream) outStream).toString().contains("[4 2] 0 d 1 w")); + } + + public void tearDown() { + generator = null; + outStream= null; + } +} diff --git a/test/java/org/apache/fop/render/ps/PSBorderPainterTestCase.java b/test/java/org/apache/fop/render/ps/PSBorderPainterTestCase.java new file mode 100644 index 000000000..1ffe87982 --- /dev/null +++ b/test/java/org/apache/fop/render/ps/PSBorderPainterTestCase.java @@ -0,0 +1,44 @@ +package org.apache.fop.render.ps; + +import java.awt.Color; +import java.io.ByteArrayOutputStream; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertTrue; + +import org.apache.xmlgraphics.ps.PSGenerator; + +import org.apache.fop.fo.Constants; + +public class PSBorderPainterTestCase { + + private PSGenerator generator; + private ByteArrayOutputStream outStream; + private PSGraphicsPainter borderPainter; + + @Before + public void setUp() { + outStream = new ByteArrayOutputStream(); + generator = new PSGenerator(outStream); + borderPainter = new PSGraphicsPainter(generator); + } + + /** + * This test will fail if either of the below statements isn't true: + * org.apache.fop.render.intermediate.BorderPainter.DASHED_BORDER_SPACE_RATIO = 0.5f:q + * org.apache.fop.render.intermediate.BorderPainter.DASHED_BORDER_LENGTH_FACTOR = 4.0f. + */ + @Test + public void testDrawBorderLine() throws Exception { + borderPainter.drawBorderLine(0, 0, 40000, 1000, true, true, + Constants.EN_DASHED, Color.BLACK); + assertTrue(outStream.toString().contains("[4.0 2.0] 0 setdash")); + } + + public void tearDown() { + generator = null; + outStream= null; + } +} |