Commit graph

157 commits

Author SHA1 Message Date
Carl Worth
b2f274b3e8 New API: Replace cairo_{ps,pdf,svg}_set_dpi with new cairo_surface_set_fallback_resolution.
This just provides the mechanics for storing the value and removing the old
function calls. The new value is still not used anywhere (though nor where
the old values), so there should be no functional change (other than forcing
any programs calling the old API to be updated).
2006-06-09 16:52:17 -07:00
Carl Worth
ef10a0403a Remove initial, final, and duplicate blank lines.
This patch was produced by running git-stripspace on all *.[ch] files
within cairo. Note that this script would have also created all the changes
from the previous commits to remove trailing whitespace.
2006-06-06 15:50:33 -07:00
Carl Worth
5278de0997 Remove all remaining trailing whitespace.
This patch was produced with the following (GNU) sed script:

	sed -i -r -e 's/[ \t]+$//'

run on all *.[ch] files within cairo.

Note that the above script would have also created all the changes
from the previous commits to remove trailing whitespace.
2006-06-06 15:41:31 -07:00
Carl Worth
4670366ede Remove trailing whitespace from lines that look like comments.
This patch was produced with the following (GNU) sed script:

	sed -i -r -e '/^[ \t]*\/?\*/ s/[ \t]+$//'

run on all *.[ch] files within cairo, (though I manually excluded
src/cairo-atsui-font.c which has a code line that appears as a comment
to this script).
2006-06-06 15:35:48 -07:00
Carl Worth
80b8deb1e4 Remove extraneous whitespace from "blank" lines.
This patch was produced with the following (GNU) sed script:

	sed -i -r -e 's/^[ \t]+$//'

run on all *.[ch] files within cairo.
2006-06-06 15:25:49 -07:00
Carl Worth
d0dd3b822e New API: Add new function cairo_surface_get_content
This assumes that the directfb, glitz, and quartz backends
always create surfaces with content of COLOR_ALPHA which might
be totally wrong.
2006-05-24 17:19:00 -07:00
Ian Osgood
57a0242d06 Additional piece of "Fix the XCB backend build for the XCB 0.9 release." 2006-05-04 14:43:03 -07:00
Emmanuel Pacaud
457132fc2b SVG: Don't test rectangle-rounding-error.
This test uses CAIRO_ANTIALIAS_NONE, which is not supported yet by
the SVG backend.
2006-05-04 21:41:36 +02:00
Emmanuel Pacaud
a428f11738 SVG: Fix bug in test suite causing SVG to fail with rgb24 and device offsets.
Same fix as for PDF and PS surfaces.
2006-05-04 14:18:59 +02:00
Carl Worth
a6b1b014bb Implement the device_offset functionality at surface, not gstate layer
This is a mega-patch that has the advantage that the entire test suite
passes both immediately before and immediately after this commit.

The disadvantage of the mega-patch is that it does not reflect the
development history of the device-offset branch, (with its various
fumblings and flailings). To capture that history, we will next merge
in that branch.
2006-05-04 01:45:41 -07:00
Vladimir Vukicevic
b3e2252b94 Augment test framework to test everything under device offsets as well.
[With this change, two tests with gradients exhibit subtle differences
under device offsets. I don't think we actually care about them
though. -cworth]
2006-05-03 23:42:45 -07:00
Emmanuel Pacaud
6a33993b15 Merge branch 'origin' 2006-05-01 22:01:38 +02:00
Emmanuel Pacaud
b920dfd3df SVG: Reenable operator tests, and rgb24 surface are meta-surfaces. 2006-05-01 21:59:53 +02:00
Carl Worth
7110c168f7 Remove redeundant -rgb24-ref.png images.
In several cases the -rgb24 reference images were identical to the -ref images.
So we change the logic to find the latter if the former doesn't exist, and then
we remove the redundant images.
2006-04-26 12:36:22 -07:00
Behdad Esfahbod
f1c3754753 Use white on red for failures. 2006-04-25 09:58:48 -04:00
Behdad Esfahbod
9668b6592f Set background color to red for test failures printing on a terminal. 2006-04-25 09:03:26 -04:00
Carl Worth
bef621e870 Augment tests to do better testing of paths/images with alpha.
Add a new cairo_test_paint_checkered function so that tests that draw
with alpha can easily put an easy-to-see checkered background in place
first.

Add new tests caps-joins-alpha and paint-source-alpha that do simple
tests of strokes and image painting with source pattern alpha.

