Commit graph

2184 commits

Author SHA1 Message Date
Uli Schlachter
1981fb6dfb meson: Use more dependency objects
For example, to depend on cairo-script, inccairoscript was added to
"include_directories:" and libcairoscript was added to "link_with:".
This commit instead uses the libcairoscript_dep dependency everywhere.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-05-22 07:59:52 +02:00
Uli Schlachter
4f61b765c9 Merge branch 'record-png-offset' into 'master'
Add a test case for commit d07fb41056

See merge request cairo/cairo!122
2021-05-02 14:55:48 +00:00
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
Emmanuele Bassi
8336309794 meson: Define HAVE_CONFIG_H as a project flag
Precisely what Autotools does, instead of adding it as per-target C
argument.

Once we remove HAVE_CONFIG_H checks in every source file, we'll be able
to drop it.
2021-05-01 16:55:38 +01:00
Uli Schlachter
8f6cfe4177 Merge branch 'ci-test-x11' into 'master'
CI: Check test results for cairo-xcb and cairo-x11

See merge request cairo/cairo!165
2021-04-30 12:12:22 +00:00
Uli Schlachter
64e1fd70ec Merge branch 'ebassi/warnings-fixes' into 'master'
Avoid a bunch of compiler warnings

See merge request cairo/cairo!166
2021-04-27 16:30:44 +00:00
Emmanuele Bassi
0bbb9de806 Disable deprecation warnings from librsvg
This is a test utility, we don't really care about deprecations.
2021-04-27 16:54:22 +01:00
Emmanuele Bassi
966b4a4e5f Handle new Cairo formats in test-trace
We are missing RGB96F and RGBA128F.
2021-04-27 16:50:56 +01:00
Uli Schlachter
14385eeff3 Merge branch 'mac-tests' into 'master'
Run the test suite on MacOS

See merge request cairo/cairo!160
2021-04-26 16:06:23 +00:00
Uli Schlachter
4d3dfb7bcb .gitlab-ci.yml: Ignore current X11 test failures
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-04-25 11:05:59 +02:00
Uli Schlachter
2d2f73bc3c Run the test suite on MacOS
This adds the necessary commands to run the test suite on MacOS in CI
and to also ignore the current failures.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-04-22 16:14:37 +02:00
Uli Schlachter
0392dd783c Ignore create-for-stream failure with svg
The create-for-stream test verifies that writing something to a file and
writing it to an in-memory surface produces the same output. The test
currently fails when the svg backend is tested with:

TEST: create_for_stream TARGET: pdf RESULT: PASS
svg: Stream based output differ from file output for output/create-for-stream.out.svg.
TEST: create_for_stream TARGET: svg RESULT: FAIL

I guess this is because svg uses unique IDs for surfaces, meaning that
drawing two times the same thing in the same process can produce
different outputs. However, this is just a guess and I didn't
investigate further.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-04-18 13:00:07 +02:00
Uli Schlachter
2f8b5bc7b2 Add hack to ignore a svg test crashes
This adds a special hack to the test suite to ignore the crashes for
self-copy and self-copy-overlap for the svg backend in CI.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-04-18 12:25:13 +02:00
Uli Schlachter
a31c7395a1 test-suite: Add a new mechanism for XFAILs
This commit adds a new mechanism to mark tests as expected to fail via
an environment variable. For example, if you expect the tests "foo" and
"bar" to fail when run under image.argb32, you would set

   CAIRO_TEST_IGNORE_image_argb32=foo,bar

The test suite then expects these tests to fail and treats this as
xfail. If they do not fail, this is a failure on its own.

This new feature is explicitly not documented much, because it is only
used as a stopgap measure to make our CI more useful: Right now the test
suite runs on CI, but the result is ignored. This new feature allows to
mark the known failures as xfail without too much work. When the
situation changes, this will be noticed as a new test suite failure.
Thus, these environment variables to not run into the danger of still
containing tests that were already fixed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-04-17 10:01:17 +00:00
Uli Schlachter
753ea90ac1 Add a test case for commit d07fb41056
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-04-01 17:02:48 +02:00
Uli Schlachter
33cce5dc37 Merge branch 'pdf-mime-data' into 'master'
"Fix" the pdf-mime-data test

