From f3a89ff075fcc4628f0f15f0b5ebf18355644e7f Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Wed, 20 Jul 2016 19:26:29 +0200 Subject: [PATCH] Add test case for imagecopyresampled() with alpha --- .../tests/imagecopyresampled_variation1.phpt | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 ext/gd/tests/imagecopyresampled_variation1.phpt diff --git a/ext/gd/tests/imagecopyresampled_variation1.phpt b/ext/gd/tests/imagecopyresampled_variation1.phpt new file mode 100644 index 00000000000..98547f8931f --- /dev/null +++ b/ext/gd/tests/imagecopyresampled_variation1.phpt @@ -0,0 +1,70 @@ +--TEST-- +Test for correct colors of imagecopyresampled() wrt. alpha +--SKIPIF-- + +--FILE-- +> 16; +$green = ($color & 0x00FF00) >> 8; +$blue = ($color & 0x0000FF); +$alpha = ($color & 0x7F000000) >> 24; + +/* test for expected component values */ +if (!($red >= EXP_RED - 1 && $red <= EXP_RED + 1)) { + printf("red: expected roughly %d, got %d\n", EXP_RED, $red); +} +if (!($green >= EXP_GREEN - 1 && $green <= EXP_GREEN + 1)) { + printf("green: expected roughly %d, got %d\n", EXP_GREEN, $green); +} +if (!($blue >= EXP_BLUE - 1 && $blue <= EXP_BLUE + 1)) { + printf("blue: expected roughly %d, got %d\n", EXP_BLUE, $blue); +} +if (!($alpha >= EXP_ALPHA - 1 && $alpha <= EXP_ALPHA + 1)) { + printf("alpha: expected roughly %d, got %d\n", EXP_ALPHA, $alpha); +} + +imagedestroy($copy); +imagedestroy($im); + +echo 'DONE'; +?> +--EXPECT-- +DONE