summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2017-12-14 12:59:25 +0100
committerPierre Ossman <ossman@cendio.se>2017-12-14 12:59:25 +0100
commit1f9d0cb12f01524bf2fd17c0ae1c6933fdbcf728 (patch)
tree8dff442af0f335e0657fd132611acd9f365ecfdf
parent0880353ba928863e328029324576dfbe70df0940 (diff)
downloadnovnc-1f9d0cb12f01524bf2fd17c0ae1c6933fdbcf728.tar.gz
Add test for 16x16 tiles
We have a special cache and therefore special code paths that need to be tested when rendering 16x16 tiles.
-rw-r--r--tests/test.display.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test.display.js b/tests/test.display.js
index 9e6f049..60201ed 100644
--- a/tests/test.display.js
+++ b/tests/test.display.js
@@ -345,6 +345,31 @@ describe('Display/Canvas Helper', function () {
expect(display).to.have.displayed(checked_data);
});
+ // We have a special cache for 16x16 tiles that we need to test
+ it('should support drawing a 16x16 tile', function () {
+ let large_checked_data = new Uint8Array(16*16*4);
+ display.resize(16, 16);
+
+ for (let y = 0;y < 16;y++) {
+ for (let x = 0;x < 16;x++) {
+ let pixel;
+ if ((x < 4) && (y < 4)) {
+ pixel = checked_data.slice((y*4+x)*4, (y*4+x+1)*4);
+ } else {
+ pixel = [0, 0xff, 0, 255];
+ }
+ large_checked_data.set(pixel, (y*16+x)*4);
+ }
+ }
+
+ display.startTile(0, 0, 16, 16, [0, 0xff, 0]);
+ display.subTile(0, 0, 2, 2, [0xff, 0, 0]);
+ display.subTile(2, 2, 2, 2, [0xff, 0, 0]);
+ display.finishTile();
+ display.flip();
+ expect(display).to.have.displayed(large_checked_data);
+ });
+
it('should support drawing BGRX blit images with true color via #blitImage', function () {
var data = [];
for (var i = 0; i < 16; i++) {