@@ -286,6 +286,24 @@ describe('recognize()', () => {
286286 expect ( blocks [ 0 ] . paragraphs [ 0 ] . lines [ 1 ] . text ) . to . be ( 'Back \\ Slash\n' ) ;
287287 } ) . timeout ( TIMEOUT ) ;
288288
289+ it ( 'recongize image with multiple choices' , async ( ) => {
290+ await workerLegacy . reinitialize ( 'eng' ) ;
291+ const { data : { blocks } } = await workerLegacy . recognize ( `${ IMAGE_PATH } /bill.png` , { } , { blocks : true } ) ;
292+ expect ( blocks [ 0 ] . paragraphs [ 1 ] . lines [ 0 ] . words [ 3 ] . choices . length ) . to . be ( 3 ) ;
293+ expect ( blocks [ 0 ] . paragraphs [ 1 ] . lines [ 0 ] . words [ 3 ] . choices [ 1 ] . text ) . to . be ( '100,000.0ll' ) ;
294+ } ) . timeout ( TIMEOUT ) ;
295+
296+ it ( 'recongize image with multiple blocks' , async ( ) => {
297+ // This also implicitly checks that non-text blocks are ignored,
298+ // as otherwise the length would be 5.
299+ await worker . reinitialize ( 'eng' ) ;
300+ await worker . setParameters ( {
301+ tessedit_pageseg_mode : PSM . AUTO ,
302+ } ) ;
303+ const { data : { blocks } } = await worker . recognize ( `${ IMAGE_PATH } /bill.png` , { } , { blocks : true } ) ;
304+ expect ( blocks . length ) . to . be ( 4 ) ;
305+ } ) . timeout ( TIMEOUT ) ;
306+
289307 it ( 'recongize chinese image' , async ( ) => {
290308 await worker . reinitialize ( 'chi_tra' ) ;
291309 const { data : { blocks } } = await worker . recognize ( `${ IMAGE_PATH } /chinese.png` , { } , { blocks : true } ) ;
0 commit comments