diff options
author | Robin Watts <robin.watts@artifex.com> | 2012-06-13 19:02:12 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2012-06-14 19:15:53 +0100 |
commit | 836d6a62162e51e7d7925773064c30ef500ded94 (patch) | |
tree | 87fc5e7d94b9ec1ba9538523f1f6c16c3cfa9707 /pdf/pdf_annot.c | |
parent | f5d721764811484be4e98d7cddc5b83ae72e6277 (diff) | |
download | mupdf-836d6a62162e51e7d7925773064c30ef500ded94.tar.xz |
Add -j flag to mudraw; create simple mujstest scripts automatically.
We add a new fz_bound_annots function (and associated pdf_bound_annots
function) that calls a given callback with the page rectangle of the
annotations on a given page. This is marked as being a 'temporary'
function, so we can remove it/change it in future if required. It
seems likely that we'll want to have some sort of 'iterate over
annotations' function eventually, and this does the job for now.
Add a -j flag to mudraw that outputs a simple mujstest script.
For each page with annotations, the script jumps to that page, then
for each annotation on the page, it sets some text to be entered,
and clicks the annotation. In the case of text fields, this will cause
the text to be entered into that text field; in the case of buttons
it will execute the button.
At the end of each page with annotations, the script is told to
snapshot the page.
These test scripts are not designed to be full tests, but they do
at least provide an easy way for us to generate scripts where
every field in our test suite is interacted with.
Diffstat (limited to 'pdf/pdf_annot.c')
-rw-r--r-- | pdf/pdf_annot.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/pdf/pdf_annot.c b/pdf/pdf_annot.c index a3dde9a3..ea4fa2c4 100644 --- a/pdf/pdf_annot.c +++ b/pdf/pdf_annot.c @@ -431,3 +431,19 @@ pdf_load_annots(pdf_document *xref, pdf_obj *annots, fz_matrix page_ctm) return head; } + +void +pdf_bound_annots(pdf_document *doc, pdf_page *page, void (*callback)(void *arg, fz_rect *), void *arg) +{ + pdf_annot *a; + + if (!doc || !page || !callback) + return; + + a = page->annots; + while (a) + { + callback(arg, &a->pagerect); + a = a->next; + } +} |