Solly Ross [Mon, 24 Nov 2014 20:16:12 +0000 (15:16 -0500)]
Fixed Erroneous HEXTILE test
The HEXTILE test which tested for a background tile followed
by an empty tile was only wide enough to actually test for one
tile, thus not actually testing the functionality. It now actually
uses two tiles, thus actually testing the functionality.
Ramon de Klein [Thu, 6 Nov 2014 12:11:46 +0000 (13:11 +0100)]
Don't draw "blank" HEXTILE tiles with random data
Previously, if a HEXTILE tiles was received with a subencoding
of 0x00, it would draw a rectangle using data from the render
queue, which would result in random colored blocks when using
the HEXTILE encoding. This is the result of a miscopy during
the refactoring. It now has the correct functionality according
to the RFB protocol specification, which is to draw a rectangle
with the last set background color.
Solly Ross [Mon, 17 Nov 2014 22:52:33 +0000 (17:52 -0500)]
Fix Karma sinon-chai version issues
Previously, we were using the karma-sinon-chai package to
provide sinon-chai to karma. This used an older version of
sinon-chai, and looks to be no longer maintained (it's been
a month since sinon-chai was updated). A new package,
karma-sinon-chai-latest, is now used. This package uses the
latest version of sinon-chai and sinon, just like karma-chai
uses the latest version of chai.
Solly Ross [Mon, 17 Nov 2014 19:19:19 +0000 (14:19 -0500)]
Fix broken tests from changing default screen size
Commit 795fca23dc6cf124b2e6969ee42bd8e7c836d605 changed the default
size from 640 to 240. This broke a couple tests which depended on
the default size being 640. Those tests have now been fixed.
Solly Ross [Sun, 2 Nov 2014 18:27:06 +0000 (13:27 -0500)]
Added in guidelines for contributing to noVNC
In CONTRIBUTING.md, you can now find a set of guidelines for
contributing to the noVNC project. They detail coding style
information, requirements for pull requests, and how to run
the unit tests.
Solly Ross [Tue, 30 Sep 2014 16:17:33 +0000 (12:17 -0400)]
Force Travis to use Node 0.11.13
The latest version of Node.js has a bug that
affects the Karma test runner. A patch has been
merged to Karma, but has not landed in a version
yet. Until a new version of Karma is released,
we should keep node at 0.11.13.
Solly Ross [Tue, 23 Sep 2014 02:30:19 +0000 (22:30 -0400)]
Make Utils.js use Object.define to modify Array
Previously, we were modifying Array's prototype using
simple assignment. This can mess with enumeration/iteration.
Thus, we now use Object.defineProperty with enumerable set to
false.
Solly Ross [Tue, 23 Sep 2014 01:42:32 +0000 (21:42 -0400)]
Add support for Relative Paths in the Test Runner
This patch adds support for using relative paths
with the '-r' or '--relative' methods. This can
be useful if you want to output HTML (with the
'--output-html' option) and use it in a webpage.
Additionally, the '-o' was removed from the documentation
of '--output-html', since it hasn't worked for that in a
while ('-o' means open in browser instead).
Solly Ross [Tue, 23 Sep 2014 01:37:04 +0000 (21:37 -0400)]
Fix Race Condition in Display#clear on IE10
There was a race condition in Display#clear on IE10
because we resize and then clear that causes the canvas
to not actually end up cleared. Clearing the current
viewport first solves the issue. It doesn't appear to
affect other platforms, so it's inside a engine check
(`Util.Engine.trident === 6`). Once we stop supporting
IE10, we should just remove this, because it's not the best
to have Engine-specific code.
Solly Ross [Fri, 19 Sep 2014 19:14:34 +0000 (15:14 -0400)]
Fixed broken mouse test in test.rfb.js
Because we use the XOR (`^`) operator, the button mask must be
set before a MouseUp event happens, otherwise we'll send a pointer
event like it was a MouseDown event. The button mask was not set
in one of the tests, so the test was failing.
Solly Ross [Fri, 19 Sep 2014 18:51:15 +0000 (14:51 -0400)]
Fixed Cursor URI Support Detection
There was a bug in cursor URI support detection due to the way
set_defaults now works -- the code was checking for `null`, whereas
when not set, options default to `undefined` unless otherwise
specified. The code now checks for either `null` or `undefined`.
Tests have been added to ensure that this works properly.
Solly Ross [Fri, 19 Sep 2014 18:48:00 +0000 (14:48 -0400)]
Fixed presence detection bug in utils.set_defaults
Previously, Utils.set_defaults was using `if(conf[keys[i]])`
to check for the presence of a configuration key. This would
fail if `conf[keys[i]]` happened to be false. Instead, we now
use `if(keys[i] in conf)`, which simply checks for the presence
of the key in the conf object.
Solly Ross [Fri, 19 Sep 2014 18:17:15 +0000 (14:17 -0400)]
Fixed Typo Causing MouseUp to not Register
There was a typo in one of the instances of the _buttonMask field
(it was written as _buttonMaks), causing MouseUp to never be sent.
This has been rectified, and the unit tests for the mouse handler
have been changed to check for explicitly sending mouseup and
mousedown.
Solly Ross [Fri, 19 Sep 2014 16:16:06 +0000 (12:16 -0400)]
Fixed assertion collision issues
When run via karma, all the tests are loaded into the same page.
This was causing a collision in the 'displayed' assertion dealing
with using viewportLoc.
The assertions are now in their own file, pulled in by tests that
need them. Additionally, several tests which only set fb_width
and fb_height were correct to set viewportLoc as well.
Solly Ross [Mon, 23 Jun 2014 23:39:50 +0000 (19:39 -0400)]
Add support for Travis CI and SauceLabs Testing
This adds support for Travis CI and SauceLabs
testing. Testing on SauceLabs in done via
the Karma test runner. Note that encrypted
Sauce username and access key values need
to be inserted into .travis.yml as global
environment variables. Additionally, the
local test runner (which is still useful
for debugging tests and code) was updated
to reflect that the 'node_modules' folder
now gets placed in the root directory.
Solly Ross [Sun, 22 Jun 2014 03:26:28 +0000 (23:26 -0400)]
Cleanup: UI code
File: ui.js
Tests Added: False
Changes:
- Fix JSHint errors
- add some curly braces to improve clarity
- move variable declarations to relevant locations instead of at the top
of methods
Solly Ross [Thu, 22 May 2014 20:57:55 +0000 (16:57 -0400)]
Cleanup: WebSocket Helper
File: websock.js
Tests Added: True
Changes:
- Cleaned up JSHint errors
- Converted to normal JS constructor pattern with "private" fields and
methods now simply being prepended by underscores
- Added a "bind" polyfill for use in PhantomJS 1.x in util.js
- Added FakeWebSocket to fill in for actual WebSocket objects when
testing
- Made exception handler actually log exception name and message,
to console, in addition to stack trace
Solly Ross [Wed, 21 May 2014 19:12:20 +0000 (15:12 -0400)]
Cleanup: Webutil code
File: webutil.js
Tests Added: False
Changes:
- Fixed JSHint Errors (global "use strict", spaces)
- added some newline characters when appropriate for readability
- moved variable declarations to the places they were actually used
for readability
Solly Ross [Wed, 21 May 2014 18:54:28 +0000 (14:54 -0400)]
Cleanup: Util code
File: util.js
Tests Added: True (partial -- for logging and array push methods)
Changes:
- Fixed JSHint Errors (indentation, semicolons, global "use strict")
- Made browser detection methods more readable
- added some newline characters when appropriate for readability
- throw Errors not strings!
- Removed conf_defaults, and added make_properties and set_defaults
instead (see below)
The removal of conf_defaults and switch to make_properties and
set_defaults is to facilitate the switch over to normal Javascript
constructors instead of Crockford-style constructors. Now, methods
are added to the objects prototype (and thus make properties is called
outside the constructor).
Solly Ross [Tue, 6 May 2014 19:11:31 +0000 (15:11 -0400)]
Cleanup and Test: base64.js
This is the first commit in a series of commits
which improve the readability of some of the code
and add tests.
File: base64.js
Tests Added: True
Changes:
- Improved indentation
- Fixed JSHint errors
- Moved loop variables to be declared in the loop for better readability
(N.B. Javascript does not have block scoping, so the variables are
still technically available outside the loop -- it just makes the code
clearer to place them inside the loop, since they are only used there)
Solly Ross [Mon, 15 Sep 2014 20:44:36 +0000 (16:44 -0400)]
Support running all tests from the root directory
Previously, if you did not specify a tests file,
you had to be in the 'tests' directory for the
"run all tests" functionality to work. Now it
will work in any directory.
Solly Ross [Tue, 3 Jun 2014 21:42:28 +0000 (17:42 -0400)]
Fix race condition in test runner
Previously, there would be a case where if your tests took
too long to run, the casper test runner would only report
on certain tests. This has been fixed.
Solly Ross [Tue, 3 Jun 2014 20:58:37 +0000 (16:58 -0400)]
Output error events from provider in test runner
Now, 'error' events from the test runner are output to stderr.
Additionally, when debug is enabled, debug output is logged to
stderr instead of stdout (as was the case previously).
Solly Ross [Tue, 3 Jun 2014 15:14:42 +0000 (11:14 -0400)]
Add support for injecting test helper files
Now, the phrase `requires test modules: ` may be place in a comment
in a file to require modules local to the test directory, similarly
to the way the `require local modules: ` line may be used to inject
files in the 'include' directory. This is useful for when common
fakes need to be injected into a test.
Solly Ross [Tue, 3 Jun 2014 15:02:27 +0000 (11:02 -0400)]
Support automatically opening test HTML in browser
When using the '-g' option with run_from_console.js, you can
now pass the '-o' option to automatically open the generated
HTML file in your default browser. This relies on the 'open'
NPM module.
Solly Ross [Mon, 5 May 2014 18:29:29 +0000 (14:29 -0400)]
Fix for scroll offset in Util.getPosition()
Previously, Util.getPosition didn't deal with scrolling
particularly well. This fixes that by calculating the
scroll offset when dealing with getting mouse positions.
Credit to @erikgull and @emmar for the initial version of
the fix. Credit to Brian Huismanfor the initial code.
Credit for this fix goes to Jesper Dam (https://github.com/Medical-Insight/noVNC/tree/fix-ie10-keyboard).
Fix keyboard handling for IE10 (issue #352)
* Keyboard events in IE10 do not provide any useful information on the properties 'which', 'char' or 'charCode'. Instead, it seems to store the char code in the keyCode property.
Changing the type of the keyboardinput element to textarea, fixes issue 356.
* The on-screen keyboard not closing when pressing Enter is more important than not having textsuggestions etc.
Attempt to change the behavior of the enter/go-key on touch devices, we want it to be Enter.
* This code works in Firefox on Android and on Chrome and Safari on iOS.
* It does not work in Chrome on Android, the enter key is labled "Go" and closes the on screen keyboard when pressed.
samhed [Wed, 26 Mar 2014 14:24:50 +0000 (15:24 +0100)]
Added alt-values to the control-bar buttons.
* On slow servers where the button-images can be slowly loaded it can be useful to see some relevant text instead of "Submit query" on every button.
Jesper Dam [Wed, 12 Mar 2014 10:11:52 +0000 (11:11 +0100)]
Better browser OS detection.
Apparently Firefox on Linux changed the value of navigator.appVersion,
causing our OS detection (used to determine how to interpret different
modifier keys) to fail.
Use navigator.platform instead, which should be more stable.
Jesper Dam [Wed, 12 Mar 2014 09:08:14 +0000 (10:08 +0100)]
Better key identifiers
Previously we identified keys in keyboard events by the 'key' property
if it was set, and 'keyCode' otherwise.
This turns out to be problematic as Firefox no longer leaves 'key'
undefined (so we fall back to using 'keyCode'), but instead sets 'key'
to 'MozPrintableKey' for all printable keys.
This meant that when (printable) keys are released, we can't match it
against the corresponding keydown event, and instead just send a keyup
event for the last keydown received.
Now, if both 'key' and 'keyCode' are set, use the concatenation of both.
Otherwise prefer 'keyCode', as that is at least unique for every key.
This should let us release the right keys on keyup events.
A facke connection to 'wss://localhost:17523' (randomly chosen) to detect
the WebSocket binary support is not the best solution.
First of all, check of prototype has the property 'binaryType'. If not,
perform a dummy connection to 'wss://.' instead of 'wss://localhost:17523'.
This patch was inspired by the discussion and implementation of Modernizr:
https://github.com/Modernizr/Modernizr/issues/370
https://github.com/Modernizr/Modernizr/blob/master/feature-detects/websockets/binary.js
Jesper Dam [Mon, 6 Jan 2014 12:59:25 +0000 (13:59 +0100)]
Fix issue #326: correct handling of shift key
When shortcut modifiers (modifier keys such as CTRL, which do not participate in
composing character input) are pressed, we try to suppress the keypress
event, as browsers do not reliably generate it. This means that
subsequent key events are decoded only based on the keydown event.
Due to a type error (comparing a string to a number), shift was
mistakenly treated as a shortcut modifier, preventing text input which
relied on shift, such as _ and %, from being generated.
Solly Ross [Tue, 17 Dec 2013 23:00:57 +0000 (18:00 -0500)]
Support 'requires' Line in Test Runner
If the files passed to the '-t' option are all '.js' files (or
the 'run all tests' option is used) and the '-i' option is not
passed, all tests will be search for the string
'require local modules: '. Only the first instance of this string
will be used. Following the colon should be a list of either local
modules (i.e. files in the '../include/' folder relative to the
test runner's directory, without the '.js' extension) or paths
to other Javascript files. The list of modules and/or files should
be comma-separated. These files will then be included in the generated
HTML file for the appropriate tests as if the '-i' option had been used.
Solly Ross [Tue, 17 Dec 2013 23:00:45 +0000 (18:00 -0500)]
Support Running All Tests
Now, if the '-t' option is passed but no tests are listed,
all tests in the same directory as the launcher will be run.
A file is considered a test if it matches the RegEx
/^test\.(\w|\.|-)+\.js$/ (for those who cannot read PCRE,
that's roughly 'test.*.js').
Solly Ross [Tue, 17 Dec 2013 22:56:18 +0000 (17:56 -0500)]
Support Skipped Tests and Fix JSHint Issues
The test runner now will not break when Mocha skips tests,
and will properly report them. Additionally, several JSHint
warnings were fixed, and a `--debug` option was added to see
output from the provider.