@@ -207,6 +207,22 @@ const files: TiffFile[] = [
207207 components : 1 ,
208208 alpha : false ,
209209 } ,
210+ {
211+ name : 'jellybeans.tiff' ,
212+ width : 256 ,
213+ height : 256 ,
214+ bitsPerSample : 8 ,
215+ components : 3 ,
216+ alpha : false ,
217+ } ,
218+ {
219+ name : 'female.tiff' ,
220+ width : 256 ,
221+ height : 256 ,
222+ bitsPerSample : 8 ,
223+ components : 3 ,
224+ alpha : false ,
225+ } ,
210226 // Checks only the first frame of the image.
211227 {
212228 name : 'dog.tiff' ,
@@ -385,7 +401,7 @@ test('should decode image compressed with deflate algorithm', () => {
385401 } ) ;
386402} ) ;
387403
388- test ( 'should decode basic 2x2 1-bit image ' , ( ) => {
404+ test ( 'should decode basic 2x2 1-bit image' , ( ) => {
389405 const decoded = decode ( readImage ( 'bw1bit.tif' ) ) ;
390406
391407 expect ( decoded ) . toHaveLength ( 1 ) ;
@@ -500,3 +516,19 @@ test('should decode multiframe image', () => {
500516 expect ( decoded [ 1 ] . samplesPerPixel ) . toBe ( 2 ) ;
501517 expect ( decoded [ 1 ] . data . slice ( 352 , 384 ) ) . toStrictEqual ( secondFrameTwelvethRow ) ;
502518} ) ;
519+
520+ test ( 'should decode image with undefined rowsPerStrip' , ( ) => {
521+ const decodedFemale = decode ( readImage ( 'female.tiff' ) ) ;
522+
523+ expect ( decodedFemale [ 0 ] . rowsPerStrip ) . toStrictEqual ( 2 ** 32 - 1 ) ;
524+ expect ( decodedFemale [ 0 ] . data . slice ( 0 , 10 ) ) . toStrictEqual (
525+ new Uint8Array ( [ 94 , 0 , 115 , 27 , 61 , 103 , 26 , 60 , 104 , 27 ] ) ,
526+ ) ;
527+
528+ const decodedJellybeans = decode ( readImage ( 'jellybeans.tiff' ) ) ;
529+
530+ expect ( decodedJellybeans [ 0 ] . rowsPerStrip ) . toStrictEqual ( 2 ** 32 - 1 ) ;
531+ expect ( decodedJellybeans [ 0 ] . data . slice ( 0 , 10 ) ) . toStrictEqual (
532+ new Uint8Array ( [ 139 , 132 , 90 , 141 , 136 , 92 , 142 , 131 , 89 , 143 ] ) ,
533+ ) ;
534+ } ) ;
0 commit comments