Skip to content

Commit 15f9f5b

Browse files
IdamkinIitext-teamcity
authored andcommitted
Add new png color profile test
Autoported commit. Original commit hash: [4618023e8]
1 parent cfa7e7d commit 15f9f5b

File tree

6 files changed

+27
-13
lines changed

6 files changed

+27
-13
lines changed

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

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -517,18 +517,15 @@ public virtual void ImageTest21() {
517517
/// <exception cref="System.IO.IOException"/>
518518
/// <exception cref="System.Exception"/>
519519
[NUnit.Framework.Test]
520-
public virtual void PngImageTest() {
521-
String outFileName = destinationFolder + "pngTest.pdf";
522-
String cmpFileName = sourceFolder + "cmp_pngTest.pdf";
523-
PdfDocument pdf = new PdfDocument(new PdfWriter(outFileName));
524-
Document document = new Document(pdf);
525-
iText.Layout.Element.Image png = new iText.Layout.Element.Image(ImageDataFactory.Create(sourceFolder + "test.png"
526-
));
527-
png.SetAutoScale(true);
528-
document.Add(png);
529-
document.Close();
530-
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, destinationFolder
531-
, "diff_png_"));
520+
public virtual void PngImageColorProfileTest() {
521+
SimpleImageTest("pngColorProfileTest.pdf", "png-color-profile-test.png");
522+
}
523+
524+
/// <exception cref="System.IO.IOException"/>
525+
/// <exception cref="System.Exception"/>
526+
[NUnit.Framework.Test]
527+
public virtual void PngImageIncorrectColorProfileTest() {
528+
SimpleImageTest("pngIncorrectColorProfileTest.pdf", "png-incorrect-color-profile-test.png");
532529
}
533530

534531
/// <summary>Image can be reused in layout, so flushing it on the very first draw is a bad thing.</summary>
@@ -777,5 +774,22 @@ public virtual void ImageWithMinMaxHeightTest01() {
777774
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, destinationFolder
778775
, "diff"));
779776
}
777+
778+
/// <exception cref="System.IO.IOException"/>
779+
/// <exception cref="System.Exception"/>
780+
private void SimpleImageTest(String pdfName, String imageName) {
781+
String outFileName = destinationFolder + pdfName;
782+
String cmpFileName = sourceFolder + "cmp_" + pdfName;
783+
String diff = "diff_" + pdfName + "_";
784+
PdfDocument pdf = new PdfDocument(new PdfWriter(outFileName));
785+
Document document = new Document(pdf);
786+
iText.Layout.Element.Image png = new iText.Layout.Element.Image(ImageDataFactory.Create(sourceFolder + imageName
787+
));
788+
png.SetAutoScale(true);
789+
document.Add(png);
790+
document.Close();
791+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, destinationFolder
792+
, diff));
793+
}
780794
}
781795
}
Binary file not shown.
8.03 KB
Loading

port-hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
c4f937a46b6932270d19caaba3ed395b08d4f9e8
1+
4618023e89f9ab0975e6c41669130e40a99826cd

0 commit comments

Comments
 (0)