Search in sources :

Example 1 with LogMessages

use of com.itextpdf.test.annotations.LogMessages in project i7j-pdfsweep by itext.

the class BigDocumentCleanUpTest method bigTaggedDocument.

@Test
@LogMessages(messages = @LogMessage(messageTemplate = IoLogMessageConstant.CREATED_ROOT_TAG_HAS_MAPPING))
public void bigTaggedDocument() throws IOException, InterruptedException {
    String input = inputPath + "chapter8_Interactive_features.pdf";
    String output = outputPath + "bigTaggedDocument.pdf";
    String cmp = inputPath + "cmp_bigTaggedDocument.pdf";
    List<Rectangle> rects = Arrays.asList(new Rectangle(60f, 80f, 460f, 65f), new Rectangle(300f, 370f, 215f, 270f));
    cleanUp(input, output, initLocations(rects, 131));
    compareByContent(cmp, output, outputPath, "4");
}
Also used : Rectangle(com.itextpdf.kernel.geom.Rectangle) IntegrationTest(com.itextpdf.test.annotations.type.IntegrationTest) ExtendedITextTest(com.itextpdf.test.ExtendedITextTest) Test(org.junit.Test) LogMessages(com.itextpdf.test.annotations.LogMessages)

Example 2 with LogMessages

use of com.itextpdf.test.annotations.LogMessages in project i7j-pdfsweep by itext.

the class CleanUpAnnotationTest method cleanWatermarkAnnotation.

@Test
@LogMessages(messages = @LogMessage(messageTemplate = CleanUpLogMessageConstant.REDACTION_OF_ANNOTATION_TYPE_WATERMARK_IS_NOT_SUPPORTED))
public // TODO: update cmp file after DEVSIX-2471 fix
void cleanWatermarkAnnotation() throws IOException, InterruptedException {
    String input = inputPath + "watermarkAnnotation.pdf";
    String output = outputPath + "watermarkAnnotation.pdf";
    String cmp = inputPath + "cmp_watermarkAnnotation.pdf";
    cleanUp(input, output, Collections.singletonList(new PdfCleanUpLocation(1, new Rectangle(410, 410, 50, 50), ColorConstants.YELLOW)));
    compareByContent(cmp, output, outputPath);
}
Also used : Rectangle(com.itextpdf.kernel.geom.Rectangle) IntegrationTest(com.itextpdf.test.annotations.type.IntegrationTest) ExtendedITextTest(com.itextpdf.test.ExtendedITextTest) Test(org.junit.Test) LogMessages(com.itextpdf.test.annotations.LogMessages)

Example 3 with LogMessages

use of com.itextpdf.test.annotations.LogMessages in project i7j-pdfsweep by itext.

the class CleanUpCsCompareUtilTest method imageReadExceptionTest.

@Test
@LogMessages(messages = @LogMessage(messageTemplate = CleanUpLogMessageConstant.CANNOT_OBTAIN_IMAGE_INFO_AFTER_FILTERING))
public void imageReadExceptionTest() {
    PdfStream stream1 = new PdfStream();
    stream1.put(PdfName.BitsPerComponent, new PdfNumber(8));
    stream1.put(PdfName.ColorSpace, PdfName.DeviceCMYK);
    PdfImageXObject image1 = new PdfImageXObject(stream1);
    stream1 = new PdfStream();
    stream1.put(PdfName.BitsPerComponent, new PdfNumber(8));
    stream1.put(PdfName.ColorSpace, PdfName.DeviceCMYK);
    PdfImageXObject image2 = new PdfImageXObject(stream1);
    Assert.assertFalse(CleanUpCsCompareUtil.isOriginalCsCompatible(image1, image2));
}
Also used : PdfImageXObject(com.itextpdf.kernel.pdf.xobject.PdfImageXObject) PdfNumber(com.itextpdf.kernel.pdf.PdfNumber) PdfStream(com.itextpdf.kernel.pdf.PdfStream) IntegrationTest(com.itextpdf.test.annotations.type.IntegrationTest) ExtendedITextTest(com.itextpdf.test.ExtendedITextTest) Test(org.junit.Test) LogMessages(com.itextpdf.test.annotations.LogMessages)

Example 4 with LogMessages

use of com.itextpdf.test.annotations.LogMessages in project i7j-pdfsweep by itext.

