summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Make cairo_tag_begin/end work correctly in groupsAdrian Johnson2023-04-1815-18/+735
| | | | Fixes #508
* Avoid misuse of ctype(3) functionsTaylor R Campbell2023-03-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ctype(3) character classification and mapping functions have a peculiarly limited definition (C11, Sec. 7.4 `Character handling <ctype.h>', p. 200): `The header <ctype.h> declares several functions useful for classifying and mapping characters. In all cases the argument is an int, the value of which shall be representable as an unsigned char or shall equal the value of the macro EOF. If the argument has any other value, the behavior is undefined.' In other words, in the most common case of 8-bit char and EOF = -1, the domain of the 257 allowed arguments is: -1, 0, 1, 2, ..., 254, 255 The ctype(3) functions are designed for use with stdio functions like getchar and fgetc which return int values in the same domain. In an ABI where char is signed (e.g., x86 SysV ABI used by most Unixish operating systems), passing an argument of type char as is can go wrong in two ways: 1. The value of a non-EOF input octet interpreted as `char' may coincide, as an integer, with the value of EOF, leading to wrong answers for some non-EOF inputs. E.g., if EOF = 1, and an input octet has all bits set, i.e., 255 as an unsigned char, then as a char the value is -1, which will be confused with EOF. In the ISO-8859-1 locale, the code point 255 is (in Unicode terminology) LATIN SMALL LETTER Y WITH DIAERESIS, for which isprint, isalpha, &c., are true. But isprint, isalpha, &c., are false for EOF. So if char *s points to a string with that character, isprint(*s) will return false when it should return true. 2. Passing a negative char whose value does not coincide with EOF is undefined behaviour. This isn't purely theoretical: often the functions are implemented by an array lookup, #define isprint(c) (ctypetab[c] & ISPRINT). If c is out of range (e.g., 192, ISO-8859-1 for LATIN CAPITAL LETTER A WITH GRAVE, which convers to (signed) char as -64), then you can get garbage answers by reading uninitialized memory or application crashes with SIGSEGV if the page preceding the table is unmapped. If what you have is an arbitrary char (e.g., from a char * string pointing at user input), then the only correct way to use the ctype(3) functions is by converting to unsigned char first -- e.g., isprint((unsigned char)*s). (If the functions were defined as macros that convert to unsigned char first, they would then spuriously interpret EOF as a non-EOF, so they can't do that themselves.) It is possible, in some cases, to prove that the input always actually lies in {0, 1, 2, ..., 127}, so the conversion to unsigned char is not necessary. I didn't check whether this was the case -- it's safer to just adopt the habit of always casting char to unsigned char first before using the ctype(3) macros, which satisfies a compiler warning on some systems designed to detect this class of application errors at compile-time.
* [quartz] Replace surface-pattern xfail with latest CI fail image.John Ralls2023-02-141-0/+0
|
* Fix -Wlogical-not-parenthesesKhaled Hosny2023-02-061-1/+1
| | | | | | | | | | | | | | | | | The code is doing "if (!double_buf_equal () != 0)" which seems to be a convoluted way to do "if (!double_buf_equal ())". Fixes: ../test/pattern-getters.c:153:6: warning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses] if (!double_buf_equal (ctx, new_buf, expected_values, ^ ../test/pattern-getters.c:153:6: note: add parentheses after the '!' to evaluate the comparison first if (!double_buf_equal (ctx, new_buf, expected_values, ^ ( ../test/pattern-getters.c:153:6: note: add parentheses around left hand side expression to silence this warning if (!double_buf_equal (ctx, new_buf, expected_values, ^ (
* Remove dead codeKhaled Hosny2023-02-041-63/+0
| | | | | This is no-op as the functions always return TRUE and the code is never executed.
* Fix -Wunused-but-set-parameterKhaled Hosny2023-02-041-0/+3
| | | | | ../test/cairo-test-runner.c:730:48: warning: parameter 'str' set but not used [-Wunused-but-set-parameter] _has_required_ghostscript_version (const char *str)
* Merge branch 'pdf-color-fonts' into 'master'Adrian Johnson2023-02-0214-0/+0
|\ | | | | | | | | PDF Type 3 color fonts See merge request cairo/cairo!434
| * PDF Type 3 color fontsAdrian Johnson2023-01-2914-0/+0
| | | | | | | | | | | | | | | | | | This implements Type 3 color fonts for PDF for any font with a CAIRO_SCALED_GLYPH_INFO_RECORDING_SURFACE. This includes user-fonts, SVG fonts, and COLR fonts. Glyphs with foreground colors are not yet implemented as Type 3 glyphs and will be rendered as images by cairo-surface.
* | meson: Replace existing link if it already existsAdrian Johnson2023-02-011-1/+1
|/ | | | Fixes #631
* Merge branch 'no-more-gl' into 'master'Emmanuele Bassi2023-01-298-697/+0
|\ | | | | | | | | Drop cairo-gl See merge request cairo/cairo!287
| * Drop cairo-glEmmanuele Bassi2023-01-278-697/+0
| | | | | | | | | | | | | | | | | | The GL support in Cairo has always been a prototype, and nothing happened in the past 10+ years to make it work as it was meant to. GL support is not enabled by any downstream packagers of Cairo, so nobody should notice its absence.
* | svg: test foreground colorsAdrian Johnson2023-01-2713-9/+57
| | | | | | | | | | Convert the ft-svg-render-palette test to a color test that test both palettes and foreground colors.
* | Foreground color fixes for ft, svg, colrv1Adrian Johnson2023-01-272-11/+156
|/
* Update user font tests to test foreground colorsAdrian Johnson2023-01-2619-117/+195
|
* Add test for SVG font palettesAdrian Johnson2023-01-216-1/+326
|
* Merge branch 'fix-shared-recording-surface' into 'master'Adrian Johnson2023-01-166-0/+441
|\ | | | | | | | | Fix shared use of recording surfaces See merge request cairo/cairo!391
| * pdf-tagged-text depends on PDFAdrian Johnson2023-01-151-0/+5
| |
| * Add a test that demonstrates a recording surface bug when re-used on ↵Adrian Johnson2023-01-155-0/+436
| | | | | | | | | | | | | | | | | | different surfaces There is a bug in the recording surface where if one recording surface is used as the same source on different paginated targets that support fine grained fallbacks, the output may be incorrect because the analysis results of a previous target are re-used on another target.
* | Merge branch 'meson-and-doc-fixes' into 'master'Adrian Johnson2023-01-162-14/+28
|\ \ | | | | | | | | | | | | Meson and documentation fixes See merge request cairo/cairo!406
| * | We don't use HAVE_CONFIG_H anymoreAdrian Johnson2023-01-151-1/+1
| | |
| * | README fixesAdrian Johnson2023-01-151-13/+27
| |/
* | Add test for loading 16 bit PNG imagesManuel Stoeckl2023-01-115-0/+81
|/ | | | | | | The base image has 16 bits per channel, with colors that do not have an exact corresponding 8 bit representation. The reference image uses 8bpc, like the rgb24/argb32 formatted images which the test outputs.
* Rename INSTALL.meson and README.mesonAdrian Johnson2023-01-081-0/+0
|
* Remove autotools buildAdrian Johnson2023-01-087-1336/+0
|
* Merge branch 'foreground-color-in-group' into 'master'Adrian Johnson2023-01-0312-2/+48
|\ | | | | | | | | User-fonts fails when foreground color used inside a group See merge request cairo/cairo!380
| * Fix user-font with foreground in group failures on image, PDF, and PSAdrian Johnson2023-01-0311-0/+0
| |
| * user-font-color test: draw glyphs again inside a groupAdrian Johnson2023-01-011-2/+48
| | | | | | | | | | This demonstrates a bug in user-fonts with foreground color inside a group.
* | Merge branch 'test-readme' into 'master'Adrian Johnson2023-01-022-2/+331
|\ \ | | | | | | | | | | | | Add README.meson file for meson test See merge request cairo/cairo!385
| * | Add README.meson file for meson testAdrian Johnson2023-01-021-0/+329
| | |
| * | Copy completion.bash to $builddir/testAdrian Johnson2023-01-011-2/+2
| |/
* | Merge branch 'duplicate-ref-images' into 'master'Uli Schlachter2023-01-0224-0/+6
|\ \ | |/ |/| | | | | Remove duplicate reference images & run check-refs.sh in CI to ensure that no new duplicate images are added See merge request cairo/cairo!384
| * Run check-refs.sh in CIUli Schlachter2022-12-311-0/+6
| | | | | | | | | | | | | | | | The check-refs.sh script detects duplicate reference images. This commit adds it to be run by CI. For this, the script is extended with a proper exit code. Signed-off-by: Uli Schlachter <psychon@znc.in>
| * Remove duplicate reference imagesUli Schlachter2022-12-3123-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Running test/check-refs.sh reports: redundant: arc-direction.pdf.ref.png and arc-direction.ref.png are byte-by-byte identical files redundant: big-little-triangle.traps.argb32.ref.png and big-little-triangle.argb32.ref.png are byte-by-byte identical files redundant: big-little-triangle.traps.rgb24.ref.png and big-little-triangle.rgb24.ref.png are byte-by-byte identical files redundant: clip-fill-rule.pdf.rgb24.ref.png and clip-fill-rule.rgb24.ref.png are byte-by-byte identical files redundant: dash-offset-negative.pdf.ref.png and dash-offset-negative.ref.png are byte-by-byte identical files redundant: font-matrix-translation.traps.ref.png and font-matrix-translation.ref.png are byte-by-byte identical files redundant: ft-show-glyphs-positioning.traps.ref.png and ft-show-glyphs-positioning.ref.png are byte-by-byte identical files redundant: ft-show-glyphs-table.traps.ref.png and ft-show-glyphs-table.ref.png are byte-by-byte identical files redundant: glyph-cache-pressure.traps.ref.png and glyph-cache-pressure.ref.png are byte-by-byte identical files redundant: inverse-text.traps.ref.png and inverse-text.ref.png are byte-by-byte identical files redundant: line-width-large-overlap-offset.ps.ref.png and line-width-large-overlap-offset.ref.png are byte-by-byte identical files redundant: partial-clip-text-right.traps.ref.png and partial-clip-text-right.ref.png are byte-by-byte identical files redundant: partial-clip-text-top.traps.ref.png and partial-clip-text-top.ref.png are byte-by-byte identical files redundant: record90-fill-alpha.pdf.ref.png and record90-fill-alpha.ref.png are byte-by-byte identical files redundant: record90-paint-alpha-clip.quartz.ref.png and record90-paint-alpha-clip.ref.png are byte-by-byte identical files redundant: record-fill-alpha.pdf.ref.png and record-fill-alpha.ref.png are byte-by-byte identical files redundant: recordflip-whole-fill-alpha.quartz.ref.png and recordflip-whole-fill-alpha.ref.png are byte-by-byte identical files redundant: recordflip-whole-paint-alpha-clip-mask.quartz.ref.png and recordflip-whole-paint-alpha-clip-mask.ref.png are byte-by-byte identical files redundant: record-mesh.ps.ref.png and record-mesh.ref.png are byte-by-byte identical files redundant: select-font-face.traps.ref.png and select-font-face.ref.png are byte-by-byte identical files redundant: show-glyphs-advance.traps.ref.png and show-glyphs-advance.ref.png are byte-by-byte identical files redundant: show-text-current-point.traps.ref.png and show-text-current-point.ref.png are byte-by-byte identical files redundant: text-antialias-gray.traps.ref.png and text-antialias-gray.ref.png are byte-by-byte identical files This commit removes these redundant files. Signed-off-by: Uli Schlachter <psychon@znc.in>
* | Merge branch 'speed-up-coverage-column-triangles' into 'master'Uli Schlachter2022-12-314-60/+62
|\ \ | | | | | | | | | | | | | | | | | | Speed up coverage-column-triangles test Closes #498 See merge request cairo/cairo!379
| * | Speed up coverage-column-triangles testUli Schlachter2022-12-304-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit changes the height of the coverage-column-triangles test by using a smaller height for the test. Previously the image was 40 pixels in height and the test took 517 seconds for me. Now, the image has a height of 4 pixels and the test takes 55 seconds. This is possible since column_triangles() does the same thing for each y coordinate. Thus, previously this test just did the same thing 40 times. Times are measured with the backends I happened to have enabled locally: script, xcb, xlib, image, recording. Thanks a lot to Christian Rohlfs for coming up with this idea in https://gitlab.freedesktop.org/cairo/cairo/-/issues/498#note_1700197 Possibly-fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/498 Signed-off-by: Uli Schlachter <psychon@znc.in>
| * | coverage.c: Use width/height argumentsUli Schlachter2022-12-301-59/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The tests in coverage.c have #defines for WIDTH and HEIGHT, but also have function arguments for these numbers. This commit changes the tests to use the function arguments instead of the defines. One complication is the rhombus test that already had a factor 2 between these two numbers. A new variable is added to get back the previous value. Signed-off-by: Uli Schlachter <psychon@znc.in>
* | | Merge branch 'script-bug-277' into 'master'Uli Schlachter2022-12-313-2/+98
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | script: Implement device finish Closes #277 See merge request cairo/cairo!292
| * | script: Implement device finishUli Schlachter2022-03-083-2/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this commit, calling cairo_device_finish() on a cairo-script context did not actually do anything in the backend. Thus, it was possible to continue emitting output on the script context even after it was finished, which means that API user had no way of preventing use-after-free bugs in their write callback. Bug 277 triggers this via detaching a snapshot, but I guess one could also simply continue drawing to a script surface. This commit implements the finish function by closing the underlying stream. However, that was not enough to fix things. This commit also turns writing into a stream into a no-op after the stream was closed. I checked that the new test case actually fails before this commit and is indeed fixed by it. Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/277 Signed-off-by: Uli Schlachter <psychon@znc.in>
* | | Merge branch 'ft-svg-fonts' into 'master'Adrian Johnson2022-12-3198-1/+5760
|\ \ \ | | | | | | | | | | | | | | | | Support SVG fonts in FT backend See merge request cairo/cairo!319
| * | | FuzzerAdrian Johnson2022-12-284-0/+94
| | | |
| * | | ft-svg-render testAdrian Johnson2022-12-2886-0/+4806
| | | |
| * | | SVG font test using cairo logoAdrian Johnson2022-12-286-1/+701
| | | |
| * | | FT SVG color font testAdrian Johnson2022-12-285-0/+159
| | | |
* | | | Merge branch 'round-join' into 'master'Uli Schlachter2022-12-291-0/+0
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | Remove `round-join-bug-520*` CI exceptions for Quartz backend See merge request cairo/cairo!377
| * | | | Removed `round-join-bug-520*` CI exceptions for Quartz backendChristian Rohlfs2022-12-281-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | Removed lines from `.gitlab-ci/ignore-quartz*`; Added `round-join-bug-520-bevel.quartz.ref.png` file.
* | | | | Test cairo-ps in CIUli Schlachter2022-12-281-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the necessary dependencies for testing cairo-ps to CI and sets up jobs for testing the ps2 and ps3 backends. Signed-off-by: Uli Schlachter <psychon@znc.in>
* | | | | Merge branch 'round-join' into 'master'Uli Schlachter2022-12-289-0/+111
|\ \ \ \ \ | |/ / / / | | | | | | | | | | | | | | | Fix for round joins See merge request cairo/cairo!372
| * | | | test: Add new `round-join-bug-520` testsChristian Rohlfs2022-12-289-0/+111
| |/ / / | | | | | | | | | | | | https://gitlab.freedesktop.org/cairo/cairo/-/issues/520
* | | | Bash completion for cairo-test-suiteAdrian Johnson2022-12-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Usage: $ source completion.bash
* | | | Merge branch 'bug-535' into 'master'Adrian Johnson2022-12-284-0/+53
|\ \ \ \ | |/ / / |/| | | | | | | | | | | | | | | | | | | Fix bug #535 in cairo-script Closes #535 See merge request cairo/cairo!276