Commit graph

269 commits

Author SHA1 Message Date
Adrian Johnson
252ff60f1e SVG font test using cairo logo 2022-12-28 13:22:00 +10:30
Adrian Johnson
29acc55849 Make it easier for cairo-test-suite to find the source dir 2022-05-19 06:44:58 +09:30
Adrian Johnson
2822728f2a Fix some MinGW warnings
The FT change is because my MinGW build is using a more recent version
of FT.

Remove the disabled _cairo_win32_scaled_font_text_to_glyphs() code to
fix the defined but not used warning.

_cairo_win32_scaled_font_text_to_glyphs() was diabled in d9408041aa with
the comment:

  "Currently disable the win32-font text_to_glyphs(), until that one
   is updated.  Or better yet, remove it and implement
   ucs4_to_index().  It's the toy font API afterall."

_cairo_win32_scaled_font_ucs4_to_index() was added in d1c619bc7d.
2021-09-02 21:14:51 +09:30
Emmanuele Bassi
bd13841257 Drop the conditional inclusion of config.h
We *always* generate this file, and we depend on its existence.

The idea behind HAVE_CONFIG_H was being able to include random files
from different projects, back in a time where "libraries" were literally
just random files instead of actual shared objects.

Since we're not in the '80s any more, and our build system(s) define
HAVE_CONFIG_H *and* generate the config.h header file, we don't need a
conditional guard around its inclusion.
2021-05-01 17:05:29 +01:00
Emmanuele Bassi
bfd1602db9 Remove stray _GNU_SOURCE definitions
We define _GNU_SOURCE globally in both the Autotools build, through the
use of the AC_USE_SYSTEM_EXTENSIONS macro; and in the Meson build, with
add_project_arguments().
2021-05-01 16:58:15 +01:00
Sven Neumann
a9ea73ae0c Fix compiler warnings in test suite
Fix some enum mixups, mostly cairo_status_t vs cairo_test_status_t.
2021-01-04 14:08:38 +01:00
George Matsumura
f2cb9ba49a meson: Fix musl build
This constitutes few fixes that are necessary to compile correctly
and reduce errors when using musl libc.

Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
2020-09-02 10:29:04 +00:00
Mathieu Duponchelle
4645ecf3f8 record tests: fix when builddir != srcdir
When builddir != srcdir, cairo_test_create_pattern_from_png
needs a non-NULL ctx to work with.
2020-07-18 19:47:17 +01:00
luz.paz
6d93bddbd6 Misc. typos
Found via `codespell -i 3 -w -I ../cairo-word-whitelist.txt -L tim,ned,uint`
Follow up of 12cb59be7d

Reviewed-by: Bryce Harrington <bryce@bryceharrington.org>
2019-01-31 17:37:15 -08:00
Adrian Johnson
71746c37d4 test: use CAIRO_MIME_TYPE_UNIQUE_ID with record-text-transform
The PS output from this test is > 100MB due to the duplicated images.
Using CAIRO_MIME_TYPE_UNIQUE_ID reduces the PS output to 650k, runs
considerably faster, and now produces correct output.
2017-11-09 22:02:05 +10:30
Andrea Canciani
e1353f3b85 test: Always use DejaVu Sans as default font
This makes the results of the test suite more stable across different
environments, because it does not rely anymore on
CAIRO_FONT_FAMILY_DEFAULT (which on Windows is "Arial", on Mac
"Helvetica").

