Skip to content

Commit 429a648

Browse files
Kate IvanovaiText-CI
authored andcommitted
Add new tests for tiff images
1. ImageTest#createTiffImageTest 2. ImageTest#tiffImageWithoutCompressionTest DEVSIX-3774, DEVSIX-987, DEV-1828 Autoported commit. Original commit hash: [9946d7d11]
1 parent aa5f25c commit 429a648

File tree

6 files changed

+34
-1
lines changed

6 files changed

+34
-1
lines changed

itext.tests/itext.layout.tests/itext/layout/ImageTest.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,5 +777,38 @@ public virtual void ImageBorderRadiusTest01() {
777777
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, destinationFolder
778778
, "diff"));
779779
}
780+
781+
[NUnit.Framework.Test]
782+
[LogMessage(iText.IO.LogMessageConstant.ELEMENT_DOES_NOT_FIT_AREA, Count = 3)]
783+
public virtual void CreateTiffImageTest() {
784+
String outFileName = destinationFolder + "createTiffImageTest.pdf";
785+
String cmpFileName = sourceFolder + "cmp_createTiffImageTest.pdf";
786+
String imgPath = sourceFolder + "group4Compression.tif";
787+
PdfDocument pdfDoc = new PdfDocument(new PdfWriter(outFileName));
788+
Document document = new Document(pdfDoc);
789+
ImageData id = ImageDataFactory.Create(imgPath);
790+
ImageData idAsTiff = ImageDataFactory.CreateTiff(UrlUtil.ToURL(imgPath), true, 1, true);
791+
ImageData idAsTiffFalse = ImageDataFactory.CreateTiff(UrlUtil.ToURL(imgPath), false, 1, false);
792+
document.Add(new iText.Layout.Element.Image(id));
793+
document.Add(new iText.Layout.Element.Image(idAsTiff));
794+
document.Add(new iText.Layout.Element.Image(idAsTiffFalse));
795+
document.Close();
796+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, destinationFolder
797+
));
798+
}
799+
800+
[NUnit.Framework.Test]
801+
public virtual void TiffImageWithoutCompressionTest() {
802+
String outFileName = destinationFolder + "tiffImageWithoutCompression.pdf";
803+
String cmpFileName = sourceFolder + "cmp_tiffImageWithoutCompression.pdf";
804+
String imgPath = sourceFolder + "no-compression-tag.tiff";
805+
PdfDocument pdfDoc = new PdfDocument(new PdfWriter(outFileName));
806+
Document document = new Document(pdfDoc);
807+
ImageData id = ImageDataFactory.Create(imgPath);
808+
document.Add(new iText.Layout.Element.Image(id));
809+
document.Close();
810+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, destinationFolder
811+
, "diff02_"));
812+
}
780813
}
781814
}

port-hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
a9b9306d604b441a28373b83f8ea0e377e867b18
1+
9946d7d113c033e1df6c213230c42ff7ad140c5d

0 commit comments

Comments
 (0)