Commit graph

2310 commits

Author SHA1 Message Date
Bryce Harrington
1b522f81e2 test: Replace deprecated rsvg_init() in any2ppm test
As of libsvg 2.35 calling g_type_init() is sufficient.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-31 11:25:32 -08:00
Behdad Esfahbod
8d2e24479a [tests] Add path-currentpoint
Checks whether copy_path()/append_path() preserves current-point.
Currently failing.
2014-01-27 17:32:58 -05:00
Adrian Johnson
2974416dfc Add test for paint with alpha and clipping bug
Add test case for https://bugs.freedesktop.org/show_bug.cgi?id=68382

Something has regressed in the recording surface. All the recording
surface based backends lose the alpha from the paint_With_alpha.
2013-12-26 17:18:41 +10:30
Adrian Johnson
acd78d721e Add test for rectangle path optimization with non rectilinear pen
This fails on pdf/ps.
2013-12-26 15:27:30 +10:30
Søren Sandmann Pedersen
98fef3cef2 _cairo_color_double_to_short(): Use standard rounding algorithm
The _cairo_color_double_to_short() function converts a double
precision floating point value in the range of [0.0, 1.0] to a
uint16_t integer by dividing the [0.0, 1.0] range into 65536
equal-sized intervals and then associating each interval with an
integer.

Under the assumption that an integer i corresponds to the real value i
/ 65535.0 this algorithm introduces more error than necessary as can
be seen from the following picture showing the analogous
transformation for two-bit integers:

    +-----------+-----------+-----------+-----------+
   0b00         |  0b01     |      0b10 |          0b11
    +-----------+-----------+-----------+-----------+

which shows that some floating point values are not converted to the
integer that would minimize the error in value that that integer
corresponds to.

Instead, this patch uses standard rounding, which makes the diagram
look like this:

    +-------+---------------+---------------+-------+
   0b00     |      0b01     |      0b10     |      0b11
    +-------+---------------+---------------+-------+

It's clear that if the values corresponding to the given integers are
fixed, then it's not possible to decrease the resulting error by
moving any of the interval boundaries.

See this thread for more information:

    http://lists.freedesktop.org/archives/cairo/2013-October/024691.html

Reference images updated:

  pthread-similar.ref.png
  record-paint-alpha.ref.png
  record90-paint-alpha.argb32.ref
  record90-paint-alpha.rgb24.ref.png
  xcb-huge-image-shm.ref.png
  xcb-huge-subimage.ref.png

All of these have only one-step differences to the old images.
2013-10-22 14:27:43 -04:00
Uli Schlachter
592e6a9803 README: Don't mention XFAIL_TESTS anymore
The variable XFAIL_TESTS is not used anymore since commit e90073f7dd.

Instead, we now have special reference images that show the wrong output and the
test suite fails a test if it does not match the expected, wrong output.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-10-03 16:59:11 +02:00
Uli Schlachter
bc89be2fff Remove XFAIL_TESTS from Makefile.am
The variable XFAIL_TESTS is not used anymore since commit e90073f7dd.

The description for the known failures are moved into the respective tests as
comments.

The following descriptions were dropped:

- surface-pattern-big: Didn't really explain the failure
- big-line: Test isn't failing any more
- self-intersecting: Only XFAIL on quartz, but description doesn't match this

The following tests don't have a xfail reference image and seem to fail just
because of not having a reference image at all (I kept their description for
now):