See merge request cairo/cairo!142
2021-03-25 15:51:13 +00:00
Uli Schlachter
5090dc3f4a Merge branch 'flush-in-tests' into 'master'
test suite: fflush() before fork()

See merge request cairo/cairo!139
2021-03-25 15:50:22 +00:00
Uli Schlachter
2f25fa68c0 test/pdf-mime-data.c: Check for pdfimages
Currently, the pdf-mime-data check just fails for me with the following
output:

    sh: 1: pdfimages: not found
    pdf-mime-data: FAIL

pdf-mime-data.log contains:

    pdfimages failed with exit status 32512

Since I do not have pdfimages installed... yeah.

This commit "fixes" that problem by skipping the test if pdfimages is
not available. No idea if it would pass if it were available, but I do
not feel like installing pdfimages just to test.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-03-08 17:31:37 +01:00
Uli Schlachter
2a8d90c6fc pdf-mime-data: Fix for out-of-tree builds
This makes the code use the existing helper for loading PNGs that also
considers the $srcdir environment variable. This makes it find the file
in out of tree builds.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-03-08 17:27:52 +01:00
Uli Schlachter
0c64c216aa pdf-mime-data: Fix error checking
I am not quite sure, but an if for "ignore this error if something
failed" seems wrong. Either this should have compared against status2 or
checked for success. This commit fixes the code for the latter.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-03-08 17:26:50 +01:00
Uli Schlachter
433d9eb109 Update the PDF size limit in mime-unique-id
The test mime-unique-id checks that some images are only embedded once
in a PDF. It does so by checking if the file size is within some
expected bounds. However, the test fails for me because the file is too
small. Yes, too *small*.

Fix this by updating the test to expect my current file size.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-03-08 16:30:33 +01:00
Uli Schlachter
0fd2197e2b test/mime-unique-id: Fix for out-of-tree builds
Instead of failing because it did not find an image, this now fails for
me since the PDF is too small (???).

This new code is modelled after cairo_test_create_surface_from_png().

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-03-08 16:28:51 +01:00
Uli Schlachter
446d3972e5 test suite: fflush() before fork()
Forking a process also duplicates the buffers of FILE*s. Thus, if there
is pending data, both the parent and the child process will write
things. This is seldom a good idea.

This issue was not noticed so far since by default the test suite
already calls fflush() a lot. However, when stdout and stderr are both
not a tty (according to isatty(1) and isatty(2)), these flushes are
skipped. The result is that the child process repeat the full output
from the test suite starting with "Compiled against cairo 1.17.4,
running on 1.17.4."

To reproduce this problem run: ./cairo-test-suite 2>&1 | cat

Fix this by flushing all the files that I managed to find before fork().

Thanks to Pekka Paalanen for helping me figure this out.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-03-08 13:45:07 +01:00
Tim-Philipp Müller
9732f4e80f meson: use encoding=utf-8 when reading/writing files in helper script
Fixes errors such as

Traceback (most recent call last):
  File "C:\Users\...\cairo\test\make-cairo-test-constructors.py", line 19, in <module>
    for l in f.readlines():
  File "c:\python39\lib\encodings\cp1253.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 6694: character maps to <undefined>

on non-English-language Windows locales/installations.
2021-02-23 23:42:11 +00:00
Heiko Lewin
9e84988f41 Merge branch 'fix-448-test' into 'master'
Make the test case for bug 448 pass

See merge request cairo/cairo!123
2021-02-21 16:09:28 +00:00
Uli Schlachter
92fa421261 Merge branch 'small-build-system-fixes' into 'master'
Small build system fixes

See merge request cairo/cairo!111
2021-02-14 09:18:27 +00:00
Uli Schlachter
ee43299276 Make the test case for bug 448 pass
Someone apparently forgot to actually add the reference image. And also
forgot to add the test to meson. Sigh.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-02-06 16:40:48 +01:00
Heiko Lewin
fb017cc73a test/path-precision.c: Correct initialization, error margin for comparisons 2021-02-04 01:39:15 +01:00
Heiko Lewin
a88696ed15 Merge branch 'extend-test-pdf-tagged-text' into 'master'
Add tests for PDF metadata

See merge request cairo/cairo!100
2021-01-19 11:12:27 +00:00
Uli Schlachter
414d0aee10 Merge branch 'fix-compiler-warnings-in-test-suite' into 'master'
Fix compiler warnings in test suite

