[Libreoffice-commits] online.git: loleaflet/.gitignore loleaflet/Makefile.am loleaflet/README loleaflet/spec
Tor Lillqvist (via logerrit)
logerrit at kemper.freedesktop.org
Thu Apr 16 06:23:08 UTC 2020
dev/null |binary
loleaflet/.gitignore | 1
loleaflet/Makefile.am | 20
loleaflet/README | 19
loleaflet/spec/.eslintrc | 38
loleaflet/spec/after.js | 3
loleaflet/spec/expect.js | 1254 ---
loleaflet/spec/headlessLoadTest.js | 188
loleaflet/spec/index.html | 91
loleaflet/spec/karma.conf.js | 71
loleaflet/spec/loadtest.html | 60
loleaflet/spec/loadtest/LoadTestSpec.js | 82
loleaflet/spec/loleaflet.html | 46
loleaflet/spec/loleaflet/control/PartsSpec.js | 153
loleaflet/spec/loleaflet/control/PermissionSpec.js | 130
loleaflet/spec/loleaflet/control/SearchSpec.js | 139
loleaflet/spec/loleaflet/control/ToolbarSpec.js | 62
loleaflet/spec/runLoadTest.sh | 20
loleaflet/spec/sinon.js | 4224 -------------
loleaflet/spec/spec.hintrc.js | 26
loleaflet/spec/suites/SpecHelper.js | 43
loleaflet/spec/suites/control/Control.AttributionSpec.js | 69
loleaflet/spec/suites/control/Control.LayersSpec.js | 68
loleaflet/spec/suites/control/Control.ScaleSpec.js | 7
loleaflet/spec/suites/control/ControlSpec.js | 52
loleaflet/spec/suites/core/ClassSpec.js | 178
loleaflet/spec/suites/core/EventsSpec.js | 417 -
loleaflet/spec/suites/core/UtilSpec.js | 239
loleaflet/spec/suites/dom/DomEventSpec.js | 103
loleaflet/spec/suites/dom/DomUtilSpec.js | 60
loleaflet/spec/suites/geo/CRSSpec.js | 152
loleaflet/spec/suites/geo/LatLngBoundsSpec.js | 149
loleaflet/spec/suites/geo/LatLngSpec.js | 120
loleaflet/spec/suites/geo/ProjectionSpec.js | 97
loleaflet/spec/suites/geometry/BoundsSpec.js | 88
loleaflet/spec/suites/geometry/LineUtilSpec.js | 91
loleaflet/spec/suites/geometry/PointSpec.js | 105
loleaflet/spec/suites/geometry/PolyUtilSpec.js | 43
loleaflet/spec/suites/geometry/TransformationSpec.js | 32
loleaflet/spec/suites/layer/FeatureGroupSpec.js | 87
loleaflet/spec/suites/layer/GeoJSONSpec.js | 326 -
loleaflet/spec/suites/layer/ImageOverlaySpec.js | 9
loleaflet/spec/suites/layer/LayerGroupSpec.js | 72
loleaflet/spec/suites/layer/PopupSpec.js | 203
loleaflet/spec/suites/layer/marker/MarkerSpec.js | 171
loleaflet/spec/suites/layer/tile/GridLayerSpec.js | 135
loleaflet/spec/suites/layer/tile/TileLayerSpec.js | 1
loleaflet/spec/suites/layer/vector/CircleMarkerSpec.js | 54
loleaflet/spec/suites/layer/vector/CircleSpec.js | 19
loleaflet/spec/suites/layer/vector/PathSpec.js | 16
loleaflet/spec/suites/layer/vector/PolygonSpec.js | 97
loleaflet/spec/suites/layer/vector/PolylineGeometrySpec.js | 36
loleaflet/spec/suites/layer/vector/PolylineSpec.js | 56
loleaflet/spec/suites/map/MapSpec.js | 574 -
loleaflet/spec/suites/map/handler/Map.DragSpec.js | 39
loleaflet/spec/tilebench.html | 44
loleaflet/spec/tilebench/TileBenchSpec.js | 392 -
57 files changed, 11071 deletions(-)
New commits:
commit 2c7b1a6919cdfa3d2ef79d10c77cfeffd185cb84
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Wed Apr 15 11:51:32 2020 +0300
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Thu Apr 16 08:22:50 2020 +0200
Remove loleaflet/spec which probably hasn't been maintained anyway
Change-Id: I1cb65489c2c58329cbed6329b7014a6c04e13b62
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92247
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Tor Lillqvist <tml at collabora.com>
diff --git a/loleaflet/.gitignore b/loleaflet/.gitignore
index 79e5206f4..18e91cc81 100644
--- a/loleaflet/.gitignore
+++ b/loleaflet/.gitignore
@@ -20,7 +20,6 @@ plugins/draw-0.2.4/dist/*.js
plugins/draw-0.2.4/npm-debug.log
coverage/
/load_test_out
-/spec/data/load_test
*.tar.gz
dist/l10n/ui-*json
dist/l10n/help-*.json
diff --git a/loleaflet/Makefile.am b/loleaflet/Makefile.am
index 385bb96a6..8375354e0 100644
--- a/loleaflet/Makefile.am
+++ b/loleaflet/Makefile.am
@@ -571,25 +571,5 @@ clean-local:
rm -rf $(builddir)/dist
rm -rf $(builddir)/build/dist
-spec/data/load-test:
- if [ ! -d spec/data/load_test ]; then \
- mkdir -p spec/data/load_test; \
- for i in $$(seq 1 125); \
- do \
- cp spec/data/eval.odt spec/data/load_test/eval$$i.odt; \
- cp spec/data/eval.odp spec/data/load_test/eval$$i.odp; \
- cp spec/data/eval.ods spec/data/load_test/eval$$i.ods; \
- cp spec/data/eval.odg spec/data/load_test/eval$$i.odg; \
- done; \
- fi
-
-load-test: spec/data/load-test
- rm -rf load_test_out; \
- mkdir load_test_out; \
- for i in $$(seq 1 20); \
- do \
- node_modules/.bin/mocha spec/headlessLoadTest.js > load_test_out/$$i.out 2>&1 & \
- done;
-
ctags:
@$(CTAGS) --language-force=JavaScript $(LOLEAFLET_JS_SRC) $(srcdir)/js/global.js
diff --git a/loleaflet/README b/loleaflet/README
index 0ac0571df..b1263bab6 100644
--- a/loleaflet/README
+++ b/loleaflet/README
@@ -132,25 +132,6 @@ loolwsd.xml. After entering the correct password you should be able to monitor t
users, memory consumption, document URLs with number of users viewing that document etc. You can also kill the
documents directly from the panel which would result in closing the socket connection to the respective document.
-Testing
--------
- - to run the unit tests
- + open spec/loleaflet.html in the browser
- - to simulate an editing session and to get the tile loading times
- + open spec/tilebench.html in the browser
- - to simulate a client opening several documents in the browser
- + open spec/loadtest.html in the browser
- - to simulate a client opening several documents in the console
- + run: node_modules/.bin/mocha spec/headlessLoadTest.js
- - to simulate multiple clients opening several documents in the console
- + run: make load-test
-
-The structure of the unit tests:
-Loleaflet unit tests are located under spec/loleaflet. Following Leaflet's testing style, each test's path
-should mirror the source's path, so spec/loleaflet/control/ToolbarSpec.js tests the features from
-src/control/Toolbar.js . Any new test file needs also to be added in spec/leaflet.html
-
-
API & events
------------
diff --git a/loleaflet/spec/.eslintrc b/loleaflet/spec/.eslintrc
deleted file mode 100644
index e3a29ac7d..000000000
--- a/loleaflet/spec/.eslintrc
+++ /dev/null
@@ -1,38 +0,0 @@
-{
- "rules": {
- "camelcase": 2,
- "no-mixed-spaces-and-tabs": [2, "smart-tabs"],
- "space-after-function-name": 2,
- "space-in-parens": 2,
- "space-in-brackets": 2,
- "space-before-blocks": 2,
- "space-after-keywords": 2,
- "no-lonely-if": 2,
- "comma-style": 2,
- "no-unused-vars": 0,
- "quotes": 0,
- "no-underscore-dangle": 0,
- "no-constant-condition": 0,
- "no-multi-spaces": 0,
- "strict": 0,
- "key-spacing": 0,
- "no-shadow": 0,
- "no-irregular-whitespace": 0,
- "no-console": 0
- },
- "globals": {
- "L": true,
- "module": false,
- "define": false,
- "expect": false,
- "it": false,
- "describe": false,
- "sinon": false,
- "happen": false,
- "beforeEach": false,
- "afterEach": false
- },
- "env": {
- "browser": true
- }
-}
diff --git a/loleaflet/spec/after.js b/loleaflet/spec/after.js
deleted file mode 100644
index fcce76018..000000000
--- a/loleaflet/spec/after.js
+++ /dev/null
@@ -1,3 +0,0 @@
-/* -*- js-indent-level: 8 -*- */
-// put after Leaflet files as imagePath can't be detected in a PhantomJS env
-L.Icon.Default.imagePath = "/base/dist/images";
diff --git a/loleaflet/spec/data/eval.odg b/loleaflet/spec/data/eval.odg
deleted file mode 100644
index 457722a5a..000000000
Binary files a/loleaflet/spec/data/eval.odg and /dev/null differ
diff --git a/loleaflet/spec/data/eval.odp b/loleaflet/spec/data/eval.odp
deleted file mode 100644
index aac1f7444..000000000
Binary files a/loleaflet/spec/data/eval.odp and /dev/null differ
diff --git a/loleaflet/spec/data/eval.ods b/loleaflet/spec/data/eval.ods
deleted file mode 100644
index 324eb7fe9..000000000
Binary files a/loleaflet/spec/data/eval.ods and /dev/null differ
diff --git a/loleaflet/spec/data/eval.odt b/loleaflet/spec/data/eval.odt
deleted file mode 100644
index 31d3377bf..000000000
Binary files a/loleaflet/spec/data/eval.odt and /dev/null differ
diff --git a/loleaflet/spec/expect.js b/loleaflet/spec/expect.js
deleted file mode 100644
index 4e6818cdd..000000000
--- a/loleaflet/spec/expect.js
+++ /dev/null
@@ -1,1254 +0,0 @@
-/* -*- js-indent-level: 8 -*- */
-
-(function (global, module) {
-
- if ('undefined' == typeof module) {
- var module = { exports: {} }
- , exports = module.exports
- }
-
- /**
- * Exports.
- */
-
- module.exports = expect;
- expect.Assertion = Assertion;
-
- /**
- * Exports version.
- */
-
- expect.version = '0.1.2';
-
- /**
- * Possible assertion flags.
- */
-
- var flags = {
- not: ['to', 'be', 'have', 'include', 'only']
- , to: ['be', 'have', 'include', 'only', 'not']
- , only: ['have']
- , have: ['own']
- , be: ['an']
- };
-
- function expect (obj) {
- return new Assertion(obj);
- }
-
- /**
- * Constructor
- *
- * @api private
- */
-
- function Assertion (obj, flag, parent) {
- this.obj = obj;
- this.flags = {};
-
- if (undefined != parent) {
- this.flags[flag] = true;
-
- for (var i in parent.flags) {
- if (parent.flags.hasOwnProperty(i)) {
- this.flags[i] = true;
- }
- }
- }
-
- var $flags = flag ? flags[flag] : keys(flags)
- , self = this
-
- if ($flags) {
- for (var i = 0, l = $flags.length; i < l; i++) {
- // avoid recursion
- if (this.flags[$flags[i]]) continue;
-
- var name = $flags[i]
- , assertion = new Assertion(this.obj, name, this)
-
- if ('function' == typeof Assertion.prototype[name]) {
- // clone the function, make sure we dont touch the prot reference
- var old = this[name];
- this[name] = function () {
- return old.apply(self, arguments);
- }
-
- for (var fn in Assertion.prototype) {
- if (Assertion.prototype.hasOwnProperty(fn) && fn != name) {
- this[name][fn] = bind(assertion[fn], assertion);
- }
- }
- } else {
- this[name] = assertion;
- }
- }
- }
- };
-
- /**
- * Performs an assertion
- *
- * @api private
- */
-
- Assertion.prototype.assert = function (truth, msg, error) {
- var msg = this.flags.not ? error : msg
- , ok = this.flags.not ? !truth : truth;
-
- if (!ok) {
- throw new Error(msg.call(this));
- }
-
- this.and = new Assertion(this.obj);
- };
-
- /**
- * Check if the value is truthy
- *
- * @api public
- */
-
- Assertion.prototype.ok = function () {
- this.assert(
- !!this.obj
- , function(){ return 'expected ' + i(this.obj) + ' to be truthy' }
- , function(){ return 'expected ' + i(this.obj) + ' to be falsy' });
- };
-
- /**
- * Assert that the function throws.
- *
- * @param {Function|RegExp} callback, or regexp to match error string against
- * @api public
- */
-
- Assertion.prototype.throwError =
- Assertion.prototype.throwException = function (fn) {
- expect(this.obj).to.be.a('function');
-
- var thrown = false
- , not = this.flags.not
-
- try {
- this.obj();
- } catch (e) {
- if ('function' == typeof fn) {
- fn(e);
- } else if ('object' == typeof fn) {
- var subject = 'string' == typeof e ? e : e.message;
- if (not) {
- expect(subject).to.not.match(fn);
- } else {
- expect(subject).to.match(fn);
- }
- }
- thrown = true;
- }
-
- if ('object' == typeof fn && not) {
- // in the presence of a matcher, ensure the `not` only applies to
- // the matching.
- this.flags.not = false;
- }
-
- var name = this.obj.name || 'fn';
- this.assert(
- thrown
- , function(){ return 'expected ' + name + ' to throw an exception' }
- , function(){ return 'expected ' + name + ' not to throw an exception' });
- };
-
- /**
- * Checks if the array is empty.
- *
- * @api public
- */
-
- Assertion.prototype.empty = function () {
- var expectation;
-
- if ('object' == typeof this.obj && null !== this.obj && !isArray(this.obj)) {
- if ('number' == typeof this.obj.length) {
- expectation = !this.obj.length;
- } else {
- expectation = !keys(this.obj).length;
- }
- } else {
- if ('string' != typeof this.obj) {
- expect(this.obj).to.be.an('object');
- }
-
- expect(this.obj).to.have.property('length');
- expectation = !this.obj.length;
- }
-
- this.assert(
- expectation
- , function(){ return 'expected ' + i(this.obj) + ' to be empty' }
- , function(){ return 'expected ' + i(this.obj) + ' to not be empty' });
- return this;
- };
-
- /**
- * Checks if the obj exactly equals another.
- *
- * @api public
- */
-
- Assertion.prototype.be =
- Assertion.prototype.equal = function (obj) {
- this.assert(
- obj === this.obj
- , function(){ return 'expected ' + i(this.obj) + ' to equal ' + i(obj) }
- , function(){ return 'expected ' + i(this.obj) + ' to not equal ' + i(obj) });
- return this;
- };
-
- /**
- * Checks if the obj sortof equals another.
- *
- * @api public
- */
-
- Assertion.prototype.eql = function (obj) {
- this.assert(
- expect.eql(obj, this.obj)
- , function(){ return 'expected ' + i(this.obj) + ' to sort of equal ' + i(obj) }
- , function(){ return 'expected ' + i(this.obj) + ' to sort of not equal ' + i(obj) });
- return this;
- };
-
- /**
- * Assert within start to finish (inclusive).
- *
- * @param {Number} start
- * @param {Number} finish
- * @api public
- */
-
- Assertion.prototype.within = function (start, finish) {
- var range = start + '..' + finish;
- this.assert(
- this.obj >= start && this.obj <= finish
- , function(){ return 'expected ' + i(this.obj) + ' to be within ' + range }
- , function(){ return 'expected ' + i(this.obj) + ' to not be within ' + range });
- return this;
- };
-
- /**
- * Assert typeof / instance of
- *
- * @api public
- */
-
- Assertion.prototype.a =
- Assertion.prototype.an = function (type) {
- if ('string' == typeof type) {
- // proper english in error msg
- var n = /^[aeiou]/.test(type) ? 'n' : '';
-
- // typeof with support for 'array'
- this.assert(
- 'array' == type ? isArray(this.obj) :
- 'object' == type
- ? 'object' == typeof this.obj && null !== this.obj
- : type == typeof this.obj
- , function(){ return 'expected ' + i(this.obj) + ' to be a' + n + ' ' + type }
- , function(){ return 'expected ' + i(this.obj) + ' not to be a' + n + ' ' + type });
- } else {
- // instanceof
- var name = type.name || 'supplied constructor';
- this.assert(
- this.obj instanceof type
- , function(){ return 'expected ' + i(this.obj) + ' to be an instance of ' + name }
- , function(){ return 'expected ' + i(this.obj) + ' not to be an instance of ' + name });
- }
-
- return this;
- };
-
- /**
- * Assert numeric value above _n_.
- *
- * @param {Number} n
- * @api public
- */
-
- Assertion.prototype.greaterThan =
- Assertion.prototype.above = function (n) {
- this.assert(
- this.obj > n
- , function(){ return 'expected ' + i(this.obj) + ' to be above ' + n }
- , function(){ return 'expected ' + i(this.obj) + ' to be below ' + n });
- return this;
- };
-
- /**
- * Assert numeric value below _n_.
- *
- * @param {Number} n
- * @api public
- */
-
- Assertion.prototype.lessThan =
- Assertion.prototype.below = function (n) {
- this.assert(
- this.obj < n
- , function(){ return 'expected ' + i(this.obj) + ' to be below ' + n }
- , function(){ return 'expected ' + i(this.obj) + ' to be above ' + n });
- return this;
- };
-
- /**
- * Assert string value matches _regexp_.
- *
- * @param {RegExp} regexp
- * @api public
- */
-
- Assertion.prototype.match = function (regexp) {
- this.assert(
- regexp.exec(this.obj)
- , function(){ return 'expected ' + i(this.obj) + ' to match ' + regexp }
- , function(){ return 'expected ' + i(this.obj) + ' not to match ' + regexp });
- return this;
- };
-
- /**
- * Assert property "length" exists and has value of _n_.
- *
- * @param {Number} n
- * @api public
- */
-
- Assertion.prototype.length = function (n) {
- expect(this.obj).to.have.property('length');
- var len = this.obj.length;
- this.assert(
- n == len
- , function(){ return 'expected ' + i(this.obj) + ' to have a length of ' + n + ' but got ' + len }
- , function(){ return 'expected ' + i(this.obj) + ' to not have a length of ' + len });
- return this;
- };
-
- /**
- * Assert property _name_ exists, with optional _val_.
- *
- * @param {String} name
- * @param {Mixed} val
- * @api public
- */
-
- Assertion.prototype.property = function (name, val) {
- if (this.flags.own) {
- this.assert(
- Object.prototype.hasOwnProperty.call(this.obj, name)
- , function(){ return 'expected ' + i(this.obj) + ' to have own property ' + i(name) }
- , function(){ return 'expected ' + i(this.obj) + ' to not have own property ' + i(name) });
- return this;
- }
-
- if (this.flags.not && undefined !== val) {
- if (undefined === this.obj[name]) {
- throw new Error(i(this.obj) + ' has no property ' + i(name));
- }
- } else {
- var hasProp;
- try {
- hasProp = name in this.obj
- } catch (e) {
- hasProp = undefined !== this.obj[name]
- }
-
- this.assert(
- hasProp
- , function(){ return 'expected ' + i(this.obj) + ' to have a property ' + i(name) }
- , function(){ return 'expected ' + i(this.obj) + ' to not have a property ' + i(name) });
- }
-
- if (undefined !== val) {
- this.assert(
- val === this.obj[name]
- , function(){ return 'expected ' + i(this.obj) + ' to have a property ' + i(name)
- + ' of ' + i(val) + ', but got ' + i(this.obj[name]) }
- , function(){ return 'expected ' + i(this.obj) + ' to not have a property ' + i(name)
- + ' of ' + i(val) });
- }
-
- this.obj = this.obj[name];
- return this;
- };
-
- /**
- * Assert that the array contains _obj_ or string contains _obj_.
- *
- * @param {Mixed} obj|string
- * @api public
- */
-
- Assertion.prototype.string =
- Assertion.prototype.contain = function (obj) {
- if ('string' == typeof this.obj) {
- this.assert(
- ~this.obj.indexOf(obj)
- , function(){ return 'expected ' + i(this.obj) + ' to contain ' + i(obj) }
- , function(){ return 'expected ' + i(this.obj) + ' to not contain ' + i(obj) });
- } else {
- this.assert(
- ~indexOf(this.obj, obj)
- , function(){ return 'expected ' + i(this.obj) + ' to contain ' + i(obj) }
- , function(){ return 'expected ' + i(this.obj) + ' to not contain ' + i(obj) });
- }
- return this;
- };
-
- /**
- * Assert exact keys or inclusion of keys by using
- * the `.own` modifier.
- *
- * @param {Array|String ...} keys
- * @api public
- */
-
- Assertion.prototype.key =
- Assertion.prototype.keys = function ($keys) {
- var str
- , ok = true;
-
- $keys = isArray($keys)
- ? $keys
- : Array.prototype.slice.call(arguments);
-
- if (!$keys.length) throw new Error('keys required');
-
- var actual = keys(this.obj)
- , len = $keys.length;
-
- // Inclusion
- ok = every($keys, function (key) {
- return ~indexOf(actual, key);
- });
-
- // Strict
- if (!this.flags.not && this.flags.only) {
- ok = ok && $keys.length == actual.length;
- }
-
- // Key string
- if (len > 1) {
- $keys = map($keys, function (key) {
- return i(key);
- });
- var last = $keys.pop();
- str = $keys.join(', ') + ', and ' + last;
- } else {
- str = i($keys[0]);
- }
-
- // Form
- str = (len > 1 ? 'keys ' : 'key ') + str;
-
- // Have / include
- str = (!this.flags.only ? 'include ' : 'only have ') + str;
-
- // Assertion
- this.assert(
- ok
- , function(){ return 'expected ' + i(this.obj) + ' to ' + str }
- , function(){ return 'expected ' + i(this.obj) + ' to not ' + str });
-
- return this;
- };
- /**
- * Assert a failure.
- *
- * @param {String ...} custom message
- * @api public
- */
- Assertion.prototype.fail = function (msg) {
- msg = msg || "explicit failure";
- this.assert(false, msg, msg);
- return this;
- };
-
- /**
- * Function bind implementation.
- */
-
- function bind (fn, scope) {
- return function () {
- return fn.apply(scope, arguments);
- }
- }
-
- /**
- * Array every compatibility
- *
- * @see bit.ly/5Fq1N2
- * @api public
- */
-
- function every (arr, fn, thisObj) {
- var scope = thisObj || global;
- for (var i = 0, j = arr.length; i < j; ++i) {
- if (!fn.call(scope, arr[i], i, arr)) {
- return false;
- }
- }
- return true;
- };
-
- /**
- * Array indexOf compatibility.
- *
- * @see bit.ly/a5Dxa2
- * @api public
- */
-
- function indexOf (arr, o, i) {
- if (Array.prototype.indexOf) {
- return Array.prototype.indexOf.call(arr, o, i);
- }
-
- if (arr.length === undefined) {
- return -1;
- }
-
- for (var j = arr.length, i = i < 0 ? i + j < 0 ? 0 : i + j : i || 0
- ; i < j && arr[i] !== o; i++);
-
- return j <= i ? -1 : i;
- };
-
- // https://gist.github.com/1044128/
- var getOuterHTML = function(element) {
- if ('outerHTML' in element) return element.outerHTML;
- var ns = "http://www.w3.org/1999/xhtml";
- var container = document.createElementNS(ns, '_');
- var elemProto = (window.HTMLElement || window.Element).prototype;
- var xmlSerializer = new XMLSerializer();
- var html;
- if (document.xmlVersion) {
- return xmlSerializer.serializeToString(element);
- } else {
- container.appendChild(element.cloneNode(false));
- html = container.innerHTML.replace('><', '>' + element.innerHTML + '<');
- container.innerHTML = '';
- return html;
- }
- };
-
- // Returns true if object is a DOM element.
- var isDOMElement = function (object) {
- if (typeof HTMLElement === 'object') {
- return object instanceof HTMLElement;
- } else {
- return object &&
- typeof object === 'object' &&
- object.nodeType === 1 &&
- typeof object.nodeName === 'string';
- }
- };
-
- /**
- * Inspects an object.
- *
- * @see taken from node.js `util` module (copyright Joyent, MIT license)
- * @api private
- */
-
- function i (obj, showHidden, depth) {
- var seen = [];
-
- function stylize (str) {
- return str;
- };
-
- function format (value, recurseTimes) {
- // Provide a hook for user-specified inspect functions.
- // Check that value is an object with an inspect function on it
- if (value && typeof value.inspect === 'function' &&
- // Filter out the util module, it's inspect function is special
- value !== exports &&
- // Also filter out any prototype objects using the circular check.
- !(value.constructor && value.constructor.prototype === value)) {
- return value.inspect(recurseTimes);
- }
-
- // Primitive types cannot have properties
- switch (typeof value) {
- case 'undefined':
- return stylize('undefined', 'undefined');
-
- case 'string':
- var simple = '\'' + json.stringify(value).replace(/^"|"$/g, '')
- .replace(/'/g, "\\'")
- .replace(/\\"/g, '"') + '\'';
- return stylize(simple, 'string');
-
- case 'number':
- return stylize('' + value, 'number');
-
- case 'boolean':
- return stylize('' + value, 'boolean');
- }
- // For some reason typeof null is "object", so special case here.
- if (value === null) {
- return stylize('null', 'null');
- }
-
- if (isDOMElement(value)) {
- return getOuterHTML(value);
- }
-
- // Look up the keys of the object.
- var visible_keys = keys(value);
- var $keys = showHidden ? Object.getOwnPropertyNames(value) : visible_keys;
-
- // Functions without properties can be shortcutted.
- if (typeof value === 'function' && $keys.length === 0) {
- if (isRegExp(value)) {
- return stylize('' + value, 'regexp');
- } else {
- var name = value.name ? ': ' + value.name : '';
- return stylize('[Function' + name + ']', 'special');
- }
- }
-
- // Dates without properties can be shortcutted
- if (isDate(value) && $keys.length === 0) {
- return stylize(value.toUTCString(), 'date');
- }
-
- var base, type, braces;
- // Determine the object type
- if (isArray(value)) {
- type = 'Array';
- braces = ['[', ']'];
- } else {
- type = 'Object';
- braces = ['{', '}'];
- }
-
- // Make functions say that they are functions
- if (typeof value === 'function') {
- var n = value.name ? ': ' + value.name : '';
- base = (isRegExp(value)) ? ' ' + value : ' [Function' + n + ']';
- } else {
- base = '';
- }
-
- // Make dates with properties first say the date
- if (isDate(value)) {
- base = ' ' + value.toUTCString();
- }
-
- if ($keys.length === 0) {
- return braces[0] + base + braces[1];
- }
-
- if (recurseTimes < 0) {
- if (isRegExp(value)) {
- return stylize('' + value, 'regexp');
- } else {
- return stylize('[Object]', 'special');
- }
- }
-
- seen.push(value);
-
- var output = map($keys, function (key) {
- var name, str;
- if (value.__lookupGetter__) {
- if (value.__lookupGetter__(key)) {
- if (value.__lookupSetter__(key)) {
- str = stylize('[Getter/Setter]', 'special');
- } else {
- str = stylize('[Getter]', 'special');
- }
- } else {
- if (value.__lookupSetter__(key)) {
- str = stylize('[Setter]', 'special');
- }
- }
- }
- if (indexOf(visible_keys, key) < 0) {
- name = '[' + key + ']';
- }
- if (!str) {
- if (indexOf(seen, value[key]) < 0) {
- if (recurseTimes === null) {
- str = format(value[key]);
- } else {
- str = format(value[key], recurseTimes - 1);
- }
- if (str.indexOf('\n') > -1) {
- if (isArray(value)) {
- str = map(str.split('\n'), function (line) {
- return ' ' + line;
- }).join('\n').substr(2);
- } else {
- str = '\n' + map(str.split('\n'), function (line) {
- return ' ' + line;
- }).join('\n');
- }
- }
- } else {
- str = stylize('[Circular]', 'special');
- }
- }
- if (typeof name === 'undefined') {
- if (type === 'Array' && key.match(/^\d+$/)) {
- return str;
- }
- name = json.stringify('' + key);
- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
- name = name.substr(1, name.length - 2);
- name = stylize(name, 'name');
- } else {
- name = name.replace(/'/g, "\\'")
- .replace(/\\"/g, '"')
- .replace(/(^"|"$)/g, "'");
- name = stylize(name, 'string');
- }
- }
-
- return name + ': ' + str;
- });
-
- seen.pop();
-
- var numLinesEst = 0;
- var length = reduce(output, function (prev, cur) {
- numLinesEst++;
- if (indexOf(cur, '\n') >= 0) numLinesEst++;
- return prev + cur.length + 1;
- }, 0);
-
- if (length > 50) {
- output = braces[0] +
- (base === '' ? '' : base + '\n ') +
- ' ' +
- output.join(',\n ') +
- ' ' +
- braces[1];
-
- } else {
- output = braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
- }
-
- return output;
- }
- return format(obj, (typeof depth === 'undefined' ? 2 : depth));
- };
-
- function isArray (ar) {
- return Object.prototype.toString.call(ar) == '[object Array]';
- };
-
- function isRegExp(re) {
- var s;
- try {
- s = '' + re;
- } catch (e) {
- return false;
- }
-
- return re instanceof RegExp || // easy case
- // duck-type for context-switching evalcx case
- typeof(re) === 'function' &&
- re.constructor.name === 'RegExp' &&
- re.compile &&
- re.test &&
- re.exec &&
- s.match(/^\/.*\/[gim]{0,3}$/);
- };
-
- function isDate(d) {
- if (d instanceof Date) return true;
- return false;
- };
-
- function keys (obj) {
- if (Object.keys) {
- return Object.keys(obj);
- }
-
- var keys = [];
-
- for (var i in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, i)) {
- keys.push(i);
- }
- }
-
- return keys;
- }
-
- function map (arr, mapper, that) {
- if (Array.prototype.map) {
- return Array.prototype.map.call(arr, mapper, that);
- }
-
- var other= new Array(arr.length);
-
- for (var i= 0, n = arr.length; i<n; i++)
- if (i in arr)
- other[i] = mapper.call(that, arr[i], i, arr);
-
- return other;
- };
-
- function reduce (arr, fun) {
- if (Array.prototype.reduce) {
- return Array.prototype.reduce.apply(
- arr
- , Array.prototype.slice.call(arguments, 1)
- );
- }
-
- var len = +this.length;
-
- if (typeof fun !== "function")
- throw new TypeError();
-
- // no value to return if no initial value and an empty array
- if (len === 0 && arguments.length === 1)
- throw new TypeError();
-
- var i = 0;
- if (arguments.length >= 2) {
- var rv = arguments[1];
- } else {
- do {
- if (i in this) {
- rv = this[i++];
- break;
- }
-
- // if array contains no values, no initial value to return
- if (++i >= len)
- throw new TypeError();
- } while (true);
- }
-
- for (; i < len; i++) {
- if (i in this)
- rv = fun.call(null, rv, this[i], i, this);
- }
-
- return rv;
- };
-
- /**
- * Asserts deep equality
- *
- * @see taken from node.js `assert` module (copyright Joyent, MIT license)
- * @api private
- */
-
- expect.eql = function eql (actual, expected) {
- // 7.1. All identical values are equivalent, as determined by ===.
- if (actual === expected) {
- return true;
- } else if ('undefined' != typeof Buffer
- && Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) {
- if (actual.length != expected.length) return false;
-
- for (var i = 0; i < actual.length; i++) {
- if (actual[i] !== expected[i]) return false;
- }
-
- return true;
-
- // 7.2. If the expected value is a Date object, the actual value is
- // equivalent if it is also a Date object that refers to the same time.
- } else if (actual instanceof Date && expected instanceof Date) {
- return actual.getTime() === expected.getTime();
-
- // 7.3. Other pairs that do not both pass typeof value == "object",
- // equivalence is determined by ==.
- } else if (typeof actual != 'object' && typeof expected != 'object') {
- return actual == expected;
-
- // 7.4. For all other Object pairs, including Array objects, equivalence is
- // determined by having the same number of owned properties (as verified
- // with Object.prototype.hasOwnProperty.call), the same set of keys
- // (although not necessarily the same order), equivalent values for every
- // corresponding key, and an identical "prototype" property. Note: this
- // accounts for both named and indexed properties on Arrays.
- } else {
- return objEquiv(actual, expected);
- }
- }
-
- function isUndefinedOrNull (value) {
- return value === null || value === undefined;
- }
-
- function isArguments (object) {
- return Object.prototype.toString.call(object) == '[object Arguments]';
- }
-
- function objEquiv (a, b) {
- if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
- return false;
- // an identical "prototype" property.
- if (a.prototype !== b.prototype) return false;
- //~~~I've managed to break Object.keys through screwy arguments passing.
- // Converting to array solves the problem.
- if (isArguments(a)) {
- if (!isArguments(b)) {
- return false;
- }
- a = pSlice.call(a);
- b = pSlice.call(b);
- return expect.eql(a, b);
- }
- try{
- var ka = keys(a),
- kb = keys(b),
- key, i;
- } catch (e) {//happens when one is a string literal and the other isn't
- return false;
- }
- // having the same number of owned properties (keys incorporates hasOwnProperty)
- if (ka.length != kb.length)
- return false;
- //the same set of keys (although not necessarily the same order),
- ka.sort();
- kb.sort();
- //~~~cheap key test
- for (i = ka.length - 1; i >= 0; i--) {
- if (ka[i] != kb[i])
- return false;
- }
- //equivalent values for every corresponding key, and
- //~~~possibly expensive deep test
- for (i = ka.length - 1; i >= 0; i--) {
- key = ka[i];
- if (!expect.eql(a[key], b[key]))
- return false;
- }
- return true;
- }
-
- var json = (function () {
- "use strict";
-
- if ('object' == typeof JSON && JSON.parse && JSON.stringify) {
- return {
- parse: nativeJSON.parse
- , stringify: nativeJSON.stringify
- }
- }
-
- var JSON = {};
-
- function f(n) {
- // Format integers to have at least two digits.
- return n < 10 ? '0' + n : n;
- }
-
- function date(d, key) {
- return isFinite(d.valueOf()) ?
- d.getUTCFullYear() + '-' +
- f(d.getUTCMonth() + 1) + '-' +
- f(d.getUTCDate()) + 'T' +
- f(d.getUTCHours()) + ':' +
- f(d.getUTCMinutes()) + ':' +
- f(d.getUTCSeconds()) + 'Z' : null;
- };
-
- var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- gap,
- indent,
- meta = { // table of character substitutions
- '\b': '\\b',
- '\t': '\\t',
- '\n': '\\n',
- '\f': '\\f',
- '\r': '\\r',
- '"' : '\\"',
- '\\': '\\\\'
- },
- rep;
-
-
- function quote(string) {
-
- // If the string contains no control characters, no quote characters, and no
- // backslash characters, then we can safely slap some quotes around it.
- // Otherwise we must also replace the offending characters with safe escape
- // sequences.
-
- escapable.lastIndex = 0;
- return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
- var c = meta[a];
- return typeof c === 'string' ? c :
- '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- }) + '"' : '"' + string + '"';
- }
-
-
- function str(key, holder) {
-
- // Produce a string from holder[key].
-
- var i, // The loop counter.
- k, // The member key.
- v, // The member value.
- length,
- mind = gap,
- partial,
- value = holder[key];
-
- // If the value has a toJSON method, call it to obtain a replacement value.
-
- if (value instanceof Date) {
- value = date(key);
- }
-
- // If we were called with a replacer function, then call the replacer to
- // obtain a replacement value.
-
- if (typeof rep === 'function') {
- value = rep.call(holder, key, value);
- }
-
- // What happens next depends on the value's type.
-
- switch (typeof value) {
- case 'string':
- return quote(value);
-
- case 'number':
-
- // JSON numbers must be finite. Encode non-finite numbers as null.
-
- return isFinite(value) ? String(value) : 'null';
-
- case 'boolean':
- case 'null':
-
- // If the value is a boolean or null, convert it to a string. Note:
- // typeof null does not produce 'null'. The case is included here in
- // the remote chance that this gets fixed someday.
-
- return String(value);
-
- // If the type is 'object', we might be dealing with an object or an array or
- // null.
-
- case 'object':
-
- // Due to a specification blunder in ECMAScript, typeof null is 'object',
- // so watch out for that case.
-
- if (!value) {
- return 'null';
- }
-
- // Make an array to hold the partial results of stringifying this object value.
-
- gap += indent;
- partial = [];
-
- // Is the value an array?
-
- if (Object.prototype.toString.apply(value) === '[object Array]') {
-
- // The value is an array. Stringify every element. Use null as a placeholder
- // for non-JSON values.
-
- length = value.length;
- for (i = 0; i < length; i += 1) {
- partial[i] = str(i, value) || 'null';
- }
-
- // Join all of the elements together, separated with commas, and wrap them in
- // brackets.
-
- v = partial.length === 0 ? '[]' : gap ?
- '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' :
- '[' + partial.join(',') + ']';
- gap = mind;
- return v;
- }
-
- // If the replacer is an array, use it to select the members to be stringified.
-
- if (rep && typeof rep === 'object') {
- length = rep.length;
- for (i = 0; i < length; i += 1) {
- if (typeof rep[i] === 'string') {
- k = rep[i];
- v = str(k, value);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- } else {
-
- // Otherwise, iterate through all of the keys in the object.
-
- for (k in value) {
- if (Object.prototype.hasOwnProperty.call(value, k)) {
- v = str(k, value);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- }
-
- // Join all of the member texts together, separated with commas,
- // and wrap them in braces.
-
- v = partial.length === 0 ? '{}' : gap ?
- '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' :
- '{' + partial.join(',') + '}';
- gap = mind;
- return v;
- }
- }
-
- // If the JSON object does not yet have a stringify method, give it one.
-
- JSON.stringify = function (value, replacer, space) {
-
- // The stringify method takes a value and an optional replacer, and an optional
- // space parameter, and returns a JSON text. The replacer can be a function
- // that can replace values, or an array of strings that will select the keys.
- // A default replacer method can be provided. Use of the space parameter can
- // produce text that is more easily readable.
-
- var i;
- gap = '';
- indent = '';
-
- // If the space parameter is a number, make an indent string containing that
- // many spaces.
-
- if (typeof space === 'number') {
- for (i = 0; i < space; i += 1) {
- indent += ' ';
- }
-
- // If the space parameter is a string, it will be used as the indent string.
-
- } else if (typeof space === 'string') {
- indent = space;
- }
-
- // If there is a replacer, it must be a function or an array.
- // Otherwise, throw an error.
-
- rep = replacer;
- if (replacer && typeof replacer !== 'function' &&
- (typeof replacer !== 'object' ||
- typeof replacer.length !== 'number')) {
- throw new Error('JSON.stringify');
- }
-
- // Make a fake root object containing our value under the key of ''.
- // Return the result of stringifying the value.
-
- return str('', {'': value});
- };
-
- // If the JSON object does not yet have a parse method, give it one.
-
- JSON.parse = function (text, reviver) {
- // The parse method takes a text and an optional reviver function, and returns
- // a JavaScript value if the text is a valid JSON text.
-
- var j;
-
- function walk(holder, key) {
-
- // The walk method is used to recursively walk the resulting structure so
- // that modifications can be made.
-
- var k, v, value = holder[key];
- if (value && typeof value === 'object') {
- for (k in value) {
- if (Object.prototype.hasOwnProperty.call(value, k)) {
- v = walk(value, k);
- if (v !== undefined) {
- value[k] = v;
- } else {
- delete value[k];
- }
- }
- }
- }
- return reviver.call(holder, key, value);
- }
-
-
- // Parsing happens in four stages. In the first stage, we replace certain
- // Unicode characters with escape sequences. JavaScript handles many characters
- // incorrectly, either silently deleting them, or treating them as line endings.
-
- text = String(text);
- cx.lastIndex = 0;
- if (cx.test(text)) {
- text = text.replace(cx, function (a) {
- return '\\u' +
- ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- });
- }
-
- // In the second stage, we run the text against regular expressions that look
- // for non-JSON patterns. We are especially concerned with '()' and 'new'
- // because they can cause invocation, and '=' because it can cause mutation.
- // But just to be safe, we want to reject all unexpected forms.
-
- // We split the second stage into 4 regexp operations in order to work around
- // crippling inefficiencies in IE's and Safari's regexp engines. First we
- // replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
- // replace all simple value tokens with ']' characters. Third, we delete all
- // open brackets that follow a colon or comma or that begin the text. Finally,
- // we look to see that the remaining characters are only whitespace or ']' or
- // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
-
- if (/^[\],:{}\s]*$/
- .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
- .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
- .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
-
- // In the third stage we use the eval function to compile the text into a
- // JavaScript structure. The '{' operator is subject to a syntactic ambiguity
- // in JavaScript: it can begin a block or an object literal. We wrap the text
- // in parens to eliminate the ambiguity.
-
- j = eval('(' + text + ')');
-
- // In the optional fourth stage, we recursively walk the new structure, passing
- // each name/value pair to a reviver function for possible transformation.
-
- return typeof reviver === 'function' ?
- walk({'': j}, '') : j;
- }
-
- // If the text is not JSON parseable, then a SyntaxError is thrown.
-
- throw new SyntaxError('JSON.parse');
- };
-
- return JSON;
- })();
-
- if ('undefined' != typeof window) {
- window.expect = module.exports;
- }
-
-})(
- this
- , 'undefined' != typeof module ? module : {}
- , 'undefined' != typeof exports ? exports : {}
-);
diff --git a/loleaflet/spec/headlessLoadTest.js b/loleaflet/spec/headlessLoadTest.js
deleted file mode 100644
index 911344273..000000000
--- a/loleaflet/spec/headlessLoadTest.js
+++ /dev/null
@@ -1,188 +0,0 @@
-/* -*- js-indent-level: 8 -*- */
-var WebSocket = require('ws');
-var events = require('events');
-
-if (typeof String.prototype.startsWith != 'function') {
- String.prototype.startsWith = function (str){
- return this.indexOf(str) === 0;
- };
-}
-
-describe('LoadTest', function () {
- // 30s timeout
- this.timeout(30000);
- // set the slow time to 5ms knowing each test takes more than that,
- // so the run time is always printed
- this.slow(5);
- var testsRan = 0,
- testsToRun = 500;
- tileSize = 256,
- tileSizeTwips = 3840,
- host = 'wss://localhost:9980';
-
- var _parseServerCmd = function (msg) {
- var tokens = msg.split(/[ \n]+/);
- var command = {};
- for (var i = 0; i < tokens.length; i++) {
- if (tokens[i].substring(0, 9) === 'tileposx=') {
- command.x = parseInt(tokens[i].substring(9));
- }
- else if (tokens[i].substring(0, 9) === 'tileposy=') {
- command.y = parseInt(tokens[i].substring(9));
- }
- else if (tokens[i].substring(0, 10) === 'tilewidth=') {
- command.tileWidth = parseInt(tokens[i].substring(10));
- }
- else if (tokens[i].substring(0, 11) === 'tileheight=') {
- command.tileHeight = parseInt(tokens[i].substring(11));
- }
- else if (tokens[i].substring(0, 6) === 'width=') {
- command.width = parseInt(tokens[i].substring(6));
- }
- else if (tokens[i].substring(0, 7) === 'height=') {
- command.height = parseInt(tokens[i].substring(7));
- }
- else if (tokens[i].substring(0, 5) === 'part=') {
- command.part = parseInt(tokens[i].substring(5));
- }
- else if (tokens[i].substring(0, 6) === 'parts=') {
- command.parts = parseInt(tokens[i].substring(6));
- }
- else if (tokens[i].substring(0, 8) === 'current=') {
- command.currentPart = parseInt(tokens[i].substring(8));
- }
- }
- return command;
- };
-
- function shuffle(o){
- for(var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
- return o;
- }
-
- docPath = 'file://' + __dirname + '/data/load_test/';
- var docs = [];
- for (var i = 1; i <= 125; i++) {
- docs.push('eval' + i + '.odt');
- docs.push('eval' + i + '.odp');
- docs.push('eval' + i + '.ods');
- docs.push('eval' + i + '.odg');
- }
- docs = shuffle(docs);
-
- docs.forEach(function (testDoc) {
- if (testsRan >= testsToRun) {
- return;
- }
- testsRan += 1;
- describe('Document #' + testsRan + ' (' + testDoc + ')', function () {
- var ws;
- var requestedTiles = 0;
- var docWidthTwips, docHeightTwips, midY, endY;
- var eventEmitter = new events.EventEmitter();
-
- var onMessage = function (evt) {
- var bytes, index, textMsg;
-
- if (typeof (evt.data) === 'string') {
- textMsg = evt.data;
- }
- else if (typeof (evt.data) === 'object') {
- bytes = new Uint8Array(evt.data);
- index = 0;
- // search for the first newline which marks the end of the message
- while (index < bytes.length && bytes[index] !== 10) {
- index++;
- }
- textMsg = String.fromCharCode.apply(null, bytes.subarray(0, index));
- }
-
- if (textMsg.startsWith('status:')) {
- command = _parseServerCmd(textMsg);
- docWidthTwips = command.width;
- docHeightTwips = command.height;
- endY = Math.floor(docHeightTwips / tileSizeTwips);
- midY = Math.floor(endY / 2);
- eventEmitter.emit('status');
- }
- else if (textMsg.startsWith('tile:')) {
- requestedTiles -= 1;
- if (requestedTiles <= 0) {
- eventEmitter.emit('alltilesloaded');
- }
- }
- else if (textMsg.startsWith('error:')) {
- console.log(textMsg);
- throw new Error(textMsg);
- }
- };
-
- var requestTiles = function (x, y) {
- requestedTiles += 1;
- ws.send('tile ' +
- 'part=0 ' +
- 'width=' + tileSize + ' ' +
- 'height=' + tileSize + ' ' +
- 'tileposx=' + x * tileSizeTwips + ' ' +
- 'tileposy=' + y * tileSizeTwips + ' ' +
- 'tilewidth=' + tileSizeTwips + ' ' +
- 'tileheight=' + tileSizeTwips);
- };
-
- var isValidTile = function (x, y) {
- return x >= 0 && y >= 0 && (x * tileSizeTwips < docWidthTwips) && (y * tileSizeTwips < docHeightTwips);
- };
-
- after(function (done) {
- ws.onmessage = function () {};
- ws.close();
- done();
- });
-
- it('Connect to the server', function (done) {
- eventEmitter.once('status', done);
- ws = new WebSocket(host);
- ws.onmessage = onMessage;
- ws.onerror = function (e) {console.log(e)};
- ws.binaryType = 'arraybuffer';
- ws.onopen = function () {
- ws.send('load url=' + docPath + testDoc);
- ws.send('status');
- };
- });
-
- it('Load the document', function (done) {
- eventEmitter.once('alltilesloaded', done);
- for (var i = 0; i < 3; i++) {
- for (j = 0; j < 5; j++) {
- if (isValidTile(j, i)) {
- requestTiles(j, i);
- }
- }
- }
- });
-
- it('Scroll to the middle', function (done) {
- eventEmitter.once('alltilesloaded', done);
- for (var i = midY; i < midY + 3; i++) {
- for (j = 0; j < 5; j++) {
- if (isValidTile(j, i)) {
- requestTiles(j, i);
- }
- }
- }
- });
-
- it('Scroll to the end', function (done) {
- eventEmitter.once('alltilesloaded', done);
- for (var i = endY; i > endY - 3; i--) {
- for (j = 0; j < 5; j++) {
- if (isValidTile(j, i)) {
- requestTiles(j, i);
- }
- }
- }
- });
- });
- });
-});
diff --git a/loleaflet/spec/index.html b/loleaflet/spec/index.html
deleted file mode 100644
index 5c94956ef..000000000
--- a/loleaflet/spec/index.html
+++ /dev/null
@@ -1,91 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta charset="utf-8">
- <title>Leaflet Spec Runner</title>
- <link rel="stylesheet" type="text/css" href="../node_modules/mocha/mocha.css">
- <link rel="stylesheet" type="text/css" href="../dist/leaflet.css">
-</head>
-<body>
- <div id="mocha"></div>
- <script src="expect.js"></script>
- <script type="text/javascript" src="../node_modules/mocha/mocha.js"></script>
- <script type="text/javascript" src="../node_modules/happen/happen.js"></script>
- <script type="text/javascript" src="sinon.js"></script>
-
- <!-- source files -->
- <script type="text/javascript" src="../build/deps.js"></script>
-
- <script type="text/javascript" src="../debug/leaflet-include.js"></script>
-
- <script>
- mocha.setup({
- ui: 'bdd',
- ignoreLeaks: true
- });
- </script>
-
- <!-- spec files -->
-
- <script type="text/javascript" src="suites/SpecHelper.js"></script>
-
- <!-- /control -->
- <script type="text/javascript" src="suites/control/ControlSpec.js"></script>
- <script type="text/javascript" src="suites/control/Control.LayersSpec.js"></script>
- <script type="text/javascript" src="suites/control/Control.ScaleSpec.js"></script>
- <script type="text/javascript" src="suites/control/Control.AttributionSpec.js"></script>
-
- <!-- /core -->
- <script type="text/javascript" src="suites/core/UtilSpec.js"></script>
- <script type="text/javascript" src="suites/core/ClassSpec.js"></script>
- <script type="text/javascript" src="suites/core/EventsSpec.js"></script>
-
- <!-- /geometry -->
- <script type="text/javascript" src="suites/geometry/PointSpec.js"></script>
- <script type="text/javascript" src="suites/geometry/BoundsSpec.js"></script>
- <script type="text/javascript" src="suites/geometry/TransformationSpec.js"></script>
- <script type="text/javascript" src="suites/geometry/LineUtilSpec.js"></script>
- <script type="text/javascript" src="suites/geometry/PolyUtilSpec.js"></script>
-
- <!-- /geo -->
- <script type="text/javascript" src="suites/geo/LatLngSpec.js"></script>
- <script type="text/javascript" src="suites/geo/LatLngBoundsSpec.js"></script>
- <script type="text/javascript" src="suites/geo/ProjectionSpec.js"></script>
-
- <!-- /dom -->
- <script type="text/javascript" src="suites/dom/DomEventSpec.js"></script>
- <script type="text/javascript" src="suites/dom/DomUtilSpec.js"></script>
-
- <!-- /layer -->
- <script type="text/javascript" src="suites/layer/FeatureGroupSpec.js"></script>
- <script type="text/javascript" src="suites/layer/GeoJSONSpec.js"></script>
- <script type="text/javascript" src="suites/layer/ImageOverlaySpec.js"></script>
- <script type="text/javascript" src="suites/layer/LayerGroupSpec.js"></script>
- <script type="text/javascript" src="suites/layer/PopupSpec.js"></script>
-
- <!-- /layer/tile -->
- <script type="text/javascript" src="suites/layer/tile/GridLayerSpec.js"></script>
- <script type="text/javascript" src="suites/layer/tile/TileLayerSpec.js"></script>
-
- <!-- /layer/marker/ -->
- <script type="text/javascript" src="suites/layer/marker/MarkerSpec.js"></script>
-
- <!-- /layer/vector/ -->
- <script type="text/javascript" src="suites/layer/vector/CircleSpec.js"></script>
- <script type="text/javascript" src="suites/layer/vector/CircleMarkerSpec.js"></script>
- <script type="text/javascript" src="suites/layer/vector/PathSpec.js"></script>
- <script type="text/javascript" src="suites/layer/vector/PolygonSpec.js"></script>
- <script type="text/javascript" src="suites/layer/vector/PolylineSpec.js"></script>
- <script type="text/javascript" src="suites/layer/vector/PolylineGeometrySpec.js"></script>
-
- <!-- /map -->
- <script type="text/javascript" src="suites/map/MapSpec.js"></script>
-
- <!-- /map/handler -->
- <script type="text/javascript" src="suites/map/handler/Map.DragSpec.js"></script>
-
- <script>
- (window.mochaPhantomJS || window.mocha).run();
- </script>
-</body>
-</html>
diff --git a/loleaflet/spec/karma.conf.js b/loleaflet/spec/karma.conf.js
deleted file mode 100644
index cf2908cd4..000000000
--- a/loleaflet/spec/karma.conf.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- js-indent-level: 8 -*- */
-// Karma configuration
-module.exports = function (config) {
-
- var libSources = require(__dirname+'/../build/build.js').getFiles();
-
- var files = [
- "spec/sinon.js",
- "spec/expect.js"
- ].concat(libSources, [
- "spec/after.js",
- "node_modules/happen/happen.js",
- "spec/suites/SpecHelper.js",
- "spec/suites/**/*.js",
- {pattern: "dist/images/*.png", included: false}
- ]);
-
- config.set({
- // base path, that will be used to resolve files and exclude
- basePath: '../',
-
- plugins: [
- 'karma-mocha',
- 'karma-coverage',
- 'karma-phantomjs-launcher',
- 'karma-chrome-launcher',
- 'karma-safari-launcher',
- 'karma-firefox-launcher'],
-
- // frameworks to use
- frameworks: ['mocha'],
-
- // list of files / patterns to load in the browser
- files: files,
- exclude: [],
-
- // test results reporter to use
- // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
- reporters: ['dots'],
-
- // web server port
- port: 9876,
-
- // level of logging
- // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
- logLevel: config.LOG_WARN,
-
- // enable / disable colors in the output (reporters and logs)
- colors: true,
-
- // enable / disable watching file and executing tests whenever any file changes
- autoWatch: false,
-
- // Start these browsers, currently available:
- // - Chrome
- // - ChromeCanary
- // - Firefox
- // - Opera
- // - Safari (only Mac)
- // - PhantomJS
- // - IE (only Windows)
- browsers: ['PhantomJS'],
-
- // If browser does not capture in given timeout [ms], kill it
- captureTimeout: 5000,
-
- // Continuous Integration mode
- // if true, it capture browsers, run tests and exit
- singleRun: true
- });
-};
diff --git a/loleaflet/spec/loadtest.html b/loleaflet/spec/loadtest.html
deleted file mode 100644
index d92930fd7..000000000
--- a/loleaflet/spec/loadtest.html
+++ /dev/null
@@ -1,60 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta charset="utf-8">
- <title>LOOL Spec Runner</title>
- <link rel="stylesheet" type="text/css" href="../node_modules/mocha/mocha.css">
- <link rel="stylesheet" type="text/css" href="../dist/leaflet.css">
- <link rel="stylesheet" type="text/css" href="../dist/scrollbar/jquery.mCustomScrollbar.css">
- <link rel="stylesheet" type="text/css" href="../dist/contextMenu/jquery.contextMenu.css">
- <link rel="stylesheet" type="text/css" href="../dist/dialog/vex.css" />
- <link rel="stylesheet" type="text/css" href="../dist/dialog/vex-theme-plain.css" />
-</head>
-<body>
- <script>var _ = function (string) {return string.toLocaleString();};</script>
- <script src="expect.js"></script>
- <script type="text/javascript" src="../node_modules/mocha/mocha.js"></script>
- <script type="text/javascript" src="../node_modules/happen/happen.js"></script>
- <script type="text/javascript" src="sinon.js"></script>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
- <script>window.jQuery || document.write('<script src="../dist/scrollbar/jquery-1.11.0.min.js"><\/script>')</script>
- <script src="../dist/scrollbar/jquery.mCustomScrollbar.js"></script>
- <script src="../dist/contextMenu/jquery.contextMenu.js"></script>
- <script src="../dist/contextMenu/jquery.ui.position.min.js"></script>
- <script src="../dist/dialog/vex.combined.min.js"></script>
- <script>vex.defaultOptions.className = 'vex-theme-plain';</script>
-
- <!-- source files -->
- <script type="text/javascript" src="../build/deps.js"></script>
-
- <script type="text/javascript" src="../debug/leaflet-include.js"></script>
-
- <script>
- mocha.setup({
- ui: 'bdd',
- ignoreLeaks: true
- });
- </script>
-
- <!-- spec files -->
- <script type="text/javascript" src="loadtest/LoadTestSpec.js"></script>
-
- <div id="toolbar" style="hidden">
- </div>
- <div id="map-test" style="height:300px; width:100%; position:absolute; top:0; opacity:0.5"></div>
- <div id="mocha" style="top:300px; position:absolute"></div>
-
- <style>
- #mocha-stats {
- top: 300px;
- }
- #mocha-report {
- min-width: 250px;
- }
- </style>
-
- <script>
- (window.mochaPhantomJS || window.mocha).run();
- </script>
-</body>
-</html>
diff --git a/loleaflet/spec/loadtest/LoadTestSpec.js b/loleaflet/spec/loadtest/LoadTestSpec.js
deleted file mode 100644
index 4825186a2..000000000
--- a/loleaflet/spec/loadtest/LoadTestSpec.js
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- js-indent-level: 8 -*- */
-describe('LoadTest', function () {
- // 25 s timeout
- this.timeout(25000);
- // set the slow time to 5ms knowing each test takes more than that,
- // so the run time is always printed
- this.slow(5);
- var testsRan = 0,
- checkTimeOut = null,
- map = null,
- docLayer = null,
- x = 0,
- y = 0;
-
- var docPath = '';
- before(function() {
- var htmlPath = window.location.pathname;
- var dir = htmlPath.substring(0, htmlPath.lastIndexOf('/'));
- docPath = 'file://' + dir + '/data/';
- });
-
- var docs = ['eval.odt', 'eval.odp', 'eval.ods', 'eval.odg'];
-
- docs.forEach(function (testDoc) {
- testsRan += 1;
- describe('Document #' + testsRan + ' (' + testDoc + ')', function () {
-
- afterEach(function () {
- map.off('statusindicator');
- });
-
- after(function () {
- map.remove();
- });
-
- it('Load the document', function (done) {
- map = L.map('map-test', {
- server: 'wss://localhost:9980',
- doc: docPath + testDoc,
- edit: false,
- readOnly: false
- });
-
- map.on('statusindicator', function (e) {
- if (e.statusType === 'alltilesloaded') {
- y = map.getDocSize().y;
- done();
- }
- });
- });
-
- it('Scroll to the middle', function (done) {
- map.on('statusindicator', function (e) {
- if (e.statusType === 'alltilesloaded') {
- clearTimeout(checkTimeOut);
- done();
- }
- });
- map.scrollTop(y / 2);
- checkTimeOut = setTimeout(function () {
- expect(map._docLayer._emptyTilesCount).to.eql(0);
- done();
- }, 6000);
- });
-
- it('Scroll to the bottom', function (done) {
- map.on('statusindicator', function (e) {
- if (e.statusType === 'alltilesloaded') {
- clearTimeout(checkTimeOut);
- done();
- }
- });
- map.scrollTop(y);
- checkTimeOut = setTimeout(function () {
- expect(map._docLayer._emptyTilesCount).to.eql(0);
- done();
- }, 6000);
- });
-
- });
- });
-});
diff --git a/loleaflet/spec/loleaflet.html b/loleaflet/spec/loleaflet.html
deleted file mode 100644
index 131d757f1..000000000
--- a/loleaflet/spec/loleaflet.html
+++ /dev/null
@@ -1,46 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta charset="utf-8">
- <title>LOOL Spec Runner</title>
- <link rel="stylesheet" type="text/css" href="../node_modules/mocha/mocha.css">
- <link rel="stylesheet" type="text/css" href="../dist/leaflet.css">
- <link rel="stylesheet" type="text/css" href="../dist/dialog/vex.css" />
- <link rel="stylesheet" type="text/css" href="../dist/dialog/vex-theme-plain.css" />
-</head>
-<body>
- <div id="mocha"></div>
- <script src="expect.js"></script>
- <script type="text/javascript" src="../node_modules/mocha/mocha.js"></script>
- <script type="text/javascript" src="../node_modules/happen/happen.js"></script>
- <script type="text/javascript" src="sinon.js"></script>
-
- <!-- source files -->
- <script type="text/javascript" src="../build/deps.js"></script>
-
- <script type="text/javascript" src="../debug/leaflet-include.js"></script>
-
- <script>
- mocha.setup({
- ui: 'bdd',
- ignoreLeaks: true
- });
- </script>
-
- <!-- spec files -->
- <script type="text/javascript" src="loleaflet/control/PermissionSpec.js"></script>
- <script type="text/javascript" src="loleaflet/control/PartsSpec.js"></script>
- <script type="text/javascript" src="loleaflet/control/SearchSpec.js"></script>
- <script type="text/javascript" src="loleaflet/control/ToolbarSpec.js"></script>
-
- <div id="toolbar" style="hidden">
- </div>
- <div id="document-container" style="top:0px; height:400px; visibility:hidden">
- <div id="map"></div>
- </div>
-
- <script>
- (window.mochaPhantomJS || window.mocha).run();
- </script>
-</body>
-</html>
diff --git a/loleaflet/spec/loleaflet/control/PartsSpec.js b/loleaflet/spec/loleaflet/control/PartsSpec.js
deleted file mode 100644
index 4a420f658..000000000
--- a/loleaflet/spec/loleaflet/control/PartsSpec.js
+++ /dev/null
@@ -1,153 +0,0 @@
-/* -*- js-indent-level: 8 -*- */
-describe('Parts and Pages', function () {
- this.timeout(10000);
- var map;
-
- before(function () {
- var htmlPath = window.location.pathname;
- var dir = htmlPath.substring(0, htmlPath.lastIndexOf('/'));
- var fileURL = 'file://' + dir + '/data/eval.odt';
- // initialize the map and load the document
- map = L.map('map', {
- server: 'wss://localhost:9980',
- doc: fileURL,
- edit: false,
- readOnly: false
- });
- });
-
- afterEach(function () {
- map.off('statusindicator');
- });
-
- after(function () {
- map.remove();
- });
-
- describe('Load the document', function () {
- it('All tiles loaded', function (done) {
- map.on('statusindicator', function (e) {
- if (e.statusType === 'alltilesloaded') {
- done();
- }
- });
- });
- });
-
- describe('Document preview', function () {
- it('Page preview', function (done) {
- map.once('tilepreview', function (e) {
- expect(e.id).to.be('1');
- expect(e.width).to.be.within(0, 100);
- expect(e.height).to.be.within(0, 200);
- expect(e.part).to.be(0);
- expect(e.docType).to.be('text');
- done();
- });
- map.getPreview(1, 0, 100, 200, {autoUpdate: true});
- });
-
- it('Page custom preview', function (done) {
- map.once('tilepreview', function (e) {
- expect(e.id).to.be('2');
- expect(e.width).to.be(100);
- expect(e.height).to.be(200);
- expect(e.part).to.be(0);
- expect(e.docType).to.be('text');
- done();
- });
- map.getCustomPreview(2, 0, 100, 200, 0, 0, 3840, 7680, {autoUpdate: true});
- });
-
-
- it('Automatic preview invalidation', function (done) {
- var count = 0;
- map.on('tilepreview', function (e) {
- if (e.id === '1' || e.id === '2') {
- count += 1;
- }
- if (count === 2) {
- // as we have 2 previews
- map.off('tilepreview');
- done();
- }
- });
- map._socket.sendMessage('uno .uno:LeftPara');
- });
-
- it('Remove the first preview', function (done) {
- map.once('tilepreview', function (e) {
- expect(e.id).to.be('2');
- map.removePreviewUpdate(2);
- done();
- });
- map.removePreviewUpdate(1);
- map._socket.sendMessage('uno .uno:CenterPara');
- });
- });
-
- describe('Page navigation', function () {
- it('Get current page number', function () {
- expect(map.getCurrentPageNumber()).to.be(0);
- });
-
- it('Go to the second page', function (done) {
- map.once('updatescrolloffset', function (e) {
- expect(e.y).to.be.above(1000);
- done();
- });
- map.goToPage(1);
- });
-
- it('Go to the first page by following the cursor', function (done) {
- map.once('scrollto', function (e) {
- expect(e.y).to.be(0);
- done();
- });
- map.once('updatepermission', function (e) {
- if (e.perm === 'edit') {
- map.goToPage(0);
- }
- });
- map.setPermission('edit');
- });
-
-
- it('Scroll to the first page', function (done) {
- map.once('pagenumberchanged', function (e) {
- expect(e.currentPage).to.be(0);
- expect(e.pages).to.be(2);
- expect(e.docType).to.be('text');
- done();
- });
- map.scrollTop(0);
- });
- });
-
- describe('Doc stats', function () {
- it('Get number of pages', function () {
- expect(map.getNumberOfPages()).to.be(2);
- });
-
- it('Get number of parts', function () {
- expect(map.getNumberOfParts()).to.be(1);
- });
-
- it('Get current page number', function () {
- expect(map.getCurrentPageNumber()).to.be(0);
- });
-
- it('Get current part number', function () {
- expect(map.getCurrentPartNumber()).to.be(0);
- });
-
- it('Get document size', function () {
- expect(Math.floor(map.getDocSize().x)).to.be(1064);
- expect(Math.floor(map.getDocSize().y)).to.be(2946);
- });
-
- it('Get document type', function () {
- expect(map.getDocType()).to.be('text');
- });
- });
-});
diff --git a/loleaflet/spec/loleaflet/control/PermissionSpec.js b/loleaflet/spec/loleaflet/control/PermissionSpec.js
deleted file mode 100644
index df3dc2db8..000000000
--- a/loleaflet/spec/loleaflet/control/PermissionSpec.js
+++ /dev/null
@@ -1,130 +0,0 @@
-/* -*- js-indent-level: 8 -*- */
-describe('Permissions', function () {
- this.timeout(10000);
- var map;
-
- before(function () {
- var htmlPath = window.location.pathname;
- var dir = htmlPath.substring(0, htmlPath.lastIndexOf('/'));
- var fileURL = 'file://' + dir + '/data/eval.odt';
- // initialize the map and load the document
- map = L.map('map', {
- server: 'wss://localhost:9980',
- doc: fileURL,
- edit: false,
- readOnly: false
- });
-
- map.on('scrollto', function (e) {
- map.scrollTop(e.y);
- map.scrollLeft(e.x);
- });
- });
-
- afterEach(function () {
- map.off('statusindicator');
- });
-
- after(function () {
- map.remove();
- });
-
- describe('Load the document', function () {
- it('Initialize the tile layer', function (done) {
- map.on('statusindicator', function (e) {
- if (e.statusType === 'loleafletloaded') {
- done();
- }
- });
- });
- });
-
- describe('ReadOnly', function () {
- it('Set permission to "readonly"', function (done) {
- map.once('updatepermission', function (e) {
- expect(e.perm).to.be('readonly');
- done();
- });
- map.setPermission('readonly');
- });
-
- it('Dragging is enabled', function () {
- expect(map.dragging.enabled()).to.be(true);
- });
-
- it('Selection is disabled', function () {
- expect(map.isSelectionEnabled()).to.be(false);
- });
-
- it('Current permission is "readonly"', function () {
- expect(map.getPermission()).to.be('readonly');
- });
- });
-
- describe('View', function () {
- it('Set permission to "view"', function (done) {
- map.once('updatepermission', function (e) {
- expect(e.perm).to.be('view');
- done();
- });
- map.setPermission('view');
- });
-
- it('Dragging is enabled', function () {
- expect(map.dragging.enabled()).to.be(true);
- });
-
- it('Selection is disabled', function () {
- expect(map.isSelectionEnabled()).to.be(false);
- });
-
- it('Current permission is "view"', function () {
- expect(map.getPermission()).to.be('view');
- });
-
- it('Click to switch to "edit"', function (done) {
- map.once('updatepermission', function (e) {
- expect(e.perm).to.be('edit');
- done();
- });
-
- // simulate a click
- var latlng = map.unproject(new L.Point(1, 1));
- var events = ['mousedown', 'mouseup'];
- for (var i = 0; i < events.length; i++) {
- map.fire(events[i], {
- latlng: latlng,
- layerPoint: map.latLngToLayerPoint(latlng),
- containerPoint: map.latLngToContainerPoint(latlng),
- originalEvent: {button:0}
- });
- }
- });
-
- it('Current permission is "edit"', function () {
- expect(map.getPermission()).to.be('edit');
- });
- });
-
- describe('Edit', function () {
- it('Sets permission to "edit"', function (done) {
- map.once('updatepermission', function (e) {
- expect(e.perm).to.be('edit');
- done();
- });
- map.setPermission('edit');
- });
-
- it('Dragging is disabled', function () {
- expect(map.dragging.enabled()).to.be(false);
- });
-
- it('Selection is enabled', function () {
- expect(map.isSelectionEnabled()).to.be(true);
- });
-
- it('Current permission is "edit"', function () {
- expect(map.getPermission()).to.be('edit');
- });
- });
-});
diff --git a/loleaflet/spec/loleaflet/control/SearchSpec.js b/loleaflet/spec/loleaflet/control/SearchSpec.js
deleted file mode 100644
index 649099fe2..000000000
--- a/loleaflet/spec/loleaflet/control/SearchSpec.js
+++ /dev/null
@@ -1,139 +0,0 @@
-/* -*- js-indent-level: 8 -*- */
-describe('Search', function () {
- this.timeout(10000);
- var map;
-
- before(function (done) {
- var htmlPath = window.location.pathname;
- var dir = htmlPath.substring(0, htmlPath.lastIndexOf('/'));
- var fileURL = 'file://' + dir + '/data/eval.odt';
- // initialize the map and load the document
- map = L.map('map', {
- server: 'wss://localhost:9980',
- doc: fileURL,
- edit: false,
- readOnly: false
- });
- });
-
- afterEach(function () {
- map.off('statusindicator');
- });
-
- after(function () {
- map.remove();
- });
-
- describe('Load the document', function () {
- it('All tiles loaded', function (done) {
- map.on('statusindicator', function (e) {
- if (e.statusType === 'alltilesloaded') {
- done();
- }
- });
- });
- });
-
- describe('Search', function () {
- afterEach(function () {
- map.off('search');
- });
-
- it('Search forward', function (done) {
- map.once('search', function (e) {
- expect(e.originalPhrase).to.be('doc');
- expect(e.count).to.be(1);
- expect(e.results[0].part).to.be(0);
- // the first page contains the search result
- //expect(map.getPageSizes().pixels[0].contains(e.results[0].rectangles[0])).to.be.ok();
- done();
- });
- map.search('doc');
- });
-
- it('Search backward', function (done) {
- map.once('search', function (e) {
- expect(e.originalPhrase).to.be('doc');
- expect(e.count).to.be(1);
- expect(e.results[0].part).to.be(0);
- // the second page contains the search result
- //expect(map.getPageSizes().pixels[1].contains(e.results[0].rectangles[0])).to.be.ok();
- done();
- });
- map.search('doc', true);
- });
-
- it('Search not found', function (done) {
- map.once('search', function (e) {
- expect(e.originalPhrase).to.be('something-not-found');
- expect(e.count).to.be(0);
- expect(e.results).to.be(undefined);
- done();
- });
- map.search('something-not-found', true);
- });
- });
-
- describe('Search with highlight all', function () {
- afterEach(function () {
- map.off('search');
- });
-
- it('Highlight all', function (done) {
- map.once('search', function (e) {
- expect(e.originalPhrase).to.be('doc');
- expect(e.highlightAll).to.be('true');
- expect(e.count).to.be(5);
- expect(e.results.length).to.be(5);
- // first 4 results are in first page
- for (var i = 0; i < e.count - 1; i++) {
- //expect(map.getPageSizes().pixels[0].contains(e.results[i].rectangles[0])).to.be.ok();
- }
- // last result is in second page
- //expect(map.getPageSizes().pixels[1].contains(e.results[e.count - 1].rectangles[0])).to.be.ok();
- done();
- });
- map.highlightAll('doc');
- });
-
- it('Search forward', function (done) {
- map.once('search', function (e) {
- expect(e.originalPhrase).to.be('doc');
- expect(e.count).to.be(1);
- expect(e.results.length).to.be(1);
- // Output of previous highlight all operation is still cached
- expect(map._docLayer._searchResults.length).to.be(5);
- // the first page contains the search result
- //expect(map.getPageSizes().pixels[0].contains(e.results[0].rectangles[0])).to.be.ok();
- done();
- });
- map.search('doc');
- });
-
- it('Search backward', function (done) {
- map.once('search', function (e) {
- expect(e.originalPhrase).to.be('doc');
- expect(e.count).to.be(1);
- expect(e.results.length).to.be(1);
- // Output of previous highlight all operation is still cached
- expect(map._docLayer._searchResults.length).to.be(5);
- // the second page contains the search result
- //expect(map.getPageSizes().pixels[1].contains(e.results[0].rectangles[0])).to.be.ok();
- done();
- });
- map.search('doc', true);
- });
-
- it('Search not found', function (done) {
- map.once('search', function (e) {
- expect(e.originalPhrase).to.be('something-not-found');
- expect(e.count).to.be(0);
- expect(e.results).to.be(undefined);
- // All cached search results from previous highlight all operations are cleared
- expect(map._docLayer._searchResults).to.be(null);
- done();
- });
- map.search('something-not-found');
- });
- });
-});
diff --git a/loleaflet/spec/loleaflet/control/ToolbarSpec.js b/loleaflet/spec/loleaflet/control/ToolbarSpec.js
deleted file mode 100644
index 350598129..000000000
--- a/loleaflet/spec/loleaflet/control/ToolbarSpec.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- js-indent-level: 8 -*- */
-describe('Toolbar', function () {
- this.timeout(10000);
- var map;
- var url;
-
- before(function () {
- var htmlPath = window.location.pathname;
- var dir = htmlPath.substring(0, htmlPath.lastIndexOf('/'));
- var fileURL = 'file://' + dir + '/data/eval.odt';
- // initialize the map and load the document
- map = L.map('map', {
- server: 'wss://localhost:9980',
- doc: fileURL,
- edit: false,
- readOnly: false,
- print: false
- });
- });
-
- afterEach(function () {
- map.off('statusindicator');
- });
-
- after(function () {
- map.remove();
- });
-
- describe('Load the document', function () {
- it('Loleaflet initialized', function (done) {
- map.on('statusindicator', function (e) {
- if (e.statusType === 'loleafletloaded') {
- done();
- }
- });
- });
- });
-
- describe('Download as', function () {
- it('Request pdf export url', function (done) {
- map.once('print', function (e) {
- console.log(e.url);
- url = e.url;
- console.log(url);
- done();
- });
- map.downloadAs('test.pdf', 'pdf', null, 'print');
- });
-
- it('Download the pdf export', function (done) {
- var xmlHttp = new XMLHttpRequest();
- xmlHttp.onreadystatechange = function () {
- if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
- done();
- }
- };
- xmlHttp.open('GET', url, true);
- xmlHttp.responseType = 'blob';
- xmlHttp.send();
- });
- });
-});
diff --git a/loleaflet/spec/runLoadTest.sh b/loleaflet/spec/runLoadTest.sh
deleted file mode 100755
index bb35673c6..000000000
--- a/loleaflet/spec/runLoadTest.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-google-chrome loadtest.html &
-sleep 0.2
-google-chrome loadtest.html &
-sleep 0.2
-google-chrome loadtest.html &
-sleep 0.2
-google-chrome loadtest.html &
-sleep 0.2
-google-chrome loadtest.html &
-sleep 0.2
-google-chrome loadtest.html &
-sleep 0.2
-google-chrome loadtest.html &
-sleep 0.2
-google-chrome loadtest.html &
-sleep 0.2
-google-chrome loadtest.html &
-sleep 0.2
-google-chrome loadtest.html &
-sleep 0.2
diff --git a/loleaflet/spec/sinon.js b/loleaflet/spec/sinon.js
deleted file mode 100644
index 3fc613905..000000000
--- a/loleaflet/spec/sinon.js
+++ /dev/null
@@ -1,4224 +0,0 @@
-/* -*- js-indent-level: 8 -*- */
-/**
- * Sinon.JS 1.6.0, 2013/02/18
- *
- * @author Christian Johansen (christian at cjohansen.no)
- * @author Contributors: https://github.com/cjohansen/Sinon.JS/blob/master/AUTHORS
- *
- * (The BSD License)
- *
- * Copyright (c) 2010-2013, Christian Johansen, christian at cjohansen.no
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of Christian Johansen nor the names of his contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-var sinon = (function () {
-"use strict";
-
-var buster = (function (setTimeout, B) {
- var isNode = typeof require == "function" && typeof module == "object";
- var div = typeof document != "undefined" && document.createElement("div");
- var F = function () {};
-
- var buster = {
- bind: function bind(obj, methOrProp) {
- var method = typeof methOrProp == "string" ? obj[methOrProp] : methOrProp;
- var args = Array.prototype.slice.call(arguments, 2);
- return function () {
- var allArgs = args.concat(Array.prototype.slice.call(arguments));
- return method.apply(obj, allArgs);
- };
- },
-
- partial: function partial(fn) {
- var args = [].slice.call(arguments, 1);
- return function () {
- return fn.apply(this, args.concat([].slice.call(arguments)));
- };
- },
-
- create: function create(object) {
- F.prototype = object;
- return new F();
- },
-
- extend: function extend(target) {
- if (!target) { return; }
- for (var i = 1, l = arguments.length, prop; i < l; ++i) {
- for (prop in arguments[i]) {
- target[prop] = arguments[i][prop];
- }
- }
- return target;
- },
-
- nextTick: function nextTick(callback) {
- if (typeof process != "undefined" && process.nextTick) {
- return process.nextTick(callback);
- }
- setTimeout(callback, 0);
- },
-
- functionName: function functionName(func) {
- if (!func) return "";
- if (func.displayName) return func.displayName;
- if (func.name) return func.name;
- var matches = func.toString().match(/function\s+([^\(]+)/m);
- return matches && matches[1] || "";
- },
-
- isNode: function isNode(obj) {
- if (!div) return false;
- try {
- obj.appendChild(div);
- obj.removeChild(div);
- } catch (e) {
- return false;
- }
- return true;
- },
-
- isElement: function isElement(obj) {
- return obj && obj.nodeType === 1 && buster.isNode(obj);
- },
-
- isArray: function isArray(arr) {
- return Object.prototype.toString.call(arr) == "[object Array]";
- },
-
- flatten: function flatten(arr) {
- var result = [], arr = arr || [];
- for (var i = 0, l = arr.length; i < l; ++i) {
- result = result.concat(buster.isArray(arr[i]) ? flatten(arr[i]) : arr[i]);
- }
- return result;
- },
-
- each: function each(arr, callback) {
- for (var i = 0, l = arr.length; i < l; ++i) {
- callback(arr[i]);
- }
- },
-
- map: function map(arr, callback) {
- var results = [];
- for (var i = 0, l = arr.length; i < l; ++i) {
- results.push(callback(arr[i]));
- }
- return results;
- },
-
- parallel: function parallel(fns, callback) {
- function cb(err, res) {
- if (typeof callback == "function") {
- callback(err, res);
- callback = null;
- }
- }
- if (fns.length == 0) { return cb(null, []); }
- var remaining = fns.length, results = [];
- function makeDone(num) {
- return function done(err, result) {
- if (err) { return cb(err); }
- results[num] = result;
- if (--remaining == 0) { cb(null, results); }
- };
- }
- for (var i = 0, l = fns.length; i < l; ++i) {
- fns[i](makeDone(i));
- }
- },
-
- series: function series(fns, callback) {
- function cb(err, res) {
- if (typeof callback == "function") {
- callback(err, res);
- }
- }
- var remaining = fns.slice();
- var results = [];
- function callNext() {
- if (remaining.length == 0) return cb(null, results);
- var promise = remaining.shift()(next);
- if (promise && typeof promise.then == "function") {
- promise.then(buster.partial(next, null), next);
- }
- }
- function next(err, result) {
- if (err) return cb(err);
- results.push(result);
- callNext();
- }
- callNext();
- },
-
- countdown: function countdown(num, done) {
- return function () {
- if (--num == 0) done();
- };
- }
- };
-
- if (typeof process === "object" &&
- typeof require === "function" && typeof module === "object") {
- var crypto = require("crypto");
- var path = require("path");
-
- buster.tmpFile = function (fileName) {
- var hashed = crypto.createHash("sha1");
- hashed.update(fileName);
- var tmpfileName = hashed.digest("hex");
-
- if (process.platform == "win32") {
- return path.join(process.env["TEMP"], tmpfileName);
- } else {
- return path.join("/tmp", tmpfileName);
- }
- };
- }
-
- if (Array.prototype.some) {
- buster.some = function (arr, fn, thisp) {
- return arr.some(fn, thisp);
- };
- } else {
- // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some
- buster.some = function (arr, fun, thisp) {
- if (arr == null) { throw new TypeError(); }
- arr = Object(arr);
- var len = arr.length >>> 0;
- if (typeof fun !== "function") { throw new TypeError(); }
-
- for (var i = 0; i < len; i++) {
- if (arr.hasOwnProperty(i) && fun.call(thisp, arr[i], i, arr)) {
- return true;
- }
- }
-
- return false;
- };
- }
-
- if (Array.prototype.filter) {
- buster.filter = function (arr, fn, thisp) {
- return arr.filter(fn, thisp);
- };
- } else {
- // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/filter
- buster.filter = function (fn, thisp) {
- if (this == null) { throw new TypeError(); }
-
- var t = Object(this);
- var len = t.length >>> 0;
- if (typeof fn != "function") { throw new TypeError(); }
-
- var res = [];
- for (var i = 0; i < len; i++) {
- if (i in t) {
- var val = t[i]; // in case fun mutates this
- if (fn.call(thisp, val, i, t)) { res.push(val); }
- }
- }
-
- return res;
- };
- }
-
- if (isNode) {
- module.exports = buster;
- buster.eventEmitter = require("./buster-event-emitter");
- Object.defineProperty(buster, "defineVersionGetter", {
- get: function () {
- return require("./define-version-getter");
- }
- });
- }
-
- return buster.extend(B || {}, buster);
-}(setTimeout, buster));
-if (typeof buster === "undefined") {
- var buster = {};
-}
-
-if (typeof module === "object" && typeof require === "function") {
- buster = require("buster-core");
-}
-
-buster.format = buster.format || {};
-buster.format.excludeConstructors = ["Object", /^.$/];
-buster.format.quoteStrings = true;
-
-buster.format.ascii = (function () {
-
- var hasOwn = Object.prototype.hasOwnProperty;
-
- var specialObjects = [];
- if (typeof global != "undefined") {
- specialObjects.push({ obj: global, value: "[object global]" });
- }
- if (typeof document != "undefined") {
- specialObjects.push({ obj: document, value: "[object HTMLDocument]" });
- }
- if (typeof window != "undefined") {
- specialObjects.push({ obj: window, value: "[object Window]" });
- }
-
- function keys(object) {
- var k = Object.keys && Object.keys(object) || [];
-
- if (k.length == 0) {
- for (var prop in object) {
- if (hasOwn.call(object, prop)) {
- k.push(prop);
- }
- }
- }
-
- return k.sort();
- }
-
- function isCircular(object, objects) {
- if (typeof object != "object") {
- return false;
- }
-
- for (var i = 0, l = objects.length; i < l; ++i) {
- if (objects[i] === object) {
- return true;
- }
- }
-
- return false;
- }
-
- function ascii(object, processed, indent) {
- if (typeof object == "string") {
- var quote = typeof this.quoteStrings != "boolean" || this.quoteStrings;
- return processed || quote ? '"' + object + '"' : object;
- }
-
- if (typeof object == "function" && !(object instanceof RegExp)) {
- return ascii.func(object);
- }
-
- processed = processed || [];
-
- if (isCircular(object, processed)) {
- return "[Circular]";
- }
-
- if (Object.prototype.toString.call(object) == "[object Array]") {
- return ascii.array.call(this, object, processed);
- }
-
- if (!object) {
- return "" + object;
- }
-
- if (buster.isElement(object)) {
- return ascii.element(object);
- }
-
- if (typeof object.toString == "function" &&
- object.toString !== Object.prototype.toString) {
- return object.toString();
- }
-
- for (var i = 0, l = specialObjects.length; i < l; i++) {
- if (object === specialObjects[i].obj) {
- return specialObjects[i].value;
- }
- }
-
- return ascii.object.call(this, object, processed, indent);
- }
-
- ascii.func = function (func) {
- return "function " + buster.functionName(func) + "() {}";
- };
-
- ascii.array = function (array, processed) {
- processed = processed || [];
- processed.push(array);
- var pieces = [];
-
- for (var i = 0, l = array.length; i < l; ++i) {
- pieces.push(ascii.call(this, array[i], processed));
- }
-
- return "[" + pieces.join(", ") + "]";
- };
-
- ascii.object = function (object, processed, indent) {
- processed = processed || [];
- processed.push(object);
- indent = indent || 0;
- var pieces = [], properties = keys(object), prop, str, obj;
- var is = "";
- var length = 3;
-
- for (var i = 0, l = indent; i < l; ++i) {
- is += " ";
- }
-
- for (i = 0, l = properties.length; i < l; ++i) {
- prop = properties[i];
- obj = object[prop];
-
- if (isCircular(obj, processed)) {
- str = "[Circular]";
- } else {
- str = ascii.call(this, obj, processed, indent + 2);
- }
-
- str = (/\s/.test(prop) ? '"' + prop + '"' : prop) + ": " + str;
- length += str.length;
- pieces.push(str);
- }
-
- var cons = ascii.constructorName.call(this, object);
- var prefix = cons ? "[" + cons + "] " : ""
-
- return (length + indent) > 80 ?
- prefix + "{\n " + is + pieces.join(",\n " + is) + "\n" + is + "}" :
- prefix + "{ " + pieces.join(", ") + " }";
- };
-
- ascii.element = function (element) {
- var tagName = element.tagName.toLowerCase();
- var attrs = element.attributes, attribute, pairs = [], attrName;
-
- for (var i = 0, l = attrs.length; i < l; ++i) {
- attribute = attrs.item(i);
- attrName = attribute.nodeName.toLowerCase().replace("html:", "");
-
- if (attrName == "contenteditable" && attribute.nodeValue == "inherit") {
- continue;
- }
-
- if (!!attribute.nodeValue) {
- pairs.push(attrName + "=\"" + attribute.nodeValue + "\"");
- }
- }
-
- var formatted = "<" + tagName + (pairs.length > 0 ? " " : "");
- var content = element.innerHTML;
-
- if (content.length > 20) {
- content = content.substr(0, 20) + "[...]";
- }
-
- var res = formatted + pairs.join(" ") + ">" + content + "</" + tagName + ">";
-
- return res.replace(/ contentEditable="inherit"/, "");
- };
-
- ascii.constructorName = function (object) {
- var name = buster.functionName(object && object.constructor);
- var excludes = this.excludeConstructors || buster.format.excludeConstructors || [];
-
- for (var i = 0, l = excludes.length; i < l; ++i) {
- if (typeof excludes[i] == "string" && excludes[i] == name) {
- return "";
- } else if (excludes[i].test && excludes[i].test(name)) {
- return "";
- }
- }
-
- return name;
- };
-
- return ascii;
-}());
-
-if (typeof module != "undefined") {
- module.exports = buster.format;
-}
-/*jslint eqeqeq: false, onevar: false, forin: true, nomen: false, regexp: false, plusplus: false*/
-/*global module, require, __dirname, document*/
-/**
- * Sinon core utilities. For internal use only.
- *
- * @author Christian Johansen (christian at cjohansen.no)
- * @license BSD
- *
- * Copyright (c) 2010-2013 Christian Johansen
- */
-
-var sinon = (function (buster) {
- var div = typeof document != "undefined" && document.createElement("div");
- var hasOwn = Object.prototype.hasOwnProperty;
-
- function isDOMNode(obj) {
- var success = false;
-
- try {
- obj.appendChild(div);
- success = div.parentNode == obj;
- } catch (e) {
- return false;
- } finally {
- try {
- obj.removeChild(div);
- } catch (e) {
- // Remove failed, not much we can do about that
- }
- }
-
- return success;
- }
-
- function isElement(obj) {
- return div && obj && obj.nodeType === 1 && isDOMNode(obj);
- }
-
- function isFunction(obj) {
- return typeof obj === "function" || !!(obj && obj.constructor && obj.call && obj.apply);
- }
-
- function mirrorProperties(target, source) {
- for (var prop in source) {
- if (!hasOwn.call(target, prop)) {
- target[prop] = source[prop];
- }
- }
- }
-
- var sinon = {
- wrapMethod: function wrapMethod(object, property, method) {
- if (!object) {
- throw new TypeError("Should wrap property of object");
- }
-
- if (typeof method != "function") {
- throw new TypeError("Method wrapper should be function");
- }
-
- var wrappedMethod = object[property];
-
- if (!isFunction(wrappedMethod)) {
- throw new TypeError("Attempted to wrap " + (typeof wrappedMethod) + " property " +
- property + " as function");
- }
-
- if (wrappedMethod.restore && wrappedMethod.restore.sinon) {
- throw new TypeError("Attempted to wrap " + property + " which is already wrapped");
- }
-
- if (wrappedMethod.calledBefore) {
- var verb = !!wrappedMethod.returns ? "stubbed" : "spied on";
- throw new TypeError("Attempted to wrap " + property + " which is already " + verb);
- }
-
- // IE 8 does not support hasOwnProperty on the window object.
- var owned = hasOwn.call(object, property);
- object[property] = method;
- method.displayName = property;
-
- method.restore = function () {
- // For prototype properties try to reset by delete first.
- // If this fails (ex: localStorage on mobile safari) then force a reset
- // via direct assignment.
- if (!owned) {
- delete object[property];
- }
- if (object[property] === method) {
- object[property] = wrappedMethod;
- }
- };
-
- method.restore.sinon = true;
- mirrorProperties(method, wrappedMethod);
-
- return method;
- },
-
- extend: function extend(target) {
- for (var i = 1, l = arguments.length; i < l; i += 1) {
- for (var prop in arguments[i]) {
- if (arguments[i].hasOwnProperty(prop)) {
- target[prop] = arguments[i][prop];
- }
-
- // DONT ENUM bug, only care about toString
- if (arguments[i].hasOwnProperty("toString") &&
- arguments[i].toString != target.toString) {
- target.toString = arguments[i].toString;
- }
- }
- }
-
- return target;
- },
-
- create: function create(proto) {
- var F = function () {};
- F.prototype = proto;
- return new F();
- },
-
- deepEqual: function deepEqual(a, b) {
- if (sinon.match && sinon.match.isMatcher(a)) {
- return a.test(b);
- }
- if (typeof a != "object" || typeof b != "object") {
- return a === b;
- }
-
- if (isElement(a) || isElement(b)) {
- return a === b;
- }
-
- if (a === b) {
- return true;
- }
-
- if ((a === null && b !== null) || (a !== null && b === null)) {
- return false;
- }
-
- var aString = Object.prototype.toString.call(a);
- if (aString != Object.prototype.toString.call(b)) {
- return false;
- }
-
- if (aString == "[object Array]") {
- if (a.length !== b.length) {
- return false;
- }
-
- for (var i = 0, l = a.length; i < l; i += 1) {
- if (!deepEqual(a[i], b[i])) {
- return false;
- }
- }
-
- return true;
- }
-
- var prop, aLength = 0, bLength = 0;
-
- for (prop in a) {
- aLength += 1;
-
- if (!deepEqual(a[prop], b[prop])) {
- return false;
- }
- }
-
- for (prop in b) {
- bLength += 1;
- }
-
- if (aLength != bLength) {
- return false;
- }
-
- return true;
- },
-
- functionName: function functionName(func) {
- var name = func.displayName || func.name;
-
- // Use function decomposition as a last resort to get function
- // name. Does not rely on function decomposition to work - if it
- // doesn't debugging will be slightly less informative
- // (i.e. toString will say 'spy' rather than 'myFunc').
- if (!name) {
- var matches = func.toString().match(/function ([^\s\(]+)/);
- name = matches && matches[1];
- }
-
- return name;
- },
-
- functionToString: function toString() {
- if (this.getCall && this.callCount) {
- var thisValue, prop, i = this.callCount;
-
- while (i--) {
- thisValue = this.getCall(i).thisValue;
-
- for (prop in thisValue) {
- if (thisValue[prop] === this) {
- return prop;
- }
- }
- }
- }
-
- return this.displayName || "sinon fake";
- },
-
- getConfig: function (custom) {
- var config = {};
- custom = custom || {};
- var defaults = sinon.defaultConfig;
-
- for (var prop in defaults) {
- if (defaults.hasOwnProperty(prop)) {
- config[prop] = custom.hasOwnProperty(prop) ? custom[prop] : defaults[prop];
- }
- }
-
- return config;
- },
-
- format: function (val) {
- return "" + val;
- },
-
- defaultConfig: {
- injectIntoThis: true,
- injectInto: null,
- properties: ["spy", "stub", "mock", "clock", "server", "requests"],
- useFakeTimers: true,
- useFakeServer: true
- },
-
- timesInWords: function timesInWords(count) {
- return count == 1 && "once" ||
- count == 2 && "twice" ||
- count == 3 && "thrice" ||
- (count || 0) + " times";
- },
-
- calledInOrder: function (spies) {
- for (var i = 1, l = spies.length; i < l; i++) {
- if (!spies[i - 1].calledBefore(spies[i]) || !spies[i].called) {
- return false;
- }
- }
-
- return true;
- },
-
- orderByFirstCall: function (spies) {
- return spies.sort(function (a, b) {
- // uuid, won't ever be equal
- var aCall = a.getCall(0);
- var bCall = b.getCall(0);
- var aId = aCall && aCall.callId || -1;
- var bId = bCall && bCall.callId || -1;
-
- return aId < bId ? -1 : 1;
- });
- },
-
- log: function () {},
-
- logError: function (label, err) {
- var msg = label + " threw exception: "
- sinon.log(msg + "[" + err.name + "] " + err.message);
- if (err.stack) { sinon.log(err.stack); }
-
- setTimeout(function () {
- err.message = msg + err.message;
- throw err;
- }, 0);
- },
-
- typeOf: function (value) {
- if (value === null) {
- return "null";
- }
- else if (value === undefined) {
- return "undefined";
- }
- var string = Object.prototype.toString.call(value);
- return string.substring(8, string.length - 1).toLowerCase();
- },
-
- createStubInstance: function (constructor) {
- if (typeof constructor !== "function") {
- throw new TypeError("The constructor should be a function.");
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list