the class PdfCleanUpToolTest method noninvertibleMatrixRemoveAllTest.

@Test
@LogMessages(messages = @LogMessage(messageTemplate = CleanUpLogMessageConstant.FAILED_TO_PROCESS_A_TRANSFORMATION_MATRIX))
public void noninvertibleMatrixRemoveAllTest() throws IOException, InterruptedException {
    String fileName = "noninvertibleMatrixRemoveAllTest";
    String input = INPUT_PATH + "noninvertibleMatrix.pdf";
    String output = OUTPUT_PATH + fileName + ".pdf";
    String cmp = INPUT_PATH + "cmp_" + fileName + ".pdf";
    PdfCleanUpLocation wholePageLocation = new PdfCleanUpLocation(1, new Rectangle(0, 0, 595, 842), null);
    cleanUp(input, output, Arrays.asList(wholePageLocation));
    compareByContent(cmp, output, OUTPUT_PATH, "diff_noninvertibleMatrixRemoveAllTest");
}
Also used : Rectangle(com.itextpdf.kernel.geom.Rectangle) PdfString(com.itextpdf.kernel.pdf.PdfString) IntegrationTest(com.itextpdf.test.annotations.type.IntegrationTest) ExtendedITextTest(com.itextpdf.test.ExtendedITextTest) Test(org.junit.Test) LogMessages(com.itextpdf.test.annotations.LogMessages)

Example 5 with LogMessages

use of com.itextpdf.test.annotations.LogMessages in project i7j-pdfsweep by itext.

the class CleanUpTextTest method cleanZeroWidthTextInvalidFont.

@Test
@LogMessages(messages = { @LogMessage(messageTemplate = IoLogMessageConstant.FONT_DICTIONARY_WITH_NO_FONT_DESCRIPTOR), @LogMessage(messageTemplate = IoLogMessageConstant.FONT_DICTIONARY_WITH_NO_WIDTHS) })
public void cleanZeroWidthTextInvalidFont() throws IOException, InterruptedException {
    String input = inputPath + "cleanZeroWidthTextInvalidFont.pdf";
    String output = outputPath + "cleanZeroWidthTextInvalidFont.pdf";
    String cmp = inputPath + "cmp_cleanZeroWidthTextInvalidFont.pdf";
    cleanUp(input, output, Arrays.asList(new PdfCleanUpLocation(1, new Rectangle(50, 50, 500, 500))));
    compareByContent(cmp, output, outputPath);
}
Also used : PdfCleanUpLocation(com.itextpdf.pdfcleanup.PdfCleanUpLocation) Rectangle(com.itextpdf.kernel.geom.Rectangle) IntegrationTest(com.itextpdf.test.annotations.type.IntegrationTest) ExtendedITextTest(com.itextpdf.test.ExtendedITextTest) Test(org.junit.Test) LogMessages(com.itextpdf.test.annotations.LogMessages)

Aggregations

ExtendedITextTest (com.itextpdf.test.ExtendedITextTest)12 LogMessages (com.itextpdf.test.annotations.LogMessages)12 IntegrationTest (com.itextpdf.test.annotations.type.IntegrationTest)12 Test (org.junit.Test)12 Rectangle (com.itextpdf.kernel.geom.Rectangle)9 PdfString (com.itextpdf.kernel.pdf.PdfString)7 PdfDocument (com.itextpdf.kernel.pdf.PdfDocument)1 PdfNumber (com.itextpdf.kernel.pdf.PdfNumber)1 PdfReader (com.itextpdf.kernel.pdf.PdfReader)1 PdfStream (com.itextpdf.kernel.pdf.PdfStream)1 PdfWriter (com.itextpdf.kernel.pdf.PdfWriter)1 PdfImageXObject (com.itextpdf.kernel.pdf.xobject.PdfImageXObject)1 PdfCleanUpLocation (com.itextpdf.pdfcleanup.PdfCleanUpLocation)1 CompositeCleanupStrategy (com.itextpdf.pdfcleanup.autosweep.CompositeCleanupStrategy)1 RegexBasedCleanupStrategy (com.itextpdf.pdfcleanup.autosweep.RegexBasedCleanupStrategy)1 CleanUpImagesCompareTool (com.itextpdf.pdfcleanup.util.CleanUpImagesCompareTool)1 ArrayList (java.util.ArrayList)1