Anonymous avatar Anonymous committed 0d3aace

- remove temporary tests before adding the tests suite

Comments (0)

Files changed (16)

src/tests/README

-TODO:
-- port the test suites
-- fill this doc :)

src/tests/bug00001.c

-#include "gd.h"
-
-int main(int argc, char * argv[])
-{
- 	gdImagePtr im;
- 	int black;
- 	int white;
- 	int brect[8];
- 	int x, y;
- 	char *err;
-	FILE *fp;
-	
- 	/* String to draw: 
- 	 * The first argument if there is one, or "Hello." */
- 	char *s = argc>1?argv[1]:"Hello.";
- 	double sz = 40.;
-
- 	/* User supplied font */
-    char *f = "/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf";
-
- 	/* obtain brect so that we can size the image */
- 	err = gdImageStringFT(NULL,&brect[0],0,f,sz,0.,0,0,s);
- 	if (err) {fprintf(stderr,err); return 1;}
-
- 	/* create an image big enough for the string plus a little whitespace */
- 	x = brect[2]-brect[6] + 6;
- 	y = brect[3]-brect[7] + 6;
- 	im = gdImageCreate(x,y);
-
- 	/* Background color (first allocated) */
- 	white = gdImageColorResolve(im, 255, 255, 255);
- 	black = gdImageColorResolve(im, 0, 0, 0);
-
- 	/* render the string, offset origin to center string*/
- 	/* note that we use top-left coordinate for adjustment
- 	 * since gd origin is in top-left with y increasing downwards. */
- 	x = 3 - brect[6];
- 	y = 3 - brect[7];
- 	err = gdImageStringFT(im,&brect[0],black,f,sz,0.0,x,y,s);
- 	if (err) {fprintf(stderr,err); return 1;}
-	fp = fopen("a.png", "wb");
- 	/* Write img to stdout */
- 	gdImagePng(im,fp);
-	fclose(fp);
-
- 	/* Destroy it */
- 	gdImageDestroy(im);
-
- 	return 0;
-}

src/tests/bug00002_1.c

-#include <gd.h>
-#include <stdio.h>
-
-int main()
-{
-	gdImagePtr im;
-	FILE *fp;
-
-	fputs("flag 0\n", stdout);
-	im = gdImageCreateTrueColor(100, 100);
-
-	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);
-
-	fp = fopen("a.png", "wb");
- 	/* Write img to stdout */
- 	gdImagePng(im,fp);
-	fclose(fp);
-
- 	/* Destroy it */
- 	gdImageDestroy(im);
-	return 0;
-}
-

src/tests/bug00002_2.c

-#include <gd.h>
-#include <stdio.h>
-
-int main()
-{
-	gdImagePtr im, tile;
-	int im_white, im_black, tile_white, tile_black;
-	int x,y;
-	FILE *fp;
-
-	fputs("flag 0\n", stdout);
-	im = gdImageCreate(150, 150);
-	tile = gdImageCreate(36, 36);
-	tile_white = gdImageColorAllocate(tile,255,255,255);
-	tile_black = gdImageColorAllocate(tile,0,0,0);
-	im_white = gdImageColorAllocate(im,255,255,255);
-	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 3\n", stdout);
-
-	fp = fopen("a.png", "wb");
- 	/* Write img to stdout */
- 	gdImagePng(im,fp);
-	fclose(fp);
-
- 	/* Destroy it */
- 	gdImageDestroy(im);
-	return 0;
-}
-

src/tests/bug00002_3.c

-/* $Id$ */
-#include <gd.h>
-#include <stdio.h>
-
-int main()
-{
-	gdImagePtr im, tile;
-	int im_white, im_black, tile_white, tile_black;
-	int x,y;
-	FILE *fp;
-
-	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);
-	im_white = gdImageColorAllocate(im,255,255,255);
-	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);
-
-	fp = fopen("a.png", "wb");
- 	/* Write img to stdout */
- 	gdImagePng(im,fp);
-	fclose(fp);
-
- 	/* Destroy it */
- 	gdImageDestroy(im);
-	return 0;
-}
-

src/tests/bug00003.c

-#include "gd.h"
-
-int main()
-{
- 	gdImagePtr im;
-	FILE *fp;
-
-
-	im = gdImageCreateTrueColor(100,100);
-	gdImageRectangle(im, 2,2, 80,95, 0x50FFFFFF);
-	fp = fopen("a.png", "wb");
- 	/* Write img to stdout */
- 	gdImagePng(im,fp);
-	fclose(fp);
-
- 	/* Destroy it */
- 	gdImageDestroy(im);
-
- 	return 0;
-}

