com php-src: Split test for bundled vs. external libgd: ext/gd/tests/imagecrop_auto-ext.phpt ext/gd/tests/imagecr op_auto.phpt

From: Date: Sun, 11 Sep 2016 17:30:55 +0000
Subject: com php-src: Split test for bundled vs. external libgd: ext/gd/tests/imagecrop_auto-ext.phpt ext/gd/tests/imagecr op_auto.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-94426@lists.php.net to get a copy of this message
Commit: 6ef987e012b505397ccc28d9014f14f762cbb07b Author: Christoph M. Becker <cmbecker69@gmx.de> Sun, 11 Sep 2016 19:30:55 +0200 Parents: 38455293f740e0444d16a247dc06db8d8ca18581 Branches: PHP-5.6 PHP-7..0 PHP-7.1 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6ef987e012b505397ccc28d9014f14f762cbb07b Log: Split test for bundled vs. external libgd The behavior of imagecropauto($im, IMG_CROP_DEFAULT) is rather different for the bundled and an external libgd, see <https://github.com/libgd/libgd/issues/298>. Therefore we split the test for now. Changed paths: A ext/gd/tests/imagecrop_auto-ext.phpt M ext/gd/tests/imagecrop_auto.phpt Diff: diff --git a/ext/gd/tests/imagecrop_auto-ext.phpt b/ext/gd/tests/imagecrop_auto-ext.phpt new file mode 100644 index 0000000..60291a6 --- /dev/null +++ b/ext/gd/tests/imagecrop_auto-ext.phpt @@ -0,0 +1,85 @@ +--TEST-- +Testing imagecropauto() +--SKIPIF-- +<?php +if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' ); +if (GD_BUNDLED) die('skip requires external libgd'); +?> +--FILE-- +<?php + +echo "TC IMG_CROP_DEFAULT\n"; +$im = imagecreatetruecolor(99, 99); +imagefilledrectangle($im, 20, 20, 30, 30, 0xff); +$im_crop = imagecropauto($im, IMG_CROP_DEFAULT); +var_dump(imagesx($im_crop)); +var_dump(imagesy($im_crop)); + +echo "Palette IMG_CROP_DEFAULT\n"; +$im = imagecreate(99, 99); +imagefilledrectangle($im, 20, 20, 30, 30, 0xff); +$im_crop = imagecropauto($im, IMG_CROP_DEFAULT); +var_dump(imagesx($im_crop)); +var_dump(imagesy($im_crop)); + +echo "TC IMG_CROP_SIDES\n"; +$im = imagecreatetruecolor(99, 99); +imagefilledrectangle($im, 20, 20, 30, 30, 0xff); +$im_crop = imagecropauto($im, IMG_CROP_SIDES); +var_dump(imagesx($im_crop)); +var_dump(imagesy($im_crop)); + +echo "Palette IMG_CROP_SIDES\n"; +$im = imagecreate(99, 99); +imagefilledrectangle($im, 20, 20, 30, 30, 0xff); +$im_crop = imagecropauto($im, IMG_CROP_SIDES); +var_dump(imagesx($im_crop)); +var_dump(imagesy($im_crop)); + +echo "TC IMG_CROP_BLACK\n"; +$im = imagecreatetruecolor(50, 50); +imagefilledrectangle($im, 20, 20, 30, 30, 0xff); +$im_crop = imagecropauto($im, IMG_CROP_BLACK); +var_dump(imagesx($im_crop)); +var_dump(imagesy($im_crop)); + +echo "Palette IMG_CROP_BLACK\n"; +$im = imagecreate(50, 50); +$bgd = imagecolorallocate($im, 0, 0, 0); +$b = imagecolorallocate($im, 0, 0, 255); +imagefilledrectangle($im, 20, 20, 30, 30, 0xff); +$im_crop = imagecropauto($im, IMG_CROP_BLACK); +var_dump(imagesx($im_crop)); +var_dump(imagesy($im_crop)); + +echo "IMG_CROP_THRESHOLD\n"; +$im = imagecreatefrompng(__DIR__ . "/logo_noise.png"); +$im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0); +imagepng($im_crop, __DIR__ . "/crop_threshold.png"); +var_dump(imagesx($im_crop)); +var_dump(imagesy($im_crop)); + +@unlink(__DIR__ . "/crop_threshold.png"); +?> +--EXPECT-- +TC IMG_CROP_DEFAULT +int(99) +int(99) +Palette IMG_CROP_DEFAULT +int(99) +int(99) +TC IMG_CROP_SIDES +int(11) +int(11) +Palette IMG_CROP_SIDES +int(11) +int(11) +TC IMG_CROP_BLACK +int(11) +int(11) +Palette IMG_CROP_BLACK +int(11) +int(11) +IMG_CROP_THRESHOLD +int(240) +int(134) diff --git a/ext/gd/tests/imagecrop_auto.phpt b/ext/gd/tests/imagecrop_auto..phpt index 1c1929d..8a0f79d 100644 --- a/ext/gd/tests/imagecrop_auto.phpt +++ b/ext/gd/tests/imagecrop_auto.phpt @@ -3,6 +3,7 @@ Testing imagecropauto() --SKIPIF-- <?php if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' ); +if (!GD_BUNDLED) die('skip requires bundled libgd'); ?> --FILE-- <?php

« previous php.cvs (#94426) next »