php-src/ext/gd/tests/imagestring_basic.phpt
Christoph M. Becker a3159d29bb Make tests a little more resilient
PNG allows identical images to be stored differently what makes nearly all
tests checking the MD5 hash of the PNG representation fail with external
libgd. For now, we use the GD format instead, which doesn't allow for such
differences.

Of course, this md5() checking should be replaced by a image diffing feature
in the long run.
2016-08-17 17:59:33 +02:00

26 lines
529 B
PHP

--TEST--
Testing imagestring() of GD library
--CREDITS--
Rafael Dohms <rdohms [at] gmail [dot] com>
#testfest PHPSP on 2009-06-20
--SKIPIF--
<?php
if (!extension_loaded("gd")) die("skip GD not present");
?>
--FILE--
<?php
$image = imagecreatetruecolor(180, 30);
$white = imagecolorallocate($image, 255,255,255);
$result = imagestring($image, 1, 5, 5, 'String Text', $white);
ob_start();
imagegd($image);
$img = ob_get_contents();
ob_end_clean();
echo md5(base64_encode($img));
?>
--EXPECT--
7f146e3cdcaf89c6b9d68ccbb44cf94e