From 1d7e2233130b3041cc204fed326087c3a2bc9867 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Fri, 28 Jan 2011 18:11:38 +0000 Subject: [PATCH] test-path: Fix the test when running against latest Cairo versions Cairo has recently changed so that it no longer adds a final move-to command when the path ends with a close. This patch makes the test check the run-time version number of Cairo to avoid duplicating this behaviour when testing the conversion to and from a Cairo path. --- tests/conform/test-path.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/conform/test-path.c b/tests/conform/test-path.c index 30a4d2c4a..b2de235a0 100644 --- a/tests/conform/test-path.c +++ b/tests/conform/test-path.c @@ -466,12 +466,18 @@ path_test_convert_to_cairo_path (CallbackData *data) last_point = path_start; /* Cairo always adds a move to after every close so we need - to insert one here */ - memmove (data->nodes + i + 2, data->nodes + i + 1, - (data->n_nodes - i - 1) * sizeof (ClutterPathNode)); - data->nodes[i + 1].type = CLUTTER_PATH_MOVE_TO; - data->nodes[i + 1].points[0] = last_point; - data->n_nodes++; + to insert one here. Since Cairo commit 166453c1abf2 it + doesn't seem to do this anymore so will assume that if + Cairo's minor version is >= 11 then it includes that + commit */ + if (cairo_version () < CAIRO_VERSION_ENCODE (1, 11, 0)) + { + memmove (data->nodes + i + 2, data->nodes + i + 1, + (data->n_nodes - i - 1) * sizeof (ClutterPathNode)); + data->nodes[i + 1].type = CLUTTER_PATH_MOVE_TO; + data->nodes[i + 1].points[0] = last_point; + data->n_nodes++; + } break; } }