summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLoïc Minier <lool@dooz.org>2009-04-14 23:42:06 +0200
committerLoïc Minier <lool@dooz.org>2009-04-14 23:42:06 +0200
commitf333a60871359f67d7565146726de1a766b51197 (patch)
treea6099f40c7bb83049e09c75c1518e47a83cdbcb3 /test
parentad0e8874dd2da1eb266b30f3eed30656e83a08f9 (diff)
Imported Upstream version 1.0.2
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am16
-rw-r--r--test/Makefile.in152
-rw-r--r--test/cairo-test.c34
-rw-r--r--test/cairo-test.h74
-rw-r--r--test/caps-joins-ref.pngbin0 -> 1262 bytes
-rw-r--r--test/caps-joins.c85
-rw-r--r--test/clip-all-ref.pngbin0 -> 118 bytes
-rw-r--r--test/clip-all.c69
-rw-r--r--test/create-from-png-stream.c6
-rw-r--r--test/dash-caps-joins-ref.pngbin0 -> 2347 bytes
-rw-r--r--test/dash-caps-joins.c94
-rw-r--r--test/filter-nearest-offset.c2
-rw-r--r--test/get-and-set.c4
-rw-r--r--test/mask-ctm.c2
-rw-r--r--test/mask-surface-ctm.c2
-rw-r--r--test/move-to-show-surface.c2
-rw-r--r--test/nil-surface.c2
-rw-r--r--test/paint-with-alpha.c2
-rw-r--r--test/pthread-show-text.c110
-rw-r--r--test/scale-source-surface-paint.c2
-rw-r--r--test/set-source.c2
-rw-r--r--test/source-surface-scale-paint.c2
-rw-r--r--test/translate-show-surface.c2
23 files changed, 578 insertions, 86 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 1cf9879..eb2b9be 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,7 +1,9 @@
# All test cases go here
TESTS = \
a8-mask \
+caps-joins \
caps-sub-paths \
+clip-all \
clip-nesting \
clip-operator \
clip-twice \
@@ -10,6 +12,7 @@ composite-integer-translate-over \
composite-integer-translate-over-repeat \
create-from-png \
create-from-png-stream \
+dash-caps-joins \
dash-offset-negative \
fill-and-stroke \
fill-rule \
@@ -55,6 +58,10 @@ unbounded-operator \
user-data \
rel-path
+if HAVE_PTHREAD
+TESTS += pthread-show-text
+endif
+
if CAIRO_HAS_FT_FONT
TESTS += ft-font-create-for-ft-face
endif
@@ -76,7 +83,9 @@ endif
# way to avoid it? Can I use a wildcard here?
EXTRA_DIST = \
a8-mask-ref.png \
+caps-joins-ref.png \
caps-sub-paths-ref.png \
+clip-all-ref.png \
clip-nesting-ref.png \
clip-operator-ref.png \
clip-twice-ref.png \
@@ -85,6 +94,7 @@ composite-integer-translate-over-ref.png \
composite-integer-translate-over-repeat-ref.png \
create-from-png-ref.png \
create-from-png-stream-ref.png \
+dash-caps-joins-ref.png \
dash-offset-negative-ref.png \
fill-and-stroke-ref.png \
fill-rule-ref.png \
@@ -183,7 +193,9 @@ endif
# time to break down and auto-generate the Makefile.am or something
# from autogen.sh. My, but this is painful...
a8_mask_LDADD = $(LDADDS)
+caps_joins_LDADD = $(LDADDS)
caps_sub_paths_LDADD = $(LDADDS)
+clip_all_LDADD = $(LDADDS)
clip_nesting_LDADD = $(LDADDS)
clip_operator_LDADD = $(LDADDS)
clip_twice_LDADD = $(LDADDS)
@@ -192,6 +204,7 @@ composite_integer_translate_over_LDADD = $(LDADDS)
composite_integer_translate_over_repeat_LDADD = $(LDADDS)
create_from_png_LDADD = $(LDADDS)
create_from_png_stream_LDADD = $(LDADDS)
+dash_caps_joins_LDADD = $(LDADDS)
dash_offset_negative_LDADD = $(LDADDS)
fill_and_stroke_LDADD = $(LDADDS)
fill_rule_LDADD = $(LDADDS)
@@ -214,8 +227,9 @@ paint_with_alpha_LDADD = $(LDADDS)
path_data_LDADD = $(LDADDS)
pdf_surface_LDADD = $(LDADDS)
pdf_clip_LDADD = $(LDADDS)
-ps_surface_LDADD = $(LDADDS)
pixman_rotate_LDADD = $(LDADDS)
+ps_surface_LDADD = $(LDADDS)
+pthread_show_text_LDADD = $(LDADDS)
rectangle_rounding_error_LDADD = $(LDADDS)
scale_source_surface_paint_LDADD = $(LDADDS)
select_font_no_show_text_LDADD = $(LDADDS)
diff --git a/test/Makefile.in b/test/Makefile.in
index e181aac..c4decd7 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -15,8 +15,6 @@
@SET_MAKE@
-SOURCES = $(libcairotest_la_SOURCES) a8-mask.c caps-sub-paths.c clip-nesting.c clip-operator.c clip-twice.c composite-integer-translate-over.c composite-integer-translate-over-repeat.c composite-integer-translate-source.c create-from-png.c create-from-png-stream.c dash-offset-negative.c fill-and-stroke.c fill-rule.c filter-nearest-offset.c ft-font-create-for-ft-face.c get-and-set.c gradient-alpha.c imagediff.c leaky-polygon.c line-width.c linear-gradient.c mask.c mask-ctm.c mask-surface-ctm.c move-to-show-surface.c nil-surface.c operator-clear.c operator-source.c paint.c paint-with-alpha.c path-data.c pdf-clip.c pdf-surface.c pixman-rotate.c ps-surface.c rectangle-rounding-error.c rel-path.c scale-source-surface-paint.c select-font-no-show-text.c self-copy.c self-intersecting.c set-source.c show-text-current-point.c source-clip.c source-surface-scale-paint.c surface-finish-twice.c surface-pattern.c text-antialias-gray.c text-antialias-none.c text-antialias-subpixel.c text-cache-crash.c text-pattern.c text-rotate.c transforms.c translate-show-surface.c trap-clip.c unantialiased-shapes.c unbounded-operator.c user-data.c xlib-surface.c
-
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
@@ -39,12 +37,13 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-@CAIRO_HAS_FT_FONT_TRUE@am__append_1 = ft-font-create-for-ft-face
-@CAIRO_HAS_PDF_SURFACE_TRUE@am__append_2 = pdf-surface pdf-clip
-@CAIRO_HAS_PS_SURFACE_TRUE@am__append_3 = ps-surface
-@CAIRO_HAS_XLIB_SURFACE_TRUE@am__append_4 = xlib-surface
-check_PROGRAMS = $(am__EXEEXT_5)
-@HAVE_PTHREAD_TRUE@am__append_5 = -lpthread
+@HAVE_PTHREAD_TRUE@am__append_1 = pthread-show-text
+@CAIRO_HAS_FT_FONT_TRUE@am__append_2 = ft-font-create-for-ft-face
+@CAIRO_HAS_PDF_SURFACE_TRUE@am__append_3 = pdf-surface pdf-clip
+@CAIRO_HAS_PS_SURFACE_TRUE@am__append_4 = ps-surface
+@CAIRO_HAS_XLIB_SURFACE_TRUE@am__append_5 = xlib-surface
+check_PROGRAMS = $(am__EXEEXT_6)
+@HAVE_PTHREAD_TRUE@am__append_6 = -lpthread
noinst_PROGRAMS = imagediff$(EXEEXT)
subdir = test
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
@@ -53,7 +52,7 @@ am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
@@ -61,28 +60,30 @@ libcairotest_la_LIBADD =
am_libcairotest_la_OBJECTS = buffer-diff.lo cairo-test.lo read-png.lo \
write-png.lo xmalloc.lo
libcairotest_la_OBJECTS = $(am_libcairotest_la_OBJECTS)
-@CAIRO_HAS_FT_FONT_TRUE@am__EXEEXT_1 = \
+@HAVE_PTHREAD_TRUE@am__EXEEXT_1 = pthread-show-text$(EXEEXT)
+@CAIRO_HAS_FT_FONT_TRUE@am__EXEEXT_2 = \
@CAIRO_HAS_FT_FONT_TRUE@ ft-font-create-for-ft-face$(EXEEXT)
-@CAIRO_HAS_PDF_SURFACE_TRUE@am__EXEEXT_2 = pdf-surface$(EXEEXT) \
+@CAIRO_HAS_PDF_SURFACE_TRUE@am__EXEEXT_3 = pdf-surface$(EXEEXT) \
@CAIRO_HAS_PDF_SURFACE_TRUE@ pdf-clip$(EXEEXT)
-@CAIRO_HAS_PS_SURFACE_TRUE@am__EXEEXT_3 = ps-surface$(EXEEXT)
-@CAIRO_HAS_XLIB_SURFACE_TRUE@am__EXEEXT_4 = xlib-surface$(EXEEXT)
-am__EXEEXT_5 = a8-mask$(EXEEXT) caps-sub-paths$(EXEEXT) \
+@CAIRO_HAS_PS_SURFACE_TRUE@am__EXEEXT_4 = ps-surface$(EXEEXT)
+@CAIRO_HAS_XLIB_SURFACE_TRUE@am__EXEEXT_5 = xlib-surface$(EXEEXT)
+am__EXEEXT_6 = a8-mask$(EXEEXT) caps-joins$(EXEEXT) \
+ caps-sub-paths$(EXEEXT) clip-all$(EXEEXT) \
clip-nesting$(EXEEXT) clip-operator$(EXEEXT) \
clip-twice$(EXEEXT) \
composite-integer-translate-source$(EXEEXT) \
composite-integer-translate-over$(EXEEXT) \
composite-integer-translate-over-repeat$(EXEEXT) \
create-from-png$(EXEEXT) create-from-png-stream$(EXEEXT) \
- dash-offset-negative$(EXEEXT) fill-and-stroke$(EXEEXT) \
- fill-rule$(EXEEXT) filter-nearest-offset$(EXEEXT) \
- get-and-set$(EXEEXT) gradient-alpha$(EXEEXT) \
- leaky-polygon$(EXEEXT) line-width$(EXEEXT) \
- linear-gradient$(EXEEXT) mask$(EXEEXT) mask-ctm$(EXEEXT) \
- mask-surface-ctm$(EXEEXT) move-to-show-surface$(EXEEXT) \
- nil-surface$(EXEEXT) operator-clear$(EXEEXT) \
- operator-source$(EXEEXT) paint$(EXEEXT) \
- paint-with-alpha$(EXEEXT) path-data$(EXEEXT) \
+ dash-caps-joins$(EXEEXT) dash-offset-negative$(EXEEXT) \
+ fill-and-stroke$(EXEEXT) fill-rule$(EXEEXT) \
+ filter-nearest-offset$(EXEEXT) get-and-set$(EXEEXT) \
+ gradient-alpha$(EXEEXT) leaky-polygon$(EXEEXT) \
+ line-width$(EXEEXT) linear-gradient$(EXEEXT) mask$(EXEEXT) \
+ mask-ctm$(EXEEXT) mask-surface-ctm$(EXEEXT) \
+ move-to-show-surface$(EXEEXT) nil-surface$(EXEEXT) \
+ operator-clear$(EXEEXT) operator-source$(EXEEXT) \
+ paint$(EXEEXT) paint-with-alpha$(EXEEXT) path-data$(EXEEXT) \
pixman-rotate$(EXEEXT) rectangle-rounding-error$(EXEEXT) \
scale-source-surface-paint$(EXEEXT) \
select-font-no-show-text$(EXEEXT) self-copy$(EXEEXT) \
@@ -96,7 +97,8 @@ am__EXEEXT_5 = a8-mask$(EXEEXT) caps-sub-paths$(EXEEXT) \
translate-show-surface$(EXEEXT) trap-clip$(EXEEXT) \
unantialiased-shapes$(EXEEXT) unbounded-operator$(EXEEXT) \
user-data$(EXEEXT) rel-path$(EXEEXT) $(am__EXEEXT_1) \
- $(am__EXEEXT_2) $(am__EXEEXT_3) $(am__EXEEXT_4)
+ $(am__EXEEXT_2) $(am__EXEEXT_3) $(am__EXEEXT_4) \
+ $(am__EXEEXT_5)
PROGRAMS = $(noinst_PROGRAMS)
a8_mask_SOURCES = a8-mask.c
a8_mask_OBJECTS = a8-mask.$(OBJEXT)
@@ -104,9 +106,15 @@ am__DEPENDENCIES_1 =
am__DEPENDENCIES_2 = libcairotest.la $(top_builddir)/src/libcairo.la \
$(am__DEPENDENCIES_1)
a8_mask_DEPENDENCIES = $(am__DEPENDENCIES_2)
+caps_joins_SOURCES = caps-joins.c
+caps_joins_OBJECTS = caps-joins.$(OBJEXT)
+caps_joins_DEPENDENCIES = $(am__DEPENDENCIES_2)
caps_sub_paths_SOURCES = caps-sub-paths.c
caps_sub_paths_OBJECTS = caps-sub-paths.$(OBJEXT)
caps_sub_paths_DEPENDENCIES = $(am__DEPENDENCIES_2)
+clip_all_SOURCES = clip-all.c
+clip_all_OBJECTS = clip-all.$(OBJEXT)
+clip_all_DEPENDENCIES = $(am__DEPENDENCIES_2)
clip_nesting_SOURCES = clip-nesting.c
clip_nesting_OBJECTS = clip-nesting.$(OBJEXT)
clip_nesting_DEPENDENCIES = $(am__DEPENDENCIES_2)
@@ -139,6 +147,9 @@ create_from_png_DEPENDENCIES = $(am__DEPENDENCIES_2)
create_from_png_stream_SOURCES = create-from-png-stream.c
create_from_png_stream_OBJECTS = create-from-png-stream.$(OBJEXT)
create_from_png_stream_DEPENDENCIES = $(am__DEPENDENCIES_2)
+dash_caps_joins_SOURCES = dash-caps-joins.c
+dash_caps_joins_OBJECTS = dash-caps-joins.$(OBJEXT)
+dash_caps_joins_DEPENDENCIES = $(am__DEPENDENCIES_2)
dash_offset_negative_SOURCES = dash-offset-negative.c
dash_offset_negative_OBJECTS = dash-offset-negative.$(OBJEXT)
dash_offset_negative_DEPENDENCIES = $(am__DEPENDENCIES_2)
@@ -215,6 +226,9 @@ pixman_rotate_DEPENDENCIES = $(am__DEPENDENCIES_2)
ps_surface_SOURCES = ps-surface.c
ps_surface_OBJECTS = ps-surface.$(OBJEXT)
ps_surface_DEPENDENCIES = $(am__DEPENDENCIES_2)
+pthread_show_text_SOURCES = pthread-show-text.c
+pthread_show_text_OBJECTS = pthread-show-text.$(OBJEXT)
+pthread_show_text_DEPENDENCIES = $(am__DEPENDENCIES_2)
rectangle_rounding_error_SOURCES = rectangle-rounding-error.c
rectangle_rounding_error_OBJECTS = rectangle-rounding-error.$(OBJEXT)
rectangle_rounding_error_DEPENDENCIES = $(am__DEPENDENCIES_2)
@@ -303,19 +317,20 @@ 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 caps-sub-paths.c \
- clip-nesting.c clip-operator.c clip-twice.c \
- composite-integer-translate-over.c \
+SOURCES = $(libcairotest_la_SOURCES) a8-mask.c caps-joins.c \
+ caps-sub-paths.c clip-all.c clip-nesting.c clip-operator.c \
+ clip-twice.c composite-integer-translate-over.c \
composite-integer-translate-over-repeat.c \
composite-integer-translate-source.c create-from-png.c \
- create-from-png-stream.c dash-offset-negative.c \
- fill-and-stroke.c fill-rule.c filter-nearest-offset.c \
- ft-font-create-for-ft-face.c get-and-set.c gradient-alpha.c \
- imagediff.c leaky-polygon.c line-width.c linear-gradient.c \
- mask.c mask-ctm.c mask-surface-ctm.c move-to-show-surface.c \
- nil-surface.c operator-clear.c operator-source.c paint.c \
- paint-with-alpha.c path-data.c pdf-clip.c pdf-surface.c \
- pixman-rotate.c ps-surface.c rectangle-rounding-error.c \
+ create-from-png-stream.c dash-caps-joins.c \
+ dash-offset-negative.c fill-and-stroke.c fill-rule.c \
+ filter-nearest-offset.c ft-font-create-for-ft-face.c \
+ get-and-set.c gradient-alpha.c imagediff.c leaky-polygon.c \
+ line-width.c linear-gradient.c mask.c mask-ctm.c \
+ mask-surface-ctm.c move-to-show-surface.c nil-surface.c \
+ operator-clear.c operator-source.c paint.c paint-with-alpha.c \
+ path-data.c pdf-clip.c pdf-surface.c pixman-rotate.c \
+ ps-surface.c pthread-show-text.c rectangle-rounding-error.c \
rel-path.c scale-source-surface-paint.c \
select-font-no-show-text.c self-copy.c self-intersecting.c \
set-source.c show-text-current-point.c source-clip.c \
@@ -325,19 +340,20 @@ SOURCES = $(libcairotest_la_SOURCES) a8-mask.c caps-sub-paths.c \
text-rotate.c transforms.c translate-show-surface.c \
trap-clip.c unantialiased-shapes.c unbounded-operator.c \
user-data.c xlib-surface.c
-DIST_SOURCES = $(libcairotest_la_SOURCES) a8-mask.c caps-sub-paths.c \
- clip-nesting.c clip-operator.c clip-twice.c \
- composite-integer-translate-over.c \
+DIST_SOURCES = $(libcairotest_la_SOURCES) a8-mask.c caps-joins.c \
+ caps-sub-paths.c clip-all.c clip-nesting.c clip-operator.c \
+ clip-twice.c composite-integer-translate-over.c \
composite-integer-translate-over-repeat.c \
composite-integer-translate-source.c create-from-png.c \
- create-from-png-stream.c dash-offset-negative.c \
- fill-and-stroke.c fill-rule.c filter-nearest-offset.c \
- ft-font-create-for-ft-face.c get-and-set.c gradient-alpha.c \
- imagediff.c leaky-polygon.c line-width.c linear-gradient.c \
- mask.c mask-ctm.c mask-surface-ctm.c move-to-show-surface.c \
- nil-surface.c operator-clear.c operator-source.c paint.c \
- paint-with-alpha.c path-data.c pdf-clip.c pdf-surface.c \
- pixman-rotate.c ps-surface.c rectangle-rounding-error.c \
+ create-from-png-stream.c dash-caps-joins.c \
+ dash-offset-negative.c fill-and-stroke.c fill-rule.c \
+ filter-nearest-offset.c ft-font-create-for-ft-face.c \
+ get-and-set.c gradient-alpha.c imagediff.c leaky-polygon.c \
+ line-width.c linear-gradient.c mask.c mask-ctm.c \
+ mask-surface-ctm.c move-to-show-surface.c nil-surface.c \
+ operator-clear.c operator-source.c paint.c paint-with-alpha.c \
+ path-data.c pdf-clip.c pdf-surface.c pixman-rotate.c \
+ ps-surface.c pthread-show-text.c rectangle-rounding-error.c \
rel-path.c scale-source-surface-paint.c \
select-font-no-show-text.c self-copy.c self-intersecting.c \
set-source.c show-text-current-point.c source-clip.c \
@@ -490,6 +506,7 @@ ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
+ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
@@ -529,14 +546,14 @@ sysconfdir = @sysconfdir@
target_alias = @target_alias@
# All test cases go here
-TESTS = a8-mask caps-sub-paths clip-nesting clip-operator clip-twice \
- composite-integer-translate-source \
+TESTS = a8-mask caps-joins caps-sub-paths clip-all clip-nesting \
+ clip-operator clip-twice composite-integer-translate-source \
composite-integer-translate-over \
composite-integer-translate-over-repeat create-from-png \
- create-from-png-stream dash-offset-negative fill-and-stroke \
- fill-rule filter-nearest-offset get-and-set gradient-alpha \
- leaky-polygon line-width linear-gradient mask mask-ctm \
- mask-surface-ctm move-to-show-surface nil-surface \
+ create-from-png-stream dash-caps-joins dash-offset-negative \
+ fill-and-stroke fill-rule filter-nearest-offset get-and-set \
+ gradient-alpha leaky-polygon line-width linear-gradient mask \
+ mask-ctm mask-surface-ctm move-to-show-surface nil-surface \
operator-clear operator-source paint paint-with-alpha \
path-data pixman-rotate rectangle-rounding-error \
scale-source-surface-paint select-font-no-show-text self-copy \
@@ -547,14 +564,16 @@ TESTS = a8-mask caps-sub-paths clip-nesting clip-operator clip-twice \
text-rotate transforms translate-show-surface trap-clip \
unantialiased-shapes unbounded-operator user-data rel-path \
$(am__append_1) $(am__append_2) $(am__append_3) \
- $(am__append_4)
+ $(am__append_4) $(am__append_5)
# All tests which have a reference image go here.
# I really don't like having to repeat this list. Anyone know a good
# way to avoid it? Can I use a wildcard here?
EXTRA_DIST = \
a8-mask-ref.png \
+caps-joins-ref.png \
caps-sub-paths-ref.png \
+clip-all-ref.png \
clip-nesting-ref.png \
clip-operator-ref.png \
clip-twice-ref.png \
@@ -563,6 +582,7 @@ composite-integer-translate-over-ref.png \
composite-integer-translate-over-repeat-ref.png \
create-from-png-ref.png \
create-from-png-stream-ref.png \
+dash-caps-joins-ref.png \
dash-offset-negative-ref.png \
fill-and-stroke-ref.png \
fill-rule-ref.png \
@@ -651,13 +671,15 @@ xmalloc.c \
xmalloc.h
LDADDS = libcairotest.la $(top_builddir)/src/libcairo.la \
- $(am__append_5)
+ $(am__append_6)
# ARGH! I have to repeat the list of tests a third time. Maybe it's
# time to break down and auto-generate the Makefile.am or something
# from autogen.sh. My, but this is painful...
a8_mask_LDADD = $(LDADDS)
+caps_joins_LDADD = $(LDADDS)
caps_sub_paths_LDADD = $(LDADDS)
+clip_all_LDADD = $(LDADDS)
clip_nesting_LDADD = $(LDADDS)
clip_operator_LDADD = $(LDADDS)
clip_twice_LDADD = $(LDADDS)
@@ -666,6 +688,7 @@ composite_integer_translate_over_LDADD = $(LDADDS)
composite_integer_translate_over_repeat_LDADD = $(LDADDS)
create_from_png_LDADD = $(LDADDS)
create_from_png_stream_LDADD = $(LDADDS)
+dash_caps_joins_LDADD = $(LDADDS)
dash_offset_negative_LDADD = $(LDADDS)
fill_and_stroke_LDADD = $(LDADDS)
fill_rule_LDADD = $(LDADDS)
@@ -688,8 +711,9 @@ paint_with_alpha_LDADD = $(LDADDS)
path_data_LDADD = $(LDADDS)
pdf_surface_LDADD = $(LDADDS)
pdf_clip_LDADD = $(LDADDS)
-ps_surface_LDADD = $(LDADDS)
pixman_rotate_LDADD = $(LDADDS)
+ps_surface_LDADD = $(LDADDS)
+pthread_show_text_LDADD = $(LDADDS)
rectangle_rounding_error_LDADD = $(LDADDS)
scale_source_surface_paint_LDADD = $(LDADDS)
select_font_no_show_text_LDADD = $(LDADDS)
@@ -785,9 +809,15 @@ clean-noinstPROGRAMS:
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)
+caps-joins$(EXEEXT): $(caps_joins_OBJECTS) $(caps_joins_DEPENDENCIES)
+ @rm -f caps-joins$(EXEEXT)
+ $(LINK) $(caps_joins_LDFLAGS) $(caps_joins_OBJECTS) $(caps_joins_LDADD) $(LIBS)
caps-sub-paths$(EXEEXT): $(caps_sub_paths_OBJECTS) $(caps_sub_paths_DEPENDENCIES)
@rm -f caps-sub-paths$(EXEEXT)
$(LINK) $(caps_sub_paths_LDFLAGS) $(caps_sub_paths_OBJECTS) $(caps_sub_paths_LDADD) $(LIBS)
+clip-all$(EXEEXT): $(clip_all_OBJECTS) $(clip_all_DEPENDENCIES)
+ @rm -f clip-all$(EXEEXT)
+ $(LINK) $(clip_all_LDFLAGS) $(clip_all_OBJECTS) $(clip_all_LDADD) $(LIBS)
clip-nesting$(EXEEXT): $(clip_nesting_OBJECTS) $(clip_nesting_DEPENDENCIES)
@rm -f clip-nesting$(EXEEXT)
$(LINK) $(clip_nesting_LDFLAGS) $(clip_nesting_OBJECTS) $(clip_nesting_LDADD) $(LIBS)
@@ -812,6 +842,9 @@ create-from-png$(EXEEXT): $(create_from_png_OBJECTS) $(create_from_png_DEPENDENC
create-from-png-stream$(EXEEXT): $(create_from_png_stream_OBJECTS) $(create_from_png_stream_DEPENDENCIES)
@rm -f create-from-png-stream$(EXEEXT)
$(LINK) $(create_from_png_stream_LDFLAGS) $(create_from_png_stream_OBJECTS) $(create_from_png_stream_LDADD) $(LIBS)
+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-offset-negative$(EXEEXT): $(dash_offset_negative_OBJECTS) $(dash_offset_negative_DEPENDENCIES)
@rm -f dash-offset-negative$(EXEEXT)
$(LINK) $(dash_offset_negative_LDFLAGS) $(dash_offset_negative_OBJECTS) $(dash_offset_negative_LDADD) $(LIBS)
@@ -887,6 +920,9 @@ pixman-rotate$(EXEEXT): $(pixman_rotate_OBJECTS) $(pixman_rotate_DEPENDENCIES)
ps-surface$(EXEEXT): $(ps_surface_OBJECTS) $(ps_surface_DEPENDENCIES)
@rm -f ps-surface$(EXEEXT)
$(LINK) $(ps_surface_LDFLAGS) $(ps_surface_OBJECTS) $(ps_surface_LDADD) $(LIBS)
+pthread-show-text$(EXEEXT): $(pthread_show_text_OBJECTS) $(pthread_show_text_DEPENDENCIES)
+ @rm -f pthread-show-text$(EXEEXT)
+ $(LINK) $(pthread_show_text_LDFLAGS) $(pthread_show_text_OBJECTS) $(pthread_show_text_LDADD) $(LIBS)
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)
@@ -972,7 +1008,9 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/a8-mask.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buffer-diff.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-test.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/caps-joins.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/caps-sub-paths.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clip-all.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clip-nesting.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clip-operator.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clip-twice.Po@am__quote@
@@ -981,6 +1019,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/composite-integer-translate-source.Po@am__quote@
@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-offset-negative.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fill-and-stroke.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fill-rule.Po@am__quote@
@@ -1006,6 +1045,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdf-surface.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pixman-rotate.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ps-surface.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pthread-show-text.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/read-png.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rectangle-rounding-error.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rel-path.Po@am__quote@
diff --git a/test/cairo-test.c b/test/cairo-test.c
index 18d036b..029002b 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -35,7 +35,9 @@
#endif
#include <errno.h>
#include <string.h>
+#if HAVE_FCFINI
#include <fontconfig/fontconfig.h>
+#endif
#include "cairo-test.h"
@@ -48,6 +50,9 @@
#define vsnprintf _vsnprintf
#endif
+static void
+xunlink (const char *pathname);
+
#define CAIRO_TEST_LOG_SUFFIX ".log"
#define CAIRO_TEST_PNG_SUFFIX "-out.png"
#define CAIRO_TEST_REF_SUFFIX "-ref.png"
@@ -59,6 +64,22 @@
FILE *cairo_test_log_file;
void
+cairo_test_init (const char *test_name)
+{
+ char *log_name;
+
+ xasprintf (&log_name, "%s%s", test_name, CAIRO_TEST_LOG_SUFFIX);
+ xunlink (log_name);
+
+ cairo_test_log_file = fopen (log_name, "a");
+ if (cairo_test_log_file == NULL) {
+ fprintf (stderr, "Error opening log file: %s\n", log_name);
+ cairo_test_log_file = stderr;
+ }
+ free (log_name);
+}
+
+void
cairo_test_log (const char *fmt, ...)
{
va_list va;
@@ -382,6 +403,8 @@ create_xlib_surface (int width, int height, void **closure)
return NULL;
}
+ XSynchronize (xtc->dpy, 1);
+
/* XXX: Currently we don't do any xlib testing when the X server
* doesn't have the Render extension. We could do better here,
* (perhaps by converting the tests from ARGB32 to RGB24). One
@@ -530,17 +553,8 @@ cairo_test_expecting (cairo_test_t *test, cairo_test_draw_function_t draw,
{ "xlib", create_xlib_surface, cleanup_xlib},
#endif
};
- char *log_name;
-
- xasprintf (&log_name, "%s%s", test->name, CAIRO_TEST_LOG_SUFFIX);
- xunlink (log_name);
- cairo_test_log_file = fopen (log_name, "a");
- if (cairo_test_log_file == NULL) {
- fprintf (stderr, "Error opening log file: %s\n", log_name);
- cairo_test_log_file = stderr;
- }
- free (log_name);
+ cairo_test_init (test->name);
/* The intended logic here is that we return overall SUCCESS
* iff. there is at least one tested backend and that all tested
diff --git a/test/cairo-test.h b/test/cairo-test.h
index d35faab..147e5c7 100644
--- a/test/cairo-test.h
+++ b/test/cairo-test.h
@@ -26,10 +26,36 @@
#ifndef _CAIRO_TEST_H_
#define _CAIRO_TEST_H_
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <math.h>
#include <cairo.h>
#include <cairo-debug.h>
+#if HAVE_STDINT_H
+# include <stdint.h>
+#elif HAVE_INTTYPES_H
+# include <inttypes.h>
+#elif HAVE_SYS_INT_TYPES_H
+# include <sys/int_types.h>
+#elif defined(_MSC_VER)
+typedef __int8 int8_t;
+typedef unsigned __int8 uint8_t;
+typedef __int16 int16_t;
+typedef unsigned __int16 uint16_t;
+typedef __int32 int32_t;
+typedef unsigned __int32 uint32_t;
+typedef __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+# ifndef HAVE_UINT64_T
+# define HAVE_UINT64_T 1
+# endif
+#else
+#error Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, \etc.)
+#endif
+
typedef enum cairo_test_status {
CAIRO_TEST_SUCCESS = 0,
CAIRO_TEST_FAILURE,
@@ -45,15 +71,58 @@ typedef struct cairo_test {
typedef cairo_test_status_t (*cairo_test_draw_function_t) (cairo_t *cr, int width, int height);
-/* cairo_test.c */
+/* The standard test interface which works by examining result image.
+ *
+ * cairo_test() accepts a draw function which will be called once for
+ * each testable backend. The following checks will be performed for
+ * each backend:
+ *
+ * 1) If draw() does not return CAIRO_TEST_SUCCESS then this backend
+ * fails.
+ *
+ * 2) Otherwise, if cairo_status(cr) indicates an error then this
+ * backend fails.
+ *
+ * 3) Otherwise, if the image size is 0, then this backend passes.
+ *
+ * 4) Otherwise, if every channel of every pixel exactly matches the
+ * reference image then this backend passes. If not, this backend
+ * fails.
+ *
+ * The overall test result is PASS if and only if there is at least
+ * one backend that is tested and if all tested backend pass according
+ * to the four criteria above.
+ */
cairo_test_status_t
cairo_test (cairo_test_t *test, cairo_test_draw_function_t draw);
+/* Like cairo_test, but the text is expected to fail for the stated
+ * reason. Any test calling this variant should be listed in the
+ * XFAIL_TESTS list in Makefile.am. */
cairo_test_status_t
cairo_test_expect_failure (cairo_test_t *test,
cairo_test_draw_function_t draw,
const char *reason);
+/* cairo_test_init() and cairo_test_log() exist to help in writing
+ * tests for which cairo_test() is not appropriate for one reason or
+ * another. For example, some tests might not be doing any drawing at
+ * all, or may need to create their own cairo_t rather than be handed
+ * one by cairo_test.
+ */
+
+/* Initialize test-specific resources, (log files, etc.) */
+void
+cairo_test_init (const char *test_name);
+
+/* Print a message to the log file, ala printf. */
+void
+cairo_test_log (const char *fmt, ...);
+
+/* Helper functions that take care of finding source images even when
+ * building in a non-srcdir manner, (ie. the tests will be run in a
+ * directory that is different from the one where the source image
+ * exists). */
cairo_surface_t *
cairo_test_create_surface_from_png (const char *filename);
@@ -61,9 +130,6 @@ cairo_pattern_t *
cairo_test_create_pattern_from_png (const char *filename);
void
-cairo_test_log (const char *fmt, ...);
-
-void
xasprintf (char **strp, const char *fmt, ...);
#endif
diff --git a/test/caps-joins-ref.png b/test/caps-joins-ref.png
new file mode 100644
index 0000000..e7547ca
--- /dev/null
+++ b/test/caps-joins-ref.png
Binary files differ
diff --git a/test/caps-joins.c b/test/caps-joins.c
new file mode 100644
index 0000000..7c5b1f0
--- /dev/null
+++ b/test/caps-joins.c
@@ -0,0 +1,85 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * 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
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. 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: Carl D. Worth <cworth@cworth.org>
+ */
+
+#include "cairo-test.h"
+
+#define LINE_WIDTH 10.
+#define SIZE (5 * LINE_WIDTH)
+#define PAD (2 * LINE_WIDTH)
+
+cairo_test_t test = {
+ "caps-joins",
+ "Test caps and joins",
+ 3 * (PAD + SIZE) + PAD,
+ PAD + SIZE + PAD
+};
+
+static void
+make_path (cairo_t *cr)
+{
+ cairo_move_to (cr, 0., 0.);
+ cairo_rel_line_to (cr, 0., SIZE);
+ cairo_rel_line_to (cr, SIZE, 0.);
+ cairo_close_path (cr);
+
+ cairo_move_to (cr, 2 * LINE_WIDTH, 0.);
+ cairo_rel_line_to (cr, 3 * LINE_WIDTH, 0.);
+ cairo_rel_line_to (cr, 0., 3 * LINE_WIDTH);
+}
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_set_line_width (cr, LINE_WIDTH);
+
+ cairo_translate (cr, PAD, PAD);
+
+ make_path (cr);
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
+ cairo_set_line_join (cr, CAIRO_LINE_JOIN_BEVEL);
+ cairo_stroke (cr);
+
+ cairo_translate (cr, SIZE + PAD, 0.);
+
+ make_path (cr);
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
+ cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
+ cairo_stroke (cr);
+
+ cairo_translate (cr, SIZE + PAD, 0.);
+
+ make_path (cr);
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
+ cairo_set_line_join (cr, CAIRO_LINE_JOIN_MITER);
+ cairo_stroke (cr);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test, draw);
+}
diff --git a/test/clip-all-ref.png b/test/clip-all-ref.png
new file mode 100644
index 0000000..6c14df5
--- /dev/null
+++ b/test/clip-all-ref.png
Binary files differ
diff --git a/test/clip-all.c b/test/clip-all.c
new file mode 100644
index 0000000..0fbcc4a
--- /dev/null
+++ b/test/clip-all.c
@@ -0,0 +1,69 @@
+/*
+ * Copyright © 2005 Novell, Inc.
+ *
+ * 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
+ * Novell, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Novell, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL NOVELL, INC. 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: Radek Doulík <rodo@novell.com>
+ */
+
+#include "cairo-test.h"
+
+#define SIZE 10
+#define CLIP_SIZE 2
+
+cairo_test_t test = {
+ "clip-all",
+ "Test clipping with everything clipped out",
+ SIZE, SIZE
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_rectangle (cr, 0, 0, SIZE, SIZE);
+ cairo_set_source_rgb (cr, 0, 0, 1);
+ cairo_fill (cr);
+
+ cairo_reset_clip (cr);
+ cairo_rectangle (cr, CLIP_SIZE, CLIP_SIZE, CLIP_SIZE, CLIP_SIZE);
+ cairo_clip (cr);
+ cairo_rectangle (cr, 3*CLIP_SIZE, 3*CLIP_SIZE, CLIP_SIZE, CLIP_SIZE);
+ cairo_clip (cr);
+
+ cairo_translate (cr, .5, .5);
+
+ cairo_reset_clip (cr);
+ cairo_rectangle (cr, CLIP_SIZE, CLIP_SIZE, CLIP_SIZE, CLIP_SIZE);
+ cairo_clip (cr);
+ cairo_rectangle (cr, 3*CLIP_SIZE, 3*CLIP_SIZE, CLIP_SIZE, CLIP_SIZE);
+ cairo_clip (cr);
+
+ cairo_rectangle (cr, 0, 0, SIZE, SIZE);
+ cairo_set_source_rgb (cr, 1, 1, 0);
+ cairo_fill (cr);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test, draw);
+}
diff --git a/test/create-from-png-stream.c b/test/create-from-png-stream.c
index 75c70a5..e4bcda8 100644
--- a/test/create-from-png-stream.c
+++ b/test/create-from-png-stream.c
@@ -32,8 +32,8 @@
#define HEIGHT 2
cairo_test_t test = {
- "create-from-png",
- "Tests the creation of an image surface from a PNG file",
+ "create-from-png-stream",
+ "Tests the creation of an image surface from a PNG using a FILE *",
WIDTH, HEIGHT
};
@@ -61,7 +61,7 @@ draw (cairo_t *cr, int width, int height)
xasprintf (&filename, "%s/%s", srcdir ? srcdir : ".",
"create-from-png-stream-ref.png");
- file = fopen (filename, "r");
+ file = fopen (filename, "rb");
if (file == NULL) {
cairo_test_log ("Error: failed to open file: %s\n", filename);
return CAIRO_TEST_FAILURE;
diff --git a/test/dash-caps-joins-ref.png b/test/dash-caps-joins-ref.png
new file mode 100644
index 0000000..c44352b
--- /dev/null
+++ b/test/dash-caps-joins-ref.png
Binary files differ
diff --git a/test/dash-caps-joins.c b/test/dash-caps-joins.c
new file mode 100644
index 0000000..d0e68ec
--- /dev/null
+++ b/test/dash-caps-joins.c
@@ -0,0 +1,94 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * 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
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. 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: Carl D. Worth <cworth@cworth.org>
+ */
+
+/* Test case for bug #4409:
+ *
+ * Dashes are missing initial caps
+ * https://bugs.freedesktop.org/show_bug.cgi?id=4409
+ */
+
+#include "cairo-test.h"
+
+#define LINE_WIDTH 10.
+#define SIZE (5 * LINE_WIDTH)
+#define PAD (2 * LINE_WIDTH)
+
+cairo_test_t test = {
+ "dash-caps-joins",
+ "Test caps and joins when dashing",
+ 3 * (PAD + SIZE) + PAD,
+ PAD + SIZE + PAD
+};
+
+static void
+make_path (cairo_t *cr)
+{
+ cairo_move_to (cr, 0., 0.);
+ cairo_rel_line_to (cr, 0., SIZE);
+ cairo_rel_line_to (cr, SIZE, 0.);
+ cairo_close_path (cr);
+
+ cairo_move_to (cr, 2 * LINE_WIDTH, 0.);
+ cairo_rel_line_to (cr, 3 * LINE_WIDTH, 0.);
+ cairo_rel_line_to (cr, 0., 3 * LINE_WIDTH);
+}
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ double dash[] = {LINE_WIDTH, 1.5 * LINE_WIDTH};
+
+ cairo_set_line_width (cr, LINE_WIDTH);
+ cairo_set_dash (cr, dash, sizeof(dash)/sizeof(dash[0]), - 2 * LINE_WIDTH);
+
+ cairo_translate (cr, PAD, PAD);
+
+ make_path (cr);
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
+ cairo_set_line_join (cr, CAIRO_LINE_JOIN_BEVEL);
+ cairo_stroke (cr);
+
+ cairo_translate (cr, SIZE + PAD, 0.);
+
+ make_path (cr);
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
+ cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
+ cairo_stroke (cr);
+
+ cairo_translate (cr, SIZE + PAD, 0.);
+
+ make_path (cr);
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
+ cairo_set_line_join (cr, CAIRO_LINE_JOIN_MITER);
+ cairo_stroke (cr);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test, draw);
+}
diff --git a/test/filter-nearest-offset.c b/test/filter-nearest-offset.c
index e5657bb..7718da5 100644
--- a/test/filter-nearest-offset.c
+++ b/test/filter-nearest-offset.c
@@ -44,7 +44,7 @@ static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
cairo_surface_t *surface;
- unsigned long data[STAMP_WIDTH * STAMP_HEIGHT] = {
+ uint32_t data[STAMP_WIDTH * STAMP_HEIGHT] = {
0xffffffff, 0xffffffff, 0xffff0000, 0xffff0000,
0xffffffff, 0xffffffff, 0xffff0000, 0xffff0000,
diff --git a/test/get-and-set.c b/test/get-and-set.c
index 72d6610..1ebdddd 100644
--- a/test/get-and-set.c
+++ b/test/get-and-set.c
@@ -52,7 +52,7 @@ settings_t settings[] = {
CAIRO_LINE_CAP_SQUARE,
CAIRO_LINE_JOIN_ROUND,
3.14,
- {1.0, 2.0, 3.0, 4.0, 5.0, 6.0}
+ {2.0, 0.0, 0.0, 2.0, 5.0, 5.0}
},
{
CAIRO_OPERATOR_ATOP,
@@ -62,7 +62,7 @@ settings_t settings[] = {
CAIRO_LINE_CAP_ROUND,
CAIRO_LINE_JOIN_BEVEL,
1000.0,
- {.1, .01, .001, .0001, .00001, .000001}
+ {-3.0, 1.0, 1.0, -3.0, -4, -4}
}
};
diff --git a/test/mask-ctm.c b/test/mask-ctm.c
index 1fd4828..6bc9992 100644
--- a/test/mask-ctm.c
+++ b/test/mask-ctm.c
@@ -36,7 +36,7 @@ draw (cairo_t *cr, int width, int height)
{
cairo_surface_t *mask_surface;
cairo_pattern_t *mask;
- unsigned long data[] = {
+ uint32_t data[] = {
0x80000000, 0x80000000,
0x80000000, 0x80000000,
};
diff --git a/test/mask-surface-ctm.c b/test/mask-surface-ctm.c
index 6eb2bf2..1d5bf33 100644
--- a/test/mask-surface-ctm.c
+++ b/test/mask-surface-ctm.c
@@ -35,7 +35,7 @@ static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
cairo_surface_t *mask;
- unsigned long data[] = {
+ uint32_t data[] = {
0x80000000, 0x80000000,
0x80000000, 0x80000000,
};
diff --git a/test/move-to-show-surface.c b/test/move-to-show-surface.c
index c5cc1ae..74bf51b 100644
--- a/test/move-to-show-surface.c
+++ b/test/move-to-show-surface.c
@@ -55,7 +55,7 @@ static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
cairo_surface_t *surface;
- unsigned long colors[4] = {
+ uint32_t colors[4] = {
0xffffffff, 0xffff0000,
0xff00ff00, 0xff0000ff
};
diff --git a/test/nil-surface.c b/test/nil-surface.c
index b1e83d4..ba2a597 100644
--- a/test/nil-surface.c
+++ b/test/nil-surface.c
@@ -24,7 +24,7 @@
*/
#include "cairo-test.h"
-#include <cairo-ft.h>
+#include <stddef.h>
/* Test to verify fixes for the following similar bugs:
*
diff --git a/test/paint-with-alpha.c b/test/paint-with-alpha.c
index f4734af..552c062 100644
--- a/test/paint-with-alpha.c
+++ b/test/paint-with-alpha.c
@@ -35,7 +35,7 @@ static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
cairo_surface_t *surface;
- unsigned long data[16] = {
+ uint32_t data[16] = {
0xffffffff, 0xffffffff, 0xffff0000, 0xffff0000,
0xffffffff, 0xffffffff, 0xffff0000, 0xffff0000,
diff --git a/test/pthread-show-text.c b/test/pthread-show-text.c
new file mode 100644
index 0000000..71a8675
--- /dev/null
+++ b/test/pthread-show-text.c
@@ -0,0 +1,110 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * 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
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. 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: Carl D. Worth <cworth@cworth.org>
+ */
+
+/* Test case for bug #4299:
+
+ Assertion fails in "cairo-font.c" when using multithreads
+ https://bugs.freedesktop.org/show_bug.cgi?id=4299
+*/
+
+#include "cairo-test.h"
+#include "xmalloc.h"
+
+#include <string.h>
+#include <stdlib.h>
+#include <pthread.h>
+#if HAVE_FCFINI
+#include <fontconfig/fontconfig.h>
+#endif
+
+static void *
+start (void *closure)
+{
+ cairo_surface_t *surface;
+ cairo_t *cr;
+ int i;
+
+ surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1);
+ cr = cairo_create (surface);
+
+ cairo_save (cr);
+ {
+ cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
+ cairo_paint (cr);
+ }
+ cairo_restore (cr);
+
+ cairo_move_to (cr, 1, 1);
+
+ for (i=0; i < 10; i++) {
+ cairo_set_font_size (cr, 8 + i);
+ cairo_show_text (cr, "Hello world.\n");
+ }
+
+ cairo_destroy (cr);
+ cairo_surface_destroy (surface);
+
+ return NULL;
+}
+
+int
+main (int argc, char *argv[0])
+{
+ int err;
+ int i, num_threads;
+ pthread_t *pthread;
+
+ if (argc > 1) {
+ num_threads = atoi (argv[1]);
+ } else {
+ num_threads = 20;
+ }
+
+ cairo_test_init ("pthread-show-text");
+
+ cairo_test_log ("Running with %d threads.\n", num_threads);
+
+ pthread = xmalloc (num_threads * sizeof (pthread_t));
+
+ for (i = 0; i < num_threads; i++) {
+ err = pthread_create (&pthread[i], NULL, start, NULL);
+ if (err) {
+ cairo_test_log ("pthread_create failed: %s\n", strerror(err));
+ return CAIRO_TEST_FAILURE;
+ }
+ }
+
+ for (i = 0; i < num_threads; i++)
+ pthread_join (pthread[i], NULL);
+
+ free (pthread);
+
+ cairo_debug_reset_static_data ();
+#if HAVE_FCFINI
+ FcFini ();
+#endif
+
+ return CAIRO_TEST_SUCCESS;
+}
diff --git a/test/scale-source-surface-paint.c b/test/scale-source-surface-paint.c
index 7b1cc38..9e36ea6 100644
--- a/test/scale-source-surface-paint.c
+++ b/test/scale-source-surface-paint.c
@@ -35,7 +35,7 @@ static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
cairo_surface_t *surface;
- unsigned long data[16] = {
+ uint32_t data[16] = {
0xffffffff, 0xffffffff, 0xffff0000, 0xffff0000,
0xffffffff, 0xffffffff, 0xffff0000, 0xffff0000,
diff --git a/test/set-source.c b/test/set-source.c
index 568935d..08e9e3e 100644
--- a/test/set-source.c
+++ b/test/set-source.c
@@ -37,7 +37,7 @@ draw (cairo_t *cr, int width, int height)
int i;
/* This color value might need to change in the future when we fix
* the rounding in cairo-color.c */
- unsigned long color = 0x7f19334C;
+ uint32_t color = 0x7f19334C;
cairo_surface_t *surface;
cairo_pattern_t *pattern;
diff --git a/test/source-surface-scale-paint.c b/test/source-surface-scale-paint.c
index 1af972f..3f3644c 100644
--- a/test/source-surface-scale-paint.c
+++ b/test/source-surface-scale-paint.c
@@ -35,7 +35,7 @@ static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
cairo_surface_t *surface;
- unsigned long data[16] = {
+ uint32_t data[16] = {
0xffffffff, 0xffffffff, 0xffff0000, 0xffff0000,
0xffffffff, 0xffffffff, 0xffff0000, 0xffff0000,
diff --git a/test/translate-show-surface.c b/test/translate-show-surface.c
index 5a566bc..d81ed1a 100644
--- a/test/translate-show-surface.c
+++ b/test/translate-show-surface.c
@@ -53,7 +53,7 @@ static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
cairo_surface_t *surface;
- unsigned long colors[4] = {
+ uint32_t colors[4] = {
0xffffffff, 0xffff0000,
0xff00ff00, 0xff0000ff
};