cvs: gd(GD_2_0) /libgd/src/tests/gdtiled bug00032.c
[email protected] ("Pierre-Alain Joye") Mon, 10 Mar 2008 01:50:30 -0000
| Newsgroups | php.gd.cvs |
|---|---|
| Message-ID | <cvspajoye1205113830@cvsserver> |
pajoye Mon Mar 10 01:50:30 2008 UTC
Modified files: (Branch: GD_2_0)
/gd/libgd/src/tests/gdtiled bug00032.c
Log:
- fix test on windows and remove possible leak when the system runs out of
memory (or the image creation failed for unknown reason)
http://cvs.php.net/viewvc.cgi/gd/libgd/src/tests/gdtiled/bug00032.c?r1=1.1&r2=1.1.2.1&diff_format=u
Index: gd/libgd/src/tests/gdtiled/bug00032.c
diff -u gd/libgd/src/tests/gdtiled/bug00032.c:1.1 gd/libgd/src/tests/gdtiled/bug00032.c:1.1.2.1
--- gd/libgd/src/tests/gdtiled/bug00032.c:1.1 Tue Jan 23 23:57:54 2007
+++ gd/libgd/src/tests/gdtiled/bug00032.c Mon Mar 10 01:50:30 2008
@@ -2,26 +2,37 @@
#include <stdio.h>
#include "gdtest.h"
-#define exp_img "bug00032_exp.png"
-
int main()
{
gdImagePtr im, tile;
char exp[] = "bug00032_exp.png";
FILE *fp;
+ const char *file_exp = "bug00132_exp.png";
+ char path[2048];
tile = gdImageCreateTrueColor(10, 10);
+ if (!im) {
+ fprintf(stderr, "Can't create a 10x10 true color image.");
+ return -1;
+ }
+
gdImageFill(tile, 0, 0, 0xFFFFFF);
gdImageLine(tile, 0,0, 9,9, 0xff0000);
gdImageColorTransparent(tile, 0xFFFFFF);
im = gdImageCreateTrueColor(50, 50);
+ if (!im) {
+ fprintf(stderr, "Can't create a 50x50 true color image.");
+ gdImageDestroy(tile);
+ return -1;
+ }
gdImageFilledRectangle(im, 0, 0, 25, 25, 0x00FF00);
gdImageSetTile(im, tile);
gdImageFilledRectangle(im, 10, 10, 49, 49, gdTiled);
- gdAssertImageEqualsToFile(exp_img, im);
+ sprintf(path, "%s/gdtiled/%s", GDTEST_TOP_DIR, file_exp);
+ gdAssertImageEqualsToFile(path, im);
/* Destroy it */
gdImageDestroy(im);