mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 16:58:01 +02:00
Add test of cairo_get_* after INVALID_RESTORE to nil-surface
This new test demonstrates a crash condition as reported here: evolution crash to _cairo_gstate_backend_to_user() https://bugs.freedesktop.org/show_bug.cgi?id=9906
This commit is contained in:
parent
712447856d
commit
36590fd470
1 changed files with 23 additions and 0 deletions
|
|
@ -30,6 +30,7 @@
|
|||
*
|
||||
* https://bugs.freedesktop.org/show_bug.cgi?id=4088
|
||||
* https://bugs.freedesktop.org/show_bug.cgi?id=3915
|
||||
* https://bugs.freedesktop.org/show_bug.cgi?id=9906
|
||||
*/
|
||||
|
||||
static cairo_test_draw_function_t draw;
|
||||
|
|
@ -113,6 +114,28 @@ draw (cairo_t *cr, int width, int height)
|
|||
cairo_surface_finish (surface);
|
||||
cairo_surface_destroy (surface);
|
||||
|
||||
/*
|
||||
* 4. OK, we're straying from the original name, but it's still a
|
||||
* similar kind of testing of error paths. Here we're making sure
|
||||
* we can still call a cairo_get_* function after triggering an
|
||||
* INVALID_RESTORE error.
|
||||
*/
|
||||
cr2 = cairo_create (cairo_get_target (cr));
|
||||
|
||||
/* Trigger invalid restore. */
|
||||
cairo_restore (cr2);
|
||||
if (cairo_status (cr2) != CAIRO_STATUS_INVALID_RESTORE) {
|
||||
cairo_test_log ("Error: Received status of \"%s\" rather than expected \"%s\"\n",
|
||||
cairo_status_to_string (cairo_status (cr2)),
|
||||
cairo_status_to_string (CAIRO_STATUS_INVALID_RESTORE));
|
||||
return CAIRO_TEST_FAILURE;
|
||||
}
|
||||
|
||||
/* Test that we can still call cairo_get_fill_rule without crashing. */
|
||||
cairo_get_fill_rule (cr2);
|
||||
|
||||
cairo_destroy (cr2);
|
||||
|
||||
return CAIRO_TEST_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue