+2008-11-10 Emmanuele Bassi <ebassi@linux.intel.com>
+
+ * tests/conform/test-label-cache.c:
+ * tests/conform/test-pick.c:
+ * tests/conform/test-timeline.c: Show all the output messages only
+ if the test was done with the verbose flag turned on.
+
+ * tests/interactive/test-main.c: Do not use the (gpointer*) cast,
+ but use a temporary gpointer instead.
+
2008-11-10 Robert Bragg <robert@linux.intel.com>
+
* tests/conform/Makefile.am:
* tests/conform/wrapper.sh:
* tests/conform/test-conform-main.c:
* tests/conform/test-timeline.c:
- Adds Neil's updates to test-timeline.c so it now works with the new unit
- testing infrastructure.
+ Adds Neil's updates to test-timeline.c so it now works with the new
+ unit testing infrastructure.
- Also some fixes to ensure wrappers get setup correctly for the timeline
- tests.
+ Also some fixes to ensure wrappers get setup correctly for the
+ timeline tests.
* tests/interactive/test-main.c:
cast the symbol return pointer as (gpointer *) to avoid warning
PangoRectangle test_extents;
gboolean fail = FALSE;
- printf ("%s: ", note);
+ if (g_test_verbose ())
+ g_print ("%s: ", note);
/* Force a redraw to get the on_paint handler to run */
force_redraw (data);
pango_layout_get_extents (data->test_layout, NULL, &test_extents);
if (memcmp (&test_extents, &data->label_extents, sizeof (PangoRectangle)))
{
- printf ("extents are different, ");
+ if (g_test_verbose ())
+ g_print ("extents are different, ");
fail = TRUE;
}
else
- printf ("extents are the same, ");
+ {
+ if (g_test_verbose ())
+ g_print ("extents are the same, ");
+ }
if (data->layout_changed)
- printf ("layout changed, ");
+ {
+ if (g_test_verbose ())
+ g_print ("layout changed, ");
+ }
else
- printf ("layout did not change, ");
+ {
+ if (g_test_verbose ())
+ g_print ("layout did not change, ");
+ }
if (data->layout_changed != layout_should_change)
fail = TRUE;
if (fail)
{
- printf ("FAIL\n");
+ if (g_test_verbose ())
+ g_print ("FAIL\n");
+
data->test_failed = TRUE;
}
else
- printf ("pass\n");
+ {
+ if (g_test_verbose ())
+ g_print ("pass\n");
+ }
return fail;
}
gconstpointer _data)
{
CallbackData data;
- int ret = 0;
memset (&data, 0, sizeof (data));
clutter_main ();
- printf ("\nOverall result: ");
+ if (g_test_verbose ())
+ g_print ("\nOverall result: ");
- if (data.test_failed)
+ if (g_test_verbose ())
{
- printf ("FAIL\n");
- exit (1);
+ if (data.test_failed)
+ g_print ("FAIL\n");
+ else
+ g_print ("pass\n");
}
else
- printf ("pass\n");
-
- return;
+ g_assert (data.test_failed != TRUE);
}
y * state->actor_height
+ state->actor_height / 2);
- printf ("actor %u -> ", state->gids[y * ACTORS_X + x]);
+ if (g_test_verbose ())
+ g_print ("actor %u -> ", state->gids[y * ACTORS_X + x]);
if (actor == NULL)
- printf ("NULL: FAIL\n");
+ {
+ if (g_test_verbose ())
+ g_print ("NULL: FAIL\n");
+ }
else
{
gid = clutter_actor_get_gid (actor);
if (gid == state->gids[y * ACTORS_X + x])
pass = TRUE;
- printf ("% 8i: %s\n", gid, pass ? "pass" : "FAIL");
+
+ if (g_test_verbose ())
+ g_print ("% 8i: %s\n", gid, pass ? "pass" : "FAIL");
}
if (!pass)
clutter_actor_destroy (state.stage);
- g_print ("end result: %s\n", state.pass ? "pass" : "FAIL");
- g_assert (state.pass);
+ if (g_test_verbose ())
+ g_print ("end result: %s\n", state.pass ? "FAIL" : "pass");
- return;
+ g_assert (state.pass);
}
timeline_complete_cb (ClutterTimeline *timeline,
TimelineData *data)
{
- printf ("%i: Completed\n", data->timeline_num);
+ if (g_test_verbose ())
+ g_print ("%i: Completed\n", data->timeline_num);
+
data->completed_count++;
}
gint frame_no,
TimelineData *data)
{
- printf ("%i: Doing frame %d, delta = %i\n",
- data->timeline_num, frame_no,
- clutter_timeline_get_delta (timeline, NULL));
+ if (g_test_verbose ())
+ g_print ("%i: Doing frame %d, delta = %i\n",
+ data->timeline_num, frame_no,
+ clutter_timeline_get_delta (timeline, NULL));
data->frame_hit_count[frame_no]++;
}
guint frame_num,
TimelineData *data)
{
- printf ("%i: Marker `%s' (%d) reached, delta = %i\n",
- data->timeline_num, marker_name, frame_num,
- clutter_timeline_get_delta (timeline, NULL));
+ if (g_test_verbose ())
+ g_print ("%i: Marker `%s' (%d) reached, delta = %i\n",
+ data->timeline_num, marker_name, frame_num,
+ clutter_timeline_get_delta (timeline, NULL));
data->markers_hit = g_slist_prepend (data->markers_hit,
g_strdup (marker_name));
}
marker_reached_count[i]++;
else
{
- printf ("FAIL: unknown marker '%s' hit for %i\n",
- (char *) node->data, data->timeline_num);
+ if (g_test_verbose ())
+ g_print ("FAIL: unknown marker '%s' hit for %i\n",
+ (char *) node->data, data->timeline_num);
succeeded = FALSE;
}
}
for (i = 0; i < n_markers; i++)
if (marker_reached_count[i] != 1)
{
- printf ("FAIL: marker '%s' hit %i times for %i\n",
- markers[i], marker_reached_count[i], data->timeline_num);
+ if (g_test_verbose ())
+ g_print ("FAIL: marker '%s' hit %i times for %i\n",
+ markers[i], marker_reached_count[i], data->timeline_num);
succeeded = FALSE;
}
if (missed_frame_count)
{
- printf ("FAIL: missed %i frame%s for %i\n",
- missed_frame_count, missed_frame_count == 1 ? "" : "s",
- data->timeline_num);
+ if (g_test_verbose ())
+ g_print ("FAIL: missed %i frame%s for %i\n",
+ missed_frame_count, missed_frame_count == 1 ? "" : "s",
+ data->timeline_num);
succeeded = FALSE;
}
}
if (data->completed_count != 1)
{
- printf ("FAIL: timeline %i completed %i times\n",
- data->timeline_num, data->completed_count);
+ if (g_test_verbose ())
+ g_print ("FAIL: timeline %i completed %i times\n",
+ data->timeline_num, data->completed_count);
succeeded = FALSE;
}
"completed", G_CALLBACK (timeline_complete_cb),
&data_3);
- printf ("Without delay...\n");
+ if (g_test_verbose ())
+ g_print ("Without delay...\n");
clutter_timeline_start (timeline_1);
clutter_timeline_start (timeline_2);
if (!check_timeline (timeline_3, &data_3, TRUE))
pass = FALSE;
- printf ("With delay...\n");
+ if (g_test_verbose ())
+ g_print ("With delay...\n");
timeline_data_destroy (&data_1);
timeline_data_init (&data_1, 1);
timeline_data_destroy (&data_2);
timeline_data_destroy (&data_3);
- g_printf ("Overall result: %s\n", pass == TRUE ? "PASS" : "FAIL");
+ if (g_test_verbose ())
+ g_print ("Overall result: %s\n", pass == TRUE ? "PASS" : "FAIL");
+
g_assert (pass == TRUE);
}
GModule *module;
char *unit_test;
char *main_symbol_name;
+ gpointer func;
int (*unit_test_main) (int argc, char **argv);
int ret;
if (argc != 2)
- g_error ("Usage: %s unit_test");
+ g_error ("Usage: %s unit_test", argv[0]);
module = g_module_open (NULL, 0);
if (!module)
main_symbol_name = g_strdup_printf ("%s_main", unit_test);
main_symbol_name = g_strdelimit (main_symbol_name, "-", '_');
- if (!g_module_symbol (module, main_symbol_name, (gpointer *)&unit_test_main))
+ if (!g_module_symbol (module, main_symbol_name, &func))
g_error ("Failed to look up main symbol for the test: %s", unit_test);
+ unit_test_main = func;
ret = unit_test_main (argc - 1, argv + 1);
g_free (unit_test);