aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAdrian Cumiskey <acumiskey@apache.org>2008-07-31 16:23:51 +0000
committerAdrian Cumiskey <acumiskey@apache.org>2008-07-31 16:23:51 +0000
commitc416edbaae9fe4ecd77ecd35e5bbd8edf524e489 (patch)
tree907f3dadb280993349547dac82ad033f773daf76 /test
parentd71f26e615fb573e19786a8297959dbb0f5741ef (diff)
downloadxmlgraphics-fop-c416edbaae9fe4ecd77ecd35e5bbd8edf524e489.tar.gz
xmlgraphics-fop-c416edbaae9fe4ecd77ecd35e5bbd8edf524e489.zip
Merged revisions 681296,681307 via svnmerge from
https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ................ r681296 | jeremias | 2008-07-31 09:07:42 +0100 (Thu, 31 Jul 2008) | 12 lines Blocked revisions 681286,681291 via svnmerge ........ r681286 | jeremias | 2008-07-31 09:15:23 +0200 (Do, 31 Jul 2008) | 1 line Move to XML Graphics Commons 1.3.1. ........ r681291 | jeremias | 2008-07-31 09:45:13 +0200 (Do, 31 Jul 2008) | 1 line Increase version number. ........ ................ r681307 | jeremias | 2008-07-31 10:06:10 +0100 (Thu, 31 Jul 2008) | 149 lines Merged revisions 636407-637074,637076-637118,637120-637790,637792-637856,637858-637992,637994-638047,638049-638307,638309-638315,638318-638936,638938-640888,640890-642905,642907-647402,647404-647536,647538-648983,648985-649005,649007-649013,649015-650549,650551-651301,651303-653536,653538-654452,654454-656285,656287-656523,656525-657519,657521-661579,661581-663481,663483-664691,664693-681285,681287-681290,681292-681298 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_95 ........ r666635 | jeremias | 2008-06-11 14:18:53 +0200 (Mi, 11 Jun 2008) | 1 line Fixed resolution handling inside AWT preview dialog. ........ r666662 | jeremias | 2008-06-11 15:33:20 +0200 (Mi, 11 Jun 2008) | 1 line Some notes on RTF and print output. ........ r668533 | jeremias | 2008-06-17 09:57:55 +0200 (Di, 17 Jun 2008) | 2 lines Bugzilla #45151: Note on the "compiling" page that Ant 1.7 is required. The README file already points to this page. ........ r668534 | jeremias | 2008-06-17 09:58:40 +0200 (Di, 17 Jun 2008) | 2 lines Update known issues. Remove ApacheConEU logo. ........ r668550 | jeremias | 2008-06-17 10:05:22 +0200 (Di, 17 Jun 2008) | 2 lines Bugzilla #45146: Removed duplicate LICENSE.txt and Notice.txt from the JAR. ........ r668570 | jeremias | 2008-06-17 10:54:07 +0200 (Di, 17 Jun 2008) | 1 line Wrong line number reported in the case of a line overflow. ........ r668641 | jeremias | 2008-06-17 14:59:25 +0200 (Di, 17 Jun 2008) | 1 line Fixed potential NPE. ........ r669118 | jeremias | 2008-06-18 11:02:45 +0200 (Mi, 18 Jun 2008) | 4 lines Bugzilla #44412: Regression fix for empty pages caused by multiple collapsible breaks. No more empty block areas if a break-before occurs on the first child of an FO to match the behaviour of tables and other FO implementations (clarification by XSL WG pending). Added an accessor interface for break-before/-after to avoid long if..else lists in BlockStackingLayoutManager. ........ r669173 | jeremias | 2008-06-18 16:07:27 +0200 (Mi, 18 Jun 2008) | 7 lines Bugzilla #44887: Fixed potential multi-threading problem concerning the use of DecimalFormat. Results from performance measurements in a separate test (operation repeated 100'000 times, exemplary): shared static variable: ~220ms (old choice, problematic!) always create new instance: ~480ms ThreadLocal: ~220ms (new choice) ........ r669478 | jeremias | 2008-06-19 15:03:57 +0200 (Do, 19 Jun 2008) | 4 lines Bugzilla #44412: Improvements after Vincent's feedback: Removal of the somewhat ugly Reference. getBreakBefore() reduced to private visibility. ........ r670551 | jeremias | 2008-06-23 14:54:27 +0200 (Mo, 23 Jun 2008) | 3 lines Use configured source and target resolution for foreign objects in RTF output. Fixed intrinsic size calculation for SVG images when source resolution is not 72 dpi. Fixed calculation of px2mm values in the SVG to G2D converter (used by RTF output). ........ r673750 | adelmelle | 2008-07-03 20:25:01 +0200 (Do, 03 Jul 2008) | 1 line Fix for Bugzilla 45295 (already committed to the trunk with r672010, r672495 and r672496) ........ r674304 | jeremias | 2008-07-06 17:09:10 +0200 (So, 06 Jul 2008) | 18 lines Bugzilla #43606: column-width accepts percent values (proportional-column-width and % working) Table width accepts percent values (100% of the page width as standard) Nested tables are working It is also possible to make nested tables with a higher depth than 3 without causing word to crash Submitted by: Maximilan Aster <maximilian.aster.at.boc-eu.com> Changes to the patch by Jeremias: - Patch simplified (reuse of ColumnSetup from the layoutmgr package) - Percentages and proportional-column-width didn't work properly in my tests -> fixed - Adjustments for FOP code conventions Bugzilla #43824: page-number-citation working but has to be refreshed inside word to show the correct values Submitted by: Maximilan Aster <maximilian.aster.at.boc-eu.com> Changes to the patch by Jeremias: - Adjustments for FOP code conventions ........ r674314 | jeremias | 2008-07-06 18:40:08 +0200 (So, 06 Jul 2008) | 7 lines Bugzilla #43825: leader supports fixed percent values for leader-length, most other properties use-content, leader-pattern-width not implemented Submitted by: Maximilan Aster <maximilian.aster.at.boc-eu.com> Changes to the patch by Jeremias: - Adjustments for FOP code conventions ........ r674317 | jeremias | 2008-07-06 18:44:43 +0200 (So, 06 Jul 2008) | 1 line Doc update after RTF changes. ........ r675106 | jeremias | 2008-07-09 09:03:46 +0200 (Mi, 09 Jul 2008) | 2 lines Bugzilla #45366: Document missing feature. ........ r675150 | jeremias | 2008-07-09 14:56:41 +0200 (Mi, 09 Jul 2008) | 2 lines Bugzilla #39980: Fixed image scaling for RTF output. ........ r675151 | jeremias | 2008-07-09 14:57:06 +0200 (Mi, 09 Jul 2008) | 1 line Removed unused code. ........ r675152 | jeremias | 2008-07-09 14:58:18 +0200 (Mi, 09 Jul 2008) | 1 line Don't generate commands for default values. ........ r675707 | jeremias | 2008-07-10 21:58:27 +0200 (Do, 10 Jul 2008) | 1 line Bugfix: -imagein didn't work because the stylesheet didn't get copied into fop.jar. ........ r680715 | jeremias | 2008-07-29 16:37:10 +0200 (Di, 29 Jul 2008) | 1 line Found a surplus "pop state" which somehow causes a regression (fill color doesn't get properly reset) between 0.94 and 0.95. Shows in Barcode4J's fop-extension-demo.fo. The line has already been there in 0.94 but only shows in 0.95 probably due to an additional save/restore state pair added in PDFRenderer for reference areas after the block-container area refactoring. ........ r680820 | jeremias | 2008-07-29 22:02:14 +0200 (Di, 29 Jul 2008) | 2 lines Bugzilla #41306: The AWT Renderer is really not out-of-order capable. ........ r681284 | jeremias | 2008-07-31 08:47:49 +0200 (Do, 31 Jul 2008) | 1 line Some updates to status.xml (I was not the only one working on the final release). ........ r681290 | jeremias | 2008-07-31 09:44:51 +0200 (Do, 31 Jul 2008) | 2 lines Website updates for the 0.95 release. The projectInfo plug-in of Forrest is not ideal for doing a bugfix release. It's not possible to combine the changes for two releases. ........ r681292 | jeremias | 2008-07-31 09:47:13 +0200 (Do, 31 Jul 2008) | 1 line Disabling the ApacheCon ad for the release build. ........ ................ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@681410 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
-rw-r--r--test/java/org/apache/fop/image/loader/batik/ImageLoaderTestCase.java45
-rw-r--r--test/layoutengine/standard-testcases/block_break-before_bug44412.xml17
-rw-r--r--test/layoutengine/standard-testcases/block_break-before_bug44412_2.xml151
-rw-r--r--test/resources/images/circles.svg8
4 files changed, 208 insertions, 13 deletions
diff --git a/test/java/org/apache/fop/image/loader/batik/ImageLoaderTestCase.java b/test/java/org/apache/fop/image/loader/batik/ImageLoaderTestCase.java
index c6c4015cc..457aa91d4 100644
--- a/test/java/org/apache/fop/image/loader/batik/ImageLoaderTestCase.java
+++ b/test/java/org/apache/fop/image/loader/batik/ImageLoaderTestCase.java
@@ -88,6 +88,51 @@ public class ImageLoaderTestCase extends TestCase {
assertEquals(16000, info.getSize().getHeightMpt());
}
+ public void testSVGNoViewbox() throws Exception {
+ String uri = "test/resources/images/circles.svg";
+
+ FopFactory ff = FopFactory.newInstance();
+ ff.setSourceResolution(96);
+ ff.setTargetResolution(300);
+
+ FOUserAgent userAgent = ff.newFOUserAgent();
+
+ ImageManager manager = ff.getImageManager();
+ ImageInfo info = manager.preloadImage(uri, userAgent.getImageSessionContext());
+ assertNotNull("ImageInfo must not be null", info);
+
+ Image img = manager.getImage(info, ImageFlavor.XML_DOM,
+ userAgent.getImageSessionContext());
+ assertNotNull("Image must not be null", img);
+ assertEquals(ImageFlavor.XML_DOM, img.getFlavor());
+ ImageXMLDOM imgDom = (ImageXMLDOM)img;
+ assertNotNull(imgDom.getDocument());
+ assertEquals("http://www.w3.org/2000/svg", imgDom.getRootNamespace());
+ info = imgDom.getInfo(); //Switch to the ImageInfo returned by the image
+ assertEquals(96, info.getSize().getDpiHorizontal(), 0);
+ assertEquals(340158, info.getSize().getWidthMpt());
+ assertEquals(340158, info.getSize().getHeightMpt());
+ assertEquals(454, info.getSize().getWidthPx());
+ assertEquals(454, info.getSize().getHeightPx());
+
+ img = manager.getImage(info, ImageFlavor.RENDERED_IMAGE,
+ userAgent.getImageSessionContext());
+ assertNotNull("Image must not be null", img);
+ assertEquals(ImageFlavor.RENDERED_IMAGE, img.getFlavor());
+ ImageRendered imgRed = (ImageRendered)img;
+ assertNotNull(imgRed.getRenderedImage());
+ if (DEBUG_TARGET_DIR != null) {
+ ImageWriterUtil.saveAsPNG(imgRed.getRenderedImage(),
+ (int)userAgent.getTargetResolution(),
+ new File(DEBUG_TARGET_DIR, "circles.svg.png"));
+ }
+ assertEquals(1418, imgRed.getRenderedImage().getWidth());
+ assertEquals(1418, imgRed.getRenderedImage().getHeight());
+ info = imgRed.getInfo(); //Switch to the ImageInfo returned by the image
+ assertEquals(340158, info.getSize().getWidthMpt());
+ assertEquals(340158, info.getSize().getHeightMpt());
+ }
+
public void testWMF() throws Exception {
String uri = "test/resources/images/testChart.wmf";
diff --git a/test/layoutengine/standard-testcases/block_break-before_bug44412.xml b/test/layoutengine/standard-testcases/block_break-before_bug44412.xml
index 9ef4150b5..cc5bcd3c8 100644
--- a/test/layoutengine/standard-testcases/block_break-before_bug44412.xml
+++ b/test/layoutengine/standard-testcases/block_break-before_bug44412.xml
@@ -20,8 +20,7 @@
<info>
<p>
This test checks Bugzilla #44412 where a break-before on the first child of an otherwise
- empty block is set. It is expected that the parent block creates two areas, the first with
- only border-before on the first page and zero bpd.
+ empty block is set.
</p>
</info>
<fo>
@@ -44,20 +43,12 @@
</fo:root>
</fo>
<checks>
- <eval expected="2" xpath="count(//block[@prod-id = 'b1'])"/>
- <eval expected="4000 4000 4000 0" xpath="(//block[@prod-id = 'b1'])[1]/@bap"/>
- <eval expected="4000 4000 0 4000" xpath="(//block[@prod-id = 'b1'])[2]/@bap"/>
- <eval expected="0" xpath="(//block[@prod-id = 'b1'])[1]/@bpd"/>
- <eval expected="43200" xpath="(//block[@prod-id = 'b1'])[2]/@bpd"/>
+ <eval expected="1" xpath="count(//block[@prod-id = 'b1'])"/>
+ <eval expected="4000 4000 4000 4000" xpath="(//block[@prod-id = 'b1'])[1]/@bap"/>
+ <eval expected="43200" xpath="(//block[@prod-id = 'b1'])[1]/@bpd"/>
<element-list category="breaker" index="0">
<box w="14400"/>
- <penalty w="0" p="0"/>
- <box w="0" aux="true"/>
- <penalty w="0" p="INF"/>
- <glue w="4000"/> <!-- border-before -->
- <box w="0"/> <!-- first block area of the "b1" block with zero bpd -->
-
<skip>3</skip>
</element-list>
</checks>
diff --git a/test/layoutengine/standard-testcases/block_break-before_bug44412_2.xml b/test/layoutengine/standard-testcases/block_break-before_bug44412_2.xml
new file mode 100644
index 000000000..3f54f809a
--- /dev/null
+++ b/test/layoutengine/standard-testcases/block_break-before_bug44412_2.xml
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- $Id$ -->
+<testcase>
+ <info>
+ <p>
+ This test checks for the correct behaviour of multiple breaks at the same break possibility.
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="page" page-height="5in" page-width="5in" margin="20pt">
+ <fo:region-body/>
+ <fo:region-after extent="1.2em"/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="page" id="ps1" initial-page-number="1" force-page-count="no-force">
+ <fo:static-content flow-name="xsl-region-after">
+ <fo:block>page: <fo:page-number/></fo:block>
+ </fo:static-content>
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block id="b1">Before the break</fo:block>
+ <fo:block break-before="page" break-after="column">
+ <fo:block id="b2" break-before="page">
+ This text should be on page 2.
+ </fo:block>
+ <fo:block>
+ <fo:block id="b3" break-after="page">
+ Inner block with break-after.
+ </fo:block>
+ </fo:block>
+ </fo:block>
+ <fo:block id="b4">This text should be on page 3.</fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ <fo:page-sequence master-reference="page" id="ps2" initial-page-number="1" force-page-count="no-force">
+ <fo:static-content flow-name="xsl-region-after">
+ <fo:block>page: <fo:page-number/></fo:block>
+ </fo:static-content>
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block id="b11">Before the break</fo:block>
+ <fo:block-container break-before="page" break-after="column">
+ <fo:block-container break-before="page">
+ <fo:block id="b12">This text should be on page 2.</fo:block>
+ </fo:block-container>
+ <fo:block>
+ <fo:block id="b13" break-after="page">
+ Inner block with break-after.
+ </fo:block>
+ </fo:block>
+ </fo:block-container>
+ <fo:block id="b14">This text should be on page 3.</fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ <fo:page-sequence master-reference="page" id="ps3" initial-page-number="1" force-page-count="no-force">
+ <fo:static-content flow-name="xsl-region-after">
+ <fo:block>page: <fo:page-number/></fo:block>
+ </fo:static-content>
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block id="b21">Before the break</fo:block>
+ <fo:block break-before="page" break-after="column">
+ <fo:table table-layout="fixed" width="100%" break-before="page">
+ <fo:table-column column-width="proportional-column-width(1)"/>
+ <fo:table-body>
+ <fo:table-row>
+ <fo:table-cell>
+ <fo:block id="b22">This text should be on page 2.</fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </fo:table-body>
+ </fo:table>
+ <fo:block>
+ <fo:table table-layout="fixed" width="100%" break-after="page">
+ <fo:table-column column-width="proportional-column-width(1)"/>
+ <fo:table-body>
+ <fo:table-row>
+ <fo:table-cell>
+ <fo:block id="b23">Inner block in table with break-after.</fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </fo:table-body>
+ </fo:table>
+ </fo:block>
+ </fo:block>
+ <fo:block id="b24">This text should be on page 3.</fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ <fo:page-sequence master-reference="page" id="ps4" initial-page-number="1" force-page-count="no-force">
+ <fo:static-content flow-name="xsl-region-after">
+ <fo:block>page: <fo:page-number/></fo:block>
+ </fo:static-content>
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block id="b31">Before the break</fo:block>
+ <fo:block break-before="page" break-after="column">
+ <fo:list-block break-before="page">
+ <fo:list-item>
+ <fo:list-item-label end-indent="label-end()">
+ <fo:block>+</fo:block>
+ </fo:list-item-label>
+ <fo:list-item-body start-indent="body-start()">
+ <fo:block id="b32">This text should be on page 2.</fo:block>
+ </fo:list-item-body>
+ </fo:list-item>
+ <fo:list-item break-after="page">
+ <fo:list-item-label end-indent="label-end()">
+ <fo:block>+</fo:block>
+ </fo:list-item-label>
+ <fo:list-item-body start-indent="body-start()">
+ <fo:block id="b33">Inner block in list-item with break-after.</fo:block>
+ </fo:list-item-body>
+ </fo:list-item>
+ </fo:list-block>
+ </fo:block>
+ <fo:block id="b34">This text should be on page 3.</fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <eval expected="1" xpath="//block[@prod-id = 'b1']/ancestor::pageViewport/@nr"/>
+ <eval expected="2" xpath="//block[@prod-id = 'b2']/ancestor::pageViewport/@nr"/>
+ <eval expected="2" xpath="//block[@prod-id = 'b3']/ancestor::pageViewport/@nr"/>
+ <eval expected="3" xpath="//block[@prod-id = 'b4']/ancestor::pageViewport/@nr"/>
+
+ <eval expected="1" xpath="//block[@prod-id = 'b11']/ancestor::pageViewport/@nr"/>
+ <eval expected="2" xpath="//block[@prod-id = 'b12']/ancestor::pageViewport/@nr"/>
+ <eval expected="2" xpath="//block[@prod-id = 'b13']/ancestor::pageViewport/@nr"/>
+ <eval expected="3" xpath="//block[@prod-id = 'b14']/ancestor::pageViewport/@nr"/>
+
+ <eval expected="1" xpath="//block[@prod-id = 'b21']/ancestor::pageViewport/@nr"/>
+ <eval expected="2" xpath="//block[@prod-id = 'b22']/ancestor::pageViewport/@nr"/>
+ <eval expected="2" xpath="//block[@prod-id = 'b23']/ancestor::pageViewport/@nr"/>
+ <eval expected="3" xpath="//block[@prod-id = 'b24']/ancestor::pageViewport/@nr"/>
+ </checks>
+</testcase>
diff --git a/test/resources/images/circles.svg b/test/resources/images/circles.svg
new file mode 100644
index 000000000..8b71e8224
--- /dev/null
+++ b/test/resources/images/circles.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="12cm" height="12cm">
+ <g style="fill-opacity:0.7; stroke:black; stroke-width:0.1cm;">
+ <circle cx="6cm" cy="2cm" r="100" style="fill:red;" transform="translate(0,50)" />
+ <circle cx="6cm" cy="2cm" r="100" style="fill:blue;" transform="translate(70,150)" />
+ <circle cx="6cm" cy="2cm" r="100" style="fill:green;" transform="translate(-70,150)"/>
+ </g>
+</svg> \ No newline at end of file