src/tests/bug00004.c

-#include "gd.h"
-
-int main()
-{
- 	gdImagePtr im;
-	FILE *fp;
-	int trans_c = gdTrueColorAlpha(255,0,0,0);
-
-	im = gdImageCreateTrueColor(192, 36);
-	gdImageColorTransparent(im, trans_c);
-	gdImageFilledRectangle(im, 2,2, 80,95, 0x50FFFFFF);
-	gdImageFilledRectangle(im, 0,0, 192,36, trans_c);
-	fp = fopen("a.png", "wb");
- 	gdImageGif(im,fp);
-	fclose(fp);
-
- 	/* Destroy it */
- 	gdImageDestroy(im);
-
- 	return 0;
-}

src/tests/bug00005.c

-#include "gd.h"
-
-int main()
-{
- 	gdImagePtr im;
-	char * giffiles[3] = {"bug00005_1.gif", "bug00005_2.gif", "bug00005_3.gif"};
-
-	FILE *fp;
-	int i = 0;
-	const int files_cnt = 3;
-
-	for (i=0; i < files_cnt; i++) {
-		fp = fopen(giffiles[i], "rb");
-		if (!fp) {
-			fprintf(stderr, "Input file does not exist!\n");
-			return 1;
-		}
-
-		im = gdImageCreateFromGif(fp);
-
-		if (!im) {
-			fprintf(stderr, "%s Invalid GIF file\n", giffiles[i]);
-		} else {
-			fprintf(stderr, "%s valid GIF file\n", giffiles[i]);
-		 	gdImageDestroy(im);
-		}
-	}
-
- 	return 0;
-}
Add a comment to this file

src/tests/bug00005_1.gif

Removed
Old image
-GIF89a
-<
-
-����, �Ҷ�˵���˲�����
Add a comment to this file

src/tests/bug00005_2.gif

Removed
Old image
Add a comment to this file

src/tests/bug00005_3.gif

Removed
Old image

src/tests/bug00007.c

-#include "gd.h"
-
-int main()
-{
- 	gdImagePtr dst_tc, src;
-	FILE *fp;
-	int c0,c1,c3;
-
-	src  = gdImageCreate(5,5);
-	c0 = gdImageColorAllocate(src, 255,255,255);
-	c1 = gdImageColorAllocateAlpha(src, 255,0,0,70);
-
-	gdImageAlphaBlending(src, 0);
-	gdImageFill(src, 0,0, c1);
-
-	dst_tc  = gdImageCreateTrueColor(5,5);
-	gdImageAlphaBlending(dst_tc, 0);
-
-	gdImageCopy(dst_tc, src, 0,0, 0,0, gdImageSX(src), gdImageSY(src));
-
-	fp = fopen("a.png", "wb");
- 	gdImagePng(dst_tc, fp);
-	fclose(fp);
-
- 	/* Destroy it */
- 	gdImageDestroy(src);
- 	gdImageDestroy(dst_tc);
-
- 	return 0;
-}

src/tests/bug00008.c

-#include "gd.h"
-
-int main()
-{
- 	gdImagePtr im;
-	FILE *fp;
-	int c0,c1,c3;
-	int red, blue, white, black;
-
-	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);
-
-	fp = fopen("a.png", "wb");
- 	gdImagePng(im, fp);
-	fclose(fp);
-
- 	/* Destroy it */
- 	gdImageDestroy(im);
-
- 	return 0;
-}

src/tests/bug00010.c

-/* $Id$ */
-#include "gd.h"
-
-int main()
-{
- 	gdImagePtr im;
-	FILE *fp;
-
-	im = gdImageCreateTrueColor(100,100);
-	
-	gdImageFilledEllipse(im, 50,50, 70, 90, 0x50FFFFFF);
-
-	fp = fopen("bug00010_out.png", "wb");
- 	gdImagePng(im, fp);
-	fclose(fp);
-
- 	/* Destroy it */
- 	gdImageDestroy(im);
-
- 	return 0;
-}

src/tests/bug00011.c

-/* $Id$ */
-#include "gd.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-int main()
-{
- 	gdImagePtr im;
-	FILE *fp;
-
-	fp = fopen("emptyfile", "rb");
-	if (!fp) {
-		printf("failed, cannot open file\n");
-	}
-	im = gdImageCreateFromPng(fp);
-	fclose(fp);
-	if (!im) {
-		printf("ok\n");
-		/* Success */
-		exit(0);
-	}		
-	printf("failed\n");
- 	/* Test fails */
- 	gdImageDestroy(im);
-
-	exit(1);
-}
Add a comment to this file

src/tests/emptyfile

Empty file removed.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.