diff --git a/test/cairo-test.c b/test/cairo-test.c index b1f019167..0c6d82396 100644 --- a/test/cairo-test.c +++ b/test/cairo-test.c @@ -151,6 +151,37 @@ cairo_test_log (const char *fmt, ...) va_end (va); } +void +cairo_test_log_path (const cairo_path_t *path) +{ + int i; + + for (i = 0; i < path->num_data; i += path->data[i].header.length) { + cairo_path_data_t *data = &path->data[i]; + switch (data->header.type) { + case CAIRO_PATH_MOVE_TO: + cairo_test_log (" cairo_move_to (cr, %g, %g);\n", + data[1].point.x, data[1].point.y); + break; + case CAIRO_PATH_LINE_TO: + cairo_test_log (" cairo_line_to (cr, %g, %g);\n", + data[1].point.x, data[1].point.y); + break; + case CAIRO_PATH_CURVE_TO: + cairo_test_log (" cairo_curve_to (cr, %g, %g, %g, %g, %g, %g);\n", + data[1].point.x, data[1].point.y, + data[2].point.x, data[2].point.y, + data[3].point.x, data[3].point.y); + break; + case CAIRO_PATH_CLOSE_PATH: + cairo_test_log (" cairo_close_path (cr);\n\n"); + break; + default: + assert (0); + } + } +} + static void xunlink (const char *pathname) { diff --git a/test/cairo-test.h b/test/cairo-test.h index 6b6b373be..381fd4c8d 100644 --- a/test/cairo-test.h +++ b/test/cairo-test.h @@ -120,6 +120,9 @@ cairo_test_fini (void); void cairo_test_log (const char *fmt, ...) CAIRO_BOILERPLATE_PRINTF_FORMAT(1, 2); +void +cairo_test_log_path (const cairo_path_t *path); + /* Helper functions that take care of finding source images even when * building in a non-srcdir manner, (ie. the tests will be run in a * directory that is different from the one where the source image