xref: /PHP-8.2/ext/gd/tests/xpm2gd.phpt (revision 0aaad46c)
1--TEST--
2xpm --> gd1/gd2 conversion test
3--EXTENSIONS--
4gd
5--SKIPIF--
6<?php
7    if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3.3', '>=')) {
8        die("skip test requires GD 2.3.2 or older");
9    }
10
11    if (!function_exists("imagecreatefromxpm")) {
12        die("skip xpm read support unavailable");
13    }
14?>
15--FILE--
16<?php
17    $cwd = __DIR__;
18
19    echo "XPM to GD1 conversion: ";
20    echo imagegd(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test_xpm.gd1") ? 'ok' : 'failed';
21    echo "\n";
22
23    echo "XPM to GD2 conversion: ";
24    echo imagegd2(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test_xpm.gd2") ? 'ok' : 'failed';
25    echo "\n";
26
27    @unlink($cwd . "/test_xpm.gd1");
28    @unlink($cwd . "/test_xpm.gd2");
29?>
30--EXPECT--
31XPM to GD1 conversion: ok
32XPM to GD2 conversion: ok
33