diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-04-12 15:30:29 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-04-12 21:22:46 -0400 |
commit | 4d1075a082780dc0be80c0e69e3a825270b6a704 (patch) | |
tree | 3d50a9cd56fe5508dfe17c1f329d076f95dfede0 | |
parent | 442f485591b65185538ab941b58743cadd1d2092 (diff) | |
download | gtk+-4d1075a082780dc0be80c0e69e3a825270b6a704.tar.gz |
testsuite: Reduce the use of g_assert
Stop using g_assert() in the gsk tests.
-rw-r--r-- | testsuite/gsk/compare-render.c | 8 | ||||
-rw-r--r-- | testsuite/gsk/node-parser.c | 2 | ||||
-rw-r--r-- | testsuite/gsk/transform.c | 10 |
3 files changed, 12 insertions, 8 deletions
diff --git a/testsuite/gsk/compare-render.c b/testsuite/gsk/compare-render.c index 462953ef9f..5494c61d1e 100644 --- a/testsuite/gsk/compare-render.c +++ b/testsuite/gsk/compare-render.c @@ -104,9 +104,11 @@ save_image (cairo_surface_t *surface, const char *extension) { char *filename = get_output_file (test_name, ".node", extension); + int status; g_print ("Storing test result image at %s\n", filename); - g_assert (cairo_surface_write_to_png (surface, filename) == CAIRO_STATUS_SUCCESS); + status = cairo_surface_write_to_png (surface, filename); + g_assert_true (status == CAIRO_STATUS_SUCCESS); g_free (filename); } @@ -207,12 +209,12 @@ main (int argc, char **argv) g_bytes_unref (bytes); g_assert_no_error (error); - g_assert (node != NULL); + g_assert_nonnull (node); } /* Render the .node file and download to cairo surface */ texture = gsk_renderer_render_texture (renderer, node, NULL); - g_assert (texture != NULL); + g_assert_nonnull (texture); rendered_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, gdk_texture_get_width (texture), diff --git a/testsuite/gsk/node-parser.c b/testsuite/gsk/node-parser.c index 3c4f61b817..749039ff29 100644 --- a/testsuite/gsk/node-parser.c +++ b/testsuite/gsk/node-parser.c @@ -173,7 +173,7 @@ parse_node_file (GFile *file, gboolean generate) g_clear_error (&error); return FALSE; } - g_assert (bytes != NULL); + g_assert_nonnull (bytes); errors = g_string_new (""); diff --git a/testsuite/gsk/transform.c b/testsuite/gsk/transform.c index 9a2fa1ffe3..caf9f72b69 100644 --- a/testsuite/gsk/transform.c +++ b/testsuite/gsk/transform.c @@ -266,7 +266,7 @@ test_invert (void) transform = apply_test_transform (transform, j); transform = apply_test_transform (transform, k); inverse = gsk_transform_invert (gsk_transform_ref (transform)); - g_assert (inverse != NULL || transform == NULL); + g_assert_true (inverse != NULL || transform == NULL); identity = gsk_transform_transform (gsk_transform_ref (transform), inverse); graphene_assert_fuzzy_transform_equal (identity, NULL, EPSILON); @@ -372,6 +372,7 @@ test_print_parse (void) GskTransform *transform, *parsed; guint i, j, k; char *str1, *str2; + gboolean ret; for (i = 0; i < G_N_ELEMENTS (test_transforms); i++) { @@ -384,14 +385,15 @@ test_print_parse (void) transform = apply_test_transform (transform, k); str1 = gsk_transform_to_string (transform); - g_assert (str1); - g_assert (strlen (str1) > 0); + g_assert_nonnull (str1); + g_assert_true (strlen (str1) > 0); str2 = gsk_transform_to_string (transform); g_assert_cmpstr (str1, ==, str2); g_free (str2); - g_assert (gsk_transform_parse (str1, &parsed)); + ret = gsk_transform_parse (str1, &parsed); + g_assert_true (ret); graphene_assert_fuzzy_transform_equal (parsed, transform, EPSILON); str2 = gsk_transform_to_string (parsed); |