@@ -637,28 +637,21 @@ describe('Resize dimensions', function () {
637637 } ) ;
638638 } ) ;
639639
640- it ( 'fastShrinkOnLoad: false ensures image is not shifted' , function ( done ) {
641- return sharp ( fixtures . inputJpgCenteredImage )
642- . resize ( 9 , 8 , { fastShrinkOnLoad : false } )
643- . png ( )
644- . toBuffer ( function ( err , data , info ) {
645- if ( err ) throw err ;
646- assert . strictEqual ( 9 , info . width ) ;
647- assert . strictEqual ( 8 , info . height ) ;
648- fixtures . assertSimilar ( fixtures . expected ( 'fast-shrink-on-load-false.png' ) , data , done ) ;
649- } ) ;
650- } ) ;
651-
652- it ( 'fastShrinkOnLoad: true (default) might result in shifted image' , function ( done ) {
653- return sharp ( fixtures . inputJpgCenteredImage )
654- . resize ( 9 , 8 )
655- . png ( )
656- . toBuffer ( function ( err , data , info ) {
657- if ( err ) throw err ;
658- assert . strictEqual ( 9 , info . width ) ;
659- assert . strictEqual ( 8 , info . height ) ;
660- fixtures . assertSimilar ( fixtures . expected ( 'fast-shrink-on-load-true.png' ) , data , done ) ;
661- } ) ;
640+ [
641+ true ,
642+ false
643+ ] . forEach ( function ( value ) {
644+ it ( `fastShrinkOnLoad: ${ value } does not causes image shifts` , function ( done ) {
645+ sharp ( fixtures . inputJpgCenteredImage )
646+ . resize ( 9 , 8 , { fastShrinkOnLoad : value } )
647+ . png ( )
648+ . toBuffer ( function ( err , data , info ) {
649+ if ( err ) throw err ;
650+ assert . strictEqual ( 9 , info . width ) ;
651+ assert . strictEqual ( 8 , info . height ) ;
652+ fixtures . assertSimilar ( fixtures . expected ( 'fast-shrink-on-load.png' ) , data , done ) ;
653+ } ) ;
654+ } ) ;
662655 } ) ;
663656
664657 [
0 commit comments