testsuite: Reduce use of g_assert

Stop using g_assert() in the reftests.
This commit is contained in:
Matthias Clasen 2021-04-12 08:30:56 -04:00
parent 03db2690e2
commit 90d187894d
3 changed files with 11 additions and 9 deletions

View File

@ -275,6 +275,7 @@ save_image (cairo_surface_t *surface,
{
GError *error = NULL;
char *filename;
int ret;
filename = get_output_file (test_name, extension, &error);
if (filename == NULL)
@ -285,7 +286,8 @@ save_image (cairo_surface_t *surface,
}
g_test_message ("Storing test result image at %s", filename);
g_assert (cairo_surface_write_to_png (surface, filename) == CAIRO_STATUS_SUCCESS);
ret = cairo_surface_write_to_png (surface, filename);
g_assert_true (ret == CAIRO_STATUS_SUCCESS);
g_free (filename);
}

View File

@ -34,9 +34,9 @@ get_surface_size (cairo_surface_t *surface,
cairo_clip_extents (cr, &x1, &y1, &x2, &y2);
cairo_destroy (cr);
g_assert (x1 == 0 && y1 == 0);
g_assert (x2 > 0 && y2 > 0);
g_assert ((int) x2 == x2 && (int) y2 == y2);
g_assert_true (x1 == 0 && y1 == 0);
g_assert_true (x2 > 0 && y2 > 0);
g_assert_true ((int) x2 == x2 && (int) y2 == y2);
*width = x2;
*height = y2;
@ -62,7 +62,7 @@ coerce_surface_for_comparison (cairo_surface_t *surface,
cairo_destroy (cr);
g_assert (cairo_surface_status (coerced) == CAIRO_STATUS_SUCCESS);
g_assert_true (cairo_surface_status (coerced) == CAIRO_STATUS_SUCCESS);
return coerced;
}
@ -110,7 +110,7 @@ buffer_diff_core (const guchar *buf_a,
diff = cairo_image_surface_create (CAIRO_FORMAT_RGB24,
width,
height);
g_assert (cairo_surface_status (diff) == CAIRO_STATUS_SUCCESS);
g_assert_true (cairo_surface_status (diff) == CAIRO_STATUS_SUCCESS);
buf_diff = cairo_image_surface_get_data (diff);
stride_diff = cairo_image_surface_get_stride (diff);
row = (guint32 *) (buf_diff + y * stride_diff);

View File

@ -209,7 +209,7 @@ reftest_inhibit_snapshot (void)
G_MODULE_EXPORT void
reftest_uninhibit_snapshot (void)
{
g_assert (inhibit_count > 0);
g_assert_true (inhibit_count > 0);
inhibit_count--;
}
@ -260,7 +260,7 @@ snapshot_widget (GtkWidget *widget)
GdkPaintable *paintable;
cairo_surface_t *surface;
g_assert (gtk_widget_get_realized (widget));
g_assert_true (gtk_widget_get_realized (widget));
loop = g_main_loop_new (NULL, FALSE);
@ -304,7 +304,7 @@ reftest_snapshot_ui_file (const char *ui_file)
g_assert_no_error (error);
window = builder_get_toplevel (builder);
g_object_unref (builder);
g_assert (window);
g_assert_true (window);
gtk_widget_show (window);