[cairo-commit] 4 commits - test/pdf-mime-data.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Mar 25 15:51:15 UTC 2021


 test/pdf-mime-data.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 33cce5dc376a7138870a3c9dc56e5a92d973621c
Merge: c48ea2737 2f25fa68c
Author: Uli Schlachter <psychon at znc.in>
Date:   Thu Mar 25 15:51:13 2021 +0000

    Merge branch 'pdf-mime-data' into 'master'
    
    "Fix" the pdf-mime-data test
    
    See merge request cairo/cairo!142

commit 2f25fa68c0d59c3ed3577e0e85b745985467c6fd
Author: Uli Schlachter <psychon at znc.in>
Date:   Mon Mar 8 17:31:37 2021 +0100

    test/pdf-mime-data.c: Check for pdfimages
    
    Currently, the pdf-mime-data check just fails for me with the following
    output:
    
        sh: 1: pdfimages: not found
        pdf-mime-data: FAIL
    
    pdf-mime-data.log contains:
    
        pdfimages failed with exit status 32512
    
    Since I do not have pdfimages installed... yeah.
    
    This commit "fixes" that problem by skipping the test if pdfimages is
    not available. No idea if it would pass if it were available, but I do
    not feel like installing pdfimages just to test.
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/test/pdf-mime-data.c b/test/pdf-mime-data.c
index beefa01b3..5052f3dac 100644
--- a/test/pdf-mime-data.c
+++ b/test/pdf-mime-data.c
@@ -112,6 +112,12 @@ preamble (cairo_test_context_t *ctx)
     if (! cairo_test_is_target_enabled (ctx, "pdf"))
 	return CAIRO_TEST_UNTESTED;
 
+    exit_status = system ("command -v pdfimages");
+    if (exit_status) {
+	cairo_test_log (ctx, "pdfimages not available\n");
+	return CAIRO_TEST_UNTESTED;
+    }
+
     image = cairo_test_create_surface_from_png (ctx, IMAGE_FILE ".png");
     test_status = read_file (ctx, IMAGE_FILE ".jpg", &data, &len);
     if (test_status) {
commit 2a8d90c6fce458151f7bd3982fcaa964c4f72195
Author: Uli Schlachter <psychon at znc.in>
Date:   Mon Mar 8 17:27:52 2021 +0100

    pdf-mime-data: Fix for out-of-tree builds
    
    This makes the code use the existing helper for loading PNGs that also
    considers the $srcdir environment variable. This makes it find the file
    in out of tree builds.
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/test/pdf-mime-data.c b/test/pdf-mime-data.c
index 7033f6051..beefa01b3 100644
--- a/test/pdf-mime-data.c
+++ b/test/pdf-mime-data.c
@@ -112,7 +112,7 @@ preamble (cairo_test_context_t *ctx)
     if (! cairo_test_is_target_enabled (ctx, "pdf"))
 	return CAIRO_TEST_UNTESTED;
 
-    image = cairo_image_surface_create_from_png (IMAGE_FILE ".png");
+    image = cairo_test_create_surface_from_png (ctx, IMAGE_FILE ".png");
     test_status = read_file (ctx, IMAGE_FILE ".jpg", &data, &len);
     if (test_status) {
 	return test_status;
commit 0c64c216aaf44d476637879d998fef96f0164762
Author: Uli Schlachter <psychon at znc.in>
Date:   Mon Mar 8 17:26:50 2021 +0100

    pdf-mime-data: Fix error checking
    
    I am not quite sure, but an if for "ignore this error if something
    failed" seems wrong. Either this should have compared against status2 or
    checked for success. This commit fixes the code for the latter.
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/test/pdf-mime-data.c b/test/pdf-mime-data.c
index 69fafa145..7033f6051 100644
--- a/test/pdf-mime-data.c
+++ b/test/pdf-mime-data.c
@@ -134,7 +134,7 @@ preamble (cairo_test_context_t *ctx)
     cairo_destroy (cr);
     cairo_surface_finish (surface);
     status2 = cairo_surface_status (surface);
-    if (status != CAIRO_STATUS_SUCCESS)
+    if (status == CAIRO_STATUS_SUCCESS)
 	status = status2;
     cairo_surface_destroy (surface);
     cairo_surface_destroy (image);


More information about the cairo-commit mailing list