Also, add the checkered background to paint-with-alpha for
consistency.
2006-04-25 01:56:51 -07:00
Christian Biesinger
e0bf137804 Fix create_xcb_surface signature 2006-04-23 21:22:17 +02:00
Emmanuel Pacaud
62d2f7cbf3 SVG: Return UNTESTED for test involving operators.
unbounded-operator, operator-clear, operator-source, clip-operator
2006-04-17 09:54:03 +02:00
Emmanuel Pacaud
714bb88832 SVG: Add support for CAIRO_CONTENT_COLOR in create_similar.
Also add support for testing this feature in test/cairo-test.c
And a bunch of unwanted commit of sgml files.
2006-04-16 15:42:49 +02:00
Emmanuel Pacaud
e952e0aff8 SVG: Add documentation for public API. Fix test filenames and add testing of CAIRO_CONTENT_COLOR 2006-04-14 22:53:58 +02:00
Carl Worth
c81569d2f1 Flesh test-paginated-surface out into a complete surface.
This adds an aactual test_paginated_surface_backend rather than just
having this test surface create a paginated surface around an image
surface. This is a more realistic test of what a paginated surface is
and should be more useful as an example of how to use the paginated
surface, (and in particular the analysis portions).
2006-04-14 11:05:35 -07:00
Carl Worth
b87726ee2a Tweak initial erase so it doesn't trigger fallbacks for every PS test case.
Add an optimization to cairo-ps-surface.c so that it ignores any
CAIRO_OPERATOR_CLEAR drawing operation that occurs on a blank page.
Also change the test suite to erase with OPERATOR_CLEAR instead of
OPERATOR_SOURCE with an all-0 source pattern.

With this change, 32 of the 61 test cases change from all-fallback to
all-native for the ps backend.

Of these 32 test cases, 13 pass the test suite with the original
reference images. Another 18 cases differ only in the single-pixel
boundary of objects due to cairo vs. ghostscript rasterization
differences. We ignore these by adding new ps-specific reference
images, (included in this commit).

Finally, there appears to be one genuine failure, (dash-caps-joins),
in which the PostScript dashes (at least as rendered by ghostscript)
differ significantly from the cairo-rendered dashes.
2006-04-06 09:43:39 -07:00
Carl Worth
c4fc7b06b5 Revert "Use ghostscript's pngalpha rather than png16m target for PS->PNG"
This reverts 3b873c66be commit.

It seemed like a good idea at the time, but...
The pngalpha target only gets the fully transparent regions correct.
But we still need to get the partially translucent regions correct.
The pngalpha target doesn't help here---instead we were already
flattening the reference image during testing. And in that case,
having anything other than alpha==1 in the output png doesn't really
help, (and meanwhile it was tripping up the current buffer_diff code).
2006-04-06 08:54:59 -07:00
Carl Worth
3b873c66be Use ghostscript's pngalpha rather than png16m target for PS->PNG
This target allows the output files to actually be transparent where
there is no PostScript "ink", which allows for much better testing.
2006-04-05 17:09:45 -07:00
Carl Worth
66ed9811cc Merge branch 'cairo-origin' into analysis-surface
With the string-array-stream stuff that this merge picks up, the
analysis-surface branch is now passing all of the test suite again.
2006-04-04 14:58:52 -07:00
Carl Worth
0114393a13 Explicitly remove the output png image before creating it during testing.
What was happening here is that some backends (such as the PS surface
backend) directly generate an output file, and then run a conversion
process to generate the png file. Some bugs were such that a broken
file would successfully be generated, the conversion would fail (the
failure was unnoticed), and the test suite would happily verify the
old image from a previously successful run.

This fix eliminates this source of false positives.
2006-04-04 11:17:25 -07:00
Carl Worth
1dd6e417c1 Add testing for cairo_surface_get_type.
All test targets now list an expected cairo_surface_type_t. Add notes
on current limitations of PDF/PS/meta-surface support that causes
CAIRO_CONTENT_COLOR similar surfaces of PDF and PS surfaces to be
returned as image surfaces.