This change should not affect Linux environments, assuming that the
default font is already set to "DejaVu Sans".
2015-07-27 12:45:59 +02:00
Bryce Harrington
2c5af590dd Refactor ARRAY_LENGTH macro definitions in test code 2014-11-20 12:22:06 -08:00
Ravi Nanjundappa
52b137bc3e test and util: maintain consistency in the usage of ARRAY_LENGTH macro
ARRAY_LENGTH macro is used in perf's cairo-perf.h, src's cairoint.h,
test's cairo-test.h and in some internal header files of util's
directory.So to maintain consistency ARRAY_SIZE is replaced with
ARRAY_LENGTH macro.

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-04-30 13:01:35 -07:00
Bryce W. Harrington
be7f1ac98f test: Make cairo_test_mkdir() usable throughout tests.
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-09 21:21:43 +02:00
Alexander Larsson
690c61aa54 tests: Add device scale test to "full" testrun similar to offsets 2013-09-05 16:08:20 +01:00
Uli Schlachter
592f594423 test: Fix CAIRO_REF_DIR
Ever since the test output was moved from test/ to test/output/, using
CAIRO_REF_DIR to make the test suite succeed no longer works. The test suite was
looking for the wrong file names.

This patch makes this work again. However, I am not sure that this really is the
correct fix. It just seems to work. :-)

Reported-by: Darxus <darxus@chaosreigns.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-03-15 16:56:42 +01:00
Uli Schlachter
d5f9c694b9 test: Define optional exception classes
According to musl libc author:

"C99 requires the FE_ macros to be defined if and only if the exception they
correspond to is supported"

So we define these macros to 0 if they are not supported. Support for these FPU
exceptions is not necessary for correct functionality, but makes some tests less
effective.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55771
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-10-16 17:09:42 +02:00
Maarten Bosmans
0bb3e0769a test: Only use alarm() when SIGALRM is also defined
On some platforms (mingw) the alarm() configure check succeeds, but the
alarm function doesn't actually work.
2012-04-10 12:08:24 +01:00
Andrea Canciani
93b0fcffc7 test: Create output directory even on Win32
This avoids cluttering the test directory with thousands of PNG files
and makes the behavior more consistent with other OSes.
2012-02-16 23:00:59 +01:00
Andrea Canciani
1501c86536 test: Do not open files in non-existing dirs
The output directory should be made before trying to open log files in
it.

Fixes the bug causing cairo-test-suite to log to stderr on the first
run (i.e. when test/output does not exist).
2011-11-12 20:49:08 +01:00
Andrea Canciani
de6a1e68fe Remove useless checks for NULL before freeing
This patch has been generated by the following Coccinelle semantic patch:

// Remove useless checks for NULL before freeing
//
// free (NULL) is a no-op, so there is no need to avoid it

@@
expression E;
@@
+ free (E);
+ E = NULL;
- if (unlikely (E != NULL)) {
-   free(E);
(
-   E = NULL;
|
-   E = 0;
)
   ...
- }

@@
expression E;
@@
+ free (E);
- if (unlikely (E != NULL)) {
-   free (E);
- }
2011-11-12 20:49:08 +01:00
Andrea Canciani
c65d4e35dc Use xstrdup instead of xmalloc when possible
Don't open code xstrdup, just use it.
2011-11-12 20:49:08 +01:00
Andrea Canciani
6dfb12c7d7 test: Reuse cairo_test_logv()
cairo_test_log() can be implemented on top of cairo_test_logv() to
ensure that their behavior is consistent.
2011-11-12 20:49:08 +01:00
Andrea Canciani
549b1f8d4b boilerplate: Remove unused thread id parameter
The thread id is not used anymore (it is always == 0), so it can be
removed.
2011-11-12 20:49:08 +01:00
Andrea Canciani
b07b242220 test: Remove unused thread field
The multi-threaded test path does not exist anymore and the ctx->thread
field is always 0, hence it can be removed.
2011-11-12 20:49:08 +01:00
Andrea Canciani
6ef9779a6f test: Remove dead code
This code is unused and can be removed.
2011-11-12 20:49:08 +01:00
Chris Wilson
5f8ee79b40 test: Write the individual test logs to output/
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-15 14:21:20 +01:00
Chris Wilson
768d39f034 test: Move all the reference images to their own directory
With over two thousand references images now, it is starting to make the
test directory look cluttered!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-15 14:05:10 +01:00
Andrea Canciani
b9d9ca281c Avoid deprecated functions on win32
Some POSIX functions are deprecated in MSVC and should instead be used
with an alternative name beginning with '_'.
2011-06-20 10:24:20 +02:00
Andrea Canciani
3b9c874489 test: Use POSIX-compatible unlink
On Win32, the POSIX-compatible unlink function is named "_unlink".