See merge request cairo/cairo!98
2021-01-06 13:41:30 +00:00
Sven Neumann
4e02f705e4 Add tests for PDF metadata
Extend the "pdf-tagged-text" test so that it does some basic checks
on the PDF file it creates. This covers the date fields as well as
some other metadata. More checks can and should be added.
2021-01-04 18:04:27 +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
Uli Schlachter
a1dc600a07 Fix copying tags in a recording surface
The code was copying from the wrong member of an union. This caused a
huge num_dashes value to be read, which then caused a so large memory
allocation that malloc returned an error.

Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/448
Signed-off-by: Uli Schlachter <psychon@znc.in>
2020-12-26 19:11:31 +01:00
Uli Schlachter
8481452510 test/meson.build: Add missing tests
These are entries that are present in test/Makefile.sources, but are
missing from test/meson.build.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2020-12-15 18:59:31 +01:00
Uli Schlachter
3a77858dbd test/Makefile.sources: Use tabs for indentation
Signed-off-by: Uli Schlachter <psychon@znc.in>
2020-12-15 18:59:10 +01:00
Heiko Lewin
0677e0a949 Add meson support 2020-12-15 18:14:35 +01:00
Heiko Lewin
8bc14a6bba Minor cleanups 2020-12-15 17:14:18 +01:00
Heiko Lewin
03a820b173 Fix mask usage in image-compositor 2020-12-15 16:48:19 +01:00
Tim-Philipp Müller
4ea2991a40 Retire dummy cairo-version.h header to fix meson subproject build
It was originally added to make bisecting easier,
but has outlived its usefuleness now.

Going forward we'll have just a single cairo-version.h
header file, the one with the real version numbers.

This is needed to fix the case where cairo is being
built as a Meson subproject, but also simplifies
things in general.

Fixes #421
2020-09-29 15:50:53 +00:00
George Matsumura
9a3ad1df1c build: Include correct poll.h
Including sys/poll.h when poll.h is available produces a compile
warning on some systems, but only sys/poll.h is present on others
such as AIX. This makes sure the most suitable poll.h is included
in each situation.

Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
2020-09-05 12:15:57 +00:00
George Matsumura
c8d82cffdf svg2png: Remove deprecated handle closing function call
rsvg_handle_close is no longer required after creating a handle with
rsvg_handle_new_from_file. It causes a deprecation warning during
compilation as well. This change removes it.

Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
2020-09-02 10:29:04 +00: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
596a82f2d1 Add meson build definitions
Co-Authored by:
Nirbheek Chauhan <nirbheek@centricular.com>
lb90 <luca.bacci982@gmail.com>
Tim-Philipp Müller <tim@centricular.com>
2020-07-31 12:21:50 +01:00
Mathieu Duponchelle
a75f8df957 Fix build on Windows with recent versions of MSVC
- vsnprintf and snprintf are available since vs2015
- define ISREG if not provided
- guard unistd.h include with HAVE_UNISTD_H
- isnan() is available after vs2010
2020-07-31 01:21:01 +01:00
Uli Schlachter
4777f9cd5f Merge branch 'fix-build-rule-for-font-variations' of gitlab.freedesktop.org:mpsuzuki/cairo 2020-07-20 18:32:33 +02:00
Uli Schlachter
e0f9db9459 Merge branch 'master' of gitlab.freedesktop.org:ffontaine/cairo 2020-07-20 18:30:45 +02:00
Mathieu Duponchelle
1676935768 raster-source: fix when builddir != srcdir
When the build dir is different from the source dir,
"png.png" is not a valid path. As we can't dispose of
an allocated filename, we add an atexit handler.
2020-07-18 19:47:27 +01: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
Fabrice Fontaine
cb2357f481 test: fix build when SHOULD_FORK is false
The code in test/cairo-test-runner.c properly takes into account
platforms that do have fork() support, and uses the SHOULD_FORK define
to know whether fork is available or not.

However, this SHOULD_FORK macro is used to guard the inclusion of
<unistd.h>, which is needed to get the prototype of other functions
(namely readlink and getppid), that are used in portions of this file
not guarded by SHOULD_FORK.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[Retrieved from:
https://git.buildroot.net/buildroot/tree/package/cairo/0001-fix-nofork-build.patch]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-02-03 21:24:25 +01:00