big-trap, long-lines, self-copy-overlap

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-10-03 16:58:52 +02:00
Bryce Harrington
38a925460b test: Drop unnecessary math.h include
Commit 0ac81988 refactored away fmin; nothing else from math.h is
needed.
2013-09-26 10:59:14 -07:00
Chris Wilson
0ac81988c1 test/pixman-downscale: Open-code fmin()
fmin() requires a bump to either _XOPEN_SOURCE_ >= 600 (POSIX 2004) or
c99 - which is a needless dependency for a single simple routine.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-17 08:37:38 +01:00
Uli Schlachter
440624cdf2 test/multi-page: Fix use-after-free
Commit f9dcd07d22 changed the way the file name is allocated and introduced
a use-after-free in doing so.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-16 12:58:44 +02:00
Adrian Johnson
412a4c34d9 test: update mime-data to test jbig2 mime types 2013-09-15 21:27:50 +09:30
Bryce W. Harrington
5390c2bbca test: Document use of -k and CAIRO_TEST_TARGET to run test subsets
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-13 12:58:11 +02:00
Bryce W. Harrington
640eb02067 test: Space out keywords for clarity
As another nitpick, a comma alone is legal for separating keywords, but
most tests use a comma and a space.  Update the few tests that don't,
to make this consistent.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-13 12:57:42 +02:00
Bryce W. Harrington
a6ace0cf6b test: Comma separate keywords
The parser accepts spaces as separtors between keywords, so this is nit
picky.  But only a minority of tests don't follow the comma convention,
so change them to be consistent.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-13 12:57:17 +02:00
Bryce Harrington
ac5f3e2b8e test: Move cairo_pattern_set_filter to after cairo_set_source_surface
Also update the image.arg32 reference images, since for now we're just
accepting pixman's output as truth.  This fixes up several tests:

                   was   is
 Tests run:        420   420
 Passed:           224   261
 Failed:           195   159
 Expected Failed:  0     0
 Error:            0     0
 Crashed:          0     0
 Untested:         0     0
 Total:            420   420

Thanks to psychon for finding the code error in the test.
2013-09-11 19:32:08 +02:00
Bryce Harrington
ade7089f72 test: Exercise image scaling quality when downscaling
This adds testcases for the various cairo filter options, each of which
match to corresponding pixman filters.  Use the 'downscale' keyword if
invoking tests using cairo-test-suite.

The 24-pixel reference images were produced from quad-color.png using
Gimp's Scale Image command with Interpolation set to None.  It is
assumed that all filters should handle a 1:4 scaling cleanly with no
antialiased blurring.

The 95-pixel reference images assume differing types of antialiasing
based on the quality level.  We are using the image.argb32 output as
reference here.  Potentially some other rendering algorithm could
conceivably provide better results in the future.

The 96-pixel reference images are simply copies of the original
quad-color.png file.  It is assumed that 1:1 downscaling operations
should produce no visible change to the original image.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2013-09-11 19:32:08 +02:00
Bryce Harrington
0f554c36d3 test: Test a variety of scales when downscaling
Downscaling from 96 to 24 is easy since it's an even multiple, so try
scaling by -1 pixel too.

This adds a 1:1 scaling test case as well, which should pass through the
image unchanged.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2013-09-11 19:32:08 +02:00
Bryce Harrington
642b6d8091 test: Add test for image downscaling
This adds pixman-downscale.c, which tests correctness of PNG images
scaled down using pixman routines.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2013-09-11 19:32:08 +02:00
Bryce W. Harrington
53255625c0 svg, test: Refer to output filename by variable, not a hardcoded value
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-09 21:28:35 +02:00
Bryce W. Harrington
f9dcd07d22 test: Ensure output dirs exist, falling back to current dir if needed
This change makes several tests behave more like ps-eps.c, et al by
making them attempt to mkdir "output", and in case of trouble use "."
instead.  filenames are now allocated at runtime due to this change, so
ensure the corresponding free()'s are in place as well.

This should facilitate running the test suite with a relative path
outside cairo's source tree, such as when employing the CAIRO_REF_DIR
environment variable.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-09 21:25:12 +02: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
Bryce W. Harrington
6731023f1b test: Fix several tests to place output files in the output directory
The standard location for test output is cairo/test/output.  The harness
itself was updated to write automatically generated images in this
directory, however a number of tests generate their own local output
files.

This patch updates these tests to write their output into
CAIRO_TEST_OUTPUT_DIR (which defaults to cairo/test/output) as well, in
the interest of decluttering the test directory.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-09 21:15:50 +02:00
Bryce W. Harrington
f3574b8b3b test: Don't ignore test output files left in test directory
Tests should be placing output files in the output/ directory now,
although not all tests follow this standard practice.  Drop the
"*.out.*" from .gitignore to make improper test behavior more evident.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-09 21:15:12 +02:00
Chris Wilson
5f70148467 test: Allow CAIRO_TEST_MODE to independently enable extended testing
Such as CAIRO_TEST_MODE=scale for testing application of
cairo_surface_set_device_offset.