A function named "unlink" exists, but does not have the same behavior
as the POSIX-specified one. This function makes the cairo test suite
behave incorrectly and immediately terminate with the message:

Error: Cannot remove cairo-test-suite.log: No error
2011-06-14 16:47:32 +02:00
Andrea Canciani
4ef32a36ba test: Silence gcc warnings
warning: cannot optimize possibly infinite loops

gcc does not detect that the "infinite" loops are actually just one or
two iterations, depending on the has_similar value being FALSE or
TRUE. It realizes it if the iteration variable and the iteration stop
value are both enum values.
2011-03-17 17:35:28 +01:00
M Joonas Pihlaja
fca8977219 build: Rework pthread detection.
Use two levels of pthread support: a minimal level used to
build cairo itself, and a full level to build threaded apps
which want to use cairo.  The minimal level tries to use
pthread stubs from libc if possible, but falls back to the
full level if that's not possible.  We use CFLAGS=-D_REENTRANT
LIBS=-lpthread to find a real pthread library since that seems
to work on every unix-like test box we can get our hands on.
2010-07-11 21:40:26 +03:00
Chris Wilson
0693af2328 test: Move all output below test/output/
make distcheck complains of remanents being left under test/ after a
clean, notably the files used to check the capabilities of a similar
surface and the fallback-resolution output.
2010-06-13 10:25:49 +01:00
Chris Wilson
bd3d9ef3d1 test: Distinguish tests that throw an error from a normal fail.
Hitting an error in a test case is almost as bad as crashing, and the
severity may be lost amidst "normal" failures. So introduce a new class
of ERROR so that we can immediately spot these during a test run, and
appropriately log them afterwards.
2010-06-11 09:14:16 +01:00
Chris Wilson
af26560f25 test: Improve memfault behaviour.
Various minor tweaks to convert asserts into error returns and to
improve error checking on intermediate surfaces.
2010-05-03 19:21:59 +01:00
Benjamin Otte
b0760826f3 test: Set have_result for image matches
Causes the log to contain information about the reference imagery used.
2010-04-29 12:12:51 +02:00
Benjamin Otte
2ce1afa322 test-suite: add image_diff_is_failure() function
This cleans the code and fixes a boolean logic error where this check
was done manually.
2010-04-28 13:15:09 +02:00
Chris Wilson
25a77b263d boilerplate: Cleanup the list of backends upon shutdown. 2010-03-23 16:49:21 +00:00
M Joonas Pihlaja
43a775f60d [meta] Rename cairo_meta_surface_t to cairo_recording_surface_t.
The new name is more descriptive than the rather opaque meta surface.
Discussed with vigour on the mailing list and #cairo:

