@@ -2512,20 +2512,46 @@ public void spacingTest01() throws IOException, InterruptedException {
2512
2512
Assert .assertNull (new CompareTool ().compareByContent (outFileName , cmpFileName , destinationFolder , testName + "_diff" ));
2513
2513
}
2514
2514
2515
- //exception to be fixed in DEVSIX-2228
2516
2515
@ Test
2517
- public void rowspanTest () throws IOException {
2518
- //actually ArrayIndexOutOfBoundsException is expected, but it won't be ported.
2519
- junitExpectedException .expect (RuntimeException .class );
2520
- String outFileName = destinationFolder + "rowspanTest.pdf" ;
2516
+ public void skipLastFooterAndProcessBigRowspanTest01 () throws IOException , InterruptedException {
2517
+ String testName = "skipLastFooterAndProcessBigRowspanTest01.pdf" ;
2518
+ String outFileName = destinationFolder + testName ;
2519
+ String cmpFileName = sourceFolder + "cmp_" + testName ;
2520
+
2521
+ PdfDocument pdfDoc = new PdfDocument (new PdfWriter (outFileName ));
2522
+ Document doc = new Document (pdfDoc , new PageSize (595 , 140 ));
2523
+ Table table = new Table (2 );
2524
+
2525
+ table .setSkipLastFooter (true );
2526
+
2527
+ table .addFooterCell (new Cell (1 , 2 ).add (new Paragraph ("Footer" )));
2528
+ table .addCell (new Cell (3 , 1 ).add (new Paragraph (Integer .toString (1 ))));
2529
+ for (int z = 0 ; z < 3 ; z ++) {
2530
+ table .addCell (new Cell ().add (new Paragraph (Integer .toString (z ))));
2531
+ }
2532
+
2533
+ doc .add (table );
2534
+ doc .close ();
2535
+
2536
+ Assert .assertNull (new CompareTool ().compareByContent (outFileName , cmpFileName , destinationFolder , testName + "_diff" ));
2537
+ }
2538
+
2539
+ @ Test
2540
+ public void skipLastFooterAndProcessBigRowspanTest02 () throws IOException , InterruptedException {
2541
+ String testName = "skipLastFooterAndProcessBigRowspanTest02.pdf" ;
2542
+ String outFileName = destinationFolder + testName ;
2543
+ String cmpFileName = sourceFolder + "cmp_" + testName ;
2544
+
2521
2545
int numRows = 3 ;
2522
- PdfWriter writer = new PdfWriter (outFileName );
2523
- PdfDocument pdfDoc = new PdfDocument (writer );
2546
+ PdfDocument pdfDoc = new PdfDocument (new PdfWriter (outFileName ));
2524
2547
Document doc = new Document (pdfDoc );
2548
+
2525
2549
Table table = new Table (numRows );
2526
2550
table .setSkipLastFooter (true );
2551
+
2527
2552
table .addHeaderCell (new Cell (1 , numRows ).add (new Paragraph ("Header" )));
2528
2553
table .addFooterCell (new Cell (1 , numRows ).add (new Paragraph ("Footer" )));
2554
+
2529
2555
for (int rows = 0 ; rows < 11 ; rows ++) {
2530
2556
table .addCell (new Cell (numRows , 1 ).add (new Paragraph ("Filled Cell: " + Integer .toString (rows ) + ", 0" )));
2531
2557
int numFillerCells = (numRows -1 ) * numRows ; //Number of cells to complete the table rows filling up to the cell of colSpan
@@ -2535,6 +2561,32 @@ public void rowspanTest() throws IOException{
2535
2561
}
2536
2562
doc .add (table );
2537
2563
doc .close ();
2564
+ Assert .assertNull (new CompareTool ().compareByContent (outFileName , cmpFileName , destinationFolder , testName + "_diff" ));
2565
+ }
2566
+
2567
+ @ Test
2568
+ public void skipLastFooterOnShortPageTest01 () throws IOException , InterruptedException {
2569
+ String testName = "skipLastFooterOnShortPageTest01.pdf" ;
2570
+ String outFileName = destinationFolder + testName ;
2571
+ String cmpFileName = sourceFolder + "cmp_" + testName ;
2572
+
2573
+ PdfDocument pdfDoc = new PdfDocument (new PdfWriter (outFileName ));
2574
+ Document doc = new Document (pdfDoc , new PageSize (595 , 120 ));
2575
+ Table table = new Table (2 );
2576
+
2577
+ table .setSkipLastFooter (true );
2578
+
2579
+ table .addFooterCell (new Cell (1 , 2 ).add (new Paragraph ("Footer" )));
2580
+ for (int z = 0 ; z < 2 ; z ++) {
2581
+ for (int i = 0 ; i < 2 ; i ++) {
2582
+ table .addCell (new Cell ().add (new Paragraph (Integer .toString (z ))));
2583
+ }
2584
+ }
2585
+
2586
+ doc .add (table );
2587
+ doc .close ();
2588
+
2589
+ Assert .assertNull (new CompareTool ().compareByContent (outFileName , cmpFileName , destinationFolder , testName + "_diff" ));
2538
2590
}
2539
2591
2540
2592
static class CustomRenderer extends TableRenderer {
0 commit comments