CAIRO_TEST_MODE=similar - test rendering through similar surfaces
CAIRO_TEST_MODE=offset - test rendering with a device offset
CAIRO_TEST_MODE=scale - test rendering with a device scale
2013-09-05 16:08:20 +01:00
Alexander Larsson
690c61aa54 tests: Add device scale test to "full" testrun similar to offsets 2013-09-05 16:08:20 +01:00
Martin Robinson
95f320e3f2 gl: Return surface in error when creating oversized texture surfaces
When creating a texture surface that is larger than the maximum
framebuffer or texture dimensions of the context, return a surface in
error. Previously the code failed an assertion, but this prevents an
application from easily detecting when to fall back.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-19 14:54:28 -07:00
Uli Schlachter
b64c83e891 api-special-cases: Also test contexts
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>
2013-08-13 19:17:56 +02:00
Uli Schlachter
9058e9ae28 Add new test for bug 61592
This test exercises some clipping-related failure that Seongwon Cho reported.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=61592
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-07-04 21:57:12 +02:00
Uli Schlachter
54bee5e0fc Fix caps-tails-curve reference images
Commit d7f5a1bec fixed a bug. This caused 12 new test failures for the
test-traps test target:

caps-tails-curve degenerate-arc degenerate-path joins subsurface
subsurface-scale twin twin-antialias-gray twin-antialias-mixed
twin-antialias-none twin-antialias-subpixel user-font

Most of these are indeed (new?) bugs. However, caps-tails-curve actually started
producing the expected result and the reference image just wrongly captures the
old state of things.

At the time of that commit, just taking the output from test-traps as the new
reference image works fine for all backends. However, with current git,
something introduced more antialiasing noise and now test-traps changed again
while cairo-xcb stayed with the old result. Thus, we also need a new reference
image to fix this test.

(The wrong reference images come from commit 8488ae02 which turned test-traps'
results into reference images)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-07-04 21:57:12 +02:00
Chris Wilson
8b55703d76 test: Amend check-refs.sh to support out-of-tree builds 2013-07-04 10:04:30 +01:00
Chris Wilson
8b4151a5e5 test: Remove conflicting .ref.png, .argb32.ref.png, .rgb24.ref.png
Where a content specific reference image exists, prefer to have both
content reference images (i.e. both argb32.ref and rgb24.ref) rather
than a mix of .ref and argb32/rgb24.
2013-07-04 10:02:46 +01:00
Chris Wilson
9eb1237e00 test: Add a few reference images found lurking on my machine 2013-07-04 09:40:37 +01:00
Chris Wilson
3255462a23 test: Remove all identical (cmp & pdiff) reference images
Courtesy of the improved check-ref-dups written by Bryce Harrington:

Running make check on the codebase (with default configuration) with the
redundant images removed produces essentially the same test results:

Before
------
Tests run:        13687
Passed:           9216
Failed:           3566
Expected Failed:  312
Error:            1
Crashed:          17
Untested:         575
Total:            13687

After
-----
Tests run:        13689
Passed:           9216
Failed:           3566
Expected Failed:  312
Error:            1
Crashed:          19
Untested:         575
Total:            13689

(with the exception being the pthread tests misbehaving between runs)
2013-07-04 09:27:56 +01:00
Bryce W. Harrington
33895904d5 test: Add special cases for create-from-png and fallback-resolution
These tests use reference images somewhat differently from other tests,
so treat them as special cases and avoid recommending deleting any of
their files.

Add TODO's to each test to rework them to be more consistent with other
tests.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2013-07-04 09:27:56 +01:00
Bryce W. Harrington
5577223489 pdiff: Drop unused variable
Fixes:
perceptualdiff.c:35:24: warning: unused variable ‘dim’
[-Wunused-variable]

