Skip to content

Commit

Permalink
add test for vips_image_write_to_file options
Browse files Browse the repository at this point in the history
  • Loading branch information
jcupitt committed Dec 6, 2016
1 parent cd4278c commit 1246db7
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
<file role='test' name='028.phpt'/>
<file role='test' name='029.phpt'/>
<file role='test' name='030.phpt'/>
<file role='test' name='031.phpt'/>

<dir name="images">
<file role='test' name='img_0076.jpg'/>
Expand Down
31 changes: 31 additions & 0 deletions tests/031.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
--TEST--
write_to_file can set options
--SKIPIF--
<?php if (!extension_loaded("vips")) print "skip"; ?>
--FILE--
<?php
$filename = dirname(__FILE__) . "/images/img_0076.jpg";
$image = vips_image_new_from_file($filename)["out"];
$output_filename1 = dirname(__FILE__) . "/x.jpg";
$output_filename2 = dirname(__FILE__) . "/y.jpg";

vips_image_write_to_file($image, $output_filename1, ["Q" => 20]);
vips_image_write_to_file($image, $output_filename2, ["Q" => 90]);

$buffer1 = file_get_contents($output_filename1);
$buffer2 = file_get_contents($output_filename2);

if (strlen($buffer1) < strlen($buffer2)) {
echo "pass";
}
?>
--EXPECT--
pass
--CLEAN--
<?php
$output_filename = dirname(__FILE__) . "/x.jpg";
unlink($output_filename);
$output_filename = dirname(__FILE__) . "/y.jpg";
unlink($output_filename);
?>

2 changes: 1 addition & 1 deletion vips.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
*/

/* Uncomment for some logging.
*/
#define VIPS_DEBUG
*/

#ifdef HAVE_CONFIG_H
#include "config.h"
Expand Down

0 comments on commit 1246db7

Please sign in to comment.