Commit graph

2310 commits

Author SHA1 Message Date
Adrian Johnson
fb6f3eb32e pdf-tagged-text: generate both 1.4 and 1.5 PDFs 2021-07-28 06:18:01 +09:30
Adrian Johnson
6fbfc9d927 pdf: use floating point widths when emitting fonts 2021-07-27 20:13:23 +00:00
Adrian Johnson
6b8d8712fb pdf-tagged-text test: disable object stream compression
to allow the test to find the strings it is looking for.
2021-07-26 18:33:34 +09:30
Adrian Johnson
908b243ab8 Merge branch 'svg-create-for-stream' into 'master'
svg: Fix create-for-stream test case

See merge request cairo/cairo!212
2021-07-25 03:21:03 +00:00
Uli Schlachter
4c6b604bd5 svg: Fix create-for-stream test case
Commit 2fbd53 added another test to create-for-stream that failed for
cairo-pdf. Manual testing shows that this test also fails for cairo-svg.
However, this was not noticed because even before this addition to the
test, create-for-stream already failed for cairo-svg. Since the
introduction on CI was done based on "let's ignore all current
failures", this hid the error.

This commit applies the trivial fix for cairo-svg to make this test
pass. It is basically the same error that cairo-pdf had.

Additionally, this removes the hack to ignore create-for-stream failures
in CI since it is now no longer necessary.

Thanks to Knut Peterson for reporting this [0].

[0]:
https://lists.cairographics.org/archives/cairo/2021-July/029291.html

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-07-24 14:42:26 +02:00
Adrian Johnson
f7c7bcb603 tags: allow links to page numbers not yet created
Previously, forward references were required to use named destinations.

This patch is based on the patch in #336 by Guillaume Ayoub <guillaume.ayoub@kozea.fr>
that converted all links to indirect objects written at the end of the document.

I have reworked the patch so that only forward references to future page numbers are
written as indirect objects. Backward references and named destinations remain as they
are. This is to minimize the number of objects written to the PDF file.

Fixes #336
2021-07-24 21:33:09 +09:30
Uli Schlachter
e689e67004 Fix build on windows
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-07-23 17:32:39 +02:00
Uli Schlachter
2fbd53a6b3 pdf: Properly pass on stdio write errors
cairo-pdf was silently ignoring write errors in
_cairo_pdf_surface_finish(). Any write errors that happened here ended
up setting a "status" variable, but the value in this variable was then
unused.

This commit fixes this bug by passing this error on to the caller.

Additionally, this also adds a test case for this behaviour based on
writing to /dev/full. This file is non-standard and thus the test first
checks that this file exists and is writable before trying to write to
it.

This bug was found based on a report from Knut Petersen [0].

[0]: https://lists.cairographics.org/archives/cairo/2021-July/029281.html

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-07-23 17:22:16 +02:00
Jonathan Kew
a8238adc5a Add link with a negative coordinate to testcase. 2021-07-20 17:53:45 +01:00
Jonathan Kew
84192695f8 Fix use-after-free in pdf-features testcase. 2021-07-19 12:30:17 +01:00
Jonathan Kew
20ef4ec460 Add an example of a link within an empty clip to pdf-tagged-text testcase. 2021-07-19 12:28:14 +01:00
Adrian Johnson
81d7b2e3a4 test: add URL and "rect" attribute to pdf-tagged-text 2021-07-18 18:13:10 +09:30
Uli Schlachter
39db60e957 Merge branch 'build-without-zlib' into 'master'
meson: Use more dependency objects & fix build without zlib

Closes #475

See merge request cairo/cairo!184
2021-06-03 15:26:07 +00:00
afdw
9ab52c9131 Merge branch 'master' into 'svg-backend-work'
# Conflicts:
#   .gitlab-ci.yml
#   test/Makefile.sources
#   test/meson.build
2021-05-29 18:32:53 +02:00
Uli Schlachter
1e34651420 Fix meson build without zlib
Trying to build with meson with -Dzlib=disabled failed with the
following error message:

cairo/test/meson.build:599:2: ERROR: Unknown variable
"libcairoscript_dep".

This commit fixes that problem by adding a not-found dependency if
cairo-script is not built.

Additionally, follow-up problems are fixed:

- any2ppm.c still tried to include cairo-script-interpreter.h, which was
  not found
- Building cairo-test-trace was attempted, but that also failed because
  of missing script support.

Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/475
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-05-22 08:16:47 +02:00
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
Anton Danilkin
c2bf6e8ae4 Fix remaining tests 2021-05-05 00:51:01 +02:00
Anton Danilkin
42128f1742 Fix reference images 2021-05-03 22:13:16 +02:00
Anton Danilkin
5b678d8185 Fix applying shifted operators 2021-05-03 16:33:05 +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
Anton Danilkin
bd487e64fc Add support for CAIRO_CONTENT_COLOR 2021-05-01 23:14:24 +02: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
afdw
cd0082338e Merge branch 'master' into 'svg-backend-work'
# Conflicts:
#   src/cairo-gstate.c
2021-05-01 14:40:52 +00: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
afdw
0cc63f5d49 Merge branch 'master' into 'svg-backend-work'
# Conflicts:
#   src/cairo-malloc-private.h
#   src/cairo-svg-surface.c
2021-04-24 12:30:44 +00: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
Anton Danilkin
917f366ad1 Add a test for #431 2021-04-11 23:59:47 +02:00
Anton Danilkin
ceae137ba6 Finish implementing correct paints in transformed recording patterns 2021-04-11 23:59:47 +02:00
Anton Danilkin
71eef9c8bc Implement the rest of the operators 2021-04-11 23:59:47 +02:00
Anton Danilkin
fa5179e9fd Add a test with operator samples from https://cairographics.org/operators/ 2021-04-11 23:59:47 +02:00
Anton Danilkin
170f8812fb Add a test for #361 2021-04-11 23:59:47 +02: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