Skip to content

Commit 93dc060

Browse files
author
Samuel Huylebroeck
committed
Additional test and javadoc update
DEVSIX-1658
1 parent 84f7910 commit 93dc060

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

layout/src/main/java/com/itextpdf/layout/element/Image.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,10 @@ public Image setAutoScale(boolean autoScale) {
340340
return this;
341341
}
342342

343+
//TODO(DEVSIX-1658):Remove bugged mention
343344
/**
344345
* Sets the autoscale property for the height of the image.
345-
*
346+
* Is currently bugged and will not work as expected.
346347
* @param autoScale whether or not to let the image height resize automatically
347348
* @return this image
348349
*/

layout/src/test/java/com/itextpdf/layout/ImageTest.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,40 @@ public void imageTest20() throws IOException, InterruptedException {
543543
Assert.assertNull(new CompareTool().compareByContent(outFileName, cmpFileName, destinationFolder, "diff"));
544544
}
545545

546+
@Ignore("DEVSIX-1658")
547+
@Test
548+
public void imageTest21() throws IOException, InterruptedException {
549+
String outFileName = destinationFolder + "imageTest21.pdf";
550+
String cmpFileName = sourceFolder + "cmp_imageTest21.pdf";
551+
552+
PdfWriter writer = new PdfWriter(outFileName);
553+
PdfDocument pdfDoc = new PdfDocument(writer);
554+
Document doc = new Document(pdfDoc);
555+
556+
Image image = new Image(ImageDataFactory.create(sourceFolder + "Desert.jpg"));
557+
image.setAutoScaleHeight(true);
558+
float[] colWidths = {1f,1f};
559+
560+
Table container = new Table(UnitValue.createPercentArray(colWidths));
561+
container.addCell("Text");
562+
container.addCell("autoscaling image, height only");
563+
564+
int textIterations =50;
565+
Paragraph p = new Paragraph();
566+
for (int i = 0; i < textIterations; i++) {
567+
p.add("Text will wrap");
568+
}
569+
container.addCell(p);
570+
571+
container.addCell(image);
572+
573+
doc.add(container);
574+
575+
doc.close();
576+
577+
Assert.assertNull(new CompareTool().compareByContent(outFileName, cmpFileName, destinationFolder, "diff"));
578+
}
579+
546580
/**
547581
* Image can be reused in layout, so flushing it on the very first draw is a bad thing.
548582
*/

0 commit comments

Comments
 (0)