Skip to content

Commit e2d1381

Browse files
EvgenyB1001iText-CI
authored andcommitted
Add tests for grayscale alpha png without embedded profile
DEVSIX-3810
1 parent 9a233f1 commit e2d1381

File tree

5 files changed

+24
-0
lines changed

5 files changed

+24
-0
lines changed

io/src/test/java/com/itextpdf/io/image/PngTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,21 @@ public void graya8BpcDepthImageTest() throws IOException {
7272
Assert.assertEquals(8, img.getImageMask().getBpc());
7373
}
7474

75+
@Test
76+
public void graya8BpcDepthWithoutEmbeddedProfileImageTest() throws IOException {
77+
ImageData img = ImageDataFactory.create(sourceFolder + "graya8BpcWithoutProfile.png");
78+
Assert.assertEquals(ImageType.PNG, img.getOriginalType());
79+
Assert.assertEquals(100, img.getWidth(), 0);
80+
Assert.assertEquals(100, img.getHeight(), 0);
81+
Assert.assertEquals(8, img.getBpc());
82+
Assert.assertEquals(1, img.getColorSpace());
83+
Assert.assertEquals(4, ((PngImageData) img).getColorType());
84+
Assert.assertNotNull(img.getImageMask());
85+
Assert.assertEquals(1, img.getImageMask().getColorSpace());
86+
Assert.assertEquals(8, img.getImageMask().getBpc());
87+
Assert.assertNull(img.getProfile());
88+
}
89+
7590
@Test
7691
public void graya8BpcAddColorToAlphaImageTest() throws IOException {
7792
ImageData img = ImageDataFactory.create(sourceFolder + "graya8BpcAddColorToAlpha.png");
1.8 KB
Loading

kernel/src/test/java/com/itextpdf/kernel/pdf/xobject/PdfImageXObjectTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,15 @@ public void grayAlphaPngImageXObjectTest() throws IOException {
118118
sourceFolder + "graya8Bpc.png");
119119
}
120120

121+
@Test
122+
public void grayAlphaPngWithoutEmbeddedProfileImageXObjectTest() throws IOException {
123+
// TODO DEVSIX-1313
124+
// Update cmp file after the specified ticket will be resolved
125+
convertAndCompare(destinationFolder + "graya8BpcWithoutProfile.pdf",
126+
sourceFolder + "cmp_graya8BpcWithoutProfile.pdf",
127+
sourceFolder + "graya8BpcWithoutProfile.png");
128+
}
129+
121130
@Test
122131
public void graySimpleTransparencyPngImageXObjectTest() throws IOException {
123132
convertAndCompare(destinationFolder + "grayscaleSimpleTransparencyImage.pdf",
1.8 KB
Loading

0 commit comments

Comments
 (0)