summaryrefslogtreecommitdiff
path: root/test/pdf-tagged-text.c
diff options
context:
space:
mode:
authorJonathan Kew <jfkthame@gmail.com>2021-07-19 12:28:14 +0100
committerJonathan Kew <jfkthame@gmail.com>2021-07-19 12:28:14 +0100
commit20ef4ec460b9631c4b094f3ac0b6a78752c22c0b (patch)
tree15a0c0731837245cd90970ad4399525d621ac7c3 /test/pdf-tagged-text.c
parent99d5337918defcea4ef0e72c4c345cb8ec973f58 (diff)
downloadcairo-20ef4ec460b9631c4b094f3ac0b6a78752c22c0b.tar.gz
Add an example of a link within an empty clip to pdf-tagged-text testcase.
Diffstat (limited to 'test/pdf-tagged-text.c')
-rw-r--r--test/pdf-tagged-text.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/pdf-tagged-text.c b/test/pdf-tagged-text.c
index f2640704f..c64a6a461 100644
--- a/test/pdf-tagged-text.c
+++ b/test/pdf-tagged-text.c
@@ -369,6 +369,22 @@ create_document (cairo_surface_t *surface, cairo_t *cr)
CAIRO_PDF_OUTLINE_ROOT,
"Cover", "page=1",
CAIRO_PDF_OUTLINE_FLAG_BOLD);
+
+ /* Create a simple link annotation. */
+ cairo_tag_begin (cr, CAIRO_TAG_LINK, "uri='http://example.org' rect=[10 10 20 20]");
+ cairo_tag_end (cr, CAIRO_TAG_LINK);
+
+ /* Try to create a link annotation while the clip is empty;
+ * it will still be emitted.
+ */
+ cairo_save (cr);
+ cairo_new_path (cr);
+ cairo_rectangle (cr, 100, 100, 50, 0);
+ cairo_clip (cr);
+ cairo_tag_begin (cr, CAIRO_TAG_LINK, "uri='http://example.com' rect=[100 100 20 20]");
+ cairo_tag_end (cr, CAIRO_TAG_LINK);
+ cairo_restore (cr);
+
cairo_show_page (cr);
page_num = 0;
@@ -454,6 +470,10 @@ check_created_pdf(cairo_test_context_t *ctx, const char* filename)
result |= check_contains_string(ctx, contents, st.st_size, "/CreationDate (20160101123456+10'30')");
result |= check_contains_string(ctx, contents, st.st_size, "/ModDate (20160621054321Z)");
+ /* check that both the example.org and example.com links were generated */
+ result |= check_contains_string(ctx, contents, st.st_size, "http://example.org");
+ result |= check_contains_string(ctx, contents, st.st_size, "http://example.com");
+
// TODO: add more checks
munmap(contents, st.st_size);