From: <pen...@pe...> - 2009-03-25 20:08:33
|
Author: tmorgner Date: 2009-03-25 16:08:28 -0400 (Wed, 25 Mar 2009) New Revision: 8445 Added: engines/classic/trunk/core/test/org/pentaho/reporting/engine/classic/core/bugs/Pre-449.xml engines/classic/trunk/core/test/org/pentaho/reporting/engine/classic/core/bugs/Pre449Test.java Modified: engines/classic/trunk/core/source/org/pentaho/reporting/engine/classic/core/layout/process/ComputeStaticPropertiesProcessStep.java engines/classic/trunk/core/source/org/pentaho/reporting/engine/classic/core/modules/parser/simple/readhandlers/JFreeReportReadHandler.java engines/classic/trunk/core/source/org/pentaho/reporting/engine/classic/core/modules/parser/simple/readhandlers/SimpleSubReportReadHandler.java engines/classic/trunk/core/source/org/pentaho/reporting/engine/classic/core/modules/parser/simple/resources/report.xsd engines/classic/trunk/core/source/org/pentaho/reporting/engine/classic/core/style/ElementDefaultStyleSheet.java engines/classic/trunk/core/test/org/pentaho/reporting/engine/classic/core/bugs/Pre-419.xml engines/classic/trunk/core/test/org/pentaho/reporting/engine/classic/core/layout/layout-matrix.xml engines/classic/trunk/core/test/org/pentaho/reporting/engine/classic/core/modules/output/table/base/layout/TableLayoutTest.java Log: Commiting the layouter changes even with one test still failing. Modified: engines/classic/trunk/core/source/org/pentaho/reporting/engine/classic/core/layout/process/ComputeStaticPropertiesProcessStep.java =================================================================== --- engines/classic/trunk/core/source/org/pentaho/reporting/engine/classic/core/layout/process/ComputeStaticPropertiesProcessStep.java 2009-03-25 18:40:12 UTC (rev 8444) +++ engines/classic/trunk/core/source/org/pentaho/reporting/engine/classic/core/layout/process/ComputeStaticPropertiesProcessStep.java 2009-03-25 20:08:28 UTC (rev 8445) @@ -265,7 +265,7 @@ final long bcw = ProcessUtility.computeBlockContextWidth(box); final long computedWidth = resolveComputedWidth(box); final long insets = box.getInsets(); - box.setComputedWidth(Math.max(computedWidth, bcw + insets)); + box.setComputedWidth(Math.max(computedWidth, bcw)); if ((box.getNodeType() & LayoutNodeTypes.MASK_BOX_INLINE) == LayoutNodeTypes.MASK_BOX_INLINE) { Modified: engines/classic/trunk/core/source/org/pentaho/reporting/engine/classic/core/modules/parser/simple/readhandlers/JFreeReportReadHandler.java =================================================================== --- engines/classic/trunk/core/source/org/pentaho/reporting/engine/classic/core/modules/parser/simple/readhandlers/JFreeReportReadHandler.java 2009-03-25 18:40:12 UTC (rev 8444) +++ engines/classic/trunk/core/source/org/pentaho/reporting/engine/classic/core/modules/parser/simple/readhandlers/JFreeReportReadHandler.java 2009-03-25 20:08:28 UTC (rev 8445) @@ -41,6 +41,7 @@ import org.pentaho.reporting.engine.classic.core.MasterReport; import org.pentaho.reporting.engine.classic.core.RelationalGroup; import org.pentaho.reporting.engine.classic.core.SimplePageDefinition; +import org.pentaho.reporting.engine.classic.core.style.ElementStyleKeys; import org.pentaho.reporting.engine.classic.core.modules.parser.base.DataFactoryReadHandler; import org.pentaho.reporting.engine.classic.core.modules.parser.base.DataFactoryReadHandlerFactory; import org.pentaho.reporting.engine.classic.core.modules.parser.base.PropertyAttributes; @@ -261,6 +262,14 @@ report.setPageDefinition(new SimplePageDefinition(format, pageSpan, 1)); } getRootHandler().setHelperObject(ReportParserUtil.HELPER_OBJ_REPORT_NAME, report); + + final String useMinChunkWidth = attrs.getValue(getUri(), "use-min-chunkwidth"); + if (useMinChunkWidth != null) + { + report.getStyle().setStyleProperty + (ElementStyleKeys.USE_MIN_CHUNKWIDTH, ReportParserUtil.parseBoolean(useMinChunkWidth, getLocator())); + } + this.report = report; } Modified: engines/classic/trunk/core/source/org/pentaho/reporting/engine/classic/core/modules/parser/simple/readhandlers/SimpleSubReportReadHandler.java =================================================================== --- engines/classic/trunk/core/source/org/pentaho/reporting/engine/classic/core/modules/parser/simple/readhandlers/SimpleSubReportReadHandler.java 2009-03-25 18:40:12 UTC (rev 8444) +++ engines/classic/trunk/core/source/org/pentaho/reporting/engine/classic/core/modules/parser/simple/readhandlers/SimpleSubReportReadHandler.java 2009-03-25 20:08:28 UTC (rev 8445) @@ -39,6 +39,7 @@ import org.pentaho.reporting.engine.classic.core.GroupList; import org.pentaho.reporting.engine.classic.core.RelationalGroup; import org.pentaho.reporting.engine.classic.core.SubReport; +import org.pentaho.reporting.engine.classic.core.style.ElementStyleKeys; import org.pentaho.reporting.engine.classic.core.modules.parser.base.PropertyAttributes; import org.pentaho.reporting.engine.classic.core.modules.parser.base.ReportParserUtil; import org.pentaho.reporting.engine.classic.core.modules.parser.base.SubReportReadHandler; @@ -215,6 +216,14 @@ report.setQuery(query); } } + + final String useMinChunkWidth = attrs.getValue(getUri(), "use-min-chunkwidth"); + if (useMinChunkWidth != null) + { + report.getStyle().setStyleProperty + (ElementStyleKeys.USE_MIN_CHUNKWIDTH, ReportParserUtil.parseBoolean(useMinChunkWidth, getLocator())); + } + getRootHandler().setHelperObject(ReportParserUtil.HELPER_OBJ_REPORT_NAME, report); } Modified: engines/classic/trunk/core/source/org/pentaho/reporting/engine/classic/core/modules/parser/simple/resources/report.xsd =================================================================== --- engines/classic/trunk/core/source/org/pentaho/reporting/engine/classic/core/modules/parser/simple/resources/report.xsd 2009-03-25 18:40:12 UTC (rev 8444) +++ engines/classic/trunk/core/source/org/pentaho/reporting/engine/classic/core/modules/parser/simple/resources/report.xsd 2009-03-25 20:08:28 UTC (rev 8445) @@ -683,6 +683,7 @@ <xsd:attribute name="leftmargin" type="xsd:unsignedInt" use="optional"/> <xsd:attribute name="rightmargin" type="xsd:unsignedInt" use="optional"/> <xsd:attribute name="engine-version" type="xsd:string" use="optional"/> + <xsd:attribute name="use-min-chunkwidth" type="xsd:boolean" use="optional"/> </xsd:restriction> </xsd:complexContent> </xsd:complexType> Modified: engines/classic/trunk/core/source/org/pentaho/reporting/engine/classic/core/style/ElementDefaultStyleSheet.java =================================================================== --- engines/classic/trunk/core/source/org/pentaho/reporting/engine/classic/core/style/ElementDefaultStyleSheet.java 2009-03-25 18:40:12 UTC (rev 8444) +++ engines/classic/trunk/core/source/org/pentaho/reporting/engine/classic/core/style/ElementDefaultStyleSheet.java 2009-03-25 20:08:28 UTC (rev 8445) @@ -131,8 +131,6 @@ setStyleProperty(ElementStyleKeys.PADDING_BOTTOM, new Float(0)); setStyleProperty(ElementStyleKeys.AVOID_PAGEBREAK_INSIDE, Boolean.FALSE); - setStyleProperty(ElementStyleKeys.USE_MIN_CHUNKWIDTH, Boolean.FALSE); - setBooleanStyleProperty(ElementStyleKeys.FILL_SHAPE, false); setBooleanStyleProperty(ElementStyleKeys.DRAW_SHAPE, false); setAllowCaching(true); Modified: engines/classic/trunk/core/test/org/pentaho/reporting/engine/classic/core/bugs/Pre-419.xml =================================================================== --- engines/classic/trunk/core/test/org/pentaho/reporting/engine/classic/core/bugs/Pre-419.xml 2009-03-25 18:40:12 UTC (rev 8444) +++ engines/classic/trunk/core/test/org/pentaho/reporting/engine/classic/core/bugs/Pre-419.xml 2009-03-25 20:08:28 UTC (rev 8445) @@ -3,7 +3,7 @@ ~ Copyright (c) 2007, Your Corporation. All Rights Reserved. --> <report xmlns="http://jfreereport.sourceforge.net/namespaces/reports/legacy/simple" - name="Pre-422" orientation="landscape" pageformat="A4" + name="Pre-419" orientation="landscape" pageformat="A4" bottommargin="72" leftmargin="72" rightmargin="72" topmargin="72"> <reportheader layout="block" border-color="black" border-style="solid" border-width="5" Copied: engines/classic/trunk/core/test/org/pentaho/reporting/engine/classic/core/bugs/Pre-449.xml (from rev 8411, engines/classic/trunk/core/test/org/pentaho/reporting/engine/classic/core/bugs/Pre-458.xml) =================================================================== --- engines/classic/trunk/core/test/org/pentaho/reporting/engine/classic/core/bugs/Pre-449.xml (rev 0) +++ engines/classic/trunk/core/test/org/pentaho/reporting/engine/classic/core/bugs/Pre-449.xml 2009-03-25 20:08:28 UTC (rev 8445) @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright (c) 2007, Your Corporation. All Rights Reserved. + --> +<report xmlns="http://jfreereport.sourceforge.net/namespaces/reports/legacy/simple" + name="Pre-449" width="500" height="500" + bottommargin="0" leftmargin="0" rightmargin="0" topmargin="0"> + <reportheader layout="block" + border-color="black" border-style="solid" border-width="25" + name="reportheader" + height="150"> + </reportheader> +</report> Property changes on: engines/classic/trunk/core/test/org/pentaho/reporting/engine/classic/core/bugs/Pre-449.xml ___________________________________________________________________ Name: svn:mergeinfo + Copied: engines/classic/trunk/core/test/org/pentaho/reporting/engine/classic/core/bugs/Pre449Test.java (from rev 8411, engines/classic/trunk/core/test/org/pentaho/reporting/engine/classic/core/bugs/Pre458Test.java) =================================================================== --- engines/classic/trunk/core/test/org/pentaho/reporting/engine/classic/core/bugs/Pre449Test.java (rev 0) +++ engines/classic/trunk/core/test/org/pentaho/reporting/engine/classic/core/bugs/Pre449Test.java 2009-03-25 20:08:28 UTC (rev 8445) @@ -0,0 +1,103 @@ +package org.pentaho.reporting.engine.classic.core.bugs; + +import java.net.URL; +import java.awt.print.PageFormat; + +import javax.swing.table.DefaultTableModel; + +import junit.framework.TestCase; +import org.pentaho.reporting.engine.classic.core.ClassicEngineBoot; +import org.pentaho.reporting.engine.classic.core.MasterReport; +import org.pentaho.reporting.engine.classic.core.SimplePageDefinition; +import org.pentaho.reporting.engine.classic.core.Band; +import org.pentaho.reporting.engine.classic.core.layout.output.DefaultProcessingContext; +import org.pentaho.reporting.engine.classic.core.layout.Renderer; +import org.pentaho.reporting.engine.classic.core.layout.ModelPrinter; +import org.pentaho.reporting.engine.classic.core.layout.process.IterateStructuralProcessStep; +import org.pentaho.reporting.engine.classic.core.layout.model.LogicalPageBox; +import org.pentaho.reporting.engine.classic.core.layout.model.CanvasRenderBox; +import org.pentaho.reporting.engine.classic.core.layout.model.RenderableReplacedContentBox; +import org.pentaho.reporting.engine.classic.core.layout.model.BlockRenderBox; +import org.pentaho.reporting.engine.classic.core.function.ProcessingContext; +import org.pentaho.reporting.engine.classic.core.testsupport.DebugReportRunner; +import org.pentaho.reporting.engine.classic.core.testsupport.DebugExpressionRuntime; +import org.pentaho.reporting.engine.classic.core.testsupport.DebugRenderer; +import org.pentaho.reporting.libraries.resourceloader.ResourceManager; +import org.pentaho.reporting.libraries.resourceloader.Resource; + +/** + * Todo: Document Me + * + * @author Thomas Morgner + */ +public class Pre449Test extends TestCase +{ + public Pre449Test() + { + } + + public Pre449Test(final String s) + { + super(s); + } + + protected void setUp() throws Exception + { + ClassicEngineBoot.getInstance().start(); + } + + + public void testWatermarkCrash() throws Exception + { + final URL url = getClass().getResource("Pre-449.xml"); + assertNotNull(url); + final ResourceManager resourceManager = new ResourceManager(); + resourceManager.registerDefaults(); + final Resource directly = resourceManager.createDirectly(url, MasterReport.class); + final MasterReport report = (MasterReport) directly.getResource(); + + + final ProcessingContext processingContext = new DefaultProcessingContext(); + final DebugExpressionRuntime runtime = new DebugExpressionRuntime(new DefaultTableModel(), 0, processingContext); + + final Object stateKey = new Object(); + final DebugRenderer debugLayoutSystem = new DebugRenderer(); + debugLayoutSystem.startReport(report); + debugLayoutSystem.startSection(Renderer.TYPE_NORMALFLOW); + + final Band band = (Band) report.getReportHeader(); + debugLayoutSystem.add(band, runtime, stateKey); + + debugLayoutSystem.endSection(); + debugLayoutSystem.endReport(); + + assertTrue(debugLayoutSystem.validatePages()); + + final LogicalPageBox logicalPageBox = debugLayoutSystem.getPageBox(); + // simple test, we assert that all paragraph-poolboxes are on either 485000 or 400000 + // and that only two lines exist for each + ModelPrinter.print(logicalPageBox); + new ValidateRunner().startValidation(logicalPageBox); + } + + + private static class ValidateRunner extends IterateStructuralProcessStep + { + public void startValidation(final LogicalPageBox logicalPageBox) + { + startProcessing(logicalPageBox); + } + + protected boolean startBlockBox(final BlockRenderBox box) + { + if ("reportheader".equals(box.getName())) + { + assertEquals("X=0pt", 0, box.getX()); + assertEquals("Y=0pt", 0, box.getY()); + assertEquals("Height=150pt", 150000, box.getHeight()); + assertEquals("Width=500pt", 500000, box.getWidth()); + } + return true; + } + } +} \ No newline at end of file Property changes on: engines/classic/trunk/core/test/org/pentaho/reporting/engine/classic/core/bugs/Pre449Test.java ___________________________________________________________________ Name: svn:mergeinfo + Modified: engines/classic/trunk/core/test/org/pentaho/reporting/engine/classic/core/layout/layout-matrix.xml =================================================================== --- engines/classic/trunk/core/test/org/pentaho/reporting/engine/classic/core/layout/layout-matrix.xml 2009-03-25 18:40:12 UTC (rev 8444) +++ engines/classic/trunk/core/test/org/pentaho/reporting/engine/classic/core/layout/layout-matrix.xml 2009-03-25 20:08:28 UTC (rev 8445) @@ -1,7 +1,8 @@ <?xml version="1.0" encoding="ISO-8859-1"?> <report xmlns="http://jfreereport.sourceforge.net/namespaces/reports/legacy/simple" - name="Nested Rows" pageformat="A4" topmargin="25" leftmargin="25" bottommargin="25" rightmargin="25"> + name="Nested Rows" pageformat="A4" topmargin="25" leftmargin="25" bottommargin="25" rightmargin="25" + use-min-chunkwidth="true"> <configuration> <property name="org.pentaho.reporting.engine.classic.core.layout.UseMinChunkWidth">true</property> </configuration> Modified: engines/classic/trunk/core/test/org/pentaho/reporting/engine/classic/core/modules/output/table/base/layout/TableLayoutTest.java =================================================================== --- engines/classic/trunk/core/test/org/pentaho/reporting/engine/classic/core/modules/output/table/base/layout/TableLayoutTest.java 2009-03-25 18:40:12 UTC (rev 8444) +++ engines/classic/trunk/core/test/org/pentaho/reporting/engine/classic/core/modules/output/table/base/layout/TableLayoutTest.java 2009-03-25 20:08:28 UTC (rev 8445) @@ -117,7 +117,6 @@ ClassicEngineBoot.getInstance().getGlobalConfig()); config.setConfigProperty("org.pentaho.reporting.engine.classic.core.modules.output.table.base.StrictLayout", String.valueOf(sequence.isStrict())); - config.setConfigProperty("org.pentaho.reporting.engine.classic.core.layout.UseMinChunkWidth", "true"); final OutputProcessorMetaData metaData = new HtmlOutputProcessorMetaData(config, HtmlOutputProcessorMetaData.PAGINATION_NONE); runtime.run(sequence, metaData); |