public void testRowBoxesEstablishOwnBlockContext() throws Exception {
    // this report defines that the group as well as all bands within that group are row-layout.
    // therefore the two itembands end on the same row.

    // The itemband did not define a width, not even a 100% width, and thus ends with a width of
    // auto/zero.
    // therefore the itemband shrinks to the minimal size that still encloses all elements.
    // the elements that have percentage width are resolved against the block context.
    // A band without a width defined (the itemband!), does not establish an own block-context, so
    // it
    // takes the block context of the parent, or as fallback: page.

    final File file = GoldTestBase.locateGoldenSampleReport("Prd-3479.prpt");
    final ResourceManager mgr = new ResourceManager();
    mgr.registerDefaults();
    final Resource directly = mgr.createDirectly(file, MasterReport.class);
    final MasterReport report = (MasterReport) directly.getResource();
    report.setCompatibilityLevel(null);

    final LogicalPageBox logicalPageBox = DebugReportRunner.layoutPage(report, 0);
    final RenderNode[] itembands =
        MatchFactory.findElementsByElementType(logicalPageBox, ItemBandType.INSTANCE);

    assertEquals(2, itembands.length);
    assertEquals(48208843, itembands[0].getWidth());
    assertEquals(48208843, itembands[1].getWidth());
    assertEquals(48208843, itembands[1].getX());
  }
Exemplo n.º 2
0
  @Test
  public void testTableColumns() throws Exception {
    final MasterReport report = DebugReportRunner.parseGoldenSampleReport("Prd-4523.prpt");
    report
        .getReportConfiguration()
        .setConfigProperty(ClassicEngineCoreModule.COMPLEX_TEXT_CONFIG_OVERRIDE_KEY, "false");
    LogicalPageBox logicalPageBox = DebugReportRunner.layoutPage(report, 0);
    RenderNode[] elementsByNodeType =
        MatchFactory.findElementsByNodeType(logicalPageBox, LayoutNodeTypes.TYPE_BOX_TABLE);
    assertEquals(1, elementsByNodeType.length);
    TableRenderBox table = (TableRenderBox) elementsByNodeType[0];
    long width = table.getWidth();
    DebugLog.log(width);
    SeparateColumnModel columnModel = (SeparateColumnModel) table.getColumnModel();
    long sum = 0;
    final ArrayList<TableColumn> expected = new ArrayList<TableColumn>();
    expected.add(createTableColumn(4748666, 4222000, 0, 0, 0));
    expected.add(createTableColumn(4694666, 4168000, 0, 0, 0));
    expected.add(createTableColumn(8415666, 7889000, 0, 0, 2824000));
    expected.add(createTableColumn(8415666, 7889000, 0, 0, 0));
    expected.add(createTableColumn(8415666, 7889000, 0, 0, 0));
    expected.add(createTableColumn(8415666, 7889000, 0, 0, 0));
    expected.add(createTableColumn(8415666, 7889000, 0, 0, 2824000));
    expected.add(createTableColumn(8415666, 7889000, 0, 0, 0));
    expected.add(createTableColumn(8415666, 7889000, 0, 0, 0));
    expected.add(createTableColumn(8415666, 7889000, 0, 0, 0));
    expected.add(createTableColumn(8415666, 7889000, 2824000, 0, 0));
    expected.add(createTableColumn(8415666, 7889000, 0, 0, 0));

    TableColumn[] columns = columnModel.getColumns();
    for (int i = 0; i < columns.length; i += 1) {
      TableColumn c = columnModel.getColumn(i);
      assertColumnsEqual(expected.get(i), c);
    }
  }
