1. libgd
  2. Untitled project
  3. gd-libgd

Commits

Pierre Joye  committed 8b5a837 Merge

Merge branch 'master' of https://bitbucket.org/libgd/gd-libgd

  • Participants
  • Parent commits 1141d7c, 83f5b74
  • Branches master

Comments (0)

Files changed (24)

File .gitignore

View file
 syntax: glob
 *~
 *.[ao]
+.dirstamp
 
 Makefile
 CMakeCache.txt
 /configure
 /libtool
 /config/ar-lib
+/config/compile
 /config/config.guess
 /config/config.sub
 /config/depcomp
 /src/testac
 /src/testtr
 /src/webpng
+
+# Tests artifacts
+tests/a.png
+tests/bmp_im2im_dst.bmp
+tests/bmp_im2im_src.bmp
+tests/bug00132.c_35_diff.png
+tests/bug00132.c_35_out.png
+tests/bug00181.gif
+tests/bug00181a.gif
+tests/bug00227.gif
+tests/gd2_im2im_dst.gd2
+tests/gd2_im2im_src.gd2
+tests/gd_im2im_dst.gd
+tests/gd_im2im_src.gd
+tests/gdimageline_aa.c_38_diff.png
+tests/gdimageline_aa.c_38_out.png
+tests/gdimagestringft_bbox.png
+tests/gif_im2im_dst.gif
+tests/gif_im2im_src.gif
+tests/jpeg_im2im_dst.jpeg
+tests/jpeg_im2im_src.jpeg
+tests/jpeg_read.c_25_diff.png
+tests/jpeg_read.c_25_out.png
+tests/png_im2im_dst.png
+tests/png_im2im_src.png
+tests/tiff_im2im_dst.tiff
+tests/tiff_im2im_src.tiff
+tests/wbmp/wbmp_im2im_dst.wbmp
+tests/wbmp/wbmp_im2im_src.wbmp
+tests/wbmp_im2im_dst.wbmp
+tests/wbmp_im2im_src.wbmp
+tests/gd2/gd2_empty_file
+tests/gdimagesetpixel/bug00186
+tests/gdimagestringftex/gdimagestringftex_returnfontpathname
+tests/gdimageline/gdimageline_aa_outofrange
+tests/gdimagerectangle/bug00003
+tests/gdimagerectangle/bug00106_gdimagerectangle
+tests/gd/gd_null
+tests/gd/gd_num_colors
+tests/tga/tga_null
+tests/gdimagepixelate/gdimagepixelate
+tests/gdimagecopy/bug00007
+tests/gdnewfilectx/gdnewfilectx_null
+tests/gdimagefilledrectangle/bug00078
+tests/gdimagefilledrectangle/bug00004
+tests/gdimagefilledrectangle/bug00106_gdimagefilledrectangle
+tests/gdimagecolordeallocate/gdimagecolordeallocate
+tests/wbmp/wbmp_null
+tests/gdimagecolortransparent/gdimagecolortransparent
+tests/gif/bug00005_2
+tests/gif/gif_null
+tests/gif/bug00181
+tests/gif/bug00227
+tests/bmp/bmp_null
+tests/gdimagestringft/gdimagestringft_bbox
+tests/gdtiled/bug00032
+tests/gd2/gd2_im2im
+tests/gd2/gd2_null
+tests/gd2/gd2_read
+tests/gdimagearc/bug00079
+tests/gdimageline/gdimageline_aa
+tests/gdimageline/bug00072
+tests/gdimageline/bug00077
+tests/gdimageline/bug00111
+tests/gdimageopenpolygon/gdimageopenpolygon2
+tests/gdimageopenpolygon/gdimageopenpolygon1
+tests/gdimageopenpolygon/gdimageopenpolygon0
+tests/gdimageopenpolygon/gdimageopenpolygon3
+tests/gd/gd_im2im
+tests/gdimagecopy/bug00081
+tests/gdimagecopyrotated/bug00020
+tests/gdimagepolygon/gdimagepolygon0
+tests/gdimagepolygon/gdimagepolygon3
+tests/gdimagepolygon/gdimagepolygon1
+tests/gdimagepolygon/gdimagepolygon2
+tests/gdimagecolorresolve/gdimagecolorresolve
+tests/gdimagefilledpolygon/gdimagefilledpolygon0
+tests/gdimagefilledpolygon/gdimagefilledpolygon3
+tests/gdimagefilledpolygon/gdimagefilledpolygon2
+tests/gdimagefilledpolygon/gdimagefilledpolygon1
+tests/gdimagefilledpolygon/bug00100
+tests/gdimagecolorreplace/gdimagecolorreplace
+tests/gdimagefill/bug00002_2
+tests/gdimagefill/bug00002_1
+tests/gdimagefill/bug00002_4
+tests/gdimagefill/bug00002_3
+tests/gdimagecolorclosest/gdimagecolorclosest
+tests/gif/bug00005
+tests/gif/gif_im2im
+tests/gif/bug00066
+tests/gif/bug00006
+tests/gif/bug00060
+tests/gdimagecolorexact/gdimagecolorexact
+tests/gdimagefilledellipse/bug00191
+tests/gdimagefilledellipse/bug00010
+tests/xpm/bug00185
+tests/xpm/color_name
+tests/xpm/bug00166
+tests/jpeg/jpeg_empty_file
+tests/jpeg/jpeg_resolution
+tests/jpeg/jpeg_im2im
+tests/jpeg/jpeg_null
+tests/jpeg/jpeg_read
+tests/png/png_null
+tests/png/bug00033
+tests/png/bug00193
+tests/png/bug00011
+tests/png/bug00088
+tests/png/png_resolution
+tests/png/bug00086
+tests/png/png_im2im
+tests/wbmp/wbmp_im2im
+tests/tiff/tiff_null
+tests/tiff/tiff_im2im
+tests/freetype/bug00132
+tests/bmp/bmp_im2im
+tests/gdimagescatterex/bug00208_1
+tests/gdimagescatterex/bug00208_2
+tests/gdimagefilltoborder/bug00037
+tests/gdtest/test_config.h

