[cairo-commit] 3 commits - test/pdf-features.c test/pdf-tagged-text.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jul 20 11:14:11 UTC 2021


 test/pdf-features.c    |    3 ++-
 test/pdf-tagged-text.c |   20 ++++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)

New commits:
commit 7c803ceb19cad0759c42d63f1b60103ae9432102
Merge: 99d533791 84192695f
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Tue Jul 20 11:14:09 2021 +0000

    Merge branch 'recording-surface-tags' into 'master'
    
    Add an extra PDF link test to pdf-tagged-text testcase
    
    See merge request cairo/cairo!194

commit 84192695f8758bc35b0ee6b2f675dd201b5bd99b
Author: Jonathan Kew <jfkthame at gmail.com>
Date:   Mon Jul 19 12:30:17 2021 +0100

    Fix use-after-free in pdf-features testcase.

diff --git a/test/pdf-features.c b/test/pdf-features.c
index b9c2bd07a..b304cc2dc 100644
--- a/test/pdf-features.c
+++ b/test/pdf-features.c
@@ -128,15 +128,16 @@ preamble (cairo_test_context_t *ctx)
 
     cairo_destroy (cr);
     cairo_surface_destroy (surface);
-    free (filename);
 
     if (status) {
 	cairo_test_log (ctx, "Failed to create pdf surface for file %s: %s\n",
 			filename, cairo_status_to_string (status));
+	free (filename);
 	return CAIRO_TEST_FAILURE;
     }
 
     printf ("pdf-features: Please check %s to ensure it looks/prints correctly.\n", filename);
+    free (filename);
     return CAIRO_TEST_SUCCESS;
 }
 
commit 20ef4ec460b9631c4b094f3ac0b6a78752c22c0b
Author: Jonathan Kew <jfkthame at gmail.com>
Date:   Mon Jul 19 12:28:14 2021 +0100

    Add an example of a link within an empty clip to pdf-tagged-text testcase.

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);


More information about the cairo-commit mailing list