Commit graph

2024 commits

Author SHA1 Message Date
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
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