summaryrefslogtreecommitdiff
path: root/testing
AgeCommit message (Collapse)Author
2017-08-15Make errors in called processes more evident and easier to debug.Henrique Nakashima
Also trying to get unicode filenames right again. Change-Id: I501c94921b92b8a8cd6a10441aff1595fc6d878e Reviewed-on: https://pdfium-review.googlesource.com/10630 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-08-11Add 'testing' to a path that got missedRyan Harrison
This applies the proper configuration rules the end HTML generation. Bug: Change-Id: Ica159131e574fd805a1363db5b26a6581ecc0ac6 Reviewed-on: https://pdfium-review.googlesource.com/10810 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-08-10Add safetynet_job.py to run safetynet_compare.py periodically.chromium/3182Henrique Nakashima
safetynet.job.py verifies if there were performance changes since its last run. Its state is comprised only of the last checkpoint, and is kept in a directory passed by argument. Results of runs are written to this directory as well. Change-Id: I94e0e176b10fd1d2b18d84f82427f63be107ae17 Reviewed-on: https://pdfium-review.googlesource.com/10370 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-08-10Fixing utf-8 safetynet_conclusions problem when writing the json.Henrique Nakashima
The previous fix (encoding on print) breaks when running compare.py directly. The real problem was in writing the json. Change-Id: Ie4cf926b5c6153731c1ae187ec6a7cffa74ce67b Reviewed-on: https://pdfium-review.googlesource.com/10653 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-08-10Extracting GetBooleanGnArg from coverage_report.pyHenrique Nakashima
Change-Id: I5475b37aad69361e2e7fae4ce69faf011e3b5c40 Reviewed-on: https://pdfium-review.googlesource.com/10030 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-08-09Fixing PrintConclusionsDictHumanReadable for dicts loaded from string.Henrique Nakashima
json.loads() reads non-ascii filenames to a non-unicode string and an encode step is required before a format. Change-Id: I3145c7aa41e947f78898e73484c3cb1655418689 Reviewed-on: https://pdfium-review.googlesource.com/10410 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-08-09Move tools/coverage to testing/tools/coverageHenrique Nakashima
Change-Id: Icb1d85167a234c9862a4011dea5dfaa09299c71c Reviewed-on: https://pdfium-review.googlesource.com/10431 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-08-09API and test for retrieving image filters from image objectsJane Liu
Added FPDFImageObj_GetImageFilterCount() and FPDFImageObj_GetImageFilters() for retrieving image filters of image objects. * Added a corresponding embedder test. * Changed the filter of an image object in embedded_image.pdf from DCTDecode to ASCIIHexDecode + DCTDecode, so we have a test case for images with more than one filter. Bug=pdfium:677 Change-Id: I398790a2cad33fea4ca16a0eb0889c04caa6b962 Reviewed-on: https://pdfium-review.googlesource.com/10130 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Jane Liu <janeliulwq@google.com>
2017-08-08Move CSS code to coreDan Sinclair
The xfa/fde/css code has no other links into xfa/. This CL moves the css code to core/fxcrt/css and sets to only build when pdf_enable_xfa is enabled. Change-Id: Iefd208e1f83a28b80b567c574e841e87bce310be Reviewed-on: https://pdfium-review.googlesource.com/9251 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-08-03Add script to compare performance of two versions of pdfium.Henrique Nakashima
Run from the pdfium root: $ testing/tools/safetynet_compare.py testing This compares the current branch with and without local changes. $ testing/tools/safetynet_compare.py testing/corpus --branch-before x This compares the current branch + local changes against branch x. It runs only the corpus tests. $ testing/tools/safetynet_compare.py testing --branch-before x --branch-after y --build-dir=~/output_compare This compares branch x and branch y. x and y can be revision hashes. The callgrind.out files of cases with significant changes will be created in ~/output_compare. $ testing/tools/safetynet_compare.py -h Print all options. Change-Id: I43aaf5fe890745db611fb3bc00a656ef799fdfef Reviewed-on: https://pdfium-review.googlesource.com/7390 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-08-03Added testing flag --save-images that saves embedded imagesJane Liu
1. Added --save-images flag in pdfium_test to save embedded images using FPDFImageObj_GetBitmap() API and the bitmap-to-png conversion tool. * Added support for bitmaps of other common color spaces in the bitmap-to-png conversion tool. Bug=pdfium:677 Change-Id: Ide29f51021695af0a1afb5205355f4b78b918d35 Reviewed-on: https://pdfium-review.googlesource.com/9710 Commit-Queue: Jane Liu <janeliulwq@google.com> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-08-03APIs and tests for extracting bitmaps from image objectsJane Liu
Added FPDFImageObj_GetBitmap() that returns the bitmap of an image object, and a FPDFBitmap_GetFormat() that returns the format of a bitmap. * Fixed a small bitmap conversion bug in cfx_dibsource.cpp. * Enabled EmbedderTest::CompareBitmap() to support different formats of bitmaps. * Added an embedder test and a test PDF file with images of many different formats. Bug=pdfium:677 Change-Id: I6a72f9d969cf5f3577db9400ca33197c213622ed Reviewed-on: https://pdfium-review.googlesource.com/9690 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Jane Liu <janeliulwq@google.com>
2017-08-01Add a regression test for FPDF_ImportPages().Lei Zhang
BUG=chromium:750558 Change-Id: I0d541c660c529b368f420d461a6eb1d81e42579a Reviewed-on: https://pdfium-review.googlesource.com/9730 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-07-31Add FORM_ReplaceSelection() and embedder tests.Diana Gage
This method replaces the selected text in a user-editable form text area with another text string (which can be empty or non-empty). If there is no selected text, FORM_ReplaceSelection() will append the replacement text after the current caret position. BUG=chromium:59266 Change-Id: I76448ef757d107888c33ebd5656457ebac93b952 Reviewed-on: https://pdfium-review.googlesource.com/8812 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Diana Gage <drgage@google.com>
2017-07-26Fix FPDF_RenderPageBitmapWithMatrixNicolas Pena
This CL fixes FPDF_RenderPageBitmapWithMatrix and improves tests. Bug: pdfium:837 Change-Id: I98f90b667cc9a50fb0e915b8a758603488b44d40 Reviewed-on: https://pdfium-review.googlesource.com/9010 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-07-24Observe Annot destruction in CPDFSDK_PageView::DeleteAnnotTom Sepez
Run test XFA-Only, since that's where the issue occurs, and the textual output is different for non-xfa. Fix a few lifetime issue in pdfium_test.cc unearthed by this test (doc must outlive pages now held in formfill info). Bug: 735912 Change-Id: Icc9e6a967c32ece67d897117896c973bb16a1515 Reviewed-on: https://pdfium-review.googlesource.com/8510 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-07-21Clean up pdfium_test.ccLei Zhang
- Move several blocks out of RenderPdf(). - Add an anonymous namespace. - Check fwrite() results. - Fix nits. Change-Id: Ief0ddd5e49455d68b92d40674294dc9134adf86c Reviewed-on: https://pdfium-review.googlesource.com/8650 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Jane Liu <janeliulwq@google.com> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-07-21Clarify --build-dir help info in safetynet_measure.py.Lei Zhang
Change-Id: I35423437015ad9057ed862ab630c9a2f403a8e1f Reviewed-on: https://pdfium-review.googlesource.com/8710 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-07-21Add safetynet_measure.py to measure pdfium performance.Henrique Nakashima
This is a script that measures the performance of pdfium when loading and rendering a single pdf file. Supported profilers for now are callgrind (default) and perfstat. It will be used by the compare script, which will compare measurements this script takes. Change-Id: I9c78ec879a7f4839e60f217d5dd8ee35b1e9a051 Reviewed-on: https://pdfium-review.googlesource.com/7354 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-07-20Add FPDFAnnot_GetFormFieldFlags() and associated embedder tests.Diana Gage
Given an interactive form annotation, this method returns its annotation flags. The flags returned are dependent upon the "Ff" field, and are specific to interactive form annotations, such as FPDF_FORMFLAG_MULTILINE, FPDF_FORMFLAG_COMBO, FPDF_FORMFLAG_EDIT, and others. To test this method more thoroughly, text_form_multiple.pdf has been added, which is similar to text_form.pdf, but includes a read-only text field. BUG=chromium:59266 Change-Id: Ie66046de273f69a1be6f04a433351ebaa271f60c Reviewed-on: https://pdfium-review.googlesource.com/7851 Commit-Queue: Diana Gage <drgage@google.com> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-07-19Rename StringCs c_str() to unterminated_c_str().Tom Sepez
Since there is no guarantee of termination if the StringC was extracted from a snippet of another string. Make it more obvious that things like strlen(str.unterminated_c_str()) might be a bad idea. Change-Id: I7832248ed89ebbddf5c0bcd402aac7d40ec2adc2 Reviewed-on: https://pdfium-review.googlesource.com/8170 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-07-19Added testing flag --save-attachments that saves embedded attachmentsJane Liu
1. Added --save-attachments flag in pdfium_test to save embedded attachments using fpdf_attachment APIs. Bug=pdfium:174 Change-Id: I62f09aeb0ab1431f6e127da389518878a7214423 Reviewed-on: https://pdfium-review.googlesource.com/7990 Commit-Queue: Jane Liu <janeliulwq@google.com> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-07-18Make progressive renderer default for pdfium_test.Dan Sinclair
When Chrome renders PDF pages it uses the progressive renderer. The one shot renderer is used to render print preview pages. This CL changes pdfium_test to use the progressive renderer by default to better match Chrome. This also adds a --render-oneshot flag which will use the non-progressive renderer. Bug: chromium:736695 Change-Id: If79333ae10a0ed1c9bce1290caad8d531e6709aa Reviewed-on: https://pdfium-review.googlesource.com/8130 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-07-17More tightly validate format strings in util.cpp.chromium/3160Tom Sepez
Re-work the previous fix to be even more particular about the input. Bug: chromium:740166 Change-Id: I6bea3b6a6dd320a83f830b07afd52951be7d1b63 Reviewed-on: https://pdfium-review.googlesource.com/7691 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-07-13Add Embeddertest for password after savingchromium/3157Nicolas Pena
This CL allows TestSaved to open password-protected and linearized documents properly. It also adds a test with one such document. BUG= pdfium:787 Change-Id: Ie0da7f290711505fb208794afdc737c36e84dd3c Reviewed-on: https://pdfium-review.googlesource.com/7034 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-07-13Fix invalid write for util.printfDan Sinclair
This CL fixes and invalid WRITE triggered by calling util.printf. We need to verify that the integer format will be less then 260 characters. Bug: chromium:740166 Change-Id: I1c9047101780582da5f39088568727e2c8b4c2d2 Reviewed-on: https://pdfium-review.googlesource.com/7630 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-07-13Basic APIs and test for retrieving embedded attachment count and nameJane Liu
1. Added APIs for retrieving embedded attachment count and file name. * Added an embedder test testing them. Bug=pdfium:174 Change-Id: I181b8e0b81495d8a7fd8c3f79dbbc0f907f5e3fd Reviewed-on: https://pdfium-review.googlesource.com/7490 Commit-Queue: Jane Liu <janeliulwq@google.com> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-07-12Cleanup ICC code part 1Nicolas Pena
This CL switches void* to CLcmsCmm*, simplifies the ownership and destruction of CLcmsCmm, and reduces unnecessary function calling in fx_codec_icc.cpp. Change-Id: Ifdbf59dcdaede497d1684b161dd066726cf08ee3 Reviewed-on: https://pdfium-review.googlesource.com/7590 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-07-10Roll FreeType to c56d8851ea987023cc73981a70d261b3f6427545chromium/3156chromium/3155chromium/3154Nicolas Pena
Bug: chromium:738919 Change-Id: I2ea99a47f45e2e68650bd1fa9ad7554d8df79874 Reviewed-on: https://pdfium-review.googlesource.com/7351 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-07-10Add combo box tests.dan sinclair
These tests pass under normal PDFium bug fail when Skia Paths is enabled. Bug: chromium:736695 Change-Id: I7e3e789ae25857060dd45940c313f5383c548d2c Reviewed-on: https://pdfium-review.googlesource.com/7450 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Cary Clark <caryclark@google.com>
2017-07-05Allow EmbedderTest to test savingNicolas Pena
This CL adds helper methods for EmbedderTest to save. This means that TestSaver is no longer needed and all the methods it uses are moved to the EmbedderTest. Change-Id: I740f29699bfd8c6b570cb1fd85e7aab9bc1d3f6f Reviewed-on: https://pdfium-review.googlesource.com/7171 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-06-30Split CFDE_CSSTextBuf in two.Lei Zhang
For the external buffer use case, use a CFDE_CSSExtTextBuf instead. With the split, both text buffer implementations are simpler now. As a result, it becomes obvious where it never fails. Adjust callers accordingly. Change-Id: I7b53d36593172487b8c939e6a55af2437ea4ee5a Reviewed-on: https://pdfium-review.googlesource.com/6932 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-06-29Basic APIs and tests for extracting and setting annotation pathsJane Liu
1. Added APIs for retrieving existing annotation paths and setting annotation paths. * Added an embedder test testing all the new functions. Bug=pdfium:737 Change-Id: Ic451bcd3be488261baf2182549c4238b887b219e Reviewed-on: https://pdfium-review.googlesource.com/6676 Commit-Queue: Jane Liu <janeliulwq@google.com> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-29Cleanup call expression handling in fm2jsRyan Harrison
Remove handling of arbitrary function calls, and only allow supported function calls. Issues with the lexer being overly permissive led to large blobs of javascript being dropped into the output. Specifically driver code was assuming that anything marked as a function would just be an identifier that could be inserted into the javascript, but the lexer marks things like ()()() as a function, which would lead to the following JS being inserted as an identifier. This change is intended to be a patch for the specific issue that was being seen from the fuzzer test, and further work will be needed to make the lexer more strict. BUG=724913 TEST=Ran fuzzer test case. Ran unittests,embeddertests,corpustests. Change-Id: Ib7d9239bf6fece853bea0f4915ee4ad72d3cd290 Reviewed-on: https://pdfium-review.googlesource.com/7032 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-28Set default graphics before generating page contentsNicolas Pena
In this CL, the content generator sets some default graphics states before processing the page objects. In particular, a default ExtGState is now set before processing, and the last CTM is now stored right after parsing finishes: the only command to change matrix is ctm, and it concatenates, so inverting requires knowing the current value. Bug: pdfium:779 Change-Id: I35b1c07550ce91839fb0e20fbf717e3e80c9b9d6 Reviewed-on: https://pdfium-review.googlesource.com/7070 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-27Made existing annotation APIs to work with APchromium/3143Jane Liu
1. Modified some existing annotation APIs to take into account the effect of annotation's appearance streams. * Added an embedder test testing annotations with APs. This CL is refactored out of https://pdfium-review.googlesource.com/c/6676/. Bug=pdfium:737 Change-Id: I27d5e66dfdb90038d147cab1a26e0bf86b324982 Reviewed-on: https://pdfium-review.googlesource.com/7030 Commit-Queue: Jane Liu <janeliulwq@google.com> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-27Change terminology of image diff to differentiate from pixel tests.Henrique Nakashima
Change-Id: I957199b63f6049a586b8de2688501f5ae3449964 Reviewed-on: https://pdfium-review.googlesource.com/7038 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-06-27Fixed file matching regex in test_runner.Henrique Nakashima
It was not matching file names with characters like '-' and '&'. Also suppressed tests that are now matched by the regex and were not run. Change-Id: I70c0c8bebf4726748574a9e3ab17db64f1033a13 Reviewed-on: https://pdfium-review.googlesource.com/6835 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-27Remove pixel suppression for Line_Stroke.pdf.Henrique Nakashima
Change-Id: Ief7bd0f2d0f4edbcb7331b0e78c01b86a9dc0621 Reviewed-on: https://pdfium-review.googlesource.com/7031 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-27Fail pixel tests when they do not provide the expected image.Henrique Nakashima
Also showing stats on number of failures, successes, suppressions, etc. Change-Id: Id12faf504ea8d6b1c343d7a8b412d03dc787ca3a Reviewed-on: https://pdfium-review.googlesource.com/6834 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-26Fix the Size trailer entry in hand written PDFs.Lei Zhang
Change-Id: Ib84cc570c2ffaf9fdd49d32bc12c7e6197e130c1 Reviewed-on: https://pdfium-review.googlesource.com/6850 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-26Add presubmit check for png filesNicolas Pena
This CL adds a presubmit check for png files so that they are in the form _expected{,_mac,_win}.pdf.BLA.png and updates the corpus test repository hash. Change-Id: I5397a091b77a339eba7d370b291b7a6e61754744 Reviewed-on: https://pdfium-review.googlesource.com/6951 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-06-26Adding back the CFX_DateTime print helpers.Henrique Nakashima
Change-Id: I23fe37139ed06a7e09f6a39ea833a6a984add49e Reviewed-on: https://pdfium-review.googlesource.com/6913 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-06-23Cleaning up fx_string_testhelpers.Henrique Nakashima
This is unused except for being a pathway for indirect deps. Change-Id: I717290235ccbc59429ad24231033382958e2a086 Reviewed-on: https://pdfium-review.googlesource.com/6910 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-06-23Update corpus test hash to include Oneof testsNicolas Pena
Bug: pdfium:781 Change-Id: I51c5ed9e582376f11f75f7512f36c33720e71bac Reviewed-on: https://pdfium-review.googlesource.com/6890 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-06-22Move image_diff code into testing/image_diff/Lei Zhang
It is not actually a sample program to demonstrate how to use PDFium APIs. It is more of a test utility program. Remove header include dependency from samples/ to core/, to set a good example. Change-Id: Idd5d567c82314bcf0e4a7bec8a3210e7d57226ee Reviewed-on: https://pdfium-review.googlesource.com/6871 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-06-22Avoid regenerating appearance stream when already present.Henrique Nakashima
Since cpdfsdk_widget.cpp already generates it, we can expect that FPDF_GenerateAP will not be called. That implementation does not work with widgets with a shared field. Bug: chromium:733528 Change-Id: Ia436b4e8bc87ca86b67a02cf7301ac2328339128 Reviewed-on: https://pdfium-review.googlesource.com/6752 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-06-22Clean up includes in testing/test_support.hLei Zhang
Change-Id: Id558c36d10501ce488717045bbf00bfed32e4b92 Reviewed-on: https://pdfium-review.googlesource.com/6870 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-22Minor change to AP generation logicJane Liu
Current behavior: Our CPVT_GenerateAP::Generate*AP() functions do not get called as long as the annotation dictionary has an "AP" entry. Problem: We always need the "N" entry in AP dictionary to display an annotation. Even though the spec requires "AP" dictionary to have an "N" entry for normal mode appearance, in case of a malformed pdf with "AP" but without "N" in "AP", we won't be able to display the annotation at all. Fix: Always check if "AP" has "N" entry to decide whether AP needs to be generated. If not, then we still need to generate AP, and add to the AP dictionary under the key "N". Bug=pdfium:778 Change-Id: Icf0c6a681b3c8c22b0b67bf8d16ce6fefdc2c45b Reviewed-on: https://pdfium-review.googlesource.com/6692 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Jane Liu <janeliulwq@google.com>
2017-06-21Fixed optional content not rendered when OCGs array is empty.chromium/3138Henrique Nakashima
At least one nonnull entry needs to be in OCGs for it to be considered present. See "OCGs" in table 4.49 in the PDF 1.7 spec. Bug: pdfium:491. Change-Id: I7eae65ba1fabff9cf1d5cea50d059a04814a3fec Reviewed-on: https://pdfium-review.googlesource.com/6751 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>