1--TEST--
2test_image_equals_file(): comparing palette images
3--SKIPIF--
4<?php
5if (!extension_loaded('gd')) die('skip gd extension not available');
6?>
7--FILE--
8<?php
9require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
10
11$im = imagecreate(10, 10);
12imagecolorallocate($im, 255, 255, 255);
13$red = imagecolorallocate($im, 255, 0, 0);
14imagefilledrectangle($im, 3,3, 7,7, $red);
15
16$filename = __DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png';
17imagepng($im, $filename);
18
19$im = imagecreate(10, 10);
20imagecolorallocate($im, 255, 255, 255);
21$blue = imagecolorallocate($im, 0, 0, 255);
22imagefilledrectangle($im, 3,3, 7,7, $blue);
23
24test_image_equals_file($filename, $im);
25
26$im = imagecreate(10, 10);
27imagecolorallocate($im, 255, 255, 255);
28imagecolorallocate($im, 0, 0, 0);
29$red = imagecolorallocate($im, 255, 0, 0);
30imagefilledrectangle($im, 3,3, 7,7, $red);
31
32test_image_equals_file($filename, $im);
33?>
34--EXPECT--
35The images differ in 25 pixels.
36The images are equal.
37--CLEAN--
38<?php
39unlink(__DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png');
40?>
41