[cairo-commit] 2 commits - test/cairo-test.c test/partial-coverage.c test/show-glyphs-advance.c test/subsurface.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 6 13:41:32 UTC 2021


 test/cairo-test.c          |   20 ++++++++++----------
 test/partial-coverage.c    |    6 +++---
 test/show-glyphs-advance.c |    2 +-
 test/subsurface.c          |    4 ++--
 4 files changed, 16 insertions(+), 16 deletions(-)

New commits:
commit 414d0aee10d3917a10ae646deef46624fe26cf47
Merge: b80d26a06 a9ea73ae0
Author: Uli Schlachter <psychon at znc.in>
Date:   Wed Jan 6 13:41:30 2021 +0000

    Merge branch 'fix-compiler-warnings-in-test-suite' into 'master'
    
    Fix compiler warnings in test suite
    
    See merge request cairo/cairo!98

commit a9ea73ae0ccbac354b34673be214b6e581700c22
Author: Sven Neumann <sven at svenfoo.org>
Date:   Mon Jan 4 14:06:21 2021 +0100

    Fix compiler warnings in test suite
    
    Fix some enum mixups, mostly cairo_status_t vs cairo_test_status_t.

diff --git a/test/cairo-test.c b/test/cairo-test.c
index 230579f6e..b5650ffce 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -628,7 +628,7 @@ cairo_test_for_target (cairo_test_context_t		 *ctx,
 		       int				  dev_scale,
 		       cairo_bool_t                       similar)
 {
-    cairo_test_status_t status;
+    cairo_status_t finish_status;
     cairo_surface_t *surface = NULL;
     cairo_t *cr;
     const char *empty_str = "";
@@ -644,7 +644,7 @@ cairo_test_for_target (cairo_test_context_t		 *ctx,
     char *base_xfail_png_path;
     char *diff_png_path;
     char *test_filename = NULL, *pass_filename = NULL, *fail_filename = NULL;
-    cairo_test_status_t ret;
+    cairo_test_status_t ret, test_status;
     cairo_content_t expected_content;
     cairo_font_options_t *font_options;
     const char *format;
@@ -930,7 +930,7 @@ REPEAT:
 
     cairo_save (cr);
     alarm (ctx->timeout);
-    status = (ctx->test->draw) (cr, ctx->test->width, ctx->test->height);
+    test_status = (ctx->test->draw) (cr, ctx->test->width, ctx->test->height);
     alarm (0);
     cairo_restore (cr);
 
@@ -946,7 +946,7 @@ REPEAT:
     /* repeat test after malloc failure injection */
     if (ctx->malloc_failure &&
 	MEMFAULT_COUNT_FAULTS () - last_fault_count > 0 &&
-	(status == CAIRO_TEST_NO_MEMORY ||
+	(test_status == CAIRO_TEST_NO_MEMORY ||
 	 cairo_status (cr) == CAIRO_STATUS_NO_MEMORY ||
 	 cairo_surface_status (surface) == CAIRO_STATUS_NO_MEMORY))
     {
@@ -968,9 +968,9 @@ REPEAT:
 #endif
 
     /* Then, check all the different ways it could fail. */
-    if (status) {
+    if (test_status) {
 	cairo_test_log (ctx, "Error: Function under test failed\n");
-	ret = status;
+	ret = test_status;
 	goto UNWIND_CAIRO;
     }
 
@@ -995,7 +995,7 @@ REPEAT:
 
 	/* also check for infinite loops whilst replaying */
 	alarm (ctx->timeout);
-	status = target->finish_surface (surface);
+	finish_status = target->finish_surface (surface);
 	alarm (0);
 
 #if HAVE_MEMFAULT
@@ -1003,7 +1003,7 @@ REPEAT:
 
 	if (ctx->malloc_failure &&
 	    MEMFAULT_COUNT_FAULTS () - last_fault_count > 0 &&
-	    status == CAIRO_STATUS_NO_MEMORY)
+	    finish_status == CAIRO_STATUS_NO_MEMORY)
 	{
 	    cairo_destroy (cr);
 	    cairo_surface_destroy (surface);
@@ -1021,9 +1021,9 @@ REPEAT:
 	    goto REPEAT;
 	}
 #endif
-	if (status) {
+	if (finish_status) {
 	    cairo_test_log (ctx, "Error: Failed to finish surface: %s\n",
-			    cairo_status_to_string (status));
+			    cairo_status_to_string (finish_status));
 	    ret = CAIRO_TEST_FAILURE;
 	    goto UNWIND_CAIRO;
 	}
diff --git a/test/partial-coverage.c b/test/partial-coverage.c
index 7e67a5e16..3e64d0e12 100644
--- a/test/partial-coverage.c
+++ b/test/partial-coverage.c
@@ -101,7 +101,7 @@ reference (cairo_t *cr, int width, int height)
 	cairo_fill (cr);
     }
 
-    return CAIRO_STATUS_SUCCESS;
+    return CAIRO_TEST_SUCCESS;
 }
 
 static cairo_test_status_t
@@ -119,7 +119,7 @@ three_quarter_reference (cairo_t *cr, int width, int height)
 	cairo_fill (cr);
     }
 
-    return CAIRO_STATUS_SUCCESS;
+    return CAIRO_TEST_SUCCESS;
 }
 
 static cairo_test_status_t
@@ -137,7 +137,7 @@ half_reference (cairo_t *cr, int width, int height)
 	cairo_fill (cr);
     }
 
-    return CAIRO_STATUS_SUCCESS;
+    return CAIRO_TEST_SUCCESS;
 }
 
 static cairo_test_status_t
diff --git a/test/show-glyphs-advance.c b/test/show-glyphs-advance.c
index 5fe9ec839..e5abc56c7 100644
--- a/test/show-glyphs-advance.c
+++ b/test/show-glyphs-advance.c
@@ -68,7 +68,7 @@ draw (cairo_t *cr, int width, int height)
     cairo_scaled_font_t *scaled_font;
     cairo_glyph_t *glyphs = xmalloc (NUM_CHARS  * sizeof (cairo_glyph_t));
     int i;
-    cairo_status_t status;
+    cairo_test_status_t status;
 
     /* Paint white background. */
     cairo_set_source_rgb (cr, 1, 1, 1);
diff --git a/test/subsurface.c b/test/subsurface.c
index 812776c0a..9af2ca06a 100644
--- a/test/subsurface.c
+++ b/test/subsurface.c
@@ -48,8 +48,8 @@ draw (cairo_t *cr, int width, int height)
 	cairo_surface_destroy (region[i]);
 
 	cairo_select_font_face (cr_region, "@cairo:",
-				CAIRO_FONT_WEIGHT_NORMAL,
-				CAIRO_FONT_SLANT_NORMAL);
+				CAIRO_FONT_SLANT_NORMAL,
+                                CAIRO_FONT_WEIGHT_NORMAL);
 	cairo_set_font_size (cr_region, 20);
 	cairo_text_extents (cr_region, buf, &extents);
 	cairo_move_to (cr_region,


More information about the cairo-commit mailing list