xref: /PHP-7.4/ext/gd/tests/jpeg2wbmp_error1.phpt (revision 26dfce7f)
1--TEST--
2Test jpeg2wbmp() function : wrong threshold value param
3--CREDITS--
4Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
5#testfest PHPSP on 2009-06-20
6--SKIPIF--
7<?php
8if(!extension_loaded('gd')) {
9    die('skip gd extension is not loaded');
10}
11if(!function_exists('jpeg2wbmp')) {
12    die('skip jpeg2wbmp function is not available');
13}
14?>
15--FILE--
16<?php
17// Create a blank image and add some text
18$im = imagecreatetruecolor(120, 20);
19$text_color = imagecolorallocate($im, 255, 255, 255);
20imagestring($im, 1, 5, 5,  'A Simple Text String', $text_color);
21
22$file = __DIR__ .'/simpletext.jpg';
23$file2 = __DIR__ .'/simpletext.wbmp';
24
25// Save the image as 'simpletext.jpg'
26imagejpeg($im, $file);
27
28// Free up memory
29imagedestroy($im);
30
31jpeg2wbmp($file, $file2, 20, 120, 9);
32jpeg2wbmp($file, $file2, 20, 120, -1);
33?>
34--EXPECTF--
35Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d
36
37Warning: jpeg2wbmp(): Invalid threshold value '9' in %s on line %d
38
39Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d
40
41Warning: jpeg2wbmp(): Invalid threshold value '-1' in %s on line %d
42--CLEAN--
43<?php
44unlink(__DIR__ .'/simpletext.jpg');
45unlink(__DIR__ .'/simpletext.wbmp');
46?>
47