diff options
author | Mehdi Houshmand <mehdi@apache.org> | 2012-09-28 15:22:49 +0000 |
---|---|---|
committer | Mehdi Houshmand <mehdi@apache.org> | 2012-09-28 15:22:49 +0000 |
commit | d261730a4f7be752ae12a5ec52e6bad8ee4fa5c1 (patch) | |
tree | 1acacd7c6dd92e04e06ef6e902ee5e72b5f27523 /test | |
parent | aaa7da8a0dd8ce9ce4e975c4eabbadbea0a67476 (diff) | |
download | xmlgraphics-fop-d261730a4f7be752ae12a5ec52e6bad8ee4fa5c1.tar.gz xmlgraphics-fop-d261730a4f7be752ae12a5ec52e6bad8ee4fa5c1.zip |
Bugzilla#53924: Support for retrieve-table-markers, submitted by Luis Bernardo.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1391502 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
9 files changed, 1431 insertions, 1 deletions
diff --git a/test/java/org/apache/fop/fo/flow/MarkersTestCase.java b/test/java/org/apache/fop/fo/flow/MarkersTestCase.java new file mode 100644 index 000000000..983a531b0 --- /dev/null +++ b/test/java/org/apache/fop/fo/flow/MarkersTestCase.java @@ -0,0 +1,128 @@ +/* + * 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.fo.flow; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.fop.fo.Constants; +import org.apache.fop.fo.flow.Marker; +import org.apache.fop.fo.flow.Markers; +import org.apache.fop.fo.flow.RetrieveMarker; +import org.apache.fop.fo.flow.RetrieveTableMarker; + +public class MarkersTestCase { + + @Test + public void testRegisterAndResolve() { + // consider 3 regions, and a boundary; the first region starts before the boundary and ends inside + // the boundary, the second region is fully inside the boundary, and the third region starts inside + // the boundary and ends after the boundary. in every region there are 2 markers, A and B. + // ======== region 1 + Map<String, Marker> markers_region_1 = new HashMap<String, Marker>(); + Marker marker_1A = mock(Marker.class); + Marker marker_1B = mock(Marker.class); + markers_region_1.put("A", marker_1A); + markers_region_1.put("B", marker_1B); + // ======== region 2 + Map<String, Marker> markers_region_2 = new HashMap<String, Marker>(); + Marker marker_2A = mock(Marker.class); + Marker marker_2B = mock(Marker.class); + markers_region_2.put("A", marker_2A); + markers_region_2.put("B", marker_2B); + // ======== region 3 + Map<String, Marker> markers_region_3 = new HashMap<String, Marker>(); + Marker marker_3A = mock(Marker.class); + Marker marker_3B = mock(Marker.class); + markers_region_3.put("A", marker_3A); + markers_region_3.put("B", marker_3B); + // instantiate markers for the boundary + Markers markers = new Markers(); + // register the markers for the different regions + // region 1 + markers.register(markers_region_1, true, false, true); + markers.register(markers_region_1, false, false, true); + // region 2 + markers.register(markers_region_2, true, true, true); + markers.register(markers_region_2, false, true, true); + // region 3 + markers.register(markers_region_3, true, true, false); + markers.register(markers_region_3, false, true, false); + // now prepare a RetrieveMarker + RetrieveMarker rm = mock(RetrieveMarker.class); + when(rm.getRetrieveClassName()).thenReturn("A"); + when(rm.getLocalName()).thenReturn("retrieve-marker"); + when(rm.getPositionLabel()).thenReturn("position-label"); // not relevant for the test + // and resolve the marker for different positions + // EN_FSWP + when(rm.getPosition()).thenReturn(Constants.EN_FSWP); + // expect marker_2A + assertEquals(marker_2A, markers.resolve(rm)); + // EN_LSWP + when(rm.getPosition()).thenReturn(Constants.EN_LSWP); + // expect marker_3A + assertEquals(marker_3A, markers.resolve(rm)); + // EN_LEWP + when(rm.getPosition()).thenReturn(Constants.EN_LEWP); + // expect marker_2A + assertEquals(marker_2A, markers.resolve(rm)); + // EN_FIC + when(rm.getPosition()).thenReturn(Constants.EN_FIC); + // expect marker_1A + assertEquals(marker_1A, markers.resolve(rm)); + // now prepare a RetrieveTableMarker + RetrieveTableMarker rtm = mock(RetrieveTableMarker.class); + when(rtm.getRetrieveClassName()).thenReturn("B"); + when(rtm.getLocalName()).thenReturn("retrieve-table-marker"); + when(rtm.getPositionLabel()).thenReturn("position-label"); // not relevant for the test + // and resolve the marker for different positions + // EN_FIRST_STARTING + when(rtm.getPosition()).thenReturn(Constants.EN_FIRST_STARTING); + // expect marker_2B + assertEquals(marker_2B, markers.resolve(rtm)); + // EN_LAST_STARTING + when(rtm.getPosition()).thenReturn(Constants.EN_LAST_STARTING); + // expect marker_3B + assertEquals(marker_3B, markers.resolve(rtm)); + // EN_LAST_ENDING + when(rtm.getPosition()).thenReturn(Constants.EN_LAST_ENDING); + // expect marker_2B + assertEquals(marker_2B, markers.resolve(rtm)); + // EN_FIRST_INCLUDING_CARRYOVER + when(rtm.getPosition()).thenReturn(Constants.EN_FIRST_INCLUDING_CARRYOVER); + // expect marker_1B + assertEquals(marker_1B, markers.resolve(rtm)); + // test also an invalid position + when(rm.getPosition()).thenReturn(Constants.EN_ABSOLUTE); + try { + Marker m = markers.resolve(rm); + fail("Expected an exception... instead got:" + m.toString()); + } catch (RuntimeException re) { + // do nothing + } + } +} diff --git a/test/java/org/apache/fop/layoutmgr/PageSequenceLayoutManagerTestCase.java b/test/java/org/apache/fop/layoutmgr/PageSequenceLayoutManagerTestCase.java index eb2a4fc92..e810f80c5 100644 --- a/test/java/org/apache/fop/layoutmgr/PageSequenceLayoutManagerTestCase.java +++ b/test/java/org/apache/fop/layoutmgr/PageSequenceLayoutManagerTestCase.java @@ -19,6 +19,8 @@ package org.apache.fop.layoutmgr; +import org.junit.Test; + import static org.junit.Assert.assertEquals; import static org.mockito.Matchers.anyInt; import static org.mockito.Mockito.mock; @@ -31,7 +33,6 @@ import org.apache.fop.fo.pagination.PageSequence; import org.apache.fop.fo.pagination.Region; import org.apache.fop.fo.pagination.Root; import org.apache.fop.fo.pagination.SimplePageMaster; -import org.junit.Test; public class PageSequenceLayoutManagerTestCase { diff --git a/test/java/org/apache/fop/layoutmgr/RetrieveTableMarkerLayoutManagerMakerTestCase.java b/test/java/org/apache/fop/layoutmgr/RetrieveTableMarkerLayoutManagerMakerTestCase.java new file mode 100644 index 000000000..6a37de33c --- /dev/null +++ b/test/java/org/apache/fop/layoutmgr/RetrieveTableMarkerLayoutManagerMakerTestCase.java @@ -0,0 +1,56 @@ +/* + * 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.layoutmgr; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.fop.apps.FOPException; +import org.apache.fop.fo.FObj.FObjIterator; +import org.apache.fop.fo.flow.RetrieveTableMarker; +import org.apache.fop.layoutmgr.LayoutManagerMapping.RetrieveTableMarkerLayoutManagerMaker; + +public class RetrieveTableMarkerLayoutManagerMakerTestCase { + + @Test + public void testMake() throws FOPException { + // mock + FObjIterator foi = mock(FObjIterator.class); + when(foi.hasNext()).thenReturn(true).thenReturn(false); + // mock + RetrieveTableMarker rtm = mock(RetrieveTableMarker.class); + // real RTMLMM, not mock + List l = new ArrayList(); + LayoutManagerMapping lmm = new LayoutManagerMapping(); + RetrieveTableMarkerLayoutManagerMaker rtmlmm = lmm.new RetrieveTableMarkerLayoutManagerMaker(); + // test the case rtm has no child nodes + when(rtm.getChildNodes()).thenReturn(null); + rtmlmm.make(rtm, l); + assertTrue(l.size() == 1); + assertTrue(l.get(0) instanceof RetrieveTableMarkerLayoutManager); + } + +} diff --git a/test/java/org/apache/fop/layoutmgr/RetrieveTableMarkerLayoutManagerTestCase.java b/test/java/org/apache/fop/layoutmgr/RetrieveTableMarkerLayoutManagerTestCase.java new file mode 100644 index 000000000..fda9cbccb --- /dev/null +++ b/test/java/org/apache/fop/layoutmgr/RetrieveTableMarkerLayoutManagerTestCase.java @@ -0,0 +1,82 @@ +/* + * 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.layoutmgr; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.apache.fop.fo.Constants; +import org.apache.fop.fo.flow.RetrieveTableMarker; +import org.apache.fop.fo.flow.table.Table; +import org.apache.fop.layoutmgr.inline.TextLayoutManager; +import org.apache.fop.layoutmgr.table.TableLayoutManager; + +public class RetrieveTableMarkerLayoutManagerTestCase { + + @Test + public void testGetNextKnuthElementsLayoutContextInt() { + LayoutContext lc = LayoutContext.newInstance(); + // mock + Table t = mock(Table.class); + // mock + RetrieveTableMarker rtm = mock(RetrieveTableMarker.class); + when(rtm.getRetrieveClassName()).thenReturn("A"); + when(rtm.getPosition()).thenReturn(Constants.EN_FIRST_STARTING); + when(rtm.getBoundary()).thenReturn(Constants.EN_TABLE_FRAGMENT); + // mock + TextLayoutManager tlm = mock(TextLayoutManager.class); + // mock + LayoutManagerMapping lmm = mock(LayoutManagerMapping.class); + when(lmm.makeLayoutManager(rtm)).thenReturn(tlm); + // mock + PageSequenceLayoutManager pslm = mock(PageSequenceLayoutManager.class); + when(pslm.getPSLM()).thenReturn(pslm); + when(pslm.getLayoutManagerMaker()).thenReturn(lmm); + // mock + TableLayoutManager tablelm = mock(TableLayoutManager.class); + when(tablelm.getTable()).thenReturn(t); + // mock + BlockLayoutManager blm = mock(BlockLayoutManager.class); + when(blm.getPSLM()).thenReturn(pslm); + when(blm.getParent()).thenReturn(tablelm); + // real RTMLM, not mock + RetrieveTableMarkerLayoutManager rtmlm = new RetrieveTableMarkerLayoutManager(rtm); + rtmlm.setParent(blm); + // test the case where resolution returns null + when(tablelm.resolveRetrieveTableMarker(rtm)).thenReturn(null); + assertNull(rtmlm.getNextKnuthElements(lc, 0)); + // test the case where resolution returns non null + List l = new ArrayList(); + when(tablelm.resolveRetrieveTableMarker(rtm)).thenReturn(rtm); + when(tlm.getNextKnuthElements(lc, 0)).thenReturn(l); + assertEquals(l, rtmlm.getNextKnuthElements(lc, 0)); + verify(tlm).setParent(blm); + verify(tlm).initialize(); + } + +} diff --git a/test/java/org/apache/fop/layoutmgr/table/TableCellLayoutManagerTestCase.java b/test/java/org/apache/fop/layoutmgr/table/TableCellLayoutManagerTestCase.java new file mode 100644 index 000000000..a370e5dd5 --- /dev/null +++ b/test/java/org/apache/fop/layoutmgr/table/TableCellLayoutManagerTestCase.java @@ -0,0 +1,116 @@ +/* + * 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.layoutmgr.table; + +import java.awt.Color; + +import org.junit.Test; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.apache.fop.fo.flow.table.PrimaryGridUnit; +import org.apache.fop.fo.flow.table.Table; +import org.apache.fop.fo.flow.table.TableCell; +import org.apache.fop.fo.flow.table.TableColumn; +import org.apache.fop.fo.flow.table.TableHeader; +import org.apache.fop.fo.flow.table.TableRow; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground.BorderInfo; +import org.apache.fop.fo.properties.CondLengthProperty; +import org.apache.fop.layoutmgr.LayoutContext; +import org.apache.fop.layoutmgr.PageSequenceLayoutManager; +import org.apache.fop.layoutmgr.PositionIterator; +import org.apache.fop.layoutmgr.RetrieveTableMarkerLayoutManager; + +public class TableCellLayoutManagerTestCase { + + // this test aims to check that the first call to addAreas() calls + // TLM.saveTableHeaderTableCellLayoutManagers() but the second call, through repeatAddAreas() + // does not call it again; there are a lot of mocks here, but just the necessary so that the + // addAreas() call can run to completion without NPE; also, the mocking needs to be done so + // the methods isDecendantOfTableHeaderOrFooter() and hasRetrieveTableMarker() return true. + @Test + public void testRepeatAddAreas() { + LayoutContext lc = LayoutContext.newInstance(); + // mock background + CommonBorderPaddingBackground cbpb = mock(CommonBorderPaddingBackground.class); + // mock conditional length property + CondLengthProperty clp = mock(CondLengthProperty.class); + when(clp.getLengthValue()).thenReturn(0); + // real border info + BorderInfo bi = BorderInfo.getInstance(0, clp, Color.BLACK); + // mock column + TableColumn tcol = mock(TableColumn.class); + when(tcol.getCommonBorderPaddingBackground()).thenReturn(cbpb); + // mock table + Table t = mock(Table.class); + when(t.getColumn(0)).thenReturn(tcol); + // mock header + TableHeader th = mock(TableHeader.class); + when(th.getCommonBorderPaddingBackground()).thenReturn(cbpb); + // mock row + TableRow tr = mock(TableRow.class); + when(tr.getParent()).thenReturn(th); + // mock cell + TableCell tc = mock(TableCell.class); + when(tc.hasRetrieveTableMarker()).thenReturn(true); + when(tc.getTable()).thenReturn(t); + when(tc.getId()).thenReturn("cellId"); + when(tc.getCommonBorderPaddingBackground()).thenReturn(cbpb); + when(tc.getParent()).thenReturn(tr); + // mock PGU + PrimaryGridUnit pgu = mock(PrimaryGridUnit.class); + when(pgu.getCell()).thenReturn(tc); + when(pgu.getColIndex()).thenReturn(0); + when(pgu.getBorderBefore(0)).thenReturn(bi); + when(pgu.getBorderAfter(0)).thenReturn(bi); + when(pgu.getBorderEnd()).thenReturn(bi); + when(pgu.getBorderStart()).thenReturn(bi); + when(pgu.getTablePart()).thenReturn(th); + // mock RTMLM + RetrieveTableMarkerLayoutManager rtmlm = mock(RetrieveTableMarkerLayoutManager.class); + when(rtmlm.isFinished()).thenReturn(true); // avoids infinite loop + // mock PSLM + PageSequenceLayoutManager pslm = mock(PageSequenceLayoutManager.class); + // mock TLM + TableLayoutManager tlm = mock(TableLayoutManager.class); + when(tlm.getPSLM()).thenReturn(pslm); + // mock PI + PositionIterator pi = mock(PositionIterator.class); + // mock RP + RowPainter rp = mock(RowPainter.class); + + // real TCLM, not a mock! + TableCellLayoutManager tclm = new TableCellLayoutManager(tc, pgu); + tclm.addChildLM(rtmlm); + tclm.setParent(tlm); + // lets call addAreas + int[] n = {}; + tclm.addAreas(pi, lc, n, 0, 0, 0, 0, true, true, rp, 0); + // check the TCLM is added to the TLM + verify(tlm).saveTableHeaderTableCellLayoutManagers(tclm); + // call the repeat + tclm.repeatAddAreas(); + // check the TCLM was not added again + verify(tlm).saveTableHeaderTableCellLayoutManagers(tclm); + } +} diff --git a/test/java/org/apache/fop/layoutmgr/table/TableContentLayoutManagerTestCase.java b/test/java/org/apache/fop/layoutmgr/table/TableContentLayoutManagerTestCase.java new file mode 100644 index 000000000..2bc41979c --- /dev/null +++ b/test/java/org/apache/fop/layoutmgr/table/TableContentLayoutManagerTestCase.java @@ -0,0 +1,64 @@ +/* + * 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.layoutmgr.table; + +import org.junit.Test; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.apache.fop.fo.FONode.FONodeIterator; +import org.apache.fop.fo.flow.table.Table; +import org.apache.fop.layoutmgr.LayoutContext; +import org.apache.fop.layoutmgr.PositionIterator; + +public class TableContentLayoutManagerTestCase { + + @Test + public void testAddAreas() { + LayoutContext lc = LayoutContext.newInstance(); + // mock + ColumnSetup cs = mock(ColumnSetup.class); + when(cs.getColumnCount()).thenReturn(3); + // mock + FONodeIterator foni = mock(FONodeIterator.class); + when(foni.hasNext()).thenReturn(false); + // mock + Table t = mock(Table.class); + when(t.getChildNodes()).thenReturn(foni); + when(t.getMarkers()).thenReturn(null); + // mock + TableLayoutManager tlm = mock(TableLayoutManager.class); + when(tlm.getTable()).thenReturn(t); + when(tlm.getColumns()).thenReturn(cs); + // mock + PositionIterator pi = mock(PositionIterator.class); + when(pi.hasNext()).thenReturn(false); + // real TCLM, not a mock + TableContentLayoutManager tclm = new TableContentLayoutManager(tlm); + // check that addAreas() calls the clearTableFragments() on the table and the + // repeatAddAreasForSavedTableHeaderTableCellLayoutManagers on the TLM + tclm.addAreas(pi, lc); + verify(tlm).clearTableFragmentMarkers(); + verify(tlm).repeatAddAreasForSavedTableHeaderTableCellLayoutManagers(); + } + +} diff --git a/test/java/org/apache/fop/layoutmgr/table/TableLayoutManagerTestCase.java b/test/java/org/apache/fop/layoutmgr/table/TableLayoutManagerTestCase.java new file mode 100644 index 000000000..46a394eb7 --- /dev/null +++ b/test/java/org/apache/fop/layoutmgr/table/TableLayoutManagerTestCase.java @@ -0,0 +1,119 @@ +/* + * 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.layoutmgr.table; + +import java.util.HashMap; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.apache.fop.area.PageViewport; +import org.apache.fop.fo.Constants; +import org.apache.fop.fo.flow.Marker; +import org.apache.fop.fo.flow.RetrieveTableMarker; +import org.apache.fop.fo.flow.table.Table; +import org.apache.fop.layoutmgr.BlockLayoutManager; +import org.apache.fop.layoutmgr.Page; +import org.apache.fop.layoutmgr.PageSequenceLayoutManager; + +public class TableLayoutManagerTestCase { + + @Test + public void testSavedTableCellLayoutManagersFunctionality() { + Table t = mock(Table.class); + TableCellLayoutManager tclm1 = mock(TableCellLayoutManager.class); + TableLayoutManager tlm = new TableLayoutManager(t); + tlm.saveTableHeaderTableCellLayoutManagers(tclm1); + tlm.repeatAddAreasForSavedTableHeaderTableCellLayoutManagers(); + verify(tclm1).repeatAddAreas(); // called once + // test that after the first repeatAddAreas() call the list closes to new additions + TableCellLayoutManager tclm2 = mock(TableCellLayoutManager.class); + tlm.saveTableHeaderTableCellLayoutManagers(tclm2); + tlm.repeatAddAreasForSavedTableHeaderTableCellLayoutManagers(); + verify(tclm1, times(2)).repeatAddAreas(); // called twice + verify(tclm2, never()).repeatAddAreas(); // never called + } + + @Test + public void testResolveRetrieveTableMarker() { + // mock + Table t = mock(Table.class); + // mock + Marker m = mock(Marker.class); + // mock + RetrieveTableMarker rtm = mock(RetrieveTableMarker.class); + when(rtm.getRetrieveClassName()).thenReturn("A"); + when(rtm.getPosition()).thenReturn(Constants.EN_FIRST_STARTING); + // mock + PageViewport pv = mock(PageViewport.class); + when(pv.resolveMarker(rtm)).thenReturn(m); + // mock + Page p = mock(Page.class); + when(p.getPageViewport()).thenReturn(pv); + // mock + PageSequenceLayoutManager pslm = mock(PageSequenceLayoutManager.class); + when(pslm.getPSLM()).thenReturn(pslm); + when(pslm.getCurrentPage()).thenReturn(p); + // mock + BlockLayoutManager blm = mock(BlockLayoutManager.class); + blm.setParent(pslm); + when(blm.getPSLM()).thenReturn(pslm); + // real TLM, not mock + TableLayoutManager tlm = new TableLayoutManager(t); + tlm.setParent(blm); + // register a marker + HashMap<String, Marker> markers1 = new HashMap<String, Marker>(); + Marker m1 = mock(Marker.class); + markers1.put("A", m1); + tlm.registerMarkers(markers1, true, true, true); + tlm.registerMarkers(markers1, false, true, true); + // check that if there is a marker at table fragment level the RTM is returned + assertEquals(rtm, tlm.resolveRetrieveTableMarker(rtm)); + verify(rtm, never()).getBoundary(); + // check that if there is no marker at table fragment level and that is the boundary + // we get a null return value + when(rtm.getBoundary()).thenReturn(Constants.EN_TABLE_FRAGMENT); + when(rtm.getRetrieveClassName()).thenReturn("B"); + assertNull(tlm.resolveRetrieveTableMarker(rtm)); + verify(rtm).getBoundary(); + verify(rtm, never()).changePositionTo(Constants.EN_LAST_ENDING); + // check that if there is no marker at table fragment level and the boundary is page + // then we try to do the resolution at page level; test the case a marker is found + when(rtm.getBoundary()).thenReturn(Constants.EN_PAGE); + assertEquals(rtm, tlm.resolveRetrieveTableMarker(rtm)); + verify(rtm).changePositionTo(Constants.EN_LAST_ENDING); + verify(rtm).changePositionTo(Constants.EN_FIRST_STARTING); + verify(pv).resolveMarker(rtm); + // test the same situation but in this case the marker is not found + when(pv.resolveMarker(rtm)).thenReturn(null); + assertNull(tlm.resolveRetrieveTableMarker(rtm)); + // test the situation where the marker is not found at page level but the boundary is table + when(rtm.getBoundary()).thenReturn(Constants.EN_TABLE); + assertNull(tlm.resolveRetrieveTableMarker(rtm)); + } + +} diff --git a/test/layoutengine/standard-testcases/markers_10.xml b/test/layoutengine/standard-testcases/markers_10.xml new file mode 100644 index 000000000..0921da0aa --- /dev/null +++ b/test/layoutengine/standard-testcases/markers_10.xml @@ -0,0 +1,144 @@ +<?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 markers on broken tables. + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg"> + <fo:layout-master-set> + <fo:simple-page-master master-name="normal" page-width="5in" page-height="2in"> + <fo:region-body margin="0.5in 0"/> + <fo:region-before extent="0.5in"/> + <fo:region-after extent="0.5in"/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="normal" white-space-collapse="true"> + <fo:static-content flow-name="xsl-region-before"> + <fo:block background-color="yellow"> + f-i-c: <fo:retrieve-marker retrieve-class-name="test" retrieve-boundary="page" retrieve-position="first-including-carryover"/> + </fo:block> + <fo:block background-color="yellow"> + f-s-w-p: <fo:retrieve-marker retrieve-class-name="test" retrieve-boundary="page" retrieve-position="first-starting-within-page"/> + </fo:block> + </fo:static-content> + <fo:static-content flow-name="xsl-region-after"> + <fo:block text-align="end" background-color="yellow"> + l-s-w-p: <fo:retrieve-marker retrieve-class-name="test" retrieve-boundary="page" retrieve-position="last-starting-within-page"/> + </fo:block> + <fo:block text-align="end" background-color="yellow"> + l-e-w-p: <fo:retrieve-marker retrieve-class-name="test" retrieve-boundary="page" retrieve-position="last-ending-within-page"/> + </fo:block> + </fo:static-content> + <fo:flow flow-name="xsl-region-body"> + <fo:table color="black" table-layout="fixed"> + <fo:table-column number-columns-repeated="2"/> + <fo:table-body> + <fo:table-row> + <fo:table-cell> + <fo:marker marker-class-name="test">row1</fo:marker> + <fo:block>row1</fo:block> + <fo:block>row1</fo:block> + <fo:block>row1</fo:block> + <fo:block>row1</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:marker marker-class-name="test">row1</fo:marker> + <fo:block>row1</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell> + <fo:marker marker-class-name="test">row2</fo:marker> + <fo:block>row2</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:marker marker-class-name="test">row2</fo:marker> + <fo:block>row2</fo:block> + <fo:block>row2</fo:block> + <fo:block>row2</fo:block> + <fo:block>row2</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell> + <fo:marker marker-class-name="test">row3</fo:marker> + <fo:block>row3</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:marker marker-class-name="test">row3</fo:marker> + <fo:block>row3</fo:block> + <fo:block>row3</fo:block> + <fo:block>row3</fo:block> + <fo:block>row3</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell> + <fo:marker marker-class-name="test">row4</fo:marker> + <fo:block>row4</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell> + <fo:marker marker-class-name="test">row5</fo:marker> + <fo:block>row5</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:marker marker-class-name="test">row5</fo:marker> + <fo:block>row5</fo:block> + <fo:block>row5</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell column-number="2"> + <fo:marker marker-class-name="test">row6</fo:marker> + <fo:block>row6</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <true xpath="starts-with(//pageViewport[@nr=1]//regionBefore/block[1],'f-i-c: row1')"/> + <true xpath="starts-with(//pageViewport[@nr=1]//regionBefore/block[2],'f-s-w-p: row1')"/> + <true xpath="starts-with(//pageViewport[@nr=1]//regionAfter/block[1],'l-s-w-p: row2')"/> + <true xpath="starts-with(//pageViewport[@nr=1]//regionAfter/block[2],'l-e-w-p: row1')"/> + + <true xpath="starts-with(//pageViewport[@nr=2]//regionBefore/block[1],'f-i-c: row2')"/> + <true xpath="starts-with(//pageViewport[@nr=2]//regionBefore/block[2],'f-s-w-p: row3')"/> + <true xpath="starts-with(//pageViewport[@nr=2]//regionAfter/block[1],'l-s-w-p: row3')"/> + <true xpath="starts-with(//pageViewport[@nr=2]//regionAfter/block[2],'l-e-w-p: row2')"/> + + <true xpath="starts-with(//pageViewport[@nr=3]//regionBefore/block[1],'f-i-c: row3')"/> + <true xpath="starts-with(//pageViewport[@nr=3]//regionBefore/block[2],'f-s-w-p: row4')"/> + <true xpath="starts-with(//pageViewport[@nr=3]//regionAfter/block[1],'l-s-w-p: row5')"/> + <true xpath="starts-with(//pageViewport[@nr=3]//regionAfter/block[2],'l-e-w-p: row5')"/> + + <true xpath="starts-with(//pageViewport[@nr=4]//regionBefore/block[1],'f-i-c: row6')"/> + <true xpath="starts-with(//pageViewport[@nr=4]//regionBefore/block[2],'f-s-w-p: row6')"/> + <true xpath="starts-with(//pageViewport[@nr=4]//regionAfter/block[1],'l-s-w-p: row6')"/> + <true xpath="starts-with(//pageViewport[@nr=4]//regionAfter/block[2],'l-e-w-p: row6')"/> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/retrieve-table-marker_multicolumn.xml b/test/layoutengine/standard-testcases/retrieve-table-marker_multicolumn.xml new file mode 100644 index 000000000..db578f95e --- /dev/null +++ b/test/layoutengine/standard-testcases/retrieve-table-marker_multicolumn.xml @@ -0,0 +1,720 @@ +<?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 retrieve-table-marker implementation. Rather, it serves as a regression test.</p> + </info> + <fo> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" font-size="10pt" font-family="sans-serif" + line-height="120%"> + <fo:layout-master-set> + <fo:simple-page-master master-name="base-page" page-height="210mm" page-width="297mm"> + <fo:region-body margin="15mm" column-count="3" /> + <fo:region-before extent="15mm" /> + <fo:region-after extent="11.4mm" /> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="base-page"> + <fo:flow flow-name="xsl-region-body" font-family="sans-serif"> + <fo:block>The table has two columns, State and Facts. In the rows corresponding to states in the + Pacific Time Zone (PST), the State and Facts table + cells have a marker with the value of the State. That marker is retrieved in the table header and + footer. All the possible boundary and positions are considered in this example. + </fo:block> + <fo:block> rbwt = retrieve-boundary-within-table; rpwt = retrieve-position-within-table; + f-i-c = first-including-carryover; f-s = first-starting; l-s = last-starting; l-e = last-ending; + t = table; p = page; p-s = page-sequence; t-f = table-fragment. + </fo:block> + <fo:wrapper> + <fo:table space-before="1em" width="100%" table-layout="fixed"> + <fo:table-column column-width="proportional-column-width(3)" /> + <fo:table-column column-width="proportional-column-width(5)" /> + <fo:table-header> + <fo:table-row> + <fo:table-cell padding="4pt" number-columns-spanned="2" + background-color="yellow"> + <fo:block> + [rbwt:t][rpwt:f-i-c]( + <fo:retrieve-table-marker retrieve-class-name="state" + retrieve-position-within-table="first-including-carryover" retrieve-boundary-within-table="table" /> + ) + </fo:block> + <fo:block> + [rbwt:t][rpwt:f-s]( + <fo:retrieve-table-marker retrieve-class-name="state" + retrieve-position-within-table="first-starting" retrieve-boundary-within-table="table" /> + ) + </fo:block> + <fo:block> + [rbwt:p][rpwt:f-i-c]( + <fo:retrieve-table-marker retrieve-class-name="state" + retrieve-position-within-table="first-including-carryover" retrieve-boundary-within-table="page" /> + ) + </fo:block> + <fo:block> + [rbwt:p][rpwt:f-s]( + <fo:retrieve-table-marker retrieve-class-name="state" + retrieve-position-within-table="first-starting" retrieve-boundary-within-table="page" /> + ) + </fo:block> + <fo:block> + [rbwt:t-f][rpwt:f-i-c]( + <fo:retrieve-table-marker retrieve-class-name="state" + retrieve-position-within-table="first-including-carryover" retrieve-boundary-within-table="table-fragment" /> + ) + </fo:block> + <fo:block> + [rbwt:t-f][rpwt:f-s]( + <fo:retrieve-table-marker retrieve-class-name="state" + retrieve-position-within-table="first-starting" retrieve-boundary-within-table="table-fragment" /> + ) + </fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block font-weight="bold">State</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block font-weight="bold">Facts</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-header> + <fo:table-footer> + <fo:table-row> + <fo:table-cell padding="4pt" number-columns-spanned="2" + background-color="yellow"> + <fo:block> + [rbwt:t][rpwt:l-s]( + <fo:retrieve-table-marker retrieve-class-name="state" + retrieve-position-within-table="last-starting" retrieve-boundary-within-table="table" /> + ) + </fo:block> + <fo:block> + [rbwt:t][rpwt:l-e]( + <fo:retrieve-table-marker retrieve-class-name="state" + retrieve-position-within-table="last-ending" retrieve-boundary-within-table="table" /> + ) + </fo:block> + <fo:block> + [rbwt:p][rpwt:l-s]( + <fo:retrieve-table-marker retrieve-class-name="state" + retrieve-position-within-table="last-starting" retrieve-boundary-within-table="page" /> + ) + </fo:block> + <fo:block> + [rbwt:p][rpwt:l-e]( + <fo:retrieve-table-marker retrieve-class-name="state" + retrieve-position-within-table="last-ending" retrieve-boundary-within-table="page" /> + ) + </fo:block> + <fo:block> + [rbwt:t-f][rpwt:l-s]( + <fo:retrieve-table-marker retrieve-class-name="state" + retrieve-position-within-table="last-starting" retrieve-boundary-within-table="table-fragment" /> + ) + </fo:block> + <fo:block> + [rbwt:t-f][rpwt:l-e]( + <fo:retrieve-table-marker retrieve-class-name="state" + retrieve-position-within-table="last-ending" retrieve-boundary-within-table="table-fragment" /> + ) + </fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-footer> + <fo:table-body> + <!--fo:marker marker-class-name="state">Alabama</fo:marker--> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Alabama</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Montgomery</fo:block> + <fo:block>Area: 52,423 square miles</fo:block> + <fo:block>Population: 4,447,100</fo:block> + <fo:block>Time Zone: CST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Alaska</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Juneau</fo:block> + <fo:block>Area: 656,425 square miles</fo:block> + <fo:block>Population: 626,932</fo:block> + <fo:block>Time Zone: GMT -9:00</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:marker marker-class-name="state">Arizona</fo:marker> + <fo:block>Arizona</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:marker marker-class-name="state">Arizona</fo:marker> + <fo:block>Capital: Phoenix</fo:block> + <fo:block>Area: 114,006 square miles</fo:block> + <fo:block>Population: 5,130,632</fo:block> + <fo:block>Time Zone: PST and MST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Arkansas</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Little Rock</fo:block> + <fo:block>Area: 53,182 square miles</fo:block> + <fo:block>Population: 2,673,400</fo:block> + <fo:block>Time Zone: CST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:marker marker-class-name="state">California</fo:marker> + <fo:block>California</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:marker marker-class-name="state">California</fo:marker> + <fo:block>Capital: Sacramento</fo:block> + <fo:block>Area: 163,707 square miles</fo:block> + <fo:block>Population: 33,871,648</fo:block> + <fo:block>Time Zone: PST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Colorado</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Denver</fo:block> + <fo:block>Area: 104,100 square miles</fo:block> + <fo:block>Population: 4,301,261</fo:block> + <fo:block>Time Zone: MST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Connecticut</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Hartford</fo:block> + <fo:block>Area: 5,544 square miles</fo:block> + <fo:block>Population: 3,405,565</fo:block> + <fo:block>Time Zone: EST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Delaware</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Dover</fo:block> + <fo:block>Area: 1,954 square miles</fo:block> + <fo:block>Population: 783,600</fo:block> + <fo:block>Time Zone: EST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Florida</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Tallahassee</fo:block> + <fo:block>Area: 65,758 square miles</fo:block> + <fo:block>Population: 15,982,378</fo:block> + <fo:block>Time Zone: EST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Georgia</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Atlanta</fo:block> + <fo:block>Area: 59,441 square miles</fo:block> + <fo:block>Population: 8,186,453</fo:block> + <fo:block>Time Zone: EST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Hawaii</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Honolulu</fo:block> + <fo:block>Area: 10,932 square miles</fo:block> + <fo:block>Population: 1,211,537</fo:block> + <fo:block>Time Zone: GMT -11:00</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Idaho</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Boise</fo:block> + <fo:block>Area: 83,574 square miles</fo:block> + <fo:block>Population: 1,293,953</fo:block> + <fo:block>Time Zone: MST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Illinois</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Springfield</fo:block> + <fo:block>Area: 57,918 square miles</fo:block> + <fo:block>Population: 12,419,293</fo:block> + <fo:block>Time Zone: CST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Indiana</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Indianapolis</fo:block> + <fo:block>Area: 36,420 square miles</fo:block> + <fo:block>Population: 6,080,485</fo:block> + <fo:block>Time Zone: EST and CST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Iowa</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Des Moines</fo:block> + <fo:block>Area: 56,276 square miles</fo:block> + <fo:block>Population: 2,926,324</fo:block> + <fo:block>Time Zone: CST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Kansas</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Topeka</fo:block> + <fo:block>Area: 82,282 square miles</fo:block> + <fo:block>Population: 2,688,418</fo:block> + <fo:block>Time Zone: CST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Kentucky</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Frankfort</fo:block> + <fo:block>Area: 40,411 square miles</fo:block> + <fo:block>Population: 4,041,769</fo:block> + <fo:block>Time Zone: EST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Louisiana</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Baton Rouge</fo:block> + <fo:block>Area: 51,843 square miles</fo:block> + <fo:block>Population: 4,468,976</fo:block> + <fo:block>Time Zone: CST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Maine</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Augusta</fo:block> + <fo:block>Area: 35,387 square miles</fo:block> + <fo:block>Population: 1,274,923</fo:block> + <fo:block>Time Zone: EST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Maryland</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Annapolis</fo:block> + <fo:block>Area: 12,407 square miles</fo:block> + <fo:block>Population: 5,296,486</fo:block> + <fo:block>Time Zone: EST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Massachusetts</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Boston</fo:block> + <fo:block>Area: 10,555 square miles</fo:block> + <fo:block>Population: 6,349,097</fo:block> + <fo:block>Time Zone: EST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Michigan</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Lansing</fo:block> + <fo:block>Area: 96,810 square miles</fo:block> + <fo:block>Population: 9,938,444</fo:block> + <fo:block>Time Zone: EST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Minnesota</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: St. Paul</fo:block> + <fo:block>Area: 86,943 square miles</fo:block> + <fo:block>Population: 4,919,479</fo:block> + <fo:block>Time Zone: CST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Mississippi</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Jackson</fo:block> + <fo:block>Area: 48,434 square miles</fo:block> + <fo:block>Population: 2,844,658</fo:block> + <fo:block>Time Zone: CST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Missouri</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Jefferson City</fo:block> + <fo:block>Area: 69,709 square miles</fo:block> + <fo:block>Population: 5,595,211</fo:block> + <fo:block>Time Zone: CST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Montana</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Helena</fo:block> + <fo:block>Area: 147,046 square miles</fo:block> + <fo:block>Population: 902,195</fo:block> + <fo:block>Time Zone: MST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Nebraska</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Lincoln</fo:block> + <fo:block>Area: XXXXXX square miles</fo:block> + <fo:block>Population: 77,358</fo:block> + <fo:block>Time Zone: CST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:marker marker-class-name="state">Nevada</fo:marker> + <fo:block>Nevada</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:marker marker-class-name="state">Nevada</fo:marker> + <fo:block>Capital: Carson City</fo:block> + <fo:block>Area: 110,567 square miles</fo:block> + <fo:block>Population: 1,998,257</fo:block> + <fo:block>Time Zone: PST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>New Hampshire</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Concord</fo:block> + <fo:block>Area: 9,351 square miles</fo:block> + <fo:block>Population: 1,235,786</fo:block> + <fo:block>Time Zone: EST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>New Jersey</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Trenton</fo:block> + <fo:block>Area: 8,722 square miles</fo:block> + <fo:block>Population: 8,414,350</fo:block> + <fo:block>Time Zone: EST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>New Mexico</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Santa Fe</fo:block> + <fo:block>Area: 121,593 square miles</fo:block> + <fo:block>Population: 1,819,046</fo:block> + <fo:block>Time Zone: MST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>New York</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Albany</fo:block> + <fo:block>Area: 54,475 square miles</fo:block> + <fo:block>Population: 18,976,457</fo:block> + <fo:block>Time Zone: EST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>North Carolina</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Raleigh</fo:block> + <fo:block>Area: 53,821 square miles</fo:block> + <fo:block>Population: 8,049,313</fo:block> + <fo:block>Time Zone: EST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>North Dakota</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Bismarck</fo:block> + <fo:block>Area: 70,704 square miles</fo:block> + <fo:block>Population: 642,200</fo:block> + <fo:block>Time Zone: CST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Ohio</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Columbus</fo:block> + <fo:block>Area: 44,828 square miles</fo:block> + <fo:block>Population: 11,353,140</fo:block> + <fo:block>Time Zone: EST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Oklahoma</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Oklahoma City</fo:block> + <fo:block>Area: 69,903 square miles</fo:block> + <fo:block>Population: 3,450,654</fo:block> + <fo:block>Time Zone: CST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:marker marker-class-name="state">Oregon</fo:marker> + <fo:block>Oregon</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:marker marker-class-name="state">Oregon</fo:marker> + <fo:block>Capital: Salem</fo:block> + <fo:block>Area: 98,386 square miles</fo:block> + <fo:block>Population: 3,421,399</fo:block> + <fo:block>Time Zone: PST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Pennsylvania</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Harrisburg</fo:block> + <fo:block>Area: 46,058 square miles</fo:block> + <fo:block>Population: 12,281,054</fo:block> + <fo:block>Time Zone: EST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Rhode Island</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Providence</fo:block> + <fo:block>Area: 1,045 square miles</fo:block> + <fo:block>Population: 1,048,319</fo:block> + <fo:block>Time Zone: EST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>South Carolina</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Columbia</fo:block> + <fo:block>Area: 32,007 square miles</fo:block> + <fo:block>Population: 4,012,012</fo:block> + <fo:block>Time Zone: EST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>South Dakota</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Pierre</fo:block> + <fo:block>Area: 77,121 square miles</fo:block> + <fo:block>Population: 754,844</fo:block> + <fo:block>Time Zone: CST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Tennessee</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Nashville</fo:block> + <fo:block>Area: 42,146 square miles</fo:block> + <fo:block>Population: 5,689,283</fo:block> + <fo:block>Time Zone: CST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Texas</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Austin</fo:block> + <fo:block>Area: 268,601 square miles</fo:block> + <fo:block>Population: 20,851,820</fo:block> + <fo:block>Time Zone: CST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Utah</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Salt Lake City</fo:block> + <fo:block>Area: 84,904 square miles</fo:block> + <fo:block>Population: 2,233,169</fo:block> + <fo:block>Time Zone: MST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Vermont</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Montpelier</fo:block> + <fo:block>Area: 9,615 square miles</fo:block> + <fo:block>Population: 608,827</fo:block> + <fo:block>Time Zone: EST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Virginia</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Richmond</fo:block> + <fo:block>Area: 42,769 square miles</fo:block> + <fo:block>Population: 7,078,515</fo:block> + <fo:block>Time Zone: EST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:marker marker-class-name="state">Washington</fo:marker> + <fo:block>Washington</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:marker marker-class-name="state">Washington</fo:marker> + <fo:block>Capital: Olympia</fo:block> + <fo:block>Area: 71,303 square miles</fo:block> + <fo:block>Population: 5,894,121</fo:block> + <fo:block>Time Zone: PST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>West Virginia</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Charleston</fo:block> + <fo:block>Area: 24,231 square miles</fo:block> + <fo:block>Population: 1,808,344</fo:block> + <fo:block>Time Zone: EST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Wisconsin</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Madison</fo:block> + <fo:block>Area: 65,503 square miles</fo:block> + <fo:block>Population: 5,363,675</fo:block> + <fo:block>Time Zone: CST</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Wyoming</fo:block> + </fo:table-cell> + <fo:table-cell padding-before="4pt" padding-after="4pt"> + <fo:block>Capital: Cheyenne</fo:block> + <fo:block>Area: 97,818 square miles</fo:block> + <fo:block>Population: 493,782</fo:block> + <fo:block>Time Zone: MST</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + </fo:wrapper> + </fo:flow> + </fo:page-sequence> +</fo:root> + </fo> + <checks> + <eval expected="1" xpath="//lineArea[starts-with(., '[rbwt:t-f][rpwt:f-i-c]( )')]/ancestor::pageViewport/@nr" /> + <eval expected="2" xpath="//lineArea[starts-with(., '[rbwt:t][rpwt:f-i-c]( Nevada )')]/ancestor::pageViewport/@nr" /> + <eval expected="2" xpath="//lineArea[starts-with(., '[rbwt:p][rpwt:f-i-c]( Nevada )')]/ancestor::pageViewport/@nr" /> + <eval expected="3" xpath="//lineArea[starts-with(., '[rbwt:t][rpwt:f-i-c]( Oregon )')]/ancestor::pageViewport/@nr" /> + <eval expected="[rbwt:t][rpwt:f-i-c]( California )" xpath="//pageViewport[2]/page/regionViewport[3]//flow[1]/block[1]/block[17]/block[1]/lineArea" /> + <eval expected="[rbwt:t][rpwt:f-i-c]( Oregon )" xpath="//pageViewport[3]/page/regionViewport[3]//flow[1]/block[1]/block[15]/block[1]/lineArea" /> + <eval expected="[rbwt:t][rpwt:f-i-c]( Washington )" xpath="//pageViewport[4]/page/regionViewport[3]//flow[1]/block[1]/block[5]/block[1]/lineArea" /> + </checks> +</testcase>
\ No newline at end of file |