[gtk/wip/baedert/nodeeditor: 8/16] testsuite: Don't pretend we're a GTest



commit a02c8ac3a974516a1f2432df85b1afa6376307ee
Author: Benjamin Otte <otte redhat com>
Date:   Tue Mar 19 03:57:04 2019 +0100

    testsuite: Don't pretend we're a GTest
    
    This is a meson test, not a GTest thing. So:
    
    - Use g_print(), not g_test_message
    That makes meson test --verbose print the actual log messsages.
    
    - Don't g_assert() all the time
    Instead, run tests through to the end and just return a non-0 exit
    status.

 testsuite/gsk/compare-render.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/testsuite/gsk/compare-render.c b/testsuite/gsk/compare-render.c
index 5081daac23..642252fdd7 100644
--- a/testsuite/gsk/compare-render.c
+++ b/testsuite/gsk/compare-render.c
@@ -49,7 +49,7 @@ save_image (cairo_surface_t *surface,
 {
   char *filename = get_output_file (test_name, ".node", extension);
 
-  g_test_message ("Storing test result image at %s", filename);
+  g_print ("Storing test result image at %s\n", filename);
   g_assert (cairo_surface_write_to_png (surface, filename) == CAIRO_STATUS_SUCCESS);
   g_free (filename);
 }
@@ -82,8 +82,8 @@ main (int argc, char **argv)
   window = gdk_surface_new_toplevel (gdk_display_get_default(), 10 , 10);
   renderer = gsk_renderer_new_for_surface (window);
 
-  g_test_message ("Node file: '%s'\n", node_file);
-  g_test_message ("PNG file: '%s'\n", png_file);
+  g_print ("Node file: '%s'\n", node_file);
+  g_print ("PNG file: '%s'\n", png_file);
 
   /* Load the render node from the given .node file */
   {
@@ -94,7 +94,7 @@ main (int argc, char **argv)
 
     if (!g_file_get_contents (node_file, &contents, &len, &error))
       {
-        g_test_message ("Could not open node file: %s\n", error->message);
+        g_print ("Could not open node file: %s\n", error->message);
         g_clear_error (&error);
         g_test_fail ();
         return -1;
@@ -132,7 +132,5 @@ main (int argc, char **argv)
   if (diff_surface)
     save_image (diff_surface, node_file, ".diff.png");
 
-  g_assert (diff_surface == NULL);
-
-  return 0;
+  return diff_surface == NULL ? 0 : 1;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]