summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolly Ross <sross@redhat.com>2015-08-24 19:34:30 -0400
committerSolly Ross <sross@redhat.com>2015-08-24 19:34:30 -0400
commita369a80c2480af685b7bddacddae9cca3aea95f9 (patch)
tree6ec512afb1912fd8838b9b1de669dfbcf4d691a9
parentbb180145c654c4bc1ab9eca15a7acaa494d9fa50 (diff)
downloadnovnc-a369a80c2480af685b7bddacddae9cca3aea95f9.tar.gz
Fix bug in non-true-color code
There was a bug caused by 38781d931ec18304f51ed3469faff8387e3cbc55 which prevented color map look-ups sent by rfb.js from working properly, since display.js expected a single-item array, and rfb.js sent just them item value itself (a number) instead. This fixes that, and tweaks the corresponding test to match that behavior.
-rw-r--r--include/display.js2
-rw-r--r--tests/test.display.js6
2 files changed, 4 insertions, 4 deletions
diff --git a/include/display.js b/include/display.js
index 8053002..6bf89bd 100644
--- a/include/display.js
+++ b/include/display.js
@@ -667,7 +667,7 @@ var Display;
if (this._true_color) {
bgr = color;
} else {
- bgr = this._colourMap[color[0]];
+ bgr = this._colourMap[color];
}
var newStyle = 'rgb(' + bgr[2] + ',' + bgr[1] + ',' + bgr[0] + ')';
diff --git a/tests/test.display.js b/tests/test.display.js
index 56dfc22..32a92e2 100644
--- a/tests/test.display.js
+++ b/tests/test.display.js
@@ -353,9 +353,9 @@ describe('Display/Canvas Helper', function () {
it('should support drawing solid colors with color maps', function () {
display._true_color = false;
display.set_colourMap({ 0: [0xff, 0, 0], 1: [0, 0xff, 0] });
- display.fillRect(0, 0, 4, 4, [1]);
- display.fillRect(0, 0, 2, 2, [0]);
- display.fillRect(2, 2, 2, 2, [0]);
+ display.fillRect(0, 0, 4, 4, 1);
+ display.fillRect(0, 0, 2, 2, 0);
+ display.fillRect(2, 2, 2, 2, 0);
expect(display).to.have.displayed(checked_data);
});