summaryrefslogtreecommitdiff
path: root/Build/source/libs/gd/gd-2.0.35/tests/gdimageline
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2009-03-20 07:58:16 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2009-03-20 07:58:16 +0000
commit10d837d22d7d99b26f44847f92501f6037da4ec2 (patch)
treecbef7ae7354e10886bec8a68e5637e7d754c33eb /Build/source/libs/gd/gd-2.0.35/tests/gdimageline
parent453e4a6601ed7f8a08029211434be8e58fc452a9 (diff)
new build system
git-svn-id: svn://tug.org/texlive/trunk@12450 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/gd/gd-2.0.35/tests/gdimageline')
-rw-r--r--Build/source/libs/gd/gd-2.0.35/tests/gdimageline/CMakeLists.txt12
-rw-r--r--Build/source/libs/gd/gd-2.0.35/tests/gdimageline/bug00072.c38
-rw-r--r--Build/source/libs/gd/gd-2.0.35/tests/gdimageline/bug00072_exp.pngbin0 -> 133 bytes
-rw-r--r--Build/source/libs/gd/gd-2.0.35/tests/gdimageline/bug00077.c34
-rw-r--r--Build/source/libs/gd/gd-2.0.35/tests/gdimageline/bug00077_exp.pngbin0 -> 97 bytes
-rw-r--r--Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa.c76
-rw-r--r--Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_a_0_exp.pngbin0 -> 198 bytes
-rw-r--r--Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_a_1_exp.pngbin0 -> 202 bytes
-rw-r--r--Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_b_0_exp.pngbin0 -> 343 bytes
-rw-r--r--Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_b_1_exp.pngbin0 -> 197 bytes
-rw-r--r--Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_c_0_exp.pngbin0 -> 200 bytes
-rw-r--r--Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_c_1_exp.pngbin0 -> 194 bytes
-rw-r--r--Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_d_0_exp.pngbin0 -> 196 bytes
-rw-r--r--Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_d_1_exp.pngbin0 -> 177 bytes
-rw-r--r--Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_outofrange.c20
15 files changed, 180 insertions, 0 deletions
diff --git a/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/CMakeLists.txt b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/CMakeLists.txt
new file mode 100644
index 00000000000..a39203dbd57
--- /dev/null
+++ b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/CMakeLists.txt
@@ -0,0 +1,12 @@
+SET(TESTS_FILES
+ gdimageline_aa
+ gdimageline_aa_outofrange
+ bug00077
+ bug00072
+)
+
+FOREACH(test_name ${TESTS_FILES})
+ add_executable(${test_name} "${test_name}.c")
+ target_link_libraries (${test_name} gdTest ${GD_LIB})
+ ADD_TEST(${test_name} ${EXECUTABLE_OUTPUT_PATH}/${test_name})
+ENDFOREACH(test_name)
diff --git a/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/bug00072.c b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/bug00072.c
new file mode 100644
index 00000000000..3bacd85d2a7
--- /dev/null
+++ b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/bug00072.c
@@ -0,0 +1,38 @@
+#include "gdtest.h"
+#include "gd.h"
+
+int main()
+{
+ gdImagePtr im;
+ const char *exp = "bug00072_exp.png";
+ const int files_cnt = 4;
+ FILE *fp;
+ int i = 0;
+ 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/gd-2.0.35/tests/gdimageline/bug00072_exp.png b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/bug00072_exp.png
new file mode 100644
index 00000000000..6439e061f1d
--- /dev/null
+++ b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/bug00072_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/bug00077.c b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/bug00077.c
new file mode 100644
index 00000000000..8f04c4990f0
--- /dev/null
+++ b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/bug00077.c
@@ -0,0 +1,34 @@
+#include "gdtest.h"
+#include "gd.h"
+
+int main()
+{
+ gdImagePtr im;
+ const char *exp = "bug00077_exp.png";
+ const int files_cnt = 4;
+ FILE *fp;
+ int i = 0;
+ 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/gd-2.0.35/tests/gdimageline/bug00077_exp.png b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/bug00077_exp.png
new file mode 100644
index 00000000000..bfa097a5c56
--- /dev/null
+++ b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/bug00077_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa.c b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa.c
new file mode 100644
index 00000000000..5c3cf0703c5
--- /dev/null
+++ b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa.c
@@ -0,0 +1,76 @@
+#include <gd.h>
+#include <stdio.h>
+#include <math.h>
+#include "gdtest.h"
+
+
+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)) {
+ printf("%s failed\n", filename);
+ error = 1;
+ }
+ gdImageDestroy(im);
+ return error;
+}
+
+int main()
+{
+ int i;
+ int error = 0;
+ char path[1024];
+ const char *srcdir;
+ int n;
+
+ sprintf(path, "%s/gdimageline/gdimageline_aa_a_0_exp.png", GDTEST_TOP_DIR);
+ error |= gen_image(path,0,1,10,100, 1);
+
+ sprintf(path, "%s/gdimageline/gdimageline_aa_a_1_exp.png", GDTEST_TOP_DIR);
+ error |= gen_image(path,1,1,10,100, 2);
+
+ sprintf(path, "%s/gdimageline/gdimageline_aa_b_0_exp.png", GDTEST_TOP_DIR);
+ error |= gen_image(path,2,-1,10,100, 1);
+ sprintf(path, "%s/gdimageline/gdimageline_aa_b_1_exp.png", GDTEST_TOP_DIR);
+ error |= gen_image(path,1,-1,10,100, 2);
+
+ sprintf(path, "%s/gdimageline/gdimageline_aa_c_0_exp.png", GDTEST_TOP_DIR);
+ error |= gen_image(path,0,1,100,10, 1);
+ sprintf(path, "%s/gdimageline/gdimageline_aa_c_1_exp.png", GDTEST_TOP_DIR);
+ error |= gen_image(path,1,1,100,10, 2);
+
+ sprintf(path, "%s/gdimageline/gdimageline_aa_d_0_exp.png", GDTEST_TOP_DIR);
+ error |= gen_image(path,2,-1,100,10, 1);
+ sprintf(path, "%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/gd-2.0.35/tests/gdimageline/gdimageline_aa_a_0_exp.png b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_a_0_exp.png
new file mode 100644
index 00000000000..83f893453ed
--- /dev/null
+++ b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_a_0_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_a_1_exp.png b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_a_1_exp.png
new file mode 100644
index 00000000000..c4edcfa36ec
--- /dev/null
+++ b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_a_1_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_b_0_exp.png b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_b_0_exp.png
new file mode 100644
index 00000000000..130d6c36cc7
--- /dev/null
+++ b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_b_0_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_b_1_exp.png b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_b_1_exp.png
new file mode 100644
index 00000000000..678800658d3
--- /dev/null
+++ b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_b_1_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_c_0_exp.png b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_c_0_exp.png
new file mode 100644
index 00000000000..6d03ae6652e
--- /dev/null
+++ b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_c_0_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_c_1_exp.png b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_c_1_exp.png
new file mode 100644
index 00000000000..6e1a38aa7e1
--- /dev/null
+++ b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_c_1_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_d_0_exp.png b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_d_0_exp.png
new file mode 100644
index 00000000000..d4bdc73ee21
--- /dev/null
+++ b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_d_0_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_d_1_exp.png b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_d_1_exp.png
new file mode 100644
index 00000000000..86570436bf5
--- /dev/null
+++ b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_d_1_exp.png
Binary files differ
diff --git a/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_outofrange.c b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_outofrange.c
new file mode 100644
index 00000000000..f67561c7244
--- /dev/null
+++ b/Build/source/libs/gd/gd-2.0.35/tests/gdimageline/gdimageline_aa_outofrange.c
@@ -0,0 +1,20 @@
+#include <gd.h>
+#include <stdio.h>
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ int bordercolor, color;
+
+ 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;
+}