summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am84
-rw-r--r--test/Makefile.in402
-rw-r--r--test/a1-image-sample-ref.pngbin0 -> 148 bytes
-rw-r--r--test/a1-image-sample.c83
-rw-r--r--test/a1-traps-sample-ref.pngbin0 -> 148 bytes
-rw-r--r--test/a1-traps-sample.c72
-rw-r--r--test/a8-mask.c135
-rw-r--r--test/bitmap-font.c103
-rw-r--r--test/cairo-test.c4
-rw-r--r--test/cairo-test.h2
-rw-r--r--test/dash-curve-ref.pngbin0 -> 39642 bytes
-rw-r--r--test/dash-curve.c74
-rw-r--r--test/extend-reflect-similar-ref.pngbin0 -> 153571 bytes
-rw-r--r--test/extend-reflect-similar.c56
-rw-r--r--test/extend-reflect.c2
-rw-r--r--test/extend-repeat-ref.pngbin0 -> 108622 bytes
-rw-r--r--test/extend-repeat-similar-ref.pngbin0 -> 108622 bytes
-rw-r--r--test/extend-repeat-similar.c56
-rw-r--r--test/extend-repeat.c34
-rw-r--r--test/fill-rule-ps-rgb24-ref.pngbin0 -> 2031 bytes
-rw-r--r--test/font-matrix-translation.c44
-rw-r--r--test/font-options.c91
-rw-r--r--test/get-path-extents.c174
-rw-r--r--test/get-xrender-format.c115
-rw-r--r--test/in-fill-trapezoid.c86
-rw-r--r--test/meta-surface-pattern-pdf-ref.pngbin0 -> 4111 bytes
-rw-r--r--test/meta-surface-pattern-pdf-rgb24-ref.pngbin0 -> 4009 bytes
-rw-r--r--test/pattern-getters.c32
-rw-r--r--test/rectangle-rounding-error-ref.pngbin298 -> 231 bytes
-rw-r--r--test/rectilinear-miter-limit-ref.pngbin0 -> 177 bytes
-rw-r--r--test/rectilinear-miter-limit.c80
-rw-r--r--test/rotate-image-surface-paint-ref.pngbin232 -> 209 bytes
-rw-r--r--test/text-zero-len.c85
-rw-r--r--test/unantialiased-shapes-ref.pngbin4449 -> 3968 bytes
34 files changed, 1603 insertions, 211 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 805ac16..220ec73 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -2,6 +2,8 @@ SUBDIRS=pdiff .
# Here are all the tests that are run unconditionally
TESTS = \
+a1-image-sample$(EXEEXT) \
+a1-traps-sample$(EXEEXT) \
a8-mask$(EXEEXT) \
big-trap$(EXEEXT) \
caps-joins$(EXEEXT) \
@@ -25,6 +27,7 @@ create-for-stream$(EXEEXT) \
create-from-png$(EXEEXT) \
create-from-png-stream$(EXEEXT) \
dash-caps-joins$(EXEEXT) \
+dash-curve$(EXEEXT) \
dash-no-dash$(EXEEXT) \
dash-offset-negative$(EXEEXT) \
dash-scale$(EXEEXT) \
@@ -35,6 +38,10 @@ degenerate-pen$(EXEEXT) \
device-offset$(EXEEXT) \
device-offset-positive$(EXEEXT) \
extend-pad$(EXEEXT) \
+extend-reflect$(EXEEXT) \
+extend-reflect-similar$(EXEEXT) \
+extend-repeat$(EXEEXT) \
+extend-repeat-similar$(EXEEXT) \
fill-and-stroke$(EXEEXT) \
fill-and-stroke-alpha$(EXEEXT) \
fill-and-stroke-alpha-add$(EXEEXT) \
@@ -44,15 +51,18 @@ fill-rule$(EXEEXT) \
filter-nearest-offset$(EXEEXT) \
font-face-get-type$(EXEEXT) \
font-matrix-translation$(EXEEXT) \
+font-options$(EXEEXT) \
glyph-cache-pressure$(EXEEXT) \
get-and-set$(EXEEXT) \
get-clip$(EXEEXT) \
get-group-target$(EXEEXT) \
get-path-extents$(EXEEXT) \
+get-xrender-format$(EXEEXT) \
gradient-alpha$(EXEEXT) \
gradient-zero-stops$(EXEEXT) \
infinite-join$(EXEEXT) \
in-fill-empty-trapezoid$(EXEEXT) \
+in-fill-trapezoid$(EXEEXT) \
invalid-matrix$(EXEEXT) \
leaky-dash$(EXEEXT) \
leaky-polygon$(EXEEXT) \
@@ -88,6 +98,7 @@ push-group$(EXEEXT) \
radial-gradient$(EXEEXT) \
random-intersections$(EXEEXT) \
rectangle-rounding-error$(EXEEXT) \
+rectilinear-miter-limit$(EXEEXT) \
rectilinear-stroke$(EXEEXT) \
rel-path$(EXEEXT) \
rgb24-ignore-alpha$(EXEEXT) \
@@ -167,7 +178,6 @@ zero-alpha$(EXEEXT)
# that's just a bug in the test rig that should just consider
# the abort an XFAIL like any other.
DISABLED_TESTS = \
-extend-reflect$(EXEEXT) \
show-glyphs-many$(EXEEXT) \
text-glyph-range$(EXEEXT)
@@ -202,6 +212,10 @@ if CAIRO_HAS_XLIB_SURFACE
TESTS += xlib-surface$(EXEEXT)
endif
+if CAIRO_HAS_XLIB_XRENDER_SURFACE
+TESTS += get-xrender-format$(EXEEXT)
+endif
+
if CAIRO_HAS_MULTI_PAGE_SURFACES
TESTS += multi-page$(EXEEXT)
endif
@@ -216,6 +230,8 @@ endif
# All tests which have a reference image go here.
REFERENCE_IMAGES = \
+ a1-image-sample-ref.png \
+ a1-traps-sample-ref.png \
a8-mask-ref.png \
bitmap-font-pdf-argb32-ref.png \
bitmap-font-ref.png \
@@ -265,6 +281,7 @@ REFERENCE_IMAGES = \
dash-caps-joins-ps-rgb24-ref.png \
dash-caps-joins-quartz-ref.png \
dash-caps-joins-ref.png \
+ dash-curve-ref.png \
dash-no-dash-ref.png \
dash-offset-negative-ref.png \
dash-scale-ps-argb32-ref.png \
@@ -288,6 +305,9 @@ REFERENCE_IMAGES = \
device-offset-rgb24-ref.png \
extend-pad-ref.png \
extend-reflect-ref.png \
+ extend-reflect-similar-ref.png \
+ extend-repeat-ref.png \
+ extend-repeat-similar-ref.png \
fill-and-stroke-alpha-add-quartz-ref.png \
fill-and-stroke-alpha-add-ref.png \
fill-and-stroke-alpha-quartz-ref.png \
@@ -311,6 +331,7 @@ REFERENCE_IMAGES = \
fill-rule-quartz-rgb24-ref.png \
fill-rule-ref.png \
fill-rule-rgb24-ref.png \
+ fill-rule-ps-rgb24-ref.png \
filter-nearest-offset-ref.png \
font-matrix-translation-ps-argb32-ref.png \
font-matrix-translation-ps-rgb24-ref.png \
@@ -361,6 +382,8 @@ REFERENCE_IMAGES = \
mask-svg-argb32-ref.png \
meta-surface-pattern-ref.png \
meta-surface-pattern-rgb24-ref.png \
+ meta-surface-pattern-pdf-ref.png \
+ meta-surface-pattern-pdf-rgb24-ref.png \
miter-precision-ref.png \
move-to-show-surface-ref.png \
new-sub-path-ps-argb32-ref.png \
@@ -413,6 +436,7 @@ REFERENCE_IMAGES = \
random-intersections-ref.png \
rgb24-ignore-alpha-ref.png \
rectangle-rounding-error-ref.png \
+ rectilinear-miter-limit-ref.png \
rectilinear-stroke-ref.png \
rel-path-quartz-ref.png \
rel-path-quartz-rgb24-ref.png \
@@ -504,11 +528,7 @@ $(REFERENCE_IMAGES)
# Of course, before any "release" of cairo we should eliminate
# everything from this list by fixing the bugs. (We don't necessarily
# have to be that strict for "snapshots" though.)
-#
-# Also, any test listed here should call cairo_test_expect_failure and
-# provide an explanation for the expected failure.
XFAIL_TESTS = \
-a8-mask$(EXEEXT) \
big-trap$(EXEEXT) \
extend-pad$(EXEEXT) \
filter-nearest-offset$(EXEEXT) \
@@ -521,19 +541,20 @@ surface-pattern-scale-up$(EXEEXT)
# Any test that doesn't generate a log file goes here
NOLOG_TESTS = \
-user-data \
-svg-surface \
-svg-clip \
+fallback-resolution \
+font-options \
+multi-page \
pdf-features \
ps-features \
-multi-page \
-fallback-resolution
+svg-clip \
+svg-surface \
+user-data
# A hook that summarises the failures
check: AM_MAKEFLAGS+=-k
check-local:
@FAILED_TESTS=""; \
- for t in *.log; do \
+ for t in $(TESTS:$(EXEEXT)=.log); do \
if grep -e '\<FAIL\>' $$t >/dev/null 2>&1; then \
FAILED_TESTS="$$FAILED_TESTS $${t%.log}"; \
fi; \
@@ -694,13 +715,40 @@ index.html: $(srcdir)/make-html.pl $(TESTS:$(EXEEXT)=.log)
# Identify identical reference images
check-ref-dups:
- @sha1sum *-ref.png > ref.hash
- @join ref.hash ref.hash | grep -v -E '( .*-ref.png).*\1' | cut -d' ' -f 1-2 | sort -u
+ @LANG=C; \
+ ( cd "$(scrdir)" && sha1sum *-ref.png | sort ) > ref.hash; \
+ join ref.hash ref.hash | grep -v -E '( .*-ref.png).*\1' | cut -d' ' -f 1-2 | sort -u
# Not exactly the best script in the world...
check-ref-missing:
- @for i in *-ref.png; do\
- echo ${REFERENCE_IMAGES} | grep -sq $$i || echo $$i; \
- done
-
-.PHONY: check-valgrind test recheck retest html rehtml check-ref-dups check-ref-missing
+ @cd "$(srcdir)"; \
+ REFS=`git ls-files "*-ref.png"`; \
+ test x = "x$$REFS" && REFS=`ls *-ref.png`; \
+ ret=true; \
+ missing=""; \
+ for i in $$REFS; do \
+ echo "" $(REFERENCE_IMAGES) "" | grep -sq " $$i " || missing="$$missing $$i" ; \
+ done ; \
+ if test -n "$$missing"; then \
+ echo "*** Error: Sanity check failed"; \
+ echo "Some reference files are not included in the distribution."; \
+ echo "You probably need to add these to Makefile.am's REFERENCE_IMAGES."; \
+ echo "Missing: $$missing"; \
+ ret=false; \
+ fi >&2; \
+ missing=""; \
+ for i in $(REFERENCE_IMAGES); do \
+ echo "" $$REFS "" | grep -sq " $$i " || missing="$$missing $$i" ; \
+ done ; \
+ if test -n "$$missing"; then \
+ echo "*** Error: Sanity check failed"; \
+ echo "Some reference files included in the distribution do not exist"; \
+ echo "or are not in git. You probably want to add these to git first."; \
+ echo "Missing: $$missing"; \
+ ret=false; \
+ fi >&2; \
+ $$ret
+
+release-verify-sane-tests: check-ref-missing
+
+.PHONY: check-valgrind test recheck retest html rehtml check-ref-dups check-ref-missing release-verify-sane-tests
diff --git a/test/Makefile.in b/test/Makefile.in
index 8deb773..ba76484 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -49,14 +49,15 @@ host_triplet = @host@
@CAIRO_HAS_PDF_SURFACE_TRUE@am__append_4 = pdf-features$(EXEEXT)
@CAIRO_HAS_PS_SURFACE_TRUE@am__append_5 = ps-features$(EXEEXT)
@CAIRO_HAS_XLIB_SURFACE_TRUE@am__append_6 = xlib-surface$(EXEEXT)
-@CAIRO_HAS_MULTI_PAGE_SURFACES_TRUE@am__append_7 = multi-page$(EXEEXT)
-@CAIRO_HAS_PDF_SURFACE_TRUE@@CAIRO_HAS_PS_SURFACE_TRUE@@CAIRO_HAS_SVG_SURFACE_TRUE@am__append_8 = fallback-resolution$(EXEEXT)
+@CAIRO_HAS_XLIB_XRENDER_SURFACE_TRUE@am__append_7 = get-xrender-format$(EXEEXT)
+@CAIRO_HAS_MULTI_PAGE_SURFACES_TRUE@am__append_8 = multi-page$(EXEEXT)
+@CAIRO_HAS_PDF_SURFACE_TRUE@@CAIRO_HAS_PS_SURFACE_TRUE@@CAIRO_HAS_SVG_SURFACE_TRUE@am__append_9 = fallback-resolution$(EXEEXT)
check_PROGRAMS = imagediff$(EXEEXT) png-flatten$(EXEEXT) \
- $(am__EXEEXT_11) $(am__EXEEXT_12)
-EXTRA_PROGRAMS = $(am__EXEEXT_9) $(am__EXEEXT_10)
-@HAVE_PTHREAD_TRUE@am__append_9 = -lpthread
-@CAIRO_CAN_TEST_PDF_SURFACE_TRUE@am__append_10 = pdf2png
-@CAIRO_CAN_TEST_SVG_SURFACE_TRUE@am__append_11 = svg2png
+ $(am__EXEEXT_12) $(am__EXEEXT_13)
+EXTRA_PROGRAMS = $(am__EXEEXT_10) $(am__EXEEXT_11)
+@HAVE_PTHREAD_TRUE@am__append_10 = -lpthread
+@CAIRO_CAN_TEST_PDF_SURFACE_TRUE@am__append_11 = pdf2png
+@CAIRO_CAN_TEST_SVG_SURFACE_TRUE@am__append_12 = svg2png
subdir = test
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -84,10 +85,12 @@ libcairotest_la_OBJECTS = $(am_libcairotest_la_OBJECTS)
@CAIRO_HAS_PDF_SURFACE_TRUE@am__EXEEXT_4 = pdf-features$(EXEEXT)
@CAIRO_HAS_PS_SURFACE_TRUE@am__EXEEXT_5 = ps-features$(EXEEXT)
@CAIRO_HAS_XLIB_SURFACE_TRUE@am__EXEEXT_6 = xlib-surface$(EXEEXT)
-@CAIRO_HAS_MULTI_PAGE_SURFACES_TRUE@am__EXEEXT_7 = \
+@CAIRO_HAS_XLIB_XRENDER_SURFACE_TRUE@am__EXEEXT_7 = get-xrender-format$(EXEEXT)
+@CAIRO_HAS_MULTI_PAGE_SURFACES_TRUE@am__EXEEXT_8 = \
@CAIRO_HAS_MULTI_PAGE_SURFACES_TRUE@ multi-page$(EXEEXT)
-@CAIRO_HAS_PDF_SURFACE_TRUE@@CAIRO_HAS_PS_SURFACE_TRUE@@CAIRO_HAS_SVG_SURFACE_TRUE@am__EXEEXT_8 = fallback-resolution$(EXEEXT)
-am__EXEEXT_9 = a8-mask$(EXEEXT) big-trap$(EXEEXT) caps-joins$(EXEEXT) \
+@CAIRO_HAS_PDF_SURFACE_TRUE@@CAIRO_HAS_PS_SURFACE_TRUE@@CAIRO_HAS_SVG_SURFACE_TRUE@am__EXEEXT_9 = fallback-resolution$(EXEEXT)
+am__EXEEXT_10 = a1-image-sample$(EXEEXT) a1-traps-sample$(EXEEXT) \
+ a8-mask$(EXEEXT) big-trap$(EXEEXT) caps-joins$(EXEEXT) \
caps-joins-alpha$(EXEEXT) caps-sub-paths$(EXEEXT) \
clip-all$(EXEEXT) clip-empty$(EXEEXT) clip-fill-rule$(EXEEXT) \
clip-fill-rule-pixel-aligned$(EXEEXT) clip-nesting$(EXEEXT) \
@@ -98,23 +101,27 @@ am__EXEEXT_9 = a8-mask$(EXEEXT) big-trap$(EXEEXT) caps-joins$(EXEEXT) \
composite-integer-translate-over-repeat$(EXEEXT) \
copy-path$(EXEEXT) create-for-stream$(EXEEXT) \
create-from-png$(EXEEXT) create-from-png-stream$(EXEEXT) \
- dash-caps-joins$(EXEEXT) dash-no-dash$(EXEEXT) \
- dash-offset-negative$(EXEEXT) dash-scale$(EXEEXT) \
- dash-state$(EXEEXT) dash-zero-length$(EXEEXT) \
- degenerate-path$(EXEEXT) degenerate-pen$(EXEEXT) \
- device-offset$(EXEEXT) device-offset-positive$(EXEEXT) \
- extend-pad$(EXEEXT) fill-and-stroke$(EXEEXT) \
- fill-and-stroke-alpha$(EXEEXT) \
+ dash-caps-joins$(EXEEXT) dash-curve$(EXEEXT) \
+ dash-no-dash$(EXEEXT) dash-offset-negative$(EXEEXT) \
+ dash-scale$(EXEEXT) dash-state$(EXEEXT) \
+ dash-zero-length$(EXEEXT) degenerate-path$(EXEEXT) \
+ degenerate-pen$(EXEEXT) device-offset$(EXEEXT) \
+ device-offset-positive$(EXEEXT) extend-pad$(EXEEXT) \
+ extend-reflect$(EXEEXT) extend-reflect-similar$(EXEEXT) \
+ extend-repeat$(EXEEXT) extend-repeat-similar$(EXEEXT) \
+ fill-and-stroke$(EXEEXT) fill-and-stroke-alpha$(EXEEXT) \
fill-and-stroke-alpha-add$(EXEEXT) \
fill-degenerate-sort-order$(EXEEXT) fill-missed-stop$(EXEEXT) \
fill-rule$(EXEEXT) filter-nearest-offset$(EXEEXT) \
font-face-get-type$(EXEEXT) font-matrix-translation$(EXEEXT) \
- glyph-cache-pressure$(EXEEXT) get-and-set$(EXEEXT) \
- get-clip$(EXEEXT) get-group-target$(EXEEXT) \
- get-path-extents$(EXEEXT) gradient-alpha$(EXEEXT) \
+ font-options$(EXEEXT) glyph-cache-pressure$(EXEEXT) \
+ get-and-set$(EXEEXT) get-clip$(EXEEXT) \
+ get-group-target$(EXEEXT) get-path-extents$(EXEEXT) \
+ get-xrender-format$(EXEEXT) gradient-alpha$(EXEEXT) \
gradient-zero-stops$(EXEEXT) infinite-join$(EXEEXT) \
- in-fill-empty-trapezoid$(EXEEXT) invalid-matrix$(EXEEXT) \
- leaky-dash$(EXEEXT) leaky-polygon$(EXEEXT) line-width$(EXEEXT) \
+ in-fill-empty-trapezoid$(EXEEXT) in-fill-trapezoid$(EXEEXT) \
+ invalid-matrix$(EXEEXT) leaky-dash$(EXEEXT) \
+ leaky-polygon$(EXEEXT) line-width$(EXEEXT) \
line-width-scale$(EXEEXT) line-width-zero$(EXEEXT) \
linear-gradient$(EXEEXT) linear-gradient-reflect$(EXEEXT) \
long-lines$(EXEEXT) mask$(EXEEXT) mask-alpha$(EXEEXT) \
@@ -130,7 +137,8 @@ am__EXEEXT_9 = a8-mask$(EXEEXT) big-trap$(EXEEXT) caps-joins$(EXEEXT) \
pattern-getters$(EXEEXT) pixman-rotate$(EXEEXT) \
push-group$(EXEEXT) radial-gradient$(EXEEXT) \
random-intersections$(EXEEXT) \
- rectangle-rounding-error$(EXEEXT) rectilinear-stroke$(EXEEXT) \
+ rectangle-rounding-error$(EXEEXT) \
+ rectilinear-miter-limit$(EXEEXT) rectilinear-stroke$(EXEEXT) \
rel-path$(EXEEXT) rgb24-ignore-alpha$(EXEEXT) \
rotate-image-surface-paint$(EXEEXT) \
scale-down-source-surface-paint$(EXEEXT) \
@@ -153,11 +161,20 @@ am__EXEEXT_9 = a8-mask$(EXEEXT) big-trap$(EXEEXT) caps-joins$(EXEEXT) \
user-data$(EXEEXT) zero-alpha$(EXEEXT) $(am__EXEEXT_1) \
$(am__EXEEXT_2) $(am__EXEEXT_3) $(am__EXEEXT_4) \
$(am__EXEEXT_5) $(am__EXEEXT_6) $(am__EXEEXT_7) \
- $(am__EXEEXT_8)
-am__EXEEXT_10 = extend-reflect$(EXEEXT) show-glyphs-many$(EXEEXT) \
- text-glyph-range$(EXEEXT)
-@CAIRO_CAN_TEST_PDF_SURFACE_TRUE@am__EXEEXT_11 = pdf2png$(EXEEXT)
-@CAIRO_CAN_TEST_SVG_SURFACE_TRUE@am__EXEEXT_12 = svg2png$(EXEEXT)
+ $(am__EXEEXT_8) $(am__EXEEXT_9)
+am__EXEEXT_11 = show-glyphs-many$(EXEEXT) text-glyph-range$(EXEEXT)
+@CAIRO_CAN_TEST_PDF_SURFACE_TRUE@am__EXEEXT_12 = pdf2png$(EXEEXT)
+@CAIRO_CAN_TEST_SVG_SURFACE_TRUE@am__EXEEXT_13 = svg2png$(EXEEXT)
+a1_image_sample_SOURCES = a1-image-sample.c
+a1_image_sample_OBJECTS = a1-image-sample.$(OBJEXT)
+a1_image_sample_LDADD = $(LDADD)
+a1_image_sample_DEPENDENCIES = $(am__DEPENDENCIES_1) libcairotest.la \
+ $(am__DEPENDENCIES_1)
+a1_traps_sample_SOURCES = a1-traps-sample.c
+a1_traps_sample_OBJECTS = a1-traps-sample.$(OBJEXT)
+a1_traps_sample_LDADD = $(LDADD)
+a1_traps_sample_DEPENDENCIES = $(am__DEPENDENCIES_1) libcairotest.la \
+ $(am__DEPENDENCIES_1)
a8_mask_SOURCES = a8-mask.c
a8_mask_OBJECTS = a8-mask.$(OBJEXT)
a8_mask_LDADD = $(LDADD)
@@ -285,6 +302,11 @@ dash_caps_joins_OBJECTS = dash-caps-joins.$(OBJEXT)
dash_caps_joins_LDADD = $(LDADD)
dash_caps_joins_DEPENDENCIES = $(am__DEPENDENCIES_1) libcairotest.la \
$(am__DEPENDENCIES_1)
+dash_curve_SOURCES = dash-curve.c
+dash_curve_OBJECTS = dash-curve.$(OBJEXT)
+dash_curve_LDADD = $(LDADD)
+dash_curve_DEPENDENCIES = $(am__DEPENDENCIES_1) libcairotest.la \
+ $(am__DEPENDENCIES_1)
dash_no_dash_SOURCES = dash-no-dash.c
dash_no_dash_OBJECTS = dash-no-dash.$(OBJEXT)
dash_no_dash_LDADD = $(LDADD)
@@ -340,6 +362,21 @@ extend_reflect_OBJECTS = extend-reflect.$(OBJEXT)
extend_reflect_LDADD = $(LDADD)
extend_reflect_DEPENDENCIES = $(am__DEPENDENCIES_1) libcairotest.la \
$(am__DEPENDENCIES_1)
+extend_reflect_similar_SOURCES = extend-reflect-similar.c
+extend_reflect_similar_OBJECTS = extend-reflect-similar.$(OBJEXT)
+extend_reflect_similar_LDADD = $(LDADD)
+extend_reflect_similar_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+ libcairotest.la $(am__DEPENDENCIES_1)
+extend_repeat_SOURCES = extend-repeat.c
+extend_repeat_OBJECTS = extend-repeat.$(OBJEXT)
+extend_repeat_LDADD = $(LDADD)
+extend_repeat_DEPENDENCIES = $(am__DEPENDENCIES_1) libcairotest.la \
+ $(am__DEPENDENCIES_1)
+extend_repeat_similar_SOURCES = extend-repeat-similar.c
+extend_repeat_similar_OBJECTS = extend-repeat-similar.$(OBJEXT)
+extend_repeat_similar_LDADD = $(LDADD)
+extend_repeat_similar_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+ libcairotest.la $(am__DEPENDENCIES_1)
fallback_resolution_SOURCES = fallback-resolution.c
fallback_resolution_OBJECTS = fallback-resolution.$(OBJEXT)
fallback_resolution_LDADD = $(LDADD)
@@ -392,6 +429,11 @@ font_matrix_translation_OBJECTS = font-matrix-translation.$(OBJEXT)
font_matrix_translation_LDADD = $(LDADD)
font_matrix_translation_DEPENDENCIES = $(am__DEPENDENCIES_1) \
libcairotest.la $(am__DEPENDENCIES_1)
+font_options_SOURCES = font-options.c
+font_options_OBJECTS = font-options.$(OBJEXT)
+font_options_LDADD = $(LDADD)
+font_options_DEPENDENCIES = $(am__DEPENDENCIES_1) libcairotest.la \
+ $(am__DEPENDENCIES_1)
ft_font_create_for_ft_face_SOURCES = ft-font-create-for-ft-face.c
ft_font_create_for_ft_face_OBJECTS = \
ft-font-create-for-ft-face.$(OBJEXT)
@@ -437,6 +479,11 @@ get_path_extents_OBJECTS = get-path-extents.$(OBJEXT)
get_path_extents_LDADD = $(LDADD)
get_path_extents_DEPENDENCIES = $(am__DEPENDENCIES_1) libcairotest.la \
$(am__DEPENDENCIES_1)
+get_xrender_format_SOURCES = get-xrender-format.c
+get_xrender_format_OBJECTS = get-xrender-format.$(OBJEXT)
+get_xrender_format_LDADD = $(LDADD)
+get_xrender_format_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+ libcairotest.la $(am__DEPENDENCIES_1)
glyph_cache_pressure_SOURCES = glyph-cache-pressure.c
glyph_cache_pressure_OBJECTS = glyph-cache-pressure.$(OBJEXT)
glyph_cache_pressure_LDADD = $(LDADD)
@@ -462,6 +509,11 @@ in_fill_empty_trapezoid_OBJECTS = in-fill-empty-trapezoid.$(OBJEXT)
in_fill_empty_trapezoid_LDADD = $(LDADD)
in_fill_empty_trapezoid_DEPENDENCIES = $(am__DEPENDENCIES_1) \
libcairotest.la $(am__DEPENDENCIES_1)
+in_fill_trapezoid_SOURCES = in-fill-trapezoid.c
+in_fill_trapezoid_OBJECTS = in-fill-trapezoid.$(OBJEXT)
+in_fill_trapezoid_LDADD = $(LDADD)
+in_fill_trapezoid_DEPENDENCIES = $(am__DEPENDENCIES_1) libcairotest.la \
+ $(am__DEPENDENCIES_1)
infinite_join_SOURCES = infinite-join.c
infinite_join_OBJECTS = infinite-join.$(OBJEXT)
infinite_join_LDADD = $(LDADD)
@@ -674,6 +726,11 @@ rectangle_rounding_error_OBJECTS = rectangle-rounding-error.$(OBJEXT)
rectangle_rounding_error_LDADD = $(LDADD)
rectangle_rounding_error_DEPENDENCIES = $(am__DEPENDENCIES_1) \
libcairotest.la $(am__DEPENDENCIES_1)
+rectilinear_miter_limit_SOURCES = rectilinear-miter-limit.c
+rectilinear_miter_limit_OBJECTS = rectilinear-miter-limit.$(OBJEXT)
+rectilinear_miter_limit_LDADD = $(LDADD)
+rectilinear_miter_limit_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+ libcairotest.la $(am__DEPENDENCIES_1)
rectilinear_stroke_SOURCES = rectilinear-stroke.c
rectilinear_stroke_OBJECTS = rectilinear-stroke.$(OBJEXT)
rectilinear_stroke_LDADD = $(LDADD)
@@ -909,32 +966,35 @@ LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-SOURCES = $(libcairotest_la_SOURCES) a8-mask.c big-trap.c \
- bitmap-font.c caps-joins.c caps-joins-alpha.c caps-sub-paths.c \
- clip-all.c clip-empty.c clip-fill-rule.c \
- clip-fill-rule-pixel-aligned.c clip-nesting.c clip-operator.c \
- clip-push-group.c clip-twice.c clip-zero.c close-path.c \
- composite-integer-translate-over.c \
+SOURCES = $(libcairotest_la_SOURCES) a1-image-sample.c \
+ a1-traps-sample.c a8-mask.c big-trap.c bitmap-font.c \
+ caps-joins.c caps-joins-alpha.c caps-sub-paths.c clip-all.c \
+ clip-empty.c clip-fill-rule.c clip-fill-rule-pixel-aligned.c \
+ clip-nesting.c clip-operator.c clip-push-group.c clip-twice.c \
+ clip-zero.c close-path.c composite-integer-translate-over.c \
composite-integer-translate-over-repeat.c \
composite-integer-translate-source.c copy-path.c \
create-for-stream.c create-from-png.c create-from-png-stream.c \
- dash-caps-joins.c dash-no-dash.c dash-offset-negative.c \
- dash-scale.c dash-state.c dash-zero-length.c degenerate-path.c \
- degenerate-pen.c device-offset.c device-offset-positive.c \
- extend-pad.c extend-reflect.c fallback-resolution.c \
+ dash-caps-joins.c dash-curve.c dash-no-dash.c \
+ dash-offset-negative.c dash-scale.c dash-state.c \
+ dash-zero-length.c degenerate-path.c degenerate-pen.c \
+ device-offset.c device-offset-positive.c extend-pad.c \
+ extend-reflect.c extend-reflect-similar.c extend-repeat.c \
+ extend-repeat-similar.c fallback-resolution.c \
fill-and-stroke.c fill-and-stroke-alpha.c \
fill-and-stroke-alpha-add.c fill-degenerate-sort-order.c \
fill-missed-stop.c fill-rule.c filter-nearest-offset.c \
- font-face-get-type.c font-matrix-translation.c \
+ font-face-get-type.c font-matrix-translation.c font-options.c \
ft-font-create-for-ft-face.c ft-text-antialias-none.c \
ft-text-vertical-layout-type1.c \
ft-text-vertical-layout-type3.c get-and-set.c get-clip.c \
- get-group-target.c get-path-extents.c glyph-cache-pressure.c \
- gradient-alpha.c gradient-zero-stops.c imagediff.c \
- in-fill-empty-trapezoid.c infinite-join.c invalid-matrix.c \
- leaky-dash.c leaky-polygon.c line-width.c line-width-scale.c \
- line-width-zero.c linear-gradient.c linear-gradient-reflect.c \
- long-lines.c mask.c mask-alpha.c mask-ctm.c mask-surface-ctm.c \
+ get-group-target.c get-path-extents.c get-xrender-format.c \
+ glyph-cache-pressure.c gradient-alpha.c gradient-zero-stops.c \
+ imagediff.c in-fill-empty-trapezoid.c in-fill-trapezoid.c \
+ infinite-join.c invalid-matrix.c leaky-dash.c leaky-polygon.c \
+ line-width.c line-width-scale.c line-width-zero.c \
+ linear-gradient.c linear-gradient-reflect.c long-lines.c \
+ mask.c mask-alpha.c mask-ctm.c mask-surface-ctm.c \
meta-surface-pattern.c miter-precision.c \
move-to-show-surface.c multi-page.c new-sub-path.c \
nil-surface.c operator-clear.c operator-source.c \
@@ -944,49 +1004,52 @@ SOURCES = $(libcairotest_la_SOURCES) a8-mask.c big-trap.c \
pattern-getters.c pdf-features.c pdf2png.c pixman-rotate.c \
png-flatten.c ps-features.c pthread-show-text.c push-group.c \
radial-gradient.c random-intersections.c \
- rectangle-rounding-error.c rectilinear-stroke.c rel-path.c \
- rgb24-ignore-alpha.c rotate-image-surface-paint.c \
- scale-down-source-surface-paint.c scale-source-surface-paint.c \
- select-font-face.c select-font-no-show-text.c self-copy.c \
- self-intersecting.c set-source.c show-glyphs-many.c \
- show-text-current-point.c skew-extreme.c \
- solid-pattern-cache-stress.c source-clip.c source-clip-scale.c \
- source-surface-scale-paint.c surface-finish-twice.c \
- surface-pattern.c surface-pattern-big-scale-down.c \
- surface-pattern-scale-down.c surface-pattern-scale-up.c \
- svg-clip.c svg-surface.c svg2png.c text-antialias-gray.c \
- text-antialias-none.c text-antialias-subpixel.c \
- text-cache-crash.c text-glyph-range.c text-pattern.c \
- text-rotate.c text-zero-len.c transforms.c \
- translate-show-surface.c trap-clip.c truetype-tables.c \
- unantialiased-shapes.c unbounded-operator.c user-data.c \
- xlib-surface.c zero-alpha.c
-DIST_SOURCES = $(libcairotest_la_SOURCES) a8-mask.c big-trap.c \
- bitmap-font.c caps-joins.c caps-joins-alpha.c caps-sub-paths.c \
- clip-all.c clip-empty.c clip-fill-rule.c \
- clip-fill-rule-pixel-aligned.c clip-nesting.c clip-operator.c \
- clip-push-group.c clip-twice.c clip-zero.c close-path.c \
- composite-integer-translate-over.c \
+ rectangle-rounding-error.c rectilinear-miter-limit.c \
+ rectilinear-stroke.c rel-path.c rgb24-ignore-alpha.c \
+ rotate-image-surface-paint.c scale-down-source-surface-paint.c \
+ scale-source-surface-paint.c select-font-face.c \
+ select-font-no-show-text.c self-copy.c self-intersecting.c \
+ set-source.c show-glyphs-many.c show-text-current-point.c \
+ skew-extreme.c solid-pattern-cache-stress.c source-clip.c \
+ source-clip-scale.c source-surface-scale-paint.c \
+ surface-finish-twice.c surface-pattern.c \
+ surface-pattern-big-scale-down.c surface-pattern-scale-down.c \
+ surface-pattern-scale-up.c svg-clip.c svg-surface.c svg2png.c \
+ text-antialias-gray.c text-antialias-none.c \
+ text-antialias-subpixel.c text-cache-crash.c \
+ text-glyph-range.c text-pattern.c text-rotate.c \
+ text-zero-len.c transforms.c translate-show-surface.c \
+ trap-clip.c truetype-tables.c unantialiased-shapes.c \
+ unbounded-operator.c user-data.c xlib-surface.c zero-alpha.c
+DIST_SOURCES = $(libcairotest_la_SOURCES) a1-image-sample.c \
+ a1-traps-sample.c a8-mask.c big-trap.c bitmap-font.c \
+ caps-joins.c caps-joins-alpha.c caps-sub-paths.c clip-all.c \
+ clip-empty.c clip-fill-rule.c clip-fill-rule-pixel-aligned.c \
+ clip-nesting.c clip-operator.c clip-push-group.c clip-twice.c \
+ clip-zero.c close-path.c composite-integer-translate-over.c \
composite-integer-translate-over-repeat.c \
composite-integer-translate-source.c copy-path.c \
create-for-stream.c create-from-png.c create-from-png-stream.c \
- dash-caps-joins.c dash-no-dash.c dash-offset-negative.c \
- dash-scale.c dash-state.c dash-zero-length.c degenerate-path.c \
- degenerate-pen.c device-offset.c device-offset-positive.c \
- extend-pad.c extend-reflect.c fallback-resolution.c \
+ dash-caps-joins.c dash-curve.c dash-no-dash.c \
+ dash-offset-negative.c dash-scale.c dash-state.c \
+ dash-zero-length.c degenerate-path.c degenerate-pen.c \
+ device-offset.c device-offset-positive.c extend-pad.c \
+ extend-reflect.c extend-reflect-similar.c extend-repeat.c \
+ extend-repeat-similar.c fallback-resolution.c \
fill-and-stroke.c fill-and-stroke-alpha.c \
fill-and-stroke-alpha-add.c fill-degenerate-sort-order.c \
fill-missed-stop.c fill-rule.c filter-nearest-offset.c \
- font-face-get-type.c font-matrix-translation.c \
+ font-face-get-type.c font-matrix-translation.c font-options.c \
ft-font-create-for-ft-face.c ft-text-antialias-none.c \
ft-text-vertical-layout-type1.c \
ft-text-vertical-layout-type3.c get-and-set.c get-clip.c \
- get-group-target.c get-path-extents.c glyph-cache-pressure.c \
- gradient-alpha.c gradient-zero-stops.c imagediff.c \
- in-fill-empty-trapezoid.c infinite-join.c invalid-matrix.c \
- leaky-dash.c leaky-polygon.c line-width.c line-width-scale.c \
- line-width-zero.c linear-gradient.c linear-gradient-reflect.c \
- long-lines.c mask.c mask-alpha.c mask-ctm.c mask-surface-ctm.c \
+ get-group-target.c get-path-extents.c get-xrender-format.c \
+ glyph-cache-pressure.c gradient-alpha.c gradient-zero-stops.c \
+ imagediff.c in-fill-empty-trapezoid.c in-fill-trapezoid.c \
+ infinite-join.c invalid-matrix.c leaky-dash.c leaky-polygon.c \
+ line-width.c line-width-scale.c line-width-zero.c \
+ linear-gradient.c linear-gradient-reflect.c long-lines.c \
+ mask.c mask-alpha.c mask-ctm.c mask-surface-ctm.c \
meta-surface-pattern.c miter-precision.c \
move-to-show-surface.c multi-page.c new-sub-path.c \
nil-surface.c operator-clear.c operator-source.c \
@@ -996,23 +1059,23 @@ DIST_SOURCES = $(libcairotest_la_SOURCES) a8-mask.c big-trap.c \
pattern-getters.c pdf-features.c pdf2png.c pixman-rotate.c \
png-flatten.c ps-features.c pthread-show-text.c push-group.c \
radial-gradient.c random-intersections.c \
- rectangle-rounding-error.c rectilinear-stroke.c rel-path.c \
- rgb24-ignore-alpha.c rotate-image-surface-paint.c \
- scale-down-source-surface-paint.c scale-source-surface-paint.c \
- select-font-face.c select-font-no-show-text.c self-copy.c \
- self-intersecting.c set-source.c show-glyphs-many.c \
- show-text-current-point.c skew-extreme.c \
- solid-pattern-cache-stress.c source-clip.c source-clip-scale.c \
- source-surface-scale-paint.c surface-finish-twice.c \
- surface-pattern.c surface-pattern-big-scale-down.c \
- surface-pattern-scale-down.c surface-pattern-scale-up.c \
- svg-clip.c svg-surface.c svg2png.c text-antialias-gray.c \
- text-antialias-none.c text-antialias-subpixel.c \
- text-cache-crash.c text-glyph-range.c text-pattern.c \
- text-rotate.c text-zero-len.c transforms.c \
- translate-show-surface.c trap-clip.c truetype-tables.c \
- unantialiased-shapes.c unbounded-operator.c user-data.c \
- xlib-surface.c zero-alpha.c
+ rectangle-rounding-error.c rectilinear-miter-limit.c \
+ rectilinear-stroke.c rel-path.c rgb24-ignore-alpha.c \
+ rotate-image-surface-paint.c scale-down-source-surface-paint.c \
+ scale-source-surface-paint.c select-font-face.c \
+ select-font-no-show-text.c self-copy.c self-intersecting.c \
+ set-source.c show-glyphs-many.c show-text-current-point.c \
+ skew-extreme.c solid-pattern-cache-stress.c source-clip.c \
+ source-clip-scale.c source-surface-scale-paint.c \
+ surface-finish-twice.c surface-pattern.c \
+ surface-pattern-big-scale-down.c surface-pattern-scale-down.c \
+ surface-pattern-scale-up.c svg-clip.c svg-surface.c svg2png.c \
+ text-antialias-gray.c text-antialias-none.c \
+ text-antialias-subpixel.c text-cache-crash.c \
+ text-glyph-range.c text-pattern.c text-rotate.c \
+ text-zero-len.c transforms.c translate-show-surface.c \
+ trap-clip.c truetype-tables.c unantialiased-shapes.c \
+ unbounded-operator.c user-data.c xlib-surface.c zero-alpha.c
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-exec-recursive install-info-recursive \
@@ -1253,7 +1316,8 @@ xlib_xrender_LIBS = @xlib_xrender_LIBS@
SUBDIRS = pdiff .
# Here are all the tests that are run unconditionally
-TESTS = a8-mask$(EXEEXT) big-trap$(EXEEXT) caps-joins$(EXEEXT) \
+TESTS = a1-image-sample$(EXEEXT) a1-traps-sample$(EXEEXT) \
+ a8-mask$(EXEEXT) big-trap$(EXEEXT) caps-joins$(EXEEXT) \
caps-joins-alpha$(EXEEXT) caps-sub-paths$(EXEEXT) \
clip-all$(EXEEXT) clip-empty$(EXEEXT) clip-fill-rule$(EXEEXT) \
clip-fill-rule-pixel-aligned$(EXEEXT) clip-nesting$(EXEEXT) \
@@ -1264,23 +1328,27 @@ TESTS = a8-mask$(EXEEXT) big-trap$(EXEEXT) caps-joins$(EXEEXT) \
composite-integer-translate-over-repeat$(EXEEXT) \
copy-path$(EXEEXT) create-for-stream$(EXEEXT) \
create-from-png$(EXEEXT) create-from-png-stream$(EXEEXT) \
- dash-caps-joins$(EXEEXT) dash-no-dash$(EXEEXT) \
- dash-offset-negative$(EXEEXT) dash-scale$(EXEEXT) \
- dash-state$(EXEEXT) dash-zero-length$(EXEEXT) \
- degenerate-path$(EXEEXT) degenerate-pen$(EXEEXT) \
- device-offset$(EXEEXT) device-offset-positive$(EXEEXT) \
- extend-pad$(EXEEXT) fill-and-stroke$(EXEEXT) \
- fill-and-stroke-alpha$(EXEEXT) \
+ dash-caps-joins$(EXEEXT) dash-curve$(EXEEXT) \
+ dash-no-dash$(EXEEXT) dash-offset-negative$(EXEEXT) \
+ dash-scale$(EXEEXT) dash-state$(EXEEXT) \
+ dash-zero-length$(EXEEXT) degenerate-path$(EXEEXT) \
+ degenerate-pen$(EXEEXT) device-offset$(EXEEXT) \
+ device-offset-positive$(EXEEXT) extend-pad$(EXEEXT) \
+ extend-reflect$(EXEEXT) extend-reflect-similar$(EXEEXT) \
+ extend-repeat$(EXEEXT) extend-repeat-similar$(EXEEXT) \
+ fill-and-stroke$(EXEEXT) fill-and-stroke-alpha$(EXEEXT) \
fill-and-stroke-alpha-add$(EXEEXT) \
fill-degenerate-sort-order$(EXEEXT) fill-missed-stop$(EXEEXT) \
fill-rule$(EXEEXT) filter-nearest-offset$(EXEEXT) \
font-face-get-type$(EXEEXT) font-matrix-translation$(EXEEXT) \
- glyph-cache-pressure$(EXEEXT) get-and-set$(EXEEXT) \
- get-clip$(EXEEXT) get-group-target$(EXEEXT) \
- get-path-extents$(EXEEXT) gradient-alpha$(EXEEXT) \
+ font-options$(EXEEXT) glyph-cache-pressure$(EXEEXT) \
+ get-and-set$(EXEEXT) get-clip$(EXEEXT) \
+ get-group-target$(EXEEXT) get-path-extents$(EXEEXT) \
+ get-xrender-format$(EXEEXT) gradient-alpha$(EXEEXT) \
gradient-zero-stops$(EXEEXT) infinite-join$(EXEEXT) \
- in-fill-empty-trapezoid$(EXEEXT) invalid-matrix$(EXEEXT) \
- leaky-dash$(EXEEXT) leaky-polygon$(EXEEXT) line-width$(EXEEXT) \
+ in-fill-empty-trapezoid$(EXEEXT) in-fill-trapezoid$(EXEEXT) \
+ invalid-matrix$(EXEEXT) leaky-dash$(EXEEXT) \
+ leaky-polygon$(EXEEXT) line-width$(EXEEXT) \
line-width-scale$(EXEEXT) line-width-zero$(EXEEXT) \
linear-gradient$(EXEEXT) linear-gradient-reflect$(EXEEXT) \
long-lines$(EXEEXT) mask$(EXEEXT) mask-alpha$(EXEEXT) \
@@ -1296,7 +1364,8 @@ TESTS = a8-mask$(EXEEXT) big-trap$(EXEEXT) caps-joins$(EXEEXT) \
pattern-getters$(EXEEXT) pixman-rotate$(EXEEXT) \
push-group$(EXEEXT) radial-gradient$(EXEEXT) \
random-intersections$(EXEEXT) \
- rectangle-rounding-error$(EXEEXT) rectilinear-stroke$(EXEEXT) \
+ rectangle-rounding-error$(EXEEXT) \
+ rectilinear-miter-limit$(EXEEXT) rectilinear-stroke$(EXEEXT) \
rel-path$(EXEEXT) rgb24-ignore-alpha$(EXEEXT) \
rotate-image-surface-paint$(EXEEXT) \
scale-down-source-surface-paint$(EXEEXT) \
@@ -1319,7 +1388,7 @@ TESTS = a8-mask$(EXEEXT) big-trap$(EXEEXT) caps-joins$(EXEEXT) \
user-data$(EXEEXT) zero-alpha$(EXEEXT) $(am__append_1) \
$(am__append_2) $(am__append_3) $(am__append_4) \
$(am__append_5) $(am__append_6) $(am__append_7) \
- $(am__append_8)
+ $(am__append_8) $(am__append_9)
# XXX: Here are some existing tests that are currently disabled for
# one reason or another. They can still be built and run (manually)
@@ -1362,13 +1431,14 @@ TESTS = a8-mask$(EXEEXT) big-trap$(EXEEXT) caps-joins$(EXEEXT) \
# that's just a bug in the test rig that should just consider
# the abort an XFAIL like any other.
DISABLED_TESTS = \
-extend-reflect$(EXEEXT) \
show-glyphs-many$(EXEEXT) \
text-glyph-range$(EXEEXT)
# All tests which have a reference image go here.
REFERENCE_IMAGES = \
+ a1-image-sample-ref.png \
+ a1-traps-sample-ref.png \
a8-mask-ref.png \
bitmap-font-pdf-argb32-ref.png \
bitmap-font-ref.png \
@@ -1418,6 +1488,7 @@ REFERENCE_IMAGES = \
dash-caps-joins-ps-rgb24-ref.png \
dash-caps-joins-quartz-ref.png \
dash-caps-joins-ref.png \
+ dash-curve-ref.png \
dash-no-dash-ref.png \
dash-offset-negative-ref.png \
dash-scale-ps-argb32-ref.png \
@@ -1441,6 +1512,9 @@ REFERENCE_IMAGES = \
device-offset-rgb24-ref.png \
extend-pad-ref.png \
extend-reflect-ref.png \
+ extend-reflect-similar-ref.png \
+ extend-repeat-ref.png \
+ extend-repeat-similar-ref.png \
fill-and-stroke-alpha-add-quartz-ref.png \
fill-and-stroke-alpha-add-ref.png \
fill-and-stroke-alpha-quartz-ref.png \
@@ -1464,6 +1538,7 @@ REFERENCE_IMAGES = \
fill-rule-quartz-rgb24-ref.png \
fill-rule-ref.png \
fill-rule-rgb24-ref.png \
+ fill-rule-ps-rgb24-ref.png \
filter-nearest-offset-ref.png \
font-matrix-translation-ps-argb32-ref.png \
font-matrix-translation-ps-rgb24-ref.png \
@@ -1514,6 +1589,8 @@ REFERENCE_IMAGES = \
mask-svg-argb32-ref.png \
meta-surface-pattern-ref.png \
meta-surface-pattern-rgb24-ref.png \
+ meta-surface-pattern-pdf-ref.png \
+ meta-surface-pattern-pdf-rgb24-ref.png \
miter-precision-ref.png \
move-to-show-surface-ref.png \
new-sub-path-ps-argb32-ref.png \
@@ -1566,6 +1643,7 @@ REFERENCE_IMAGES = \
random-intersections-ref.png \
rgb24-ignore-alpha-ref.png \
rectangle-rounding-error-ref.png \
+ rectilinear-miter-limit-ref.png \
rectilinear-stroke-ref.png \
rel-path-quartz-ref.png \
rel-path-quartz-rgb24-ref.png \
@@ -1658,11 +1736,7 @@ $(REFERENCE_IMAGES)
# Of course, before any "release" of cairo we should eliminate
# everything from this list by fixing the bugs. (We don't necessarily
# have to be that strict for "snapshots" though.)
-#
-# Also, any test listed here should call cairo_test_expect_failure and
-# provide an explanation for the expected failure.
XFAIL_TESTS = \
-a8-mask$(EXEEXT) \
big-trap$(EXEEXT) \
extend-pad$(EXEEXT) \
filter-nearest-offset$(EXEEXT) \
@@ -1676,13 +1750,14 @@ surface-pattern-scale-up$(EXEEXT)
# Any test that doesn't generate a log file goes here
NOLOG_TESTS = \
-user-data \
-svg-surface \
-svg-clip \
+fallback-resolution \
+font-options \
+multi-page \
pdf-features \
ps-features \
-multi-page \
-fallback-resolution
+svg-clip \
+svg-surface \
+user-data
# We're using _GNU_SOURCE to get the prototype for asprintf. This may
@@ -1712,7 +1787,7 @@ libcairotest_la_LIBADD = \
$(top_builddir)/src/libcairo.la \
$(CAIRO_LDADD)
-LDADD = $(CAIRO_LDADD) libcairotest.la $(am__append_9)
+LDADD = $(CAIRO_LDADD) libcairotest.la $(am__append_10)
@CAIRO_CAN_TEST_PDF_SURFACE_TRUE@pdf2png_CFLAGS = $(POPPLER_CFLAGS)
# add LDADD, so poppler uses "our" cairo
@CAIRO_CAN_TEST_PDF_SURFACE_TRUE@pdf2png_LDADD = $(LDADD) $(POPPLER_LIBS)
@@ -1786,6 +1861,12 @@ clean-checkPROGRAMS:
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
+a1-image-sample$(EXEEXT): $(a1_image_sample_OBJECTS) $(a1_image_sample_DEPENDENCIES)
+ @rm -f a1-image-sample$(EXEEXT)
+ $(LINK) $(a1_image_sample_LDFLAGS) $(a1_image_sample_OBJECTS) $(a1_image_sample_LDADD) $(LIBS)
+a1-traps-sample$(EXEEXT): $(a1_traps_sample_OBJECTS) $(a1_traps_sample_DEPENDENCIES)
+ @rm -f a1-traps-sample$(EXEEXT)
+ $(LINK) $(a1_traps_sample_LDFLAGS) $(a1_traps_sample_OBJECTS) $(a1_traps_sample_LDADD) $(LIBS)
a8-mask$(EXEEXT): $(a8_mask_OBJECTS) $(a8_mask_DEPENDENCIES)
@rm -f a8-mask$(EXEEXT)
$(LINK) $(a8_mask_LDFLAGS) $(a8_mask_OBJECTS) $(a8_mask_LDADD) $(LIBS)
@@ -1858,6 +1939,9 @@ create-from-png-stream$(EXEEXT): $(create_from_png_stream_OBJECTS) $(create_from
dash-caps-joins$(EXEEXT): $(dash_caps_joins_OBJECTS) $(dash_caps_joins_DEPENDENCIES)
@rm -f dash-caps-joins$(EXEEXT)
$(LINK) $(dash_caps_joins_LDFLAGS) $(dash_caps_joins_OBJECTS) $(dash_caps_joins_LDADD) $(LIBS)
+dash-curve$(EXEEXT): $(dash_curve_OBJECTS) $(dash_curve_DEPENDENCIES)
+ @rm -f dash-curve$(EXEEXT)
+ $(LINK) $(dash_curve_LDFLAGS) $(dash_curve_OBJECTS) $(dash_curve_LDADD) $(LIBS)
dash-no-dash$(EXEEXT): $(dash_no_dash_OBJECTS) $(dash_no_dash_DEPENDENCIES)
@rm -f dash-no-dash$(EXEEXT)
$(LINK) $(dash_no_dash_LDFLAGS) $(dash_no_dash_OBJECTS) $(dash_no_dash_LDADD) $(LIBS)
@@ -1891,6 +1975,15 @@ extend-pad$(EXEEXT): $(extend_pad_OBJECTS) $(extend_pad_DEPENDENCIES)
extend-reflect$(EXEEXT): $(extend_reflect_OBJECTS) $(extend_reflect_DEPENDENCIES)
@rm -f extend-reflect$(EXEEXT)
$(LINK) $(extend_reflect_LDFLAGS) $(extend_reflect_OBJECTS) $(extend_reflect_LDADD) $(LIBS)
+extend-reflect-similar$(EXEEXT): $(extend_reflect_similar_OBJECTS) $(extend_reflect_similar_DEPENDENCIES)
+ @rm -f extend-reflect-similar$(EXEEXT)
+ $(LINK) $(extend_reflect_similar_LDFLAGS) $(extend_reflect_similar_OBJECTS) $(extend_reflect_similar_LDADD) $(LIBS)
+extend-repeat$(EXEEXT): $(extend_repeat_OBJECTS) $(extend_repeat_DEPENDENCIES)
+ @rm -f extend-repeat$(EXEEXT)
+ $(LINK) $(extend_repeat_LDFLAGS) $(extend_repeat_OBJECTS) $(extend_repeat_LDADD) $(LIBS)
+extend-repeat-similar$(EXEEXT): $(extend_repeat_similar_OBJECTS) $(extend_repeat_similar_DEPENDENCIES)
+ @rm -f extend-repeat-similar$(EXEEXT)
+ $(LINK) $(extend_repeat_similar_LDFLAGS) $(extend_repeat_similar_OBJECTS) $(extend_repeat_similar_LDADD) $(LIBS)
fallback-resolution$(EXEEXT): $(fallback_resolution_OBJECTS) $(fallback_resolution_DEPENDENCIES)
@rm -f fallback-resolution$(EXEEXT)
$(LINK) $(fallback_resolution_LDFLAGS) $(fallback_resolution_OBJECTS) $(fallback_resolution_LDADD) $(LIBS)
@@ -1921,6 +2014,9 @@ font-face-get-type$(EXEEXT): $(font_face_get_type_OBJECTS) $(font_face_get_type_
font-matrix-translation$(EXEEXT): $(font_matrix_translation_OBJECTS) $(font_matrix_translation_DEPENDENCIES)
@rm -f font-matrix-translation$(EXEEXT)
$(LINK) $(font_matrix_translation_LDFLAGS) $(font_matrix_translation_OBJECTS) $(font_matrix_translation_LDADD) $(LIBS)
+font-options$(EXEEXT): $(font_options_OBJECTS) $(font_options_DEPENDENCIES)
+ @rm -f font-options$(EXEEXT)
+ $(LINK) $(font_options_LDFLAGS) $(font_options_OBJECTS) $(font_options_LDADD) $(LIBS)
ft-font-create-for-ft-face$(EXEEXT): $(ft_font_create_for_ft_face_OBJECTS) $(ft_font_create_for_ft_face_DEPENDENCIES)
@rm -f ft-font-create-for-ft-face$(EXEEXT)
$(LINK) $(ft_font_create_for_ft_face_LDFLAGS) $(ft_font_create_for_ft_face_OBJECTS) $(ft_font_create_for_ft_face_LDADD) $(LIBS)
@@ -1945,6 +2041,9 @@ get-group-target$(EXEEXT): $(get_group_target_OBJECTS) $(get_group_target_DEPEND
get-path-extents$(EXEEXT): $(get_path_extents_OBJECTS) $(get_path_extents_DEPENDENCIES)
@rm -f get-path-extents$(EXEEXT)
$(LINK) $(get_path_extents_LDFLAGS) $(get_path_extents_OBJECTS) $(get_path_extents_LDADD) $(LIBS)
+get-xrender-format$(EXEEXT): $(get_xrender_format_OBJECTS) $(get_xrender_format_DEPENDENCIES)
+ @rm -f get-xrender-format$(EXEEXT)
+ $(LINK) $(get_xrender_format_LDFLAGS) $(get_xrender_format_OBJECTS) $(get_xrender_format_LDADD) $(LIBS)
glyph-cache-pressure$(EXEEXT): $(glyph_cache_pressure_OBJECTS) $(glyph_cache_pressure_DEPENDENCIES)
@rm -f glyph-cache-pressure$(EXEEXT)
$(LINK) $(glyph_cache_pressure_LDFLAGS) $(glyph_cache_pressure_OBJECTS) $(glyph_cache_pressure_LDADD) $(LIBS)
@@ -1960,6 +2059,9 @@ imagediff$(EXEEXT): $(imagediff_OBJECTS) $(imagediff_DEPENDENCIES)
in-fill-empty-trapezoid$(EXEEXT): $(in_fill_empty_trapezoid_OBJECTS) $(in_fill_empty_trapezoid_DEPENDENCIES)
@rm -f in-fill-empty-trapezoid$(EXEEXT)
$(LINK) $(in_fill_empty_trapezoid_LDFLAGS) $(in_fill_empty_trapezoid_OBJECTS) $(in_fill_empty_trapezoid_LDADD) $(LIBS)
+in-fill-trapezoid$(EXEEXT): $(in_fill_trapezoid_OBJECTS) $(in_fill_trapezoid_DEPENDENCIES)
+ @rm -f in-fill-trapezoid$(EXEEXT)
+ $(LINK) $(in_fill_trapezoid_LDFLAGS) $(in_fill_trapezoid_OBJECTS) $(in_fill_trapezoid_LDADD) $(LIBS)
infinite-join$(EXEEXT): $(infinite_join_OBJECTS) $(infinite_join_DEPENDENCIES)
@rm -f infinite-join$(EXEEXT)
$(LINK) $(infinite_join_LDFLAGS) $(infinite_join_OBJECTS) $(infinite_join_LDADD) $(LIBS)
@@ -2086,6 +2188,9 @@ random-intersections$(EXEEXT): $(random_intersections_OBJECTS) $(random_intersec
rectangle-rounding-error$(EXEEXT): $(rectangle_rounding_error_OBJECTS) $(rectangle_rounding_error_DEPENDENCIES)
@rm -f rectangle-rounding-error$(EXEEXT)
$(LINK) $(rectangle_rounding_error_LDFLAGS) $(rectangle_rounding_error_OBJECTS) $(rectangle_rounding_error_LDADD) $(LIBS)
+rectilinear-miter-limit$(EXEEXT): $(rectilinear_miter_limit_OBJECTS) $(rectilinear_miter_limit_DEPENDENCIES)
+ @rm -f rectilinear-miter-limit$(EXEEXT)
+ $(LINK) $(rectilinear_miter_limit_LDFLAGS) $(rectilinear_miter_limit_OBJECTS) $(rectilinear_miter_limit_LDADD) $(LIBS)
rectilinear-stroke$(EXEEXT): $(rectilinear_stroke_OBJECTS) $(rectilinear_stroke_DEPENDENCIES)
@rm -f rectilinear-stroke$(EXEEXT)
$(LINK) $(rectilinear_stroke_LDFLAGS) $(rectilinear_stroke_OBJECTS) $(rectilinear_stroke_LDADD) $(LIBS)
@@ -2222,6 +2327,8 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/a1-image-sample.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/a1-traps-sample.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/a8-mask.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/big-trap.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitmap-font.Po@am__quote@
@@ -2248,6 +2355,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/create-from-png-stream.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/create-from-png.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dash-caps-joins.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dash-curve.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dash-no-dash.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dash-offset-negative.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dash-scale.Po@am__quote@
@@ -2258,7 +2366,10 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device-offset-positive.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device-offset.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extend-pad.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extend-reflect-similar.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extend-reflect.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extend-repeat-similar.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extend-repeat.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fallback-resolution.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fill-and-stroke-alpha-add.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fill-and-stroke-alpha.Po@am__quote@
@@ -2269,6 +2380,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter-nearest-offset.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/font-face-get-type.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/font-matrix-translation.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/font-options.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft-font-create-for-ft-face.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft-text-antialias-none.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft-text-vertical-layout-type1.Po@am__quote@
@@ -2277,11 +2389,13 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get-clip.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get-group-target.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get-path-extents.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get-xrender-format.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glyph-cache-pressure.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gradient-alpha.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gradient-zero-stops.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imagediff.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/in-fill-empty-trapezoid.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/in-fill-trapezoid.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/infinite-join.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/invalid-matrix.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/leaky-dash.Po@am__quote@
@@ -2324,6 +2438,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/radial-gradient.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/random-intersections.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rectangle-rounding-error.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rectilinear-miter-limit.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rectilinear-stroke.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rel-path.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rgb24-ignore-alpha.Po@am__quote@
@@ -2777,7 +2892,7 @@ uninstall-info: uninstall-info-recursive
check: AM_MAKEFLAGS+=-k
check-local:
@FAILED_TESTS=""; \
- for t in *.log; do \
+ for t in $(TESTS:$(EXEEXT)=.log); do \
if grep -e '\<FAIL\>' $$t >/dev/null 2>&1; then \
FAILED_TESTS="$$FAILED_TESTS $${t%.log}"; \
fi; \
@@ -2856,16 +2971,43 @@ index.html: $(srcdir)/make-html.pl $(TESTS:$(EXEEXT)=.log)
# Identify identical reference images
check-ref-dups:
- @sha1sum *-ref.png > ref.hash
- @join ref.hash ref.hash | grep -v -E '( .*-ref.png).*\1' | cut -d' ' -f 1-2 | sort -u
+ @LANG=C; \
+ ( cd "$(scrdir)" && sha1sum *-ref.png | sort ) > ref.hash; \
+ join ref.hash ref.hash | grep -v -E '( .*-ref.png).*\1' | cut -d' ' -f 1-2 | sort -u
# Not exactly the best script in the world...
check-ref-missing:
- @for i in *-ref.png; do\
- echo ${REFERENCE_IMAGES} | grep -sq $$i || echo $$i; \
- done
-
-.PHONY: check-valgrind test recheck retest html rehtml check-ref-dups check-ref-missing
+ @cd "$(srcdir)"; \
+ REFS=`git ls-files "*-ref.png"`; \
+ test x = "x$$REFS" && REFS=`ls *-ref.png`; \
+ ret=true; \
+ missing=""; \
+ for i in $$REFS; do \
+ echo "" $(REFERENCE_IMAGES) "" | grep -sq " $$i " || missing="$$missing $$i" ; \
+ done ; \
+ if test -n "$$missing"; then \
+ echo "*** Error: Sanity check failed"; \
+ echo "Some reference files are not included in the distribution."; \
+ echo "You probably need to add these to Makefile.am's REFERENCE_IMAGES."; \
+ echo "Missing: $$missing"; \
+ ret=false; \
+ fi >&2; \
+ missing=""; \
+ for i in $(REFERENCE_IMAGES); do \
+ echo "" $$REFS "" | grep -sq " $$i " || missing="$$missing $$i" ; \
+ done ; \
+ if test -n "$$missing"; then \
+ echo "*** Error: Sanity check failed"; \
+ echo "Some reference files included in the distribution do not exist"; \
+ echo "or are not in git. You probably want to add these to git first."; \
+ echo "Missing: $$missing"; \
+ ret=false; \
+ fi >&2; \
+ $$ret
+
+release-verify-sane-tests: check-ref-missing
+
+.PHONY: check-valgrind test recheck retest html rehtml check-ref-dups check-ref-missing release-verify-sane-tests
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/test/a1-image-sample-ref.png b/test/a1-image-sample-ref.png
new file mode 100644
index 0000000..b4e81eb
--- /dev/null
+++ b/test/a1-image-sample-ref.png
Binary files differ
diff --git a/test/a1-image-sample.c b/test/a1-image-sample.c
new file mode 100644
index 0000000..2dc4254
--- /dev/null
+++ b/test/a1-image-sample.c
@@ -0,0 +1,83 @@
+/*
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth@cworth.org>
+ */
+
+#include "cairo-test.h"
+
+static cairo_test_draw_function_t draw;
+
+#define POINTS 10
+#define STEP (1.0 / POINTS)
+#define PAD 1
+#define WIDTH (PAD + POINTS * 2 + PAD)
+#define HEIGHT (WIDTH)
+
+cairo_test_t test = {
+ "a1-image-sample",
+ "Test sample position when drawing images with FILTER_NEAREST",
+ WIDTH, HEIGHT,
+ draw
+};
+
+/* A single, black pixel */
+static const uint32_t black_pixel = 0xff000000;
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ int i, j;
+ cairo_surface_t *surface;
+
+ surface = cairo_image_surface_create_for_data ((unsigned char *) &black_pixel,
+ CAIRO_FORMAT_ARGB32,
+ 1, 1, 4);
+
+ /* Fill background white */
+ cairo_set_source_rgb (cr, 1, 1, 1);
+ cairo_paint (cr);
+
+ /* Draw in black */
+ cairo_set_source_rgb (cr, 0, 0, 0);
+
+ cairo_translate (cr, PAD, PAD);
+ cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);
+
+ for (i = 0; i < POINTS; i++)
+ for (j = 0; j < POINTS; j++) {
+ cairo_set_source_surface (cr, surface,
+ 2 * i + i * STEP, 2 * j + j * STEP);
+ cairo_pattern_set_filter (cairo_get_source (cr),
+ CAIRO_FILTER_NEAREST);
+ cairo_paint (cr);
+ }
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test);
+}
diff --git a/test/a1-traps-sample-ref.png b/test/a1-traps-sample-ref.png
new file mode 100644
index 0000000..b4e81eb
--- /dev/null
+++ b/test/a1-traps-sample-ref.png
Binary files differ
diff --git a/test/a1-traps-sample.c b/test/a1-traps-sample.c
new file mode 100644
index 0000000..1148a8b
--- /dev/null
+++ b/test/a1-traps-sample.c
@@ -0,0 +1,72 @@
+/*
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth@cworth.org>
+ */
+
+#include "cairo-test.h"
+
+static cairo_test_draw_function_t draw;
+
+#define POINTS 10
+#define STEP (1.0 / POINTS)
+#define PAD 1
+#define WIDTH (PAD + POINTS * 2 + PAD)
+#define HEIGHT (WIDTH)
+
+cairo_test_t test = {
+ "a1-traps-sample",
+ "Test sample position when drawing trapezoids with ANTIALIAS_NONE",
+ WIDTH, HEIGHT,
+ draw
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ int i, j;
+
+ /* Fill background white */
+ cairo_set_source_rgb (cr, 1, 1, 1);
+ cairo_paint (cr);
+
+ /* Draw in black */
+ cairo_set_source_rgb (cr, 0, 0, 0);
+
+ cairo_translate (cr, PAD, PAD);
+ cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);
+
+ for (i = 0; i < POINTS; i++)
+ for (j = 0; j < POINTS; j++) {
+ cairo_rectangle (cr, 2 * i + i * STEP, 2 * j + j * STEP, 1, 1);
+ cairo_fill (cr);
+ }
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test);
+}
diff --git a/test/a8-mask.c b/test/a8-mask.c
index e21b9df..14d4f8f 100644
--- a/test/a8-mask.c
+++ b/test/a8-mask.c
@@ -20,7 +20,8 @@
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * Author: Jeff Muizelaar <jeff@infidigm.net>
+ * Authors: Jeff Muizelaar <jeff@infidigm.net>
+ * Carl Worth <cworth@cworth.org>
*/
#include "cairo-test.h"
@@ -29,42 +30,142 @@ static cairo_test_draw_function_t draw;
cairo_test_t test = {
"a8-mask",
- "test masks of CAIRO_FORMAT_A8"
- "\nimage backend fails because libpixman only handles (stride % sizeof(pixman_bits) == 0)",
+ "test masks of CAIRO_FORMAT_A8",
8, 8,
draw
};
-static unsigned char mask[] = {
- 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0,
- 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0,
- 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0,
- 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0,
- 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0,
- 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0,
- 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0,
- 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0
+#define MASK_WIDTH 8
+#define MASK_HEIGHT 8
+
+static unsigned char mask[MASK_WIDTH * MASK_HEIGHT] = {
+ 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0,
};
static cairo_test_status_t
-draw (cairo_t *cr, int width, int height)
+check_status (cairo_status_t status, cairo_status_t expected)
+{
+ if (status == expected)
+ return CAIRO_TEST_SUCCESS;
+
+ cairo_test_log ("Error: Expected status value %d (%s), received %d (%s)\n",
+ expected,
+ cairo_status_to_string (expected),
+ status,
+ cairo_status_to_string (status));
+ return CAIRO_TEST_FAILURE;
+}
+
+static cairo_test_status_t
+test_surface_with_width_and_stride (int width, int stride,
+ cairo_status_t expected)
+{
+ cairo_test_status_t status;
+ cairo_surface_t *surface;
+ cairo_t *cr;
+ unsigned char *data;
+
+ cairo_test_log ("Creating surface with width %d and stride %d\n",
+ width, stride);
+
+ data = malloc (stride);
+
+ surface = cairo_image_surface_create_for_data (data, CAIRO_FORMAT_A8,
+ width, 1, stride);
+ cr = cairo_create (surface);
+
+ cairo_paint (cr);
+
+ status = check_status (cairo_surface_status (surface), expected);
+ if (status)
+ return status;
+
+ status = check_status (cairo_status (cr), expected);
+ if (status)
+ return status;
+
+ free (data);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+static cairo_test_status_t
+draw (cairo_t *cr, int dst_width, int dst_height)
{
+ int test_width, stride, row;
+ unsigned char *src, *dst, *mask_aligned;
cairo_surface_t *surface;
cairo_pattern_t *pattern;
+ cairo_test_status_t status;
+ cairo_status_t expected;
+
+ for (test_width = 0; test_width < 40; test_width++) {
+ stride = cairo_format_stride_for_width (CAIRO_FORMAT_A8,
+ test_width);
+
+ /* First create a surface using the width as the stride, (most
+ * of these should fail). */
+ expected = (stride == test_width) ?
+ CAIRO_STATUS_SUCCESS : CAIRO_STATUS_INVALID_STRIDE;
- cairo_set_source_rgb (cr, 0, 0, 1);
+ status = test_surface_with_width_and_stride (test_width,
+ test_width,
+ expected);
+ if (status)
+ return status;
+
+ /* Then create a surface using the correct stride, (should
+ always succeed).*/
+ status = test_surface_with_width_and_stride (test_width,
+ stride,
+ CAIRO_STATUS_SUCCESS);
+ if (status)
+ return status;
+ }
+
+ /* Now test actually drawing through our mask data, allocating and
+ * copying with the proper stride. */
+ stride = cairo_format_stride_for_width (CAIRO_FORMAT_A8,
+ MASK_WIDTH);
+
+ mask_aligned = malloc (stride * MASK_HEIGHT);
+
+ src = mask;
+ dst = mask_aligned;
+ for (row = 0; row < MASK_HEIGHT; row++) {
+ memcpy (dst, src, MASK_WIDTH);
+ src += MASK_WIDTH;
+ dst += stride;
+ }
+
+ surface = cairo_image_surface_create_for_data (mask,
+ CAIRO_FORMAT_A8,
+ MASK_WIDTH,
+ MASK_HEIGHT,
+ stride);
+
+ /* Paint background blue */
+ cairo_set_source_rgb (cr, 0, 0, 1); /* blue */
cairo_paint (cr);
- surface = cairo_image_surface_create_for_data (mask, CAIRO_FORMAT_A8,
- 7, 8, 7);
+ /* Then paint red through our mask */
pattern = cairo_pattern_create_for_surface (surface);
- cairo_set_source_rgb (cr, 1, 0, 0);
+ cairo_set_source_rgb (cr, 1, 0, 0); /* red */
cairo_mask (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_surface_destroy (surface);
+ free (mask_aligned);
+
return CAIRO_TEST_SUCCESS;
}
diff --git a/test/bitmap-font.c b/test/bitmap-font.c
index 2a9754e..a9e4e8b 100644
--- a/test/bitmap-font.c
+++ b/test/bitmap-font.c
@@ -45,11 +45,44 @@ cairo_test_t test = {
draw
};
+static cairo_bool_t
+font_extents_equal (const cairo_font_extents_t *A,
+ const cairo_font_extents_t *B)
+{
+ return
+ CAIRO_TEST_DOUBLE_EQUALS (A->ascent, B->ascent) &&
+ CAIRO_TEST_DOUBLE_EQUALS (A->descent, B->descent) &&
+ CAIRO_TEST_DOUBLE_EQUALS (A->height, B->height) &&
+ CAIRO_TEST_DOUBLE_EQUALS (A->max_x_advance, B->max_x_advance) &&
+ CAIRO_TEST_DOUBLE_EQUALS (A->max_y_advance, B->max_y_advance);
+}
+
+static cairo_test_status_t
+check_font_extents (cairo_t *cr, const char *comment)
+{
+ cairo_font_extents_t font_extents, ref_font_extents = {11, 2, 13, 6, 0};
+
+ memset (&font_extents, 0xff, sizeof (cairo_font_extents_t));
+ cairo_font_extents (cr, &font_extents);
+ if (! font_extents_equal (&font_extents, &ref_font_extents)) {
+ cairo_test_log ("Error: %s: cairo_font_extents(); extents (%g, %g, %g, %g, %g)\n",
+ comment,
+ font_extents.ascent, font_extents.descent,
+ font_extents.height,
+ font_extents.max_x_advance, font_extents.max_y_advance);
+ return CAIRO_TEST_FAILURE;
+ }
+
+ return CAIRO_TEST_SUCCESS;
+}
+
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
FcPattern *pattern;
cairo_font_face_t *font_face;
+ cairo_font_extents_t font_extents;
+ cairo_font_options_t *font_options;
cairo_status_t status;
const char *srcdir = getenv ("srcdir");
char *filename;
@@ -92,12 +125,44 @@ draw (cairo_t *cr, int width, int height)
cairo_set_font_face (cr, font_face);
+#define CHECK_FONT_EXTENTS(comment) if (check_font_extents (cr, (comment)) != CAIRO_TEST_SUCCESS) return CAIRO_TEST_FAILURE
+
+ cairo_font_extents (cr, &font_extents);
+ CHECK_FONT_EXTENTS ("default");
+
FcPatternDestroy (pattern);
cairo_font_face_destroy (font_face);
- cairo_move_to (cr, 1, TEXT_SIZE - 3);
+ font_options = cairo_font_options_create ();
+
+ cairo_font_options_set_hint_metrics (font_options, CAIRO_HINT_METRICS_ON);
+ cairo_set_font_options (cr, font_options);
+
+ CHECK_FONT_EXTENTS ("HINT_METRICS_ON");
+
+ cairo_move_to (cr, 1, font_extents.ascent - 1);
cairo_set_source_rgb (cr, 0.0, 0.0, 1.0); /* blue */
- cairo_show_text (cr, "the quick brown fox");
+
+
+ cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
+ cairo_set_font_options (cr, font_options);
+ CHECK_FONT_EXTENTS ("HINT_METRICS_ON HINT_STYLE_NONE");
+ cairo_show_text (cr, "the ");
+
+ cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_SLIGHT);
+ cairo_set_font_options (cr, font_options);
+ CHECK_FONT_EXTENTS ("HINT_METRICS_ON HINT_STYLE_SLIGHT");
+ cairo_show_text (cr, "quick ");
+
+ cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_MEDIUM);
+ cairo_set_font_options (cr, font_options);
+ CHECK_FONT_EXTENTS ("HINT_METRICS_ON HINT_STYLE_MEDIUM");
+ cairo_show_text (cr, "brown");
+
+ cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_FULL);
+ cairo_set_font_options (cr, font_options);
+ CHECK_FONT_EXTENTS ("HINT_METRICS_ON HINT_STYLE_FULL");
+ cairo_show_text (cr, " fox");
/* Switch from show_text to text_path/fill to exercise bug #7889 */
cairo_text_path (cr, " jumps over a lazy dog");
@@ -105,13 +170,35 @@ draw (cairo_t *cr, int width, int height)
/* And test it rotated as well for the sake of bug #7888 */
- /* XXX: The math for the vertical positioning here is all wrong,
- * but it is landing where I want it. Someone who understands
- * fonts at all should fix this. */
- cairo_move_to (cr, width -1, 2 * (TEXT_SIZE - 5));
+ cairo_translate (cr, width, height);
cairo_rotate (cr, M_PI);
- cairo_show_text (cr, "the quick");
- cairo_show_text (cr, " brown fox");
+
+ cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_DEFAULT);
+ cairo_font_options_set_hint_metrics (font_options, CAIRO_HINT_METRICS_OFF);
+ cairo_set_font_options (cr, font_options);
+ CHECK_FONT_EXTENTS ("HINT_METRICS_OFF");
+
+ cairo_move_to (cr, 1, font_extents.height - font_extents.descent - 1);
+
+ cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
+ cairo_set_font_options (cr, font_options);
+ CHECK_FONT_EXTENTS ("HINT_METRICS_OFF HINT_STYLE_NONE");
+ cairo_show_text (cr, "the ");
+
+ cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_SLIGHT);
+ cairo_set_font_options (cr, font_options);
+ CHECK_FONT_EXTENTS ("HINT_METRICS_OFF HINT_STYLE_SLIGHT");
+ cairo_show_text (cr, "quick");
+
+ cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_MEDIUM);
+ cairo_set_font_options (cr, font_options);
+ CHECK_FONT_EXTENTS ("HINT_METRICS_OFF HINT_STYLE_MEDIUM");
+ cairo_show_text (cr, " brown");
+
+ cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_FULL);
+ cairo_set_font_options (cr, font_options);
+ CHECK_FONT_EXTENTS ("HINT_METRICS_OFF HINT_STYLE_FULL");
+ cairo_show_text (cr, " fox");
cairo_text_path (cr, " jumps over");
cairo_text_path (cr, " a lazy dog");
diff --git a/test/cairo-test.c b/test/cairo-test.c
index 8fbd5e3..61cbb31 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -79,6 +79,8 @@ static const char *vector_ignored_tests[] = {
/* We can't match the results of tests that depend on
* CAIRO_ANTIALIAS_NONE/SUBPIXEL for vector backends
* (nor do we care). */
+ "a1-image-sample",
+ "a1-traps-sample",
"ft-text-antialias-none",
"rectangle-rounding-error",
"text-antialias-gray",
@@ -701,8 +703,6 @@ cairo_test_create_surface_from_png (const char *filename)
image = cairo_image_surface_create_from_png (srcdir_filename);
free (srcdir_filename);
}
- if (cairo_surface_status(image))
- return NULL;
}
return image;
diff --git a/test/cairo-test.h b/test/cairo-test.h
index d7ed3a7..6b6b373 100644
--- a/test/cairo-test.h
+++ b/test/cairo-test.h
@@ -133,6 +133,8 @@ cairo_test_create_pattern_from_png (const char *filename);
cairo_status_t
cairo_test_paint_checkered (cairo_t *cr);
+#define CAIRO_TEST_DOUBLE_EQUALS(a,b) (fabs((a)-(b)) < 0.00001)
+
CAIRO_END_DECLS
#endif
diff --git a/test/dash-curve-ref.png b/test/dash-curve-ref.png
new file mode 100644
index 0000000..542b2d8
--- /dev/null
+++ b/test/dash-curve-ref.png
Binary files differ
diff --git a/test/dash-curve.c b/test/dash-curve.c
new file mode 100644
index 0000000..48f5c12
--- /dev/null
+++ b/test/dash-curve.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright © 2007 Jeff Smith
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Jeff Smith not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Jeff Smith makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * JEFF SMITH DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL JEFF SMITH BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Jeff Smith <whydoubt@yahoo.com>
+ */
+
+#include "cairo-test.h"
+
+static cairo_test_draw_function_t draw;
+
+cairo_test_t test = {
+ "dash-curve",
+ "Tries to explore the state space of the dashing code along curves",
+ 25*60, 4*60,
+ draw
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ double dashes[2] = {20, 20};
+ int a=0, b=0, c=0;
+
+ cairo_set_source_rgb (cr, 0, 0, 0);
+ cairo_paint (cr);
+
+ for (a=0; a<4; a++)
+ for (b=0; b<5; b++)
+ for (c=0; c<5; c++) {
+ cairo_move_to (cr, ((b*5)+c)*60+10, a*60+10);
+ cairo_rel_curve_to (cr,
+ 0, b*10,
+ 0, b*10,
+ c*10, b*10);
+
+ cairo_set_source_rgb (cr, 1, 1, 1);
+ cairo_set_line_width (cr, 8);
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
+ cairo_set_dash (cr, dashes, 2, a*10);
+ cairo_stroke_preserve (cr);
+
+ cairo_set_source_rgb (cr, 0, 0.5, 1);
+ cairo_set_line_width (cr, 2);
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
+ cairo_set_dash (cr, 0, 0, 0);
+ cairo_stroke (cr);
+ }
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test);
+}
diff --git a/test/extend-reflect-similar-ref.png b/test/extend-reflect-similar-ref.png
new file mode 100644
index 0000000..93a8b00
--- /dev/null
+++ b/test/extend-reflect-similar-ref.png
Binary files differ
diff --git a/test/extend-reflect-similar.c b/test/extend-reflect-similar.c
new file mode 100644
index 0000000..1ff4039
--- /dev/null
+++ b/test/extend-reflect-similar.c
@@ -0,0 +1,56 @@
+#include "cairo-test.h"
+
+const char png_filename[] = "romedalen.png";
+
+static cairo_test_draw_function_t draw;
+
+cairo_test_t test = {
+ "extend-reflect-similar",
+ "Test CAIRO_EXTEND_REFLECT for surface patterns",
+ 256 + 32*2, 192 + 32*2,
+ draw
+};
+
+static cairo_surface_t *
+clone_similar_surface (cairo_surface_t * target, cairo_surface_t *surface)
+{
+ cairo_t *cr;
+ cairo_surface_t *similar;
+
+ similar = cairo_surface_create_similar (target,
+ cairo_surface_get_content (surface),
+ cairo_image_surface_get_width (surface),
+ cairo_image_surface_get_height (surface));
+ cr = cairo_create (similar);
+ cairo_set_source_surface (cr, surface, 0, 0);
+ cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
+ cairo_paint (cr);
+ cairo_destroy (cr);
+
+ return similar;
+}
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_surface_t *surface;
+ cairo_surface_t *similar;
+
+ surface = cairo_test_create_surface_from_png (png_filename);
+ similar = clone_similar_surface (cairo_get_group_target (cr), surface);
+ cairo_set_source_surface (cr, similar, 32, 32);
+ cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REFLECT);
+
+ cairo_paint (cr);
+
+ cairo_surface_destroy (similar);
+ cairo_surface_destroy (surface);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test);
+}
diff --git a/test/extend-reflect.c b/test/extend-reflect.c
index e23c8f6..e9d07cc 100644
--- a/test/extend-reflect.c
+++ b/test/extend-reflect.c
@@ -24,6 +24,8 @@ draw (cairo_t *cr, int width, int height)
cairo_paint (cr);
+ cairo_surface_destroy (surface);
+
return CAIRO_TEST_SUCCESS;
}
diff --git a/test/extend-repeat-ref.png b/test/extend-repeat-ref.png
new file mode 100644
index 0000000..ee2527f
--- /dev/null
+++ b/test/extend-repeat-ref.png
Binary files differ
diff --git a/test/extend-repeat-similar-ref.png b/test/extend-repeat-similar-ref.png
new file mode 100644
index 0000000..ee2527f
--- /dev/null
+++ b/test/extend-repeat-similar-ref.png
Binary files differ
diff --git a/test/extend-repeat-similar.c b/test/extend-repeat-similar.c
new file mode 100644
index 0000000..1a14125
--- /dev/null
+++ b/test/extend-repeat-similar.c
@@ -0,0 +1,56 @@
+#include "cairo-test.h"
+
+const char png_filename[] = "romedalen.png";
+
+static cairo_test_draw_function_t draw;
+
+cairo_test_t test = {
+ "extend-repeat-similar",
+ "Test CAIRO_EXTEND_REPEAT for surface patterns",
+ 256 + 32*2, 192 + 32*2,
+ draw
+};
+
+static cairo_surface_t *
+clone_similar_surface (cairo_surface_t * target, cairo_surface_t *surface)
+{
+ cairo_t *cr;
+ cairo_surface_t *similar;
+
+ similar = cairo_surface_create_similar (target,
+ cairo_surface_get_content (surface),
+ cairo_image_surface_get_width (surface),
+ cairo_image_surface_get_height (surface));
+ cr = cairo_create (similar);
+ cairo_set_source_surface (cr, surface, 0, 0);
+ cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
+ cairo_paint (cr);
+ cairo_destroy (cr);
+
+ return similar;
+}
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_surface_t *surface;
+ cairo_surface_t *similar;
+
+ surface = cairo_test_create_surface_from_png (png_filename);
+ similar = clone_similar_surface (cairo_get_group_target (cr), surface);
+ cairo_set_source_surface (cr, similar, 32, 32);
+ cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
+
+ cairo_paint (cr);
+
+ cairo_surface_destroy (similar);
+ cairo_surface_destroy (surface);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test);
+}
diff --git a/test/extend-repeat.c b/test/extend-repeat.c
new file mode 100644
index 0000000..351b63b
--- /dev/null
+++ b/test/extend-repeat.c
@@ -0,0 +1,34 @@
+#include "cairo-test.h"
+
+const char png_filename[] = "romedalen.png";
+
+static cairo_test_draw_function_t draw;
+
+cairo_test_t test = {
+ "extend-repeat",
+ "Test CAIRO_EXTEND_REPEAT for surface patterns",
+ 256 + 32*2, 192 + 32*2,
+ draw
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_surface_t *surface;
+
+ surface = cairo_test_create_surface_from_png (png_filename);
+ cairo_set_source_surface (cr, surface, 32, 32);
+ cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
+
+ cairo_paint (cr);
+
+ cairo_surface_destroy (surface);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test);
+}
diff --git a/test/fill-rule-ps-rgb24-ref.png b/test/fill-rule-ps-rgb24-ref.png
new file mode 100644
index 0000000..8e1efc2
--- /dev/null
+++ b/test/fill-rule-ps-rgb24-ref.png
Binary files differ
diff --git a/test/font-matrix-translation.c b/test/font-matrix-translation.c
index 067cbb5..06b407d 100644
--- a/test/font-matrix-translation.c
+++ b/test/font-matrix-translation.c
@@ -38,15 +38,44 @@ cairo_test_t test = {
draw
};
-static void
+static cairo_bool_t
+text_extents_equal (const cairo_text_extents_t *A,
+ const cairo_text_extents_t *B)
+{
+ return A->x_bearing == B->x_bearing &&
+ A->y_bearing == B->y_bearing &&
+ A->width == B->width &&
+ A->height == B->height &&
+ A->x_advance == B->x_advance &&
+ A->y_advance == B->y_advance;
+}
+
+static cairo_test_status_t
box_text (cairo_t *cr, const char *utf8, double x, double y)
{
double line_width;
- cairo_text_extents_t extents;
+ cairo_text_extents_t extents = {}, scaled_extents = {};
+ cairo_scaled_font_t *scaled_font;
cairo_save (cr);
cairo_text_extents (cr, utf8, &extents);
+
+ scaled_font = cairo_get_scaled_font (cr);
+ cairo_scaled_font_text_extents (scaled_font, TEXT, &scaled_extents);
+ if (! text_extents_equal (&extents, &scaled_extents)) {
+ cairo_test_log ("Error: extents differ when they shouldn't:\n"
+ "cairo_text_extents(); extents (%g, %g, %g, %g, %g, %g)\n"
+ "cairo_scaled_font_text_extents(); extents (%g, %g, %g, %g, %g, %g)\n",
+ extents.x_bearing, extents.y_bearing,
+ extents.width, extents.height,
+ extents.x_advance, extents.y_advance,
+ scaled_extents.x_bearing, scaled_extents.y_bearing,
+ scaled_extents.width, scaled_extents.height,
+ scaled_extents.x_advance, scaled_extents.y_advance);
+ return CAIRO_TEST_FAILURE;
+ }
+
line_width = cairo_get_line_width (cr);
cairo_rectangle (cr,
x + extents.x_bearing - line_width / 2,
@@ -59,11 +88,14 @@ box_text (cairo_t *cr, const char *utf8, double x, double y)
cairo_show_text (cr, utf8);
cairo_restore (cr);
+
+ return CAIRO_TEST_SUCCESS;
}
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
+ cairo_test_status_t status;
cairo_text_extents_t extents;
cairo_matrix_t matrix;
@@ -82,7 +114,9 @@ draw (cairo_t *cr, int width, int height)
/* Draw text and bounding box */
cairo_set_source_rgb (cr, 0, 0, 0); /* black */
- box_text (cr, TEXT, 0, - extents.y_bearing);
+ status = box_text (cr, TEXT, 0, - extents.y_bearing);
+ if (status)
+ return status;
/* Then draw again with the same coordinates, but with a font
* matrix to position the text below and shifted a bit to the
@@ -92,7 +126,9 @@ draw (cairo_t *cr, int width, int height)
cairo_set_font_matrix (cr, &matrix);
cairo_set_source_rgb (cr, 0, 0, 1); /* blue */
- box_text (cr, TEXT, 0, - extents.y_bearing);
+ status = box_text (cr, TEXT, 0, - extents.y_bearing);
+ if (status)
+ return status;
return CAIRO_TEST_SUCCESS;
}
diff --git a/test/font-options.c b/test/font-options.c
new file mode 100644
index 0000000..fdcde15
--- /dev/null
+++ b/test/font-options.c
@@ -0,0 +1,91 @@
+/*
+ * Copyright © 2008 Chris Wilson
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Chris Wilson not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Chris Wilson makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * CHRIS WILSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL CHRIS WILSON BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Chris Wilson <chris@chris-wilson.co.uk>
+ */
+
+#include <cairo.h>
+#include <assert.h>
+#include <stdlib.h>
+
+int
+main (void)
+{
+ cairo_font_options_t *options1;
+ cairo_font_options_t *options2;
+ cairo_surface_t *surface;
+ cairo_matrix_t identity;
+ cairo_t *cr;
+ cairo_scaled_font_t *scaled_font;
+
+ /* first check NULL handling of cairo_font_options_t */
+ options1 = cairo_font_options_create ();
+ options2 = cairo_font_options_copy (NULL);
+
+ assert (cairo_font_options_equal (options1, options2));
+ assert (cairo_font_options_equal (NULL, options2));
+ assert (cairo_font_options_equal (options1, NULL));
+
+ assert (cairo_font_options_hash (options1) == cairo_font_options_hash (options2));
+ assert (cairo_font_options_hash (NULL) == cairo_font_options_hash (options2));
+ assert (cairo_font_options_hash (options1) == cairo_font_options_hash (NULL));
+
+ cairo_font_options_merge (NULL, NULL);
+ cairo_font_options_merge (options1, NULL);
+ cairo_font_options_merge (options1, options2);
+
+ cairo_font_options_destroy (NULL);
+ cairo_font_options_destroy (options1);
+ cairo_font_options_destroy (options2);
+
+ cairo_font_options_set_antialias (NULL, CAIRO_ANTIALIAS_DEFAULT);
+ cairo_font_options_get_antialias (NULL);
+
+ cairo_font_options_set_subpixel_order (NULL, CAIRO_SUBPIXEL_ORDER_DEFAULT);
+ cairo_font_options_get_subpixel_order (NULL);
+
+ cairo_font_options_set_hint_style (NULL, CAIRO_HINT_STYLE_DEFAULT);
+ cairo_font_options_get_hint_style (NULL);
+
+ cairo_font_options_set_hint_metrics (NULL, CAIRO_HINT_METRICS_DEFAULT);
+ cairo_font_options_get_hint_metrics (NULL);
+
+ /* Now try creating fonts with NULLs */
+ surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 0, 0);
+ cr = cairo_create (surface);
+ cairo_surface_destroy (surface);
+
+ cairo_matrix_init_identity (&identity);
+ scaled_font = cairo_scaled_font_create (cairo_get_font_face (cr),
+ &identity, &identity,
+ NULL);
+ assert (cairo_scaled_font_status (scaled_font) == CAIRO_STATUS_SUCCESS);
+ cairo_scaled_font_get_font_options (scaled_font, NULL);
+ cairo_scaled_font_destroy (scaled_font);
+
+ cairo_set_font_options (cr, NULL);
+ cairo_get_font_options (cr, NULL);
+
+ cairo_destroy (cr);
+
+ return 0;
+}
diff --git a/test/get-path-extents.c b/test/get-path-extents.c
index 917039e..12901fd 100644
--- a/test/get-path-extents.c
+++ b/test/get-path-extents.c
@@ -36,7 +36,7 @@ cairo_test_t test = {
draw
};
-enum ExtentsType { FILL, STROKE };
+enum ExtentsType { FILL, STROKE, PATH };
enum Relation { EQUALS, APPROX_EQUALS, CONTAINS };
@@ -59,6 +59,10 @@ check_extents (const char *message, cairo_t *cr, enum ExtentsType type,
type_string = "stroke";
cairo_stroke_extents (cr, &ext_x1, &ext_y1, &ext_x2, &ext_y2);
break;
+ case PATH:
+ type_string = "path";
+ cairo_path_extents (cr, &ext_x1, &ext_y1, &ext_x2, &ext_y2);
+ break;
}
/* let empty rects match */
@@ -102,7 +106,8 @@ draw (cairo_t *cr, int width, int height)
cairo_surface_t *surface;
cairo_t *cr2;
const char *phase;
- cairo_text_extents_t extents;
+ const char string[] = "The quick brown fox jumps over the lazy dog.";
+ cairo_text_extents_t extents, scaled_font_extents;
cairo_test_status_t ret = CAIRO_TEST_SUCCESS;
surface = cairo_surface_create_similar (cairo_get_group_target (cr),
@@ -118,9 +123,77 @@ draw (cairo_t *cr, int width, int height)
phase = "No path";
if (!check_extents (phase, cr2, FILL, EQUALS, 0, 0, 0, 0) ||
- !check_extents (phase, cr2, STROKE, EQUALS, 0, 0, 0, 0))
+ !check_extents (phase, cr2, STROKE, EQUALS, 0, 0, 0, 0) ||
+ !check_extents (phase, cr2, PATH, EQUALS, 0, 0, 0, 0))
+ ret = CAIRO_TEST_FAILURE;
+
+ cairo_save (cr2);
+
+ cairo_new_path (cr2);
+ cairo_move_to (cr2, 200, 400);
+ cairo_rel_line_to (cr2, 0., 0.);
+ phase = "Degenerate line";
+ if (!check_extents (phase, cr2, FILL, EQUALS, 0, 0, 0, 0) ||
+ !check_extents (phase, cr2, STROKE, EQUALS, 0, 0, 0, 0) ||
+ !check_extents (phase, cr2, PATH, EQUALS, 200, 400, 0, 0))
+ ret = CAIRO_TEST_FAILURE;
+
+ cairo_new_path (cr2);
+ cairo_move_to (cr2, 200, 400);
+ cairo_rel_curve_to (cr2, 0., 0., 0., 0., 0., 0.);
+ phase = "Degenerate curve";
+ if (!check_extents (phase, cr2, FILL, EQUALS, 0, 0, 0, 0) ||
+ !check_extents (phase, cr2, STROKE, EQUALS, 0, 0, 0, 0) ||
+ !check_extents (phase, cr2, PATH, EQUALS, 200, 400, 0, 0))
+ ret = CAIRO_TEST_FAILURE;
+
+ cairo_new_path (cr2);
+ cairo_arc (cr2, 200, 400, 0., 0, 2 * M_PI);
+ phase = "Degenerate arc (R=0)";
+ if (!check_extents (phase, cr2, FILL, EQUALS, 0, 0, 0, 0) ||
+ !check_extents (phase, cr2, STROKE, EQUALS, 0, 0, 0, 0) ||
+ !check_extents (phase, cr2, PATH, EQUALS, 200, 400, 0, 0))
ret = CAIRO_TEST_FAILURE;
+ cairo_new_path (cr2);
+ cairo_arc (cr2, 200, 400, 10., 0, 0);
+ phase = "Degenerate arc (Θ=0)";
+ if (!check_extents (phase, cr2, FILL, EQUALS, 0, 0, 0, 0) ||
+ !check_extents (phase, cr2, STROKE, EQUALS, 0, 0, 0, 0) ||
+ !check_extents (phase, cr2, PATH, EQUALS, 200, 400, 0, 0))
+ ret = CAIRO_TEST_FAILURE;
+
+ cairo_new_path (cr2);
+ cairo_restore (cr2);
+
+ /* Test that with CAIRO_LINE_CAP_ROUND, we get "dots" from
+ * cairo_move_to; cairo_rel_line_to(0,0) */
+ cairo_save (cr2);
+
+ cairo_set_line_cap (cr2, CAIRO_LINE_CAP_ROUND);
+ cairo_set_line_width (cr2, 20);
+
+ cairo_move_to (cr2, 200, 400);
+ cairo_rel_line_to (cr2, 0, 0);
+ phase = "Single 'dot'";
+ if (!check_extents (phase, cr2, FILL, EQUALS, 0, 0, 0, 0) ||
+ !check_extents (phase, cr2, STROKE, EQUALS, 190, 390, 20, 20) ||
+ !check_extents (phase, cr2, PATH, EQUALS, 200, 400, 0, 0))
+ ret = CAIRO_TEST_FAILURE;
+
+ /* Add another dot without starting a new path */
+ cairo_move_to (cr2, 100, 500);
+ cairo_rel_line_to (cr2, 0, 0);
+ phase = "Multiple 'dots'";
+ if (!check_extents (phase, cr2, FILL, EQUALS, 0, 0, 0, 0) ||
+ !check_extents (phase, cr2, STROKE, EQUALS, 90, 390, 120, 120) ||
+ !check_extents (phase, cr2, PATH, EQUALS, 100, 400, 100, 100))
+ ret = CAIRO_TEST_FAILURE;
+
+ cairo_new_path (cr2);
+
+ cairo_restore (cr2);
+
/* http://bugs.freedesktop.org/show_bug.cgi?id=7965 */
phase = "A vertical, open path";
cairo_save (cr2);
@@ -129,7 +202,8 @@ draw (cairo_t *cr, int width, int height)
cairo_move_to (cr2, 0, 180);
cairo_line_to (cr2, 750, 180);
if (!check_extents (phase, cr2, FILL, EQUALS, 0, 0, 0, 0) ||
- !check_extents (phase, cr2, STROKE, EQUALS, -5, 175, 760, 10))
+ !check_extents (phase, cr2, STROKE, EQUALS, -5, 175, 760, 10) ||
+ !check_extents (phase, cr2, PATH, EQUALS, 0, 180, 755, 0))
ret = CAIRO_TEST_FAILURE;
cairo_new_path (cr2);
cairo_restore (cr2);
@@ -138,7 +212,8 @@ draw (cairo_t *cr, int width, int height)
cairo_save (cr2);
cairo_rectangle (cr2, 10, 10, 80, 80);
if (!check_extents (phase, cr2, FILL, EQUALS, 10, 10, 80, 80) ||
- !check_extents (phase, cr2, STROKE, EQUALS, 5, 5, 90, 90))
+ !check_extents (phase, cr2, STROKE, EQUALS, 5, 5, 90, 90) ||
+ !check_extents (phase, cr2, PATH, EQUALS, 10, 10, 80, 80))
ret = CAIRO_TEST_FAILURE;
cairo_new_path (cr2);
cairo_restore (cr2);
@@ -148,7 +223,8 @@ draw (cairo_t *cr, int width, int height)
cairo_rectangle (cr2, 10, 10, 10, 10);
cairo_rectangle (cr2, 20, 20, 10, 10);
if (!check_extents (phase, cr2, FILL, EQUALS, 10, 10, 20, 20) ||
- !check_extents (phase, cr2, STROKE, EQUALS, 5, 5, 30, 30))
+ !check_extents (phase, cr2, STROKE, EQUALS, 5, 5, 30, 30) ||
+ !check_extents (phase, cr2, PATH, EQUALS, 10, 10, 20, 20))
ret = CAIRO_TEST_FAILURE;
cairo_new_path (cr2);
cairo_restore (cr2);
@@ -162,11 +238,61 @@ draw (cairo_t *cr, int width, int height)
/* miter joins protrude 5*(1+sqrt(2)) above the top-left corner and to
the right of the bottom-right corner */
if (!check_extents (phase, cr2, FILL, EQUALS, 10, 10, 80, 80) ||
- !check_extents (phase, cr2, STROKE, CONTAINS, 0, 5, 95, 95))
+ !check_extents (phase, cr2, STROKE, CONTAINS, 0, 5, 95, 95) ||
+ !check_extents (phase, cr2, PATH, CONTAINS, 10, 10, 80, 80))
ret = CAIRO_TEST_FAILURE;
cairo_new_path (cr2);
cairo_restore (cr2);
+ cairo_save (cr2);
+
+ cairo_set_line_width (cr2, 4);
+
+ cairo_rectangle (cr2, 10, 10, 30, 30);
+ cairo_rectangle (cr2, 25, 10, 15, 30);
+
+ cairo_set_fill_rule (cr2, CAIRO_FILL_RULE_EVEN_ODD);
+ phase = "EVEN_ODD overlapping rectangles";
+ if (!check_extents (phase, cr2, FILL, EQUALS, 10, 10, 15, 30) ||
+ !check_extents (phase, cr2, STROKE, EQUALS, 8, 8, 34, 34) ||
+ !check_extents (phase, cr2, PATH, EQUALS, 10, 10, 30, 30))
+ ret = CAIRO_TEST_FAILURE;
+
+ /* Test other fill rule with the same path. */
+
+ cairo_set_fill_rule (cr2, CAIRO_FILL_RULE_WINDING);
+ phase = "WINDING overlapping rectangles";
+ if (!check_extents (phase, cr2, FILL, EQUALS, 10, 10, 30, 30) ||
+ !check_extents (phase, cr2, STROKE, EQUALS, 8, 8, 34, 34) ||
+ !check_extents (phase, cr2, PATH, EQUALS, 10, 10, 30, 30))
+ ret = CAIRO_TEST_FAILURE;
+
+ /* Now, change the direction of the second rectangle and test both
+ * fill rules again. */
+ cairo_new_path (cr2);
+ cairo_rectangle (cr2, 10, 10, 30, 30);
+ cairo_rectangle (cr2, 25, 40, 15, -30);
+
+ cairo_set_fill_rule (cr2, CAIRO_FILL_RULE_EVEN_ODD);
+ phase = "EVEN_ODD overlapping rectangles";
+ if (!check_extents (phase, cr2, FILL, EQUALS, 10, 10, 15, 30) ||
+ !check_extents (phase, cr2, STROKE, EQUALS, 8, 8, 34, 34) ||
+ !check_extents (phase, cr2, PATH, EQUALS, 10, 10, 30, 30))
+ ret = CAIRO_TEST_FAILURE;
+
+ /* Test other fill rule with the same path. */
+
+ cairo_set_fill_rule (cr2, CAIRO_FILL_RULE_WINDING);
+ phase = "WINDING overlapping rectangles";
+ if (!check_extents (phase, cr2, FILL, EQUALS, 10, 10, 15, 30) ||
+ !check_extents (phase, cr2, STROKE, EQUALS, 8, 8, 34, 34) ||
+ !check_extents (phase, cr2, PATH, EQUALS, 10, 10, 30, 30))
+ ret = CAIRO_TEST_FAILURE;
+
+ cairo_new_path (cr2);
+
+ cairo_restore (cr2);
+
/* http://bugs.freedesktop.org/show_bug.cgi?id=7245 */
phase = "Arc";
cairo_save (cr2);
@@ -179,16 +305,35 @@ draw (cairo_t *cr, int width, int height)
phase = "Text";
cairo_save (cr2);
+ cairo_set_tolerance (cr2, 100.0);
cairo_select_font_face (cr2, "Bitstream Vera Sans",
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr2, 12);
- cairo_text_extents (cr2, "The quick brown fox jumped over the lazy dog.", &extents);
+ cairo_text_extents (cr2, string, &extents);
+ /* double check that the two methods of measuring the text agree... */
+ cairo_scaled_font_text_extents (cairo_get_scaled_font (cr2),
+ string,
+ &scaled_font_extents);
+ if (memcmp (&extents, &scaled_font_extents, sizeof (extents))) {
+ cairo_test_log ("Error: cairo_text_extents() does not match cairo_scaled_font_text_extents() - font extents (%f, %f) x (%f, %f) should be (%f, %f) x (%f, %f)\n",
+ scaled_font_extents.x_bearing,
+ scaled_font_extents.y_bearing,
+ scaled_font_extents.width,
+ scaled_font_extents.height,
+ extents.x_bearing,
+ extents.y_bearing,
+ extents.width,
+ extents.height);
+ ret = CAIRO_TEST_FAILURE;
+ }
+
cairo_move_to (cr2, -extents.x_bearing, -extents.y_bearing);
- cairo_text_path (cr2, "The quick brown fox jumped over the lazy dog.");
+ cairo_text_path (cr2, string);
cairo_set_line_width (cr2, 2.0);
if (!check_extents (phase, cr2, FILL, EQUALS, 0, 0, extents.width, extents.height) ||
- !check_extents (phase, cr2, STROKE, EQUALS, -1, -1, extents.width+2, extents.height+2))
+ !check_extents (phase, cr2, STROKE, EQUALS, -1, -1, extents.width+2, extents.height+2) ||
+ !check_extents (phase, cr2, PATH, EQUALS, 0, 0, extents.width, extents.height))
ret = CAIRO_TEST_FAILURE;
cairo_new_path (cr2);
cairo_restore (cr2);
@@ -198,7 +343,8 @@ draw (cairo_t *cr, int width, int height)
cairo_scale (cr2, 2, 2);
cairo_rectangle (cr2, 5, 5, 40, 40);
if (!check_extents (phase, cr2, FILL, EQUALS, 5, 5, 40, 40) ||
- !check_extents (phase, cr2, STROKE, EQUALS, 0, 0, 50, 50))
+ !check_extents (phase, cr2, STROKE, EQUALS, 0, 0, 50, 50) ||
+ !check_extents (phase, cr2, PATH, EQUALS, 5, 5, 40, 40))
ret = CAIRO_TEST_FAILURE;
cairo_new_path (cr2);
cairo_restore (cr2);
@@ -210,7 +356,8 @@ draw (cairo_t *cr, int width, int height)
cairo_rectangle (cr2, 5, 5, 40, 40);
cairo_restore (cr2);
if (!check_extents (phase, cr2, FILL, EQUALS, 10, 10, 80, 80) ||
- !check_extents (phase, cr2, STROKE, EQUALS, 5, 5, 90, 90))
+ !check_extents (phase, cr2, STROKE, EQUALS, 5, 5, 90, 90) ||
+ !check_extents (phase, cr2, PATH, EQUALS, 10, 10, 80, 80))
ret = CAIRO_TEST_FAILURE;
cairo_new_path (cr2);
cairo_restore (cr2);
@@ -229,7 +376,8 @@ draw (cairo_t *cr, int width, int height)
the largest axis-aligned square is a bit over 38 on either side of
the axes. */
if (!check_extents (phase, cr2, FILL, CONTAINS, -35, -35, 35, 35) ||
- !check_extents (phase, cr2, STROKE, CONTAINS, -38, -38, 38, 38))
+ !check_extents (phase, cr2, STROKE, CONTAINS, -38, -38, 38, 38) ||
+ !check_extents (phase, cr2, PATH, CONTAINS, -35, -35, 35, 35))
ret = CAIRO_TEST_FAILURE;
cairo_new_path (cr2);
cairo_restore (cr2);
diff --git a/test/get-xrender-format.c b/test/get-xrender-format.c
new file mode 100644
index 0000000..0c9ce9a
--- /dev/null
+++ b/test/get-xrender-format.c
@@ -0,0 +1,115 @@
+/*
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth@cworth.org>
+ */
+
+#include "cairo-test.h"
+
+#include "cairo-xlib.h"
+#include "cairo-xlib-xrender.h"
+
+#include "cairo-boilerplate-xlib.h"
+
+int
+main (void)
+{
+ Display *dpy;
+ XRenderPictFormat *orig_format, *format;
+ cairo_surface_t *surface;
+ Pixmap pixmap;
+ int screen;
+
+ cairo_test_init ("get-xrender-format");
+
+ dpy = XOpenDisplay (NULL);
+ if (! dpy) {
+ cairo_test_log ("Error: Cannot open display: %s.\n",
+ XDisplayName (NULL));
+ cairo_test_fini ();
+ return CAIRO_TEST_UNTESTED;
+ }
+
+ screen = DefaultScreen (dpy);
+
+ cairo_test_log ("Testing with image surface.\n");
+
+ surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1);
+
+ format = cairo_xlib_surface_get_xrender_format (surface);
+ if (format != NULL) {
+ cairo_test_log ("Error: expected NULL for image surface\n");
+ return CAIRO_TEST_FAILURE;
+ }
+
+ cairo_surface_destroy (surface);
+
+ cairo_test_log ("Testing with non-xrender xlib surface.\n");
+
+ pixmap = XCreatePixmap (dpy, DefaultRootWindow (dpy),
+ 1, 1, DefaultDepth (dpy, screen));
+ surface = cairo_xlib_surface_create (dpy, pixmap,
+ DefaultVisual (dpy, screen),
+ 1, 1);
+ orig_format = XRenderFindVisualFormat (dpy, DefaultVisual (dpy, screen));
+ format = cairo_xlib_surface_get_xrender_format (surface);
+ if (format != orig_format) {
+ cairo_test_log ("Error: did not receive the same format as XRenderFindVisualFormat\n");
+ return CAIRO_TEST_FAILURE;
+ }
+ cairo_surface_destroy (surface);
+ XFreePixmap (dpy, pixmap);
+
+ cairo_test_log ("Testing with xlib xrender surface.\n");
+
+ orig_format = XRenderFindStandardFormat (dpy, PictStandardARGB32);
+ pixmap = XCreatePixmap (dpy, DefaultRootWindow (dpy),
+ 1, 1, 32);
+ surface = cairo_xlib_surface_create_with_xrender_format (dpy,
+ pixmap,
+ DefaultScreenOfDisplay (dpy),
+ orig_format,
+ 1, 1);
+ format = cairo_xlib_surface_get_xrender_format (surface);
+ if (format != orig_format) {
+ cairo_test_log ("Error: did not receive the same format originally set\n");
+ return CAIRO_TEST_FAILURE;
+ }
+
+ cairo_test_log ("Testing without the X Render extension.\n");
+
+ cairo_boilerplate_xlib_surface_disable_render (surface);
+
+ format = cairo_xlib_surface_get_xrender_format (surface);
+ if (format != NULL) {
+ cairo_test_log ("Error: did not receive a NULL format as expected\n");
+ return CAIRO_TEST_FAILURE;
+ }
+
+
+ XCloseDisplay (dpy);
+
+ cairo_test_fini ();
+
+ return CAIRO_TEST_SUCCESS;
+}
diff --git a/test/in-fill-trapezoid.c b/test/in-fill-trapezoid.c
new file mode 100644
index 0000000..a544e43
--- /dev/null
+++ b/test/in-fill-trapezoid.c
@@ -0,0 +1,86 @@
+/*
+ * Copyright © 2008 Chris Wilson
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Author: Chris Wilson <chris@chris-wilson.co.uk>
+ */
+
+#include "cairo-test.h"
+
+static cairo_test_draw_function_t draw;
+
+cairo_test_t test = {
+ "in-fill-trapezoid",
+ "Test _cairo_trap_contains via cairo_in_fill",
+ 0, 0,
+ draw
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_test_status_t ret = CAIRO_TEST_SUCCESS;
+
+ cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
+
+ /* simple rectangle */
+ cairo_new_path (cr);
+ cairo_rectangle (cr, -10, -10, 20, 20);
+ if (! cairo_in_fill (cr, 0, 0)) {
+ cairo_test_log ("Error: Failed to find point inside rectangle\n");
+ ret = CAIRO_TEST_FAILURE;
+ }
+
+ /* simple circle */
+ cairo_new_path (cr);
+ cairo_arc (cr, 0, 0, 10, 0, 2 * M_PI);
+ if (! cairo_in_fill (cr, 0, 0)) {
+ cairo_test_log ("Error: Failed to find point inside circle\n");
+ ret = CAIRO_TEST_FAILURE;
+ }
+
+ /* holey rectangle */
+ cairo_new_path (cr);
+ cairo_rectangle (cr, -10, -10, 20, 20);
+ cairo_rectangle (cr, -5, -5, 10, 10);
+ if (cairo_in_fill (cr, 0, 0)) {
+ cairo_test_log ("Error: Found an unexpected point inside rectangular hole\n");
+ ret = CAIRO_TEST_FAILURE;
+ }
+
+ /* holey circle */
+ cairo_new_path (cr);
+ cairo_arc (cr, 0, 0, 10, 0, 2 * M_PI);
+ cairo_arc (cr, 0, 0, 5, 0, 2 * M_PI);
+ if (cairo_in_fill (cr, 0, 0)) {
+ cairo_test_log ("Error: Found an unexpected point inside circular hole\n");
+ ret = CAIRO_TEST_FAILURE;
+ }
+
+ return ret;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test);
+}
diff --git a/test/meta-surface-pattern-pdf-ref.png b/test/meta-surface-pattern-pdf-ref.png
new file mode 100644
index 0000000..2e561b2
--- /dev/null
+++ b/test/meta-surface-pattern-pdf-ref.png
Binary files differ
diff --git a/test/meta-surface-pattern-pdf-rgb24-ref.png b/test/meta-surface-pattern-pdf-rgb24-ref.png
new file mode 100644
index 0000000..680f0f5
--- /dev/null
+++ b/test/meta-surface-pattern-pdf-rgb24-ref.png
Binary files differ
diff --git a/test/pattern-getters.c b/test/pattern-getters.c
index 695245d..aa420bf 100644
--- a/test/pattern-getters.c
+++ b/test/pattern-getters.c
@@ -38,14 +38,12 @@ cairo_test_t test = {
#define CHECK_SUCCESS do { if (status) return CAIRO_TEST_FAILURE; } while (0)
-#define DOUBLE_EQUALS(a,b) (fabs((a)-(b)) < 0.00001)
-
static int
double_buf_equal (double *a, double *b, int nc)
{
int i;
for (i = 0; i < nc; i++) {
- if (!DOUBLE_EQUALS(a[i],b[i])) {
+ if (!CAIRO_TEST_DOUBLE_EQUALS(a[i],b[i])) {
cairo_test_log ("Error: doubles not equal: %g, %g\n",
a[i], b[i]);
return 0;
@@ -68,10 +66,10 @@ draw (cairo_t *cr, int width, int height)
status = cairo_pattern_get_rgba (pat, &r, &g, &b, &a);
CHECK_SUCCESS;
- if (!DOUBLE_EQUALS(r,0.2) ||
- !DOUBLE_EQUALS(g,0.3) ||
- !DOUBLE_EQUALS(b,0.4) ||
- !DOUBLE_EQUALS(a,0.5)) {
+ if (!CAIRO_TEST_DOUBLE_EQUALS(r,0.2) ||
+ !CAIRO_TEST_DOUBLE_EQUALS(g,0.3) ||
+ !CAIRO_TEST_DOUBLE_EQUALS(b,0.4) ||
+ !CAIRO_TEST_DOUBLE_EQUALS(a,0.5)) {
cairo_test_log ("Error: cairo_pattern_get_rgba returned unexepcted results: %g, %g, %g, %g\n",
r, g, b, a);
return CAIRO_TEST_FAILURE;
@@ -120,10 +118,10 @@ draw (cairo_t *cr, int width, int height)
status = cairo_pattern_get_linear_points (pat, &x0, &y0, &x1, &y1);
CHECK_SUCCESS;
- if (!DOUBLE_EQUALS(x0,1.0) ||
- !DOUBLE_EQUALS(y0,2.0) ||
- !DOUBLE_EQUALS(x1,3.0) ||
- !DOUBLE_EQUALS(y1,4.0))
+ if (!CAIRO_TEST_DOUBLE_EQUALS(x0,1.0) ||
+ !CAIRO_TEST_DOUBLE_EQUALS(y0,2.0) ||
+ !CAIRO_TEST_DOUBLE_EQUALS(x1,3.0) ||
+ !CAIRO_TEST_DOUBLE_EQUALS(y1,4.0))
return CAIRO_TEST_FAILURE;
status = cairo_pattern_get_color_stop_count (pat, &i);
@@ -161,12 +159,12 @@ draw (cairo_t *cr, int width, int height)
status = cairo_pattern_get_radial_circles (pat, &a, &b, &c, &d, &e, &f);
CHECK_SUCCESS;
- if (!DOUBLE_EQUALS(a,1.0) ||
- !DOUBLE_EQUALS(b,2.0) ||
- !DOUBLE_EQUALS(c,3.0) ||
- !DOUBLE_EQUALS(d,4.0) ||
- !DOUBLE_EQUALS(e,5.0) ||
- !DOUBLE_EQUALS(f,6.0))
+ if (!CAIRO_TEST_DOUBLE_EQUALS(a,1.0) ||
+ !CAIRO_TEST_DOUBLE_EQUALS(b,2.0) ||
+ !CAIRO_TEST_DOUBLE_EQUALS(c,3.0) ||
+ !CAIRO_TEST_DOUBLE_EQUALS(d,4.0) ||
+ !CAIRO_TEST_DOUBLE_EQUALS(e,5.0) ||
+ !CAIRO_TEST_DOUBLE_EQUALS(f,6.0))
return CAIRO_TEST_FAILURE;
cairo_pattern_destroy (pat);
diff --git a/test/rectangle-rounding-error-ref.png b/test/rectangle-rounding-error-ref.png
index c3a6840..413345d 100644
--- a/test/rectangle-rounding-error-ref.png
+++ b/test/rectangle-rounding-error-ref.png
Binary files differ
diff --git a/test/rectilinear-miter-limit-ref.png b/test/rectilinear-miter-limit-ref.png
new file mode 100644
index 0000000..53bfee0
--- /dev/null
+++ b/test/rectilinear-miter-limit-ref.png
Binary files differ
diff --git a/test/rectilinear-miter-limit.c b/test/rectilinear-miter-limit.c
new file mode 100644
index 0000000..114472c
--- /dev/null
+++ b/test/rectilinear-miter-limit.c
@@ -0,0 +1,80 @@
+/*
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth@cworth.org>
+ */
+
+#include "cairo-test.h"
+
+#define LINE_WIDTH 10
+#define PAD 2
+#define WIDTH (PAD + LINE_WIDTH + PAD)
+#define HEIGHT (WIDTH)
+
+static cairo_test_draw_function_t draw;
+
+cairo_test_t test = {
+ "rectilinear-miter-limit",
+ "Test that the rectilinear stroke optimization doesn't break cairo_set_miter_limit",
+ WIDTH, HEIGHT,
+ draw
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_translate (cr, PAD, PAD);
+
+ /* Paint background white, then draw in black. */
+ cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
+ cairo_paint (cr);
+ cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); /* black */
+
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
+ cairo_set_line_width (cr, LINE_WIDTH);
+
+ /* The default miter limit value of 10.0 guarantees that
+ * right-angle turns, (in fact, any angle greater than 11
+ * degrees), gets a miter rather than a bevel join. The
+ * rectilinear stroke optimization was originally written in a
+ * buggy way that did not respect the miter limit, (that is,
+ * inappropriately drawing miter joins when the miter limit would
+ * turn them into bevels). So we draw here with a miter limit of
+ * 1.0 to force all miter joins into bevels. */
+ cairo_set_line_join (cr, CAIRO_LINE_JOIN_MITER);
+ cairo_set_miter_limit (cr, 1.0);
+
+ cairo_move_to (cr, LINE_WIDTH / 2.0, LINE_WIDTH);
+ cairo_rel_line_to (cr, 0, - LINE_WIDTH / 2.0);
+ cairo_rel_line_to (cr, LINE_WIDTH / 2.0, 0);
+
+ cairo_stroke (cr);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test);
+}
diff --git a/test/rotate-image-surface-paint-ref.png b/test/rotate-image-surface-paint-ref.png
index 7ccc9ac..a63e9cb 100644
--- a/test/rotate-image-surface-paint-ref.png
+++ b/test/rotate-image-surface-paint-ref.png
Binary files differ
diff --git a/test/text-zero-len.c b/test/text-zero-len.c
index e64daa8..6c2a836 100644
--- a/test/text-zero-len.c
+++ b/test/text-zero-len.c
@@ -66,11 +66,23 @@ text_extents_equal (const cairo_text_extents_t *A,
A->y_advance == B->y_advance;
}
+static cairo_bool_t
+font_extents_equal (const cairo_font_extents_t *A,
+ const cairo_font_extents_t *B)
+{
+ return A->ascent == B->ascent &&
+ A->descent == B->descent &&
+ A->height == B->height &&
+ A->max_x_advance == B->max_x_advance &&
+ A->max_y_advance == B->max_y_advance;
+}
+
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
- cairo_text_extents_t nil_extents;
- cairo_text_extents_t extents;
+ cairo_text_extents_t extents, nil_extents;
+ cairo_font_extents_t font_extents, nil_font_extents;
+ cairo_scaled_font_t *scaled_font;
cairo_select_font_face (cr, "Bitstream Vera Sans",
CAIRO_FONT_SLANT_NORMAL,
@@ -121,6 +133,75 @@ draw (cairo_t *cr, int width, int height)
return CAIRO_TEST_FAILURE;
}
+ scaled_font = cairo_get_scaled_font (cr);
+
+ memset (&extents, 0xff, sizeof (cairo_text_extents_t));
+ cairo_scaled_font_text_extents (scaled_font, "", &extents);
+ if (! text_extents_equal (&extents, &nil_extents)) {
+ cairo_test_log ("Error: cairo_scaled_font_text_extents(\"\"); extents (%g, %g, %g, %g, %g, %g)\n",
+ extents.x_bearing, extents.y_bearing,
+ extents.width, extents.height,
+ extents.x_advance, extents.y_advance);
+ return CAIRO_TEST_FAILURE;
+ }
+
+ memset (&extents, 0xff, sizeof (cairo_text_extents_t));
+ cairo_scaled_font_text_extents (scaled_font, NULL, &extents);
+ if (! text_extents_equal (&extents, &nil_extents)) {
+ cairo_test_log ("Error: cairo_scaled_font_text_extents(NULL); extents (%g, %g, %g, %g, %g, %g)\n",
+ extents.x_bearing, extents.y_bearing,
+ extents.width, extents.height,
+ extents.x_advance, extents.y_advance);
+ return CAIRO_TEST_FAILURE;
+ }
+
+ memset (&extents, 0xff, sizeof (cairo_text_extents_t));
+ cairo_scaled_font_glyph_extents (scaled_font, (void*)8, 0, &extents);
+ if (! text_extents_equal (&extents, &nil_extents)) {
+ cairo_test_log ("Error: cairo_scaled_font_glyph_extents(NULL); extents (%g, %g, %g, %g, %g, %g)\n",
+ extents.x_bearing, extents.y_bearing,
+ extents.width, extents.height,
+ extents.x_advance, extents.y_advance);
+ return CAIRO_TEST_FAILURE;
+ }
+
+ /* Lets also try font size 0 while here */
+ cairo_set_font_size (cr, 0);
+
+ memset (&extents, 0xff, sizeof (cairo_text_extents_t));
+ cairo_text_extents (cr, "test", &extents);
+ if (! text_extents_equal (&extents, &nil_extents)) {
+ cairo_test_log ("Error: cairo_set_font_size(0); cairo_text_extents(\"test\"); extents (%g, %g, %g, %g, %g, %g)\n",
+ extents.x_bearing, extents.y_bearing,
+ extents.width, extents.height,
+ extents.x_advance, extents.y_advance);
+ return CAIRO_TEST_FAILURE;
+ }
+
+ memset (&nil_font_extents, 0, sizeof (cairo_font_extents_t));
+
+ memset (&font_extents, 0xff, sizeof (cairo_font_extents_t));
+ cairo_font_extents (cr, &font_extents);
+ if (! font_extents_equal (&font_extents, &nil_font_extents)) {
+ cairo_test_log ("Error: cairo_set_font_size(0); cairo_font_extents(); extents (%g, %g, %g, %g, %g)\n",
+ font_extents.ascent, font_extents.descent,
+ font_extents.height,
+ font_extents.max_x_advance, font_extents.max_y_advance);
+ return CAIRO_TEST_FAILURE;
+ }
+
+ scaled_font = cairo_get_scaled_font (cr);
+
+ memset (&font_extents, 0xff, sizeof (cairo_font_extents_t));
+ cairo_scaled_font_extents (scaled_font, &font_extents);
+ if (! font_extents_equal (&font_extents, &nil_font_extents)) {
+ cairo_test_log ("Error: cairo_set_font_size(0); cairo_scaled_font_extents(); extents (%g, %g, %g, %g, %g)\n",
+ font_extents.ascent, font_extents.descent,
+ font_extents.height,
+ font_extents.max_x_advance, font_extents.max_y_advance);
+ return CAIRO_TEST_FAILURE;
+ }
+
return CAIRO_TEST_SUCCESS;
}
diff --git a/test/unantialiased-shapes-ref.png b/test/unantialiased-shapes-ref.png
index ad79993..d350ad9 100644
--- a/test/unantialiased-shapes-ref.png
+++ b/test/unantialiased-shapes-ref.png
Binary files differ