Commit graph

21 commits

Author SHA1 Message Date
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
Uli Schlachter
b9e5cd9572 create-from-png*: Test mark_dirty with mime data
This currently hits the following assertion:

lt-cairo-test-suite: cairo-surface.c:1381: cairo_surface_mark_dirty_rectangle:
Assertion `! _cairo_surface_has_mime_data (surface)' failed.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41409

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-10-09 09:21:13 +02:00
Chris Wilson
7e5e2dd5e1 test/create-from-png: Update to point to new reference/ images
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-23 13:20:14 +01:00
Chris Wilson
aee71e2063 [test] Memfault checks.
Don't assume an error means the test failed, check for injected allocation
errors.
2009-03-30 13:41:00 +01:00
Chris Wilson
992f74d884 [test] Use '.' as the field separator in the names
We frequently use '-' within the test name or format name and so we
encounter confusion as '-' is also used as the field separator. At times
this has caused a new test to break an old test because the new test would
match one of the old test's target specific reference images. So switch
everything over to use '.' between fields (test name, target, format,
subtest, etc.).
2008-10-31 13:50:55 +00:00
Chris Wilson
e90073f7dd [test] Build test suite into single binary.
Avoid calling libtool to link every single test case, by building just one
binary from all the sources.

This binary is then given the task of choosing tests to run (based on user
selection and individual test requirement), forking each test into its own
process and accumulating the results.
2008-10-31 12:30:11 +00:00
Adrian Johnson
05fce5bced PS/PDF: Set image Interpolation flag
If the filter mode is anything other than DEFAILT, FAST or NEAREST set the
Interpolate flag in the image dictionary so that a smoothing filter is
applied when rasterising the vector file.

As we have no control over the implementation of the Interpolate filter
(the PS/PDF specifications leave it undefined) we need to capture the
output of poppler/GS and update our reference images. (For a couple of
tests, the filtering is irrelevant so for those we set the filter to
NEAREST.)

Note that GhostScript's Interpolate filter does not work on rotated images
(and a variety of other transformations) so several of the PS reference
images have use nearest-neighbour sampling instead of a bilinear filter.
2008-10-30 21:24:54 +00:00
Chris Wilson
37bca38772 [test/create-from-png] Return the failure.
Having checked all the possible PNG formats, report any failures.
2008-08-17 15:30:51 +01:00
Chris Wilson
436c0c8be2 [test] Preparatory work for running under memfault.
In order to run under memfault, the framework is first extended to handle
running concurrent tests - i.e. multi-threading. (Not that this is a
requirement for memfault, instead it shares a common goal of storing
per-test data).  To that end all the global data is moved into a per-test
context and the targets are adjusted to avoid overlap on shared, global
resources (such as output files and frame buffers). In order to preserve
the simplicity of the standard draw routines, the context is not passed
explicitly as a parameter to the routines, but is instead attached to the
cairo_t via the user_data.

For the masochist, to enable the tests to be run across multiple threads
simply set the environment variable CAIRO_TEST_NUM_THREADS to the desired
number.

In the long run, we can hope the need for memfault (runtime testing of
error paths) will be mitigated by static analysis. A promising candidate
for this task would appear to be http://hal.cs.berkeley.edu/cil/.
2008-08-13 21:54:59 +01:00
Chris Wilson
a313547f6d [test/create-from-png] Check loading of various colour types.
Check that when loading from index/gray/rgb PNGs, with and without
alpha/transparency, that the correct surface is generated by read_png(),
i.e. if the PNG contains an alpha channel then the image must be an
ARGB32 surface.
2008-04-21 19:44:11 +01:00
Chris Wilson
1469de5211 [cairo-png] Propagate error from read and write funcs.
Use the png_struct->error_ptr to propagate the error status from the
user/stdio read and write functions through the png_error() to the
cairo_surface_write_to_png*() and cairo_surface_read_from_png*()
functions. From there the error is returned back to the user either
directly or as the most appropriate error surface.

(Fixes https://bugs.freedesktop.org/show_bug.cgi?id=6909)
2007-09-25 23:45:39 +01:00
Behdad Esfahbod
cf1b23a4c5 Add prototype for draw in each test file and remove it from the header. 2006-07-13 12:58:24 -04:00
Behdad Esfahbod
973d3a3d14 More test suite infrastructure improvements:
- Remove cairo_test_expect_failure.  cairo-test.c now checks
  env var CAIRO_XFAIL_TESTS to see if the running test is
  expected to fail.  The reason for expected failure is
  appended to the test description.
- Test description is written out.
- Failed/crashed tests also write a line out to stderr (in red),
  so one can now redirect stdout to /dev/null to only see failures.
- cairo_test() has been changed to not take the draw function
  anymore, instead, draw function is now part of the test struct.
- "make check" doesn't allow limiting backends to test using env
  var anymore.  To limit backends to test, one should use the
  TARGETS variable on the make command line.
- "make check-valgrind" now writes its log to valgrind-log instead
  of valgrind.log, to not interfere with test log file processing.
2006-07-11 22:19:39 -04:00
Carl Worth
a83124a3ee Fix so that one of three different error status values will be returned:
CAIRO_STATUS_NO_MEMORY CAIRO_STATUS_FILE_NOT_FOUND CAIRO_STATUS_READ_ERROR
Add new CAIRO_STATUS_FILE_NOT_FOUND.
Add new _cairo_surface_nil_read_error and _cairo_surface_nil_file_not_found.
Test the new FILE_NOT_FOUND error.
2005-07-28 10:41:08 +00:00
Carl Worth
8cb451962b Fix typo that caused cairo_image_surface_create_from_png_stream to segfault. Closes bug #3863 (thanks to Steve Chaplin).
Add a test to actually call cairo_image_surface_create_from_png_stream.
2005-07-27 09:23:29 +00:00
Carl Worth
574b702029 Rename create-for-png test to create-from-png to match the naming of the cairo_image_surface_create_from_png function. 2005-07-14 11:17:12 +00:00
Carl Worth
b05c85eafb Removing mucking around with stderr and add a cairo_test_log function instead.
Switch all error messages from fprintf(stderr,...) to cairo_test_log(...).
2005-05-10 20:25:38 +00:00
Carl Worth
05ccd76854 Originally 2005-04-20 Carl Worth <cworth@cworth.org>
Remove cairo_show_surface. Add new cairo_set_source_surface.
Remove _cairo_gstate_show_surface.
Replace calls to cairo_show_surface with cairo_set_source_surface; cairo_paint.
Fix messages to prefer - over _.
Fix documentation.
Three new tests to exercise set_source_surface more completely, (two of these are expected failures dues to outstanding bugs).
2005-05-03 08:33:32 +00:00
Carl Worth
618792c8c0 Add very simple test to generate PDF output, (no automated verification yet).
Track PNG interface changes, (no more include of cairo-png.h, cairo_surface_write_png renamed to cairo_surface_write_to_png).
2005-04-26 09:43:39 +00:00
Kristian Høgsberg
87009d692b Factor out bulk of the code into a new callback based function, write_png(). Call it with a stdio write callback. (cairo_surface_write_png_to_stream): New function to write a surface to a PNG stream. (cairo_image_surface_create_from_png): Likewise, move most of the code to read_png(), clean up error handling and reduce this function to calling read_png() with a stdio based read function. (cairo_image_surface_create_from_png_stream): New function to create an image surface from a PNG stream.
New functions to get widht and height of an image surface.
Add new prototype and error codes.
Adjust to new PNG API.
2005-04-25 20:42:54 +00:00
Carl Worth
a6d9b6a671 Change type of data parameter from char* to unsigned char*.
Propagate the unsigned char* change down the stack.
Add cast since XImage uses char* rather than unsigned char*.
Fix memory leak of image data.
Switch to use cairo_surface_write_png rather than a custom write_png_argb32.
Add test to exercise the cairo_image_surface_create_for_png function.
2005-04-04 09:47:12 +00:00