Commit 4645ecf3 authored by Mathieu Duponchelle's avatar Mathieu Duponchelle 🐸 Committed by Tim-Philipp Müller
Browse files

record tests: fix when builddir != srcdir

When builddir != srcdir, cairo_test_create_pattern_from_png
needs a non-NULL ctx to work with.
parent aee96d17
......@@ -1662,6 +1662,14 @@ cairo_test_get_context (cairo_t *cr)
return cairo_get_user_data (cr, &_cairo_test_context_key);
}
cairo_t *
cairo_test_create (cairo_surface_t *surface, cairo_test_context_t *ctx)
{
cairo_t *cr = cairo_create(surface);
cairo_set_user_data(cr, &_cairo_test_context_key, ctx, NULL);
return cr;
}
cairo_surface_t *
cairo_test_create_surface_from_png (const cairo_test_context_t *ctx,
const char *filename)
......
......@@ -317,6 +317,9 @@ cairo_test_get_reference_image (cairo_test_context_t *ctx,
cairo_bool_t
cairo_test_mkdir (const char *path);
cairo_t *
cairo_test_create (cairo_surface_t *surface, cairo_test_context_t *ctx);
CAIRO_END_DECLS
#endif
......@@ -346,7 +346,7 @@ record_create (cairo_t *target)
cairo_t *cr;
surface = cairo_recording_surface_create (cairo_surface_get_content (cairo_get_target (target)), NULL);
cr = cairo_create (surface);
cr = cairo_test_create (surface, cairo_test_get_context (target));
cairo_surface_destroy (surface);
return cr;
......
......@@ -339,7 +339,7 @@ record_create (cairo_t *target)
cairo_t *cr;
surface = cairo_recording_surface_create (cairo_surface_get_content (cairo_get_target (target)), NULL);
cr = cairo_create (surface);
cr = cairo_test_create (surface, cairo_test_get_context (target));
cairo_surface_destroy (surface);
return cr;
......
......@@ -335,7 +335,7 @@ record_create (cairo_t *target)
cairo_t *cr;
surface = cairo_recording_surface_create (cairo_surface_get_content (cairo_get_target (target)), NULL);
cr = cairo_create (surface);
cr = cairo_test_create (surface, cairo_test_get_context (target));
cairo_surface_destroy (surface);
return cr;
......
......@@ -335,7 +335,7 @@ record_create (cairo_t *target)
cairo_t *cr;
surface = cairo_recording_surface_create (cairo_surface_get_content (cairo_get_target (target)), NULL);
cr = cairo_create (surface);
cr = cairo_test_create (surface, cairo_test_get_context (target));
cairo_surface_destroy (surface);
return cr;
......
......@@ -333,7 +333,7 @@ record_create (cairo_t *target)
cairo_t *cr;
surface = cairo_recording_surface_create (cairo_surface_get_content (cairo_get_target (target)), NULL);
cr = cairo_create (surface);
cr = cairo_test_create (surface, cairo_test_get_context (target));
cairo_surface_destroy (surface);
return cr;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment