Add svgload_stream to the descriptors test
Seems to work!
This commit is contained in:
parent
609fdb4fb6
commit
41c08b0ffb
@ -475,8 +475,7 @@ vips_foreign_load_svg_stream_is_a( VipsStreami *input )
|
||||
{
|
||||
ssize_t n;
|
||||
|
||||
if( vips_streami_unminimise( input ) ||
|
||||
vips_streami_rewind( input ) )
|
||||
if( vips_streami_rewind( input ) )
|
||||
return( FALSE );
|
||||
|
||||
g_byte_array_set_size( input->sniff, SVG_HEADER_SIZE );
|
||||
|
@ -898,7 +898,6 @@ vips_streami_seek( VipsStreami *streami, gint64 offset, int whence )
|
||||
vips_error( vips_stream_nick( VIPS_STREAM( streami ) ),
|
||||
"%s", _( "bad 'whence'" ) );
|
||||
return( -1 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if( streami->is_pipe ) {
|
||||
@ -926,7 +925,6 @@ vips_streami_seek( VipsStreami *streami, gint64 offset, int whence )
|
||||
vips_error( vips_stream_nick( VIPS_STREAM( streami ) ),
|
||||
"%s", _( "bad 'whence'" ) );
|
||||
return( -1 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -1029,8 +1027,7 @@ vips_streami_sniff( VipsStreami *streami, size_t length )
|
||||
|
||||
SANITY( streami );
|
||||
|
||||
if( vips_streami_unminimise( streami ) ||
|
||||
vips_streami_rewind( streami ) )
|
||||
if( vips_streami_rewind( streami ) )
|
||||
return( NULL );
|
||||
|
||||
g_byte_array_set_size( streami->sniff, length );
|
||||
|
@ -125,9 +125,9 @@ vips_streamiw_tell( GSeekable *seekable )
|
||||
pos = vips_streami_seek( streami, 0, SEEK_CUR );
|
||||
|
||||
if( pos == -1 )
|
||||
return 0;
|
||||
return( 0 );
|
||||
|
||||
return pos;
|
||||
return( pos );
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -137,7 +137,7 @@ vips_streamiw_can_seek( GSeekable *seekable )
|
||||
|
||||
VIPS_DEBUG_MSG( "vips_streamiw_can_seek: %d\n", !streami->is_pipe );
|
||||
|
||||
return !streami->is_pipe;
|
||||
return( !streami->is_pipe );
|
||||
}
|
||||
|
||||
static int
|
||||
@ -146,11 +146,11 @@ seek_type_to_lseek( GSeekType type )
|
||||
switch( type ) {
|
||||
default:
|
||||
case G_SEEK_CUR:
|
||||
return SEEK_CUR;
|
||||
return( SEEK_CUR );
|
||||
case G_SEEK_SET:
|
||||
return SEEK_SET;
|
||||
return( SEEK_SET );
|
||||
case G_SEEK_END:
|
||||
return SEEK_END;
|
||||
return( SEEK_END );
|
||||
}
|
||||
}
|
||||
|
||||
@ -234,14 +234,13 @@ vips_streamiw_skip( GInputStream *stream, gsize count,
|
||||
return( -1 );
|
||||
|
||||
start = vips_streami_seek( streami, 0, SEEK_CUR );
|
||||
|
||||
if( start == -1 )
|
||||
{
|
||||
g_set_error( error, G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
_("Error while seeking: %s"),
|
||||
vips_error_buffer() );
|
||||
return -1;
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
end = vips_streami_seek( streami, 0, SEEK_END );
|
||||
@ -251,7 +250,7 @@ vips_streamiw_skip( GInputStream *stream, gsize count,
|
||||
G_IO_ERROR_FAILED,
|
||||
_("Error while seeking: %s"),
|
||||
vips_error_buffer() );
|
||||
return -1;
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
if( end - start > count )
|
||||
@ -264,7 +263,7 @@ vips_streamiw_skip( GInputStream *stream, gsize count,
|
||||
G_IO_ERROR_FAILED,
|
||||
_("Error while seeking: %s"),
|
||||
vips_error_buffer() );
|
||||
return -1;
|
||||
return( -1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ class TestStream:
|
||||
|
||||
assert x.filename() == JPEG_FILE
|
||||
|
||||
@skip_if_no("jpegload")
|
||||
@skip_if_no("jpegload_stream")
|
||||
def test_image_new_from_stream_filename(self):
|
||||
x = pyvips.Streami.new_from_filename(JPEG_FILE)
|
||||
y = pyvips.Image.new_from_stream(x, "")
|
||||
@ -58,7 +58,7 @@ class TestStream:
|
||||
|
||||
assert x.filename() == filename
|
||||
|
||||
@skip_if_no("jpegload")
|
||||
@skip_if_no("jpegload_stream")
|
||||
def test_image_write_to_stream_filename(self):
|
||||
filename = temp_filename(self.tempdir, ".jpg")
|
||||
x = pyvips.Streamo.new_to_filename(filename)
|
||||
@ -75,7 +75,7 @@ class TestStream:
|
||||
|
||||
assert x.filename() == None
|
||||
|
||||
@skip_if_no("jpegload")
|
||||
@skip_if_no("jpegload_stream")
|
||||
def test_image_new_from_stream_memory(self):
|
||||
data = self.colour.write_to_buffer(".jpg")
|
||||
x = pyvips.Streami.new_from_memory(data)
|
||||
@ -89,7 +89,7 @@ class TestStream:
|
||||
|
||||
assert x.filename() == None
|
||||
|
||||
@skip_if_no("jpegload")
|
||||
@skip_if_no("jpegload_stream")
|
||||
def test_image_write_to_stream_filename(self):
|
||||
x = pyvips.Streamo.new_to_memory()
|
||||
self.colour.write_to_stream(x, ".jpg")
|
||||
|
@ -31,6 +31,7 @@ count_files( const char *dirname )
|
||||
int
|
||||
main( int argc, char **argv )
|
||||
{
|
||||
VipsStreami *streami;
|
||||
VipsImage *image, *x;
|
||||
char fd_dir[256];
|
||||
int n_files;
|
||||
@ -56,7 +57,9 @@ main( int argc, char **argv )
|
||||
/* Opening an image should read the header, then close the fd.
|
||||
*/
|
||||
printf( "** seq open ..\n" );
|
||||
if( !(image = vips_image_new_from_file( argv[1],
|
||||
if( !(streami = vips_streami_new_from_filename( argv[1] )) )
|
||||
vips_error_exit( NULL );
|
||||
if( !(image = vips_image_new_from_stream( streami, "",
|
||||
"access", VIPS_ACCESS_SEQUENTIAL,
|
||||
NULL )) )
|
||||
vips_error_exit( NULL );
|
||||
@ -92,6 +95,7 @@ main( int argc, char **argv )
|
||||
*/
|
||||
printf( "** unref ..\n" );
|
||||
g_object_unref( image );
|
||||
g_object_unref( streami );
|
||||
printf( "** shutdown ..\n" );
|
||||
vips_shutdown();
|
||||
|
||||
|
@ -10,18 +10,22 @@ set -e
|
||||
|
||||
. ./variables.sh
|
||||
|
||||
if test_supported jpegload; then
|
||||
if test_supported jpegload_stream; then
|
||||
./test_descriptors $image
|
||||
fi
|
||||
|
||||
if test_supported pngload; then
|
||||
if test_supported pngload_stream; then
|
||||
./test_descriptors $test_images/sample.png
|
||||
fi
|
||||
|
||||
if test_supported tiffload; then
|
||||
if test_supported tiffload_stream; then
|
||||
./test_descriptors $test_images/sample.tif
|
||||
fi
|
||||
|
||||
if test_supported radload; then
|
||||
if test_supported radload_stream; then
|
||||
./test_descriptors $test_images/sample.hdr
|
||||
fi
|
||||
|
||||
if test_supported svgload_stream; then
|
||||
./test_descriptors $test_images/logo.svg
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user