From c6c26611213022a54218918256610f5d4904f492 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 28 Sep 2020 12:24:56 +0200 Subject: [PATCH] Add workaround for Firefox PNG rounding bug --- kasmweb/tests/test.tightpng.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kasmweb/tests/test.tightpng.js b/kasmweb/tests/test.tightpng.js index cb36e99..253400b 100644 --- a/kasmweb/tests/test.tightpng.js +++ b/kasmweb/tests/test.tightpng.js @@ -128,8 +128,15 @@ describe('TightPng Decoder', function () { 0x00, 0xff, 0x00, 255, 0x00, 0xff, 0x00, 255, 0xff, 0x00, 0x00, 255, 0xff, 0x00, 0x00, 255 ]); + // Firefox currently has some very odd rounding bug: + // https://bugzilla.mozilla.org/show_bug.cgi?id=1667747 + function almost(a, b) { + let diff = Math.abs(a - b); + return diff < 30; + } + display.onflush = () => { - expect(display).to.have.displayed(targetData); + expect(display).to.have.displayed(targetData, almost); done(); }; display.flush();