Commit graph

2310 commits

Author SHA1 Message Date
Andrea Canciani
654b4a8efe test: Fix coverage-intersecting-triangles reference
Commit 4e3ef57bc8 added
coverage-intersecting-triangles with an incorrect reference and
generator. The test checks the rasterization of two overlapping
triangles in the following position:

   .   .
   |\ /|
   | X |
   |/ \|
   .---.

Since the triangles have both vertical and horizontal sides of size
x/WIDTH, the expected coverage is 3/4 (75%) of (x/WIDTH)^2. The
original code, instead, was checking for a coverage of 0.75*x/WIDTH,
as if one of the sides was always 1 unit long.

The image and xlib backends still suffer from some jitter, caused by
the approximation of the actual coverage by means of sampling. For
this reason their references are still considered XFAIL, even though
their result now looks mostly consistent with the expected reference.
2015-04-08 14:32:17 +02:00
Bryce Harrington
2cf2d8e340 Fix spellings descibed, indicies, stange 2015-04-04 15:49:18 -07:00
Andrea Canciani
b19b06c463 Harden make-cairo-test-constructors.sh
The make-cairo-test-constructors.sh script executes several commands
without checking their success. This can lead to undetected errors,
like those fixed in 86fad78fcd.

The script now exits with an error status if no file is
input. Moreover, it sets the '-e' flag, so that if a command fails,
the whole script is immediately terminated with an error.

In the Makefile.am, the script result is now checked and the target
file is removed upon error. This ensures that the
'cairo-test-constructors.c' target completes succesfully only if no
error occurred.

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-03-13 13:18:32 -07:00
Bryce Harrington
86fad78fcd On MacOSX, the sed utility errors out when parsing non-UTF8
files. Because of this, the generated cairo-test-constructor only
contained a few tests and the test suite was thus incomplete.

Original patch by Andrea Canciani <ranma42@gmail.com>
2015-03-10 12:15:40 -07:00
Michael Haubenwallner
0916d580db test: fix include order for AIX, bug#89354 2015-03-05 17:02:14 -08:00
Michael Haubenwallner
f72bd7c757 skip MAP_NORESERVE when unsupported
Fixes a compilation on AIX ('MAP_NORESERVE' undeclared)

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=89340
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2015-03-05 14:48:28 -08:00
Andrea Canciani
4a225fca5f test: Free test list
When running the cairo-test-suite, valgrind reports each of the
registered test as a leak, because they are _list_prepend()'ed, but
the tests list is never _list_free()'d.

Fixes the following valgrind error:

malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
cairo_boilerplate_xmalloc (cairo-boilerplate-system.c:47)
cairo_test_register (cairo-test-runner.c:131)
_cairo_test_runner_register_tests (cairo-test-constructors.c:1112)
main (cairo-test-runner.c:714)

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2014-12-06 17:38:02 -08:00
Andrea Canciani
9806f437b4 test: Release owned pattern
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>
2014-12-06 17:38:02 -08:00
Bryce Harrington
2c5af590dd Refactor ARRAY_LENGTH macro definitions in test code 2014-11-20 12:22:06 -08:00
Bryce Harrington
7edc5a8844 test: Use ARRAY_LENGTH macro 2014-11-20 12:22:06 -08:00
Bryce Harrington
b4e218c3e8 Drop the target-specific huge-radial.pdf.*.ref.png images
These two images are mis-rendered (clearly evident from visual
inspection).  By removing them, the test will fall back to the more
general format-specific images, huge-radial.argb32.ref.png and
huge-radial.rgb24.ref.png.

Note that the huge-radial.pdf tests still fail to pass, but the pdiff
looks more sensible.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66218

Signed-off-by: Bryce Harrington <bryce@bryceharrington.org>
2014-10-29 15:45:17 -07:00
Bryce Harrington
51892e91d4 Revert "Add execution bit for make-cairo-test-constructors.sh"
This reverts commit 5c17bf1a33.

