The pattern created by cairo_pattern_create_rgb() is owned by the
caller, hence it needs to be released.
Fixes the following valgrind error:
malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
_cairo_pattern_create_solid (cairo-pattern.c:605)
_cairo_pattern_create_in_error (cairo-pattern.c:628)
cairo_pop_group (cairo.c:552)
test_cairo_push_group (api-special-cases.c:157)
preamble (api-special-cases.c:1766)
main (cairo-test-runner.c:228)
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
This adds code to the api-special-cases test which also tests the behavior of
cairo when the cairo context or the surface that is target is in an error state
or finished. These new tests call into all public entry points defined in
cairo.h which receive a cairo_t * as their first argument.
Currently this causes a new crash in the testsuite:
cairo-surface.c:394:
_cairo_surface_begin_modification: Assertion `! surface->finished' failed.
Reported-by: christophe.troestler@umons.ac.be
References: https://bugs.freedesktop.org/show_bug.cgi?id=68014
Signed-off-by: Uli Schlachter <psychon@znc.in>
The ARRAY_LENGTH macro is used by many tests, although sometimes it is
named ARRAY_SIZE. Define it just once in cairo-test.h and reuse it.
In a similar way, MAX() and MIN() are currently defined in some
specific tests, while they could be reused.
In that check, we call functions that require a specific surface type
with surfaces of a different type and check that they don't crash and
set the correct error.
In particular, it checks that finished and surfaces in an error state do
not do bad things, like cause crashes.
So far this test only checks surface APIs, but it should be extended to
cover all APIs.
Please update this test when new APIs get added.
Motivated by https://bugs.launchpad.net/ubuntu/+source/cairo/+bug/600622