|
@@ -1,5 +1,5 @@
|
|
|
// requires local modules: util, base64, websock, rfb, keyboard, keysym, keysymdef, input, jsunzip, des, display
|
|
|
-// requires test modules: fake.websocket
|
|
|
+// requires test modules: fake.websocket, assertions
|
|
|
/* jshint expr: true */
|
|
|
var assert = chai.assert;
|
|
|
var expect = chai.expect;
|
|
@@ -13,31 +13,6 @@ function make_rfb (extra_opts) {
|
|
|
return new RFB(extra_opts);
|
|
|
}
|
|
|
|
|
|
-// some useful assertions for noVNC
|
|
|
-chai.use(function (_chai, utils) {
|
|
|
- _chai.Assertion.addMethod('displayed', function (target_data) {
|
|
|
- var obj = this._obj;
|
|
|
- var data_cl = obj._drawCtx.getImageData(0, 0, obj._fb_width, obj._fb_height).data;
|
|
|
- // NB(directxman12): PhantomJS 1.x doesn't implement Uint8ClampedArray, so work around that
|
|
|
- var data = new Uint8Array(data_cl);
|
|
|
- this.assert(utils.eql(data, target_data),
|
|
|
- "expected #{this} to have displayed the image #{exp}, but instead it displayed #{act}",
|
|
|
- "expected #{this} not to have displayed the image #{act}",
|
|
|
- target_data,
|
|
|
- data);
|
|
|
- });
|
|
|
-
|
|
|
- _chai.Assertion.addMethod('sent', function (target_data) {
|
|
|
- var obj = this._obj;
|
|
|
- var data = obj._websocket._get_sent_data();
|
|
|
- this.assert(utils.eql(data, target_data),
|
|
|
- "expected #{this} to have sent the data #{exp}, but it actually sent #{act}",
|
|
|
- "expected #{this} not to have sent the data #{act}",
|
|
|
- target_data,
|
|
|
- data);
|
|
|
- });
|
|
|
-});
|
|
|
-
|
|
|
describe('Remote Frame Buffer Protocol Client', function() {
|
|
|
"use strict";
|
|
|
before(FakeWebSocket.replace);
|
|
@@ -1211,6 +1186,8 @@ describe('Remote Frame Buffer Protocol Client', function() {
|
|
|
client._fb_height = 4;
|
|
|
client._display._fb_width = 4;
|
|
|
client._display._fb_height = 4;
|
|
|
+ client._display._viewportLoc.w = 4;
|
|
|
+ client._display._viewportLoc.h = 4;
|
|
|
client._fb_Bpp = 4;
|
|
|
});
|
|
|
|
|
@@ -1286,6 +1263,8 @@ describe('Remote Frame Buffer Protocol Client', function() {
|
|
|
client._fb_height = 4;
|
|
|
client._display._fb_width = 4;
|
|
|
client._display._fb_height = 4;
|
|
|
+ client._display._viewportLoc.w = 4;
|
|
|
+ client._display._viewportLoc.h = 4;
|
|
|
client._fb_Bpp = 4;
|
|
|
});
|
|
|
|