Exemplo n.º 3
0
 public void testWidow1Error() throws Exception {
   final MasterReport masterReport =
       DebugReportRunner.parseGoldenSampleReport("Prd-2087-Widow-1.prpt");
   // masterReport.setCompatibilityLevel(ClassicEngineBoot.computeVersionId(3, 8, 0));
   //    DebugReportRunner.createXmlTablePageable(masterReport);
   final LogicalPageBox logicalPageBox = DebugReportRunner.layoutPage(masterReport, 3);
   //    ModelPrinter.INSTANCE.print(logicalPageBox);
 }
  public void testPagebreakHonoredOnFirstPage() throws Exception {
    final MasterReport masterReport = DebugReportRunner.parseGoldenSampleReport("Pre-492.prpt");
    final LogicalPageBox page0 = DebugReportRunner.layoutPage(masterReport, 0);
    final RenderNode[] elementsByElementType =
        MatchFactory.findElementsByElementType(page0.getContentArea(), AutoLayoutBoxType.INSTANCE);
    assertEquals(31, elementsByElementType.length);
    assertEquals(
        StrictGeomUtility.toInternalValue(199),
        elementsByElementType[elementsByElementType.length - 1].getY());

    final LogicalPageBox page1 = DebugReportRunner.layoutPage(masterReport, 1);
    final RenderNode[] elementsPage1 =
        MatchFactory.findElementsByElementType(page1.getContentArea(), AutoLayoutBoxType.INSTANCE);
    assertEquals(34, elementsPage1.length);
    assertEquals(
        StrictGeomUtility.toInternalValue(211), elementsPage1[elementsPage1.length - 1].getY());
    //  ModelPrinter.INSTANCE.print(page1);
  }
Exemplo n.º 5
0
  public void testOrphan4() throws Exception {
    final MasterReport masterReport =
        DebugReportRunner.parseGoldenSampleReport("Prd-2087-Orphan-4.prpt");

    final LogicalPageBox box = DebugReportRunner.layoutPage(masterReport, 0);
    final RenderNode srs[] = MatchFactory.findElementsByElementType(box, SubReportType.INSTANCE);
    assertEquals(1, srs.length);
    assertEquals(StrictGeomUtility.toInternalValue(20), srs[0].getY());
    final RenderNode elementByName = MatchFactory.findElementByName(box, "outer-group");
    assertEquals(StrictGeomUtility.toInternalValue(20), elementByName.getY());
  }
Exemplo n.º 6
0
  /**
   * Canvas elements do not shift content. Therefore the widow definition is not effective.
   *
   * @throws Exception
   */
  public void testOrphan5() throws Exception {
    final MasterReport masterReport =
        DebugReportRunner.parseGoldenSampleReport("Prd-2087-Orphan-5.prpt");
    // masterReport.setCompatibilityLevel(ClassicEngineBoot.computeVersionId(3, 8, 0));
    // DebugReportRunner.createXmlPageable(masterReport);

    final LogicalPageBox box = DebugReportRunner.layoutPage(masterReport, 0);
    final RenderNode elementByName = MatchFactory.findElementByName(box, "outer-group");
    assertEquals(StrictGeomUtility.toInternalValue(20), elementByName.getY());
    //    ModelPrinter.INSTANCE.print(box);
    //    DebugReportRunner.showDialog(masterReport);

  }
  public void testWizardDefinitionIsAvailable() throws Exception {
    final File url = GoldTestBase.locateGoldenSampleReport("prd-2887.prpt");
    assertNotNull(url);
    final ResourceManager resourceManager = new ResourceManager();
    resourceManager.registerDefaults();
    final Resource directly = resourceManager.createDirectly(url, MasterReport.class);
    final MasterReport org = (MasterReport) directly.getResource();

    assertNotNull(WizardProcessorUtil.loadWizardSpecification(org, resourceManager));
    final MasterReport report = postProcess(org);
    assertNotNull(WizardProcessorUtil.loadWizardSpecification(report, report.getResourceManager()));
    DetailsHeader detailsHeader = report.getDetailsHeader();
    detailsHeader.getElement(0).setName("MagicChange");

    LogicalPageBox logicalPageBox = DebugReportRunner.layoutPage(report, 1);
    ModelPrinter.INSTANCE.print(logicalPageBox);
  }