summaryrefslogtreecommitdiff
path: root/Build/source/libs/gd/libgd-2.1.0/tests
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/gd/libgd-2.1.0/tests')
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/CMakeLists.txt78
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/Makefile.am360
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/bmp/CMakeLists.txt12
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/bmp/bmp_im2im.c66
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/bmp/bmp_null.c14
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/freetype/CMakeLists.txt10
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/freetype/DejaVuSans.ttfbin0 -> 569008 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/freetype/bug00132.c42
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/freetype/bug00132_exp.pngbin0 -> 217 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gd/CMakeLists.txt13
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gd/crafted_num_colors.gdbin0 -> 1039 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gd/gd_im2im.c66
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gd/gd_null.c14
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gd/gd_num_colors.c24
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gd2/CMakeLists.txt14
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gd2/conv_gd2_exp.gd20
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gd2/conv_test.gd2bin0 -> 423 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gd2/conv_test_exp.pngbin0 -> 87 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gd2/empty.gd20
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gd2/gd2_empty_file.c30
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gd2/gd2_im2im.c66
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gd2/gd2_null.c14
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gd2/gd2_read.c38
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagearc/CMakeLists.txt10
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagearc/bug00079.c25
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagearc/bug00079_exp.pngbin0 -> 2127 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorclosest/CMakeLists.txt10
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorclosest/gdimagecolorclosest.c59
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolordeallocate/CMakeLists.txt10
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolordeallocate/gdimagecolordeallocate.c29
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorexact/CMakeLists.txt10
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorexact/gdimagecolorexact.c64
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorreplace/CMakeLists.txt10
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorreplace/gdimagecolorreplace.c150
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorresolve/CMakeLists.txt10
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorresolve/gdimagecolorresolve.c66
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolortransparent/CMakeLists.txt10
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolortransparent/gdimagecolortransparent.c31
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopy/CMakeLists.txt11
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopy/bug00007.c30
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopy/bug00081.c43
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopy/bug00081_exp.pngbin0 -> 95 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopyrotated/CMakeLists.txt11
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopyrotated/bug00020.c32
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopyrotated/bug00020_exp.pngbin0 -> 402 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/CMakeLists.txt13
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_1.c48
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_1_exp.pngbin0 -> 289 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_2.c50
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_2_exp.pngbin0 -> 393 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_3.c56
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_3_exp.pngbin0 -> 410 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_4.c40
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_4_exp.pngbin0 -> 192 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledellipse/CMakeLists.txt12
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledellipse/bug00010.c21
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledellipse/bug00010_exp.pngbin0 -> 479 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledellipse/bug00191.c21
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledellipse/bug00191.pngbin0 -> 143 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/CMakeLists.txt14
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/bug00100.c157
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/bug00100.pngbin0 -> 2124 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon0.c22
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon0.pngbin0 -> 95 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon1.c31
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon1.pngbin0 -> 95 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon2.c33
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon2.pngbin0 -> 140 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon3.c35
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon3.pngbin0 -> 269 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledrectangle/CMakeLists.txt12
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledrectangle/bug00004.c27
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledrectangle/bug00078.c39
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledrectangle/bug00106_gdimagefilledrectangle.c27
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilltoborder/CMakeLists.txt10
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilltoborder/bug00037.c30
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/CMakeLists.txt14
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/bug00072.c35
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/bug00072_exp.pngbin0 -> 133 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/bug00077.c31
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/bug00077_exp.pngbin0 -> 97 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/bug00111.c35
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/bug00111_exp.pngbin0 -> 79 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdImageAALine_thickness.c28
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdImageAALine_thickness_exp.pngbin0 -> 534 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa.c76
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_a_0_exp.pngbin0 -> 198 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_a_1_exp.pngbin0 -> 202 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_b_0_exp.pngbin0 -> 343 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_b_1_exp.pngbin0 -> 197 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_c_0_exp.pngbin0 -> 200 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_c_1_exp.pngbin0 -> 194 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_d_0_exp.pngbin0 -> 200 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_d_1_exp.pngbin0 -> 216 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_outofrange.c19
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_bug5.c39
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/CMakeLists.txt13
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon0.c22
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon0.pngbin0 -> 95 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon1.c31
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon1.pngbin0 -> 95 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon2.c33
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon2.pngbin0 -> 140 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon3.c35
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon3.pngbin0 -> 237 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagepixelate/CMakeLists.txt10
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagepixelate/gdimagepixelate.c88
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/CMakeLists.txt13
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon0.c22
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon0.pngbin0 -> 95 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon1.c31
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon1.pngbin0 -> 99 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon2.c33
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon2.pngbin0 -> 140 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon3.c35
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon3.pngbin0 -> 271 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagerectangle/CMakeLists.txt11
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagerectangle/bug00003.c23
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagerectangle/bug00106_gdimagerectangle.c28
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067.c67
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_000_exp.pngbin0 -> 30195 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_015_exp.pngbin0 -> 34731 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_030_exp.pngbin0 -> 36734 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_045_exp.pngbin0 -> 36631 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_060_exp.pngbin0 -> 36759 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_075_exp.pngbin0 -> 34775 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_090_exp.pngbin0 -> 30955 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_105_exp.pngbin0 -> 35010 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_120_exp.pngbin0 -> 36899 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_135_exp.pngbin0 -> 37111 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_150_exp.pngbin0 -> 36771 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_165_exp.pngbin0 -> 34593 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_180_exp.pngbin0 -> 30299 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/php_bug_64898.c58
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/php_bug_64898.pngbin0 -> 1191 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/php_bug_64898_exp.pngbin0 -> 6363 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/remirh128.jpgbin0 -> 10619 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagescatterex/CMakeLists.txt11
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagescatterex/bug00208.pngbin0 -> 14179 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagescatterex/bug00208_1.c55
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagescatterex/bug00208_1.pngbin0 -> 22719 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagescatterex/bug00208_2.c57
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagescatterex/bug00208_2.pngbin0 -> 18296 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagesetpixel/CMakeLists.txt10
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagesetpixel/bug00186.c32
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagestringft/CMakeLists.txt10
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagestringft/gdimagestringft_bbox.c81
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagestringftex/CMakeLists.txt10
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdimagestringftex/gdimagestringftex_returnfontpathname.c22
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdnewfilectx/CMakeLists.txt10
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdnewfilectx/gdnewfilectx_null.c7
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdtest/CMakeLists.txt4
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdtest/gdtest.c227
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdtest/gdtest.h44
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdtest/test_config.h.cmake4
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdtiled/CMakeLists.txt10
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdtiled/bug00032.c41
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gdtiled/bug00032_exp.pngbin0 -> 233 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gif/CMakeLists.txt19
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005.c46
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005_0.gifbin0 -> 7332 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005_1.gif4
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005_2.c455
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005_2.gifbin0 -> 65646 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005_2_exp.pngbin0 -> 10515 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005_3.gifbin0 -> 18276 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00006.c67
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00060.c24
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00060.gifbin0 -> 16821 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00066.c30
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00066.gifbin0 -> 25489 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00066_exp.pngbin0 -> 12247 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00181.c93
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00227.c67
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gif/gif_im2im.c66
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/gif/gif_null.c14
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/jpeg/CMakeLists.txt15
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/jpeg/conv_test.jpegbin0 -> 2317 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/jpeg/conv_test_exp.pngbin0 -> 39678 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/jpeg/empty.jpeg0
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/jpeg/jpeg_empty_file.c31
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/jpeg/jpeg_im2im.c70
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/jpeg/jpeg_null.c14
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/jpeg/jpeg_read.c45
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/jpeg/jpeg_resolution.c28
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/png/CMakeLists.txt18
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/png/bug00011.c27
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/png/bug00033.c32
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/png/bug00033.pngbin0 -> 393216 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/png/bug00086.c33
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/png/bug00088.c44
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/png/bug00088_1.pngbin0 -> 1892 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/png/bug00088_1_exp.pngbin0 -> 2791 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/png/bug00088_2.pngbin0 -> 238 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/png/bug00088_2_exp.pngbin0 -> 284 bytes
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/png/bug00193.c43
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/png/emptyfile0
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/png/png_im2im.c66
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/png/png_null.c17
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/png/png_resolution.c30
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/test_config.h.in3
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/tga/CMakeLists.txt11
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/tga/tga_null.c13
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/tiff/CMakeLists.txt12
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/tiff/tiff_im2im.c70
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/tiff/tiff_null.c14
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/wbmp/CMakeLists.txt12
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/wbmp/wbmp_im2im.c64
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/wbmp/wbmp_null.c14
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/xpm/CMakeLists.txt13
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/xpm/bug00166.c29
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/xpm/bug00166.xpm12
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/xpm/bug00185.c25
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/xpm/bug00185.xpm12
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/xpm/bug00185_damaged.xpm11
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/xpm/color_name.c29
-rw-r--r--Build/source/libs/gd/libgd-2.1.0/tests/xpm/color_name.xpm17
217 files changed, 5404 insertions, 0 deletions
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/CMakeLists.txt
new file mode 100644
index 00000000000..5f8706fdb02
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/CMakeLists.txt
@@ -0,0 +1,78 @@
+
+if (BUILD_TEST)
+ SET(DART_TESTING_TIMEOUT 5)
+
+ INCLUDE(Dart)
+
+ set(GDTEST_SOURCE_DIR ${GD_SOURCE_DIR}/tests/gdtest)
+
+ IF (ENABLE_GCOV AND CMAKE_COMPILER_IS_GNUCC)
+ SET(CMAKE_BUILD_TYPE TESTINGGCOV)
+ SET(CMAKE_CXX_FLAGS_TESTINGGCOV "-g3 -O0")
+ SET(CMAKE_C_FLAGS_TESTINGGCOV "-g3 -O0")
+ endif (ENABLE_GCOV AND CMAKE_COMPILER_IS_GNUCC)
+
+ message(STATUS "gd include dir: ${GD_INCLUDE_DIR}" )
+ message(STATUS "gd libs dir: ${GD_LIBS_DIR}" )
+
+ include_directories (BEFORE ${GD_INCLUDE_DIR} "${GDTEST_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_BINARY_DIR}/tests/gdtest")
+
+ SET(TESTS_DIRS
+ gdtest
+ bmp
+ gd
+ gd2
+ gdimagearc
+ gdimagecolorclosest
+ gdimagecolordeallocate
+ gdimagecolorexact
+ gdimagecolorreplace
+ gdimagecolorresolve
+ gdimagecolortransparent
+ gdimagecopy
+ gdimagecopyrotated
+ gdimagefill
+ gdimagefilledellipse
+ gdimagefilledpolygon
+ gdimagefilledrectangle
+ gdimagefilltoborder
+ gdimageline
+ gdimageopenpolygon
+ gdimagepixelate
+ gdimagepolygon
+ gdimagerectangle
+ gdimagerotate
+ gdimagescatterex
+ gdimagesetpixel
+ gdnewfilectx
+ gdtiled
+ gif
+ tga
+ wbmp
+ )
+
+ IF(FREETYPE_FOUND)
+ LIST(APPEND TESTS_DIRS freetype gdimagestringft gdimagestringftex)
+ ENDIF(FREETYPE_FOUND)
+
+ IF(JPEG_FOUND)
+ LIST(APPEND TESTS_DIRS jpeg)
+ ENDIF(JPEG_FOUND)
+
+ IF(PNG_FOUND)
+ LIST(APPEND TESTS_DIRS png)
+ ENDIF(PNG_FOUND)
+
+ IF(TIFF_FOUND)
+ LIST(APPEND TESTS_DIRS tiff)
+ ENDIF(TIFF_FOUND)
+
+ IF(XPM_FOUND)
+ LIST(APPEND TESTS_DIRS xpm)
+ ENDIF(XPM_FOUND)
+
+ FOREACH(test_dir ${TESTS_DIRS})
+ add_subdirectory (${test_dir})
+ ENDFOREACH(test_dir)
+
+endif (BUILD_TEST)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/Makefile.am b/Build/source/libs/gd/libgd-2.1.0/tests/Makefile.am
new file mode 100644
index 00000000000..de63743c850
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/Makefile.am
@@ -0,0 +1,360 @@
+noinst_LIBRARIES = libgdtest.a
+
+libgdtest_a_SOURCES = \
+ gdtest/gdtest.c \
+ gdtest/gdtest.h \
+ ../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 \
+ gdimageline/gdimageline_bug5 \
+ gdimageline/gdImageAALine_thickness \
+ 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 \
+ gdimagerotate/php_bug_64898 \
+ gdimagerotate/bug00067
+
+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 \
+ gdimageline/gdimageline_bug5 \
+ gdimageline/gdImageAALine_thickness \
+ 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 \
+ gdimagerotate/php_bug_64898 \
+ gdimagerotate/bug00067
+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)
+
+EXTRA_DIST = \
+ gdtest/test_config.h.cmake \
+ xpm/bug00166.xpm \
+ xpm/bug00185.xpm \
+ xpm/bug00185_damaged.xpm \
+ xpm/color_name.xpm \
+ gdtiled/bug00032_exp.png \
+ jpeg/conv_test.jpeg \
+ jpeg/conv_test_exp.png \
+ jpeg/empty.jpeg \
+ gd2/conv_test.gd2 \
+ gd2/conv_gd2_exp.gd2 \
+ gd2/empty.gd2 \
+ gd2/conv_test_exp.png \
+ gdimagearc/bug00079_exp.png \
+ png/bug00088_2.png \
+ png/bug00088_1_exp.png \
+ png/bug00033.png \
+ png/bug00088_2_exp.png \
+ png/bug00088_1.png \
+ png/emptyfile \
+ gdimageline/gdimageline_aa_b_0_exp.png \
+ gdimageline/gdimageline_aa_c_0_exp.png \
+ gdimageline/gdimageline_aa_d_1_exp.png \
+ gdimageline/gdimageline_aa_a_1_exp.png \
+ gdimageline/gdimageline_aa_d_0_exp.png \
+ gdimageline/bug00111_exp.png \
+ gdimageline/gdimageline_aa_c_1_exp.png \
+ gdimageline/gdimageline_aa_a_0_exp.png \
+ gdimageline/gdimageline_aa_b_1_exp.png \
+ gdimageline/bug00072_exp.png \
+ gdimageline/bug00077_exp.png \
+ gdimageopenpolygon/gdimageopenpolygon0.png \
+ gdimageopenpolygon/gdimageopenpolygon1.png \
+ gdimageopenpolygon/gdimageopenpolygon2.png \
+ gdimageopenpolygon/gdimageopenpolygon3.png \
+ gd/crafted_num_colors.gd \
+ gdimagecopy/bug00081_exp.png \
+ gdimagecopyrotated/bug00020_exp.png \
+ gdimagepolygon/gdimagepolygon1.png \
+ gdimagepolygon/gdimagepolygon3.png \
+ gdimagepolygon/gdimagepolygon0.png \
+ gdimagepolygon/gdimagepolygon2.png \
+ gdimagefilledpolygon/gdimagefilledpolygon0.png \
+ gdimagefilledpolygon/gdimagefilledpolygon1.png \
+ gdimagefilledpolygon/gdimagefilledpolygon3.png \
+ gdimagefilledpolygon/gdimagefilledpolygon2.png \
+ gdimagefilledpolygon/bug00100.png \
+ gdimagefill/bug00002_3_exp.png \
+ gdimagefill/bug00002_2_exp.png \
+ gdimagefill/bug00002_1_exp.png \
+ gdimagefill/bug00002_4_exp.png \
+ gif/bug00005_0.gif \
+ gif/bug00005_1.gif \
+ gif/bug00005_3.gif \
+ gif/bug00005_2.gif \
+ gif/bug00060.gif \
+ gif/bug00066_exp.png \
+ gif/bug00005_2_exp.png \
+ gif/bug00066.gif \
+ gdimagefilledellipse/bug00191.png \
+ gdimagefilledellipse/bug00010_exp.png \
+ gdimagescatterex/bug00208_2.png \
+ gdimagescatterex/bug00208.png \
+ gdimagescatterex/bug00208_1.png \
+ freetype/bug00132_exp.png \
+ freetype/DejaVuSans.ttf \
+ gdimagestringft/CMakeLists.txt \
+ gdtest/CMakeLists.txt \
+ xpm/CMakeLists.txt \
+ gdtiled/CMakeLists.txt \
+ jpeg/CMakeLists.txt \
+ gd2/CMakeLists.txt \
+ gdimagesetpixel/CMakeLists.txt \
+ gdimagearc/CMakeLists.txt \
+ png/CMakeLists.txt \
+ gdimagestringftex/CMakeLists.txt \
+ gdimageline/CMakeLists.txt \
+ gdimageopenpolygon/CMakeLists.txt \
+ gdimagerectangle/CMakeLists.txt \
+ gd/CMakeLists.txt \
+ tga/CMakeLists.txt \
+ gdimagepixelate/CMakeLists.txt \
+ tiff/CMakeLists.txt \
+ gdimagecopy/CMakeLists.txt \
+ CMakeLists.txt \
+ gdnewfilectx/CMakeLists.txt \
+ gdimagefilledrectangle/CMakeLists.txt \
+ gdimagecopyrotated/CMakeLists.txt \
+ gdimagepolygon/CMakeLists.txt \
+ gdimagecolordeallocate/CMakeLists.txt \
+ wbmp/CMakeLists.txt \
+ gdimagecolorresolve/CMakeLists.txt \
+ gdimagefilledpolygon/CMakeLists.txt \
+ gdimagecolorreplace/CMakeLists.txt \
+ gdimagefill/CMakeLists.txt \
+ gdimagecolorclosest/CMakeLists.txt \
+ gdimagecolortransparent/CMakeLists.txt \
+ gif/CMakeLists.txt \
+ gdimagecolorexact/CMakeLists.txt \
+ gdimagefilledellipse/CMakeLists.txt \
+ bmp/CMakeLists.txt \
+ gdimagescatterex/CMakeLists.txt \
+ gdimagefilltoborder/CMakeLists.txt \
+ freetype/CMakeLists.txt \
+ gdimagerotate/php_bug_64898.png \
+ gdimagerotate/php_bug_64898_exp.png \
+ gdimagerotate/remirh128.jpg \
+ gdimagerotate/bug00067_000_exp.png \
+ gdimagerotate/bug00067_015_exp.png \
+ gdimagerotate/bug00067_030_exp.png \
+ gdimagerotate/bug00067_045_exp.png \
+ gdimagerotate/bug00067_060_exp.png \
+ gdimagerotate/bug00067_075_exp.png \
+ gdimagerotate/bug00067_090_exp.png \
+ gdimagerotate/bug00067_105_exp.png \
+ gdimagerotate/bug00067_120_exp.png \
+ gdimagerotate/bug00067_135_exp.png \
+ gdimagerotate/bug00067_150_exp.png \
+ gdimagerotate/bug00067_165_exp.png \
+ gdimagerotate/bug00067_180_exp.png \
+ gdimageline/gdImageAALine_thickness_exp.png
+
+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
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/bmp/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/bmp/CMakeLists.txt
new file mode 100644
index 00000000000..3e456f7ea02
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/bmp/CMakeLists.txt
@@ -0,0 +1,12 @@
+
+SET(TESTS_FILES
+ bmp_im2im
+ bmp_null
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest ${GD_LIB})
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/bmp/bmp_im2im.c b/Build/source/libs/gd/libgd-2.1.0/tests/bmp/bmp_im2im.c
new file mode 100644
index 00000000000..2beb2db4206
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/bmp/bmp_im2im.c
@@ -0,0 +1,66 @@
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr src, dst;
+ int r, g, b;
+ void *p;
+ int size = 0;
+ int status = 0;
+ CuTestImageResult result = {0, 0};
+
+ src = gdImageCreate(100, 100);
+ if (src == NULL) {
+ printf("could not create src\n");
+ return 1;
+ }
+ r = gdImageColorAllocate(src, 0xFF, 0, 0);
+ g = gdImageColorAllocate(src, 0, 0xFF, 0);
+ b = gdImageColorAllocate(src, 0, 0, 0xFF);
+ gdImageFilledRectangle(src, 0, 0, 99, 99, r);
+ gdImageRectangle(src, 20, 20, 79, 79, g);
+ gdImageEllipse(src, 70, 25, 30, 20, b);
+
+#define OUTPUT_BMP(name) do { \
+ FILE *fp; \
+ \
+ fp = fopen("bmp_im2im_" #name ".bmp", "wb"); \
+ if (fp) { \
+ gdImageBmp(name, fp, 1); \
+ fclose(fp); \
+ } \
+ } while (0)
+
+ OUTPUT_BMP(src);
+ p = gdImageBmpPtr(src, &size, 1);
+ if (p == NULL) {
+ status = 1;
+ printf("p is null\n");
+ goto door0;
+ }
+ if (size <= 0) {
+ status = 1;
+ printf("size is non-positive\n");
+ goto door1;
+ }
+
+ dst = gdImageCreateFromBmpPtr(size, p);
+ if (dst == NULL) {
+ status = 1;
+ printf("could not create dst\n");
+ goto door1;
+ }
+ OUTPUT_BMP(dst);
+ gdTestImageDiff(src, dst, NULL, &result);
+ if (result.pixels_changed > 0) {
+ status = 1;
+ printf("pixels changed: %d\n", result.pixels_changed);
+ }
+ gdImageDestroy(dst);
+door1:
+ gdFree(p);
+door0:
+ gdImageDestroy(src);
+ return status;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/bmp/bmp_null.c b/Build/source/libs/gd/libgd-2.1.0/tests/bmp/bmp_null.c
new file mode 100644
index 00000000000..08ed8377736
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/bmp/bmp_null.c
@@ -0,0 +1,14 @@
+#include "gd.h"
+
+int main()
+{
+ gdImagePtr im;
+
+ im = gdImageCreateFromBmp(NULL);
+ if (im != NULL) {
+ gdImageDestroy(im);
+ return 1;
+ }
+ gdImageBmp(im, NULL, 0); /* noop safely */
+ return 0;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/freetype/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/freetype/CMakeLists.txt
new file mode 100644
index 00000000000..dbc580e140a
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/freetype/CMakeLists.txt
@@ -0,0 +1,10 @@
+SET(TESTS_FILES
+ bug00132
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/freetype/DejaVuSans.ttf b/Build/source/libs/gd/libgd-2.1.0/tests/freetype/DejaVuSans.ttf
new file mode 100644
index 00000000000..3299ee5572f
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/freetype/DejaVuSans.ttf
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/freetype/bug00132.c b/Build/source/libs/gd/libgd-2.1.0/tests/freetype/bug00132.c
new file mode 100644
index 00000000000..88cdfc695a3
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/freetype/bug00132.c
@@ -0,0 +1,42 @@
+/* $Id$ */
+
+#include "gd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "gdtest.h"
+#include "gdfontl.h"
+
+int main()
+{
+ gdImagePtr im;
+ int error = 0;
+ char path[2048];
+ const char *file_exp = "bug00132_exp.png";
+ char *ret = NULL;
+
+ im = gdImageCreateTrueColor(50, 30);
+
+ if (!im) {
+ printf("can't get truecolor image\n");
+ return 1;
+ }
+
+ gdImageAlphaBlending(im, 0);
+ gdImageFilledRectangle(im, 0, 0, 200, 200, gdTrueColorAlpha(0, 0, 0, 127));
+
+ sprintf(path, "%s/freetype/DejaVuSans.ttf", GDTEST_TOP_DIR);
+
+ ret = gdImageStringFT(im, NULL, - 0xFFFFFF, path, 14.0, 0.0, 10, 20, "&thetasym; &theta;");
+ if (ret) {
+ error = 1;
+ printf("%s\n", ret);
+ } else {
+ sprintf(path, "%s/freetype/%s", GDTEST_TOP_DIR, file_exp);
+ if (!gdAssertImageEqualsToFile(path, im)) {
+ error = 1;
+ printf("Reference image and destination differ\n");
+ }
+ }
+ gdImageDestroy(im);
+ return error;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/freetype/bug00132_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/freetype/bug00132_exp.png
new file mode 100644
index 00000000000..c45495e618f
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/freetype/bug00132_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gd/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gd/CMakeLists.txt
new file mode 100644
index 00000000000..a744f6619ac
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gd/CMakeLists.txt
@@ -0,0 +1,13 @@
+
+SET(TESTS_FILES
+ gd_im2im
+ gd_null
+ gd_num_colors
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gd/crafted_num_colors.gd b/Build/source/libs/gd/libgd-2.1.0/tests/gd/crafted_num_colors.gd
new file mode 100644
index 00000000000..45c944cc29f
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gd/crafted_num_colors.gd
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gd/gd_im2im.c b/Build/source/libs/gd/libgd-2.1.0/tests/gd/gd_im2im.c
new file mode 100644
index 00000000000..a7a2226e719
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gd/gd_im2im.c
@@ -0,0 +1,66 @@
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr src, dst;
+ int r, g, b;
+ void *p;
+ int size = 0;
+ int status = 0;
+ CuTestImageResult result = {0, 0};
+
+ src = gdImageCreate(100, 100);
+ if (src == NULL) {
+ printf("could not create src\n");
+ return 1;
+ }
+ r = gdImageColorAllocate(src, 0xFF, 0, 0);
+ g = gdImageColorAllocate(src, 0, 0xFF, 0);
+ b = gdImageColorAllocate(src, 0, 0, 0xFF);
+ gdImageFilledRectangle(src, 0, 0, 99, 99, r);
+ gdImageRectangle(src, 20, 20, 79, 79, g);
+ gdImageEllipse(src, 70, 25, 30, 20, b);
+
+#define OUTPUT_GD(x) do { \
+ FILE *fp; \
+ \
+ fp = fopen("gd_im2im_" #x ".gd", "wb"); \
+ if (fp) { \
+ gdImageGd(x, fp); \
+ fclose(fp); \
+ } \
+ } while (0)
+
+ OUTPUT_GD(src);
+ p = gdImageGdPtr(src, &size);
+ if (p == NULL) {
+ status = 1;
+ printf("p is null\n");
+ goto door0;
+ }
+ if (size <= 0) {
+ status = 1;
+ printf("size is non-positive\n");
+ goto door1;
+ }
+
+ dst = gdImageCreateFromGdPtr(size, p);
+ if (dst == NULL) {
+ status = 1;
+ printf("could not create dst\n");
+ goto door1;
+ }
+ OUTPUT_GD(dst);
+ gdTestImageDiff(src, dst, NULL, &result);
+ if (result.pixels_changed > 0) {
+ status = 1;
+ printf("pixels changed: %d\n", result.pixels_changed);
+ }
+ gdImageDestroy(dst);
+door1:
+ gdFree(p);
+door0:
+ gdImageDestroy(src);
+ return status;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gd/gd_null.c b/Build/source/libs/gd/libgd-2.1.0/tests/gd/gd_null.c
new file mode 100644
index 00000000000..c0594662f1c
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gd/gd_null.c
@@ -0,0 +1,14 @@
+#include "gd.h"
+
+int main()
+{
+ gdImagePtr im;
+
+ im = gdImageCreateFromGd(NULL);
+ if (im != NULL) {
+ gdImageDestroy(im);
+ return 1;
+ }
+ gdImageGd(im, NULL); /* noop safely */
+ return 0;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gd/gd_num_colors.c b/Build/source/libs/gd/libgd-2.1.0/tests/gd/gd_num_colors.c
new file mode 100644
index 00000000000..7d919361925
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gd/gd_num_colors.c
@@ -0,0 +1,24 @@
+#include "gd.h"
+#include <stdio.h>
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ char path[1024];
+ FILE* fp;
+
+ sprintf(path, "%s/gd/crafted_num_colors.gd", GDTEST_TOP_DIR);
+
+ fp = fopen(path, "rb");
+ if (!fp) {
+ return 1;
+ }
+ im = gdImageCreateFromGd(fp);
+ fclose(fp);
+ if (im) {
+ gdImageDestroy(im);
+ return 1;
+ }
+ return 0;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gd2/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gd2/CMakeLists.txt
new file mode 100644
index 00000000000..c9bd5e5876e
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gd2/CMakeLists.txt
@@ -0,0 +1,14 @@
+
+SET(TESTS_FILES
+ gd2_read
+ gd2_empty_file
+ gd2_im2im
+ gd2_null
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gd2/conv_gd2_exp.gd2 b/Build/source/libs/gd/libgd-2.1.0/tests/gd2/conv_gd2_exp.gd2
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gd2/conv_gd2_exp.gd2
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gd2/conv_test.gd2 b/Build/source/libs/gd/libgd-2.1.0/tests/gd2/conv_test.gd2
new file mode 100644
index 00000000000..1c64b46d9ae
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gd2/conv_test.gd2
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gd2/conv_test_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gd2/conv_test_exp.png
new file mode 100644
index 00000000000..b4bc3fad9f4
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gd2/conv_test_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gd2/empty.gd2 b/Build/source/libs/gd/libgd-2.1.0/tests/gd2/empty.gd2
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gd2/empty.gd2
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gd2/gd2_empty_file.c b/Build/source/libs/gd/libgd-2.1.0/tests/gd2/gd2_empty_file.c
new file mode 100644
index 00000000000..289debc541e
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gd2/gd2_empty_file.c
@@ -0,0 +1,30 @@
+/* $Id$ */
+#include "gd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ FILE *fp;
+ char path[1024];
+
+ sprintf(path, "%s/gd2/empty.gd2", GDTEST_TOP_DIR);
+
+ fp = fopen(path, "rb");
+ if (!fp) {
+ printf("failed, cannot open file (%s)\n", path);
+ return 1;
+ }
+
+ im = gdImageCreateFromGd2(fp);
+ fclose(fp);
+
+ if (!im) {
+ return 0;
+ } else {
+ gdImageDestroy(im);
+ return 1;
+ }
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gd2/gd2_im2im.c b/Build/source/libs/gd/libgd-2.1.0/tests/gd2/gd2_im2im.c
new file mode 100644
index 00000000000..7745fa5973e
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gd2/gd2_im2im.c
@@ -0,0 +1,66 @@
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr src, dst;
+ int r, g, b;
+ void *p;
+ int size = 0;
+ int status = 0;
+ CuTestImageResult result = {0, 0};
+
+ src = gdImageCreate(100, 100);
+ if (src == NULL) {
+ printf("could not create src\n");
+ return 1;
+ }
+ r = gdImageColorAllocate(src, 0xFF, 0, 0);
+ g = gdImageColorAllocate(src, 0, 0xFF, 0);
+ b = gdImageColorAllocate(src, 0, 0, 0xFF);
+ gdImageFilledRectangle(src, 0, 0, 99, 99, r);
+ gdImageRectangle(src, 20, 20, 79, 79, g);
+ gdImageEllipse(src, 70, 25, 30, 20, b);
+
+#define OUTPUT_GD2(x) do { \
+ FILE *fp; \
+ \
+ fp = fopen("gd2_im2im_" #x ".gd2", "wb"); \
+ if (fp) { \
+ gdImageGd2(x, fp, (GD2_CHUNKSIZE_MIN+GD2_CHUNKSIZE_MAX)/2, GD2_FMT_COMPRESSED); \
+ fclose(fp); \
+ } \
+ } while (0)
+
+ OUTPUT_GD2(src);
+ p = gdImageGd2Ptr(src, (GD2_CHUNKSIZE_MIN+GD2_CHUNKSIZE_MAX)/2, GD2_FMT_COMPRESSED, &size);
+ if (p == NULL) {
+ status = 1;
+ printf("p is null\n");
+ goto door0;
+ }
+ if (size <= 0) {
+ status = 1;
+ printf("size is non-positive\n");
+ goto door1;
+ }
+
+ dst = gdImageCreateFromGd2Ptr(size, p);
+ if (dst == NULL) {
+ status = 1;
+ printf("could not create dst\n");
+ goto door1;
+ }
+ OUTPUT_GD2(dst);
+ gdTestImageDiff(src, dst, NULL, &result);
+ if (result.pixels_changed > 0) {
+ status = 1;
+ printf("pixels changed: %d\n", result.pixels_changed);
+ }
+ gdImageDestroy(dst);
+door1:
+ gdFree(p);
+door0:
+ gdImageDestroy(src);
+ return status;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gd2/gd2_null.c b/Build/source/libs/gd/libgd-2.1.0/tests/gd2/gd2_null.c
new file mode 100644
index 00000000000..6c8fc96caae
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gd2/gd2_null.c
@@ -0,0 +1,14 @@
+#include "gd.h"
+
+int main()
+{
+ gdImagePtr im;
+
+ im = gdImageCreateFromGd2(NULL);
+ if (im != NULL) {
+ gdImageDestroy(im);
+ return 1;
+ }
+ gdImageGd2(im, NULL, 0, GD2_FMT_RAW); /* noop safely */
+ return 0;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gd2/gd2_read.c b/Build/source/libs/gd/libgd-2.1.0/tests/gd2/gd2_read.c
new file mode 100644
index 00000000000..2e78e9a6d23
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gd2/gd2_read.c
@@ -0,0 +1,38 @@
+/* $Id$ */
+#include "gd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "gdtest.h"
+
+int main()
+{
+ int error;
+ gdImagePtr im;
+ FILE *fp;
+ char path[1024];
+
+ sprintf(path, "%s/gd2/conv_test.gd2", GDTEST_TOP_DIR);
+
+ fp = fopen(path, "rb");
+ if (!fp) {
+ printf("failed, cannot open file\n");
+ return 1;
+ }
+
+ im = gdImageCreateFromGd2(fp);
+ fclose(fp);
+
+ sprintf(path, "%s/gd2/conv_test_exp.png", GDTEST_TOP_DIR);
+ if (!gdAssertImageEqualsToFile(path, im)) {
+ error = 1;
+ gdImageDestroy(im);
+ } else {
+ if (im) {
+ gdImageDestroy(im);
+ error = 0;
+ } else {
+ error = 1;
+ }
+ }
+ return error;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagearc/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagearc/CMakeLists.txt
new file mode 100644
index 00000000000..82cc9b8e1c1
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagearc/CMakeLists.txt
@@ -0,0 +1,10 @@
+SET(TESTS_FILES
+ bug00079
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagearc/bug00079.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagearc/bug00079.c
new file mode 100644
index 00000000000..b2843a74873
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagearc/bug00079.c
@@ -0,0 +1,25 @@
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ int error = 0;
+ char path[1024];
+
+
+ im = gdImageCreateTrueColor(300, 300);
+ gdImageFilledRectangle(im, 0,0, 299,299, 0xFFFFFF);
+
+ gdImageSetAntiAliased(im, 0x000000);
+ gdImageArc(im, 300, 300, 600,600, 0, 360, gdAntiAliased);
+
+ sprintf(path, "%s/gdimagearc/bug00079_exp.png", GDTEST_TOP_DIR);
+ if (!gdAssertImageEqualsToFile(path, im)) {
+ printf("%s failed\n", path);
+ error = 1;
+ }
+
+ gdImageDestroy(im);
+ return error;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagearc/bug00079_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagearc/bug00079_exp.png
new file mode 100644
index 00000000000..1abfbbfbc51
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagearc/bug00079_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorclosest/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorclosest/CMakeLists.txt
new file mode 100644
index 00000000000..1b2f83edc8c
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorclosest/CMakeLists.txt
@@ -0,0 +1,10 @@
+SET(TESTS_FILES
+ gdimagecolorclosest
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorclosest/gdimagecolorclosest.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorclosest/gdimagecolorclosest.c
new file mode 100644
index 00000000000..4754a2c28be
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorclosest/gdimagecolorclosest.c
@@ -0,0 +1,59 @@
+#include <stdio.h>
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ int error = 0;
+ int c, i;
+
+ im = gdImageCreateTrueColor(5, 5);
+ c = gdImageColorClosest(im, 255, 0, 255);
+ gdImageDestroy(im);
+
+ if (gdTestAssert(c==0xFF00FF) != 1) {
+ error = -1;
+ }
+
+ im = gdImageCreate(5, 5);
+ c = gdImageColorClosest(im, 255, 0, 255);
+ if (gdTestAssert(c==-1) != 1) {
+ error = -1;
+ }
+ gdImageDestroy(im);
+
+ im = gdImageCreate(5, 5);
+ c = gdImageColorAllocate(im, 255, 0, 255);
+ c = gdImageColorClosest(im, 255, 0, 255);
+ c = gdTrueColorAlpha(gdImageRed(im, c), gdImageGreen(im, c), gdImageBlue(im, c), 0);
+ gdImageDestroy(im);
+ if (gdTestAssert(c==0xFF00FF) != 1) {
+ error = -1;
+ }
+
+
+ im = gdImageCreate(5, 5);
+ for (i=0; i < 255; i++) {
+ c = gdImageColorAllocate(im, 255, 0, 0);
+ }
+ c = gdImageColorClosest(im, 255, 0, 0);
+ c = gdTrueColorAlpha(gdImageRed(im, c), gdImageGreen(im, c), gdImageBlue(im, c), 0);
+ gdImageDestroy(im);
+ if (gdTestAssert(c==0xFF0000) != 1) {
+ error = -1;
+ }
+
+ im = gdImageCreate(5, 5);
+ for (i=0; i < 256; i++) {
+ c = gdImageColorAllocate(im, 255, 0, 0);
+ }
+ c = gdImageColorClosest(im, 255, 0, 0);
+ c = gdTrueColorAlpha(gdImageRed(im, c), gdImageGreen(im, c), gdImageBlue(im, c), 0);
+ gdImageDestroy(im);
+ if (gdTestAssert(c==0xFF0000) != 1) {
+ error = -1;
+ }
+
+ return error;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolordeallocate/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolordeallocate/CMakeLists.txt
new file mode 100644
index 00000000000..996bd24ca9e
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolordeallocate/CMakeLists.txt
@@ -0,0 +1,10 @@
+SET(TESTS_FILES
+ gdimagecolordeallocate
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolordeallocate/gdimagecolordeallocate.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolordeallocate/gdimagecolordeallocate.c
new file mode 100644
index 00000000000..c671bd323de
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolordeallocate/gdimagecolordeallocate.c
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ int c;
+
+ im = gdImageCreate(1, 1);
+ /* test for deallocating a color */
+ c = gdImageColorAllocate(im, 255, 255, 255);
+ if (c < 0) {
+ gdImageDestroy(im);
+ return 1;
+ }
+ gdImageColorDeallocate(im, c);
+ if (!im->open[c]) {
+ gdImageDestroy(im);
+ return 1;
+ }
+
+ /* just see whether it is OK with out-of-bounds values */
+ gdImageColorDeallocate(im, gdMaxColors);
+ gdImageColorDeallocate(im, -1);
+ gdImageDestroy(im);
+
+ return 0;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorexact/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorexact/CMakeLists.txt
new file mode 100644
index 00000000000..a724d130891
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorexact/CMakeLists.txt
@@ -0,0 +1,10 @@
+SET(TESTS_FILES
+ gdimagecolorexact
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorexact/gdimagecolorexact.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorexact/gdimagecolorexact.c
new file mode 100644
index 00000000000..9d754ca9614
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorexact/gdimagecolorexact.c
@@ -0,0 +1,64 @@
+#include <stdio.h>
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ int error = 0;
+ int c, c1, c2, c3, c4, color;
+
+ im = gdImageCreateTrueColor(5, 5);
+ c = gdImageColorExact(im, 255, 0, 255);
+ c2 = gdImageColorExactAlpha(im, 255, 0, 255, 100);
+ gdImageDestroy(im);
+
+ if (gdTestAssert(c == 0xFF00FF) != 1) {
+ error = -1;
+ }
+ if (gdTestAssert(c2 == 0x64FF00FF) != 1) {
+ error = -1;
+ }
+
+ im = gdImageCreate(5, 5);
+ c1 = gdImageColorAllocate(im, 255, 0, 255);
+ c2 = gdImageColorAllocate(im, 255, 200, 0);
+ c3 = gdImageColorAllocateAlpha(im, 255, 0, 255, 100);
+
+ c1 = gdImageColorExact(im, 255, 0, 255);
+ c2 = gdImageColorExact(im, 255, 200, 0);
+ c3 = gdImageColorExactAlpha(im, 255, 0, 255, 100);
+ c4 = gdImageColorExactAlpha(im, 255, 34, 255, 100);
+
+ if (gdTestAssert(c1 == 0) != 1) {
+ error = -1;
+ }
+ if (gdTestAssert(c2 == 1) != 1) {
+ error = -1;
+ }
+ if (gdTestAssert(c3 == 2) != 1) {
+ error = -1;
+ }
+ if (gdTestAssert(c4 == -1) != 1) {
+ error = -1;
+ }
+
+ color = gdTrueColorAlpha(gdImageRed(im, c1), gdImageGreen(im, c1),
+ gdImageBlue(im, c1), 0);
+ if (gdTestAssert(color == 0xFF00FF) != 1) {
+ error = -1;
+ }
+ color = gdTrueColorAlpha(gdImageRed(im, c2), gdImageGreen(im, c2),
+ gdImageBlue(im, c2), 0);
+ if (gdTestAssert(color == 0xFFC800) != 1) {
+ error = -1;
+ }
+ color = gdTrueColorAlpha(gdImageRed(im, c3), gdImageGreen(im, c3),
+ gdImageBlue(im, c3), 0);
+ if (gdTestAssert(color == 0xFF00FF) != 1) {
+ error = -1;
+ }
+ gdImageDestroy(im);
+
+ return error;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorreplace/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorreplace/CMakeLists.txt
new file mode 100644
index 00000000000..f88a8a07b37
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorreplace/CMakeLists.txt
@@ -0,0 +1,10 @@
+SET(TESTS_FILES
+ gdimagecolorreplace
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorreplace/gdimagecolorreplace.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorreplace/gdimagecolorreplace.c
new file mode 100644
index 00000000000..9694bd4ae5a
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorreplace/gdimagecolorreplace.c
@@ -0,0 +1,150 @@
+#include <stdio.h>
+#include <limits.h>
+#include "gd.h"
+#include "gdtest.h"
+
+static int callback(gdImagePtr im, int src)
+{
+ int r, g, b;
+
+ r = gdImageRed(im, src);
+ g = gdImageGreen(im, src);
+ b = gdImageBlue(im, src);
+ if (b & 0xFF) {
+ return gdImageColorResolve(im, 0x0F & r, 0x0F & g, 0);
+ } else {
+ return -1;
+ }
+}
+
+static void run_tests(gdImagePtr im, int *error)
+{
+ int black, \
+ white, \
+ cosmic_latte, \
+ cream, \
+ ivory, \
+ magnolia, \
+ old_lace, \
+ seashell, \
+ yellow, \
+ c, d;
+ int src[2], dst[2];
+ int n;
+
+#define COLOR(name, r, g, b) name = gdImageColorAllocateAlpha(im, r, g, b, gdAlphaOpaque)
+ COLOR(black, 0, 0, 0);
+ COLOR(white, 0xFF, 0xFF, 0xFF);
+ COLOR(cosmic_latte, 0xFF, 0xF8, 0xE7);
+ COLOR(cream, 0xFF, 0xFD, 0xD0);
+ COLOR(ivory, 0xFF, 0xFF, 0xF0);
+ COLOR(magnolia, 0xF8, 0xF4, 0xFF);
+ COLOR(old_lace, 0xFD, 0xF5, 0xE6);
+ COLOR(seashell, 0xFF, 0xF5, 0xEE);
+ COLOR(yellow, 0xFF, 0xFF, 0);
+#undef COLOR
+
+#define CHECK_VALUE(n, expected) do { \
+ if (gdTestAssert((n) == (expected)) != 1) { \
+ printf("%d is expected, but %d\n", expected, n); \
+ *error = -1; \
+ } \
+ } while (0)
+
+#define CHECK_PIXEL(x, y, expected) do { \
+ gdImageSetClip(im, 0, 0, 4, 4); \
+ c = gdImageGetPixel(im, (x), (y)); \
+ if (gdTestAssert(c == (expected)) != 1) { \
+ printf("%d is expected, but %d\n", expected, c); \
+ *error = -1; \
+ } \
+ } while (0)
+
+ c = gdImageColorAllocate(im, 0xFF, 0, 0xFF);
+ gdImageFilledRectangle(im, 0, 0, 4, 4, white);
+ gdImageFilledRectangle(im, 0, 0, 3, 3, black);
+ n = gdImageColorReplace(im, white, c);
+ CHECK_VALUE(n, 9);
+ CHECK_PIXEL(0, 0, black);
+ CHECK_PIXEL(2, 3, black);
+ CHECK_PIXEL(4, 4, c);
+
+ gdImageSetClip(im, 1, 1, 3, 3);
+ n = gdImageColorReplace(im, black, c);
+ CHECK_VALUE(n, 9);
+ CHECK_PIXEL(0, 0, black);
+ CHECK_PIXEL(2, 3, c);
+
+ src[0] = black;
+ src[1] = c;
+ dst[0] = c;
+ dst[1] = white;
+ gdImageSetClip(im, 0, 0, 4, 4);
+ n = gdImageColorReplaceArray(im, 2, src, dst);
+ CHECK_VALUE(n, 25);
+ CHECK_PIXEL(0, 0, c);
+ CHECK_PIXEL(2, 3, white);
+ CHECK_PIXEL(4, 4, white);
+
+ n = gdImageColorReplaceArray(im, 0, src, dst);
+ CHECK_VALUE(n, 0);
+ n = gdImageColorReplaceArray(im, -1, src, dst);
+ CHECK_VALUE(n, 0);
+ n = gdImageColorReplaceArray(im, INT_MAX, src, dst);
+ CHECK_VALUE(n, -1);
+
+ gdImageSetClip(im, 1, 1, 4, 4);
+ n = gdImageColorReplaceCallback(im, callback);
+ CHECK_VALUE(n, 16);
+ CHECK_PIXEL(0, 0, c);
+ CHECK_PIXEL(0, 4, white);
+ d = gdImageColorExact(im, 0x0F, 0x0F, 0);
+ if (gdTestAssert(d > 0) != 1) {
+ *error = -1;
+ }
+ CHECK_PIXEL(2, 3, d);
+ CHECK_PIXEL(4, 4, d);
+
+#define INITIALIZE_IMAGE() \
+ gdImageSetClip(im, 0, 0, 4, 4); \
+ gdImageFilledRectangle(im, 0, 0, 4, 4, black); \
+ gdImageFilledRectangle(im, 1, 1, 3, 3, white); \
+ gdImageSetPixel(im, 1, 1, cosmic_latte); \
+ gdImageSetPixel(im, 1, 2, cream); \
+ gdImageSetPixel(im, 2, 1, ivory); \
+ gdImageSetPixel(im, 2, 2, magnolia); \
+ gdImageSetPixel(im, 3, 1, old_lace); \
+ gdImageSetPixel(im, 3, 2, seashell)
+
+ INITIALIZE_IMAGE();
+ n = gdImageColorReplaceThreshold(im, white, yellow, 2.0);
+ CHECK_VALUE(n, 9);
+ CHECK_PIXEL(0, 0, black);
+ CHECK_PIXEL(1, 1, yellow);
+ CHECK_PIXEL(2, 2, yellow);
+ CHECK_PIXEL(3, 3, yellow);
+
+#undef INITIALIZE_IMAGE
+#undef CHECK_VALUE
+#undef CHECK_PIXEL
+}
+
+int main()
+{
+ gdImagePtr im;
+ int error = 0;
+
+ gdSetErrorMethod(gdSilence);
+
+ /* true color */
+ im = gdImageCreateTrueColor(5, 5);
+ run_tests(im, &error);
+ gdImageDestroy(im);
+
+ /* palette */
+ im = gdImageCreate(5, 5);
+ run_tests(im, &error);
+ gdImageDestroy(im);
+
+ return error;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorresolve/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorresolve/CMakeLists.txt
new file mode 100644
index 00000000000..2ab9444a6ce
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorresolve/CMakeLists.txt
@@ -0,0 +1,10 @@
+SET(TESTS_FILES
+ gdimagecolorresolve
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorresolve/gdimagecolorresolve.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorresolve/gdimagecolorresolve.c
new file mode 100644
index 00000000000..1a0d6884e7e
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolorresolve/gdimagecolorresolve.c
@@ -0,0 +1,66 @@
+#include <stdio.h>
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ int error = 0;
+ int c, c1, c2, c3, c4, color;
+
+ im = gdImageCreateTrueColor(5, 5);
+ c = gdImageColorResolve(im, 255, 0, 255);
+ c2 = gdImageColorResolveAlpha(im, 255, 0, 255, 100);
+ gdImageDestroy(im);
+
+ if (gdTestAssert(c == 0xFF00FF) != 1) {
+ error = -1;
+ }
+ if (gdTestAssert(c2 == 0x64FF00FF) != 1) {
+ error = -1;
+ }
+
+ im = gdImageCreate(5, 5);
+
+ c1 = gdImageColorResolve(im, 255, 0, 255);
+ c2 = gdImageColorResolve(im, 255, 200, 0);
+ c3 = gdImageColorResolveAlpha(im, 255, 0, 255, 100);
+ c4 = gdImageColorResolveAlpha(im, 255, 34, 255, 100);
+
+ if (gdTestAssert(c1 == 0) != 1) {
+ error = -1;
+ }
+ if (gdTestAssert(c2 == 1) != 1) {
+ error = -1;
+ }
+ if (gdTestAssert(c3 == 2) != 1) {
+ error = -1;
+ }
+ if (gdTestAssert(c4 == 3) != 1) {
+ error = -1;
+ }
+
+ color = gdTrueColorAlpha(gdImageRed(im, c1), gdImageGreen(im, c1),
+ gdImageBlue(im, c1), 0);
+ if (gdTestAssert(color == 0xFF00FF) != 1) {
+ error = -1;
+ }
+ color = gdTrueColorAlpha(gdImageRed(im, c2), gdImageGreen(im, c2),
+ gdImageBlue(im, c2), 0);
+ if (gdTestAssert(color == 0xFFC800) != 1) {
+ error = -1;
+ }
+ color = gdTrueColorAlpha(gdImageRed(im, c3), gdImageGreen(im, c3),
+ gdImageBlue(im, c3), 0);
+ if (gdTestAssert(color == 0xFF00FF) != 1) {
+ error = -1;
+ }
+ color = gdTrueColorAlpha(gdImageRed(im, c4), gdImageGreen(im, c4),
+ gdImageBlue(im, c4), 0);
+ if (gdTestAssert(color == 0xFF22FF) != 1) {
+ error = -1;
+ }
+ gdImageDestroy(im);
+
+ return error;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolortransparent/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolortransparent/CMakeLists.txt
new file mode 100644
index 00000000000..9e6c82f0a09
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolortransparent/CMakeLists.txt
@@ -0,0 +1,10 @@
+SET(TESTS_FILES
+ gdimagecolortransparent
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolortransparent/gdimagecolortransparent.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolortransparent/gdimagecolortransparent.c
new file mode 100644
index 00000000000..aca380b2c6f
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecolortransparent/gdimagecolortransparent.c
@@ -0,0 +1,31 @@
+#include "gd.h"
+#include <stdio.h>
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ int error = 0, pos;
+
+ pos = gdMaxColors;
+
+ im = gdImageCreate(1,1);
+
+ gdImageColorTransparent(im, pos);
+
+ if(im->transparent == pos) {
+ error = -1;
+ }
+
+ pos = -2;
+
+ gdImageColorTransparent(im, pos);
+
+ if(im->transparent == pos) {
+ error = -1;
+ }
+
+ gdImageDestroy(im);
+
+ return error;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopy/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopy/CMakeLists.txt
new file mode 100644
index 00000000000..209257aab63
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopy/CMakeLists.txt
@@ -0,0 +1,11 @@
+SET(TESTS_FILES
+ bug00007
+ bug00081
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopy/bug00007.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopy/bug00007.c
new file mode 100644
index 00000000000..f3106f3a2f4
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopy/bug00007.c
@@ -0,0 +1,30 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "gd.h"
+
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr dst_tc, src;
+ int c1;
+
+ src = gdImageCreate(5,5);
+ gdImageAlphaBlending(src, 0);
+
+ gdImageColorAllocate(src, 255,255,255); /* allocate white for background color */
+ c1 = gdImageColorAllocateAlpha(src, 255,0,0,70);
+
+ gdImageFilledRectangle(src, 0,0, 4,4, c1);
+
+ dst_tc = gdImageCreateTrueColor(5,5);
+ gdImageAlphaBlending(dst_tc, 0);
+ gdImageCopy(dst_tc, src, 0,0, 0,0, gdImageSX(src), gdImageSY(src));
+
+ /* CuAssertImageEquals(tc, src, dst_tc); */
+
+ /* Destroy it */
+ gdImageDestroy(dst_tc);
+ gdImageDestroy(src);
+ return 0;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopy/bug00081.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopy/bug00081.c
new file mode 100644
index 00000000000..0e28f4ca409
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopy/bug00081.c
@@ -0,0 +1,43 @@
+/* $Id$ */
+
+#include "gd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im, im2;
+ int error = 0;
+ char path[2048];
+ const char *file_exp = "bug00081_exp.png";
+
+ im = gdImageCreateTrueColor(5, 5);
+ if (!im) {
+ printf("can't create the src truecolor image\n");
+ return 1;
+ }
+
+ gdImageFilledRectangle(im, 0, 0, 49, 49, 0x00FFFFFF);
+ gdImageColorTransparent(im, 0xFFFFFF);
+ gdImageFilledRectangle(im, 1, 1, 4, 4, 0xFF00FF);
+
+ im2 = gdImageCreateTrueColor(20, 20);
+ if (!im2) {
+ printf("can't create the dst truecolor image\n");
+ gdImageDestroy(im);
+ return 1;
+ }
+
+ gdImageCopy(im2, im, 2, 2 , 0, 0, gdImageSX(im), gdImageSY(im));
+
+ sprintf(path, "%s/gdimagecopy/%s", GDTEST_TOP_DIR, file_exp);
+ if (!gdAssertImageEqualsToFile(path, im2)) {
+ error = 1;
+ printf("Reference image and destination differ\n");
+ }
+
+ gdImageDestroy(im);
+ gdImageDestroy(im2);
+ return error;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopy/bug00081_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopy/bug00081_exp.png
new file mode 100644
index 00000000000..c5587f78a40
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopy/bug00081_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopyrotated/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopyrotated/CMakeLists.txt
new file mode 100644
index 00000000000..4a0e08346d9
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopyrotated/CMakeLists.txt
@@ -0,0 +1,11 @@
+
+SET(TESTS_FILES
+ bug00020
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopyrotated/bug00020.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopyrotated/bug00020.c
new file mode 100644
index 00000000000..f1c2467fc47
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopyrotated/bug00020.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+#include "gd.h"
+#include "gdtest.h"
+
+#define width 50
+
+int main()
+{
+ gdImagePtr im, im2;
+ int error = 0;
+ char path[1024];
+
+ sprintf(path, "%s/gdimagecopyrotated/bug00020_exp.png", GDTEST_TOP_DIR);
+
+ im = gdImageCreateTrueColor(width, width);
+ gdImageFilledRectangle(im, 0,0, width, width, 0xFF0000);
+ gdImageColorTransparent(im, 0xFF0000);
+ gdImageFilledEllipse(im, width/2, width/2, width - 20, width - 10,
+ 0x50FFFFFF);
+
+ im2 = gdImageCreateTrueColor(width, width);
+
+ gdImageCopyRotated(im2, im, width / 2, width / 2, 0,0, width, width, 60);
+
+ if (!gdAssertImageEqualsToFile(path, im2)) {
+ error = 1;
+ }
+
+ gdImageDestroy(im2);
+ gdImageDestroy(im);
+ return error;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopyrotated/bug00020_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopyrotated/bug00020_exp.png
new file mode 100644
index 00000000000..f0a9c161b14
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagecopyrotated/bug00020_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/CMakeLists.txt
new file mode 100644
index 00000000000..c0fe79914b6
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/CMakeLists.txt
@@ -0,0 +1,13 @@
+
+SET(TESTS_FILES
+ bug00002_1
+ bug00002_2
+ bug00002_3
+ bug00002_4
+)
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_1.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_1.c
new file mode 100644
index 00000000000..2a440f20ede
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_1.c
@@ -0,0 +1,48 @@
+#include "gd.h"
+#include <stdio.h>
+#include "gdtest.h"
+
+#define TMP_FN "bug00002_1.png"
+
+int main()
+{
+ gdImagePtr im;
+ FILE *fp;
+ char path[1024];
+
+ im = gdImageCreateTrueColor(100, 100);
+
+ if (im == NULL) {
+ gdTestErrorMsg("Cannot create image.\n");
+ return 1;
+ }
+
+ gdImageFill(im, 0, 0, 0xffffff);
+ gdImageFill(im, 0, 0, 0xffffff);
+
+ fp = fopen(TMP_FN, "wb");
+ if (fp == NULL) {
+ gdTestErrorMsg("Cannot create image from <%s>\n", TMP_FN);
+ gdImageDestroy(im);
+ return 1;
+ }
+
+ gdImagePng(im,fp);
+ fclose(fp);
+
+ sprintf(path, "%s/gdimagefill/bug00002_1_exp.png", GDTEST_TOP_DIR);
+ if (!gdAssertImageEqualsToFile(path, im)) {
+ gdImageDestroy(im);
+ return 1;
+ }
+
+ gdImageDestroy(im);
+
+ if (remove(TMP_FN) == -1) {
+ gdTestErrorMsg("Cannot remove temporary file: <%s>\n", TMP_FN);
+ return 1;
+ }
+
+ return 0;
+}
+
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_1_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_1_exp.png
new file mode 100644
index 00000000000..a5435f278bc
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_1_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_2.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_2.c
new file mode 100644
index 00000000000..06cf8311195
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_2.c
@@ -0,0 +1,50 @@
+#include "gd.h"
+#include <stdio.h>
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im, tile;
+ int im_black, tile_black;
+ int x,y, error = 0;
+ char path[1024];
+
+/* fputs("flag 0\n", stdout); */
+ im = gdImageCreate(150, 150);
+ tile = gdImageCreate(36, 36);
+ gdImageColorAllocate(tile,255,255,255); /* allocate white for background color */
+ tile_black = gdImageColorAllocate(tile,0,0,0);
+ gdImageColorAllocate(im,255,255,255); /* allocate white for background color */
+ im_black = gdImageColorAllocate(im,0,0,0);
+
+
+ /* create the dots pattern */
+ for (x=0; x<36; x+=2) {
+ for (y=0; y<36; y+=2) {
+ gdImageSetPixel(tile,x,y,tile_black);
+ }
+ }
+
+ gdImageSetTile(im,tile);
+ gdImageRectangle(im, 9,9,139,139, im_black);
+ gdImageLine(im, 9,9,139,139, im_black);
+ gdImageFill(im, 11,12, gdTiled);
+
+
+/* fputs("flag 1\n", stdout); */
+ gdImageFill(im, 0, 0, 0xffffff);
+/* fputs("flag 2\n", stdout); */
+ gdImageFill(im, 0, 0, 0xffffff);
+/* fputs("flag 2\n", stdout); */
+
+
+ sprintf(path, "%s/gdimagefill/bug00002_2_exp.png", GDTEST_TOP_DIR);
+ if (!gdAssertImageEqualsToFile(path, im)) {
+ error = 1;
+ }
+
+ /* Destroy it */
+ gdImageDestroy(im);
+ return error;
+}
+
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_2_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_2_exp.png
new file mode 100644
index 00000000000..2a3f0fb2c65
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_2_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_3.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_3.c
new file mode 100644
index 00000000000..454d5be3612
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_3.c
@@ -0,0 +1,56 @@
+/* $Id$ */
+#include "gd.h"
+#include <stdio.h>
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im, tile;
+ int im_black, tile_white, tile_black;
+ int x,y, error = 0;
+ char path[1024];
+
+/* fputs("flag 0\n", stdout); */
+ im = gdImageCreate(150, 150);
+
+
+ tile = gdImageCreateTrueColor(36, 36);
+
+ tile_white = gdImageColorAllocate(tile,255,255,255);
+ tile_black = gdImageColorAllocate(tile,55,0,0);
+ gdImageColorAllocate(im,255,255,255); /* allocate white for background color */
+ im_black = gdImageColorAllocate(im,0,0,0);
+
+ gdImageFill(tile, 0,0, tile_white);
+ gdImageColorTransparent(tile, tile_black);
+ gdImageColorTransparent(im, im_black);
+
+ /* create the dots pattern */
+ for (x=0; x<36; x+=2) {
+ for (y=0; y<36; y+=2) {
+ gdImageSetPixel(tile,x,y,tile_black);
+ }
+ }
+
+ gdImageSetTile(im,tile);
+ gdImageRectangle(im, 9,9,139,139, im_black);
+ gdImageLine(im, 9,9,139,139, im_black);
+ gdImageFill(im, 11,12, gdTiled);
+
+
+/* fputs("flag 1\n", stdout); */
+ gdImageFill(im, 0, 0, 0xffffff);
+/* fputs("flag 2\n", stdout); */
+ gdImageFill(im, 0, 0, 0xffffff);
+/* fputs("flag 3\n", stdout); */
+
+ sprintf(path, "%s/gdimagefill/bug00002_3_exp.png", GDTEST_TOP_DIR);
+ if (!gdAssertImageEqualsToFile(path, im)) {
+ error = 1;
+ }
+
+ /* Destroy it */
+ gdImageDestroy(im);
+ return error;
+}
+
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_3_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_3_exp.png
new file mode 100644
index 00000000000..b8b7a2b319d
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_3_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_4.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_4.c
new file mode 100644
index 00000000000..4b11d84bdc9
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_4.c
@@ -0,0 +1,40 @@
+/*ImageFill Pattern fill */
+
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ int red, blue, white, black, error = 0;
+ char path[1024];
+
+ im = gdImageCreate(50,100);
+ red = gdImageColorAllocate(im, 255, 0, 0);
+ blue = gdImageColorAllocate(im, 0,0,255);
+ white = gdImageColorAllocate(im, 255,255,255);
+ black = gdImageColorAllocate(im, 0,0,0);
+ gdImageFill(im, 0,0, black);
+
+ gdImageLine(im, 20,20,180,20, white);
+ gdImageLine(im, 20,20,20,70, blue);
+ gdImageLine(im, 20,70,180,70, red);
+ gdImageLine(im, 180,20,180,45, white);
+ gdImageLine(im, 180,70,180,45, red);
+ gdImageLine(im, 20,20,100,45, blue);
+ gdImageLine(im, 20,70,100,45, blue);
+ gdImageLine(im, 100,45,180,45, red);
+
+ gdImageFill(im, 21,45, blue);
+ gdImageFill(im, 100,69, red);
+ gdImageFill(im, 100,21, white);
+
+ sprintf(path, "%s/gdimagefill/bug00002_4_exp.png", GDTEST_TOP_DIR);
+ if (!gdAssertImageEqualsToFile(path, im)) {
+ error = 1;
+ }
+
+ /* Destroy it */
+ gdImageDestroy(im);
+ return error;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_4_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_4_exp.png
new file mode 100644
index 00000000000..d751a74d7a0
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefill/bug00002_4_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledellipse/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledellipse/CMakeLists.txt
new file mode 100644
index 00000000000..8d047e787d7
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledellipse/CMakeLists.txt
@@ -0,0 +1,12 @@
+
+SET(TESTS_FILES
+ bug00010
+ bug00191
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledellipse/bug00010.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledellipse/bug00010.c
new file mode 100644
index 00000000000..df0c66dbc64
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledellipse/bug00010.c
@@ -0,0 +1,21 @@
+/* $Id$ */
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ int error = 0;
+ char path[1024];
+
+ im = gdImageCreateTrueColor(100,100);
+ gdImageFilledEllipse(im, 50,50, 70, 90, 0x50FFFFFF);
+
+ sprintf(path, "%s/gdimagefilledellipse/bug00010_exp.png", GDTEST_TOP_DIR);
+ if (!gdAssertImageEqualsToFile(path, im)) {
+ error = 1;
+ }
+
+ gdImageDestroy(im);
+ return error;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledellipse/bug00010_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledellipse/bug00010_exp.png
new file mode 100644
index 00000000000..871ca671987
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledellipse/bug00010_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledellipse/bug00191.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledellipse/bug00191.c
new file mode 100644
index 00000000000..7db64151726
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledellipse/bug00191.c
@@ -0,0 +1,21 @@
+/* $Id$ */
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ int error = 0;
+ char path[1024];
+
+ im = gdImageCreate(100, 100);
+ (void)gdImageColorAllocate(im, 255, 255, 255);
+ gdImageSetThickness(im, 20);
+ gdImageFilledEllipse(im, 30, 50, 20, 20, gdImageColorAllocate(im, 0, 0, 0));
+ sprintf(path, "%s/gdimagefilledellipse/bug00191.png", GDTEST_TOP_DIR);
+ if (!gdAssertImageEqualsToFile(path, im)) {
+ error = 1;
+ }
+ gdImageDestroy(im);
+ return error;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledellipse/bug00191.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledellipse/bug00191.png
new file mode 100644
index 00000000000..dbb7439e2b5
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledellipse/bug00191.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/CMakeLists.txt
new file mode 100644
index 00000000000..be8ab7c4aa3
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/CMakeLists.txt
@@ -0,0 +1,14 @@
+SET(TESTS_FILES
+ gdimagefilledpolygon0
+ gdimagefilledpolygon1
+ gdimagefilledpolygon2
+ gdimagefilledpolygon3
+ bug00100
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/bug00100.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/bug00100.c
new file mode 100644
index 00000000000..ae2e084fe41
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/bug00100.c
@@ -0,0 +1,157 @@
+#include <stdlib.h>
+#include "gd.h"
+#include "gdtest.h"
+
+/* This is a quickie test program to show a bug in gd.
+ * There is a red line that is drawn across the bottom of
+ * the image that shouldn't be there.
+ */
+int
+main(void)
+{
+ gdPoint pointy[5];
+ gdPoint diamond[4];
+ int d, x, y, top, bot, left, right, r;
+
+ /* R G B */
+ int white = gdTrueColorAlpha(255, 255, 255, 10);
+ int black = gdTrueColorAlpha( 0, 0, 0, 10);
+ int red = gdTrueColorAlpha(255, 0, 0, 10);
+ int green = gdTrueColorAlpha( 0, 255, 0, 10);
+ int blue = gdTrueColorAlpha( 0, 0, 255, 10);
+ int yellow = gdTrueColorAlpha(255, 255, 0, 10);
+ int cyan = gdTrueColorAlpha( 0, 255, 255, 10);
+ int magenta = gdTrueColorAlpha(255, 0, 255, 10);
+ int purple = gdTrueColorAlpha(100, 0, 100, 10);
+
+ gdImagePtr im = gdImageCreateTrueColor(256, 256);
+ if (!im) exit(EXIT_FAILURE);
+
+ gdImageFilledRectangle(im, 0, 0, 256, 256, white);
+
+ /* M (bridge) */
+ top = 240;
+ bot = 255;
+ d = 30;
+ x = 100;
+ pointy[0].x = x;
+ pointy[0].y = top;
+ pointy[1].x = x+2*d;
+ pointy[1].y = top;
+ pointy[2].x = x+2*d;
+ pointy[2].y = bot;
+ pointy[3].x = x+d;
+ pointy[3].y = (top+bot)/2;
+ pointy[4].x = x;
+ pointy[4].y = bot;
+ gdImageFilledPolygon(im, pointy, 5, yellow);
+
+ /* left-facing M not on baseline */
+ top = 40;
+ bot = 70;
+ left = 120;
+ right = 180;
+ pointy[0].x = left;
+ pointy[0].y = top;
+ pointy[1].x = right;
+ pointy[1].y = top;
+ pointy[2].x = right;
+ pointy[2].y = bot;
+ pointy[3].x = left;
+ pointy[3].y = bot;
+ pointy[4].x = (left+right)/2;
+ pointy[4].y = (top+bot)/2;
+ gdImageFilledPolygon(im, pointy, 5, purple);
+
+ /* left-facing M on baseline */
+ top = 240;
+ bot = 270;
+ left = 20;
+ right = 80;
+ pointy[0].x = left;
+ pointy[0].y = top;
+ pointy[1].x = right;
+ pointy[1].y = top;
+ pointy[2].x = right;
+ pointy[2].y = bot;
+ pointy[3].x = left;
+ pointy[3].y = bot;
+ pointy[4].x = (left+right)/2;
+ pointy[4].y = (top+bot)/2;
+ gdImageFilledPolygon(im, pointy, 5, magenta);
+
+ /* left-facing M on ceiling */
+ top = -15;
+ bot = 15;
+ left = 20;
+ right = 80;
+ pointy[0].x = left;
+ pointy[0].y = top;
+ pointy[1].x = right;
+ pointy[1].y = top;
+ pointy[2].x = right;
+ pointy[2].y = bot;
+ pointy[3].x = left;
+ pointy[3].y = bot;
+ pointy[4].x = (left+right)/2;
+ pointy[4].y = (top+bot)/2;
+ gdImageFilledPolygon(im, pointy, 5, blue);
+
+ d = 30;
+ x = 150;
+ y = 150;
+ diamond[0].x = x-d;
+ diamond[0].y = y;
+ diamond[1].x = x;
+ diamond[1].y = y+d;
+ diamond[2].x = x+d;
+ diamond[2].y = y;
+ diamond[3].x = x;
+ diamond[3].y = y-d;
+ gdImageFilledPolygon(im, diamond, 4, green);
+
+ x = 180;
+ y = 225;
+ diamond[0].x = x-d;
+ diamond[0].y = y;
+ diamond[1].x = x;
+ diamond[1].y = y+d;
+ diamond[2].x = x+d;
+ diamond[2].y = y;
+ diamond[3].x = x;
+ diamond[3].y = y-d;
+ gdImageFilledPolygon(im, diamond, 4, red);
+
+ x = 225;
+ y = 255;
+ diamond[0].x = x-d;
+ diamond[0].y = y;
+ diamond[1].x = x;
+ diamond[1].y = y+d;
+ diamond[2].x = x+d;
+ diamond[2].y = y;
+ diamond[3].x = x;
+ diamond[3].y = y-d;
+ gdImageFilledPolygon(im, diamond, 4, cyan);
+
+ /* M (bridge) not touching bottom boundary */
+ top = 100;
+ bot = 150;
+ x = 30;
+ pointy[0].x = x;
+ pointy[0].y = top;
+ pointy[1].x = x+2*d;
+ pointy[1].y = top;
+ pointy[2].x = x+2*d;
+ pointy[2].y = bot;
+ pointy[3].x = x+d;
+ pointy[3].y = (top+bot)/2;
+ pointy[4].x = x;
+ pointy[4].y = bot;
+ gdImageFilledPolygon(im, pointy, 5, black);
+
+ r = gdAssertImageEqualsToFile(GDTEST_TOP_DIR "/gdimagefilledpolygon/bug00100.png", im);
+ gdImageDestroy(im);
+ if (!r) exit(EXIT_FAILURE);
+ return EXIT_SUCCESS;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/bug00100.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/bug00100.png
new file mode 100644
index 00000000000..439224e2334
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/bug00100.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon0.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon0.c
new file mode 100644
index 00000000000..5ca877c630c
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon0.c
@@ -0,0 +1,22 @@
+#include <stdlib.h>
+#include "gd.h"
+#include "gdtest.h"
+
+int
+main(void)
+{
+ gdImagePtr im;
+ int white, black, r;
+
+ im = gdImageCreate(100, 100);
+ if (!im) exit(EXIT_FAILURE);
+ white = gdImageColorAllocate(im, 0xff, 0xff, 0xff);
+ black = gdImageColorAllocate(im, 0, 0, 0);
+ gdImageFilledRectangle(im, 0, 0, 99, 99, white);
+ gdImageFilledPolygon(im, NULL, 0, black); /* no effect */
+ gdImageFilledPolygon(im, NULL, -1, black); /* no effect */
+ r = gdAssertImageEqualsToFile(GDTEST_TOP_DIR "/gdimagefilledpolygon/gdimagefilledpolygon0.png", im);
+ gdImageDestroy(im);
+ if (!r) exit(EXIT_FAILURE);
+ return EXIT_SUCCESS;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon0.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon0.png
new file mode 100644
index 00000000000..14c7090a415
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon0.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon1.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon1.c
new file mode 100644
index 00000000000..950035e2b4b
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon1.c
@@ -0,0 +1,31 @@
+#include <stdlib.h>
+#include "gd.h"
+#include "gdhelpers.h"
+#include "gdtest.h"
+
+int
+main(void)
+{
+ gdImagePtr im;
+ int white, black, r;
+ gdPointPtr points;
+
+ im = gdImageCreate(100, 100);
+ if (!im) exit(EXIT_FAILURE);
+ white = gdImageColorAllocate(im, 0xff, 0xff, 0xff);
+ black = gdImageColorAllocate(im, 0, 0, 0);
+ gdImageFilledRectangle(im, 0, 0, 99, 99, white);
+ points = (gdPointPtr)calloc(3, sizeof(gdPoint));
+ if (!points) {
+ gdImageDestroy(im);
+ exit(EXIT_FAILURE);
+ }
+ points[0].x = 10;
+ points[0].y = 10;
+ gdImageFilledPolygon(im, points, 1, black);
+ r = gdAssertImageEqualsToFile(GDTEST_TOP_DIR "/gdimagefilledpolygon/gdimagefilledpolygon1.png", im);
+ free(points);
+ gdImageDestroy(im);
+ if (!r) exit(EXIT_FAILURE);
+ return EXIT_SUCCESS;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon1.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon1.png
new file mode 100644
index 00000000000..14c7090a415
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon1.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon2.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon2.c
new file mode 100644
index 00000000000..628665a1919
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon2.c
@@ -0,0 +1,33 @@
+#include <stdlib.h>
+#include "gd.h"
+#include "gdhelpers.h"
+#include "gdtest.h"
+
+int
+main(void)
+{
+ gdImagePtr im;
+ int white, black, r;
+ gdPointPtr points;
+
+ im = gdImageCreate(100, 100);
+ if (!im) exit(EXIT_FAILURE);
+ white = gdImageColorAllocate(im, 0xff, 0xff, 0xff);
+ black = gdImageColorAllocate(im, 0, 0, 0);
+ gdImageFilledRectangle(im, 0, 0, 99, 99, white);
+ points = (gdPointPtr)calloc(3, sizeof(gdPoint));
+ if (!points) {
+ gdImageDestroy(im);
+ exit(EXIT_FAILURE);
+ }
+ points[0].x = 10;
+ points[0].y = 10;
+ points[1].x = 50;
+ points[1].y = 70;
+ gdImageFilledPolygon(im, points, 2, black);
+ r = gdAssertImageEqualsToFile(GDTEST_TOP_DIR "/gdimagefilledpolygon/gdimagefilledpolygon2.png", im);
+ free(points);
+ gdImageDestroy(im);
+ if (!r) exit(EXIT_FAILURE);
+ return EXIT_SUCCESS;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon2.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon2.png
new file mode 100644
index 00000000000..80f91a2814b
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon2.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon3.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon3.c
new file mode 100644
index 00000000000..0db5c8519e1
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon3.c
@@ -0,0 +1,35 @@
+#include <stdlib.h>
+#include "gd.h"
+#include "gdhelpers.h"
+#include "gdtest.h"
+
+int
+main(void)
+{
+ gdImagePtr im;
+ int white, black, r;
+ gdPointPtr points;
+
+ im = gdImageCreate(100, 100);
+ if (!im) exit(EXIT_FAILURE);
+ white = gdImageColorAllocate(im, 0xff, 0xff, 0xff);
+ black = gdImageColorAllocate(im, 0, 0, 0);
+ gdImageFilledRectangle(im, 0, 0, 99, 99, white);
+ points = (gdPointPtr)calloc(3, sizeof(gdPoint));
+ if (!points) {
+ gdImageDestroy(im);
+ exit(EXIT_FAILURE);
+ }
+ points[0].x = 10;
+ points[0].y = 10;
+ points[1].x = 50;
+ points[1].y = 70;
+ points[2].x = 90;
+ points[2].y = 30;
+ gdImageFilledPolygon(im, points, 3, black);
+ r = gdAssertImageEqualsToFile(GDTEST_TOP_DIR "/gdimagefilledpolygon/gdimagefilledpolygon3.png", im);
+ free(points);
+ gdImageDestroy(im);
+ if (!r) exit(EXIT_FAILURE);
+ return EXIT_SUCCESS;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon3.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon3.png
new file mode 100644
index 00000000000..72311d83a29
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledpolygon/gdimagefilledpolygon3.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledrectangle/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledrectangle/CMakeLists.txt
new file mode 100644
index 00000000000..9a82b99ea01
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledrectangle/CMakeLists.txt
@@ -0,0 +1,12 @@
+SET(TESTS_FILES
+ bug00004
+ bug00078
+ bug00106_gdimagefilledrectangle
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledrectangle/bug00004.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledrectangle/bug00004.c
new file mode 100644
index 00000000000..594e29637d7
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledrectangle/bug00004.c
@@ -0,0 +1,27 @@
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ int c1,c2,c3,c4,c5;
+
+ im = gdImageCreateTrueColor(100,100);
+ gdImageFilledRectangle(im, 2,2, 80,95, 0x50FFFFFF);
+
+ c1 = gdImageGetTrueColorPixel(im, 2, 2);
+ c2 = gdImageGetTrueColorPixel(im, 80, 95);
+ c3 = gdImageGetTrueColorPixel(im, 80, 2);
+ c4 = gdImageGetTrueColorPixel(im, 2, 95);
+ c5 = gdImageGetTrueColorPixel(im, 49, 49);
+
+ gdImageDestroy(im);
+ if (0x005e5e5e == c1 && 0x005e5e5e == c2 &&
+ 0x005e5e5e == c3 && 0x005e5e5e == c4 &&
+ 0x005e5e5e == c5) {
+ return 0;
+ } else {
+ return 1;
+ }
+}
+
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledrectangle/bug00078.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledrectangle/bug00078.c
new file mode 100644
index 00000000000..adf244ebca2
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledrectangle/bug00078.c
@@ -0,0 +1,39 @@
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ int c1,c2,c3,c4,c5;
+
+ im = gdImageCreateTrueColor(100,100);
+ gdImageFilledRectangle(im, 2,2, 80,95, 0x50FFFFFF);
+ c1 = gdImageGetTrueColorPixel(im, 2, 2);
+ c2 = gdImageGetTrueColorPixel(im, 80, 95);
+ c3 = gdImageGetTrueColorPixel(im, 80, 2);
+ c4 = gdImageGetTrueColorPixel(im, 2, 95);
+ c5 = gdImageGetTrueColorPixel(im, 49, 49);
+
+ if (!(0x005e5e5e == c1 && 0x005e5e5e == c2 &&
+ 0x005e5e5e == c3 && 0x005e5e5e == c4)) {
+ return 1;
+ }
+ gdImageFilledRectangle(im, 0, 0, 99, 99, 0x0);
+
+ gdImageFilledRectangle(im, 80,95, 2,2, 0x50FFFFFF);
+ c1 = gdImageGetTrueColorPixel(im, 2, 2);
+ c2 = gdImageGetTrueColorPixel(im, 80, 95);
+ c3 = gdImageGetTrueColorPixel(im, 80, 2);
+ c4 = gdImageGetTrueColorPixel(im, 2, 95);
+ c5 = gdImageGetTrueColorPixel(im, 49, 49);
+
+ if (!(0x005e5e5e == c1 && 0x005e5e5e == c2 &&
+ 0x005e5e5e == c3 && 0x005e5e5e == c4 &&
+ 0x005e5e5e == c5)) {
+ return 1;
+ }
+
+ gdImageDestroy(im);
+ return 0;
+}
+
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledrectangle/bug00106_gdimagefilledrectangle.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledrectangle/bug00106_gdimagefilledrectangle.c
new file mode 100644
index 00000000000..24f5ceb9327
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilledrectangle/bug00106_gdimagefilledrectangle.c
@@ -0,0 +1,27 @@
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ int c1,c2,c3,c4;
+
+ im = gdImageCreateTrueColor(10,10);
+ if (!im) {
+ return 1;
+ }
+
+ gdImageFilledRectangle(im, 1,1, 1,1, 0x50FFFFFF);
+ c1 = gdImageGetTrueColorPixel(im, 1, 1);
+ c2 = gdImageGetTrueColorPixel(im, 2, 1);
+ c3 = gdImageGetTrueColorPixel(im, 1, 2);
+ c4 = gdImageGetTrueColorPixel(im, 2, 2);
+ gdImageDestroy(im);
+ if (0x005e5e5e == c1 && 0x0 == c2 &&
+ 0x0 == c3 && 0x0 == c4) {
+ return 0;
+ } else {
+ return 1;
+ }
+}
+
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilltoborder/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilltoborder/CMakeLists.txt
new file mode 100644
index 00000000000..966bff0657b
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilltoborder/CMakeLists.txt
@@ -0,0 +1,10 @@
+
+SET(TESTS_FILES
+ bug00037
+)
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilltoborder/bug00037.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilltoborder/bug00037.c
new file mode 100644
index 00000000000..646adbd0f79
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagefilltoborder/bug00037.c
@@ -0,0 +1,30 @@
+#include <stdio.h>
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ int bordercolor, color;
+
+ im = gdImageCreateTrueColor(100, 100);
+
+ gdImageAlphaBlending(im, 1);
+ gdImageSaveAlpha(im, 1);
+ bordercolor = gdImageColorAllocateAlpha(im, 0, 0, 0, 2);
+ color = gdImageColorAllocateAlpha(im, 0, 0, 0, 1);
+
+ gdImageFillToBorder(im, 5, 5, bordercolor, color);
+
+ color = gdImageGetPixel(im, 5, 5);
+
+ gdImageDestroy(im);
+ if (gdTestAssert(color==0x1000000)) {
+ return 0;
+ } else {
+ printf("c: %X, expected %X\n", color, 0x1000000);
+ return -1;
+ }
+
+}
+
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/CMakeLists.txt
new file mode 100644
index 00000000000..fb3212eba71
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/CMakeLists.txt
@@ -0,0 +1,14 @@
+SET(TESTS_FILES
+ gdimageline_aa
+ gdimageline_aa_outofrange
+ bug00077
+ bug00072
+ bug00111
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/bug00072.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/bug00072.c
new file mode 100644
index 00000000000..c3a3137e539
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/bug00072.c
@@ -0,0 +1,35 @@
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ const char *exp = "bug00072_exp.png";
+ int error = 0;
+
+ char path[1024];
+
+
+ im = gdImageCreateTrueColor(11, 11);
+ gdImageFilledRectangle(im, 0, 0, 10, 10, 0xFFFFFF);
+ gdImageSetThickness(im, 3);
+
+ gdImageLine(im, 5, 0, 5, 11, 0x000000);
+ gdImageLine(im, 0, 5, 11, 5, 0x000000);
+ gdImageLine(im, 0, 0, 11, 11, 0x000000);
+
+ gdImageSetThickness(im, 1);
+
+ gdImageLine(im, 5, 0, 5, 11, 0xFF0000);
+ gdImageLine(im, 0, 5, 11, 5, 0xFF0000);
+ gdImageLine(im, 0, 0, 11, 11, 0xFF0000);
+
+ sprintf(path, "%s/gdimageline/%s", GDTEST_TOP_DIR, exp);
+ if (!gdAssertImageEqualsToFile(path, im)) {
+ error = 1;
+ }
+
+ gdImageDestroy(im);
+
+ return error;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/bug00072_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/bug00072_exp.png
new file mode 100644
index 00000000000..6439e061f1d
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/bug00072_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/bug00077.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/bug00077.c
new file mode 100644
index 00000000000..d69e88177f2
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/bug00077.c
@@ -0,0 +1,31 @@
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ const char *exp = "bug00077_exp.png";
+ int error = 0;
+
+ char path[1024];
+
+
+ im = gdImageCreateTrueColor(11, 11);
+ gdImageFilledRectangle(im, 0, 0, 10, 10, 0xFFFFFF);
+ gdImageSetThickness(im, 1);
+
+ gdImageLine(im, 0, 10, 0, 0, 0x0);
+ gdImageLine(im, 5, 10, 5, 0, 0x0);
+ gdImageLine(im, 10, 5, 0, 5, 0x0);
+ gdImageLine(im, 10, 10, 0, 10, 0x0);
+
+ sprintf(path, "%s/gdimageline/%s", GDTEST_TOP_DIR, exp);
+
+ if (!gdAssertImageEqualsToFile(path, im)) {
+ error = 1;
+ }
+
+ gdImageDestroy(im);
+
+ return error;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/bug00077_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/bug00077_exp.png
new file mode 100644
index 00000000000..bfa097a5c56
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/bug00077_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/bug00111.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/bug00111.c
new file mode 100644
index 00000000000..4277534874d
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/bug00111.c
@@ -0,0 +1,35 @@
+/* $Id$ */
+
+#include "gd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ int error = 0;
+ char path[2048];
+ const char *file_exp = "bug00111_exp.png";
+
+ im = gdImageCreateTrueColor(10, 10);
+ if (!im) {
+ printf("can't get truecolor image\n");
+ return 1;
+ }
+
+ gdImageLine(im, 2, 2, 2, 2, 0xFFFFFF);
+ gdImageLine(im, 5, 5, 5, 5, 0xFFFFFF);
+
+ gdImageLine(im, 0, 0, 0, 0, 0xFFFFFF);
+
+ sprintf(path, "%s/gdimageline/%s", GDTEST_TOP_DIR, file_exp);
+ if (!gdAssertImageEqualsToFile(path, im)) {
+ error = 1;
+ printf("Reference image and destination differ\n");
+ }
+
+ gdImageDestroy(im);
+
+ return error;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/bug00111_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/bug00111_exp.png
new file mode 100644
index 00000000000..ecd44b25d66
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/bug00111_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdImageAALine_thickness.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdImageAALine_thickness.c
new file mode 100644
index 00000000000..6db2c72f57c
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdImageAALine_thickness.c
@@ -0,0 +1,28 @@
+#include <stdio.h>
+#include "gd.h"
+#include "gdtest.h"
+
+int main(int argc, char **argv)
+{
+ gdImagePtr im;
+ char path[2048];
+ const char *file_exp = "gdimageline/gdImageAALine_thickness_exp.png";
+
+ im = gdImageCreateTrueColor(100, 100);
+ gdImageFilledRectangle(im, 0, 0, 99, 99,
+ gdImageColorExactAlpha(im, 255, 255, 255, 0));
+
+ gdImageSetThickness(im, 5);
+ gdImageSetAntiAliased(im, gdImageColorExactAlpha(im, 0, 0, 0, 0));
+ gdImageLine(im, 0,0, 99, 99, gdAntiAliased);
+
+ sprintf(path, "%s/%s", GDTEST_TOP_DIR, file_exp);
+
+ if (!gdAssertImageEqualsToFile(path, im)) {
+ printf("comparing rotated image to %s failed.\n", path);
+ gdImageDestroy(im);
+ return 1;
+ }
+
+ gdImageDestroy(im);
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdImageAALine_thickness_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdImageAALine_thickness_exp.png
new file mode 100644
index 00000000000..26e02bc3661
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdImageAALine_thickness_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa.c
new file mode 100644
index 00000000000..b0bea3a4d5c
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa.c
@@ -0,0 +1,76 @@
+#include <stdio.h>
+#include <math.h>
+#include "gd.h"
+#include "gdtest.h"
+
+#ifdef _MSC_VER
+# define snprintf _snprintf
+#endif
+
+int gen_image(const char* filename, int idx, int reverse_x, int width, int height, int bgd)
+{
+ double gradient = height / (width*2.0);
+ int offset = idx*width;
+ int x1,y1,x2,y2, error = 0;
+
+ gdImagePtr im = gdImageCreateTrueColor(width,height);
+ if (bgd==1) {
+ gdImageFilledRectangle(im,0,0,width-1,height-1, gdTrueColorAlpha(255, 255, 255, 0));
+ } else {
+ gdImageFilledRectangle(im,0,0,width-1,height-1, gdTrueColorAlpha(255, 255, 0, 0));
+ }
+
+ gdImageSetAntiAliased(im, gdTrueColorAlpha(0,0,0,0));
+
+ /*
+ test for potential segfault (introduced with AA improvements, fixed
+ with the same patch - but I didn't notice it until later).*/
+ gdImageLine(im,-1,-1,-1,-1,gdAntiAliased);
+
+ x1 = floor(reverse_x * -width + 0.5);
+ y1 = (offset-width) * gradient + 0.5;
+
+ x2 = floor(reverse_x * width*2 + 0.5);
+ y2 = floor((offset+width*2) * gradient + 0.5);
+
+ /* draw an AA line */
+ gdImageLine(im, x1, y1, x2, y2, gdAntiAliased);
+
+ gdImageLine(im, 0, im->sy - 1, im->sx, im->sy - 1, 0x40FF0000);
+
+ if (!gdAssertImageEqualsToFile(filename, im)) {
+ gdTestErrorMsg("gdAssertImageEqualsToFile failed: <%s>\n", filename);
+ error = 1;
+ }
+ gdImageDestroy(im);
+ return error;
+}
+
+int main()
+{
+ int error = 0;
+ char path[1024];
+
+ snprintf(path, sizeof(path)-1, "%s/gdimageline/gdimageline_aa_a_0_exp.png", GDTEST_TOP_DIR);
+ error |= gen_image(path,0,1,10,100, 1);
+
+ snprintf(path, sizeof(path)-1, "%s/gdimageline/gdimageline_aa_a_1_exp.png", GDTEST_TOP_DIR);
+ error |= gen_image(path,1,1,10,100, 2);
+
+ snprintf(path, sizeof(path)-1, "%s/gdimageline/gdimageline_aa_b_0_exp.png", GDTEST_TOP_DIR);
+ error |= gen_image(path,2,-1,10,100, 1);
+ snprintf(path, sizeof(path)-1, "%s/gdimageline/gdimageline_aa_b_1_exp.png", GDTEST_TOP_DIR);
+ error |= gen_image(path,1,-1,10,100, 2);
+
+ snprintf(path, sizeof(path)-1, "%s/gdimageline/gdimageline_aa_c_0_exp.png", GDTEST_TOP_DIR);
+ error |= gen_image(path,0,1,100,10, 1);
+ snprintf(path, sizeof(path)-1, "%s/gdimageline/gdimageline_aa_c_1_exp.png", GDTEST_TOP_DIR);
+ error |= gen_image(path,1,1,100,10, 2);
+
+ snprintf(path, sizeof(path)-1, "%s/gdimageline/gdimageline_aa_d_0_exp.png", GDTEST_TOP_DIR);
+ error |= gen_image(path,2,-1,100,10, 1);
+ snprintf(path, sizeof(path)-1, "%s/gdimageline/gdimageline_aa_d_1_exp.png", GDTEST_TOP_DIR);
+ error |= gen_image(path,1,-1,100,10, 2);
+
+ return error;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_a_0_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_a_0_exp.png
new file mode 100644
index 00000000000..83f893453ed
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_a_0_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_a_1_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_a_1_exp.png
new file mode 100644
index 00000000000..c4edcfa36ec
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_a_1_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_b_0_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_b_0_exp.png
new file mode 100644
index 00000000000..130d6c36cc7
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_b_0_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_b_1_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_b_1_exp.png
new file mode 100644
index 00000000000..678800658d3
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_b_1_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_c_0_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_c_0_exp.png
new file mode 100644
index 00000000000..6d03ae6652e
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_c_0_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_c_1_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_c_1_exp.png
new file mode 100644
index 00000000000..6e1a38aa7e1
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_c_1_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_d_0_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_d_0_exp.png
new file mode 100644
index 00000000000..c6f9e27e4fc
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_d_0_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_d_1_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_d_1_exp.png
new file mode 100644
index 00000000000..709c186c26a
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_d_1_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_outofrange.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_outofrange.c
new file mode 100644
index 00000000000..5c1ed05ab03
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_aa_outofrange.c
@@ -0,0 +1,19 @@
+#include <stdio.h>
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+
+ im = gdImageCreateTrueColor(300, 300);
+
+ gdImageSetAntiAliased(im, gdTrueColorAlpha(255, 255, 255, 0));
+
+ gdImageLine(im, -1, -1, -1, -1, gdAntiAliased);
+ gdImageLine(im, 299, 299, 0, 299, gdAntiAliased);
+ gdImageLine(im, 1,1, 50, 50, gdAntiAliased);
+
+ /* Test for segfaults, if we reach this point, the test worked */
+ return 0;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_bug5.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_bug5.c
new file mode 100644
index 00000000000..ef57f6c1cb2
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageline/gdimageline_bug5.c
@@ -0,0 +1,39 @@
+#include <stdio.h>
+#include "gd.h"
+#include "gdtest.h"
+
+int main() {
+ /* Declare the image */
+ gdImagePtr im;
+
+ /* Declare output files */
+ /* FILE *pngout; */
+ int black, white;
+
+ im = gdImageCreateTrueColor(63318, 771);
+
+ /* Allocate the color white (red, green and blue all maximum). */
+ white = gdImageColorAllocate(im, 255, 255, 255);
+ /* Allocate the color white (red, green and blue all maximum). */
+ black = gdImageColorAllocate(im, 0, 0, 0);
+
+ /* white background */
+ gdImageFill(im, 1, 1, white);
+
+ gdImageSetAntiAliased(im, black);
+
+ /* This line fails! */
+ gdImageLine(im, 28562, 631, 34266, 750, gdAntiAliased);
+
+ /* Open a file for writing. "wb" means "write binary", important under MSDOS, harmless under Unix. */
+ /* pngout = fopen("test.png", "wb"); */
+
+ /* Output the image to the disk file in PNG format. */
+ /* gdImagePng(im, pngout); */
+
+ /* Close the files. */
+ /* fclose(pngout); */
+
+ /* Destroy the image in memory. */
+ gdImageDestroy(im);
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/CMakeLists.txt
new file mode 100644
index 00000000000..09a22678077
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/CMakeLists.txt
@@ -0,0 +1,13 @@
+SET(TESTS_FILES
+ gdimageopenpolygon0
+ gdimageopenpolygon1
+ gdimageopenpolygon2
+ gdimageopenpolygon3
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon0.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon0.c
new file mode 100644
index 00000000000..d9bf1bd962a
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon0.c
@@ -0,0 +1,22 @@
+#include <stdlib.h>
+#include "gd.h"
+#include "gdtest.h"
+
+int
+main(void)
+{
+ gdImagePtr im;
+ int white, black, r;
+
+ im = gdImageCreate(100, 100);
+ if (!im) exit(EXIT_FAILURE);
+ white = gdImageColorAllocate(im, 0xff, 0xff, 0xff);
+ black = gdImageColorAllocate(im, 0, 0, 0);
+ gdImageFilledRectangle(im, 0, 0, 99, 99, white);
+ gdImageOpenPolygon(im, NULL, 0, black); /* no effect */
+ gdImageOpenPolygon(im, NULL, -1, black); /* no effect */
+ r = gdAssertImageEqualsToFile(GDTEST_TOP_DIR "/gdimageopenpolygon/gdimageopenpolygon0.png", im);
+ gdImageDestroy(im);
+ if (!r) exit(EXIT_FAILURE);
+ return EXIT_SUCCESS;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon0.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon0.png
new file mode 100644
index 00000000000..14c7090a415
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon0.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon1.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon1.c
new file mode 100644
index 00000000000..07ee29dff49
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon1.c
@@ -0,0 +1,31 @@
+#include <stdlib.h>
+#include "gd.h"
+#include "gdhelpers.h"
+#include "gdtest.h"
+
+int
+main(void)
+{
+ gdImagePtr im;
+ int white, black, r;
+ gdPointPtr points;
+
+ im = gdImageCreate(100, 100);
+ if (!im) exit(EXIT_FAILURE);
+ white = gdImageColorAllocate(im, 0xff, 0xff, 0xff);
+ black = gdImageColorAllocate(im, 0, 0, 0);
+ gdImageFilledRectangle(im, 0, 0, 99, 99, white);
+ points = (gdPointPtr)calloc(3, sizeof(gdPoint));
+ if (!points) {
+ gdImageDestroy(im);
+ exit(EXIT_FAILURE);
+ }
+ points[0].x = 10;
+ points[0].y = 10;
+ gdImageOpenPolygon(im, points, 1, black);
+ r = gdAssertImageEqualsToFile(GDTEST_TOP_DIR "/gdimageopenpolygon/gdimageopenpolygon1.png", im);
+ free(points);
+ gdImageDestroy(im);
+ if (!r) exit(EXIT_FAILURE);
+ return EXIT_SUCCESS;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon1.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon1.png
new file mode 100644
index 00000000000..14c7090a415
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon1.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon2.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon2.c
new file mode 100644
index 00000000000..ab097d83cad
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon2.c
@@ -0,0 +1,33 @@
+#include <stdlib.h>
+#include "gd.h"
+#include "gdhelpers.h"
+#include "gdtest.h"
+
+int
+main(void)
+{
+ gdImagePtr im;
+ int white, black, r;
+ gdPointPtr points;
+
+ im = gdImageCreate(100, 100);
+ if (!im) exit(EXIT_FAILURE);
+ white = gdImageColorAllocate(im, 0xff, 0xff, 0xff);
+ black = gdImageColorAllocate(im, 0, 0, 0);
+ gdImageFilledRectangle(im, 0, 0, 99, 99, white);
+ points = (gdPointPtr)calloc(3, sizeof(gdPoint));
+ if (!points) {
+ gdImageDestroy(im);
+ exit(EXIT_FAILURE);
+ }
+ points[0].x = 10;
+ points[0].y = 10;
+ points[1].x = 50;
+ points[1].y = 70;
+ gdImageOpenPolygon(im, points, 2, black);
+ r = gdAssertImageEqualsToFile(GDTEST_TOP_DIR "/gdimageopenpolygon/gdimageopenpolygon2.png", im);
+ free(points);
+ gdImageDestroy(im);
+ if (!r) exit(EXIT_FAILURE);
+ return EXIT_SUCCESS;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon2.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon2.png
new file mode 100644
index 00000000000..80f91a2814b
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon2.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon3.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon3.c
new file mode 100644
index 00000000000..027bfacd20b
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon3.c
@@ -0,0 +1,35 @@
+#include <stdlib.h>
+#include "gd.h"
+#include "gdhelpers.h"
+#include "gdtest.h"
+
+int
+main(void)
+{
+ gdImagePtr im;
+ int white, black, r;
+ gdPointPtr points;
+
+ im = gdImageCreate(100, 100);
+ if (!im) exit(EXIT_FAILURE);
+ white = gdImageColorAllocate(im, 0xff, 0xff, 0xff);
+ black = gdImageColorAllocate(im, 0, 0, 0);
+ gdImageFilledRectangle(im, 0, 0, 99, 99, white);
+ points = (gdPointPtr)calloc(3, sizeof(gdPoint));
+ if (!points) {
+ gdImageDestroy(im);
+ exit(EXIT_FAILURE);
+ }
+ points[0].x = 10;
+ points[0].y = 10;
+ points[1].x = 50;
+ points[1].y = 70;
+ points[2].x = 90;
+ points[2].y = 30;
+ gdImageOpenPolygon(im, points, 3, black);
+ r = gdAssertImageEqualsToFile(GDTEST_TOP_DIR "/gdimageopenpolygon/gdimageopenpolygon3.png", im);
+ free(points);
+ gdImageDestroy(im);
+ if (!r) exit(EXIT_FAILURE);
+ return EXIT_SUCCESS;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon3.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon3.png
new file mode 100644
index 00000000000..9d63d6ac9ba
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimageopenpolygon/gdimageopenpolygon3.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepixelate/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepixelate/CMakeLists.txt
new file mode 100644
index 00000000000..1f1182581eb
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepixelate/CMakeLists.txt
@@ -0,0 +1,10 @@
+SET(TESTS_FILES
+ gdimagepixelate
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepixelate/gdimagepixelate.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepixelate/gdimagepixelate.c
new file mode 100644
index 00000000000..2a0a4692269
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepixelate/gdimagepixelate.c
@@ -0,0 +1,88 @@
+#include "gd.h"
+#include "gdtest.h"
+
+#define WIDTH 12
+#define BLOCK_SIZE 4
+
+static const int expected_upperleft[][3] = {
+ {0x000000, 0x040404, 0x080808},
+ {0x303030, 0x343434, 0x383838},
+ {0x606060, 0x646464, 0x686868}
+};
+
+static const int expected_average[][3] = {
+ {0x131313, 0x171717, 0x1b1b1b},
+ {0x434343, 0x474747, 0x4b4b4b},
+ {0x737373, 0x777777, 0x7b7b7b},
+};
+
+#define SETUP_PIXELS(im) do { \
+ int x, y, i = 0; \
+ for (y = 0; y < (im)->sy; y++) { \
+ for (x = 0; x < (im)->sx; x++) { \
+ int p = gdImageColorResolve(im, i, i, i); \
+ gdImageSetPixel(im, x, y, p); \
+ i++; \
+ } \
+ } \
+ } while (0)
+
+#define CHECK_PIXELS(im, expected) do { \
+ int x, y; \
+ for (y = 0; y < (im)->sy; y++) { \
+ for (x = 0; x < (im)->sx; x++) { \
+ int p = gdImageGetPixel(im, x, y); \
+ int r = ((expected)[y/BLOCK_SIZE][x/BLOCK_SIZE]>>16)&0xFF; \
+ int g = ((expected)[y/BLOCK_SIZE][x/BLOCK_SIZE]>> 8)&0xFF; \
+ int b = ((expected)[y/BLOCK_SIZE][x/BLOCK_SIZE] )&0xFF; \
+ if (r != gdImageRed(im, p)) { \
+ printf("Red %x is expected, but %x\n", r, gdImageRed(im, p)); \
+ return 0; \
+ } \
+ if (g != gdImageGreen(im, p)) { \
+ printf("Green %x is expected, but %x\n", g, gdImageGreen(im, p)); \
+ return 0; \
+ } \
+ if (b != gdImageBlue(im, p)) { \
+ printf("Blue %x is expected, but %x\n", b, gdImageBlue(im, p)); \
+ return 0; \
+ } \
+ } \
+ } \
+ } while (0)
+
+static int testPixelate(gdImagePtr im)
+{
+ if (gdImagePixelate(im, -1, GD_PIXELATE_UPPERLEFT) != 0) return 0;
+ if (gdImagePixelate(im, 1, GD_PIXELATE_UPPERLEFT) != 1) return 0;
+ if (gdImagePixelate(im, 2, -1) != 0) return 0;
+
+ SETUP_PIXELS(im);
+ if (!gdImagePixelate(im, BLOCK_SIZE, GD_PIXELATE_UPPERLEFT)) return 0;
+ CHECK_PIXELS(im, expected_upperleft);
+
+ SETUP_PIXELS(im);
+ if (!gdImagePixelate(im, BLOCK_SIZE, GD_PIXELATE_AVERAGE)) return 0;
+ CHECK_PIXELS(im, expected_average);
+
+ return 1;
+}
+
+int main()
+{
+ gdImagePtr im;
+
+ im = gdImageCreate(WIDTH, WIDTH);
+ if (!testPixelate(im)) {
+ return 1;
+ }
+ gdImageDestroy(im);
+
+ im = gdImageCreateTrueColor(WIDTH, WIDTH);
+ if (!testPixelate(im)) {
+ return 2;
+ }
+ gdImageDestroy(im);
+
+ return 0;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/CMakeLists.txt
new file mode 100644
index 00000000000..92802ec6253
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/CMakeLists.txt
@@ -0,0 +1,13 @@
+SET(TESTS_FILES
+ gdimagepolygon0
+ gdimagepolygon1
+ gdimagepolygon2
+ gdimagepolygon3
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon0.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon0.c
new file mode 100644
index 00000000000..20fa423c056
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon0.c
@@ -0,0 +1,22 @@
+#include <stdlib.h>
+#include "gd.h"
+#include "gdtest.h"
+
+int
+main(void)
+{
+ gdImagePtr im;
+ int white, black, r;
+
+ im = gdImageCreate(100, 100);
+ if (!im) exit(EXIT_FAILURE);
+ white = gdImageColorAllocate(im, 0xff, 0xff, 0xff);
+ black = gdImageColorAllocate(im, 0, 0, 0);
+ gdImageFilledRectangle(im, 0, 0, 99, 99, white);
+ gdImagePolygon(im, NULL, 0, black); /* no effect */
+ gdImagePolygon(im, NULL, -1, black); /* no effect */
+ r = gdAssertImageEqualsToFile(GDTEST_TOP_DIR "/gdimagepolygon/gdimagepolygon0.png", im);
+ gdImageDestroy(im);
+ if (!r) exit(EXIT_FAILURE);
+ return EXIT_SUCCESS;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon0.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon0.png
new file mode 100644
index 00000000000..14c7090a415
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon0.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon1.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon1.c
new file mode 100644
index 00000000000..6f2ad57dfcc
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon1.c
@@ -0,0 +1,31 @@
+#include <stdlib.h>
+#include "gd.h"
+#include "gdhelpers.h"
+#include "gdtest.h"
+
+int
+main(void)
+{
+ gdImagePtr im;
+ int white, black, r;
+ gdPointPtr points;
+
+ im = gdImageCreate(100, 100);
+ if (!im) exit(EXIT_FAILURE);
+ white = gdImageColorAllocate(im, 0xff, 0xff, 0xff);
+ black = gdImageColorAllocate(im, 0, 0, 0);
+ gdImageFilledRectangle(im, 0, 0, 99, 99, white);
+ points = (gdPointPtr)calloc(3, sizeof(gdPoint));
+ if (!points) {
+ gdImageDestroy(im);
+ exit(EXIT_FAILURE);
+ }
+ points[0].x = 10;
+ points[0].y = 10;
+ gdImagePolygon(im, points, 1, black);
+ r = gdAssertImageEqualsToFile(GDTEST_TOP_DIR "/gdimagepolygon/gdimagepolygon1.png", im);
+ free(points);
+ gdImageDestroy(im);
+ if (!r) exit(EXIT_FAILURE);
+ return EXIT_SUCCESS;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon1.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon1.png
new file mode 100644
index 00000000000..845c5f6930b
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon1.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon2.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon2.c
new file mode 100644
index 00000000000..8142c3ba873
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon2.c
@@ -0,0 +1,33 @@
+#include <stdlib.h>
+#include "gd.h"
+#include "gdhelpers.h"
+#include "gdtest.h"
+
+int
+main(void)
+{
+ gdImagePtr im;
+ int white, black, r;
+ gdPointPtr points;
+
+ im = gdImageCreate(100, 100);
+ if (!im) exit(EXIT_FAILURE);
+ white = gdImageColorAllocate(im, 0xff, 0xff, 0xff);
+ black = gdImageColorAllocate(im, 0, 0, 0);
+ gdImageFilledRectangle(im, 0, 0, 99, 99, white);
+ points = (gdPointPtr)calloc(3, sizeof(gdPoint));
+ if (!points) {
+ gdImageDestroy(im);
+ exit(EXIT_FAILURE);
+ }
+ points[0].x = 10;
+ points[0].y = 10;
+ points[1].x = 50;
+ points[1].y = 70;
+ gdImagePolygon(im, points, 2, black);
+ r = gdAssertImageEqualsToFile(GDTEST_TOP_DIR "/gdimagepolygon/gdimagepolygon2.png", im);
+ free(points);
+ gdImageDestroy(im);
+ if (!r) exit(EXIT_FAILURE);
+ return EXIT_SUCCESS;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon2.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon2.png
new file mode 100644
index 00000000000..80f91a2814b
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon2.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon3.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon3.c
new file mode 100644
index 00000000000..55d71f27a9c
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon3.c
@@ -0,0 +1,35 @@
+#include <stdlib.h>
+#include "gd.h"
+#include "gdhelpers.h"
+#include "gdtest.h"
+
+int
+main(void)
+{
+ gdImagePtr im;
+ int white, black, r;
+ gdPointPtr points;
+
+ im = gdImageCreate(100, 100);
+ if (!im) exit(EXIT_FAILURE);
+ white = gdImageColorAllocate(im, 0xff, 0xff, 0xff);
+ black = gdImageColorAllocate(im, 0, 0, 0);
+ gdImageFilledRectangle(im, 0, 0, 99, 99, white);
+ points = (gdPointPtr)calloc(3, sizeof(gdPoint));
+ if (!points) {
+ gdImageDestroy(im);
+ exit(EXIT_FAILURE);
+ }
+ points[0].x = 10;
+ points[0].y = 10;
+ points[1].x = 50;
+ points[1].y = 70;
+ points[2].x = 90;
+ points[2].y = 30;
+ gdImagePolygon(im, points, 3, black);
+ r = gdAssertImageEqualsToFile(GDTEST_TOP_DIR "/gdimagepolygon/gdimagepolygon3.png", im);
+ free(points);
+ gdImageDestroy(im);
+ if (!r) exit(EXIT_FAILURE);
+ return EXIT_SUCCESS;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon3.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon3.png
new file mode 100644
index 00000000000..aaff882a8fb
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagepolygon/gdimagepolygon3.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerectangle/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerectangle/CMakeLists.txt
new file mode 100644
index 00000000000..223b381128b
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerectangle/CMakeLists.txt
@@ -0,0 +1,11 @@
+SET(TESTS_FILES
+ bug00003
+ bug00106_gdimagerectangle
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerectangle/bug00003.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerectangle/bug00003.c
new file mode 100644
index 00000000000..4ee4ddbcb5d
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerectangle/bug00003.c
@@ -0,0 +1,23 @@
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ int c1,c2,c3,c4;
+
+ im = gdImageCreateTrueColor(100,100);
+ gdImageRectangle(im, 2,2, 80,95, 0x50FFFFFF);
+ c1 = gdImageGetTrueColorPixel(im, 2, 2);
+ c2 = gdImageGetTrueColorPixel(im, 80, 95);
+ c3 = gdImageGetTrueColorPixel(im, 80, 2);
+ c4 = gdImageGetTrueColorPixel(im, 2, 95);
+
+ gdImageDestroy(im);
+ if (0x005e5e5e == c1 && 0x005e5e5e == c2 &&
+ 0x005e5e5e == c3 && 0x005e5e5e == c4) {
+ return 0;
+ } else {
+ return 1;
+ }
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerectangle/bug00106_gdimagerectangle.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerectangle/bug00106_gdimagerectangle.c
new file mode 100644
index 00000000000..21bf88b7440
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerectangle/bug00106_gdimagerectangle.c
@@ -0,0 +1,28 @@
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ int c1,c2,c3,c4;
+
+ im = gdImageCreateTrueColor(10,10);
+
+ if (!im) {
+ return 1;
+ }
+
+ gdImageRectangle(im, 1,1, 1,1, 0x50FFFFFF);
+ c1 = gdImageGetTrueColorPixel(im, 1, 1);
+ c2 = gdImageGetTrueColorPixel(im, 2, 1);
+ c3 = gdImageGetTrueColorPixel(im, 1, 2);
+ c4 = gdImageGetTrueColorPixel(im, 2, 2);
+ gdImageDestroy(im);
+
+ if (0x005e5e5e == c1 && 0x0 == c2 &&
+ 0x0 == c3 && 0x0 == c4) {
+ return 0;
+ } else {
+ return 1;
+ }
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067.c
new file mode 100644
index 00000000000..4a6595988b9
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067.c
@@ -0,0 +1,67 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "gd.h"
+
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im, exp;
+ char path[2048];
+ const char *file_im = "gdimagerotate/remirh128.jpg";
+ const char *file_exp = "gdimagerotate/bug00067";
+ FILE *fp;
+ int color;
+ int error = 0;
+ int angle;
+
+ sprintf(path, "%s/%s", GDTEST_TOP_DIR, file_im);
+
+ fp = fopen(path, "rb");
+
+ if (!fp) {
+ gdTestErrorMsg("opening Jpeg %s for reading failed.\n", path);
+ return 1;
+ }
+
+ im = gdImageCreateFromJpeg(fp);
+
+ fclose(fp);
+
+ if (!im) {
+ gdTestErrorMsg("loading %s failed.\n", path);
+ return 1;
+ }
+
+ color = gdImageColorAllocate(im, 0, 0, 0);
+
+ if (color < 0) {
+ gdTestErrorMsg("allocation color from image failed.\n");
+ gdImageDestroy(im);
+ return 1;
+ }
+
+ for (angle = 0; angle <= 180; angle += 15) {
+
+ exp = gdImageRotateInterpolated(im, angle, color);
+
+ if (!exp) {
+ gdTestErrorMsg("rotating image failed for %03d.\n", angle);
+ gdImageDestroy(im);
+ return 1;
+ }
+
+ sprintf(path, "%s/%s_%03d_exp.png", GDTEST_TOP_DIR, file_exp, angle);
+
+ if (!gdAssertImageEqualsToFile(path, exp)) {
+ gdTestErrorMsg("comparing rotated image to %s failed.\n", path);
+ error += 1;
+ }
+
+ gdImageDestroy(exp);
+ }
+
+ gdImageDestroy(im);
+
+ return error;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_000_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_000_exp.png
new file mode 100644
index 00000000000..d06b5fe58fb
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_000_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_015_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_015_exp.png
new file mode 100644
index 00000000000..a0f8ce2efae
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_015_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_030_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_030_exp.png
new file mode 100644
index 00000000000..aad7f4ccb67
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_030_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_045_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_045_exp.png
new file mode 100644
index 00000000000..75916a51649
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_045_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_060_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_060_exp.png
new file mode 100644
index 00000000000..f24364a062f
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_060_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_075_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_075_exp.png
new file mode 100644
index 00000000000..f8dcf449086
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_075_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_090_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_090_exp.png
new file mode 100644
index 00000000000..a971447c7b2
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_090_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_105_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_105_exp.png
new file mode 100644
index 00000000000..2cf641d85a8
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_105_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_120_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_120_exp.png
new file mode 100644
index 00000000000..1890f92545c
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_120_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_135_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_135_exp.png
new file mode 100644
index 00000000000..34ccb0aa054
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_135_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_150_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_150_exp.png
new file mode 100644
index 00000000000..330d030a7fa
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_150_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_165_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_165_exp.png
new file mode 100644
index 00000000000..df5b6400bc2
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_165_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_180_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_180_exp.png
new file mode 100644
index 00000000000..d4f65983615
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/bug00067_180_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/php_bug_64898.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/php_bug_64898.c
new file mode 100644
index 00000000000..9bbd98b5313
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/php_bug_64898.c
@@ -0,0 +1,58 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "gd.h"
+
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im, exp;
+ char path[2048];
+ const char *file_im = "gdimagerotate/php_bug_64898.png";
+ const char *file_exp = "gdimagerotate/php_bug_64898_exp.png";
+ FILE *fp;
+ int color;
+
+ sprintf(path, "%s/%s", GDTEST_TOP_DIR, file_im);
+
+ fp = fopen(path, "rb");
+
+ if (!fp) {
+ gdTestErrorMsg("opening PNG %s for reading failed.\n", path);
+ return 1;
+ }
+
+ im = gdImageCreateTrueColor(141, 200);
+
+ if (!im) {
+ gdTestErrorMsg("loading %s failed.\n", path);
+ return 1;
+ }
+
+ gdImageFilledRectangle(im, 0, 0, 140, 199, 0x00ffffff);
+
+/* Try default interpolation method, but any non-optimized fails */
+/* gdImageSetInterpolationMethod(im, GD_BICUBIC_FIXED); */
+
+ exp = gdImageRotateInterpolated(im, 45, 0x0);
+
+ if (!exp) {
+ gdTestErrorMsg("rotating image failed.\n");
+ gdImageDestroy(im);
+ return 1;
+ }
+
+ sprintf(path, "%s/%s", GDTEST_TOP_DIR, file_exp);
+
+ if (!gdAssertImageEqualsToFile(path, exp)) {
+ printf("comparing rotated image to %s failed.\n", path);
+ gdImageDestroy(im);
+ gdImageDestroy(exp);
+ return 1;
+ }
+
+ gdImageDestroy(exp);
+ gdImageDestroy(im);
+
+ return 0;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/php_bug_64898.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/php_bug_64898.png
new file mode 100644
index 00000000000..089680a248c
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/php_bug_64898.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/php_bug_64898_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/php_bug_64898_exp.png
new file mode 100644
index 00000000000..a03bdb8e9d6
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/php_bug_64898_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/remirh128.jpg b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/remirh128.jpg
new file mode 100644
index 00000000000..bd5e3c77e3c
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagerotate/remirh128.jpg
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagescatterex/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagescatterex/CMakeLists.txt
new file mode 100644
index 00000000000..3e51d344065
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagescatterex/CMakeLists.txt
@@ -0,0 +1,11 @@
+SET(TESTS_FILES
+ bug00208_1
+ bug00208_2
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagescatterex/bug00208.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagescatterex/bug00208.png
new file mode 100644
index 00000000000..eac854aeaeb
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagescatterex/bug00208.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagescatterex/bug00208_1.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagescatterex/bug00208_1.c
new file mode 100644
index 00000000000..4dc8b63e737
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagescatterex/bug00208_1.c
@@ -0,0 +1,55 @@
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im, ex;
+ FILE *fp;
+ gdScatter s;
+ CuTestImageResult r;
+
+ fp = fopen(GDTEST_TOP_DIR "/gdimagescatterex/bug00208.png", "rb");
+ if (!fp) {
+ fprintf(stderr, "could not open file\n");
+ return 1;
+ }
+ im = gdImageCreateFromPng(fp);
+ fclose(fp);
+ if (!im) {
+ fprintf(stderr, "could not create image\n");
+ return 1;
+ }
+
+ s.sub = 1;
+ s.plus = 3;
+ s.seed = 0;
+ s.num_colors = 0;
+ if (!gdImageScatterEx(im, &s)) {
+ gdImageDestroy(im);
+ fprintf(stderr, "could not scatter\n");
+ return 1;
+ }
+
+ fp = fopen(GDTEST_TOP_DIR "/gdimagescatterex/bug00208_1.png", "rb");
+ if (!fp) {
+ fprintf(stderr, "could not open file\n");
+ gdImageDestroy(im);
+ return 1;
+ }
+ ex = gdImageCreateFromPng(fp);
+ fclose(fp);
+ if (!ex) {
+ fprintf(stderr, "could not create image\n");
+ gdImageDestroy(im);
+ return 1;
+ }
+ r.pixels_changed = 0;
+ gdTestImageDiff(im, ex, NULL, &r);
+ gdImageDestroy(ex);
+ gdImageDestroy(im);
+ if (r.pixels_changed > 10000) {
+ fprintf(stderr, "too much diff: %d\n", r.pixels_changed);
+ return 1;
+ }
+ return 0;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagescatterex/bug00208_1.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagescatterex/bug00208_1.png
new file mode 100644
index 00000000000..21ef1240db4
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagescatterex/bug00208_1.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagescatterex/bug00208_2.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagescatterex/bug00208_2.c
new file mode 100644
index 00000000000..90361569df2
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagescatterex/bug00208_2.c
@@ -0,0 +1,57 @@
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im, ex;
+ FILE *fp;
+ gdScatter s;
+ int colors[] = {0xFF0000, 0x00FF00};
+ CuTestImageResult r;
+
+ fp = fopen(GDTEST_TOP_DIR "/gdimagescatterex/bug00208.png", "rb");
+ if (!fp) {
+ fprintf(stderr, "could not open file\n");
+ return 1;
+ }
+ im = gdImageCreateFromPng(fp);
+ fclose(fp);
+ if (!im) {
+ fprintf(stderr, "could not create image\n");
+ return 1;
+ }
+
+ s.sub = 1;
+ s.plus = 3;
+ s.seed = 0;
+ s.num_colors = 2;
+ s.colors = colors;
+ if (!gdImageScatterEx(im, &s)) {
+ gdImageDestroy(im);
+ fprintf(stderr, "could not scatter\n");
+ return 1;
+ }
+
+ fp = fopen(GDTEST_TOP_DIR "/gdimagescatterex/bug00208_2.png", "rb");
+ if (!fp) {
+ fprintf(stderr, "could not open file\n");
+ gdImageDestroy(im);
+ return 1;
+ }
+ ex = gdImageCreateFromPng(fp);
+ fclose(fp);
+ if (!ex) {
+ fprintf(stderr, "could not create image\n");
+ gdImageDestroy(im);
+ return 1;
+ }
+ r.pixels_changed = 0;
+ gdTestImageDiff(im, ex, NULL, &r);
+ gdImageDestroy(ex);
+ gdImageDestroy(im);
+ if (r.pixels_changed > 10000) {
+ fprintf(stderr, "too much diff: %d\n", r.pixels_changed);
+ return 1;
+ }
+ return 0;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagescatterex/bug00208_2.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagescatterex/bug00208_2.png
new file mode 100644
index 00000000000..feb1ede3594
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagescatterex/bug00208_2.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagesetpixel/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagesetpixel/CMakeLists.txt
new file mode 100644
index 00000000000..e5b9b2a0dd3
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagesetpixel/CMakeLists.txt
@@ -0,0 +1,10 @@
+SET(TESTS_FILES
+ bug00186
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagesetpixel/bug00186.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagesetpixel/bug00186.c
new file mode 100644
index 00000000000..efa07b27ec8
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagesetpixel/bug00186.c
@@ -0,0 +1,32 @@
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ gdImagePtr tile;
+ int red, green, blue, other;
+ int i, r = 0;
+
+ im = gdImageCreateTrueColor(100, 100);
+ tile = gdImageCreate(10, 10);
+ red = gdImageColorAllocate(tile, 0xFF, 0, 0);
+ green = gdImageColorAllocate(tile, 0, 0xFF, 0);
+ blue = gdImageColorAllocate(tile, 0, 0, 0xFF);
+ other = gdImageColorAllocate(tile, 0, 0, 0x2);
+ gdImageFilledRectangle(tile, 0, 0, 2, 10, red);
+ gdImageFilledRectangle(tile, 3, 0, 4, 10, green);
+ gdImageFilledRectangle(tile, 5, 0, 7, 10, blue);
+ gdImageFilledRectangle(tile, 8, 0, 9, 10, other);
+ gdImageColorTransparent(tile, blue);
+ gdImageSetTile(im, tile);
+ for (i=0; i<100; i++) {
+ gdImageSetPixel(im, i, i, gdTiled);
+ }
+ if (gdTrueColorGetBlue(gdImageGetPixel(im, 9, 9)) != 0x2) {
+ r = 1;
+ }
+ gdImageDestroy(tile);
+ gdImageDestroy(im);
+ return r;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagestringft/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagestringft/CMakeLists.txt
new file mode 100644
index 00000000000..7ff29cb7662
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagestringft/CMakeLists.txt
@@ -0,0 +1,10 @@
+SET(TESTS_FILES
+ gdimagestringft_bbox
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagestringft/gdimagestringft_bbox.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagestringft/gdimagestringft_bbox.c
new file mode 100644
index 00000000000..01fd73a33c1
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagestringft/gdimagestringft_bbox.c
@@ -0,0 +1,81 @@
+#include "gd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "gdtest.h"
+
+#define PI 3.141592
+#define DELTA (PI/8)
+
+static int EXPECT[16][8] = {
+ {498, 401, 630, 401, 630, 374, 498, 374},
+ {491, 364, 613, 313, 602, 288, 481, 338},
+ {470, 332, 563, 239, 544, 219, 451, 312},
+ {438, 310, 488, 189, 463, 178, 412, 300},
+ {401, 303, 401, 171, 374, 171, 374, 303},
+ {365, 310, 314, 188, 289, 199, 339, 320},
+ {334, 331, 241, 238, 221, 257, 314, 350},
+ {313, 362, 192, 312, 181, 337, 303, 388},
+ {306, 398, 174, 398, 174, 425, 306, 425},
+ {313, 433, 191, 484, 202, 509, 323, 459},
+ {333, 463, 240, 556, 259, 576, 352, 483},
+ {363, 484, 313, 605, 338, 616, 389, 494},
+ {398, 490, 398, 622, 425, 622, 425, 490},
+ {432, 483, 483, 605, 508, 594, 458, 473},
+ {461, 464, 554, 557, 574, 538, 481, 445},
+ {481, 435, 602, 485, 613, 460, 491, 409},
+};
+
+int main()
+{
+ char path[2048];
+ gdImagePtr im;
+ int black;
+ double cos_t, sin_t;
+ int x, y, temp;
+ int i, j;
+ int brect[8];
+ int error = 0;
+ FILE *fp;
+
+ sprintf(path, "%s/freetype/DejaVuSans.ttf", GDTEST_TOP_DIR);
+ im = gdImageCreate(800, 800);
+ gdImageColorAllocate(im, 0xFF, 0xFF, 0xFF); /* allocate white for background color */
+ black = gdImageColorAllocate(im, 0, 0, 0);
+ cos_t = cos(DELTA);
+ sin_t = sin(DELTA);
+ x = 100;
+ y = 0;
+ for (i = 0; i < 16; i++) {
+ if (gdImageStringFT(im, brect, black, path, 24, DELTA*i, 400+x, 400+y, "ABCDEF")) {
+ error = 1;
+ goto done;
+ }
+ for (j = 0; j < 8; j++) {
+ if (brect[j] != EXPECT[i][j]) {
+ printf("(%d, %d) (%d, %d) (%d, %d) (%d, %d) expected, but (%d, %d) (%d, %d) (%d, %d) (%d, %d)\n",
+ EXPECT[i][0], EXPECT[i][1], EXPECT[i][2], EXPECT[i][3],
+ EXPECT[i][4], EXPECT[i][5], EXPECT[i][6], EXPECT[i][7],
+ brect[0], brect[1], brect[2], brect[3],
+ brect[4], brect[5], brect[6], brect[7]);
+ error = 1;
+ goto done;
+ }
+ }
+ gdImagePolygon(im, (gdPointPtr)brect, 4, black);
+ gdImageFilledEllipse(im, brect[0], brect[1], 8, 8, black);
+ temp = (int)(cos_t * x + sin_t * y);
+ y = (int)(cos_t * y - sin_t * x);
+ x = temp;
+ }
+ fp = fopen("gdimagestringft_bbox.png", "wb");
+ if (!fp) {
+ error = 1;
+ goto done;
+ }
+ gdImagePng(im, fp);
+ fclose(fp);
+done:
+ gdImageDestroy(im);
+ return error;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagestringftex/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagestringftex/CMakeLists.txt
new file mode 100644
index 00000000000..7252bd24c92
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagestringftex/CMakeLists.txt
@@ -0,0 +1,10 @@
+SET(TESTS_FILES
+ gdimagestringftex_returnfontpathname
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdimagestringftex/gdimagestringftex_returnfontpathname.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagestringftex/gdimagestringftex_returnfontpathname.c
new file mode 100644
index 00000000000..f91485b7717
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdimagestringftex/gdimagestringftex_returnfontpathname.c
@@ -0,0 +1,22 @@
+#include <string.h>
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdFTStringExtra strex;
+ char path[2048];
+
+ sprintf(path, "%s/freetype/DejaVuSans.ttf", GDTEST_TOP_DIR);
+ strex.flags = gdFTEX_RETURNFONTPATHNAME;
+ strex.fontpath = NULL;
+ gdImageStringFTEx(NULL, NULL, 0, path, 72, 0, 0, 0, "hello, gd", &strex);
+ if (!strex.fontpath) {
+ return 1;
+ }
+ if (strcmp(path, strex.fontpath) != 0) {
+ return 2;
+ }
+ gdFree(strex.fontpath);
+ return 0;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdnewfilectx/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gdnewfilectx/CMakeLists.txt
new file mode 100644
index 00000000000..75de828d94a
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdnewfilectx/CMakeLists.txt
@@ -0,0 +1,10 @@
+SET(TESTS_FILES
+ gdnewfilectx_null
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdnewfilectx/gdnewfilectx_null.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdnewfilectx/gdnewfilectx_null.c
new file mode 100644
index 00000000000..0da8295ab5c
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdnewfilectx/gdnewfilectx_null.c
@@ -0,0 +1,7 @@
+#include "gd.h"
+
+int main()
+{
+ if (gdNewFileCtx(NULL) != NULL) return 1;
+ return 0;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdtest/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gdtest/CMakeLists.txt
new file mode 100644
index 00000000000..5f89bc91b75
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdtest/CMakeLists.txt
@@ -0,0 +1,4 @@
+SET(GDTEST_TOP_DIR "${GD_SOURCE_DIR}/tests")
+CONFIGURE_FILE(test_config.h.cmake test_config.h ESCAPE_QUOTES)
+add_library (gdTest STATIC gdtest.c)
+target_link_libraries(gdTest ${GD_LIB})
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdtest/gdtest.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdtest/gdtest.c
new file mode 100644
index 00000000000..d84b7896d7a
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdtest/gdtest.c
@@ -0,0 +1,227 @@
+#include <assert.h>
+#include <setjmp.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include "gd.h"
+
+#include "gdtest.h"
+#include "test_config.h"
+
+void gdSilence(int priority, const char *format, va_list args)
+{
+ (void)priority;
+ (void)format;
+ (void)args;
+}
+
+gdImagePtr gdTestImageFromPng(const char *filename)
+{
+ gdImagePtr image;
+
+ FILE *fp;
+
+ fp = fopen(filename, "rb");
+
+ if (!fp) {
+ return NULL;
+ }
+ image = gdImageCreateFromPng(fp);
+ fclose(fp);
+ return image;
+}
+
+/* Compare two buffers, returning the number of pixels that are
+ * different and the maximum difference of any single color channel in
+ * result_ret.
+ *
+ * This function should be rewritten to compare all formats supported by
+ * cairo_format_t instead of taking a mask as a parameter.
+ */
+void gdTestImageDiff(gdImagePtr buf_a, gdImagePtr buf_b,
+ gdImagePtr buf_diff, CuTestImageResult *result_ret)
+{
+ int x, y;
+ int c1, c2;
+
+ for (y = 0; y < gdImageSY(buf_a); y++) {
+ for (x = 0; x < gdImageSX(buf_a); x++) {
+ c1 = gdImageGetTrueColorPixel(buf_a, x, y);
+ c2 = gdImageGetTrueColorPixel(buf_b, x, y);
+
+ /* check if the pixels are the same */
+ if (c1 != c2) {
+ int r1,b1,g1,a1,r2,b2,g2,a2;
+ unsigned int diff_a,diff_r,diff_g,diff_b;
+
+ a1 = gdTrueColorGetAlpha(c1);
+ a2 = gdTrueColorGetAlpha(c2);
+ diff_a = abs (a1 - a2);
+ diff_a *= 4; /* emphasize */
+
+ if (diff_a) {
+ diff_a += 128; /* make sure it's visible */
+ }
+ if (diff_a > gdAlphaMax) {
+ diff_a = gdAlphaMax/2;
+ }
+
+ r1 = gdTrueColorGetRed(c1);
+ r2 = gdTrueColorGetRed(c2);
+ diff_r = abs (r1 - r2);
+ /* diff_r *= 4; /* emphasize */
+ if (diff_r) {
+ diff_r += gdRedMax/2; /* make sure it's visible */
+ }
+ if (diff_r > 255) {
+ diff_r = 255;
+ }
+
+ g1 = gdTrueColorGetGreen(c1);
+ g2 = gdTrueColorGetGreen(c2);
+ diff_g = abs (g1 - g2);
+ diff_g *= 4; /* emphasize */
+ if (diff_g) {
+ diff_g += gdGreenMax/2; /* make sure it's visible */
+ }
+ if (diff_g > 255) {
+ diff_g = 255;
+ }
+
+ b1 = gdTrueColorGetBlue(c1);
+ b2 = gdTrueColorGetBlue(c2);
+ diff_b = abs (b1 - b2);
+ diff_b *= 4; /* emphasize */
+ if (diff_b) {
+ diff_b += gdBlueMax/2; /* make sure it's visible */
+ }
+ if (diff_b > 255) {
+ diff_b = 255;
+ }
+
+ result_ret->pixels_changed++;
+ if (buf_diff) gdImageSetPixel(buf_diff, x,y, gdTrueColorAlpha(diff_r, diff_g, diff_b, diff_a));
+ } else {
+ if (buf_diff) gdImageSetPixel(buf_diff, x,y, gdTrueColorAlpha(255,255,255,0));
+ }
+ }
+ }
+}
+
+int gdTestImageCompareToImage(const char* file, unsigned int line, const char* message,
+ gdImagePtr expected, gdImagePtr actual)
+{
+ unsigned int width_a, height_a;
+ unsigned int width_b, height_b;
+ gdImagePtr surface_diff = NULL;
+ CuTestImageResult result = {0, 0};
+
+ (void)message;
+
+ if (!actual) {
+ _gdTestErrorMsg(file, line, "Image is NULL\n");
+ goto fail;
+ }
+
+ width_a = gdImageSX(expected);
+ height_a = gdImageSY(expected);
+ width_b = gdImageSX(actual);
+ height_b = gdImageSY(actual);
+
+ if (width_a != width_b || height_a != height_b) {
+ _gdTestErrorMsg(file, line,
+ "Image size mismatch: (%ux%u) vs. (%ux%u)\n for %s vs. buffer\n",
+ width_a, height_a,
+ width_b, height_b,
+ file);
+ goto fail;
+ }
+
+ surface_diff = gdImageCreateTrueColor(width_a, height_a);
+
+ gdTestImageDiff(expected, actual, surface_diff, &result);
+ if (result.pixels_changed>0) {
+ char file_diff[255];
+ char file_out[1024];
+ FILE *fp;
+ int len, p;
+
+ _gdTestErrorMsg(file, line,
+ "Total pixels changed: %d with a maximum channel difference of %d.\n",
+ result.pixels_changed,
+ result.max_diff
+ );
+
+ p = len = strlen(file);
+ p--;
+
+ /* Use only the filename (and store it in the bld dir not the src dir
+ */
+ while(p > 0 && (file[p] != '/' && file[p] != '\\')) {
+ p--;
+ }
+ sprintf(file_diff, "%s_%u_diff.png", file + p + 1, line);
+ sprintf(file_out, "%s_%u_out.png", file + p + 1, line);
+
+ fp = fopen(file_diff, "wb");
+ if (!fp) goto fail;
+ gdImagePng(surface_diff,fp);
+ fclose(fp);
+
+ fp = fopen(file_out, "wb");
+ if (!fp) goto fail;
+ gdImagePng(actual, fp);
+ fclose(fp);
+ } else {
+ if (surface_diff) {
+ gdImageDestroy(surface_diff);
+ }
+ return 1;
+ }
+
+fail:
+ if (surface_diff) {
+ gdImageDestroy(surface_diff);
+ }
+ return 0;
+}
+
+int gdTestImageCompareToFile(const char* file, unsigned int line, const char* message,
+ const char *expected_file, gdImagePtr actual)
+{
+ gdImagePtr expected;
+ int res = 1;
+
+ expected = gdTestImageFromPng(expected_file);
+
+ if (!expected) {
+ _gdTestErrorMsg(file, line, "Cannot open PNG <%s>", expected_file);
+ res = 0;
+ } else {
+ res = gdTestImageCompareToImage(file, line, message, expected, actual);
+ gdImageDestroy(expected);
+ }
+ return res;
+}
+
+int _gdTestAssert(const char* file, unsigned int line, const char* message, int condition)
+{
+ if (condition) return 1;
+ _gdTestErrorMsg(file, line, "%s", message);
+ return 0;
+}
+
+int _gdTestErrorMsg(const char* file, unsigned int line, const char* format, ...) /* {{{ */
+{
+ va_list args;
+ char output_buf[GDTEST_STRING_MAX];
+
+ va_start(args, format);
+ vsnprintf(output_buf, sizeof(output_buf), format, args);
+ va_end(args);
+ fprintf(stderr, "%s:%u: %s", file, line, output_buf);
+ fflush(stderr);
+ return 0;
+}
+/* }}} */
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdtest/gdtest.h b/Build/source/libs/gd/libgd-2.1.0/tests/gdtest/gdtest.h
new file mode 100644
index 00000000000..81bded5a0f6
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdtest/gdtest.h
@@ -0,0 +1,44 @@
+#ifndef GD_TEST_H
+#define GD_TEST_H
+
+#include <stdarg.h>
+#include "test_config.h"
+
+#define GDTEST_STRING_MAX 1024
+typedef struct CuTestImageResult CuTestImageResult;
+struct CuTestImageResult {
+ unsigned int pixels_changed;
+ unsigned int max_diff;
+};
+
+
+/* Internal versions of assert functions -- use the public versions */
+gdImagePtr gdTestImageFromPng(const char *filename);
+
+void gdTestImageDiff(gdImagePtr buf_a, gdImagePtr buf_b,
+ gdImagePtr buf_diff, CuTestImageResult *result_ret);
+
+int gdTestImageCompareToImage(const char* file, unsigned int line, const char* message,
+ gdImagePtr expected, gdImagePtr actual);
+
+int gdTestImageCompareToFile(const char* file, unsigned int line, const char* message,
+ const char *expected_file, gdImagePtr actual);
+
+int _gdTestAssert(const char* file, unsigned int line, const char* message, int condition);
+
+int _gdTestErrorMsg(const char* file, unsigned int line, const char* string, ...);
+
+/* public assert functions */
+#define gdAssertImageEqualsToFile(ex,ac) gdTestImageCompareToFile(__FILE__,__LINE__,NULL,(ex),(ac))
+#define gdAssertImageFileEqualsMsg(ex,ac) gdTestImageCompareFiles(__FILE__,__LINE__,(ms),(ex),(ac))
+
+#define gdAssertImageEquals(tc,ex,ac) CuAssertImageEquals_LineMsg((tc),__FILE__,__LINE__,NULL,(ex),(ac))
+#define gdAssertImageEqualsMsg(tc,ex,ac) CuAssertImageEquals_LineMsg((tc),__FILE__,__LINE__,(ms),(ex),(ac))
+
+#define gdTestAssert(cond) _gdTestAssert(__FILE__, __LINE__, "assert failed in <%s:%i>\n", (cond))
+
+#define gdTestErrorMsg(...) _gdTestErrorMsg(__FILE__, __LINE__, __VA_ARGS__)
+
+void gdSilence(int priority, const char *format, va_list args);
+
+#endif /* GD_TEST_H */
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdtest/test_config.h.cmake b/Build/source/libs/gd/libgd-2.1.0/tests/gdtest/test_config.h.cmake
new file mode 100644
index 00000000000..59d2f0cf7ed
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdtest/test_config.h.cmake
@@ -0,0 +1,4 @@
+/* Define the full path to the top src dir, required to get the path
+ * of each input data */
+#cmakedefine GDTEST_TOP_DIR "@GDTEST_TOP_DIR@"
+
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdtiled/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gdtiled/CMakeLists.txt
new file mode 100644
index 00000000000..90e15da34ea
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdtiled/CMakeLists.txt
@@ -0,0 +1,10 @@
+SET(TESTS_FILES
+ bug00032
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdtiled/bug00032.c b/Build/source/libs/gd/libgd-2.1.0/tests/gdtiled/bug00032.c
new file mode 100644
index 00000000000..0e711533f10
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdtiled/bug00032.c
@@ -0,0 +1,41 @@
+#include "gd.h"
+#include <stdio.h>
+#include "gdtest.h"
+
+#define exp_img "bug00032_exp.png"
+
+#ifdef _MSC_VER
+# define snprintf _snprintf
+#endif
+
+int main()
+{
+ gdImagePtr im, tile;
+ char path[GDTEST_STRING_MAX];
+
+ gdSetErrorMethod(gdSilence);
+
+ snprintf(path, GDTEST_STRING_MAX - 1, "%s/gdtiled/%s", GDTEST_TOP_DIR, exp_img);
+
+ tile = gdImageCreateTrueColor(10, 10);
+ gdImageFill(tile, 0, 0, 0xFFFFFF);
+ gdImageLine(tile, 0,0, 9,9, 0xff0000);
+ gdImageColorTransparent(tile, 0xFFFFFF);
+
+ im = gdImageCreateTrueColor(50, 50);
+ gdImageFilledRectangle(im, 0, 0, 25, 25, 0x00FF00);
+
+ gdImageSetTile(im, tile);
+ gdImageFilledRectangle(im, 10, 10, 49, 49, gdTiled);
+
+ if (!gdAssertImageEqualsToFile(path, im)) {
+ gdImageDestroy(im);
+ gdImageDestroy(tile);
+ return 1;
+ }
+
+ gdImageDestroy(im);
+ gdImageDestroy(tile);
+ return 0;
+}
+
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gdtiled/bug00032_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gdtiled/bug00032_exp.png
new file mode 100644
index 00000000000..2bee38eebad
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gdtiled/bug00032_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gif/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/gif/CMakeLists.txt
new file mode 100644
index 00000000000..a155559cc12
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gif/CMakeLists.txt
@@ -0,0 +1,19 @@
+
+SET(TESTS_FILES
+ gif_im2im
+ gif_null
+ bug00005
+ bug00005_2
+ bug00006
+ bug00060
+ bug00066
+ bug00181
+ bug00227
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005.c b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005.c
new file mode 100644
index 00000000000..1911e6a17a9
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005.c
@@ -0,0 +1,46 @@
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ char * giffiles[4] = {"bug00005_0.gif", "bug00005_1.gif", "bug00005_2.gif", "bug00005_3.gif"};
+ int valid[4] = {0, 0, 0, 0};
+ char *exp[4] = {NULL, NULL, "bug00005_2_exp.png", NULL};
+ const int files_cnt = 4;
+ FILE *fp;
+ int i = 0;
+ int error = 0;
+ char path[1024];
+
+ for (i=0; i < files_cnt; i++) {
+ sprintf(path, "%s/gif/%s", GDTEST_TOP_DIR, giffiles[i]);
+
+ fp = fopen(path, "rb");
+ if (!fp) {
+ gdTestErrorMsg("<%s> Input file does not exist!\n", path);
+ return 1;
+ }
+
+ im = gdImageCreateFromGif(fp);
+ fclose(fp);
+
+ if (valid[i]) {
+ if (!im) {
+ error = 1;
+ } else {
+ sprintf(path, "%s/gif/%s", GDTEST_TOP_DIR, exp[i]);
+ if (!gdAssertImageEqualsToFile(path, im)) {
+ error = 1;
+ }
+ gdImageDestroy(im);
+ }
+ } else {
+ if (!gdTestAssert(im == NULL)) {
+ error = 1;
+ }
+ }
+ }
+
+ return error;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005_0.gif b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005_0.gif
new file mode 100644
index 00000000000..753156014d4
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005_0.gif
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005_1.gif b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005_1.gif
new file mode 100644
index 00000000000..76ce1e398ec
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005_1.gif
@@ -0,0 +1,4 @@
+GIF89a
+<
+
+¿´°É, ÎÒ¶¼Ëµ¹ýÂ˲»ÑÏÁË \ No newline at end of file
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005_2.c b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005_2.c
new file mode 100644
index 00000000000..de7d3d17f97
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005_2.c
@@ -0,0 +1,455 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "gd.h"
+
+static const unsigned char gifdata[8994] = {71,73,70,56,55,97,20,1,110,
+ 0,247,0,0,247,247,247,255,251,255,231,231,231,214,211,214,239,235,239,
+ 206,203,206,173,20,0,222,219,222,24,69,173,24,73,181,16,52,132,16,60,
+ 148,198,24,0,181,178,181,247,243,247,140,16,0,198,190,189,189,186,189,
+ 24,77,198,231,227,231,239,239,239,198,195,198,247,243,239,189,190,189,
+ 198,199,198,8,81,8,206,207,206,8,36,99,33,89,214,214,36,8,214,215,214,
+ 24,81,206,156,158,156,239,186,0,222,223,222,0,101,0,214,174,0,99,150,
+ 239,49,101,214,74,125,231,8,60,165,181,182,181,156,154,156,115,162,239,
+ 222,223,231,57,113,222,107,12,0,0,125,8,255,207,0,189,182,189,173,166,
+ 173,165,162,165,231,73,49,41,81,181,255,117,99,189,150,0,90,138,239,165,
+ 166,165,16,69,181,173,170,173,198,158,0,173,174,173,247,105,82,231,60,
+ 33,253,253,253,239,89,66,99,211,99,222,48,24,90,203,90,181,36,16,132,
+ 170,247,249,249,249,148,121,0,16,150,24,181,142,0,132,105,0,99,81,0,41,
+ 73,148,173,134,0,189,44,24,107,44,33,49,182,57,165,130,0,173,199,247,
+ 206,60,41,165,190,239,173,170,165,198,215,255,189,227,189,99,121,164,
+ 107,211,115,247,134,115,255,239,8,90,105,124,140,32,16,148,65,49,132,
+ 134,148,247,150,132,148,146,140,115,121,140,198,146,140,165,166,173,189,
+ 207,239,206,213,214,41,65,107,132,125,115,217,215,203,234,234,234,123,
+ 77,66,239,242,247,148,174,222,203,206,214,74,97,148,132,154,214,222,219,
+ 214,247,251,255,123,134,173,165,134,123,23,64,154,140,146,148,57,186,66,
+ 181,178,173,165,170,173,24,162,33,107,105,107,66,195,74,218,229,255,82,
+ 109,173,198,199,206,156,101,90,123,101,82,73,85,115,59,89,147,123,219,
+ 132,132,146,181,247,223,90,231,235,239,206,174,165,89,129,214,214,182,
+ 181,165,182,214,210,210,210,247,186,173,222,227,231,57,97,181,247,166,
+ 156,148,158,181,231,231,239,194,194,195,181,182,189,217,217,217,181,69,
+ 49,255,247,255,247,247,255,198,117,107,214,219,231,214,219,221,225,225,
+ 225,173,150,140,206,199,198,132,117,57,33,170,41,181,186,198,244,244,
+ 244,156,134,66,181,195,222,255,235,231,231,228,222,206,235,206,231,219,
+ 222,173,178,181,247,215,41,181,162,99,168,167,167,90,117,90,181,166,140,
+ 255,203,198,115,142,206,192,191,191,239,231,231,170,146,49,247,215,206,
+ 189,158,16,255,247,132,241,241,241,255,255,247,206,211,231,185,184,185,
+ 181,89,74,25,57,127,222,203,140,239,199,41,13,55,146,206,195,165,214,
+ 101,90,255,239,49,222,203,198,165,174,189,231,235,255,206,174,41,222,
+ 186,66,12,50,133,201,201,201,255,243,181,178,177,178,181,170,165,239,
+ 247,239,255,243,239,255,255,239,156,211,165,255,247,247,180,179,178,247,
+ 231,214,140,203,140,239,227,148,222,239,222,165,164,163,173,142,16,239,
+ 235,231,255,251,222,214,215,222,247,247,239,10,45,119,90,170,99,25,77,
+ 189,140,174,140,222,215,214,162,160,160,123,150,123,146,148,154,66,142,
+ 66,22,74,190,41,93,49,24,121,33,154,153,153,197,196,193,157,154,153,166,
+ 163,160,215,212,209,3,26,76,11,34,87,148,147,149,42,62,109,152,155,165,
+ 43,98,218,155,153,151,155,182,242,145,172,230,154,155,159,209,221,243,
+ 247,235,247,133,133,139,184,181,176,24,46,97,243,244,246,255,255,255,44,
+ 0,0,0,0,20,1,110,0,0,8,255,0,255,9,28,72,176,160,193,131,8,19,42,92,200,
+ 176,161,195,135,16,35,74,156,72,177,162,197,139,24,51,106,220,200,177,
+ 163,199,143,32,67,138,28,73,178,164,201,147,40,83,170,92,201,178,165,
+ 203,151,48,99,202,156,73,179,166,205,155,56,115,234,220,201,179,167,207,
+ 159,64,131,10,29,74,180,168,81,154,136,190,41,253,70,132,136,22,45,133,
+ 162,22,194,114,180,170,213,151,156,204,141,120,241,34,73,168,62,66,158,
+ 106,9,75,245,170,217,133,153,140,93,49,51,165,138,219,42,83,204,92,49,
+ 54,231,236,193,0,0,48,233,213,218,245,43,212,168,66,250,68,193,19,205,
+ 153,221,179,20,116,85,41,113,194,4,7,9,9,18,232,152,28,57,129,4,14,38,
+ 20,25,49,147,233,48,94,11,4,38,16,168,144,97,107,146,40,78,11,85,139,
+ 198,186,90,181,178,135,137,226,221,196,72,145,227,15,184,63,64,78,128,
+ 162,183,111,223,146,117,124,48,81,98,138,49,179,1,28,8,56,160,161,64,1,
+ 116,165,95,236,193,211,52,154,62,76,177,171,78,114,211,130,195,7,14,224,
+ 193,75,255,144,160,163,55,130,38,132,224,252,249,3,135,80,147,5,11,80,
+ 32,184,204,225,196,138,43,86,147,11,240,128,33,70,10,232,35,140,224,21,
+ 30,120,84,147,138,0,22,0,144,221,80,186,196,226,29,110,225,237,38,31,33,
+ 89,72,82,9,6,26,168,225,129,28,28,14,0,136,36,89,16,2,95,13,152,181,80,
+ 2,126,71,129,118,64,5,13,244,0,93,116,123,12,166,197,1,44,16,160,224,
+ 130,63,109,162,200,120,16,122,183,219,121,89,148,1,65,5,16,64,112,193,
+ 145,69,14,137,161,28,34,28,32,74,22,35,154,208,130,125,126,24,21,0,5,34,
+ 176,40,131,43,25,192,136,71,31,90,164,82,227,141,56,234,132,151,33,8,
+ 160,96,89,110,227,241,134,64,144,41,52,32,103,4,116,214,105,231,5,69,98,
+ 48,128,8,128,100,161,192,2,53,76,137,67,21,157,17,165,220,0,41,108,217,
+ 229,86,95,17,81,8,1,20,56,64,102,153,56,29,208,132,2,10,200,103,217,143,
+ 40,16,162,130,156,13,164,144,39,6,164,146,58,100,157,49,248,119,164,6,
+ 114,84,66,136,2,8,152,255,112,2,14,43,84,57,84,0,251,37,202,101,116,95,
+ 9,81,136,3,120,81,154,19,94,19,192,177,193,6,127,34,96,153,155,89,88,33,
+ 231,5,21,96,56,192,1,7,136,96,237,1,26,14,208,28,4,254,197,217,64,12,24,
+ 142,177,193,2,144,204,90,130,25,183,98,201,98,26,139,190,208,107,33,216,
+ 9,155,19,104,44,12,48,200,177,201,78,86,195,29,161,66,160,193,180,19,32,
+ 8,105,130,160,81,0,218,181,26,96,112,65,139,45,70,160,1,24,200,6,90,66,
+ 113,66,1,96,193,1,16,52,192,46,175,96,193,43,47,78,42,42,156,199,189,
+ 200,198,87,131,10,162,22,224,129,104,145,254,19,64,0,46,199,236,50,0,22,
+ 19,32,128,28,3,84,16,129,156,50,52,128,193,29,17,155,88,66,21,62,189,
+ 236,50,150,25,111,204,104,199,147,126,252,146,209,120,9,48,192,5,59,204,
+ 0,2,201,10,52,33,195,5,42,215,40,233,66,80,31,189,92,1,25,91,145,195,
+ 214,226,42,80,195,9,19,79,1,84,114,44,96,208,0,24,237,190,27,175,211,52,
+ 29,74,181,10,124,223,255,155,117,4,123,18,240,181,68,120,133,54,64,198,
+ 85,231,16,65,23,17,179,77,113,209,14,28,32,247,29,117,119,236,0,222,53,
+ 133,220,192,12,124,131,192,184,2,89,8,222,52,225,14,16,112,64,1,41,88,
+ 61,67,15,104,140,107,2,14,19,219,218,19,0,19,20,208,0,229,48,130,165,
+ 133,5,152,215,164,220,138,155,131,48,67,30,116,16,82,67,41,26,93,57,118,
+ 10,57,204,144,3,208,27,196,10,251,10,133,238,132,215,233,41,136,209,238,
+ 30,186,243,222,251,76,250,1,111,197,14,128,159,178,201,38,28,209,139,65,
+ 234,32,200,224,247,218,19,27,209,19,177,168,107,159,123,88,163,127,239,
+ 82,114,166,235,44,234,0,4,216,8,212,126,87,129,30,88,77,12,199,90,192,
+ 235,86,80,2,217,233,132,118,168,83,193,246,116,103,24,253,129,175,116,
+ 204,193,64,1,0,152,63,140,232,205,10,237,123,159,137,86,32,63,235,65,48,
+ 5,18,188,159,22,42,104,193,153,28,140,90,19,160,64,7,47,2,183,245,89,13,
+ 98,174,163,213,125,120,162,28,13,196,32,133,91,153,78,88,255,88,216,66,
+ 23,18,224,136,51,164,33,6,11,168,2,16,180,78,109,38,50,130,17,234,114,
+ 16,0,240,65,4,120,225,3,11,60,192,135,46,34,4,106,212,112,68,36,194,176,
+ 133,45,132,33,18,142,160,134,68,148,19,193,237,225,97,136,63,217,198,50,
+ 110,113,136,58,214,241,22,203,216,6,52,72,98,10,88,140,177,140,101,12,
+ 131,35,106,241,12,1,210,76,36,81,211,64,240,62,167,64,28,24,161,86,8,
+ 153,0,31,48,240,15,8,240,225,0,22,136,1,31,12,134,144,89,132,65,24,52,8,
+ 101,40,127,240,131,33,144,50,8,97,168,133,67,162,214,70,47,57,229,26,5,
+ 97,68,44,98,17,135,90,74,81,138,111,129,203,20,118,201,203,43,248,161,
+ 13,31,209,134,47,126,1,131,98,194,32,4,200,76,102,8,126,113,136,91,236,
+ 177,35,169,248,100,16,70,73,202,33,116,160,3,67,24,2,13,124,16,9,83,240,
+ 4,102,87,90,81,213,210,144,192,181,145,144,104,7,145,36,4,2,144,134,28,
+ 76,224,31,23,224,195,93,0,64,6,107,254,64,148,165,236,64,17,246,201,255,
+ 128,107,254,192,6,170,100,8,0,4,208,202,32,82,71,11,176,140,217,149,36,
+ 177,128,76,169,105,60,37,50,215,196,38,134,131,19,88,116,86,70,184,66,
+ 245,44,114,10,100,32,179,152,200,36,1,9,120,96,139,146,222,224,6,60,32,
+ 65,8,96,112,136,109,104,36,21,194,200,230,61,105,144,207,34,60,225,166,
+ 69,48,64,63,181,185,5,53,242,132,118,138,228,220,19,17,16,69,35,28,199,
+ 32,26,224,3,1,26,112,201,119,90,242,32,169,184,196,78,171,217,129,39,
+ 240,130,12,137,88,68,34,200,112,137,125,242,212,155,10,233,97,12,64,224,
+ 198,87,202,44,88,19,160,67,67,227,51,31,204,152,139,129,37,168,168,99,
+ 30,3,209,19,24,149,34,201,241,133,74,149,41,82,91,176,34,24,159,200,144,
+ 26,130,193,138,108,40,129,7,43,61,196,51,35,2,78,10,104,162,3,12,48,37,
+ 85,159,160,137,172,106,128,24,159,72,132,38,114,138,77,26,132,1,172,53,
+ 129,217,204,164,118,1,25,56,17,89,210,147,34,186,12,162,177,127,8,143,0,
+ 148,204,129,60,11,66,140,39,255,48,160,159,216,132,236,37,154,113,6,78,
+ 208,8,17,109,64,68,34,190,80,4,42,252,192,7,176,80,200,64,7,16,1,32,118,
+ 229,160,9,197,139,114,2,102,129,62,101,225,186,116,128,132,4,164,116,
+ 209,22,56,230,15,113,96,4,35,36,241,135,182,158,160,10,84,132,200,41,
+ 142,33,82,190,242,128,21,16,56,131,7,6,48,45,22,76,2,75,175,200,198,13,
+ 72,0,131,97,44,131,34,226,160,194,109,177,105,77,125,6,226,2,103,72,48,
+ 181,30,1,220,3,144,193,11,197,61,110,114,135,69,129,21,153,205,111,11,
+ 224,0,173,140,128,206,130,16,160,80,162,13,86,65,82,241,4,157,226,22,
+ 178,129,16,5,145,134,228,28,149,33,226,17,129,48,0,21,104,16,4,71,36,
+ 100,185,99,109,87,18,14,138,138,129,76,87,91,27,164,47,171,36,161,172,
+ 203,152,192,49,18,128,68,49,6,112,138,89,12,236,13,229,149,18,36,31,162,
+ 6,91,164,116,175,125,125,133,145,144,84,129,22,79,139,0,106,160,133,19,
+ 248,203,133,91,72,100,17,69,184,237,137,25,80,4,79,108,121,255,72,16,32,
+ 213,6,15,208,134,79,124,65,198,52,142,196,3,107,215,0,25,48,210,156,82,
+ 188,156,68,44,118,9,3,232,244,154,144,229,197,183,184,76,36,57,31,0,198,
+ 50,14,130,15,108,124,144,67,69,128,172,209,217,177,83,80,209,216,45,22,
+ 64,97,17,136,65,3,46,64,135,100,141,103,60,58,248,3,215,228,252,175,3,
+ 32,136,14,177,98,27,138,24,162,6,148,94,89,164,36,176,133,226,34,16,231,
+ 82,193,217,209,7,32,197,152,97,80,102,176,129,243,31,139,48,244,128,33,
+ 203,102,79,48,58,206,43,150,115,147,238,76,5,73,235,153,38,33,6,0,1,166,
+ 182,131,180,41,32,1,81,156,50,67,178,77,207,7,60,224,208,215,164,194,
+ 168,53,248,175,230,232,12,79,16,208,16,113,183,137,220,42,74,237,210,58,
+ 230,177,64,146,131,165,109,249,103,110,152,90,0,2,116,16,153,84,167,128,
+ 215,165,234,242,156,181,81,222,22,192,110,214,9,81,131,126,121,112,235,
+ 145,190,2,90,210,202,150,187,35,0,111,109,129,66,10,100,54,115,67,62,97,
+ 104,19,171,153,1,110,255,134,64,1,254,165,241,156,113,188,72,30,40,0,20,
+ 188,80,109,110,230,164,194,5,244,182,244,86,176,130,213,62,36,57,7,240,
+ 130,185,15,157,77,50,204,57,96,4,176,214,0,200,230,31,135,205,224,1,79,
+ 144,180,13,64,235,227,123,99,218,52,250,222,183,182,39,0,100,12,148,97,
+ 173,69,30,79,13,122,112,1,118,107,43,97,120,170,0,198,0,197,54,113,27,
+ 132,118,180,80,2,74,113,45,82,248,22,128,70,162,57,162,0,4,192,117,166,
+ 167,32,5,111,104,198,18,156,16,2,46,20,219,32,80,11,0,137,149,125,114,6,
+ 104,194,57,129,59,98,192,248,190,116,110,249,231,13,79,47,194,54,109,64,
+ 233,208,226,124,110,200,130,213,2,87,224,182,159,59,160,13,117,112,129,
+ 234,207,221,89,181,67,74,82,52,163,151,203,229,4,8,54,60,128,10,62,176,
+ 65,24,246,173,245,123,59,87,211,66,232,241,64,94,182,117,230,192,33,89,
+ 155,26,143,36,156,67,35,190,55,233,211,23,56,184,6,224,208,200,18,76,
+ 241,46,14,96,133,20,228,94,241,99,64,192,3,53,74,208,255,141,10,183,28,
+ 13,64,192,91,128,0,197,18,110,64,108,46,252,119,158,0,8,196,185,77,126,
+ 219,75,0,98,101,71,28,156,116,199,118,126,57,97,192,246,81,103,3,0,101,
+ 19,112,195,34,16,131,41,8,80,31,60,215,97,227,134,65,80,160,122,46,96,
+ 110,69,208,1,52,48,38,5,17,123,82,131,56,162,144,6,46,240,4,52,32,128,
+ 201,149,109,86,167,99,168,17,124,136,7,0,20,48,11,197,128,124,18,144,27,
+ 89,160,50,175,39,41,178,231,63,16,0,6,106,227,56,165,71,16,201,17,12,82,
+ 224,4,135,69,119,36,144,8,43,51,56,5,129,23,203,133,56,217,195,4,32,71,
+ 108,195,128,16,52,147,8,67,71,127,12,208,12,156,48,1,68,168,131,52,115,
+ 111,13,176,3,49,144,122,52,151,123,91,112,55,50,81,128,160,23,112,245,
+ 81,2,43,192,128,11,97,49,181,35,8,16,24,129,58,53,4,226,160,92,164,213,
+ 34,98,224,2,95,104,3,91,112,129,190,71,130,68,96,130,111,71,1,197,130,
+ 124,185,193,1,162,112,10,54,130,133,203,85,64,183,227,58,104,255,184,2,
+ 192,52,124,14,48,1,180,208,131,115,183,87,200,192,9,8,178,134,22,112,
+ 111,59,96,54,76,176,126,133,119,120,4,97,49,143,240,5,243,183,108,12,
+ 192,11,154,40,104,9,1,55,220,102,54,80,0,117,65,32,128,157,55,134,3,229,
+ 67,7,248,39,28,224,112,214,247,16,203,117,1,61,32,6,130,240,128,112,200,
+ 0,52,16,9,133,116,23,234,210,0,32,52,139,1,104,3,19,38,16,203,133,111,
+ 153,86,130,194,119,129,181,131,6,132,136,27,138,96,129,136,23,57,114,
+ 195,57,17,163,67,83,0,53,218,22,1,72,96,137,41,149,76,193,176,137,227,
+ 102,1,181,195,60,101,32,8,131,71,102,195,176,88,51,67,0,205,16,133,39,
+ 214,1,137,208,50,13,40,57,155,147,3,108,224,2,154,167,135,91,64,117,49,
+ 1,65,23,144,54,2,183,93,22,181,2,192,40,0,65,197,55,42,144,6,108,240,
+ 128,15,208,79,158,197,144,212,120,111,57,80,6,179,152,144,54,112,109,33,
+ 57,0,63,228,135,128,88,138,88,162,7,1,55,31,223,241,1,110,144,136,243,
+ 180,109,84,255,131,64,55,72,66,70,112,35,218,22,108,235,232,4,251,181,
+ 87,199,16,67,192,136,147,86,80,143,76,128,4,60,208,126,214,144,109,4,0,
+ 99,254,136,104,84,128,73,171,68,59,83,35,3,6,137,135,213,182,5,156,87,
+ 19,16,180,56,37,51,31,82,98,34,15,161,55,50,128,145,159,210,0,117,128,
+ 138,6,224,79,91,48,141,251,134,115,61,144,3,15,88,92,185,103,3,203,248,
+ 15,213,120,117,93,81,130,176,161,117,245,2,52,166,6,30,38,112,6,135,244,
+ 69,23,99,59,132,73,84,214,183,2,44,64,141,19,128,1,75,176,142,63,152,76,
+ 190,96,147,13,113,37,89,178,57,105,176,148,55,48,138,77,56,16,160,81,1,
+ 66,119,110,184,85,116,9,242,115,4,16,55,73,233,134,180,168,144,153,115,
+ 111,198,82,152,142,161,8,171,132,65,253,97,54,86,195,133,52,178,8,154,
+ 224,5,68,55,105,227,71,59,114,67,146,231,86,109,54,224,3,1,197,151,219,
+ 214,92,44,25,152,46,115,49,26,0,145,9,120,100,138,160,153,78,56,153,101,
+ 184,115,43,160,11,206,41,2,175,255,80,153,62,216,142,200,164,6,233,229,
+ 16,185,232,153,161,168,4,100,198,5,62,165,109,44,224,9,17,136,154,216,
+ 68,74,196,144,68,149,38,53,41,160,7,176,153,144,94,153,10,23,52,143,220,
+ 152,44,223,1,30,184,153,155,229,215,31,91,216,51,42,87,35,14,86,104,135,
+ 246,145,2,97,145,49,96,151,231,22,128,62,176,8,3,81,141,191,7,152,23,
+ 184,109,16,224,109,9,208,139,45,16,7,210,32,80,22,154,54,222,233,54,180,
+ 115,6,117,64,158,251,245,81,191,48,9,250,249,118,56,185,3,159,121,143,
+ 78,41,153,103,16,8,245,25,135,167,36,0,233,217,16,193,216,3,255,137,123,
+ 94,121,139,79,35,143,5,192,58,127,178,0,9,112,160,31,16,11,16,161,31,19,
+ 32,2,27,71,39,101,231,98,136,0,156,57,213,79,63,176,5,106,208,6,44,112,
+ 1,200,105,0,209,136,146,125,25,157,5,193,70,15,137,47,177,118,2,140,208,
+ 16,108,36,150,176,114,134,67,147,11,166,147,126,50,186,87,48,224,11,55,
+ 138,120,21,6,1,58,26,138,195,70,108,135,192,151,21,255,86,0,7,57,116,
+ 157,69,3,154,48,7,131,202,123,225,4,1,170,0,155,145,38,128,187,55,134,
+ 88,242,51,49,41,28,224,241,1,113,64,56,218,38,0,34,16,115,239,150,36,
+ 255,210,96,92,101,114,87,213,159,66,167,166,31,168,123,90,247,156,31,
+ 250,135,129,25,0,78,10,122,168,37,43,56,240,6,70,90,59,35,131,128,189,
+ 56,49,85,16,140,234,135,4,66,9,168,190,64,17,22,32,2,73,131,168,77,73,
+ 108,171,192,151,247,198,145,172,55,83,137,48,17,1,208,6,24,147,169,112,
+ 24,141,91,224,61,45,1,53,141,58,6,49,57,165,163,234,6,20,17,123,20,176,
+ 28,49,71,54,44,182,65,44,16,92,192,169,9,188,208,85,95,32,8,179,234,129,
+ 185,215,169,206,201,92,185,42,4,187,234,164,121,0,61,162,135,3,56,0,158,
+ 2,85,59,48,153,44,189,104,81,165,0,65,13,176,4,127,186,82,48,160,6,208,
+ 26,174,203,234,4,136,101,173,124,201,103,218,90,4,218,20,4,65,64,12,29,
+ 139,169,143,170,166,181,40,128,149,74,18,1,32,162,175,2,31,50,255,25,30,
+ 62,135,87,0,240,99,219,82,175,46,166,32,203,165,49,67,7,176,62,32,176,
+ 218,166,146,5,187,171,205,120,90,209,3,172,232,3,54,253,102,131,127,50,
+ 165,101,105,6,210,32,57,57,16,138,204,138,88,43,245,11,218,176,178,170,
+ 240,177,33,11,3,171,208,13,224,138,1,50,80,178,39,235,3,167,0,182,45,
+ 235,129,2,104,3,230,186,63,71,91,6,235,218,130,222,97,2,147,144,17,159,
+ 17,26,204,81,0,141,166,65,3,80,133,173,153,51,242,151,161,244,102,180,
+ 125,120,141,186,170,141,5,228,103,229,52,43,14,171,16,225,84,0,53,59,
+ 112,7,106,2,2,32,142,89,75,173,26,251,11,174,120,165,14,16,55,97,75,158,
+ 99,187,10,22,80,168,118,89,159,69,240,3,82,71,1,222,42,142,105,59,174,
+ 155,231,3,1,244,15,180,193,75,114,113,5,188,219,187,188,187,187,14,132,
+ 17,64,87,157,81,90,100,51,153,160,2,228,0,178,215,28,142,118,45,5,32,10,
+ 182,199,122,137,123,171,72,235,166,195,7,84,155,131,64,65,131,3,200,3,
+ 54,166,3,147,54,255,219,130,222,40,13,20,144,149,76,16,138,82,112,186,
+ 49,171,131,72,147,3,24,139,4,135,165,177,168,91,190,165,85,178,174,235,
+ 3,229,122,165,224,52,186,24,128,161,210,155,123,182,43,16,143,240,42,
+ 109,229,139,60,199,64,21,213,2,10,76,37,201,131,115,151,18,190,120,75,
+ 147,31,65,124,161,145,170,243,53,45,56,131,182,167,249,150,52,22,4,108,
+ 186,184,166,1,162,165,200,159,86,195,56,227,210,139,238,74,185,218,166,
+ 6,199,39,112,201,39,1,21,155,163,130,224,185,197,116,8,27,101,122,113,
+ 163,2,149,41,5,51,90,76,191,208,137,204,181,186,17,216,186,62,128,191,
+ 120,197,191,119,8,169,247,107,3,192,162,32,4,112,124,100,105,31,183,196,
+ 24,222,101,152,82,22,188,222,106,58,134,80,188,145,33,190,31,48,185,2,
+ 164,117,228,55,121,56,83,1,117,16,133,29,224,186,65,192,161,212,184,109,
+ 43,201,184,6,91,132,133,186,3,125,19,49,175,19,186,132,58,11,134,96,179,
+ 4,87,112,127,96,1,64,28,1,59,48,195,149,25,154,53,188,190,195,135,115,
+ 49,255,202,172,61,12,3,200,144,139,49,160,10,7,57,196,199,85,180,239,
+ 138,37,128,0,164,74,140,178,54,0,0,202,115,49,151,146,128,14,71,66,60,
+ 23,11,127,0,9,53,144,202,36,242,29,43,112,84,20,193,70,151,219,197,185,
+ 209,2,136,236,173,158,172,188,130,120,56,168,104,159,51,213,156,71,11,
+ 157,112,44,157,188,90,59,99,213,68,34,164,134,23,104,1,21,208,4,190,161,
+ 44,147,1,195,52,35,162,135,10,154,26,187,168,89,124,56,203,202,195,206,
+ 250,15,22,138,164,171,71,196,150,124,205,16,176,203,134,150,198,161,20,
+ 6,115,144,116,204,33,7,140,35,165,245,1,59,56,224,6,64,182,114,9,118,6,
+ 111,80,10,140,80,10,55,188,153,71,163,199,92,204,35,184,145,194,40,161,
+ 28,243,57,149,167,116,187,3,11,204,33,220,184,69,40,162,156,19,66,39,
+ 124,2,16,87,16,185,240,6,53,208,204,205,44,9,54,130,130,30,32,140,98,
+ 112,190,75,224,158,53,92,164,14,113,40,23,107,153,230,25,2,79,185,31,73,
+ 243,205,53,39,176,87,106,177,27,60,85,63,255,176,8,115,192,127,120,186,
+ 0,219,53,37,39,10,1,28,167,65,154,184,151,22,161,109,5,240,30,46,124,
+ 106,120,123,0,41,65,44,103,224,150,38,70,96,154,0,149,4,107,189,46,179,
+ 191,243,168,58,49,160,174,177,86,5,120,44,16,140,112,209,240,17,31,190,
+ 65,7,53,226,50,145,115,1,32,4,210,75,200,82,181,60,178,103,224,9,59,124,
+ 153,200,116,10,87,114,166,207,168,122,145,102,196,166,58,1,48,58,149,50,
+ 149,10,3,181,34,59,243,57,121,90,150,113,112,1,162,134,39,119,23,67,93,
+ 125,165,41,232,39,2,167,44,47,28,7,109,125,17,22,48,9,158,224,143,59,
+ 213,1,139,32,213,10,253,151,12,93,132,139,201,60,171,83,0,146,32,122,
+ 108,51,5,126,48,9,147,64,27,138,80,30,97,13,31,127,98,8,106,176,185,71,
+ 35,78,178,117,190,76,185,82,171,80,203,188,122,0,111,64,10,204,42,119,
+ 237,21,2,200,144,9,223,42,57,175,185,122,0,107,3,251,60,110,224,250,6,
+ 228,140,110,29,32,12,117,97,177,59,64,216,215,105,81,110,64,54,165,255,
+ 178,65,34,176,185,149,141,23,20,192,80,145,253,194,151,49,0,149,93,17,
+ 40,216,212,169,184,108,84,32,0,165,232,198,126,121,26,161,29,162,30,192,
+ 34,73,153,2,226,0,147,53,32,43,143,184,2,56,208,2,31,144,0,178,141,41,
+ 10,0,7,101,240,9,7,96,163,211,201,103,32,240,209,237,201,219,221,32,17,
+ 124,122,0,121,128,4,140,124,101,200,20,12,51,3,225,119,56,196,155,135,
+ 208,21,121,0,253,248,222,136,214,173,216,202,92,144,107,172,190,200,8,
+ 77,50,45,213,34,2,140,93,17,188,250,6,239,49,112,149,113,106,58,16,7,
+ 171,121,18,223,138,8,242,87,114,106,6,89,100,48,41,191,156,180,9,241,59,
+ 114,211,3,61,16,1,114,80,106,255,189,97,70,80,2,45,32,1,40,128,224,104,
+ 0,7,119,144,7,16,192,65,189,135,40,86,51,195,76,48,108,238,183,70,2,192,
+ 13,172,48,220,151,72,2,199,176,183,255,112,40,236,51,201,52,39,105,205,
+ 121,150,2,240,163,154,125,91,84,128,8,251,102,58,131,29,122,9,136,131,
+ 169,75,1,20,112,68,175,255,135,200,217,38,2,144,32,31,58,158,124,58,0,9,
+ 7,176,222,239,74,79,37,39,133,29,32,7,103,117,180,57,22,204,202,213,63,
+ 59,147,2,71,130,6,128,18,110,113,32,9,116,48,6,170,126,7,32,96,5,162,82,
+ 219,161,139,130,7,128,214,17,14,210,161,201,5,214,48,104,19,160,142,219,
+ 103,107,184,22,12,55,66,190,89,25,225,204,157,103,186,30,1,179,42,133,
+ 137,64,69,156,201,34,218,125,134,61,87,132,151,35,98,131,70,0,127,224,
+ 232,143,222,38,9,32,10,218,73,18,52,67,6,151,222,120,12,112,228,177,62,
+ 130,158,78,135,7,192,92,114,146,2,161,172,167,56,240,45,102,211,60,61,
+ 224,229,3,128,32,162,181,111,189,202,57,159,169,132,252,53,12,235,27,0,
+ 173,173,125,189,78,113,41,133,12,54,57,204,79,106,53,124,160,122,117,
+ 110,3,176,203,154,44,192,11,243,71,127,188,112,240,159,247,236,109,151,
+ 179,26,49,11,89,32,31,125,220,199,193,97,8,70,137,18,150,206,120,141,
+ 119,9,44,128,199,109,122,238,148,219,168,49,96,54,220,8,40,178,255,114,
+ 2,45,96,8,13,112,54,174,174,114,154,104,1,247,94,117,135,243,208,132,
+ 172,4,133,151,235,185,41,92,61,200,125,4,111,11,159,64,132,71,248,208,
+ 143,170,121,53,54,110,251,219,6,153,29,238,183,85,4,75,63,126,88,82,0,
+ 121,128,241,104,168,241,24,97,237,106,82,112,149,17,28,89,0,230,20,241,
+ 12,176,176,190,179,32,12,226,126,114,69,176,8,221,206,233,32,128,14,1,2,
+ 218,113,60,110,251,113,1,121,32,181,238,44,37,38,96,8,17,32,42,26,116,0,
+ 53,206,140,157,201,57,42,192,6,160,217,95,46,181,153,14,160,1,217,224,
+ 131,39,85,249,55,144,8,246,158,200,34,96,59,15,253,128,94,0,176,62,37,
+ 80,0,240,9,57,117,233,37,247,10,240,40,16,209,202,245,140,52,232,95,207,
+ 17,220,0,9,32,47,25,149,145,38,127,80,0,143,64,68,140,133,108,194,224,8,
+ 55,74,79,182,213,120,166,79,6,35,63,223,42,9,2,1,98,26,141,34,157,95,52,
+ 186,5,160,7,70,221,86,101,233,6,233,94,45,49,52,183,246,54,53,61,208,68,
+ 139,255,191,148,77,57,154,95,4,78,115,112,0,180,96,249,150,255,10,155,
+ 48,247,164,149,150,124,227,249,79,240,79,41,106,108,81,101,250,37,87,7,
+ 162,113,239,205,222,0,94,31,237,25,145,11,110,64,30,0,145,64,160,14,129,
+ 2,17,160,128,164,108,2,174,35,255,28,62,132,24,81,226,191,0,255,22,21,
+ 161,18,6,214,179,136,1,28,16,35,67,133,193,72,146,6,76,158,172,195,137,
+ 0,0,137,1,4,28,192,64,110,196,204,17,47,246,68,193,131,101,98,75,0,22,
+ 42,213,64,129,64,168,4,14,45,78,224,56,99,129,194,82,7,59,37,90,152,160,
+ 161,193,12,21,32,100,128,98,34,133,71,136,67,208,156,62,60,64,75,201,88,
+ 178,99,95,157,153,64,97,162,5,17,5,166,170,152,145,131,141,11,47,79,126,
+ 216,48,245,213,33,177,75,39,253,26,168,163,70,128,131,138,14,3,80,56,80,
+ 33,79,151,13,27,20,44,144,96,2,71,9,51,122,45,59,228,166,136,160,4,9,6,
+ 133,30,68,241,103,157,28,10,13,47,79,12,0,64,245,63,98,69,12,48,24,18,
+ 196,198,255,150,45,154,132,253,232,64,114,228,95,148,7,88,168,149,136,
+ 233,0,132,112,233,104,214,124,145,100,143,150,211,185,220,36,64,64,48,1,
+ 231,162,39,226,56,0,48,135,229,233,127,0,8,36,158,106,85,84,154,37,72,
+ 182,174,90,230,212,129,47,91,55,200,58,145,226,36,219,171,2,7,40,52,149,
+ 152,235,123,133,240,59,98,4,114,225,129,39,98,115,196,41,0,200,112,237,
+ 175,7,188,168,163,62,236,10,163,136,2,17,20,99,172,49,5,16,168,193,168,
+ 202,184,155,232,145,56,58,227,172,32,161,236,88,160,196,44,40,57,128,33,
+ 14,121,178,160,197,127,196,249,226,1,147,116,99,32,183,221,20,124,96,65,
+ 79,222,56,96,37,136,60,248,198,28,115,210,121,129,166,12,142,156,41,185,
+ 61,116,210,11,128,88,164,43,72,7,162,76,104,65,151,21,33,2,64,0,15,32,
+ 152,106,134,30,0,105,6,20,36,148,32,33,132,85,110,217,198,171,0,44,160,
+ 198,151,99,120,112,207,9,248,164,144,130,20,43,0,241,192,71,212,178,220,
+ 178,129,28,188,124,35,135,24,139,232,32,182,72,255,106,49,37,53,10,106,
+ 33,163,47,191,114,124,224,139,28,240,20,96,187,135,214,156,112,177,198,
+ 44,196,208,4,35,44,229,16,0,93,98,225,64,74,17,71,44,81,129,38,192,88,
+ 199,62,32,174,236,200,2,2,4,152,96,130,44,235,240,34,71,222,78,130,20,
+ 82,47,2,185,211,131,74,33,236,46,26,227,140,60,50,217,12,144,219,227,
+ 154,175,8,200,2,133,129,10,74,64,202,15,220,128,245,82,7,4,24,128,63,25,
+ 100,104,160,128,1,94,161,69,138,27,120,40,243,151,95,144,121,19,78,37,
+ 232,68,34,94,82,196,168,164,130,1,6,251,202,35,45,185,252,182,129,55,60,
+ 240,228,139,25,97,251,129,6,42,68,98,128,87,72,191,168,163,222,123,241,
+ 131,8,83,10,55,232,167,226,13,122,233,20,135,42,252,152,195,178,0,8,48,
+ 35,142,22,62,248,160,51,207,16,40,113,129,199,224,104,229,147,20,129,
+ 120,53,91,135,84,19,64,4,15,6,24,224,128,73,52,168,3,138,94,127,206,49,
+ 64,47,216,80,193,97,124,47,245,8,19,1,194,33,135,28,87,158,134,218,149,
+ 52,255,200,9,39,156,106,80,113,106,19,72,164,165,246,51,161,106,136,195,
+ 141,82,204,240,163,141,43,83,211,178,130,20,122,232,33,5,12,88,152,32,
+ 24,86,196,26,235,6,187,223,149,34,94,36,64,153,87,15,135,39,176,96,39,8,
+ 245,237,118,237,182,223,158,32,145,64,4,222,181,215,161,235,240,219,94,
+ 91,81,99,171,130,29,64,0,163,139,65,228,217,192,27,199,16,152,242,132,
+ 18,140,152,194,140,43,78,191,194,140,42,220,136,229,4,14,72,54,217,179,
+ 84,21,160,157,144,59,248,81,166,147,81,96,150,249,210,44,69,24,160,128,
+ 10,134,23,183,2,79,2,97,3,10,229,151,87,158,141,52,64,136,220,3,192,35,
+ 246,238,165,3,14,40,224,130,30,64,224,158,123,25,98,208,64,207,157,184,
+ 1,170,218,83,83,46,17,5,41,57,160,18,135,21,170,184,34,147,203,2,208,
+ 215,131,236,27,104,160,94,13,88,160,245,147,68,88,153,27,45,72,49,64,82,
+ 212,65,12,42,208,67,219,240,4,56,80,57,165,126,24,136,0,254,26,0,129,1,
+ 76,0,17,44,88,4,25,52,193,139,255,47,116,176,131,108,8,68,29,160,215,54,
+ 201,137,47,98,22,96,1,6,122,48,14,22,178,176,28,119,232,2,33,154,176,0,
+ 105,113,134,100,55,196,33,103,98,7,29,161,204,142,118,10,32,4,24,100,16,
+ 1,119,76,96,119,189,235,200,182,14,112,134,236,69,80,130,107,147,1,8,
+ 196,48,69,49,112,175,12,57,248,158,189,6,3,42,125,97,111,120,92,178,66,
+ 92,196,8,46,12,244,168,129,15,97,65,249,160,212,67,149,53,193,141,110,4,
+ 141,64,36,240,1,19,156,192,8,87,56,35,79,190,163,129,10,68,192,143,16,
+ 168,128,6,6,240,136,71,176,128,27,76,188,64,10,84,161,135,43,238,32,15,
+ 23,168,15,1,28,32,191,211,172,233,59,221,242,99,4,32,128,1,113,17,242,
+ 17,156,176,31,4,42,177,200,111,57,18,146,121,194,142,224,28,48,129,2,
+ 196,64,6,227,192,7,11,119,176,139,64,106,64,20,134,248,131,12,105,136,2,
+ 94,122,237,51,40,72,217,15,127,136,134,65,140,65,12,173,96,134,50,236,
+ 115,132,152,33,49,98,74,196,36,254,174,216,61,106,206,255,224,138,89,
+ 212,192,4,36,217,18,11,188,100,0,124,244,227,5,36,136,191,71,70,242,140,
+ 31,219,26,2,186,134,178,5,172,42,7,110,27,192,25,0,81,12,67,100,129,16,
+ 7,73,0,251,90,80,130,41,228,49,34,0,160,192,4,14,160,129,2,64,0,144,21,
+ 192,64,66,49,80,129,11,56,81,6,59,192,31,4,196,165,77,179,93,9,0,171,28,
+ 40,4,15,186,73,225,49,52,130,15,77,96,10,32,89,65,19,114,147,0,246,107,
+ 64,10,118,176,210,29,200,96,23,178,40,128,7,78,113,10,17,216,82,18,245,
+ 132,131,12,103,104,135,94,8,147,118,104,32,102,23,140,217,138,86,76,67,
+ 22,141,48,98,51,157,217,17,239,28,192,126,16,196,95,75,165,138,69,252,
+ 213,139,71,218,204,163,162,190,227,1,13,116,213,171,94,21,215,1,182,248,
+ 207,110,208,65,1,210,90,35,48,225,160,2,44,198,0,2,255,146,233,44,180,
+ 113,10,64,208,97,134,53,168,163,251,174,224,177,139,78,0,120,5,40,232,
+ 240,134,151,201,24,252,241,173,30,224,31,196,96,133,182,9,200,33,120,
+ 255,5,61,104,31,35,16,131,6,24,246,95,218,12,156,199,182,197,9,75,20,64,
+ 25,178,216,69,104,35,32,11,89,172,163,2,202,168,0,32,148,161,1,119,104,
+ 0,181,160,101,36,8,94,88,142,122,196,227,128,112,105,197,44,97,42,14,1,
+ 80,0,0,74,93,170,68,104,38,208,199,106,212,160,195,227,100,206,4,48,86,
+ 193,1,84,0,179,90,46,116,103,53,43,192,89,160,129,169,121,67,137,212,41,
+ 34,96,102,97,7,84,141,193,5,18,138,208,133,106,64,14,90,162,67,137,32,
+ 113,148,18,84,193,159,212,163,192,5,157,10,86,192,214,247,95,34,208,102,
+ 73,23,155,26,232,94,15,103,245,5,240,101,171,251,94,158,224,98,13,107,
+ 152,64,39,14,48,128,70,104,224,19,148,128,64,4,82,192,15,102,228,33,15,
+ 204,96,219,52,26,48,13,102,236,192,10,173,120,40,51,68,204,140,93,68,
+ 160,2,141,176,132,54,71,193,76,224,6,151,39,14,144,21,11,68,32,130,235,
+ 249,70,4,112,163,85,139,8,252,79,213,88,183,39,63,78,13,0,136,69,63,7,
+ 64,235,49,66,49,255,8,10,86,149,135,240,138,55,161,29,189,64,132,53,9,
+ 73,17,92,160,9,10,168,129,232,70,7,28,203,92,52,198,19,128,155,140,113,
+ 60,96,23,35,13,198,212,149,241,140,225,134,95,2,172,36,59,30,235,72,0,
+ 128,112,81,0,224,130,2,4,56,176,0,58,161,96,6,23,128,18,159,56,109,5,40,
+ 97,218,10,144,150,120,26,240,192,1,58,177,6,10,172,152,119,101,230,142,
+ 106,122,162,148,165,244,88,53,29,131,52,83,119,118,229,5,108,23,58,53,0,
+ 65,12,2,153,179,26,115,181,171,24,128,192,5,26,58,89,225,161,1,203,90,
+ 94,1,166,231,7,227,158,220,71,210,214,205,116,75,104,61,233,251,248,56,
+ 53,217,42,12,16,88,12,51,97,31,193,216,71,24,133,172,160,75,43,22,88,
+ 162,19,44,224,196,1,68,208,9,1,172,129,0,163,0,192,176,31,157,107,110,
+ 67,122,77,44,40,6,237,58,45,37,29,212,160,12,35,213,230,82,238,76,128,
+ 52,131,178,0,78,132,40,4,202,176,129,5,64,98,50,163,235,118,190,245,189,
+ 111,126,247,123,177,124,186,131,99,255,58,61,29,9,72,66,162,34,112,51,
+ 245,176,67,0,191,14,0,170,223,138,0,99,154,176,207,21,148,96,175,254,
+ 198,120,198,53,190,113,103,42,10,123,96,16,248,116,62,64,135,79,220,203,
+ 183,249,2,232,119,178,183,61,25,4,252,213,43,88,129,17,56,62,115,154,
+ 215,220,230,221,225,86,5,198,32,240,57,154,224,2,98,125,51,95,17,163,
+ 129,8,244,64,5,42,112,53,2,246,105,132,21,88,233,230,79,135,122,212,93,
+ 172,180,236,129,252,49,68,81,132,28,8,144,89,238,28,6,123,111,65,3,189,
+ 37,3,243,42,72,221,236,103,71,187,94,82,195,202,20,184,28,50,28,136,195,
+ 74,100,205,157,109,121,192,114,72,167,119,150,97,142,173,180,247,221,
+ 239,102,95,187,91,64,16,118,200,152,192,13,210,216,177,97,34,230,17,86,
+ 54,96,240,143,201,80,9,98,158,248,191,87,222,242,249,6,64,227,101,48,8,
+ 199,224,149,239,176,162,25,209,85,32,238,200,76,38,14,151,71,125,234,
+ 251,157,121,183,228,192,234,8,48,193,233,101,150,165,110,141,225,200,
+ 145,49,138,236,85,191,255,123,222,79,93,0,173,228,30,231,23,192,129,19,
+ 84,244,108,124,178,242,237,217,103,120,138,244,222,249,207,95,17,218,60,
+ 112,129,63,169,160,243,38,96,196,236,5,32,135,44,104,215,90,31,224,64,
+ 101,136,5,125,242,151,63,86,41,148,42,200,23,144,33,63,0,155,0,134,8,
+ 138,167,57,163,136,110,152,223,254,247,55,204,182,6,224,202,33,238,28,
+ 50,39,104,191,232,35,128,88,240,26,243,17,136,82,192,191,4,44,63,143,
+ 115,11,47,41,0,179,130,140,22,152,2,14,201,133,82,128,132,83,249,37,67,
+ 176,0,197,82,192,14,84,61,194,209,158,6,136,1,53,208,131,25,34,10,28,
+ 152,2,14,140,136,110,120,4,55,104,1,9,32,8,175,225,37,20,200,2,17,224,
+ 50,15,196,193,212,251,54,162,139,168,5,235,62,20,152,163,22,192,1,35,
+ 168,2,211,73,29,70,96,157,22,120,29,147,97,163,148,161,131,135,201,193,
+ 40,212,65,196,40,168,63,242,0,109,16,5,56,160,33,130,195,161,46,44,25,
+ 30,242,33,66,0,1,151,209,47,41,52,67,180,243,58,225,113,43,255,72,154,0,
+ 1,168,171,25,10,138,130,208,33,29,2,67,149,89,0,56,0,131,6,208,34,202,
+ 59,195,62,164,57,180,169,41,201,2,36,243,210,146,91,250,131,26,168,1,
+ 161,224,26,207,112,35,56,24,131,59,176,2,81,147,30,174,243,195,74,4,60,
+ 231,178,187,40,251,35,192,26,0,174,194,0,81,40,134,155,50,4,58,32,69,48,
+ 184,131,3,186,162,72,172,128,73,180,196,86,68,59,154,89,48,53,84,53,63,
+ 106,50,90,76,169,30,8,163,63,137,11,83,18,151,163,113,197,95,140,58,69,
+ 105,172,224,25,44,9,115,162,6,144,1,61,40,165,135,2,23,77,154,168,74,1,
+ 198,104,148,58,254,178,158,255,242,168,201,74,129,108,100,178,40,3,44,
+ 196,202,47,62,148,198,112,244,55,213,152,21,26,115,42,156,65,71,116,244,
+ 0,233,249,70,112,20,199,119,236,54,8,185,53,165,104,179,233,98,56,2,80,
+ 55,10,192,53,120,228,199,202,147,180,95,235,199,128,20,200,129,36,200,
+ 142,107,190,230,27,191,130,84,200,124,57,200,133,116,200,135,132,200,
+ 129,172,136,194,152,200,8,136,180,200,139,196,200,128,0,59
+ };
+
+int main(void)
+{
+ gdImagePtr im;
+ if ((im = gdImageCreateFromGifPtr(8994, (char*) &gifdata[0])) != NULL) {
+ gdImageDestroy(im);
+ return 0;
+ } else {
+ return 1;
+ }
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005_2.gif b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005_2.gif
new file mode 100644
index 00000000000..3f9e6c5e400
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005_2.gif
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005_2_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005_2_exp.png
new file mode 100644
index 00000000000..708b8adf00d
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005_2_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005_3.gif b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005_3.gif
new file mode 100644
index 00000000000..178d27e3574
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00005_3.gif
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00006.c b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00006.c
new file mode 100644
index 00000000000..57d7ad01611
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00006.c
@@ -0,0 +1,67 @@
+#include <stdio.h>
+#include "gd.h"
+#include "gdtest.h"
+
+#define TMP_FN "_tmp_bug0006.gif"
+
+int main()
+{
+ gdImagePtr im;
+ FILE *fp;
+ const int r = 255, g = 0, b = 0;
+ int r_f,g_f,b_f, trans_c_f;
+ int trans_c = gdTrueColorAlpha(r,g,b,0);
+ int error = 0;
+
+ im = gdImageCreateTrueColor(192, 36);
+ if (im == NULL) {
+ gdTestErrorMsg("Cannot create image\n");
+ return 1;
+ }
+
+ gdImageColorTransparent(im, trans_c);
+ gdImageFilledRectangle(im, 0,0, 192,36, trans_c);
+
+ fp = fopen(TMP_FN, "wb");
+ if (!fp) {
+ gdTestErrorMsg("Cannot open <%s> for writing\n", TMP_FN);
+ return 1;
+ }
+ gdImageGif(im,fp);
+ fclose(fp);
+
+ gdImageDestroy(im);
+
+ fp = fopen(TMP_FN, "rb");
+ if (!fp) {
+ gdTestErrorMsg("Cannot open <%s> for reading\n", TMP_FN);
+ return 1;
+ }
+ im = gdImageCreateFromGif(fp);
+ fclose(fp);
+
+ if (!im) {
+ gdTestErrorMsg("Cannot create image from <%s>\n", TMP_FN);
+ return 1;
+ }
+
+ trans_c_f = gdImageGetTransparent(im);
+ if (gdTestAssert(trans_c_f == 1)) {
+ r_f = gdImageRed(im, trans_c_f);
+ g_f = gdImageGreen(im, trans_c_f);
+ b_f = gdImageBlue(im, trans_c_f);
+
+ if (!gdTestAssert(r_f == r) || !gdTestAssert(g_f==g) || !gdTestAssert(b_f==b)) {
+ error = 1;
+ }
+ } else {
+ error = 1;
+ }
+
+ /* Destroy it */
+ gdImageDestroy(im);
+ if (remove(TMP_FN) == -1) {
+ gdTestErrorMsg("Cannot remove file: <%s>\n", TMP_FN);
+ }
+ return error;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00060.c b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00060.c
new file mode 100644
index 00000000000..721d3bc401d
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00060.c
@@ -0,0 +1,24 @@
+#include <stdio.h>
+#include "gd.h"
+#include "gdtest.h"
+
+
+int main()
+{
+ gdImagePtr im;
+ FILE *fp;
+ char path[1024];
+
+ sprintf(path, "%s/gif/bug00060.gif", GDTEST_TOP_DIR);
+ fp = fopen(path, "rb");
+
+ if (!fp) {
+ printf("cannot open <%s>\n", path);
+ return -1;
+ }
+
+ im = gdImageCreateFromGif(fp);
+ fclose(fp);
+ gdImageDestroy(im);
+ return 0;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00060.gif b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00060.gif
new file mode 100644
index 00000000000..c8821748057
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00060.gif
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00066.c b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00066.c
new file mode 100644
index 00000000000..be24066ca2e
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00066.c
@@ -0,0 +1,30 @@
+#include <stdio.h>
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ FILE *fp;
+ char path[1024];
+ int error = 0;
+
+ sprintf(path, "%s/gif/bug00066.gif", GDTEST_TOP_DIR);
+ fp = fopen(path, "rb");
+
+ if (!fp) {
+ printf("cannot open <%s>\n", path);
+ return -1;
+ }
+
+ im = gdImageCreateFromGif(fp);
+ fclose(fp);
+
+ sprintf(path, "%s/gif/bug00066_exp.png", GDTEST_TOP_DIR);
+ if (!gdAssertImageEqualsToFile(path, im)) {
+ error = 1;
+ }
+ gdImageDestroy(im);
+
+ return error;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00066.gif b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00066.gif
new file mode 100644
index 00000000000..cdf5f29a82e
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00066.gif
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00066_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00066_exp.png
new file mode 100644
index 00000000000..9f535adc168
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00066_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00181.c b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00181.c
new file mode 100644
index 00000000000..27d6481175e
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00181.c
@@ -0,0 +1,93 @@
+#include <stdio.h>
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im, im2, im3;
+ FILE *fp;
+ int black, trans;
+ int error = 0;
+
+ /* GIFEncode */
+ im = gdImageCreate(100, 100);
+ if (!im) {
+ gdTestErrorMsg("Cannot create image.\n");
+ return 1;
+ }
+ im->interlace = 1;
+ fp = fopen("bug00181.gif", "wb");
+ if (!fp) {
+ gdTestErrorMsg("Cannot open <%s> for writing.\n", "bug00181.gif");
+ return 1;
+ }
+ gdImageGif(im, fp);
+ gdImageDestroy(im);
+ fclose(fp);
+
+ fp = fopen("bug00181.gif", "rb");
+ if (!fp) {
+ gdTestErrorMsg("Cannot open <%s> for reading.\n", "bug00181.gif");
+ return 1;
+ }
+ im = gdImageCreateFromGif(fp);
+ fclose(fp);
+ if (!im) {
+ gdTestErrorMsg("Cannot create image from <%s>\n", "bug00181.gif");
+ return 1;
+ }
+ error = !im->interlace;
+ gdImageDestroy(im);
+
+ if (error) return error;
+
+ /* GIFAnimEncode */
+ im = gdImageCreate(100, 100);
+ im->interlace = 1;
+ gdImageColorAllocate(im, 255, 255, 255); /* allocate white for background color */
+ black = gdImageColorAllocate(im, 0, 0, 0);
+ trans = gdImageColorAllocate(im, 1, 1, 1);
+ gdImageRectangle(im, 0, 0, 10, 10, black);
+ fp = fopen("bug00181a.gif", "wb");
+ if (!fp) {
+ gdTestErrorMsg("Cannot open <%s> for writing.\n", "bug00181a.gif");
+ return 1;
+ }
+ gdImageGifAnimBegin(im, fp, 1, 3);
+ gdImageGifAnimAdd(im, fp, 0, 0, 0, 100, 1, NULL);
+ im2 = gdImageCreate(100, 100);
+ im2->interlace = 1;
+ (void)gdImageColorAllocate(im2, 255, 255, 255);
+ gdImagePaletteCopy (im2, im);
+ gdImageRectangle(im2, 0, 0, 15, 15, black);
+ gdImageColorTransparent (im2, trans);
+ gdImageGifAnimAdd(im2, fp, 0, 0, 0, 100, 1, im);
+ im3 = gdImageCreate(100, 100);
+ im3->interlace = 1;
+ (void)gdImageColorAllocate(im3, 255, 255, 255);
+ gdImagePaletteCopy (im3, im);
+ gdImageRectangle(im3, 0, 0, 15, 20, black);
+ gdImageColorTransparent (im3, trans);
+ gdImageGifAnimAdd(im3, fp, 0, 0, 0, 100, 1, im2);
+ gdImageGifAnimEnd(fp);
+ fclose(fp);
+ gdImageDestroy(im);
+ gdImageDestroy(im2);
+ gdImageDestroy(im3);
+
+ fp = fopen("bug00181a.gif", "rb");
+ if (!fp) {
+ gdTestErrorMsg("Cannot open <%s> for reading.\n", "bug00181a.gif");
+ return 1;
+ }
+ im = gdImageCreateFromGif(fp);
+ fclose(fp);
+ if (!im) {
+ gdTestErrorMsg("Cannot create image from <%s>\n", "bug00181a.gif");
+ return 1;
+ }
+ error = !im->interlace;
+ gdImageDestroy(im);
+
+ return error;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00227.c b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00227.c
new file mode 100644
index 00000000000..861006e7447
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gif/bug00227.c
@@ -0,0 +1,67 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "gd.h"
+#include "gdtest.h"
+
+#define WIDTH 150
+#define HEIGHT 1
+#define DELAY 100
+#define PROBE_SIZE 11
+
+int main()
+{
+ FILE *fp;
+ gdImagePtr im0, im1, im2;
+ int i;
+ char *buf;
+
+ /* generate a GIF animation */
+ im0 = gdImageCreate(WIDTH, HEIGHT);
+ if (!im0) return 1;
+ for (i = 0; i < WIDTH; i++) {
+ int c = gdImageColorAllocate(im0, i, 0xff, 0xff);
+ gdImageSetPixel(im0, i, 0, c);
+ }
+
+ fp = fopen("bug00227.gif", "wb");
+ if (!fp) return 1;
+
+ gdImageGifAnimBegin(im0, fp, 0, 0);
+
+ gdImageGifAnimAdd(im0, fp, 1, 0, 0, DELAY, 1, NULL);
+
+ im1 = gdImageCreate(WIDTH, HEIGHT);
+ if (!im1) return 1;
+ for (i = 0; i < WIDTH; i++) {
+ int c = gdImageColorAllocate(im1, i, 0x00, 0xff);
+ gdImageSetPixel(im1, i, 0, c);
+ }
+ gdImageGifAnimAdd(im1, fp, 1, 0, 0, DELAY, 1, im0);
+
+ im2 = gdImageCreate(WIDTH, HEIGHT);
+ if (!im2) return 1;
+ for (i = 0; i < WIDTH; i++) {
+ int c = gdImageColorAllocate(im2, i, 0xff, 0x00);
+ gdImageSetPixel(im2, i, 0, c);
+ }
+ gdImageGifAnimAdd(im2, fp, 1, 0, 0, DELAY, 1, im1);
+
+ gdImageGifAnimEnd(fp);
+
+ fclose(fp);
+
+ gdImageDestroy(im0);
+ gdImageDestroy(im1);
+ gdImageDestroy(im2);
+
+ /* check the Global Color Table flag */
+ fp = fopen("bug00227.gif", "rb");
+ if (!fp) return 1;
+ buf = malloc(PROBE_SIZE);
+ if (!buf) return 1;
+ if (PROBE_SIZE != fread(buf, 1, PROBE_SIZE, fp)) return 1;
+ if (buf[PROBE_SIZE-1] & 0x80) return 1;
+ free(buf);
+ fclose(fp);
+ return 0;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gif/gif_im2im.c b/Build/source/libs/gd/libgd-2.1.0/tests/gif/gif_im2im.c
new file mode 100644
index 00000000000..a5b0adbdb85
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gif/gif_im2im.c
@@ -0,0 +1,66 @@
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr src, dst;
+ int r, g, b;
+ void *p;
+ int size = 0;
+ int status = 0;
+ CuTestImageResult result = {0, 0};
+
+ src = gdImageCreate(100, 100);
+ if (src == NULL) {
+ printf("could not create src\n");
+ return 1;
+ }
+ r = gdImageColorAllocate(src, 0xFF, 0, 0);
+ g = gdImageColorAllocate(src, 0, 0xFF, 0);
+ b = gdImageColorAllocate(src, 0, 0, 0xFF);
+ gdImageFilledRectangle(src, 0, 0, 99, 99, r);
+ gdImageRectangle(src, 20, 20, 79, 79, g);
+ gdImageEllipse(src, 70, 25, 30, 20, b);
+
+#define OUTPUT_GIF(name) do { \
+ FILE *fp; \
+ \
+ fp = fopen("gif_im2im_" #name ".gif", "wb"); \
+ if (fp) { \
+ gdImageGif(name, fp); \
+ fclose(fp); \
+ } \
+ } while (0)
+
+ OUTPUT_GIF(src);
+ p = gdImageGifPtr(src, &size);
+ if (p == NULL) {
+ status = 1;
+ printf("p is null\n");
+ goto door0;
+ }
+ if (size <= 0) {
+ status = 1;
+ printf("size is non-positive\n");
+ goto door1;
+ }
+
+ dst = gdImageCreateFromGifPtr(size, p);
+ if (dst == NULL) {
+ status = 1;
+ printf("could not create dst\n");
+ goto door1;
+ }
+ OUTPUT_GIF(dst);
+ gdTestImageDiff(src, dst, NULL, &result);
+ if (result.pixels_changed > 0) {
+ status = 1;
+ printf("pixels changed: %d\n", result.pixels_changed);
+ }
+ gdImageDestroy(dst);
+door1:
+ gdFree(p);
+door0:
+ gdImageDestroy(src);
+ return status;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/gif/gif_null.c b/Build/source/libs/gd/libgd-2.1.0/tests/gif/gif_null.c
new file mode 100644
index 00000000000..463d31ebaf6
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/gif/gif_null.c
@@ -0,0 +1,14 @@
+#include "gd.h"
+
+int main()
+{
+ gdImagePtr im;
+
+ im = gdImageCreateFromGif(NULL);
+ if (im != NULL) {
+ gdImageDestroy(im);
+ return 1;
+ }
+ gdImageGif(im, NULL); /* noop safely */
+ return 0;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/CMakeLists.txt
new file mode 100644
index 00000000000..d68028b2d94
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/CMakeLists.txt
@@ -0,0 +1,15 @@
+
+SET(TESTS_FILES
+ jpeg_im2im
+ jpeg_null
+ jpeg_read
+ jpeg_empty_file
+ jpeg_resolution
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/conv_test.jpeg b/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/conv_test.jpeg
new file mode 100644
index 00000000000..7283d1a4754
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/conv_test.jpeg
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/conv_test_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/conv_test_exp.png
new file mode 100644
index 00000000000..1210f479aa6
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/conv_test_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/empty.jpeg b/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/empty.jpeg
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/empty.jpeg
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/jpeg_empty_file.c b/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/jpeg_empty_file.c
new file mode 100644
index 00000000000..844dbf43d3e
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/jpeg_empty_file.c
@@ -0,0 +1,31 @@
+/* $Id$ */
+#include "gd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ FILE *fp;
+ char path[1024];
+
+ gdSetErrorMethod(gdSilence);
+
+ sprintf(path, "%s/jpeg/empty.jpeg", GDTEST_TOP_DIR);
+ fp = fopen(path, "rb");
+ if (!fp) {
+ printf("failed, cannot open file\n");
+ return 1;
+ }
+
+ im = gdImageCreateFromJpeg(fp);
+ fclose(fp);
+
+ if (!im) {
+ return 0;
+ } else {
+ gdImageDestroy(im);
+ return 1;
+ }
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/jpeg_im2im.c b/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/jpeg_im2im.c
new file mode 100644
index 00000000000..89a72be7ffd
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/jpeg_im2im.c
@@ -0,0 +1,70 @@
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr src, dst;
+ int r, g, b;
+ void *p;
+ int size = 0;
+ int status = 0;
+#if 0
+ CuTestImageResult result = {0, 0};
+#endif
+
+ src = gdImageCreateTrueColor(100, 100);
+ if (src == NULL) {
+ printf("could not create src\n");
+ return 1;
+ }
+ r = gdImageColorAllocate(src, 0xFF, 0, 0);
+ g = gdImageColorAllocate(src, 0, 0xFF, 0);
+ b = gdImageColorAllocate(src, 0, 0, 0xFF);
+ gdImageFilledRectangle(src, 0, 0, 99, 99, r);
+ gdImageRectangle(src, 20, 20, 79, 79, g);
+ gdImageEllipse(src, 70, 25, 30, 20, b);
+
+#define OUTPUT_JPEG(name) do { \
+ FILE *fp; \
+ \
+ fp = fopen("jpeg_im2im_" #name ".jpeg", "wb"); \
+ if (fp) { \
+ gdImageJpeg(name, fp, 100); \
+ fclose(fp); \
+ } \
+ } while (0)
+
+ OUTPUT_JPEG(src);
+ p = gdImageJpegPtr(src, &size, 100);
+ if (p == NULL) {
+ status = 1;
+ printf("p is null\n");
+ goto door0;
+ }
+ if (size <= 0) {
+ status = 1;
+ printf("size is non-positive\n");
+ goto door1;
+ }
+
+ dst = gdImageCreateFromJpegPtr(size, p);
+ if (dst == NULL) {
+ status = 1;
+ printf("could not create dst\n");
+ goto door1;
+ }
+ OUTPUT_JPEG(dst);
+#if 0
+ gdTestImageDiff(src, dst, NULL, &result);
+ if (result.pixels_changed > 0) {
+ status = 1;
+ printf("pixels changed: %d\n", result.pixels_changed);
+ }
+#endif
+ gdImageDestroy(dst);
+door1:
+ gdFree(p);
+door0:
+ gdImageDestroy(src);
+ return status;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/jpeg_null.c b/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/jpeg_null.c
new file mode 100644
index 00000000000..3b2caa68744
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/jpeg_null.c
@@ -0,0 +1,14 @@
+#include "gd.h"
+
+int main()
+{
+ gdImagePtr im;
+
+ im = gdImageCreateFromJpeg(NULL);
+ if (im != NULL) {
+ gdImageDestroy(im);
+ return 1;
+ }
+ gdImageJpeg(im, NULL, 100); /* noop safely */
+ return 0;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/jpeg_read.c b/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/jpeg_read.c
new file mode 100644
index 00000000000..64130ce125a
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/jpeg_read.c
@@ -0,0 +1,45 @@
+/* $Id$ */
+#include "gd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "gdtest.h"
+#include <jpeglib.h>
+
+#ifdef _MSC_VER
+# define snprintf _snprintf
+#endif
+
+int main()
+{
+#if defined(JPEG_LIB_VERSION_MAJOR) && JPEG_LIB_VERSION_MAJOR >= 8
+ printf("skip, JPEG Major version too high (%i)\n", JPEG_LIB_VERSION_MAJOR);
+ return 0;
+#else
+ gdImagePtr im;
+ FILE *fp;
+ char path[1024];
+
+ snprintf(path, sizeof(path)-1, "%s/jpeg/conv_test.jpeg", GDTEST_TOP_DIR);
+ fp = fopen(path, "rb");
+ if (!fp) {
+ gdTestErrorMsg("failed, cannot open file: %s\n", path);
+ return 1;
+ }
+
+ im = gdImageCreateFromJpeg(fp);
+ fclose(fp);
+
+ if (im == NULL) {
+ gdTestErrorMsg("gdImageCreateFromJpeg failed.\n");
+ return 1;
+ }
+ snprintf(path, sizeof(path), "%s/jpeg/conv_test_exp.png", GDTEST_TOP_DIR);
+ if (!gdAssertImageEqualsToFile(path, im)) {
+ gdTestErrorMsg("gdAssertImageEqualsToFile failed: <%s>.\n", path);
+ gdImageDestroy(im);
+ return 1;
+ }
+
+ return 0;
+#endif
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/jpeg_resolution.c b/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/jpeg_resolution.c
new file mode 100644
index 00000000000..386f5f3fee4
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/jpeg/jpeg_resolution.c
@@ -0,0 +1,28 @@
+#include "gd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ void *data;
+ int size, red;
+
+ im = gdImageCreate(100, 100);
+ gdImageSetResolution(im, 72, 300);
+ red = gdImageColorAllocate(im, 0xFF, 0x00, 0x00);
+ gdImageFilledRectangle(im, 0, 0, 99, 99, red);
+ data = gdImageJpegPtr(im, &size, 10);
+ gdImageDestroy(im);
+
+ im = gdImageCreateFromJpegPtr(size, data);
+ gdFree(data);
+ if (!gdTestAssert(gdImageResolutionX(im) == 72) || !gdTestAssert(gdImageResolutionY(im) == 300)) {
+ gdTestErrorMsg("failed image resolution X (%d != 72) or Y (%d != 300)\n", gdImageResolutionX(im), gdImageResolutionY(im));
+ gdImageDestroy(im);
+ return 1;
+ }
+ gdImageDestroy(im);
+ return 0;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/png/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/png/CMakeLists.txt
new file mode 100644
index 00000000000..dd0b4c4145e
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/png/CMakeLists.txt
@@ -0,0 +1,18 @@
+
+SET(TESTS_FILES
+ png_im2im
+ png_null
+ png_resolution
+ bug00011
+ bug00033
+ bug00086
+ bug00088
+ bug00193
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00011.c b/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00011.c
new file mode 100644
index 00000000000..865c87ea5cd
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00011.c
@@ -0,0 +1,27 @@
+/* $Id$ */
+#include "gd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ FILE *fp;
+ char path[2048];
+
+ sprintf(path, "%s/png/emptyfile", GDTEST_TOP_DIR);
+ fp = fopen(path, "rb");
+ if (!fp) {
+ fprintf(stderr, "failed, cannot open file: %s\n", path);
+ return 1;
+ }
+ im = gdImageCreateFromPng(fp);
+ fclose(fp);
+
+ if (!im) {
+ return 0;
+ } else {
+ return 1;
+ }
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00033.c b/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00033.c
new file mode 100644
index 00000000000..f7e90f0824c
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00033.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+#include "gd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ FILE *fp;
+ char path[1024];
+
+ gdSetErrorMethod(gdSilence);
+
+ sprintf(path, "%s/png/bug00033.png", GDTEST_TOP_DIR);
+ fp = fopen(path, "rb");
+ if (!fp) {
+ printf("failed, cannot open file <%s>\n", path);
+ return 1;
+ }
+
+ im = gdImageCreateFromPng(fp);
+ fclose(fp);
+
+ if (im) {
+ gdImageDestroy(im);
+ return 1;
+ } else {
+ return 0;
+ }
+
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00033.png b/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00033.png
new file mode 100644
index 00000000000..73a7d6a3e77
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00033.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00086.c b/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00086.c
new file mode 100644
index 00000000000..ef9d43b2b56
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00086.c
@@ -0,0 +1,33 @@
+/* $Id$ */
+/* id: gdbad3.c, Xavier Roche, May. 2007 */
+/* gcc gdbad3.c -o bad -lgd && ./bad */
+
+#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) {
+ return 0;
+ } else {
+ fprintf(stderr, "failed!\n");
+ gdImageDestroy(im);
+ return 1;
+ }
+ return 0;
+}
+
+/* PNG data */
+static const unsigned char pngdata[93] = {137,80,78,71,13,10,26,10,0,0,
+ 0,13,73,72,68,82,0,0,0,120,0,0,0,131,8,6,0,0,0,70,49,223,8,0,0,0,6,98,
+ 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
+};
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00088.c b/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00088.c
new file mode 100644
index 00000000000..78495aa4410
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00088.c
@@ -0,0 +1,44 @@
+/* $Id$ */
+#include "gd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "gdtest.h"
+
+int main()
+{
+ int error;
+ gdImagePtr im;
+ FILE *fp;
+ char path[1024];
+ const char * files[2] = {"bug00088_1.png", "bug00088_2.png"};
+ const char * files_exp[2] = {"bug00088_1_exp.png", "bug00088_2_exp.png"};
+
+ int i, cnt = 2;
+ error = 0;
+
+ for (i = 0; i < cnt; i++) {
+
+ sprintf(path, "%s/png/%s", GDTEST_TOP_DIR, files[i]);
+ fp = fopen(path, "rb");
+ if (!fp) {
+ printf("failed, cannot open file <%s>\n", path);
+ return 1;
+ }
+
+ im = gdImageCreateFromPng(fp);
+ fclose(fp);
+
+ if (!im) {
+ error |= 1;
+ continue;
+ }
+
+ sprintf(path, "%s/png/%s", GDTEST_TOP_DIR, files_exp[i]);
+ if (!gdAssertImageEqualsToFile(path, im)) {
+ error |= 1;
+ }
+ gdImageDestroy(im);
+ }
+
+ return error;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00088_1.png b/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00088_1.png
new file mode 100644
index 00000000000..3f9a5c7d408
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00088_1.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00088_1_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00088_1_exp.png
new file mode 100644
index 00000000000..25ee05a93c9
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00088_1_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00088_2.png b/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00088_2.png
new file mode 100644
index 00000000000..fa58ffe61c9
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00088_2.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00088_2_exp.png b/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00088_2_exp.png
new file mode 100644
index 00000000000..a21c8408679
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00088_2_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00193.c b/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00193.c
new file mode 100644
index 00000000000..67acf545f67
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/png/bug00193.c
@@ -0,0 +1,43 @@
+#include <stdlib.h>
+#include "gd.h"
+#include "gdhelpers.h"
+#include "gdtest.h"
+
+static gdImagePtr im;
+
+#define TERMINATE(ctx, status) do { \
+ free(ctx); \
+ gdImageDestroy(im); \
+ exit(status); \
+ } while (0)
+
+static void
+failPutC(gdIOCtxPtr ctx, int c)
+{
+ (void)c;
+ TERMINATE(ctx, 1);
+}
+
+static int
+failPutBuf(gdIOCtxPtr ctx, const void * data, int size)
+{
+ (void)data;
+ (void)size;
+ TERMINATE(ctx, 1);
+ return -1;
+}
+
+int main()
+{
+ gdIOCtxPtr ctx;
+
+ gdSetErrorMethod(gdSilence);
+
+ im = gdImageCreate(100, 100);
+ ctx = (gdIOCtxPtr)malloc(sizeof(gdIOCtx));
+ ctx->putC = failPutC;
+ ctx->putBuf = failPutBuf;
+ gdImagePngCtx(im, ctx);
+ TERMINATE(ctx, 0);
+ return 0;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/png/emptyfile b/Build/source/libs/gd/libgd-2.1.0/tests/png/emptyfile
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/png/emptyfile
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/png/png_im2im.c b/Build/source/libs/gd/libgd-2.1.0/tests/png/png_im2im.c
new file mode 100644
index 00000000000..bac5e13aeb7
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/png/png_im2im.c
@@ -0,0 +1,66 @@
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr src, dst;
+ int r, g, b;
+ void *p;
+ int size = 0;
+ int status = 0;
+ CuTestImageResult result = {0, 0};
+
+ src = gdImageCreate(100, 100);
+ if (src == NULL) {
+ printf("could not create src\n");
+ return 1;
+ }
+ r = gdImageColorAllocate(src, 0xFF, 0, 0);
+ g = gdImageColorAllocate(src, 0, 0xFF, 0);
+ b = gdImageColorAllocate(src, 0, 0, 0xFF);
+ gdImageFilledRectangle(src, 0, 0, 99, 99, r);
+ gdImageRectangle(src, 20, 20, 79, 79, g);
+ gdImageEllipse(src, 70, 25, 30, 20, b);
+
+#define OUTPUT_PNG(name) do { \
+ FILE *fp; \
+ \
+ fp = fopen("png_im2im_" #name ".png", "wb"); \
+ if (fp) { \
+ gdImagePng(name, fp); \
+ fclose(fp); \
+ } \
+ } while (0)
+
+ OUTPUT_PNG(src);
+ p = gdImagePngPtr(src, &size);
+ if (p == NULL) {
+ status = 1;
+ printf("p is null\n");
+ goto door0;
+ }
+ if (size <= 0) {
+ status = 1;
+ printf("size is non-positive\n");
+ goto door1;
+ }
+
+ dst = gdImageCreateFromPngPtr(size, p);
+ if (dst == NULL) {
+ status = 1;
+ printf("could not create dst\n");
+ goto door1;
+ }
+ OUTPUT_PNG(dst);
+ gdTestImageDiff(src, dst, NULL, &result);
+ if (result.pixels_changed > 0) {
+ status = 1;
+ printf("pixels changed: %d\n", result.pixels_changed);
+ }
+ gdImageDestroy(dst);
+door1:
+ gdFree(p);
+door0:
+ gdImageDestroy(src);
+ return status;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/png/png_null.c b/Build/source/libs/gd/libgd-2.1.0/tests/png/png_null.c
new file mode 100644
index 00000000000..d3b5e6a963b
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/png/png_null.c
@@ -0,0 +1,17 @@
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+
+ gdSetErrorMethod(gdSilence);
+
+ im = gdImageCreateFromPng(NULL);
+ if (im != NULL) {
+ gdImageDestroy(im);
+ return 1;
+ }
+ gdImagePng(im, NULL); /* noop safely */
+ return 0;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/png/png_resolution.c b/Build/source/libs/gd/libgd-2.1.0/tests/png/png_resolution.c
new file mode 100644
index 00000000000..aed7545ba51
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/png/png_resolution.c
@@ -0,0 +1,30 @@
+#include "gd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ void *data;
+ int size, red;
+
+ im = gdImageCreate(100, 100);
+ gdImageSetResolution(im, 72, 300);
+ red = gdImageColorAllocate(im, 0xFF, 0x00, 0x00);
+ gdImageFilledRectangle(im, 0, 0, 99, 99, red);
+ data = gdImagePngPtr(im, &size);
+ gdImageDestroy(im);
+
+ im = gdImageCreateFromPngPtr(size, data);
+ gdFree(data);
+
+ if (!gdTestAssert(gdImageResolutionX(im) == 72) || !gdTestAssert(gdImageResolutionY(im) == 300)) {
+ gdTestErrorMsg("failed image resolution X (%d != 72) or Y (%d != 300)\n", gdImageResolutionX(im), gdImageResolutionY(im));
+ gdImageDestroy(im);
+ return 1;
+ }
+
+ gdImageDestroy(im);
+ return 0;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/test_config.h.in b/Build/source/libs/gd/libgd-2.1.0/tests/test_config.h.in
new file mode 100644
index 00000000000..bfa8127889f
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/test_config.h.in
@@ -0,0 +1,3 @@
+/* Define the full path to the top src dir, required to get the path
+ * of each input data */
+#define GDTEST_TOP_DIR "@srcdir@"
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/tga/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/tga/CMakeLists.txt
new file mode 100644
index 00000000000..a88872a2c6d
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/tga/CMakeLists.txt
@@ -0,0 +1,11 @@
+
+SET(TESTS_FILES
+ tga_null
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/tga/tga_null.c b/Build/source/libs/gd/libgd-2.1.0/tests/tga/tga_null.c
new file mode 100644
index 00000000000..f61078c32f5
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/tga/tga_null.c
@@ -0,0 +1,13 @@
+#include "gd.h"
+
+int main()
+{
+ gdImagePtr im;
+
+ im = gdImageCreateFromTga(NULL);
+ if (im != NULL) {
+ gdImageDestroy(im);
+ return 1;
+ }
+ return 0;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/tiff/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/tiff/CMakeLists.txt
new file mode 100644
index 00000000000..aefdaf7e032
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/tiff/CMakeLists.txt
@@ -0,0 +1,12 @@
+
+SET(TESTS_FILES
+ tiff_im2im
+ tiff_null
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/tiff/tiff_im2im.c b/Build/source/libs/gd/libgd-2.1.0/tests/tiff/tiff_im2im.c
new file mode 100644
index 00000000000..4b6136d4b92
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/tiff/tiff_im2im.c
@@ -0,0 +1,70 @@
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr src, dst;
+ int r, g, b;
+ void *p;
+ int size = 0;
+ int status = 0;
+#if 0
+ CuTestImageResult result = {0, 0};
+#endif
+
+ src = gdImageCreate(100, 100);
+ if (src == NULL) {
+ printf("could not create src\n");
+ return 1;
+ }
+ r = gdImageColorAllocate(src, 0xFF, 0, 0);
+ g = gdImageColorAllocate(src, 0, 0xFF, 0);
+ b = gdImageColorAllocate(src, 0, 0, 0xFF);
+ gdImageFilledRectangle(src, 0, 0, 99, 99, r);
+ gdImageRectangle(src, 20, 20, 79, 79, g);
+ gdImageEllipse(src, 70, 25, 30, 20, b);
+
+#define OUTPUT_TIFF(name) do { \
+ FILE *fp; \
+ \
+ fp = fopen("tiff_im2im_" #name ".tiff", "wb"); \
+ if (fp) { \
+ gdImageTiff(name, fp); \
+ fclose(fp); \
+ } \
+ } while (0)
+
+ OUTPUT_TIFF(src);
+ p = gdImageTiffPtr(src, &size);
+ if (p == NULL) {
+ status = 1;
+ printf("p is null\n");
+ goto door0;
+ }
+ if (size <= 0) {
+ status = 1;
+ printf("size is non-positive\n");
+ goto door1;
+ }
+
+ dst = gdImageCreateFromTiffPtr(size, p);
+ if (dst == NULL) {
+ status = 1;
+ printf("could not create dst\n");
+ goto door1;
+ }
+ OUTPUT_TIFF(dst);
+#if 0
+ gdTestImageDiff(src, dst, NULL, &result);
+ if (result.pixels_changed > 0) {
+ status = 1;
+ printf("pixels changed: %d\n", result.pixels_changed);
+ }
+#endif
+ gdImageDestroy(dst);
+door1:
+ gdFree(p);
+door0:
+ gdImageDestroy(src);
+ return status;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/tiff/tiff_null.c b/Build/source/libs/gd/libgd-2.1.0/tests/tiff/tiff_null.c
new file mode 100644
index 00000000000..ccaade7498f
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/tiff/tiff_null.c
@@ -0,0 +1,14 @@
+#include "gd.h"
+
+int main()
+{
+ gdImagePtr im;
+
+ im = gdImageCreateFromTiff(NULL);
+ if (im != NULL) {
+ gdImageDestroy(im);
+ return 1;
+ }
+ gdImageTiff(im, NULL); /* noop safely */
+ return 0;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/wbmp/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/wbmp/CMakeLists.txt
new file mode 100644
index 00000000000..aac4f69ad44
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/wbmp/CMakeLists.txt
@@ -0,0 +1,12 @@
+
+SET(TESTS_FILES
+ wbmp_im2im
+ wbmp_null
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/wbmp/wbmp_im2im.c b/Build/source/libs/gd/libgd-2.1.0/tests/wbmp/wbmp_im2im.c
new file mode 100644
index 00000000000..826c7fa953c
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/wbmp/wbmp_im2im.c
@@ -0,0 +1,64 @@
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr src, dst;
+ int b;
+ void *p;
+ int size = 0;
+ int status = 0;
+ CuTestImageResult result = {0, 0};
+
+ src = gdImageCreate(100, 100);
+ if (src == NULL) {
+ printf("could not create src\n");
+ return 1;
+ }
+ gdImageColorAllocate(src, 0xFF, 0xFF, 0xFF); /* allocate white for background color */
+ b = gdImageColorAllocate(src, 0, 0, 0);
+ gdImageRectangle(src, 20, 20, 79, 79, b);
+ gdImageEllipse(src, 70, 25, 30, 20, b);
+
+#define OUTPUT_WBMP(name) do { \
+ FILE *fp; \
+ \
+ fp = fopen("wbmp_im2im_" #name ".wbmp", "wb"); \
+ if (fp) { \
+ gdImageWBMP(name, 1, fp); \
+ fclose(fp); \
+ } \
+ } while (0)
+
+ OUTPUT_WBMP(src);
+ p = gdImageWBMPPtr(src, &size, 1);
+ if (p == NULL) {
+ status = 1;
+ printf("p is null\n");
+ goto door0;
+ }
+ if (size <= 0) {
+ status = 1;
+ printf("size is non-positive\n");
+ goto door1;
+ }
+
+ dst = gdImageCreateFromWBMPPtr(size, p);
+ if (dst == NULL) {
+ status = 1;
+ printf("could not create dst\n");
+ goto door1;
+ }
+ OUTPUT_WBMP(dst);
+ gdTestImageDiff(src, dst, NULL, &result);
+ if (result.pixels_changed > 0) {
+ status = 1;
+ printf("pixels changed: %d\n", result.pixels_changed);
+ }
+ gdImageDestroy(dst);
+door1:
+ gdFree(p);
+door0:
+ gdImageDestroy(src);
+ return status;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/wbmp/wbmp_null.c b/Build/source/libs/gd/libgd-2.1.0/tests/wbmp/wbmp_null.c
new file mode 100644
index 00000000000..d70f38d01bf
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/wbmp/wbmp_null.c
@@ -0,0 +1,14 @@
+#include "gd.h"
+
+int main()
+{
+ gdImagePtr im;
+
+ im = gdImageCreateFromWBMP(NULL);
+ if (im != NULL) {
+ gdImageDestroy(im);
+ return 1;
+ }
+ gdImageWBMP(im, 0, NULL); /* noop safely */
+ return 0;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/xpm/CMakeLists.txt b/Build/source/libs/gd/libgd-2.1.0/tests/xpm/CMakeLists.txt
new file mode 100644
index 00000000000..f90d3c6caec
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/xpm/CMakeLists.txt
@@ -0,0 +1,13 @@
+
+SET(TESTS_FILES
+ bug00166
+ bug00185
+ color_name
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest)
+ get_target_property(test_path ${test_name} LOCATION)
+ ADD_TEST(${test_name} ${test_path})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/xpm/bug00166.c b/Build/source/libs/gd/libgd-2.1.0/tests/xpm/bug00166.c
new file mode 100644
index 00000000000..2ffd6af25a2
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/xpm/bug00166.c
@@ -0,0 +1,29 @@
+/* $Id$ */
+#include "gd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "gdtest.h"
+
+int
+main(void)
+{
+ gdImagePtr im;
+ char path[1024];
+ int c, result;
+
+ sprintf(path, "%s/xpm/bug00166.xpm", GDTEST_TOP_DIR);
+ im = gdImageCreateFromXpm(path);
+ if (!im) {
+ return 2;
+ }
+ c = gdImageGetPixel(im, 1, 1);
+ if (gdImageRed(im, c) == 0xAA
+ && gdImageGreen(im, c) == 0xBB
+ && gdImageBlue(im, c) == 0xCC) {
+ result = 0;
+ } else {
+ result = 1;
+ }
+ gdImageDestroy(im);
+ return result;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/xpm/bug00166.xpm b/Build/source/libs/gd/libgd-2.1.0/tests/xpm/bug00166.xpm
new file mode 100644
index 00000000000..90c6cd387e7
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/xpm/bug00166.xpm
@@ -0,0 +1,12 @@
+/* XPM */
+static char * a[] = {
+/* width height colors cpp */
+"4 4 3 1",
+" c None",
+"@ c #abc",
+". c #def",
+/* pixels */
+" .. ",
+".@@.",
+".@@.",
+" .. "};
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/xpm/bug00185.c b/Build/source/libs/gd/libgd-2.1.0/tests/xpm/bug00185.c
new file mode 100644
index 00000000000..2dda809cc96
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/xpm/bug00185.c
@@ -0,0 +1,25 @@
+/* $Id$ */
+#include "gd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "gdtest.h"
+
+/* To check memory leaks, run such as 'valgrind --leak-check=full ./bug00185' */
+int
+main()
+{
+ gdImagePtr im;
+ char path[1024];
+
+ sprintf(path, "%s/xpm/bug00185.xpm", GDTEST_TOP_DIR);
+ im = gdImageCreateFromXpm(path);
+ if (!im) return 1;
+ gdImageDestroy(im);
+
+ sprintf(path, "%s/xpm/bug00185_damaged.xpm", GDTEST_TOP_DIR);
+ im = gdImageCreateFromXpm(path);
+ if (!im) return 0;
+ gdImageDestroy(im);
+
+ return 2;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/xpm/bug00185.xpm b/Build/source/libs/gd/libgd-2.1.0/tests/xpm/bug00185.xpm
new file mode 100644
index 00000000000..bb7cd7975a8
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/xpm/bug00185.xpm
@@ -0,0 +1,12 @@
+/* XPM */
+static char * a[] = {
+/* width height colors cpp */
+"4 4 3 1",
+" c None",
+"x c #ff00ff",
+". c #ff0000",
+/* pixels */
+" ..x",
+".xxx",
+"xxx.",
+"x.. "};
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/xpm/bug00185_damaged.xpm b/Build/source/libs/gd/libgd-2.1.0/tests/xpm/bug00185_damaged.xpm
new file mode 100644
index 00000000000..b0c7d61be5e
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/xpm/bug00185_damaged.xpm
@@ -0,0 +1,11 @@
+/* XPM */
+static char * a[] = {
+/* width height colors cpp */
+"4 4 3 1",
+" c None",
+"x c #ff00ff",
+". c #ff0000",
+/* pixels */
+" ..x",
+"xxx.",
+"x.. "
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/xpm/color_name.c b/Build/source/libs/gd/libgd-2.1.0/tests/xpm/color_name.c
new file mode 100644
index 00000000000..22481785a83
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/xpm/color_name.c
@@ -0,0 +1,29 @@
+/* $Id$ */
+#include "gd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "gdtest.h"
+
+int
+main(void)
+{
+ gdImagePtr im;
+ char path[1024];
+ int c, result;
+
+ sprintf(path, "%s/xpm/color_name.xpm", GDTEST_TOP_DIR);
+ im = gdImageCreateFromXpm(path);
+ if (!im) {
+ return 2;
+ }
+ c = gdImageGetPixel(im, 2, 2);
+ if (gdImageRed(im, c) == 0xFF
+ && gdImageGreen(im, c) == 0xFF
+ && gdImageBlue(im, c) == 0x0) {
+ result = 0;
+ } else {
+ result = 1;
+ }
+ gdImageDestroy(im);
+ return result;
+}
diff --git a/Build/source/libs/gd/libgd-2.1.0/tests/xpm/color_name.xpm b/Build/source/libs/gd/libgd-2.1.0/tests/xpm/color_name.xpm
new file mode 100644
index 00000000000..4733789245d
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0/tests/xpm/color_name.xpm
@@ -0,0 +1,17 @@
+/* XPM */
+static char *color_name = {
+"3 5 6 1",
+
+" c None",
+"A c AliceBlue",
+"b c blue",
+"c c cyan",
+"w c wheat",
+"y c yellow",
+
+" A ",
+"AbA",
+"yby",
+"ycy",
+"wcw",
+};