Script is sourced in the makefile, no need for +x.
2014-10-18 19:10:32 -07:00
Bryce Harrington
5c17bf1a33 Add execution bit for make-cairo-test-constructors.sh
This is referenced in the Makefile but not set as executable
2014-10-17 15:50:31 -07:00
Bryce Harrington
82cd66f833 test: Update pixman downscaling 95 reference images
The pixman downscaling "95" tests attempt to rescale a 96x96 pixmap to
95x95.  Ideally the borders between color areas should be sharp, but for
this use case we allow for 1 pixel of blur between the areas as
acceptable.  The choice of what color to use for this blurred region is
not important, and in fact varies from backend to backend.

The old reference images were generated by Krzysztof Kosiński's
downscaling algorithm.  These new images are against the algorithms
written by Bill Spitzak.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2014-10-09 18:28:53 -07:00
Bryce Harrington
79b5a35f83 test: Add an update-refs.sh script to update reference images
There are cases where the rendered output of a test can vary from
backend to backend in ways which are visually acceptable.  This is why
we have reference images in the first place.  In these cases, changes to
the rendering logic can result in slight differences in the output that
is also within acceptable visual limits.

We see this in the pixman downscaling tests.  This script is introduced
as a way to more easily update the reference images after a renderer
change.

This script is intended to be expanded to handle updating of references
for other tests as we identify similar issues.  The intent is that this
script then serves as a way to document these exceptional cases.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2014-10-09 18:28:52 -07:00
Bryce Harrington
1570fa23e8 test: Fix error message to specify the executable that was missing
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2014-10-09 13:51:49 -07:00
Chris Wilson
a8abf3a48b test: Fix conflation of different device scales in index.html
Currently testtable.js does not recognise the difference between running
the same test with multiple scale factors and merges the results into
one.
2014-10-09 10:57:17 +01:00
Chris Wilson
14df211b9c test: Add whole flipped replays
When investing the symmetry of the raterisation, we want to have a
simple replay of all of the original geometry through a the flipped
recording surface. This reduces the worry about artifacts from the
clipped rendering.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-02 13:08:50 +01:00
Chris Wilson
7aacd81bef test: Refresh reference images for tor rendering changes
(And include a git add missed from commit

ccd48b3464
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Sep 30 14:06:21 2014 +0100

    test: Remove more duplicated reference images

but were mostly invalidated by the rasteriser changes anyway).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-02 08:46:44 +01:00
Chris Wilson
79c8b14b9f test/simple: Tighten sanity checks in reference image generator
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-02 08:46:44 +01:00
Chris Wilson
50b41e2145 test: Add a simple rasteriser to check fidelity of edge rendering
In order to check the behaviour of the analytic rasteriser inside tor,
let's compare it against a very simple rasteriser that uses a rectiliner
256x256 sample grid.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-02 00:06:27 +01:00
Chris Wilson
2144e7f48b test: Fix coverage-abutting
Using CAIRO_OPERATOR_OVER in case causes oversampling of the coincident
edges, to measure coverage we should only use ADD. :|

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-30 16:18:34 +01:00
Chris Wilson
0c42d5c176 test: Add another coverage example demonstrating the seams in tor
References: https://bugs.freedesktop.org/show_bug.cgi?id=84396
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-30 16:15:33 +01:00
Chris Wilson
95e147bfa0 test: Explicitly flip the reference image for recordflip
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-30 14:33:50 +01:00
Chris Wilson
ccd48b3464 test: Remove more duplicated reference images
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-30 14:06:36 +01:00
Chris Wilson
167561f282 tor: Review full-row walker
When updating the quorem between cells, we would lose the overflow
increment as it was only applied locally and not preserved by updating
the quorem.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-30 13:57:05 +01:00
Chris Wilson
ff23afd5f2 test: Include coverage in the normal test run
Currently coverage is marked as slow. It is slower than the typical
test, but it is quite a useful check on our rasterisation quality
without going too far overboard (unlike partial-coverage!).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-30 12:25:56 +01:00
Chris Wilson
03c3d4b7c1 tor: Fix loss of precision from projection onto sample grid
The goal is to preserve the precision in the gradients of the edges and
only apply the projection into the final cell location. We also include
the half-subrow offset as spotted by Massimo.

