mirror of
https://github.com/php/php-src.git
synced 2024-12-24 09:18:17 +08:00
3f72c77ce4
This patch simplifies line endings tracked in the Git repository and syncs them to all include the LF style instead of the CRLF files. Newline characters: - LF (\n) (*nix and Mac) - CRLF (\r\n) (Windows) - CR (\r) (old Mac, obsolete) To see which line endings are in the index and in the working copy the following command can be used: `git ls-files --eol` Git additionally provides `.gitattributes` file to specify if some files need to have specific line endings on all platforms (either CRLF or LF). Changed files shouldn't cause issues on modern Windows platforms because also Git can do output conversion is core.autocrlf=true is set on Windows and use CRLF newlines in all files in the working tree. Unless CRLF files are tracked specifically, Git by default tracks all files in the index using LF newlines.
39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
--TEST--
|
|
imagewebp() and imagecreatefromwebp() - basic test
|
|
--SKIPIF--
|
|
<?php
|
|
if (!extension_loaded('gd')) die('skip gd extension not available');
|
|
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.0', '<')) {
|
|
die("skip test requires GD 2.2.0 or higher");
|
|
}
|
|
if (!function_exists('imagewebp') || !function_exists('imagecreatefromwebp'))
|
|
die('skip WebP support not available');
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
require_once __DIR__ . '/similarity.inc';
|
|
|
|
$filename = __DIR__ . '/webp_basic.webp';
|
|
|
|
$im1 = imagecreatetruecolor(75, 75);
|
|
$white = imagecolorallocate($im1, 255, 255, 255);
|
|
$red = imagecolorallocate($im1, 255, 0, 0);
|
|
$green = imagecolorallocate($im1, 0, 255, 0);
|
|
$blue = imagecolorallocate($im1, 0, 0, 255);
|
|
imagefilledrectangle($im1, 0, 0, 74, 74, $white);
|
|
imageline($im1, 3, 3, 71, 71, $red);
|
|
imageellipse($im1, 18, 54, 36, 36, $green);
|
|
imagerectangle($im1, 41, 3, 71, 33, $blue);
|
|
imagewebp($im1, $filename);
|
|
|
|
$im2 = imagecreatefromwebp($filename);
|
|
imagewebp($im2, $filename);
|
|
var_dump(calc_image_dissimilarity($im1, $im2) < 10e5);
|
|
?>
|
|
--CLEAN--
|
|
<?php
|
|
@unlink(__DIR__ . '/webp_basic.webp');
|
|
?>
|
|
--EXPECT--
|
|
bool(true)
|