summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfannot_embeddertest.cpp
AgeCommit message (Collapse)Author
2017-10-05Roll FT to ae7dc1f62d826083d418e86cce3f66a76dff038aNicolas Pena
List of changes: https://chromium.googlesource.com/chromium/src/third_party/freetype2.git/+log/7e50824288fa..ae7dc1f62d82 Bug: chromium:754574 pdfium:905 Change-Id: Ic7525eb5a4d5fab19bdc2ec7e625e0fc889c52a2 Reviewed-on: https://pdfium-review.googlesource.com/15370 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-09-27Cleanup FX macrosDan Sinclair
This CL renames the FX_OS defines to have _OS_ in their names and drops the _DESKTOP suffix. The FXM defines have been changed to just FX. Change-Id: Iab172fba541713b5f6d14fb8098baf68e3364c74 Reviewed-on: https://pdfium-review.googlesource.com/14833 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-08-31Change APIs to use FPDF_BYTESTRING for keys.Lei Zhang
Change-Id: I865a9eeb197ea2c1f5480cae32d975909495676d Reviewed-on: https://pdfium-review.googlesource.com/12551 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-08-28Added FPDFAnnot_GetAnnotIndex()Jane Liu
Added FPDFAnnot_GetAnnotIndex() to get the index of an annotation. This is useful if linked annotations are renedered together - then we need to know which ones in the annotation list we need to skip. Bug=pdfium:863,pdfium:737 Change-Id: I53482a15e0fd9a896b348b64d68e99f9c21da9f9 Reviewed-on: https://pdfium-review.googlesource.com/11970 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-22Added FPDFAnnot_GetLinkedAnnot()Jane Liu
Added FPDFAnnot_GetLinkedAnnot() to retrieve annotations linked to other annotations through a specified key. Bug=pdfium:863,pdfium:737 Change-Id: If81f41178fb4c40f6561bd392215c709722c4000 Reviewed-on: https://pdfium-review.googlesource.com/11491 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Jane Liu <janeliulwq@google.com>
2017-08-16Fixed the return values of FPDFAnnot_Get{Rect|AttachmentPoints}Jane Liu
Currently, FPDFAnnot_Get{Rect|AttachmentPoints} would return BBox if the annotation's appearance stream is defined, which does not make much sense to the user since BBox is defined in the form space; upon rendering, the annotation's position in the device space is solely defined by its rectangle. This CL removes references to BBox in FPDFAnnot_Get{Rect| AttachmentPoints}; instead, they will only return rectangle or quadpoints as requested. The embedder test is also modified to reflect this change, and also to demonstrate that an annotation's position is changed only if its rectangle is changed. Bug=pdfium:861 Change-Id: I489876511aa5d93131dd695170d46bbc49d16574 Reviewed-on: https://pdfium-review.googlesource.com/11050 Commit-Queue: Jane Liu <janeliulwq@google.com> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-08-16Changed the return type of FPDFAnnot_Get{Rect|AttachmentPoints}()Jane Liu
Instead of returning structs, changed FPDFAnnot_GetRect() and FPDFAnnot_GetAttachmentPoints() to return a bool and take a struct as an out parameter. Change-Id: I380e76eb1566b2488150fb31e9dad564a3ee10d4 Reviewed-on: https://pdfium-review.googlesource.com/10470 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Jane Liu <janeliulwq@google.com>
2017-08-09Unify of saving documents.chromium/3181Artem Strygin
In the original code the method of writing of objects depends on a much unpredictable factors: as: 1) Is there an updated version of the at least one object in the document. 2) The password is changed. 3) Was this object loaded earlier. 4) The Object is compressed and document have a password. With these factors it is difficult to predict what will be the final file. To reduce volatility use only one method that works in all cases mentioned. This method is parse then serialize. Change-Id: I3d7dcadd10abffbad68d1f993f2dd60b039ed989 Reviewed-on: https://pdfium-review.googlesource.com/9572 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-07-20Add FPDFAnnot_GetFormFieldAtPoint() and embedder tests.Diana Gage
Given a point on a page, this method returns the interactive form annotation whose rectangle contains that point. If there is no such annotation, nullptr is returned. FPDFPage_CloseAnnot() must be called after the annotation this method returns is no longer needed. The tests for this method use the returned annotation to check its interactive form annotation flags via FPDFAnnot_GetFormFieldFlags(). BUG=chromium:59266 Change-Id: I8728792bea5367c172e08fdb6bae83eafb70eb68 Reviewed-on: https://pdfium-review.googlesource.com/7970 Commit-Queue: Diana Gage <drgage@google.com> Reviewed-by: Lei Zhang <thestig@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-11Added API for removing objects from annotationsJane Liu
Bug=pdfium:737 Change-Id: Ia485219b9288b9fe7e1ae226035b37dde2bc3abd Reviewed-on: https://pdfium-review.googlesource.com/7213 Commit-Queue: Jane Liu <janeliulwq@google.com> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@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-06Added APIs for getting/setting string pairs in annotation dictionariesJane Liu
1. Added APIs for getting/setting arbitary key + value string pairs in annotation dictionaries. * Added an embedder test testing all the new functions. Bug=pdfium:737 Change-Id: I93c9ca6fccf787028e106607ef8cf549ebca95d8 Reviewed-on: https://pdfium-review.googlesource.com/7150 Commit-Queue: Jane Liu <janeliulwq@google.com> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-07-06Generalized annotation APIs to support image and text objectsJane Liu
Generalized the following annotation APIs to support working with image and text objects: FPDFAnnot_AppendPathObject() -> FPDFAnnot_AppendObject() FPDFAnnot_UpdatePathObject() -> FPDFAnnot_UpdateObject() FPDFAnnot_GetPathObjectCount() -> FPDFAnnot_GetObjectCount() FPDFAnnot_GetPathObject() -> FPDFAnnot_GetObject() Also added two embeddertests to test appending, retrieving, editting, and updating image and text objects in annotations. Bug=pdfium:737 Change-Id: If3ea5846d5abec7dc195291bb1a0ef4b17f0d604 Reviewed-on: https://pdfium-review.googlesource.com/7210 Commit-Queue: Jane Liu <janeliulwq@google.com> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-07-06Added APIs for setting annotation flag valuesJane Liu
1. Added APIs for getting/setting/unsetting annotation flag values in annotation dictionaries. * Added an embedder test testing all the new functions. Bug=pdfium:737 Change-Id: Ib6bbcf05d6e93c43ec4dcd7120db71bc244afdbf Reviewed-on: https://pdfium-review.googlesource.com/7154 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
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-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-29Added FPDFAnnot_RemoveAnnot()Jane Liu
Added an API for removing annotation and an embedder test for it. Bug=pdfium:737 Change-Id: I6f01625e8103078b83967a57a5c1a7a26bc0c70a Reviewed-on: https://pdfium-review.googlesource.com/7039 Commit-Queue: Jane Liu <janeliulwq@google.com> Reviewed-by: Lei Zhang <thestig@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-27Changed the return type for annotation APIsJane Liu
Before: When returning FPDF_ANNOTATION, the APIs would take in a FPDF_ANNTOATION* and write the handle of the annotation to it, while returning a boolean as status. This CL: This CL changes the APIs to directly return FPDF_ANNOTATION, which would be null on failure. Also adds more null checks within the annotation APIs. Bug=pdfium:737 Change-Id: I4f77dd1b16d43eab3f16c303598b76591da0dcab Reviewed-on: https://pdfium-review.googlesource.com/6952 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Jane Liu <janeliulwq@google.com>
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-20Wrapper class for annotation dictionary + CPDF_Formchromium/3137Jane Liu
Simple wrapper class for annotation + its path parsing form object. This will be used in APIs for extracting and setting annotation paths. Bug=pdfium:737 Change-Id: I2e8131672d087613213735295c6d01e377b956e7 Reviewed-on: https://pdfium-review.googlesource.com/6730 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-06-14Reenabled a flaky testchromium/3131Jane Liu
Reenabling since can't reproduce failure any more. Bug=pdfium:747 Change-Id: I347a994e0a6b389d39162075f7d5d94ae0048984 Reviewed-on: https://pdfium-review.googlesource.com/6590 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-09Disable a new flaky testJane Liu
Bug=pdfium:747 Change-Id: I51656750e5e5e7f7cecefc5244a66333a0213f19 Reviewed-on: https://pdfium-review.googlesource.com/6433 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Jane Liu <janeliulwq@google.com>
2017-06-07Fixing FPDFPage_TransformAnnotsJane Liu
Came across this error in FPDFPage_TransformAnnots, where SetNewAt() would fail on a bound assertion when a newly created array calls it. This CL contains a fix in the function and adds an embedder test for this. Bug=pdfium:745 Change-Id: I569f225598d956d270ef8f11ee3225acf48aadc7 Reviewed-on: https://pdfium-review.googlesource.com/6353 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Jane Liu <janeliulwq@google.com>
2017-06-07Basic APIs and tests for creating annotationsJane Liu
1. Added API for adding annotations and modifying common annotation properties * Added three embedder tests covering all of the API functions. Bug=pdfium:737 Change-Id: I369d9e17f589f896f9e8c672382f082e524ae534 Reviewed-on: https://pdfium-review.googlesource.com/6351 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-01Basic APIs and tests for extracting annotationsJane Liu
1. Added API for extracting annotation properties: * Added testing flag "--annot" that outputs the annotation properties into a .txt file. * Added two embedder tests covering all the API functions. Bug=pdfium:737 Change-Id: I95943a9b2b3d5d431bc8a74a31b27b4f4b521026 Reviewed-on: https://pdfium-review.googlesource.com/6092 Commit-Queue: Jane Liu <janeliulwq@google.com> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>