From commits-return-15929-archive-asf-public=cust-asf.ponee.io@pdfbox.apache.org Thu Oct 24 02:37:08 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id A67D3180608 for ; Thu, 24 Oct 2019 04:37:08 +0200 (CEST) Received: (qmail 40580 invoked by uid 500); 24 Oct 2019 02:37:07 -0000 Mailing-List: contact commits-help@pdfbox.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pdfbox.apache.org Delivered-To: mailing list commits@pdfbox.apache.org Received: (qmail 40571 invoked by uid 99); 24 Oct 2019 02:37:07 -0000 Received: from Unknown (HELO svn01-us-east.apache.org) (13.90.137.153) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Oct 2019 02:37:07 +0000 Received: from svn01-us-east.apache.org (localhost [127.0.0.1]) by svn01-us-east.apache.org (ASF Mail Server at svn01-us-east.apache.org) with ESMTP id C556817A0E7 for ; Thu, 24 Oct 2019 02:37:06 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1868830 - in /pdfbox/branches/issue45/pdfbox/src/test: java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactoryTest.java resources/org/apache/pdfbox/pdmodel/graphics/image/gif-1bit-transparent.gif Date: Thu, 24 Oct 2019 02:37:06 -0000 To: commits@pdfbox.apache.org From: tilman@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20191024023706.C556817A0E7@svn01-us-east.apache.org> Author: tilman Date: Thu Oct 24 02:37:06 2019 New Revision: 1868830 URL: http://svn.apache.org/viewvc?rev=1868830&view=rev Log: PDFBOX-4672: add "previously failing" test of 1-bit bw gif Added: pdfbox/branches/issue45/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/graphics/image/gif-1bit-transparent.gif (with props) Modified: pdfbox/branches/issue45/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactoryTest.java Modified: pdfbox/branches/issue45/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactoryTest.java URL: http://svn.apache.org/viewvc/pdfbox/branches/issue45/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactoryTest.java?rev=1868830&r1=1868829&r2=1868830&view=diff ============================================================================== --- pdfbox/branches/issue45/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactoryTest.java (original) +++ pdfbox/branches/issue45/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactoryTest.java Thu Oct 24 02:37:06 2019 @@ -264,6 +264,36 @@ public class LosslessFactoryTest extends } /** + * Tests LosslessFactoryTest#createFromImage(PDDocument document, + * BufferedImage image) with a transparent 1 bit GIF. (PDFBOX-4672) + * This ends up as RGB because the 1 bit fast path doesn't support transparency. + * + * @throws java.io.IOException + */ + public void testCreateLosslessFromTransparent1BitGIF() throws IOException + { + PDDocument document = new PDDocument(); + BufferedImage image = ImageIO.read(this.getClass().getResourceAsStream("gif-1bit-transparent.gif")); + + assertEquals(Transparency.BITMASK, image.getColorModel().getTransparency()); + assertEquals(BufferedImage.TYPE_BYTE_BINARY, image.getType()); + + PDImageXObject ximage = LosslessFactory.createFromImage(document, image); + + int w = image.getWidth(); + int h = image.getHeight(); + validate(ximage, 8, w, h, "png", PDDeviceRGB.INSTANCE.getName()); + checkIdent(image, ximage.getImage()); + checkIdentRGB(image, ximage.getOpaqueImage()); + + assertNotNull(ximage.getSoftMask()); + validate(ximage.getSoftMask(), 1, w, h, "png", PDDeviceGray.INSTANCE.getName()); + assertEquals(2, colorCount(ximage.getSoftMask().getImage())); + + doWritePDF(document, ximage, testResultsDir, "gif-1bit-transparent.pdf"); + } + + /** * Test file that had a predictor encoding bug in PDFBOX-4184. * * @throws java.io.IOException Added: pdfbox/branches/issue45/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/graphics/image/gif-1bit-transparent.gif URL: http://svn.apache.org/viewvc/pdfbox/branches/issue45/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/graphics/image/gif-1bit-transparent.gif?rev=1868830&view=auto ============================================================================== Binary file - no diff available. Propchange: pdfbox/branches/issue45/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/graphics/image/gif-1bit-transparent.gif ------------------------------------------------------------------------------ svn:mime-type = image/gif