Add cairo_internal_surface_type_t for the meta, paginated, and various
test surfaces.
2006-02-28 00:55:27 -08:00
Emmanuel Pacaud
9c05d2aab1 fix filename.
shh!
2006-02-02 12:47:58 +00:00
Christian Biesinger
2afe78c0c2 Don't mix declarations and code. This makes the code valid ISO C, fixes a gcc -pedantic warning, and unbreaks the build with the compiler Zeta ships with. 2006-01-21 09:39:10 +00:00
Carl Worth
074f886c00 Rip the cairo_content_t argument out of ps/pdf_surface_create as per discussion on cairo mailing list. Instead these surface will behave as if CONTENT_COLOR_ALPHA had been passed (that is, compositing operators will behave as if destination alpha were available).
This also has the benefit of preserving the API that has been in place for PS/PDF surface since the (experimental) stuff in 1.0.0.
Track API change.
Continue testing PS/PDF surfaces in the CAIRO_CONTENT_COLOR mode but do it by rendering to an intermediate similar surface rather than constructing the target surface differently.
2006-01-19 17:48:22 +00:00
Carl Worth
c634e54775 Change documentation to recommend cairo_paint rather than cairo_rectangle;cairo_fill for clearing a surface.
Add documentation. Add a cairo_content_t argument to PDF surface constructors.
Add documentation. Add a cairo_content_t argument to PS surface constructors.
Track changes in PS/PDF surface constructor API.
2006-01-18 16:40:17 +00:00
Carl Worth
b5c5fb613d Big change to the test infrastructure and supporting internals. The goal now is to test both a COLOR_ALPHA and a COLOR content for each surface backend, (since the semantics are different and we probably need to support both in each backend.
The PS/PDF backends don't allow a content to be passed in right now, so they fail against the rgb24 tests, but the trivial addition to the constructors will allow them to pass all tests with both content values.
And new constructors (currently internal only) to create an image surface with a cairo_content_t rather than a cairo_format_t.
Add a cairo_content_t argument to the constructor.
Add a cairo_content_t to the constructor and use this content value when constructing intermediate image surfaces in acquire_source, show_page, copy_page, and snapshot.
Add image flattening by compositing over white, as is done in cairo-ps-surface.c.
Track changes to cairo-paginates-surface which now requires a cairo_content_t value (no change to public PS/PDF constructors yet).
Track change in meta-surface and paginated-surface interfaces by now accepting a cairo_content_t rather than a cairo_format_t.
Ignore new output files (argb32 from pdf and ps as well as rgb24 from test-fallback, test-meta, and test-paginated).
Add new utility for flattening PNG images in order to generate the -argbf-ref.png images.
Add image_diff_flattened for comparing flattened output from PS and PDF backend with ARGB reference images by first blending the reference images over white.
Get rid of conditional, format-specific background-color initialization before running tests. Now uses ARGB(0,0,0,0) in all cases. Switch from specifying tests with a format value to specifying tests with a content value. Add support for a 'fake' COLOR_ALPHA_FLATTENED content for testing the PS and PDF output against a flattened version of the argb32 reference images (first blended over white).
Track change in cairo_ps_surface_create (now requires cairo_content_t value).
Adjust tests that draw in default (black) to first paint white so that the results are visible.
Adjust ARGB32 reference images for new white background for changed tests.
Adjust RGB24 reference images for new black background due to changed initialization (and the tests themselves being unchanged).
2006-01-17 16:59:08 +00:00
Vladimir Vukicevic
c6cdfc5770 Clamp surface dimensions to a minimum of 1. (_cairo_glitz_surface_get_image): Set the glitz clip to NULL before calling glitz_get_pixels, to return the full surface contents. Restore clip afterwards. (_cairo_glitz_surface_composite_trapezoid): Return UNSUPPORTED if the antialias is anything other than DEFAULT/GRAY.
Try to recover a standard cairo_format_t from given pixman format masks, so that various things that only work with a standard format work correctly.
Remove cairo_glitz_surface_write_to_png, replace with generic cairo_surface_write_to_png (since it works with image-surface create_with_masks fix)
2006-01-03 09:23:48 +00:00
Michael Emmel
23e5e55841 New directfb backend for cairo includes test suite and example to run the test is in the comment at the top of cairo-test-directfb.c enable with
--enable-directfb
2005-12-29 07:17:01 +00:00
Carl Worth
e71e2fc4f1 Add a private cairo_paginated_surface_t which builds on top of the meta surface and is intended to provide an easy interface with common functionality for the various paginated surface types (ps, pdf, etc.).
Add test_paginated_surface_t which is another test surface enabled with --enable-test-surfaces. The test_meta_surface code served as the basis for cairo_paginated_surface_t so that test surface may be entirely superfluous now.
2005-12-21 16:46:44 +00:00
Carl Worth
75b2fe93f0 Use _cairo_surface_paint rather than _cairo_surface_fill_rectangle as only the former is guaranteed to work with all backends.
Refine the comment describing this test surface.
Add new test surface for exercising cairo_meta_surface.
Simplify the image and test_fallback targets by not using create_for_data. Allow for NULL cleanup target functions. Add support for the test_meta_surface.
2005-12-19 22:01:39 +00:00
Emmanuel Pacaud
ec574cd6f0 CAIRO_CAN_TEST_SVG_SURFACE depends on librsvg.
cairo_svg_surface_t owns a xml node, for support of svg_surface_composite. (_cairo_svg_surface_create_for_document): init xml_node. All surfaces except first one are stored in defs node. (emit_composite_image_pattern): returns pattern size, and don't call emit_transform if is_pattern == TRUE. (emit_composite_svg_pattern): do something. (emit_composite_pattern): returns pattern size. (_cairo_svg_surface_composite): xml_node is stored in cairo_svg_surface_t now. (emit_surface_pattern): emit surface pattern width here. Fix property names. (_cairo_svg_path_close_path): don't close path if no current point. (_cairo_svg_surface_fill_rectangles): new. (_cairo_svg_surface_fill): emit fill rule. xml_node is in surface now. (_cairo_svg_surface_composite_trapezoids): xml_node is in surface now. (_cairo_svg_surface_stroke): ditto. (_cairo_svg_surface_intersect_clip_path): ditto. Emit fill rule.
ignore svg2png.
build svg2png utility.
test SVG backend if CAIRO_HAS_SVG_SURFACE && CAIRO_CAN_TEST_SVG_SURFACE.
new.
2005-12-19 13:59:34 +00:00
Christian Biesinger
6142bc5348 Mention new --enable-svg option
Add notes for the new BeOS backend
Add disabled by default BeOS backend
Add BeOS files
New
New
BEOS_SURFACE_FEATURE
BeOS mutex functions
Ignore files generates by the BeOS tests
Add cairo-test-beos.*
New.
Test BeOS backend.
2005-12-18 17:20:06 +00:00
Carl Worth
c75232f8ab Add a new option --enable-test-surfaces.
New surface backend for testing only. It has as many NULL backend entries as possible.
Add support to test the new test_fallback backend.
2005-12-16 11:31:10 +00:00
Stuart Parmenter
88615148ca #define access _access and #define F_OK to 0 on for MSVC
add CAIRO_BEGIN_DECLS and CAIRO_END_DECLS
2005-12-14 19:56:09 +00:00
Vladimir Vukicevic
c2c4f0bb25 bump glitz req to 0.5.1, test for backends
Add glitz backend (original patches from sunmoon1997@gmail.com), including glx, wgl, and agl support. Add CAIRO_TEST_TARGET environment variable for limiting backends to test.
Takes all *.log files and spits out html to stdout that can be used to view all test results at once.
2005-12-12 11:56:40 +00:00
Carl Worth
45c350e328 Add checks for poppler and friends which are needed by pdf2png. Set CAIRO_CAN_TEST_PDF_SURFACE as both a #define and an automake conditional.
Build pdf2png if possible.
Add support for testing the PDF backend.
New utility program to convert a PDF file into a PNG image using poppler (thanks to Kristian Høgsberg).
Ignore new stuff generated by PDF backend testing.
2005-12-07 16:06:11 +00:00
Carl Worth
96be55124f Fix to check cairo_surface_status rather than !surface which is always false. (cleanup_ps): Fix leak of filename memory. 2005-12-07 11:53:30 +00:00
Stuart Parmenter
49136c04f2 Hooked up tests to run on Windows with a Windows surface 2005-11-17 11:55:20 +00:00
Carl Worth
5b6c912667 Note that PS is now passing all tests except for self-copy.
Add missing glue to hook up PS backend with new meta-surface support for the 5 basic drawing operations. Currently, this forces image fallbacks for all operations.
Switch from gs device of pngalpha to png16m which for some reason gives the correct result for nil-surface now, while pngalpha does not.
Key off of N_OPERATORS as the loop control for easier trimming down of this test case when debugging.
Rename stroke_style parameter to style in backend->stroke parameter list.
Remove PS-specific reference images for many tests which are now using more fallback paths than before.
2005-11-08 17:43:13 +00:00
Carl Worth
94dece56a5 Ignore output of PS tests.
Fix the PS tests to work again, (track change in create_surface interface).
2005-10-08 11:58:20 +00:00
Carl Worth
74af57339c Add missing initialization for ximage.xoffset. 2005-10-06 11:32:54 +00:00
Keith Packard
d3e7dad53e Add rgb24 surface tests, support per-target reference images and support PS surface testing
reviewed by: cworth
2005-09-29 14:31:08 +00:00
Carl Worth
258f6f4903 Add documentation for cairo_test functions.
Abstract log fie creation into cairo_test_init for use by tests that don't use cairo_test().
Add new test for bug #4299 as reported by Alexey Shabalin.
2005-09-13 12:11:32 +00:00