As Behdad suggested, we can dramatically speed up the test suite by
short-circuiting the write to a png file, only to then immediately read it
back in. So for the raster based surfaces, we avoid the round-trip through
libpng by implementing a new boilerplate method to directly extract the image
buffer from the test result. A secondary speedup is achieved by caching the
most recent reference image.
By keeping a static reference to the user font face, it is erroneously kept
alive during a call to cairo_debug_reset_static_data(). (A violation of
the caller's contract to ensure that no active reference to a cairo object
is held by the caller.)
The test-suite for win32 shows less than ideal error detection whilst
running on mingw32. Looking at the code, I spotted a few places where the
error propagation could be improved, and lo...
g++ only warns about using C-only warning flags, but add -Werror promotes
the warning to an error and enables correct detection of the unsupported
flags.
_cairo_cache_remove_random() just returned whether it found an entry to
remove and so the code can be simplified by returning a boolean as opposed
to a status code.
valgrind warns about an uninitialized read after a single char is promoted
to an int when passed to the printf. Silence the warning by using a
explicitly promoting the output byte to a full int.
The compiler complained about passing a non-string literal as the format
to printf, so just to sanitize the code and keep the compiler happy, add
the magic "%s" format.
When searching for a matching font, check the most recently used font
first. This optimizes the common case where pango calls save() and restore()
around rendering each layout, but almost all consecutive layouts use the
same font.
By inspecting all the users of the close display hooks, we can see that
(a) the key is redundant and (b) the data is unique to the hook. This
means we can trim the interface and stop the linear searches as soon as
we've found the correct element.
When cleaning files, limit the glob to only match *-out.{pdf,ps,svg} in
order to distinguish the current practice of naming vector output files
from possible future vector target/reference files.
Construct the test name to pass to the boilerplate creation routines such
that it uniquely identifies the test in terms of test, target, content and
pass (similar, offset, thread). This allows the vector targets to create
output different output files for each test, whereas before, later tests
would overwrite existing files making debugging more difficult.
Currently fallback-resolution is included in the test suite if we have all
of the vector surfaces available. This commit enables individual support
for the vector surfaces, so that the test can be run even if one or more
of the surfaces are not available.