File Makefile.am

View file
 ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = src config
+SUBDIRS = src config tests
 EXTRA_DIST = test tests docs examples windows VMS cmake netware CMakeLists.txt

File configure.ac

View file
 AM_PROG_AR
 
 AC_PROG_CC
+AM_PROG_CC_C_O
 AC_PROG_INSTALL
 AC_PROG_LIBTOOL
 AC_PROG_LN_S
     with_png=yes
   ],[
     if test "$with_png" = yes; then
-      AC_MSG_ERROR([png support requested, but not found])
+      AC_MSG_ERROR([png support requested, but not found - see http://www.libpng.org/pub/png/])
     fi
     with_png=no
   ])
     LIBPNG_LIBS=`$LIBPNG_CONFIG --libs`
     with_png=yes
   else
-    AC_MSG_ERROR([png support requested, but not found: $LIBPNG_CONFIG])
+    AC_MSG_ERROR([png support requested, but not found at requested location: $LIBPNG_CONFIG])
   fi
   ;;
 esac
-if test "$with_png" = no; then
-  AC_MSG_WARN([libpng is required for PNG files - see http://www.libpng.org/pub/png/])
-else
+if test "$with_png" != no; then
   CPPFLAGS="$CPPFLAGS $LIBPNG_CFLAGS"
   LIBS="$LIBS $LIBPNG_LIBS"
   FEATURES="GD_PNG $FEATURES"
 else
   ac_cv_lib_fontconfig_FcInit=no
 fi
+AM_CONDITIONAL([HAVE_LIBFONTCONFIG], test "$ac_cv_lib_fontconfig_FcInit" = yes)
 
 dnl check for libjpeg by default
 AC_ARG_WITH(jpeg,dnl
 else
   ac_cv_lib_jpeg_jpeg_set_defaults=no
 fi
+AM_CONDITIONAL([HAVE_LIBJPEG], test "$ac_cv_lib_jpeg_jpeg_set_defaults" = yes)
 
 dnl check for libXpm by default
 AC_ARG_WITH(xpm,dnl
 else
   ac_cv_lib_Xpm_XpmReadFileToXpmImage=no
 fi
-
-
+AM_CONDITIONAL([HAVE_LIBXPM], test "$ac_cv_lib_Xpm_XpmReadFileToXpmImage" = yes)
 
 dnl check for libvpx by default
 AC_ARG_WITH(vpx,dnl
 else
   ac_cv_lib_vpx_vpx_codec_destroy=no
 fi
-
+AM_CONDITIONAL([HAVE_LIBVPX], test "$ac_cv_lib_vpx_vpx_codec_destroy" = yes)
 
 dnl check for libtiff by default
 AC_ARG_WITH(tiff,dnl
 else
   ac_cv_lib_tiff_TIFFClientOpen=no
 fi
+AM_CONDITIONAL([HAVE_LIBTIFF], test "$ac_cv_lib_tiff_TIFFClientOpen" = yes)
 
 gl_VISIBILITY()
 CFLAGS="$CFLAGS $CFLAG_VISIBILITY"
 
 AC_CONFIG_FILES([Makefile
                 src/Makefile
+		tests/Makefile
+		tests/test_config.h
                 config/Makefile
                 config/gdlib-config
 		config/gdlib.pc])

File src/Makefile.am

View file
 ## Process this file with automake to produce Makefile.in -*-Makefile-*-
 
 bin_PROGRAMS = gdcmpgif
+check_PROGRAMS = gifanimtest gd_color_map_test
 
 if HAVE_LIBPNG
 bin_PROGRAMS += gdtopng pngtogd webpng
+check_PROGRAMS += circletexttest fontsizetest fontwheeltest gddemo testac
 if HAVE_LIBZ
 bin_PROGRAMS += gdparttopng gd2topng pngtogd2
+check_PROGRAMS += gdtest
 endif
 endif
 
+if HAVE_LIBJPEG
+if !HAVE_LIBPNG
+check_PROGRAMS += fontsizetest fontwheeltest
+endif
+endif
+
+if HAVE_LIBFONTCONFIG
+check_PROGRAMS += fontconfigtest
+endif
+
 if HAVE_LIBFREETYPE
 bin_PROGRAMS += annotate
+check_PROGRAMS += gdtestft testtr
 endif
 
 if HAVE_LIBZ
 
 bin_SCRIPTS = bdftogd
 
-check_PROGRAMS = fontsizetest fontwheeltest gdtest gddemo gd2time gdtestft testac circletexttest testtr fontconfigtest gifanimtest gd_color_map_test
+if HAVE_LIBZ
+check_PROGRAMS += gd2time
+endif
 
 EXTRA_DIST = bdftogd demoin.png entities.html entities.tcl CMakeLists.txt
 

File src/circletexttest.c

View file
 	/* 2.0.22: can't depend on PNG either  */
 #ifndef HAVE_LIBPNG
 	fprintf(stderr, "Requires PNG support, gd was compiled without it\n");
-	exit(0);
+	return 0;
 #else
 	char *error;
 	FILE *in = 0;

File src/gdtestft.c

View file
 	}
 	/* TBB: Write img to test/fttest.jpg or test/fttest.png */
 	if (im->trueColor) {
+#ifdef HAVE_LIBJPEG
 		out = fopen ("test/fttest.jpg", "wb");
 		if (!out) {
 			fprintf(stderr, "Can't create test/fttest.jpg\n");
 			exit (1);
 		}
 		/* Fairly high JPEG quality setting */
-#ifdef HAVE_LIBJPEG
 		gdImageJpeg (im, out, 90);
-#else
-		fprintf(stderr, "No JPEG library support.\n");
-#endif
 		fclose (out);
 		fprintf(stderr, "Test image written to test/fttest.jpg\n");
+#else
+		fprintf(stderr, "Test image not written; No JPEG library support.\n");
+#endif
 	} else {
+#ifdef HAVE_LIBPNG
 		out = fopen ("test/fttest.png", "wb");
 		if (!out) {
 			fprintf(stderr, "Can't create test/fttest.png\n");
 			exit (1);
 		}
 		/* 2.0.10: correct ifdef, thanks to Gabriele Verzeletti */
-#ifdef HAVE_LIBPNG
 		gdImagePng (im, out);
-#else
-		fprintf(stderr, "No PNG library support.\n");
-#endif
 		fclose (out);
 		fprintf(stderr, "Test image written to test/fttest.png\n");
+#else
+		fprintf(stderr, "Test image not written; No PNG library support.\n");
+#endif
 	}
 	/* Destroy it */
 	gdImageDestroy (im);

File src/testtr.c

View file
 	gdImagePng (im, out);
 	fclose (out);
 #else
-	gd_error("Compiled without libpng support\n");
+	fprintf(stderr, "Compiled without libpng support\n");
 #endif /* HAVE_LIBPNG */
 	gdImageDestroy (im);
 
 	return 0;
 #else
-	gd_error("Compiled without freetype support\n");
+	fprintf(stderr, "Compiled without freetype support\n");
 	return 0;
 #endif /* HAVE_LIBFREETYPE */
 }

File tests/Makefile.am

View file
+noinst_LIBRARIES = libgdtest.a
+
+libgdtest_a_SOURCES = gdtest/gdtest.c ../src/gdhelpers.c
+
+check_PROGRAMS = \
+	gd2/gd2_empty_file \
+	gdimagesetpixel/bug00186 \
+	gdimagestringftex/gdimagestringftex_returnfontpathname \
+	gdimageline/gdimageline_aa_outofrange \
+	gdimagerectangle/bug00003 \
+	gdimagerectangle/bug00106_gdimagerectangle \
+	gd/gd_null \
+	gd/gd_num_colors \
+	tga/tga_null \
+	gdimagepixelate/gdimagepixelate \
+	gdimagecopy/bug00007 \
+	gdnewfilectx/gdnewfilectx_null \
+	gdimagefilledrectangle/bug00078 \
+	gdimagefilledrectangle/bug00004 \
+	gdimagefilledrectangle/bug00106_gdimagefilledrectangle \
+	gdimagecolordeallocate/gdimagecolordeallocate \
+	wbmp/wbmp_null \
+	gdimagecolortransparent/gdimagecolortransparent \
+	gif/bug00005_2 \
+	gif/gif_null \
+	gif/bug00181 \
+	gif/bug00227 \
+	bmp/bmp_null
+
+EXTRA_PROGRAMS = \
+	gdimagestringft/gdimagestringft_bbox \
+	gdtiled/bug00032 \
+	gd2/gd2_im2im \
+	gd2/gd2_null \
+	gd2/gd2_read \
+	gdimagearc/bug00079 \
+	gdimageline/gdimageline_aa \
+	gdimageline/bug00072 \
+	gdimageline/bug00077 \
+	gdimageline/bug00111 \
+	gdimageopenpolygon/gdimageopenpolygon2 \
+	gdimageopenpolygon/gdimageopenpolygon1 \
+	gdimageopenpolygon/gdimageopenpolygon0 \
+	gdimageopenpolygon/gdimageopenpolygon3 \
+	gd/gd_im2im \
+	gdimagecopy/bug00081 \
+	gdimagecopyrotated/bug00020 \
+	gdimagepolygon/gdimagepolygon0 \
+	gdimagepolygon/gdimagepolygon3 \
+	gdimagepolygon/gdimagepolygon1 \
+	gdimagepolygon/gdimagepolygon2 \
+	gdimagecolorresolve/gdimagecolorresolve \
+	gdimagefilledpolygon/gdimagefilledpolygon0 \
+	gdimagefilledpolygon/gdimagefilledpolygon3 \
+	gdimagefilledpolygon/gdimagefilledpolygon2 \
+	gdimagefilledpolygon/gdimagefilledpolygon1 \
+	gdimagefilledpolygon/bug00100 \
+	gdimagecolorreplace/gdimagecolorreplace \
+	gdimagefill/bug00002_2 \
+	gdimagefill/bug00002_1 \
+	gdimagefill/bug00002_4 \
+	gdimagefill/bug00002_3 \
+	gdimagecolorclosest/gdimagecolorclosest \
+	gif/bug00005 \
+	gif/gif_im2im \
+	gif/bug00066 \
+	gif/bug00006 \
+	gif/bug00060 \
+	gdimagecolorexact/gdimagecolorexact \
+	gdimagefilledellipse/bug00191 \
+	gdimagefilledellipse/bug00010 \
+	xpm/bug00185 \
+	xpm/color_name \
+	xpm/bug00166 \
+	jpeg/jpeg_empty_file \
+	jpeg/jpeg_resolution \
+	jpeg/jpeg_im2im \
+	jpeg/jpeg_null \
+	jpeg/jpeg_read \
+	png/png_null \
+	png/bug00033 \
+	png/bug00193 \
+	png/bug00011 \
+	png/bug00088 \
+	png/png_resolution \
+	png/bug00086 \
+	png/png_im2im \
+	wbmp/wbmp_im2im \
+	tiff/tiff_null \
+	tiff/tiff_im2im \
+	freetype/bug00132 \
+	bmp/bmp_im2im \
+	gdimagescatterex/bug00208_1 \
+	gdimagescatterex/bug00208_2 \
+	gdimagefilltoborder/bug00037
+
+if HAVE_LIBXPM
+check_PROGRAMS += \
+	xpm/bug00185 \
+	xpm/color_name \
+	xpm/bug00166
+endif
+
+if HAVE_LIBJPEG
+check_PROGRAMS += \
+	jpeg/jpeg_empty_file \
+	jpeg/jpeg_im2im \
+	jpeg/jpeg_null
+if HAVE_LIBPNG
+check_PROGRAMS += \
+	jpeg/jpeg_resolution \
+	jpeg/jpeg_read
+endif
+endif
+
+if HAVE_LIBZ
+check_PROGRAMS += \
+	gd2/gd2_null
+endif
+
+if HAVE_LIBPNG
+if HAVE_LIBZ
+check_PROGRAMS += \
+	gd2/gd2_read \
+	gd2/gd2_im2im \
+	gdtiled/bug00032
+endif
+check_PROGRAMS += \
+	gdimagestringft/gdimagestringft_bbox \
+	gdimagearc/bug00079 \
+	gdimageline/gdimageline_aa \
+	gdimageline/bug00072 \
+	gdimageline/bug00077 \
+	gdimageline/bug00111 \
+	gdimageopenpolygon/gdimageopenpolygon2 \
+	gdimageopenpolygon/gdimageopenpolygon1 \
+	gdimageopenpolygon/gdimageopenpolygon0 \
+	gdimageopenpolygon/gdimageopenpolygon3 \
+	gd/gd_im2im \
+	gdimagecopy/bug00081 \
+	gdimagecopyrotated/bug00020 \
+	gdimagepolygon/gdimagepolygon0 \
+	gdimagepolygon/gdimagepolygon3 \
+	gdimagepolygon/gdimagepolygon1 \
+	gdimagepolygon/gdimagepolygon2 \
+	gdimagecolorresolve/gdimagecolorresolve \
+	gdimagefilledpolygon/gdimagefilledpolygon0 \
+	gdimagefilledpolygon/gdimagefilledpolygon3 \
+	gdimagefilledpolygon/gdimagefilledpolygon2 \
+	gdimagefilledpolygon/gdimagefilledpolygon1 \
+	gdimagefilledpolygon/bug00100 \
+	gdimagecolorreplace/gdimagecolorreplace \
+	gdimagefill/bug00002_2 \
+	gdimagefill/bug00002_1 \
+	gdimagefill/bug00002_4 \
+	gdimagefill/bug00002_3 \
+	gdimagecolorclosest/gdimagecolorclosest \
+	gif/bug00005 \
+	gif/gif_im2im \
+	gif/bug00066 \
+	gif/bug00006 \
+	gif/bug00060 \
+	gdimagecolorexact/gdimagecolorexact \
+	gdimagefilledellipse/bug00191 \
+	gdimagefilledellipse/bug00010 \
+	png/png_null \
+	png/bug00033 \
+	png/bug00193 \
+	png/bug00011 \
+	png/bug00088 \
+	png/png_resolution \
+	png/bug00086 \
+	png/png_im2im \
+	wbmp/wbmp_im2im \
+	bmp/bmp_im2im \
+	gdimagescatterex/bug00208_1 \
+	gdimagescatterex/bug00208_2 \
+	gdimagefilltoborder/bug00037
+endif
+
+if HAVE_LIBTIFF
+check_PROGRAMS += \
+	tiff/tiff_null \
+	tiff/tiff_im2im
+endif
+
+if HAVE_LIBFREETYPE
+check_PROGRAMS +=
+	freetype/bug00132
+endif
+
+LDADD = ../src/libgd.la libgdtest.a
+AM_CPPFLAGS = -I$(top_srcdir)/src -I $(top_srcdir)/tests/gdtest
+
+TESTS = $(check_PROGRAMS)
+
+CLEANFILES = \
+	a.png \
+	bmp_im2im_dst.bmp \
+	bmp_im2im_src.bmp \
+	bug00132.c_35_diff.png \
+	bug00132.c_35_out.png \
+	bug00181.gif \
+	bug00181a.gif \
+	bug00227.gif \
+	gd2_im2im_dst.gd2 \
+	gd2_im2im_src.gd2 \
+	gd_im2im_dst.gd \
+	gd_im2im_src.gd \
+	gdimageline_aa.c_38_diff.png \
+	gdimageline_aa.c_38_out.png \
+	gdimagestringft_bbox.png \
+	gif_im2im_dst.gif \
+	gif_im2im_src.gif \
+	jpeg_im2im_dst.jpeg \
+	jpeg_im2im_src.jpeg \
+	jpeg_read.c_25_diff.png \
+	jpeg_read.c_25_out.png \
+	png_im2im_dst.png \
+	png_im2im_src.png \
+	tiff_im2im_dst.tiff \
+	tiff_im2im_src.tiff \
+	wbmp/wbmp_im2im_dst.wbmp \
+	wbmp/wbmp_im2im_src.wbmp \
+	wbmp_im2im_dst.wbmp \
+	wbmp_im2im_src.wbmp

File tests/gdimagecolorreplace/gdimagecolorreplace.c

View file
 	gdImagePtr im;
 	int error = 0;
 
+	gdSetErrorMethod(gdSilence);
+
 	/* true color */
 	im = gdImageCreateTrueColor(5, 5);
 	run_tests(im, &error);

File tests/gdimagefill/bug00002_1.c

View file
 	FILE *fp;
 	char path[1024];
 
-	fputs("flag 0\n", stdout);
+/*	fputs("flag 0\n", stdout); */
 	im = gdImageCreateTrueColor(100, 100);
 
-	fputs("flag 1\n", stdout);
+/*	fputs("flag 1\n", stdout); */
 	gdImageFill(im, 0, 0, 0xffffff);
-	fputs("flag 2\n", stdout);
+/*	fputs("flag 2\n", stdout); */
 	gdImageFill(im, 0, 0, 0xffffff);
-	fputs("flag 3\n", stdout);
+/*	fputs("flag 3\n", stdout); */
 
 	fp = fopen("a.png", "wb");
 	/* Write img to stdout */

File tests/gdimagefill/bug00002_2.c

View file
 	int x,y, error = 0;
 	char path[1024];
 
-	fputs("flag 0\n", stdout);
+/*	fputs("flag 0\n", stdout); */
 	im = gdImageCreate(150, 150);
 	tile = gdImageCreate(36, 36);
 	gdImageColorAllocate(tile,255,255,255); /* allocate white for background color */
 	gdImageFill(im, 11,12, gdTiled);
 
 
-	fputs("flag 1\n", stdout);
+/*	fputs("flag 1\n", stdout); */
 	gdImageFill(im, 0, 0, 0xffffff);
-	fputs("flag 2\n", stdout);
+/*	fputs("flag 2\n", stdout); */
 	gdImageFill(im, 0, 0, 0xffffff);
-	fputs("flag 2\n", stdout);
+/*	fputs("flag 2\n", stdout); */
 
 
 	sprintf(path, "%s/gdimagefill/bug00002_2_exp.png", GDTEST_TOP_DIR);

File tests/gdimagefill/bug00002_3.c

View file
 	int x,y, error = 0;
 	char path[1024];
 
-	fputs("flag 0\n", stdout);
+/*	fputs("flag 0\n", stdout); */
 	im = gdImageCreate(150, 150);
 
 
 	gdImageFill(im, 11,12, gdTiled);
 
 
-	fputs("flag 1\n", stdout);
+/*	fputs("flag 1\n", stdout); */
 	gdImageFill(im, 0, 0, 0xffffff);
-	fputs("flag 2\n", stdout);
+/*	fputs("flag 2\n", stdout); */
 	gdImageFill(im, 0, 0, 0xffffff);
-	fputs("flag 3\n", stdout);
+/*	fputs("flag 3\n", stdout); */
 
 	sprintf(path, "%s/gdimagefill/bug00002_3_exp.png", GDTEST_TOP_DIR);
 	if (!gdAssertImageEqualsToFile(path, im)) {

File tests/gdtest/gdtest.c

View file
 #include "gdtest.h"
 #include "test_config.h"
 
+void gdSilence(int priority, const char *format, ...)
+{
+	return;
+}
 
 gdImagePtr gdTestImageFromPng(const char *filename)
 {

File tests/gdtest/gdtest.h

View file
 
 #define gdTestErrorMsg(format, ...) _gdTestErrorMsg(__FILE__, __LINE__, format, ## __VA_ARGS__)
 
+void gdSilence(int priority, const char *format, ...);
+
 #endif /* GD_TEST_H */

File tests/gdtiled/bug00032.c

View file
 int main()
 {
 	gdImagePtr im, tile;
+	char path[1024];
+
+	gdSetErrorMethod(gdSilence);
+
+	snprintf(path, 1023, "%s/gdtiled/%s", GDTEST_TOP_DIR, exp_img);
 
 	tile = gdImageCreateTrueColor(10, 10);
 	gdImageFill(tile, 0, 0, 0xFFFFFF);
 	gdImageSetTile(im, tile);
 	gdImageFilledRectangle(im, 10, 10, 49, 49, gdTiled);
 
-	gdAssertImageEqualsToFile(exp_img, im);
+	gdAssertImageEqualsToFile(path, im);
 
 	/* Destroy it */
 	gdImageDestroy(im);

File tests/gif/bug00005_2.c

View file
 int main(void)
 {
 	gdImagePtr im;
-	if ( ( im = gdImageCreateFromGifPtr(8994,
-	                                    (char*) &gifdata[0]) ) != NULL) {
-		fprintf(stderr, "success!\n");
+	if ((im = gdImageCreateFromGifPtr(8994, (char*) &gifdata[0])) != NULL) {
 		gdImageDestroy(im);
 		return 0;
 	} else {
-		fprintf(stderr, "failed!\n");
 		return 1;
 	}
 }

File tests/gif/bug00006.c

View file
 	}
 
 	trans_c_f =gdImageGetTransparent(im);
-	printf("c_f: %i\n", trans_c_f);
 	if (gdTestAssert(trans_c_f == 1)) {
 		r_f = gdImageRed(im, trans_c_f);
 		g_f = gdImageGreen(im, trans_c_f);

File tests/jpeg/jpeg_empty_file.c

View file
 	FILE *fp;
 	char path[1024];
 
+	gdSetErrorMethod(gdSilence);
+
 	sprintf(path, "%s/jpeg/empty.jpeg", GDTEST_TOP_DIR);
 	fp = fopen(path, "rb");
 	if (!fp) {

File tests/png/bug00011.c

View file
 	char path[2048];
 
 	sprintf(path, "%s/png/emptyfile", GDTEST_TOP_DIR);
-	printf("opening %s\n", path);
 	fp = fopen(path, "rb");
 	if (!fp) {
-		printf("failed, cannot open file\n");
+		fprintf(stderr, "failed, cannot open file: %s\n", path);
 		return 1;
 	}
 	im = gdImageCreateFromPng(fp);

File tests/png/bug00033.c

View file
 	FILE *fp;
 	char path[1024];
 
+	gdSetErrorMethod(gdSilence);
+
 	sprintf(path, "%s/png/bug00033.png", GDTEST_TOP_DIR);
 	fp = fopen(path, "rb");
 	if (!fp) {

File tests/png/bug00086.c

View file
 #include <stdio.h>
 #include <stdlib.h>
 #include "gd.h"
+#include "gdtest.h"
 
 static const unsigned char pngdata[93];
 int main(void)
 {
 	gdImagePtr im;
 
+	gdSetErrorMethod(gdSilence);
+
 	if ( ( im = gdImageCreateFromPngPtr(93, (char*) &pngdata[0]) ) == NULL) {
-		fprintf(stderr, "success!\n");
 		return 0;
 	} else {
 		fprintf(stderr, "failed!\n");
         75,71,68,0,255,0,255,0,255,160,189,167,147,0,0,0,9,112,72,89,115,0,0,92,
         70,0,0,92,70,1,20,148,67,65,0,0,0,9,118,112,65,103,0,0,0,120,0,0,0,131,
         0,226,13,249,45
-                                         };
-
+};

File tests/png/bug00193.c

View file
 {
 	gdIOCtxPtr ctx;
 
+	gdSetErrorMethod(gdSilence);
+
 	im = gdImageCreate(100, 100);
 	ctx = (gdIOCtxPtr)gdMalloc(sizeof(gdIOCtx));
 	ctx->putC   = failPutC;

File tests/png/png_null.c

View file
 #include "gd.h"
+#include "gdtest.h"
 
 int main()
 {
 	gdImagePtr im;
 
+	gdSetErrorMethod(gdSilence);
+
 	im = gdImageCreateFromPng(NULL);
 	if (im != NULL) {
 		gdImageDestroy(im);

File tests/test_config.h.in

View file
+/* Define the full path to the top src dir, required to get the path
+ * of each input data */
+#define GDTEST_TOP_DIR "@srcdir@"