Its not clear that we will be able to leverage the Float64Array. It may also be that the overhead of constructing these small arrays negates any benefit of faster access. And for all coordinate arrays, we'll need arrays that grow/shrink.
52 lines
1.2 KiB
JavaScript
52 lines
1.2 KiB
JavaScript
goog.provide('ol.test.geom.LinearRing');
|
|
|
|
describe('ol.geom.LinearRing', function() {
|
|
|
|
describe('constructor', function() {
|
|
|
|
it('creates a ring from an array', function() {
|
|
var ring = new ol.geom.LinearRing([[10, 20], [30, 40]]);
|
|
expect(ring).toBeA(ol.geom.LinearRing);
|
|
});
|
|
|
|
it('throws when given mismatched dimension', function() {
|
|
expect(function() {
|
|
var ring = new ol.geom.LinearRing([[10, 20], [30, 40, 50]]);
|
|
}).toThrow();
|
|
});
|
|
|
|
});
|
|
|
|
describe('#coordinates', function() {
|
|
|
|
it('is an array', function() {
|
|
var ring = new ol.geom.LinearRing([[10, 20], [30, 40]]);
|
|
|
|
expect(ring.coordinates.length).toBe(4);
|
|
expect(ring.coordinates[0]).toBe(10);
|
|
expect(ring.coordinates[1]).toBe(20);
|
|
expect(ring.coordinates[2]).toBe(30);
|
|
expect(ring.coordinates[3]).toBe(40);
|
|
});
|
|
|
|
});
|
|
|
|
describe('#dimension', function() {
|
|
|
|
it('can be 2', function() {
|
|
var ring = new ol.geom.LinearRing([[10, 20], [30, 40]]);
|
|
expect(ring.dimension).toBe(2);
|
|
});
|
|
|
|
it('can be 3', function() {
|
|
var ring = new ol.geom.LinearRing([[10, 20, 30], [40, 50, 60]]);
|
|
expect(ring.dimension).toBe(3);
|
|
});
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
goog.require('ol.geom.LinearRing');
|