@@ -471,6 +471,78 @@ public void imageTest17() throws IOException, InterruptedException {
471
471
Assert .assertNull (new CompareTool ().compareByContent (outFileName , cmpFileName , destinationFolder , "diff" ));
472
472
}
473
473
474
+ @ Test
475
+ public void imageTest18 () throws IOException , InterruptedException {
476
+ String outFileName = destinationFolder + "imageTest18.pdf" ;
477
+ String cmpFileName = sourceFolder + "cmp_imageTest18.pdf" ;
478
+
479
+ PdfWriter writer = new PdfWriter (outFileName );
480
+ PdfDocument pdfDoc = new PdfDocument (writer );
481
+ Document doc = new Document (pdfDoc );
482
+
483
+ Image image = new Image (ImageDataFactory .create (sourceFolder + "Desert.jpg" ));
484
+ image .setAutoScale (true );
485
+
486
+ Div container = new Div ();
487
+ container .setBorder (new SolidBorder (1f ));
488
+ container .setWidth (UnitValue .createPercentValue (50f ));
489
+ container .setHeight (UnitValue .createPointValue (300f ));
490
+ container .add (image );
491
+ doc .add (container );
492
+
493
+ doc .close ();
494
+
495
+ Assert .assertNull (new CompareTool ().compareByContent (outFileName , cmpFileName , destinationFolder , "diff" ));
496
+ }
497
+ @ Ignore ("DEVSIX-1658" )
498
+ @ Test
499
+ public void imageTest19 () throws IOException , InterruptedException {
500
+ String outFileName = destinationFolder + "imageTest19.pdf" ;
501
+ String cmpFileName = sourceFolder + "cmp_imageTest19.pdf" ;
502
+
503
+ PdfWriter writer = new PdfWriter (outFileName );
504
+ PdfDocument pdfDoc = new PdfDocument (writer );
505
+ Document doc = new Document (pdfDoc );
506
+
507
+ Image image = new Image (ImageDataFactory .create (sourceFolder + "Desert.jpg" ));
508
+ image .setAutoScaleHeight (true );
509
+
510
+ Div container = new Div ();
511
+ container .setBorder (new SolidBorder (1f ));
512
+ container .setWidth (UnitValue .createPercentValue (50f ));
513
+ container .setHeight (UnitValue .createPointValue (300f ));
514
+ container .add (image );
515
+ doc .add (container );
516
+
517
+ doc .close ();
518
+
519
+ Assert .assertNull (new CompareTool ().compareByContent (outFileName , cmpFileName , destinationFolder , "diff" ));
520
+ }
521
+
522
+ @ Test
523
+ public void imageTest20 () throws IOException , InterruptedException {
524
+ String outFileName = destinationFolder + "imageTest20.pdf" ;
525
+ String cmpFileName = sourceFolder + "cmp_imageTest20.pdf" ;
526
+
527
+ PdfWriter writer = new PdfWriter (outFileName );
528
+ PdfDocument pdfDoc = new PdfDocument (writer );
529
+ Document doc = new Document (pdfDoc );
530
+
531
+ Image image = new Image (ImageDataFactory .create (sourceFolder + "Desert.jpg" ));
532
+ image .setAutoScaleWidth (true );
533
+
534
+ Div container = new Div ();
535
+ container .setBorder (new SolidBorder (1f ));
536
+ container .setWidth (UnitValue .createPercentValue (60f ));
537
+ container .setHeight (UnitValue .createPointValue (300f ));
538
+ container .add (image );
539
+ doc .add (container );
540
+
541
+ doc .close ();
542
+
543
+ Assert .assertNull (new CompareTool ().compareByContent (outFileName , cmpFileName , destinationFolder , "diff" ));
544
+ }
545
+
474
546
/**
475
547
* Image can be reused in layout, so flushing it on the very first draw is a bad thing.
476
548
*/
0 commit comments