cvs: gd /libgd/tests CMakeLists.txt Makefile.am /libgd/tests/gdimagestringft CMakeLists.txt Makefile.am gdimagestringft_bbox.c

From: Date: Tue, 05 May 2009 17:28:22 +0000
Subject: cvs: gd /libgd/tests CMakeLists.txt Makefile.am /libgd/tests/gdimagestringft CMakeLists.txt Makefile.am gdimagestringft_bbox.c
Groups: php.gd.cvs 
Request: Send a blank email to php-gd-cvs+get-615@lists.php.net to get a copy of this message
tabe Tue May 5 17:28:22 2009 UTC Added files: /gd/libgd/tests/gdimagestringft CMakeLists.txt Makefile.am gdimagestringft_bbox.c Modified files: /gd/libgd/tests CMakeLists.txt Makefile.am Log: added test to sort regressions like php #43073 (TrueType bounding box is wrong for angle<>0) http://cvs.php.net/viewvc.cgi/gd/libgd/tests/CMakeLists.txt?r1=1.13&r2=1.14&diff_format=u Index: gd/libgd/tests/CMakeLists.txt diff -u gd/libgd/tests/CMakeLists.txt:1.13 gd/libgd/tests/CMakeLists.txt:1.14 --- gd/libgd/tests/CMakeLists.txt:1.13 Mon Apr 20 09:49:29 2009 +++ gd/libgd/tests/CMakeLists.txt Tue May 5 17:28:21 2009 @@ -42,6 +42,7 @@ gdimagepixelate gdimagerectangle gdimagesetpixel + gdimagestringft gdimagestringftex gdtiled gif http://cvs.php.net/viewvc.cgi/gd/libgd/tests/Makefile.am?r1=1.7&r2=1.8&diff_format=u Index: gd/libgd/tests/Makefile.am diff -u gd/libgd/tests/Makefile.am:1.7 gd/libgd/tests/Makefile.am:1.8 --- gd/libgd/tests/Makefile.am:1.7 Mon Apr 20 09:49:29 2009 +++ gd/libgd/tests/Makefile.am Tue May 5 17:28:21 2009 @@ -21,6 +21,7 @@ gdimagepixelate \ gdimagerectangle \ gdimagesetpixel \ + gdimagestringft \ gdimagestringftex \ gdtiled \ gif \ http://cvs.php.net/viewvc.cgi/gd/libgd/tests/gdimagestringft/CMakeLists.txt?view=markup&rev=1.1 Index: gd/libgd/tests/gdimagestringft/CMakeLists.txt +++ gd/libgd/tests/gdimagestringft/CMakeLists.txt SET(TESTS_FILES gdimagestringft_bbox ) FOREACH(test_name ${TESTS_FILES}) add_executable(${test_name} "${test_name}.c") target_link_libraries (${test_name} ${GDTESTS_TARGET_LINK}) get_target_property(test_path ${test_name} LOCATION) ADD_TEST(${test_name} ${test_path}) ENDFOREACH(test_name) http://cvs.php.net/viewvc.cgi/gd/libgd/tests/gdimagestringft/Makefile.am?view=markup&rev=1.1 Index: gd/libgd/tests/gdimagestringft/Makefile.am +++ gd/libgd/tests/gdimagestringft/Makefile.am ## Process this file with automake to produce Makefile.in -*-Makefile-*- EXTRA_DIST = CMakeLists.txt gdimagestringft_bbox.c http://cvs.php.net/viewvc.cgi/gd/libgd/tests/gdimagestringft/gdimagestringft_bbox.c?view=markup&rev=1.1 Index: gd/libgd/tests/gdimagestringft/gdimagestringft_bbox.c +++ gd/libgd/tests/gdimagestringft/gdimagestringft_bbox.c #include "gd.h" #include <stdio.h> #include <stdlib.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 bg, 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); bg = gdImageColorAllocate(im, 0xFF, 0xFF, 0xFF); 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; }

« previous php.gd.cvs (#615) next »