@ -210,6 +210,61 @@ describe('Tight Decoder', function () {
// Not implemented yet
} ) ;
it ( 'should handle empty copy rects' , function ( ) {
display . fillRect ( 0 , 0 , 4 , 4 , [ 0x00 , 0x00 , 0xff ] ) ;
display . fillRect ( 2 , 0 , 2 , 2 , [ 0x00 , 0xff , 0x00 ] ) ;
display . fillRect ( 0 , 2 , 2 , 2 , [ 0x00 , 0xff , 0x00 ] ) ;
testDecodeRect ( decoder , 1 , 2 , 0 , 0 , [ 0x00 ] , display , 24 ) ;
let targetData = new Uint8Array ( [
0x00 , 0x00 , 0xff , 255 , 0x00 , 0x00 , 0xff , 255 , 0x00 , 0xff , 0x00 , 255 , 0x00 , 0xff , 0x00 , 255 ,
0x00 , 0x00 , 0xff , 255 , 0x00 , 0x00 , 0xff , 255 , 0x00 , 0xff , 0x00 , 255 , 0x00 , 0xff , 0x00 , 255 ,
0x00 , 0xff , 0x00 , 255 , 0x00 , 0xff , 0x00 , 255 , 0x00 , 0x00 , 0xff , 255 , 0x00 , 0x00 , 0xff , 255 ,
0x00 , 0xff , 0x00 , 255 , 0x00 , 0xff , 0x00 , 255 , 0x00 , 0x00 , 0xff , 255 , 0x00 , 0x00 , 0xff , 255
] ) ;
expect ( display ) . to . have . displayed ( targetData ) ;
} ) ;
it ( 'should handle empty palette rects' , function ( ) {
display . fillRect ( 0 , 0 , 4 , 4 , [ 0x00 , 0x00 , 0xff ] ) ;
display . fillRect ( 2 , 0 , 2 , 2 , [ 0x00 , 0xff , 0x00 ] ) ;
display . fillRect ( 0 , 2 , 2 , 2 , [ 0x00 , 0xff , 0x00 ] ) ;
testDecodeRect ( decoder , 1 , 2 , 0 , 0 ,
[ 0x40 , 0x01 , 0x01 ,
0xff , 0xff , 0xff ,
0xff , 0xff , 0xff ] , display , 24 ) ;
let targetData = new Uint8Array ( [
0x00 , 0x00 , 0xff , 255 , 0x00 , 0x00 , 0xff , 255 , 0x00 , 0xff , 0x00 , 255 , 0x00 , 0xff , 0x00 , 255 ,
0x00 , 0x00 , 0xff , 255 , 0x00 , 0x00 , 0xff , 255 , 0x00 , 0xff , 0x00 , 255 , 0x00 , 0xff , 0x00 , 255 ,
0x00 , 0xff , 0x00 , 255 , 0x00 , 0xff , 0x00 , 255 , 0x00 , 0x00 , 0xff , 255 , 0x00 , 0x00 , 0xff , 255 ,
0x00 , 0xff , 0x00 , 255 , 0x00 , 0xff , 0x00 , 255 , 0x00 , 0x00 , 0xff , 255 , 0x00 , 0x00 , 0xff , 255
] ) ;
expect ( display ) . to . have . displayed ( targetData ) ;
} ) ;
it ( 'should handle empty fill rects' , function ( ) {
display . fillRect ( 0 , 0 , 4 , 4 , [ 0x00 , 0x00 , 0xff ] ) ;
display . fillRect ( 2 , 0 , 2 , 2 , [ 0x00 , 0xff , 0x00 ] ) ;
display . fillRect ( 0 , 2 , 2 , 2 , [ 0x00 , 0xff , 0x00 ] ) ;
testDecodeRect ( decoder , 1 , 2 , 0 , 0 ,
[ 0x80 , 0xff , 0xff , 0xff ] , display , 24 ) ;
let targetData = new Uint8Array ( [
0x00 , 0x00 , 0xff , 255 , 0x00 , 0x00 , 0xff , 255 , 0x00 , 0xff , 0x00 , 255 , 0x00 , 0xff , 0x00 , 255 ,
0x00 , 0x00 , 0xff , 255 , 0x00 , 0x00 , 0xff , 255 , 0x00 , 0xff , 0x00 , 255 , 0x00 , 0xff , 0x00 , 255 ,
0x00 , 0xff , 0x00 , 255 , 0x00 , 0xff , 0x00 , 255 , 0x00 , 0x00 , 0xff , 255 , 0x00 , 0x00 , 0xff , 255 ,
0x00 , 0xff , 0x00 , 255 , 0x00 , 0xff , 0x00 , 255 , 0x00 , 0x00 , 0xff , 255 , 0x00 , 0x00 , 0xff , 255
] ) ;
expect ( display ) . to . have . displayed ( targetData ) ;
} ) ;
it ( 'should handle JPEG rects' , function ( done ) {
let data = [
// Control bytes