diff options
author | Vincent Hennebert <vhennebert@apache.org> | 2011-03-24 18:14:23 +0000 |
---|---|---|
committer | Vincent Hennebert <vhennebert@apache.org> | 2011-03-24 18:14:23 +0000 |
commit | c0388acf51d54ca414b91bb06941f041fd09497a (patch) | |
tree | 0b38a2a4d8dec65695b4f520beb124bee0747dcb | |
parent | 823d0e968d25875f9774f62f2f5264863cb35ba9 (diff) | |
download | xmlgraphics-fop-c0388acf51d54ca414b91bb06941f041fd09497a.tar.gz xmlgraphics-fop-c0388acf51d54ca414b91bb06941f041fd09497a.zip |
Bugzilla #50763: Implemented non-standard behavior for basic-link areas, such that they take into account the heights of their descendants areas
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1085058 13f79535-47bb-0310-9956-ffa450edef68
14 files changed, 449 insertions, 33 deletions
diff --git a/src/java/org/apache/fop/area/inline/AbstractTextArea.java b/src/java/org/apache/fop/area/inline/AbstractTextArea.java index 08997a817..1558e8160 100644 --- a/src/java/org/apache/fop/area/inline/AbstractTextArea.java +++ b/src/java/org/apache/fop/area/inline/AbstractTextArea.java @@ -185,4 +185,15 @@ public abstract class AbstractTextArea extends InlineParent { public void setBaselineOffset(int baselineOffset) { this.baselineOffset = baselineOffset; } + + @Override + int getVirtualOffset() { + return getOffset(); + } + + @Override + int getVirtualBPD() { + /* Word and space areas don't have a properly set bpd; return this area's bpd instead. */ + return getBPD(); + } } diff --git a/src/java/org/apache/fop/area/inline/BasicLinkArea.java b/src/java/org/apache/fop/area/inline/BasicLinkArea.java new file mode 100644 index 000000000..fce913944 --- /dev/null +++ b/src/java/org/apache/fop/area/inline/BasicLinkArea.java @@ -0,0 +1,53 @@ +/* + * 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$ */ + +package org.apache.fop.area.inline; + +import org.apache.fop.area.Area; + +/** + * An inline area produced by an fo:basic-link element. This class implements a different + * behavior to what is prescribed by the XSL-FO 1.1 Recommendation. With the standard + * behavior, there is no easy way to make a link cover e.g. a whole image. + * + * <p>See following bug report at W3C's: + * http://www.w3.org/Bugs/Public/show_bug.cgi?id=11672</p> + */ +public class BasicLinkArea extends InlineParent { + + private static final long serialVersionUID = 5183753430412208151L; + + @Override + public void setParentArea(Area parentArea) { + super.setParentArea(parentArea); + /* + * Perform necessary modifications to make this area encompass all of its children + * elements, so as to have a useful active area. We assume that this method is + * called after all of the children areas have been added to this area. + */ + /* Make this area start at its beforest child. */ + setOffset(getOffset() + minChildOffset); + /* Update children offsets accordingly. */ + for (InlineArea inline : inlines) { + inline.setOffset(inline.getOffset() - minChildOffset); + } + setBPD(getVirtualBPD()); + } + +} diff --git a/src/java/org/apache/fop/area/inline/InlineArea.java b/src/java/org/apache/fop/area/inline/InlineArea.java index 515f45b68..d62e6f721 100644 --- a/src/java/org/apache/fop/area/inline/InlineArea.java +++ b/src/java/org/apache/fop/area/inline/InlineArea.java @@ -251,5 +251,32 @@ public class InlineArea extends Area { storedIPDVariation += ipdVariation; } } + + /** + * Returns the offset that this area would have if its offset and size were taking + * children areas into account. The bpd of an inline area is taken from its nominal + * font and doesn't depend on the bpds of its children elements. However, in the case + * of a basic-link element we want the active area to cover all of the children + * elements. + * + * @return the offset that this area would have if the before-edge of its + * content-rectangle were coinciding with the <q>beforest</q> before-edge of its + * children allocation-rectangles. + * @see #getVirtualBPD() + * @see BasicLinkArea + */ + int getVirtualOffset() { + return getOffset(); + } + + /** + * Returns the block-progression-dimension that this area would have if it were taking + * its children elements into account. See {@linkplain #getVirtualOffset()}. + * + * @return the bpd + */ + int getVirtualBPD() { + return getBPD(); + } } diff --git a/src/java/org/apache/fop/area/inline/InlineParent.java b/src/java/org/apache/fop/area/inline/InlineParent.java index db8f2f056..521080469 100644 --- a/src/java/org/apache/fop/area/inline/InlineParent.java +++ b/src/java/org/apache/fop/area/inline/InlineParent.java @@ -39,31 +39,42 @@ public class InlineParent extends InlineArea { /** Controls whether the IPD is automatically adjusted based on the area's children. */ protected transient boolean autoSize; - /** - * Create a new inline parent to add areas to. - */ - public InlineParent() { - } + /** The offset of the <q>beforest</q> child area of this area. */ + protected int minChildOffset; /** - * Override generic Area method. - * - * @param childArea the child area to add + * The offset of the <q>afterest</q> child area of this area. Offset from the + * before-edge of this area's content-rectangle and the after-edge of the child area's + * allocation-rectangle. */ + private int maxAfterEdge; + @Override - public void addChildArea(Area childArea) { + public void addChildArea(Area c) { + assert c instanceof InlineArea; if (inlines.size() == 0) { autoSize = (getIPD() == 0); } - if (childArea instanceof InlineArea) { - InlineArea inlineChildArea = (InlineArea) childArea; - inlines.add(inlineChildArea); - // set the parent area for the child area - inlineChildArea.setParentArea(this); - if (autoSize) { - increaseIPD(inlineChildArea.getAllocIPD()); - } + InlineArea childArea = (InlineArea) c; + inlines.add(childArea); + // set the parent area for the child area + childArea.setParentArea(this); + if (autoSize) { + increaseIPD(childArea.getAllocIPD()); } + int childOffset = childArea.getVirtualOffset(); + minChildOffset = Math.min(minChildOffset, childOffset); + maxAfterEdge = Math.max(maxAfterEdge, childOffset + childArea.getVirtualBPD()); + } + + @Override + int getVirtualOffset() { + return getOffset() + minChildOffset; + } + + @Override + int getVirtualBPD() { + return maxAfterEdge - minChildOffset; } /** @@ -98,5 +109,6 @@ public class InlineParent extends InlineArea { return hasUnresolvedAreas; } + } diff --git a/src/java/org/apache/fop/layoutmgr/inline/BasicLinkLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/BasicLinkLayoutManager.java index eef649c97..40c9a324e 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/BasicLinkLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/BasicLinkLayoutManager.java @@ -21,7 +21,9 @@ package org.apache.fop.layoutmgr.inline; import org.apache.fop.area.LinkResolver; import org.apache.fop.area.Trait; +import org.apache.fop.area.inline.BasicLinkArea; import org.apache.fop.area.inline.InlineArea; +import org.apache.fop.area.inline.InlineParent; import org.apache.fop.datatypes.URISpecification; import org.apache.fop.fo.Constants; import org.apache.fop.fo.flow.BasicLink; @@ -77,4 +79,10 @@ public class BasicLinkLayoutManager extends InlineLayoutManager { } } } + + @Override + protected InlineParent createInlineParent() { + return new BasicLinkArea(); + } + } diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java index 085174fae..9563b491e 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java @@ -198,13 +198,13 @@ public class InlineLayoutManager extends InlineStackingLayoutManager { /** * Create and initialize an <code>InlineArea</code> * - * @param hasInlineParent true if the parent is an inline + * @param isInline true if the parent is an inline * @return the area */ - protected InlineArea createArea(boolean hasInlineParent) { + protected InlineArea createArea(boolean isInline) { InlineArea area; - if (hasInlineParent) { - area = new InlineParent(); + if (isInline) { + area = createInlineParent(); area.setOffset(0); } else { area = new InlineBlockParent(); @@ -215,6 +215,10 @@ public class InlineLayoutManager extends InlineStackingLayoutManager { return area; } + protected InlineParent createInlineParent() { + return new InlineParent(); + } + /** {@inheritDoc} */ @Override protected void setTraits(boolean isNotFirst, boolean isNotLast) { diff --git a/status.xml b/status.xml index 304c08173..20a77f567 100644 --- a/status.xml +++ b/status.xml @@ -59,6 +59,10 @@ documents. Example: the fix of marks layering will be such a case when it's done. --> <release version="FOP Trunk" date="TBD"> + <action context="Layout" dev="VH" type="fix" fixex-bug="50763"> + Implemented non-standard behavior for basic-link areas, such that they take into account the + heights of their descendants areas. + </action> <action context="Layout" dev="VH" type="fix"> Bugfix: keep-together does not apply to fo:table-cell. </action> diff --git a/test/layoutengine/disabled-testcases.xml b/test/layoutengine/disabled-testcases.xml index 6c61ca747..cd63ad03f 100644 --- a/test/layoutengine/disabled-testcases.xml +++ b/test/layoutengine/disabled-testcases.xml @@ -20,13 +20,6 @@ <!--DOCTYPE disabled-testcases SYSTEM "disabled-testcases.dtd"--> <disabled-testcases> <testcase> - <name>External link around an SVG not properly sized</name> - <file>basic-link_external-destination_2.xml</file> - <description>The bpd trait of the inlineparent area for the basic-link - is not sized correctly if it wraps an image that is higher than the - nominal line.</description> - </testcase> - <testcase> <name>Auto-height block-containers produce fences</name> <file>block-container_space-before_space-after_3.xml</file> <description>Block-containers with no height currently don't diff --git a/test/layoutengine/standard-testcases/basic-link_external-destination_2.xml b/test/layoutengine/standard-testcases/basic-link_external-destination_2.xml index f804893ac..0f00da82c 100644 --- a/test/layoutengine/standard-testcases/basic-link_external-destination_2.xml +++ b/test/layoutengine/standard-testcases/basic-link_external-destination_2.xml @@ -47,10 +47,12 @@ </fo:root> </fo> <checks> - <eval expected="192000" xpath="//inlineparent[@prod-id='link']/viewport/@ipd"/> - <eval expected="192000" xpath="//inlineparent[@prod-id='link']/viewport/@bpd"/> - - <eval expected="192000" xpath="//inlineparent[@prod-id='link']/@ipd"/> - <eval expected="192000" xpath="//inlineparent[@prod-id='link']/@bpd"/> + <eval expected="144000" xpath="//inlineparent[@prod-id='link']/@ipd"/> + <eval expected="144000" xpath="//inlineparent[@prod-id='link']/@bpd"/> + <eval expected="0" xpath="//inlineparent[@prod-id='link']/@offset"/> + + <eval expected="144000" xpath="//inlineparent[@prod-id='link']/viewport/@ipd"/> + <eval expected="144000" xpath="//inlineparent[@prod-id='link']/viewport/@bpd"/> + <eval expected="0" xpath="//inlineparent[@prod-id='link']/viewport/@offset"/> </checks> </testcase> diff --git a/test/layoutengine/standard-testcases/basic-link_height.xml b/test/layoutengine/standard-testcases/basic-link_height.xml new file mode 100644 index 000000000..cb56f7f00 --- /dev/null +++ b/test/layoutengine/standard-testcases/basic-link_height.xml @@ -0,0 +1,53 @@ +<?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 the height of an fo:basic-link wrapping a bigger element. + </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="420pt" page-width="320pt" margin="10pt"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="page"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In in <fo:basic-link + id="link" color="blue" + external-destination="url(http://xmlgraphics.apache.org/fop/)"><fo:inline id="inline" + font-size="24pt" baseline-shift="12pt">egestas</fo:inline></fo:basic-link> nisi. + Etiam at ante eget velit placerat ullamcorper.</fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="84048" xpath="//inlineparent[@prod-id='link']/@ipd"/> + <eval expected="22200" xpath="//inlineparent[@prod-id='link']/@bpd"/> + <eval expected="0" xpath="//inlineparent[@prod-id='link']/@offset"/> + + <eval expected="84048" xpath="//inlineparent[@prod-id='link']/inlineparent/@ipd"/> + <eval expected="22200" xpath="//inlineparent[@prod-id='link']/inlineparent/@bpd"/> + <eval expected="0" xpath="//inlineparent[@prod-id='link']/inlineparent/@offset"/> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/basic-link_height_baseline-shift.xml b/test/layoutengine/standard-testcases/basic-link_height_baseline-shift.xml new file mode 100644 index 000000000..582ef6143 --- /dev/null +++ b/test/layoutengine/standard-testcases/basic-link_height_baseline-shift.xml @@ -0,0 +1,62 @@ +<?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 the height of an fo:basic-link with baseline-shift. + </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="420pt" page-width="320pt" margin="10pt"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="page"> + <fo:flow flow-name="xsl-region-body"> + <fo:block font-size="40pt">Lorem ipsum dolor <fo:basic-link id="link" color="blue" + font-size="12pt" external-destination="url(http://xmlgraphics.apache.org/fop/)" + baseline-shift="-5pt">sit <fo:inline baseline-shift="5pt">amet,</fo:inline> <fo:inline + font-size="24pt" baseline-shift="-10pt">consectetur</fo:inline> + adipiscing</fo:basic-link>elit.</fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <!-- First line --> + <eval expected="28584" xpath="//lineArea[2]//inlineparent[@prod-id='link']/@bpd"/> + <eval expected="20104" xpath="//lineArea[2]//inlineparent[@prod-id='link']/@offset"/> + + <eval expected="11100" xpath="//lineArea[2]//inlineparent[@prod-id='link']/text[1]/@bpd"/> + <eval expected="5000" xpath="//lineArea[2]//inlineparent[@prod-id='link']/text[1]/@offset"/> + + <eval expected="11100" xpath="//lineArea[2]//inlineparent[@prod-id='link']/inlineparent[1]/@bpd"/> + <eval expected="0" xpath="//lineArea[2]//inlineparent[@prod-id='link']/inlineparent[1]/@offset"/> + + <eval expected="22200" xpath="//lineArea[2]//inlineparent[@prod-id='link']/inlineparent[2]/@bpd"/> + <eval expected="6384" xpath="//lineArea[2]//inlineparent[@prod-id='link']/inlineparent[2]/@offset"/> + + <!-- Second line --> + <eval expected="11100" xpath="//lineArea[3]//inlineparent[@prod-id='link']/@bpd"/> + <eval expected="25104" xpath="//lineArea[3]//inlineparent[@prod-id='link']/@offset"/> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/basic-link_height_inline-child.xml b/test/layoutengine/standard-testcases/basic-link_height_inline-child.xml new file mode 100644 index 000000000..3b74781d8 --- /dev/null +++ b/test/layoutengine/standard-testcases/basic-link_height_inline-child.xml @@ -0,0 +1,62 @@ +<?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 the height of an fo:basic-link having several child elements wrapped into a + single fo:inline element. + </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="420pt" page-width="320pt" margin="10pt"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="page"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>Lorem ipsum dolor sit amet, consectetur adipiscing elit. <fo:basic-link + id="link" color="blue" + external-destination="url(http://xmlgraphics.apache.org/fop/)"><fo:inline>In + <fo:inline baseline-shift="12pt">in</fo:inline> <fo:inline font-size="24pt" + baseline-shift="-20pt">egestas</fo:inline> nisi</fo:inline></fo:basic-link>. Etiam + at ante eget velit placerat ullamcorper.</fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="45584" xpath="//inlineparent[@prod-id='link']/@bpd"/> + <eval expected="0" xpath="//inlineparent[@prod-id='link']/@offset"/> + + <eval expected="11100" xpath="//inlineparent[@prod-id='link']/inlineparent/@bpd"/> + <eval expected="12000" xpath="//inlineparent[@prod-id='link']/inlineparent/@offset"/> + + <eval expected="11100" xpath="//inlineparent[@prod-id='link']/inlineparent/text[1]/@bpd"/> + <eval expected="0" xpath="//inlineparent[@prod-id='link']/inlineparent/text[1]/@offset"/> + + <eval expected="11100" xpath="//inlineparent[@prod-id='link']/inlineparent/inlineparent[1]/@bpd"/> + <eval expected="-12000" xpath="//inlineparent[@prod-id='link']/inlineparent/inlineparent[1]/@offset"/> + + <eval expected="22200" xpath="//inlineparent[@prod-id='link']/inlineparent/inlineparent[2]/@bpd"/> + <eval expected="11384" xpath="//inlineparent[@prod-id='link']/inlineparent/inlineparent[2]/@offset"/> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/basic-link_height_multi-child.xml b/test/layoutengine/standard-testcases/basic-link_height_multi-child.xml new file mode 100644 index 000000000..845a1d130 --- /dev/null +++ b/test/layoutengine/standard-testcases/basic-link_height_multi-child.xml @@ -0,0 +1,58 @@ +<?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 the height of an fo:basic-link having several child elements. + </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="420pt" page-width="320pt" margin="10pt"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="page"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>Lorem ipsum dolor sit amet, consectetur adipiscing elit. <fo:basic-link + id="link" color="blue" + external-destination="url(http://xmlgraphics.apache.org/fop/)">In <fo:inline + baseline-shift="12pt">in</fo:inline> <fo:inline font-size="24pt" + baseline-shift="-20pt">egestas</fo:inline> nisi</fo:basic-link>. Etiam at ante eget + velit placerat ullamcorper.</fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="45584" xpath="//inlineparent[@prod-id='link']/@bpd"/> + <eval expected="0" xpath="//inlineparent[@prod-id='link']/@offset"/> + + <eval expected="11100" xpath="//inlineparent[@prod-id='link']/text[1]/@bpd"/> + <eval expected="12000" xpath="//inlineparent[@prod-id='link']/text[1]/@offset"/> + + <eval expected="11100" xpath="//inlineparent[@prod-id='link']/inlineparent[1]/@bpd"/> + <eval expected="0" xpath="//inlineparent[@prod-id='link']/inlineparent[1]/@offset"/> + + <eval expected="22200" xpath="//inlineparent[@prod-id='link']/inlineparent[2]/@bpd"/> + <eval expected="23384" xpath="//inlineparent[@prod-id='link']/inlineparent[2]/@offset"/> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/basic-link_height_multi-line.xml b/test/layoutengine/standard-testcases/basic-link_height_multi-line.xml new file mode 100644 index 000000000..9a52d0128 --- /dev/null +++ b/test/layoutengine/standard-testcases/basic-link_height_multi-line.xml @@ -0,0 +1,67 @@ +<?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 the height of an fo:basic-link spanning over several lines. + </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="420pt" page-width="320pt" margin="10pt"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="page"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer quis neque + vitae lectus condimentum. <fo:basic-link id="link" color="blue" + external-destination="url(http://xmlgraphics.apache.org/fop/)">In <fo:inline + baseline-shift="12pt">in</fo:inline> <fo:inline font-size="24pt" + baseline-shift="-20pt">egestas</fo:inline> nisi</fo:basic-link>. Etiam at ante eget + velit placerat ullamcorper.</fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <!-- First line --> + <eval expected="23100" xpath="//lineArea[2]//inlineparent[@prod-id='link']/@bpd"/> + <eval expected="0" xpath="//lineArea[2]//inlineparent[@prod-id='link']/@offset"/> + + <eval expected="11100" xpath="//lineArea[2]//inlineparent[@prod-id='link']/text[1]/@bpd"/> + <eval expected="12000" xpath="//lineArea[2]//inlineparent[@prod-id='link']/text[1]/@offset"/> + + <eval expected="11100" xpath="//lineArea[2]//inlineparent[@prod-id='link']/inlineparent/@bpd"/> + <eval expected="0" xpath="//lineArea[2]//inlineparent[@prod-id='link']/inlineparent/@offset"/> + + <!-- Second line --> + <eval expected="33584" xpath="//lineArea[3]//inlineparent[@prod-id='link']/@bpd"/> + <eval expected="0" xpath="//lineArea[3]//inlineparent[@prod-id='link']/@offset"/> + + <eval expected="22200" xpath="//lineArea[3]//inlineparent[@prod-id='link']/inlineparent/@bpd"/> + <eval expected="11384" xpath="//lineArea[3]//inlineparent[@prod-id='link']/inlineparent/@offset"/> + + <eval expected="11100" xpath="//lineArea[3]//inlineparent[@prod-id='link']/text[1]/@bpd"/> + <eval expected="0" xpath="//lineArea[3]//inlineparent[@prod-id='link']/text[1]/@offset"/> + + </checks> +</testcase> |