References: https://bugs.freedesktop.org/show_bug.cgi?id=84396
Testcase: coverage-rhombus
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-30 12:01:13 +01:00
Chris Wilson
8e1e2a5414 test: Remove redundant reference images
If we have both a argb32 and rgb24 reference image that are identical,
we can replace them with a plain reference image. I also prefer to have
argb32/rgb24 versions of the reference images if rgb24 differs from the
plain reference.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-30 11:47:44 +01:00
Ravi Nanjundappa
93c21e3fd3 test: Add test for egl-surface-source
This test file attempts to use a EGL backend surface as a source
surface for all other backends.

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
2014-09-29 16:08:23 -07:00
Chris Wilson
5c03b20732 test/coverage: Exercise invariance under mirror symmetry
Massimo noticed that the record/record-flip were not being rasterised as
identical mirror images due to a half-subpixel offset in the tor scan
converter. This test attempts to reproduce this error by rendering a
rhombus around the origin of each cell (that is it generates 4 mirror
images of a triangle in the 4 different orientations0. The expectation
is that each pixel in the group is lit identically as the coverage is
identical.

References: https://bugs.freedesktop.org/show_bug.cgi?id=84396
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-29 08:42:17 +01:00
Chris Wilson
80359e73d8 test: Exercise stroking bugs with xlib/trapezoids
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84115
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-24 12:35:47 +01:00
Ravi Nanjundappa
8479b60867 test: Add test oversized egl surfaces
This test exercises error scenario when creating over sized egl surface
that is larger than maximum framebuffer or texture dimensions of the
context

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
2014-09-19 15:46:14 -07:00
Ravi Nanjundappa
c6ae5b1976 test: Fix null pointer issue reported by cppcheck static analysis tool
cppcheck analysis tool reports the following issues when run on the
latest Cairo source.

$ grep "(error)"  cppcheck_error_log.txt
[test/pdf-mime-data.c:58]: (error) Possible null pointer dereference: file - otherwise it is redundant to check if file is null at line 53
[test/pdf-mime-data.c:75]: (error) Resource leak: fp
$

The proposed changes fixes the above issues.

And also it does some refactoring to print the appropriate error messages
for each error condition in read_file() function and also to free the allocated
data buffer.

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-27 20:39:57 -07:00
Ravi Nanjundappa
7736d08e22 README : Update README file related to usage of FORMAT make variable
Reformatted the README file to simplify the sentences.

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-14 16:10:14 -07:00
Ravi Nanjundappa
f8e0ecb5af test: Selective execution of Cairo tests based on FORMAT option
Added a new command line option FORMAT which can take rgb and/or rgba
values which enables the execution of tests only for the given FORMAT
For ex:
(1). CAIRO_TESTS="zero-alpha" make test TARGETS=ps2,image FORMAT=rgba,rgb
This command runs the zero-alpha test for both ps2 and image backends
with argb32 and rgb24 content formats.
(2). CAIRO_TESTS="zero-alpha" make test TARGETS=ps2,image FORMAT=rgba
This command runs the zero-alpha test for both ps2 and image backends
with argb32 content format and so on.

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-14 16:09:20 -07:00
Ravi Nanjundappa
7d44f8d47e test : build fix when --enable-pdf=no
Though --enable-pdf=yes by default, when --enable-pdf=no, the cairo build
fails due to unavailability of cairo-pdf.h and related cairo pdf's apis.
The current changes fixes this issue by conditionally checking if PDF
surface is enabled or not.

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Tested-by: Bryce Harrington <bryce@osg.samsung.com>
2014-08-14 12:00:08 -07:00
Behdad Esfahbod
23dce494d1 Binary mode in any2ppm
From:
https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-cairo/0010-binary-mode-in-any2ppm.mingw.patch
2014-07-23 12:09:45 -04:00
Ravi Nanjundappa
8a605472d2 .gitignore: Ignore the generated profile data files from callgrind tool in test/
Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-07-09 16:51:22 -07:00
Eric Le Bihan
5741a7f2ca test: fix build of any2ppm if fork not available
The test program any2ppm can run as daemon. This feature can be disabled
at compile time, if the required headers are not present. However the
support for fork() is not checked.

This patch fixes this issue.

Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
2014-06-05 16:09:45 -07:00
Ravi Nanjundappa
d1453c512c test : Maintain consistency in the usage of xcalloc
xcalloc is a wrapper for calloc. If it can't allocate memory then it
terminates the program. The current changes replace the usages of calloc
by xcalloc in tests.

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
2014-05-16 11:56:27 -07:00
Sylvestre Ledru
247cfaaa25 Fix some memory leaks found by scan-build, the LLVM/Clang static analyzer
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Uli Schlachter <psychon@znc.in>
2014-05-16 11:11:34 -07:00
Sylvestre Ledru
da9ef97372 Remove some useless declarations found by scan-build, the LLVM/clang static analyzer
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-05-06 10:14:53 -07: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
Uli Schlachter
3e22a8580a pthread-same-source: Refresh reference images
These reference images are generated by the new GENERATE_REFERENCE mode that the
previous commit introduced.

I have no idea what the "base" images. From my reading of the code in
boilerplate/, these images will be used by the test-XXX targets. However, these
seem to generate the same result than e.g. the image backend. Thus, I deleted
these files.

There is still pthread-same-source.quartz.xfail.png. This file was created in
commit b6e16b8d and touched in commit 5a1e590b1. No idea if this is still valid
and since I don't have a Mac, I won't touch it.

The test is still broken on the following backends (out of the backends I have
compiled in). This mostly seems to be differences in image scaling, but I
couldn't figure out an easy way to tell the test suite that the new results are
correct.

test-paginated, ps2, ps3, xcb, xcb-window, xcb-window&, xcb-fallback, xlib,
xlib-window, xlib-fallback, recording

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-04-17 11:32:56 +02:00
Uli Schlachter
ddd344fb0f pthread-same-source: Add ref image generation
When the new GENERATE_REFERENCE symbol is defined to 1, no threads are involved
at all. In this case, all operations are done sequentially by the main thread.

Thus, in this mode no thread issues can occur and the result must be usable as
reference images.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-04-17 11:32:49 +02:00
Bryce Harrington
9b8a752249 test: Quell warning for deprecated g_type_init()
The g_type_init() routine was deprecated in glib 2.34.  Tested and
verified this conditionalization on glib 2.32 and 2.36.  No need to
change version dependencies.

  test/any2ppm.c:864:5: warning: ‘g_type_init’ is deprecated
  (declared at /usr/include/glib-2.0/gobject/gtype.h:669)

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-25 12:13:40 -08:00
Bryce Harrington
75e671c29b test: Quell warning for inclusion of old rsvg header files
This silences a warning due to header file deprecated as of libsrvg
2.36.2.  Tested and verified this hackaround on librsvg 2.36.4 and
2.36.1.  No need to change version dependencies.

  In file included from test/any2ppm.c:73:0:
  /usr/include/librsvg-2.0/librsvg/rsvg-cairo.h:27:2: warning:
  #warning "Including <librsvg/rsvg-cairo.h> directly is deprecated."

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-25 12:13:34 -08:00
Bryce Harrington
9a29805f4e test: Drop unused path variable in two recently added tests
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-31 11:25:48 -08:00
Bryce Harrington
0723290a6f test: Handle error in fgets call in ps-eps test
Most likely this is just a theoretical problem since we just checked
feof, but this quells the following warning:

ps-eps.c:216:8: warning: ignoring return value of ‘fgets’, declared with
attribute warn_unused_result [-Wunused-result]

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-31 11:25:43 -08:00