@@ -284,6 +284,41 @@ describe("ID3v2TagReader", function() {
284284 expect ( tags . tags . picture . data ) . toEqual ( [ 0x01 , 0x02 , 0xff , 0x03 , 0x04 , 0x05 ] ) ;
285285 } ) ;
286286 } ) ;
287+
288+ it ( "doesn't unsynchronise frames twice" , function ( ) {
289+ var id3FileContents =
290+ new ID3v2TagContents ( 4 , 3 )
291+ . setFlags ( {
292+ unsynchronisation : true
293+ } )
294+ . addFrame ( "TIT2" , [ ] . concat (
295+ [ 0x00 ] , // encoding
296+ bin ( "The title" ) , [ 0x00 ]
297+ ) )
298+ . addFrame ( "APIC" , [ ] . concat (
299+ [ 0x00 ] , // text encoding
300+ bin ( "image/jpeg" ) , [ 0x00 ] ,
301+ [ 0x03 ] , // picture type - cover front
302+ bin ( "front cover image" ) , [ 0x00 ] ,
303+ [ 0x01 , 0x02 , 0xff , 0x00 , 0x00 , 0x03 , 0x04 , 0x05 ] // image data
304+ ) , {
305+ format : {
306+ unsynchronisation : true
307+ }
308+ } ) ;
309+ mediaFileReader = new ArrayFileReader ( id3FileContents . toArray ( ) ) ;
310+ tagReader = new ID3v2TagReader ( mediaFileReader ) ;
311+
312+ return new Promise ( function ( resolve , reject ) {
313+ tagReader . read ( {
314+ onSuccess : resolve ,
315+ onFailure : reject
316+ } ) ;
317+ jest . runAllTimers ( ) ;
318+ } ) . then ( function ( tags ) {
319+ expect ( tags . tags . picture . data ) . toEqual ( [ 0x01 , 0x02 , 0xff , 0x00 , 0x03 , 0x04 , 0x05 ] ) ;
320+ } ) ;
321+ } ) ;
287322 } ) ;
288323
289324 it ( "should process frames with no content" , function ( ) {
0 commit comments