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.
This commit is contained in:
parent
ae660d756c
commit
51dd99d701
@ -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] + ')';
|
||||
|
@ -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);
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user