http://lists.cairographics.org/archives/cairo/2009-July/017571.html
2009-10-22 02:29:47 +03:00
Chris Wilson
dac73d260a [build] Link against pthread-stubs
Avoid pulling in the real pthread library if the application is single
threaded and not using pthreads, by linking against pthread-stubs
instead.
2009-10-15 13:05:47 +01:00
Chris Wilson
8e4e0aa7ee [boilerplate/xcb] Check for connection errors during test 2009-09-30 17:50:35 +01:00
Chris Wilson
abaef9bfbe [test] Compare a failure against the image output
If a backend fails in exactly the same way as the image, then we can
safely assume that the failure is systematic and not an error in the
backend, so change the result to XFAIL.
2009-09-09 13:57:06 +01:00
M Joonas Pihlaja
12d0613210 [test] Allow tests to XFAIL by putting the cairo_t into an error state.
The test runner was extra strict about never letting a test put
the cairo_t into an error state, and never would it check for
the expectedness status of the failure.  This patch moves the
check for a test being an XFAIL above the check on the cairo_t's
final status.
2009-09-03 19:27:23 +03:00
M Joonas Pihlaja
feaf38d0cd [test] Use HAVE_FLOCKFILE instead of _POSIX_C_SOURCE.
The _POSIX_C_SOURCE 2001.. #define requires C99 mode and
clang on Solaris is strict about such things. Use configure
tests for flockfile() instead.
2009-08-31 16:25:08 +03:00
Chris Wilson
19f4498234 [test] Wrap yet another call to get_image_surface() inside a timeout.
I missed this call to get_image_surface() that is now being hit having
restored the reference image for dash-infinite-loop.
2009-07-28 12:58:07 +01:00
Chris Wilson
24b5ac6377 [test] Add timeouts around finishing and converting surfaces to images.
In order to catch infinite loops whilst replaying and converting vector
surfaces to images (via external renderers) we need to also install
alarms around the calls to finish() and get_image().
2009-07-28 08:41:50 +01:00
Chris Wilson
596dec9561 [test] Trap SIGFPE
Note the crash if we hit a floating-point exception.
2009-07-24 10:44:03 +01:00
Chris Wilson
c3f2db4f73 [drm] Add an accelerated image surface.
Use the DRM interface to h/w accelerate composition on image surfaces.
The purpose of the backend is simply to explore what such a hardware
interface might look like and what benefits we might expect.  The
use case that might justify writing such custom backends are embedded
devices running a drm compositor like wayland - which would, for example,
allow one to write applications that seamlessly integrated accelerated,
dynamic, high quality 2D graphics using Cairo with advanced interaction
(e.g. smooth animations in the UI) driven by a clutter framework...

In this first step we introduce the fundamental wrapping of GEM for intel
and radeon chipsets, and, for comparison, gallium. No acceleration, all
we do is use buffer objects (that is use the kernel memory manager) to
allocate images and simply use the fallback mechanism. This provides a
suitable base to start writing chip specific drivers.
2009-07-23 16:18:42 +01:00
Chris Wilson
bed2701e1c Remove clip handling from generic surface layer.
Handling clip as part of the surface state, as opposed to being part of
the operation state, is cumbersome and a hindrance to providing true proxy
surface support. For example, the clip must be copied from the surface
onto the fallback image, but this was forgotten causing undue hassle in
each backend. Another example is the contortion the meta surface
endures to ensure the clip is correctly recorded. By contrast passing the
clip along with the operation is quite simple and enables us to write
generic handlers for providing surface wrappers. (And in the future, we
should be able to write more esoteric wrappers, e.g. automatic 2x FSAA,
trivially.)

In brief, instead of the surface automatically applying the clip before
calling the backend, the backend can call into a generic helper to apply
clipping. For raster surfaces, clip regions are handled automatically as
part of the composite interface. For vector surfaces, a clip helper is
introduced to replay and callback into an intersect_clip_path() function
as necessary.

Whilst this is not primarily a performance related change (the change
should just move the computation of the clip from the moment it is applied
by the user to the moment it is required by the backend), it is important
to track any potential regression:

ppc:
Speedups
========
image-rgba         evolution-20090607-0    1026085.22 0.18% -> 672972.07 0.77%:  1.52x speedup
▌
image-rgba         evolution-20090618-0    680579.98 0.12% -> 573237.66  0.16%:  1.19x speedup
▎
image-rgba      swfdec-fill-rate-4xaa-0    460296.92 0.36% -> 407464.63  0.42%:  1.13x speedup
▏
image-rgba      swfdec-fill-rate-2xaa-0    128431.95 0.47% -> 115051.86  0.42%:  1.12x speedup
▏
Slowdowns
=========
image-rgba     firefox-periodic-table-0    56837.61 0.78% -> 66055.17    3.20%:  1.09x slowdown
▏
2009-07-23 15:32:14 +01:00
Chris Wilson
dbaa08e80b [test] Fallback to comparing the base image references
After looking at backend specific images, check against the base image
reference. This is useful to fallback surfaces like xlib-fallback, which
should look closer to the image backend than the xlib backend.
2009-07-20 18:56:10 +01:00