|
|
|
@ -365,17 +365,22 @@ describe('Tight Decoder', function () {
|
|
|
|
|
|
|
|
|
|
testDecodeRect(decoder, 0, 0, 4, 4, data, display, 24);
|
|
|
|
|
|
|
|
|
|
// We got some rounding errors when we compressed things,
|
|
|
|
|
// hence not perfect 0xff/0x00 values
|
|
|
|
|
let targetData = new Uint8Array([
|
|
|
|
|
0xfe, 0x00, 0x00, 255, 0xfe, 0x00, 0x00, 255, 0x00, 0xff, 0x01, 255, 0x00, 0xff, 0x01, 255,
|
|
|
|
|
0xfe, 0x00, 0x00, 255, 0xfd, 0x00, 0x00, 255, 0x00, 0xff, 0x01, 255, 0x01, 0xff, 0x02, 255,
|
|
|
|
|
0x00, 0xff, 0x01, 255, 0x00, 0xff, 0x01, 255, 0xfe, 0x00, 0x00, 255, 0xfe, 0x00, 0x00, 255,
|
|
|
|
|
0x00, 0xff, 0x01, 255, 0x01, 0xff, 0x00, 255, 0xfe, 0x00, 0x00, 255, 0xfd, 0x01, 0x00, 255
|
|
|
|
|
0xff, 0x00, 0x00, 255, 0xff, 0x00, 0x00, 255, 0x00, 0xff, 0x00, 255, 0x00, 0xff, 0x00, 255,
|
|
|
|
|
0xff, 0x00, 0x00, 255, 0xff, 0x00, 0x00, 255, 0x00, 0xff, 0x00, 255, 0x00, 0xff, 0x00, 255,
|
|
|
|
|
0x00, 0xff, 0x00, 255, 0x00, 0xff, 0x00, 255, 0xff, 0x00, 0x00, 255, 0xff, 0x00, 0x00, 255,
|
|
|
|
|
0x00, 0xff, 0x00, 255, 0x00, 0xff, 0x00, 255, 0xff, 0x00, 0x00, 255, 0xff, 0x00, 0x00, 255
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
// Browsers have rounding errors, so we need an approximate
|
|
|
|
|
// comparing function
|
|
|
|
|
function almost(a, b) {
|
|
|
|
|
let diff = Math.abs(a - b);
|
|
|
|
|
return diff < 5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
display.onflush = () => {
|
|
|
|
|
expect(display).to.have.displayed(targetData);
|
|
|
|
|
expect(display).to.have.displayed(targetData, almost);
|
|
|
|
|
done();
|
|
|
|
|
};
|
|
|
|
|
display.flush();
|
|
|
|
|