fix .dz as a target

and add a test for this as well
This commit is contained in:
John Cupitt 2015-02-13 11:17:55 +00:00
parent 5b90e36559
commit 4d0887f5de
3 changed files with 34 additions and 6 deletions

View File

@ -4,6 +4,7 @@
- improvements to configure for python - improvements to configure for python
- remove --disable-cxx configure flag - remove --disable-cxx configure flag
- python imageize preserves interpretation - python imageize preserves interpretation
- fix dzsave as a target format
30/12/14 started 7.42.2 30/12/14 started 7.42.2
- C++ required output params were broken, thanks Lovell - C++ required output params were broken, thanks Lovell

View File

@ -1734,12 +1734,12 @@ vips_foreign_save_dz_build( VipsObject *object )
{ {
GsfOutput *out; GsfOutput *out;
GError *error = NULL; GError *error = NULL;
char name[VIPS_PATH_MAX];
/* We can't write to dirname: gsf_outfile_stdio_new() will vips_snprintf( name, VIPS_PATH_MAX, "%s/%s",
* make a dir called @arg1 to hold the things we make. dz->dirname, dz->basename );
*/
if( !(out = (GsfOutput *) if( !(out = (GsfOutput *)
gsf_outfile_stdio_new( dz->name, &error )) ) { gsf_outfile_stdio_new( name, &error )) ) {
vips_g_error( &error ); vips_g_error( &error );
return( -1 ); return( -1 );
} }
@ -1754,10 +1754,13 @@ vips_foreign_save_dz_build( VipsObject *object )
GsfOutput *zip; GsfOutput *zip;
GsfOutput *out2; GsfOutput *out2;
GError *error = NULL; GError *error = NULL;
char name[VIPS_PATH_MAX];
/* This is the zip we are building. /* This is the zip we are building.
*/ */
if( !(out = gsf_output_stdio_new( dz->name, &error )) ) { vips_snprintf( name, VIPS_PATH_MAX, "%s/%s.zip",
dz->dirname, dz->basename );
if( !(out = gsf_output_stdio_new( name, &error )) ) {
vips_g_error( &error ); vips_g_error( &error );
return( -1 ); return( -1 );
} }

View File

@ -133,6 +133,26 @@ test_loader() {
echo "ok" echo "ok"
} }
# a format for which we only have a saver (eg. dzsave)
# just run the operation and check exit status
test_saver() {
oper=$1
in=$2
suffix=$3
printf "testing $oper $(basename $in) $suffix ... "
rm -rf $tmp/savertest*
cmd="$vips $oper $in $tmp/savertest$suffix"
if ! $cmd ; then
echo "error executing:"
echo " $cmd"
exit 1
fi
echo "ok"
}
# test for file format supported # test for file format supported
test_supported() { test_supported() {
format=$1 format=$1
@ -192,5 +212,9 @@ if test_supported matload; then
test_loader $matlab_ref $matlab matlab test_loader $matlab_ref $matlab matlab
fi fi
# we have loaders but not savers for other formats, add tests here if test_supported dzsave; then
test_saver dzsave $image .zip
test_saver copy $image .dz
test_saver copy $image .dz[container=zip]
fi