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