examples: don't put code with side-effects into g_assert()
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Sat, 16 Apr 2011 16:57:32 +0000 (17:57 +0100)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Sat, 16 Apr 2011 16:57:32 +0000 (17:57 +0100)
Otherwise things won't work too well when compiling with
-DG_DISABLE_ASSERT (as we do for pre-releases and releases).

tests/examples/level/level-example.c

index aa8b416..a85d751 100644 (file)
@@ -102,9 +102,12 @@ main (int argc, char *argv[])
 
   gst_bin_add_many (GST_BIN (pipeline), audiotestsrc, audioconvert, level,
       fakesink, NULL);
-  g_assert (gst_element_link (audiotestsrc, audioconvert));
-  g_assert (gst_element_link_filtered (audioconvert, level, caps));
-  g_assert (gst_element_link (level, fakesink));
+  if (!gst_element_link (audiotestsrc, audioconvert))
+    g_error ("Failed to link audiotestsrc and audioconvert");
+  if (!gst_element_link_filtered (audioconvert, level, caps))
+    g_error ("Failed to link audioconvert and level");
+  if (!gst_element_link (level, fakesink))
+    g_error ("Failed to link level and fakesink");
 
   /* make sure we'll get messages */
   g_object_set (G_OBJECT (level), "message", TRUE, NULL);