Signed-off-by: Bryce Harrington <bryce@bryceharrington.org>
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2013-07-04 09:27:56 +01:00
Bryce W. Harrington
319b893582 pdiff: Quell warning about signed/unsigned comparisons
perceptualdiff.c:55:19: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
perceptualdiff.c:60:16: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2013-07-04 09:27:55 +01:00
Bryce W. Harrington
9e4cac50c2 test: Make check-ref-dups utilize perceptualdiff for comparisons
The current sha1sum-based file checker does a blanket comparison of all
files with each other, which is fast but not directly helpful since it
doesn't distinguish between sibling files (which are allowable to be
duplicates).  Also, it ignores files that may have byte differences
(such as PNG header differences) but are otherwise pixel-identical.

This patch replaces the sha1sum-based checker with one that accounts for
the default fallback path and uses perceptualdiff to compare files that
are bytewise different and verify whether they actually are different.

The intention is that the output of this command can be directly used to
remove redundant files, e.g.:

  cd test
  make check-ref-dups | cut -d' ' -f2 | \
      while read f; do git rm "reference/$f"; done

This should have no impact on make check's results (modulo any tests
that behave erratically), and will help trim down the size of the
tarball.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
[ickle: rebase and add the suggested command to the Makefile]
2013-07-04 09:27:55 +01:00
Bryce W. Harrington
8d3c518e9d test: Use cmp to catch byte-by-byte identical files
cmp runs faster than perceptualdiff, and catches files that are exact
copies of the reference image.  We still use perceptualdiff for catching
files that aren't bytewise identical, but are still identical at the
pixel level.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2013-07-04 09:04:17 +01:00
Bryce W. Harrington
b0be0d8d42 test: Add script to check for redundant reference images
This script requires the perceptualdiff program, which can be built as
follows:

  cd test/pdiff && make perceptualdiff

The script's output provides a list of target-specific or
format-specific images that are identical to their more generic
reference files, and thus are redundant and can be safely removed from
the archive without altering any test behaviors.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
[ickle: applied Behdad's suggestion of renaming the script check-refs.sh]
2013-07-04 09:04:05 +01:00
Bryce W. Harrington
7f1be42e85 test: Fix make check-ref-dups due to move of ref images to reference/
The check-ref-dups target in Makefile.am was not updated with the new
path when the reference images were moved from test/ to
test/reference/.  Now it produces output properly again.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2013-07-04 08:57:45 +01:00
Chris Wilson
9ea5993b03 test/get-path-extents: Check exact matches within tolerance
When we refine geometry, we do so to a tolerance as specified by the
user. This means that we can not expect tessellated results to have
exact results, but always they should match within the specified
tolerance.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-20 14:11:38 +01:00
Bryce W. Harrington
d4545910e2 test: Note naming scheme for XFAIL images in README
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2013-06-20 11:00:59 +01:00
Bryce W. Harrington
5271f31991 test: Fix typo in sample_horizontal to use horizontal, not vertical.
Triggers the following warning during build:

sample.c:61:1: warning: ‘horizontal’ defined but not used
 [-Wunused-function]

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2013-06-08 07:52:18 +01:00
Chris Wilson
e34b800214 test: Extend testing of joins for fine lines 2013-06-04 11:52:30 +01:00
Chris Wilson
a2d8524973 test: Expand testing of caps for fine strokes 2013-06-04 11:52:26 +01:00
Behdad Esfahbod
ff233fd706 [test] Set font size
Previously this test was working because we were not scaling bitmap
fonts.  We do now, so adjust test.
2013-03-18 14:18:13 -04: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
Chris Wilson
02b467a287 test: Exercise replaying a recording surface through a flip matrix 2013-02-12 10:46:42 +00:00
Chris Wilson
93ddc3a283 tests: Update reference images after adjustments to polygon line clipping
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-02-10 13:13:31 +00:00
Chris Wilson
350f9fb536 test: Refresh refs for aa noise following reduction of the 2-stage compositing
A side effect of

commit c986a7310b
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Jan 24 08:55:54 2013 +0000

    image: Enable inplace compositing with opacities for general routines

is that we should in theory be reducing the rounding errors when
compositing coverage.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-31 15:15:03 +00:00