add testcase for gdimagecreatefromgd2part
parent
04bb9a08b3
commit
ef952d4ca5
|
@ -3,6 +3,7 @@
|
|||
/bug00309
|
||||
/bug00354
|
||||
/bug00383
|
||||
/createimagefromgd2part
|
||||
/createimagefromgd2partptr
|
||||
/gd2_empty_file
|
||||
/gd2_im2im
|
||||
|
|
|
@ -6,6 +6,7 @@ LIST(APPEND TESTS_FILES
|
|||
bug00309
|
||||
bug00354
|
||||
bug00383
|
||||
createimagefromgd2part
|
||||
createimagefromgd2partptr
|
||||
gd2_empty_file
|
||||
php_bug_72339
|
||||
|
|
|
@ -6,6 +6,7 @@ libgd_test_programs += \
|
|||
gd2/bug00309 \
|
||||
gd2/bug00354 \
|
||||
gd2/bug00383 \
|
||||
gd2/createimagefromgd2part \
|
||||
gd2/createimagefromgd2partptr \
|
||||
gd2/gd2_empty_file \
|
||||
gd2/php_bug_72339 \
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
*Base test for gdImageCreateFromGd2Part()
|
||||
*/
|
||||
#include "gd.h"
|
||||
#include "gdtest.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
gdImagePtr im;
|
||||
FILE *p;
|
||||
int expected_color = 0xffffff;
|
||||
int actual_color = 0;
|
||||
|
||||
p = gdTestFileOpen2("gd2", "conv_test.gd2");
|
||||
|
||||
if (!p) {
|
||||
gdTestErrorMsg("failed, connot open gd2 file: conv_test.gd2");
|
||||
return 1;
|
||||
}
|
||||
|
||||
im = gdImageCreateFromGd2Part(p, 3, 3, 3, 3);
|
||||
fclose(p);
|
||||
|
||||
if (!im) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
actual_color = gdImageGetPixel(im, 2, 2);
|
||||
gdImageDestroy(im);
|
||||
gdTestAssert(expected_color == actual_color);
|
||||
|
||||
return gdNumFailures();
|
||||
}
|
Loading…
Reference in New Issue