Merge pull request #5429 from probins/testenums

Remove enums from tests
This commit is contained in:
Andreas Hocevar
2016-07-15 09:12:58 +02:00
committed by GitHub
41 changed files with 379 additions and 435 deletions

View File

@@ -63,7 +63,7 @@ describe('ol.control.ZoomSlider', function() {
control.setMap(map);
control.initSlider_();
var horizontal = ol.control.ZoomSlider.direction.HORIZONTAL;
var horizontal = 1;
expect(control.direction_).to.be(horizontal);
control.dispose();
@@ -76,7 +76,7 @@ describe('ol.control.ZoomSlider', function() {
control.setMap(map);
var vertical = ol.control.ZoomSlider.direction.VERTICAL;
var vertical = 0;
expect(control.direction_).to.be(vertical);
control.dispose();
@@ -109,7 +109,7 @@ describe('ol.control.ZoomSlider', function() {
control.element.firstChild.style.height = '10px';
map.renderSync();
var dragger = control.dragger_;
var event = new ol.pointer.PointerEvent(ol.pointer.EventType.POINTERDOWN, {
var event = new ol.pointer.PointerEvent('pointerdown', {
target: control.element.firstElementChild
});
event.clientX = control.widthLimit_;
@@ -118,16 +118,16 @@ describe('ol.control.ZoomSlider', function() {
expect(control.currentResolution_).to.be(16);
expect(control.dragging_).to.be(true);
expect(control.dragListenerKeys_.length).to.be(6);
event.type = ol.pointer.EventType.POINTERMOVE;
event.type = 'pointermove';
event.clientX = 6 * control.widthLimit_ / 8;
event.clientY = 0;
dragger.dispatchEvent(event);
expect(control.currentResolution_).to.be(4);
event.type = ol.pointer.EventType.POINTERMOVE;
event.type = 'pointermove';
event.clientX = 4 * control.widthLimit_ / 8;
event.clientY = 0;
dragger.dispatchEvent(event);
event.type = ol.pointer.EventType.POINTERUP;
event.type = 'pointerup';
dragger.dispatchEvent(event);
expect(control.currentResolution_).to.be(1);
expect(control.dragListenerKeys_.length).to.be(0);
@@ -143,7 +143,7 @@ describe('ol.control.ZoomSlider', function() {
map.getView().setZoom(8);
map.renderSync();
var dragger = control.dragger_;
var event = new ol.pointer.PointerEvent(ol.pointer.EventType.POINTERDOWN, {
var event = new ol.pointer.PointerEvent('pointerdown', {
target: control.element.firstElementChild
});
event.clientX = 0;
@@ -152,16 +152,16 @@ describe('ol.control.ZoomSlider', function() {
expect(control.currentResolution_).to.be(0.0625);
expect(control.dragging_).to.be(true);
expect(control.dragListenerKeys_.length).to.be(6);
event.type = ol.pointer.EventType.POINTERMOVE;
event.type = 'pointermove';
event.clientX = 0;
event.clientY = 2 * control.heightLimit_ / 8;
dragger.dispatchEvent(event);
expect(control.currentResolution_).to.be(0.25);
event.type = ol.pointer.EventType.POINTERMOVE;
event.type = 'pointermove';
event.clientX = 0;
event.clientY = 4 * control.heightLimit_ / 8;
dragger.dispatchEvent(event);
event.type = ol.pointer.EventType.POINTERUP;
event.type = 'pointerup';
dragger.dispatchEvent(event);
expect(control.currentResolution_).to.be(1);
expect(control.dragListenerKeys_.length).to.be(0);

View File

@@ -352,11 +352,11 @@ describe('ol.extent', function() {
describe('coordinateRelationship()', function() {
var extent = [-180, -90, 180, 90];
var INTERSECTING = ol.extent.Relationship.INTERSECTING;
var ABOVE = ol.extent.Relationship.ABOVE;
var RIGHT = ol.extent.Relationship.RIGHT;
var BELOW = ol.extent.Relationship.BELOW;
var LEFT = ol.extent.Relationship.LEFT;
var INTERSECTING = 1;
var ABOVE = 2;
var RIGHT = 4;
var BELOW = 8;
var LEFT = 16;
it('returns intersecting for within', function() {
var rel = ol.extent.coordinateRelationship(extent, [0, 0]);
@@ -448,22 +448,22 @@ describe('ol.extent', function() {
var extent = [1, 2, 3, 4];
it('gets the bottom left', function() {
var corner = ol.extent.Corner.BOTTOM_LEFT;
var corner = 'bottom-left';
expect(ol.extent.getCorner(extent, corner)).to.eql([1, 2]);
});
it('gets the bottom right', function() {
var corner = ol.extent.Corner.BOTTOM_RIGHT;
var corner = 'bottom-right';
expect(ol.extent.getCorner(extent, corner)).to.eql([3, 2]);
});
it('gets the top left', function() {
var corner = ol.extent.Corner.TOP_LEFT;
var corner = 'top-left';
expect(ol.extent.getCorner(extent, corner)).to.eql([1, 4]);
});
it('gets the top right', function() {
var corner = ol.extent.Corner.TOP_RIGHT;
var corner = 'top-right';
expect(ol.extent.getCorner(extent, corner)).to.eql([3, 4]);
});
@@ -865,6 +865,4 @@ describe('ol.extent', function() {
goog.require('ol.extent');
goog.require('ol.extent.Corner');
goog.require('ol.extent.Relationship');
goog.require('ol.proj');

View File

@@ -17,7 +17,7 @@ describe('ol.featureloader', function() {
it('adds features to the source', function(done) {
loader = ol.featureloader.xhr(url, format);
source.on(ol.source.VectorEventType.ADDFEATURE, function(e) {
source.on('addfeature', function(e) {
expect(source.getFeatures().length).to.be.greaterThan(0);
done();
});
@@ -31,7 +31,7 @@ describe('ol.featureloader', function() {
};
loader = ol.featureloader.xhr(url, format);
source.on(ol.source.VectorEventType.ADDFEATURE, function(e) {
source.on('addfeature', function(e) {
expect(source.getFeatures().length).to.be.greaterThan(0);
done();
});
@@ -100,4 +100,3 @@ goog.require('ol.format.GeoJSON');
goog.require('ol.format.MVT');
goog.require('ol.proj');
goog.require('ol.source.Vector');
goog.require('ol.source.VectorEventType');

View File

@@ -328,7 +328,7 @@ describe('ol.format.EsriJSON', function() {
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.Point);
expect(obj.getCoordinates()).to.eql([10, 20]);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XY);
expect(obj.getLayout()).to.eql('XY');
});
it('parses XYZ point', function() {
@@ -341,7 +341,7 @@ describe('ol.format.EsriJSON', function() {
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.Point);
expect(obj.getCoordinates()).to.eql([10, 20, 10]);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XYZ);
expect(obj.getLayout()).to.eql('XYZ');
});
it('parses XYM point', function() {
@@ -354,7 +354,7 @@ describe('ol.format.EsriJSON', function() {
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.Point);
expect(obj.getCoordinates()).to.eql([10, 20, 10]);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XYM);
expect(obj.getLayout()).to.eql('XYM');
});
it('parses XYZM point', function() {
@@ -368,7 +368,7 @@ describe('ol.format.EsriJSON', function() {
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.Point);
expect(obj.getCoordinates()).to.eql([10, 20, 0, 10]);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XYZM);
expect(obj.getLayout()).to.eql('XYZM');
});
it('parses multipoint', function() {
@@ -379,7 +379,7 @@ describe('ol.format.EsriJSON', function() {
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.MultiPoint);
expect(obj.getCoordinates()).to.eql([[10, 20], [20, 30]]);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XY);
expect(obj.getLayout()).to.eql('XY');
});
it('parses XYZ multipoint', function() {
@@ -391,7 +391,7 @@ describe('ol.format.EsriJSON', function() {
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.MultiPoint);
expect(obj.getCoordinates()).to.eql([[10, 20, 0], [20, 30, 0]]);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XYZ);
expect(obj.getLayout()).to.eql('XYZ');
});
it('parses XYM multipoint', function() {
@@ -403,7 +403,7 @@ describe('ol.format.EsriJSON', function() {
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.MultiPoint);
expect(obj.getCoordinates()).to.eql([[10, 20, 0], [20, 30, 0]]);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XYM);
expect(obj.getLayout()).to.eql('XYM');
});
it('parses XYZM multipoint', function() {
@@ -416,7 +416,7 @@ describe('ol.format.EsriJSON', function() {
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.MultiPoint);
expect(obj.getCoordinates()).to.eql([[10, 20, 0, 1], [20, 30, 0, 1]]);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XYZM);
expect(obj.getLayout()).to.eql('XYZM');
});
it('parses linestring', function() {
@@ -427,7 +427,7 @@ describe('ol.format.EsriJSON', function() {
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.LineString);
expect(obj.getCoordinates()).to.eql([[10, 20], [30, 40]]);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XY);
expect(obj.getLayout()).to.eql('XY');
});
it('parses XYZ linestring', function() {
@@ -438,7 +438,7 @@ describe('ol.format.EsriJSON', function() {
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.LineString);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XYZ);
expect(obj.getLayout()).to.eql('XYZ');
expect(obj.getCoordinates()).to.eql([[10, 20, 1534], [30, 40, 1420]]);
});
@@ -450,7 +450,7 @@ describe('ol.format.EsriJSON', function() {
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.LineString);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XYM);
expect(obj.getLayout()).to.eql('XYM');
expect(obj.getCoordinates()).to.eql([[10, 20, 1534], [30, 40, 1420]]);
});
@@ -463,7 +463,7 @@ describe('ol.format.EsriJSON', function() {
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.LineString);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XYZM);
expect(obj.getLayout()).to.eql('XYZM');
expect(obj.getCoordinates()).to.eql([[10, 20, 1534, 1],
[30, 40, 1420, 2]]);
});
@@ -482,7 +482,7 @@ describe('ol.format.EsriJSON', function() {
[[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]],
[[105.0, 3.0], [106.0, 4.0], [107.0, 3.0], [108.0, 4.0]]
]);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XY);
expect(obj.getLayout()).to.eql('XY');
});
it('parses XYZ multilinestring', function() {
@@ -500,7 +500,7 @@ describe('ol.format.EsriJSON', function() {
[[102.0, 0.0, 1], [103.0, 1.0, 1], [104.0, 0.0, 1], [105.0, 1.0, 1]],
[[105.0, 3.0, 1], [106.0, 4.0, 1], [107.0, 3.0, 1], [108.0, 4.0, 1]]
]);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XYZ);
expect(obj.getLayout()).to.eql('XYZ');
});
it('parses XYM multilinestring', function() {
@@ -518,7 +518,7 @@ describe('ol.format.EsriJSON', function() {
[[102.0, 0.0, 1], [103.0, 1.0, 1], [104.0, 0.0, 1], [105.0, 1.0, 1]],
[[105.0, 3.0, 1], [106.0, 4.0, 1], [107.0, 3.0, 1], [108.0, 4.0, 1]]
]);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XYM);
expect(obj.getLayout()).to.eql('XYM');
});
it('parses XYZM multilinestring', function() {
@@ -537,7 +537,7 @@ describe('ol.format.EsriJSON', function() {
[[102, 0, 1, 2], [103, 1, 1, 2], [104, 0, 1, 2], [105, 1, 1, 2]],
[[105, 3, 1, 2], [106, 4, 1, 2], [107, 3, 1, 2], [108, 4, 1, 2]]
]);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XYZM);
expect(obj.getLayout()).to.eql('XYZM');
});
it('parses polygon', function() {
@@ -549,7 +549,7 @@ describe('ol.format.EsriJSON', function() {
});
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.Polygon);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XY);
expect(obj.getLayout()).to.eql('XY');
var rings = obj.getLinearRings();
expect(rings.length).to.be(3);
expect(rings[0].getCoordinates()[0].length).to.equal(2);
@@ -568,7 +568,7 @@ describe('ol.format.EsriJSON', function() {
});
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.Polygon);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XYZ);
expect(obj.getLayout()).to.eql('XYZ');
var rings = obj.getLinearRings();
expect(rings.length).to.be(3);
expect(rings[0].getCoordinates()[0].length).to.equal(3);
@@ -587,7 +587,7 @@ describe('ol.format.EsriJSON', function() {
});
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.Polygon);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XYM);
expect(obj.getLayout()).to.eql('XYM');
var rings = obj.getLinearRings();
expect(rings.length).to.be(3);
expect(rings[0].getCoordinates()[0].length).to.equal(3);
@@ -616,7 +616,7 @@ describe('ol.format.EsriJSON', function() {
});
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.Polygon);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XYZM);
expect(obj.getLayout()).to.eql('XYZM');
var rings = obj.getLinearRings();
expect(rings.length).to.be(3);
expect(rings[0].getCoordinates()[0].length).to.equal(4);
@@ -635,7 +635,7 @@ describe('ol.format.EsriJSON', function() {
});
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.MultiPolygon);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XY);
expect(obj.getLayout()).to.eql('XY');
expect(obj.getCoordinates()).to.eql([
[[[0, 1], [1, 4], [4, 3], [3, 0]], [[2, 2], [3, 2],
[3, 3], [2, 3]]],
@@ -654,7 +654,7 @@ describe('ol.format.EsriJSON', function() {
});
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.MultiPolygon);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XYZ);
expect(obj.getLayout()).to.eql('XYZ');
expect(obj.getCoordinates()).to.eql([
[[[0, 1, 0], [1, 4, 0], [4, 3, 0], [3, 0, 0]], [[2, 2, 0], [3, 2, 0],
[3, 3, 0], [2, 3, 0]]],
@@ -673,7 +673,7 @@ describe('ol.format.EsriJSON', function() {
});
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.MultiPolygon);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XYM);
expect(obj.getLayout()).to.eql('XYM');
expect(obj.getCoordinates()).to.eql([
[[[0, 1, 0], [1, 4, 0], [4, 3, 0], [3, 0, 0]], [[2, 2, 0], [3, 2, 0],
[3, 3, 0], [2, 3, 0]]],
@@ -693,7 +693,7 @@ describe('ol.format.EsriJSON', function() {
});
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.MultiPolygon);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XYZM);
expect(obj.getLayout()).to.eql('XYZM');
expect(obj.getCoordinates()).to.eql([
[[[0, 1, 0, 1], [1, 4, 0, 1], [4, 3, 0, 1], [3, 0, 0, 1]],
[[2, 2, 0, 1], [3, 2, 0, 1],
@@ -759,14 +759,14 @@ describe('ol.format.EsriJSON', function() {
});
it('encodes XYZ point', function() {
var point = new ol.geom.Point([10, 20, 0], ol.geom.GeometryLayout.XYZ);
var point = new ol.geom.Point([10, 20, 0], 'XYZ');
var esrijson = format.writeGeometry(point);
expect(point.getCoordinates()).to.eql(
format.readGeometry(esrijson).getCoordinates());
});
it('encodes XYM point', function() {
var point = new ol.geom.Point([10, 20, 0], ol.geom.GeometryLayout.XYM);
var point = new ol.geom.Point([10, 20, 0], 'XYM');
var esrijson = format.writeGeometry(point);
expect(point.getCoordinates()).to.eql(
format.readGeometry(esrijson).getCoordinates());
@@ -774,7 +774,7 @@ describe('ol.format.EsriJSON', function() {
it('encodes XYZM point', function() {
var point = new ol.geom.Point([10, 20, 5, 0],
ol.geom.GeometryLayout.XYZM);
'XYZM');
var esrijson = format.writeGeometry(point);
expect(point.getCoordinates()).to.eql(
format.readGeometry(esrijson).getCoordinates());
@@ -789,7 +789,7 @@ describe('ol.format.EsriJSON', function() {
it('encodes XYZ linestring', function() {
var linestring = new ol.geom.LineString([[10, 20, 1534], [30, 40, 1420]],
ol.geom.GeometryLayout.XYZ);
'XYZ');
var esrijson = format.writeGeometry(linestring);
expect(linestring.getCoordinates()).to.eql(
format.readGeometry(esrijson).getCoordinates());
@@ -797,7 +797,7 @@ describe('ol.format.EsriJSON', function() {
it('encodes XYM linestring', function() {
var linestring = new ol.geom.LineString([[10, 20, 1534], [30, 40, 1420]],
ol.geom.GeometryLayout.XYM);
'XYM');
var esrijson = format.writeGeometry(linestring);
expect(linestring.getCoordinates()).to.eql(
format.readGeometry(esrijson).getCoordinates());
@@ -806,7 +806,7 @@ describe('ol.format.EsriJSON', function() {
it('encodes XYZM linestring', function() {
var linestring = new ol.geom.LineString([[10, 20, 1534, 1],
[30, 40, 1420, 1]],
ol.geom.GeometryLayout.XYZM);
'XYZM');
var esrijson = format.writeGeometry(linestring);
expect(linestring.getCoordinates()).to.eql(
format.readGeometry(esrijson).getCoordinates());
@@ -827,7 +827,7 @@ describe('ol.format.EsriJSON', function() {
var inner1 = [[1, 1, 3], [2, 1, 3], [2, 2, 3], [1, 2, 3], [1, 1, 3]];
var inner2 = [[8, 8, 2], [9, 8, 2], [9, 9, 2], [8, 9, 2], [8, 8, 2]];
var polygon = new ol.geom.Polygon([outer, inner1, inner2],
ol.geom.GeometryLayout.XYZ);
'XYZ');
var esrijson = format.writeGeometry(polygon);
expect(polygon.getCoordinates(false)).to.eql(
format.readGeometry(esrijson).getCoordinates());
@@ -838,7 +838,7 @@ describe('ol.format.EsriJSON', function() {
var inner1 = [[1, 1, 3], [2, 1, 3], [2, 2, 3], [1, 2, 3], [1, 1, 3]];
var inner2 = [[8, 8, 2], [9, 8, 2], [9, 9, 2], [8, 9, 2], [8, 8, 2]];
var polygon = new ol.geom.Polygon([outer, inner1, inner2],
ol.geom.GeometryLayout.XYM);
'XYM');
var esrijson = format.writeGeometry(polygon);
expect(polygon.getCoordinates(false)).to.eql(
format.readGeometry(esrijson).getCoordinates());
@@ -855,7 +855,7 @@ describe('ol.format.EsriJSON', function() {
[8, 8, 2, 1], [9, 8, 2, 2], [9, 9, 2, 1], [8, 9, 2, 1], [8, 8, 2, 1]
];
var polygon = new ol.geom.Polygon([outer, inner1, inner2],
ol.geom.GeometryLayout.XYZM);
'XYZM');
var esrijson = format.writeGeometry(polygon);
expect(polygon.getCoordinates(false)).to.eql(
format.readGeometry(esrijson).getCoordinates());
@@ -870,7 +870,7 @@ describe('ol.format.EsriJSON', function() {
it('encodes XYZ multipoint', function() {
var multipoint = new ol.geom.MultiPoint([[102.0, 0.0, 3],
[103.0, 1.0, 4]], ol.geom.GeometryLayout.XYZ);
[103.0, 1.0, 4]], 'XYZ');
var esrijson = format.writeGeometry(multipoint);
expect(multipoint.getCoordinates()).to.eql(
format.readGeometry(esrijson).getCoordinates());
@@ -878,7 +878,7 @@ describe('ol.format.EsriJSON', function() {
it('encodes XYM multipoint', function() {
var multipoint = new ol.geom.MultiPoint([[102.0, 0.0, 3],
[103.0, 1.0, 4]], ol.geom.GeometryLayout.XYM);
[103.0, 1.0, 4]], 'XYM');
var esrijson = format.writeGeometry(multipoint);
expect(multipoint.getCoordinates()).to.eql(
format.readGeometry(esrijson).getCoordinates());
@@ -886,7 +886,7 @@ describe('ol.format.EsriJSON', function() {
it('encodes XYZM multipoint', function() {
var multipoint = new ol.geom.MultiPoint([[102.0, 0.0, 3, 1],
[103.0, 1.0, 4, 1]], ol.geom.GeometryLayout.XYZM);
[103.0, 1.0, 4, 1]], 'XYZM');
var esrijson = format.writeGeometry(multipoint);
expect(multipoint.getCoordinates()).to.eql(
format.readGeometry(esrijson).getCoordinates());
@@ -906,7 +906,7 @@ describe('ol.format.EsriJSON', function() {
var multilinestring = new ol.geom.MultiLineString([
[[102.0, 0.0, 1], [103.0, 1.0, 2], [104.0, 0.0, 3], [105.0, 1.0, 4]],
[[105.0, 3.0, 1], [106.0, 4.0, 2], [107.0, 3.0, 3], [108.0, 4.0, 4]]
], ol.geom.GeometryLayout.XYZ);
], 'XYZ');
var esrijson = format.writeGeometry(multilinestring);
expect(multilinestring.getCoordinates()).to.eql(
format.readGeometry(esrijson).getCoordinates());
@@ -916,7 +916,7 @@ describe('ol.format.EsriJSON', function() {
var multilinestring = new ol.geom.MultiLineString([
[[102.0, 0.0, 1], [103.0, 1.0, 2], [104.0, 0.0, 3], [105.0, 1.0, 4]],
[[105.0, 3.0, 1], [106.0, 4.0, 2], [107.0, 3.0, 3], [108.0, 4.0, 4]]
], ol.geom.GeometryLayout.XYM);
], 'XYM');
var esrijson = format.writeGeometry(multilinestring);
expect(multilinestring.getCoordinates()).to.eql(
format.readGeometry(esrijson).getCoordinates());
@@ -928,7 +928,7 @@ describe('ol.format.EsriJSON', function() {
[105.0, 1.0, 4, 2]],
[[105.0, 3.0, 1, 0], [106.0, 4.0, 2, 1], [107.0, 3.0, 3, 1],
[108.0, 4.0, 4, 2]]
], ol.geom.GeometryLayout.XYZM);
], 'XYZM');
var esrijson = format.writeGeometry(multilinestring);
expect(multilinestring.getCoordinates()).to.eql(
format.readGeometry(esrijson).getCoordinates());
@@ -949,7 +949,7 @@ describe('ol.format.EsriJSON', function() {
[[[0, 1, 0], [1, 4, 0], [4, 3, 0], [3, 0, 0]], [[2, 2, 0], [3, 2, 0],
[3, 3, 0], [2, 3, 0]]],
[[[10, 1, 0], [11, 5, 0], [14, 3, 0], [13, 0, 0]]]
], ol.geom.GeometryLayout.XYZ);
], 'XYZ');
var esrijson = format.writeGeometry(multipolygon);
expect(multipolygon.getCoordinates()).to.eql(
format.readGeometry(esrijson).getCoordinates());
@@ -960,7 +960,7 @@ describe('ol.format.EsriJSON', function() {
[[[0, 1, 0], [1, 4, 0], [4, 3, 0], [3, 0, 0]], [[2, 2, 0], [3, 2, 0],
[3, 3, 0], [2, 3, 0]]],
[[[10, 1, 0], [11, 5, 0], [14, 3, 0], [13, 0, 0]]]
], ol.geom.GeometryLayout.XYM);
], 'XYM');
var esrijson = format.writeGeometry(multipolygon);
expect(multipolygon.getCoordinates()).to.eql(
format.readGeometry(esrijson).getCoordinates());
@@ -972,7 +972,7 @@ describe('ol.format.EsriJSON', function() {
[[2, 2, 0, 3], [3, 2, 0, 4],
[3, 3, 0, 1], [2, 3, 0, 1]]],
[[[10, 1, 0, 1], [11, 5, 0, 2], [14, 3, 0, 3], [13, 0, 0, 3]]]
], ol.geom.GeometryLayout.XYZM);
], 'XYZM');
var esrijson = format.writeGeometry(multipolygon);
expect(multipolygon.getCoordinates()).to.eql(
format.readGeometry(esrijson).getCoordinates());
@@ -1059,7 +1059,6 @@ describe('ol.format.EsriJSON', function() {
goog.require('ol.Feature');
goog.require('ol.extent');
goog.require('ol.format.EsriJSON');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.LineString');
goog.require('ol.geom.LinearRing');
goog.require('ol.geom.MultiLineString');

View File

@@ -314,7 +314,7 @@ describe('ol.format.GeoJSON', function() {
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.Point);
expect(obj.getCoordinates()).to.eql([10, 20]);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XY);
expect(obj.getLayout()).to.eql('XY');
});
it('parses linestring', function() {
@@ -326,7 +326,7 @@ describe('ol.format.GeoJSON', function() {
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.LineString);
expect(obj.getCoordinates()).to.eql([[10, 20], [30, 40]]);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XY);
expect(obj.getLayout()).to.eql('XY');
});
it('parses XYZ linestring', function() {
@@ -337,7 +337,7 @@ describe('ol.format.GeoJSON', function() {
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.LineString);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XYZ);
expect(obj.getLayout()).to.eql('XYZ');
expect(obj.getCoordinates()).to.eql([[10, 20, 1534], [30, 40, 1420]]);
});
@@ -352,7 +352,7 @@ describe('ol.format.GeoJSON', function() {
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.Polygon);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XY);
expect(obj.getLayout()).to.eql('XY');
var rings = obj.getLinearRings();
expect(rings.length).to.be(3);
expect(rings[0]).to.be.a(ol.geom.LinearRing);
@@ -374,9 +374,9 @@ describe('ol.format.GeoJSON', function() {
var array = geometryCollection.getGeometries();
expect(array.length).to.be(2);
expect(array[0]).to.be.a(ol.geom.Point);
expect(array[0].getLayout()).to.eql(ol.geom.GeometryLayout.XY);
expect(array[0].getLayout()).to.eql('XY');
expect(array[1]).to.be.a(ol.geom.LineString);
expect(array[1].getLayout()).to.eql(ol.geom.GeometryLayout.XY);
expect(array[1].getLayout()).to.eql('XY');
});
});
@@ -775,7 +775,6 @@ goog.require('ol.Feature');
goog.require('ol.extent');
goog.require('ol.format.GeoJSON');
goog.require('ol.geom.Circle');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.GeometryCollection');
goog.require('ol.geom.LineString');
goog.require('ol.geom.LinearRing');

View File

@@ -33,7 +33,7 @@ describe('ol.format.GPX', function() {
var g = f.getGeometry();
expect(g).to.be.an(ol.geom.LineString);
expect(g.getCoordinates()).to.eql([]);
expect(g.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
expect(g.getLayout()).to.be('XYZM');
});
it('can read and write various rte attributes', function() {
@@ -90,7 +90,7 @@ describe('ol.format.GPX', function() {
var g = f.getGeometry();
expect(g).to.be.an(ol.geom.LineString);
expect(g.getCoordinates()).to.eql([[2, 1, 0, 0], [4, 3, 0, 0]]);
expect(g.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
expect(g.getLayout()).to.be('XYZM');
var serialized = format.writeFeaturesNode(fs);
expect(serialized).to.xmleql(ol.xml.parse(text));
});
@@ -119,7 +119,7 @@ describe('ol.format.GPX', function() {
var p2 = ol.proj.transform([6, 5], 'EPSG:4326', 'EPSG:3857');
p2.push(0, 0);
expect(g.getCoordinates()).to.eql([p1, p2]);
expect(g.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
expect(g.getLayout()).to.be('XYZM');
var serialized = format.writeFeaturesNode(fs, {
featureProjection: 'EPSG:3857'
});
@@ -159,7 +159,7 @@ describe('ol.format.GPX', function() {
var g = f.getGeometry();
expect(g).to.be.an(ol.geom.MultiLineString);
expect(g.getCoordinates()).to.eql([]);
expect(g.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
expect(g.getLayout()).to.be('XYZM');
});
it('can read and write various trk attributes', function() {
@@ -215,7 +215,7 @@ describe('ol.format.GPX', function() {
var g = f.getGeometry();
expect(g).to.be.an(ol.geom.MultiLineString);
expect(g.getCoordinates()).to.eql([[]]);
expect(g.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
expect(g.getLayout()).to.be('XYZM');
var serialized = format.writeFeaturesNode(fs);
expect(serialized).to.xmleql(ol.xml.parse(text));
});
@@ -248,7 +248,7 @@ describe('ol.format.GPX', function() {
expect(g.getCoordinates()).to.eql([
[[2, 1, 3, 1263115752], [6, 5, 7, 1263115812]]
]);
expect(g.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
expect(g.getLayout()).to.be('XYZM');
var serialized = format.writeFeaturesNode(fs);
expect(serialized).to.xmleql(ol.xml.parse(text));
});
@@ -285,7 +285,7 @@ describe('ol.format.GPX', function() {
var p2 = ol.proj.transform([6, 5], 'EPSG:4326', 'EPSG:3857');
p2.push(7, 1263115812);
expect(g.getCoordinates()).to.eql([[p1, p2]]);
expect(g.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
expect(g.getLayout()).to.be('XYZM');
var serialized = format.writeFeaturesNode(fs, {
featureProjection: 'EPSG:3857'
});
@@ -331,7 +331,7 @@ describe('ol.format.GPX', function() {
[[2, 1, 3, 1263115752], [6, 5, 7, 1263115812]],
[[9, 8, 10, 1263115872], [12, 11, 13, 1263115932]]
]);
expect(g.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
expect(g.getLayout()).to.be('XYZM');
var serialized = format.writeFeaturesNode(fs);
expect(serialized).to.xmleql(ol.xml.parse(text));
});
@@ -390,7 +390,7 @@ describe('ol.format.GPX', function() {
var g = f.getGeometry();
expect(g).to.be.an(ol.geom.Point);
expect(g.getCoordinates()).to.eql([2, 1, 0, 0]);
expect(g.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
expect(g.getLayout()).to.be('XYZM');
var serialized = format.writeFeaturesNode(fs);
expect(serialized).to.xmleql(ol.xml.parse(text));
});
@@ -414,7 +414,7 @@ describe('ol.format.GPX', function() {
var expectedPoint = ol.proj.transform([2, 1], 'EPSG:4326', 'EPSG:3857');
expectedPoint.push(0, 0);
expect(g.getCoordinates()).to.eql(expectedPoint);
expect(g.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
expect(g.getLayout()).to.be('XYZM');
var serialized = format.writeFeaturesNode(fs, {
featureProjection: 'EPSG:3857'
});
@@ -438,7 +438,7 @@ describe('ol.format.GPX', function() {
var g = f.getGeometry();
expect(g).to.be.an(ol.geom.Point);
expect(g.getCoordinates()).to.eql([2, 1, 3, 0]);
expect(g.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
expect(g.getLayout()).to.be('XYZM');
var serialized = format.writeFeaturesNode(fs);
expect(serialized).to.xmleql(ol.xml.parse(text));
});
@@ -460,7 +460,7 @@ describe('ol.format.GPX', function() {
var g = f.getGeometry();
expect(g).to.be.an(ol.geom.Point);
expect(g.getCoordinates()).to.eql([2, 1, 0, 1263115752]);
expect(g.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
expect(g.getLayout()).to.be('XYZM');
var serialized = format.writeFeaturesNode(fs);
expect(serialized).to.xmleql(ol.xml.parse(text));
});
@@ -483,7 +483,7 @@ describe('ol.format.GPX', function() {
var g = f.getGeometry();
expect(g).to.be.an(ol.geom.Point);
expect(g.getCoordinates()).to.eql([2, 1, 3, 1263115752]);
expect(g.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
expect(g.getLayout()).to.be('XYZM');
var serialized = format.writeFeaturesNode(fs);
expect(serialized).to.xmleql(ol.xml.parse(text));
});
@@ -677,7 +677,6 @@ describe('ol.format.GPX', function() {
goog.require('ol.Feature');
goog.require('ol.format.GPX');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.LineString');
goog.require('ol.geom.MultiLineString');
goog.require('ol.geom.Point');

View File

@@ -46,7 +46,7 @@ describe('ol.format.IGC', function() {
var feature = format.readFeature(igc);
expect(feature).to.be.an(ol.Feature);
var geom = feature.getGeometry();
expect(geom.getType()).to.eql(ol.geom.GeometryType.LINE_STRING);
expect(geom.getType()).to.eql('LineString');
expect(geom.getCoordinates()).to.eql([
[6.851583333333333, 45.9376, 1303202928],
[6.850183333333334, 45.93395, 1303203353],
@@ -60,7 +60,7 @@ describe('ol.format.IGC', function() {
});
expect(feature).to.be.an(ol.Feature);
var geom = feature.getGeometry();
expect(geom.getType()).to.eql(ol.geom.GeometryType.LINE_STRING);
expect(geom.getType()).to.eql('LineString');
var expectedPoint1 = ol.proj.transform(
[6.851583333333333, 45.9376], 'EPSG:4326', 'EPSG:3857');
@@ -93,7 +93,7 @@ describe('ol.format.IGC', function() {
var feature = features[0];
expect(feature).to.be.an(ol.Feature);
var geom = feature.getGeometry();
expect(geom.getType()).to.eql(ol.geom.GeometryType.LINE_STRING);
expect(geom.getType()).to.eql('LineString');
expect(geom.getCoordinates()).to.eql([
[6.851583333333333, 45.9376, 1303202928],
[6.850183333333334, 45.93395, 1303203353],
@@ -109,7 +109,7 @@ describe('ol.format.IGC', function() {
var feature = features[0];
expect(feature).to.be.an(ol.Feature);
var geom = feature.getGeometry();
expect(geom.getType()).to.eql(ol.geom.GeometryType.LINE_STRING);
expect(geom.getType()).to.eql('LineString');
var expectedPoint1 = ol.proj.transform(
[6.851583333333333, 45.9376], 'EPSG:4326', 'EPSG:3857');
@@ -133,5 +133,4 @@ describe('ol.format.IGC', function() {
goog.require('ol.format.IGC');
goog.require('ol.Feature');
goog.require('ol.geom.GeometryType');
goog.require('ol.proj');

View File

@@ -220,7 +220,7 @@ describe('ol.format.KML', function() {
});
it('can write XY Point geometries', function() {
var layout = ol.geom.GeometryLayout.XY;
var layout = 'XY';
var point = new ol.geom.Point([1, 2], layout);
var features = [new ol.Feature(point)];
var node = format.writeFeaturesNode(features);
@@ -240,7 +240,7 @@ describe('ol.format.KML', function() {
});
it('can write XYZ Point geometries', function() {
var layout = ol.geom.GeometryLayout.XYZ;
var layout = 'XYZ';
var point = new ol.geom.Point([1, 2, 3], layout);
var features = [new ol.Feature(point)];
var node = format.writeFeaturesNode(features);
@@ -269,7 +269,7 @@ describe('ol.format.KML', function() {
return [coordinate[0] / 2, coordinate[1] / 2];
});
var layout = ol.geom.GeometryLayout.XYZ;
var layout = 'XYZ';
var point = new ol.geom.Point([1, 2, 3], layout).transform(
'EPSG:4326', 'double');
var features = [new ol.Feature(point)];
@@ -297,7 +297,7 @@ describe('ol.format.KML', function() {
});
it('can write XYM Point geometries', function() {
var layout = ol.geom.GeometryLayout.XYM;
var layout = 'XYM';
var point = new ol.geom.Point([1, 2, 100], layout);
var features = [new ol.Feature(point)];
var node = format.writeFeaturesNode(features);
@@ -317,7 +317,7 @@ describe('ol.format.KML', function() {
});
it('can write XYZM Point geometries', function() {
var layout = ol.geom.GeometryLayout.XYZM;
var layout = 'XYZM';
var point = new ol.geom.Point([1, 2, 3, 100], layout);
var features = [new ol.Feature(point)];
var node = format.writeFeaturesNode(features);
@@ -359,7 +359,7 @@ describe('ol.format.KML', function() {
});
it('can write XY LineString geometries', function() {
var layout = ol.geom.GeometryLayout.XY;
var layout = 'XY';
var lineString = new ol.geom.LineString([[1, 2], [3, 4]], layout);
var features = [new ol.Feature(lineString)];
var node = format.writeFeaturesNode(features);
@@ -379,7 +379,7 @@ describe('ol.format.KML', function() {
});
it('can write XYZ LineString geometries', function() {
var layout = ol.geom.GeometryLayout.XYZ;
var layout = 'XYZ';
var lineString = new ol.geom.LineString(
[[1, 2, 3], [4, 5, 6]], layout);
var features = [new ol.Feature(lineString)];
@@ -400,7 +400,7 @@ describe('ol.format.KML', function() {
});
it('can write XYM LineString geometries', function() {
var layout = ol.geom.GeometryLayout.XYM;
var layout = 'XYM';
var lineString = new ol.geom.LineString(
[[1, 2, 100], [3, 4, 200]], layout);
var features = [new ol.Feature(lineString)];
@@ -421,7 +421,7 @@ describe('ol.format.KML', function() {
});
it('can write XYZM LineString geometries', function() {
var layout = ol.geom.GeometryLayout.XYZM;
var layout = 'XYZM';
var lineString = new ol.geom.LineString(
[[1, 2, 3, 100], [4, 5, 6, 200]], layout);
var features = [new ol.Feature(lineString)];
@@ -460,7 +460,7 @@ describe('ol.format.KML', function() {
});
it('can write XY LinearRing geometries', function() {
var layout = ol.geom.GeometryLayout.XY;
var layout = 'XY';
var linearRing = new ol.geom.LinearRing(
[[1, 2], [3, 4], [1, 2]], layout);
var features = [new ol.Feature(linearRing)];
@@ -481,7 +481,7 @@ describe('ol.format.KML', function() {
});
it('can write XYZ LinearRing geometries', function() {
var layout = ol.geom.GeometryLayout.XYZ;
var layout = 'XYZ';
var linearRing = new ol.geom.LinearRing(
[[1, 2, 3], [4, 5, 6], [1, 2, 3]], layout);
var features = [new ol.Feature(linearRing)];
@@ -502,7 +502,7 @@ describe('ol.format.KML', function() {
});
it('can write XYM LinearRing geometries', function() {
var layout = ol.geom.GeometryLayout.XYM;
var layout = 'XYM';
var linearRing = new ol.geom.LinearRing(
[[1, 2, 100], [3, 4, 200], [1, 2, 100]], layout);
var features = [new ol.Feature(linearRing)];
@@ -523,7 +523,7 @@ describe('ol.format.KML', function() {
});
it('can write XYZM LinearRing geometries', function() {
var layout = ol.geom.GeometryLayout.XYZM;
var layout = 'XYZM';
var linearRing = new ol.geom.LinearRing(
[[1, 2, 3, 100], [4, 5, 6, 200], [1, 2, 3, 100]], layout);
var features = [new ol.Feature(linearRing)];
@@ -571,7 +571,7 @@ describe('ol.format.KML', function() {
});
it('can write XY Polygon geometries', function() {
var layout = ol.geom.GeometryLayout.XY;
var layout = 'XY';
var polygon = new ol.geom.Polygon(
[[[0, 0], [0, 2], [2, 2], [2, 0], [0, 0]]], layout);
var features = [new ol.Feature(polygon)];
@@ -596,7 +596,7 @@ describe('ol.format.KML', function() {
});
it('can write XYZ Polygon geometries', function() {
var layout = ol.geom.GeometryLayout.XYZ;
var layout = 'XYZ';
var polygon = new ol.geom.Polygon(
[[[0, 0, 1], [0, 2, 2], [2, 2, 3], [2, 0, 4], [0, 0, 5]]], layout);
var features = [new ol.Feature(polygon)];
@@ -623,7 +623,7 @@ describe('ol.format.KML', function() {
});
it('can write XYM Polygon geometries', function() {
var layout = ol.geom.GeometryLayout.XYM;
var layout = 'XYM';
var polygon = new ol.geom.Polygon(
[[[0, 0, 1], [0, 2, 1], [2, 2, 1], [2, 0, 1], [0, 0, 1]]], layout);
var features = [new ol.Feature(polygon)];
@@ -650,7 +650,7 @@ describe('ol.format.KML', function() {
});
it('can write XYZM Polygon geometries', function() {
var layout = ol.geom.GeometryLayout.XYZM;
var layout = 'XYZM';
var polygon = new ol.geom.Polygon(
[[[0, 0, 1, 1], [0, 2, 2, 1], [2, 2, 3, 1],
[2, 0, 4, 1], [0, 0, 5, 1]]], layout);
@@ -711,7 +711,7 @@ describe('ol.format.KML', function() {
});
it('can write complex Polygon geometries', function() {
var layout = ol.geom.GeometryLayout.XYZ;
var layout = 'XYZ';
var polygon = new ol.geom.Polygon(
[[[0, 0, 1], [0, 5, 1], [5, 5, 2], [5, 0, 3]],
[[1, 1, 0], [1, 2, 0], [2, 2, 0], [2, 1, 0]],
@@ -783,7 +783,7 @@ describe('ol.format.KML', function() {
});
it('can write MultiPoint geometries', function() {
var layout = ol.geom.GeometryLayout.XYZ;
var layout = 'XYZ';
var multiPoint = new ol.geom.MultiPoint(
[[1, 2, 3], [4, 5, 6]], layout);
var features = [new ol.Feature(multiPoint)];
@@ -843,7 +843,7 @@ describe('ol.format.KML', function() {
});
it('can write MultiLineString geometries', function() {
var layout = ol.geom.GeometryLayout.XYZ;
var layout = 'XYZ';
var multiLineString = new ol.geom.MultiLineString(
[[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]], layout);
var features = [new ol.Feature(multiLineString)];
@@ -912,7 +912,7 @@ describe('ol.format.KML', function() {
});
it('can write MultiPolygon geometries', function() {
var layout = ol.geom.GeometryLayout.XYZ;
var layout = 'XYZ';
var multiPolygon = new ol.geom.MultiPolygon(
[[[[0, 0, 0], [0, 1, 0], [1, 1, 0], [1, 0, 0]]],
[[[3, 0, 0], [3, 1, 0], [4, 1, 0], [4, 0, 0]]]], layout);
@@ -1772,12 +1772,12 @@ describe('ol.format.KML', function() {
var style = new ol.style.Style({
image: new ol.style.Icon({
anchor: [0.25, 36],
anchorOrigin: ol.style.IconOrigin.TOP_LEFT,
anchorOrigin: 'top-left',
anchorXUnits: 'fraction',
anchorYUnits: 'pixels',
crossOrigin: 'anonymous',
offset: [96, 96],
offsetOrigin: ol.style.IconOrigin.TOP_LEFT,
offsetOrigin: 'top-left',
rotation: 45,
scale: 0.5,
size: [48, 48],
@@ -2874,7 +2874,6 @@ goog.require('ol.Feature');
goog.require('ol.format.GeoJSON');
goog.require('ol.format.KML');
goog.require('ol.geom.GeometryCollection');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.LineString');
goog.require('ol.geom.LinearRing');
goog.require('ol.geom.MultiLineString');
@@ -2885,7 +2884,6 @@ goog.require('ol.geom.Polygon');
goog.require('ol.style.Circle');
goog.require('ol.style.Fill');
goog.require('ol.style.Icon');
goog.require('ol.style.IconOrigin');
goog.require('ol.proj');
goog.require('ol.proj.Projection');
goog.require('ol.style.Stroke');

View File

@@ -316,11 +316,11 @@ describe('ol.format.Polyline', function() {
43.252, -126.453, 20
], 3);
var format = new ol.format.Polyline({
geometryLayout: ol.geom.GeometryLayout.XYZ
geometryLayout: 'XYZ'
});
var geometry = format.readGeometry(xyz);
expect(geometry.getLayout()).to.eql(ol.geom.GeometryLayout.XYZ);
expect(geometry.getLayout()).to.eql('XYZ');
expect(geometry.getCoordinates()).to.eql([
[-120.200, 38.500, 100],
[-120.950, 40.700, 200],
@@ -399,6 +399,5 @@ describe('ol.format.Polyline', function() {
goog.require('ol.Feature');
goog.require('ol.format.Polyline');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.LineString');
goog.require('ol.proj');

View File

@@ -84,8 +84,8 @@ describe('ol.format.WKT', function() {
expect(features.length).to.eql(2);
var point1 = features[0].getGeometry();
var point2 = features[1].getGeometry();
expect(point1.getType()).to.eql(ol.geom.GeometryType.POINT);
expect(point2.getType()).to.eql(ol.geom.GeometryType.POINT);
expect(point1.getType()).to.eql('Point');
expect(point2.getType()).to.eql('Point');
expect(point1.getCoordinates()).to.eql(
ol.proj.transform([1, 2], 'EPSG:4326', 'EPSG:3857'));
expect(point2.getCoordinates()).to.eql(
@@ -157,13 +157,13 @@ describe('ol.format.WKT', function() {
it('LineString read / written correctly', function() {
var wkt = 'LINESTRING(30 10,10 30,40 40)';
var geom = format.readGeometry(wkt);
expect(geom.getType()).to.eql(ol.geom.GeometryType.LINE_STRING);
expect(geom.getType()).to.eql('LineString');
expect(geom.getCoordinates()).to.eql([[30, 10], [10, 30], [40, 40]]);
expect(format.writeGeometry(geom)).to.eql(wkt);
// test whitespace when reading
wkt = 'LINESTRING (30 10, 10 30, 40 40)';
geom = format.readGeometry(wkt);
expect(geom.getType()).to.eql(ol.geom.GeometryType.LINE_STRING);
expect(geom.getType()).to.eql('LineString');
expect(geom.getCoordinates()).to.eql([[30, 10], [10, 30], [40, 40]]);
});
@@ -171,10 +171,10 @@ describe('ol.format.WKT', function() {
var wkt = 'MULTILINESTRING((10 10,20 20,10 40),' +
'(40 40,30 30,40 20,30 10))';
var geom = format.readGeometry(wkt);
expect(geom.getType()).to.eql(ol.geom.GeometryType.MULTI_LINE_STRING);
expect(geom.getType()).to.eql('MultiLineString');
var linestrings = geom.getLineStrings();
expect(linestrings.length).to.eql(2);
expect(linestrings[0].getType()).to.eql(ol.geom.GeometryType.LINE_STRING);
expect(linestrings[0].getType()).to.eql('LineString');
expect(linestrings[0].getCoordinates()).to.eql(
[[10, 10], [20, 20], [10, 40]]);
expect(format.writeGeometry(geom)).to.eql(wkt);
@@ -182,11 +182,11 @@ describe('ol.format.WKT', function() {
wkt = 'MULTILINESTRING ( (10 10, 20 20, 10 40), ' +
'(40 40, 30 30, 40 20, 30 10) )';
geom = format.readGeometry(wkt);
expect(geom.getType()).to.eql(ol.geom.GeometryType.MULTI_LINE_STRING);
expect(geom.getType()).to.eql('MultiLineString');
linestrings = geom.getLineStrings();
expect(linestrings.length).to.eql(2);
expect(linestrings[0].getType()).to.eql(
ol.geom.GeometryType.LINE_STRING);
'LineString');
expect(linestrings[0].getCoordinates()).to.eql(
[[10, 10], [20, 20], [10, 40]]);
});
@@ -194,10 +194,10 @@ describe('ol.format.WKT', function() {
it('Polygon read / written correctly', function() {
var wkt = 'POLYGON((30 10,10 20,20 40,40 40,30 10))';
var geom = format.readGeometry(wkt);
expect(geom.getType()).to.eql(ol.geom.GeometryType.POLYGON);
expect(geom.getType()).to.eql('Polygon');
var rings = geom.getLinearRings();
expect(rings.length).to.eql(1);
expect(rings[0].getType()).to.eql(ol.geom.GeometryType.LINEAR_RING);
expect(rings[0].getType()).to.eql('LinearRing');
expect(rings[0].getCoordinates()).to.eql(
[[30, 10], [10, 20], [20, 40], [40, 40], [30, 10]]);
expect(format.writeGeometry(geom)).to.eql(wkt);
@@ -205,11 +205,11 @@ describe('ol.format.WKT', function() {
// note that WKT doesn't care about winding order, we do
wkt = 'POLYGON((35 10,10 20,15 40,45 45,35 10),(20 30,30 20,35 35,20 30))';
geom = format.readGeometry(wkt);
expect(geom.getType()).to.eql(ol.geom.GeometryType.POLYGON);
expect(geom.getType()).to.eql('Polygon');
rings = geom.getLinearRings();
expect(rings.length).to.eql(2);
expect(rings[0].getType()).to.eql(ol.geom.GeometryType.LINEAR_RING);
expect(rings[1].getType()).to.eql(ol.geom.GeometryType.LINEAR_RING);
expect(rings[0].getType()).to.eql('LinearRing');
expect(rings[1].getType()).to.eql('LinearRing');
expect(rings[0].getCoordinates()).to.eql(
[[35, 10], [10, 20], [15, 40], [45, 45], [35, 10]]);
expect(rings[1].getCoordinates()).to.eql(
@@ -219,10 +219,10 @@ describe('ol.format.WKT', function() {
// test whitespace when reading
wkt = 'POLYGON ( (30 10, 10 20, 20 40, 40 40, 30 10) )';
geom = format.readGeometry(wkt);
expect(geom.getType()).to.eql(ol.geom.GeometryType.POLYGON);
expect(geom.getType()).to.eql('Polygon');
rings = geom.getLinearRings();
expect(rings.length).to.eql(1);
expect(rings[0].getType()).to.eql(ol.geom.GeometryType.LINEAR_RING);
expect(rings[0].getType()).to.eql('LinearRing');
expect(rings[0].getCoordinates()).to.eql(
[[30, 10], [10, 20], [20, 40], [40, 40], [30, 10]]);
});
@@ -232,11 +232,11 @@ describe('ol.format.WKT', function() {
var wkt = 'MULTIPOLYGON(((40 40,45 30,20 45,40 40)),' +
'((20 35,45 20,30 5,10 10,10 30,20 35),(30 20,20 25,20 15,30 20)))';
var geom = format.readGeometry(wkt);
expect(geom.getType()).to.eql(ol.geom.GeometryType.MULTI_POLYGON);
expect(geom.getType()).to.eql('MultiPolygon');
var polygons = geom.getPolygons();
expect(polygons.length).to.eql(2);
expect(polygons[0].getType()).to.eql(ol.geom.GeometryType.POLYGON);
expect(polygons[1].getType()).to.eql(ol.geom.GeometryType.POLYGON);
expect(polygons[0].getType()).to.eql('Polygon');
expect(polygons[1].getType()).to.eql('Polygon');
expect(polygons[0].getLinearRings().length).to.eql(1);
expect(polygons[1].getLinearRings().length).to.eql(2);
expect(polygons[0].getLinearRings()[0].getCoordinates()).to.eql(
@@ -252,11 +252,11 @@ describe('ol.format.WKT', function() {
'( (20 35, 45 20,30 5,10 10,10 30,20 35), ' +
'( 30 20, 20 25,20 15 ,30 20 ) ))';
geom = format.readGeometry(wkt);
expect(geom.getType()).to.eql(ol.geom.GeometryType.MULTI_POLYGON);
expect(geom.getType()).to.eql('MultiPolygon');
polygons = geom.getPolygons();
expect(polygons.length).to.eql(2);
expect(polygons[0].getType()).to.eql(ol.geom.GeometryType.POLYGON);
expect(polygons[1].getType()).to.eql(ol.geom.GeometryType.POLYGON);
expect(polygons[0].getType()).to.eql('Polygon');
expect(polygons[1].getType()).to.eql('Polygon');
expect(polygons[0].getLinearRings().length).to.eql(1);
expect(polygons[1].getLinearRings().length).to.eql(2);
expect(polygons[0].getLinearRings()[0].getCoordinates()).to.eql(
@@ -310,9 +310,9 @@ describe('ol.format.WKT', function() {
var geom = format.readGeometry(wkt);
var geoms = geom.getGeometries();
expect(geoms.length).to.eql(2);
expect(geom.getType()).to.eql(ol.geom.GeometryType.GEOMETRY_COLLECTION);
expect(geoms[0].getType()).to.eql(ol.geom.GeometryType.POINT);
expect(geoms[1].getType()).to.eql(ol.geom.GeometryType.LINE_STRING);
expect(geom.getType()).to.eql('GeometryCollection');
expect(geoms[0].getType()).to.eql('Point');
expect(geoms[1].getType()).to.eql('LineString');
expect(geoms[0].getCoordinates()).to.eql([4, 6]);
expect(geoms[1].getCoordinates()).to.eql([[4, 6], [7, 10]]);
expect(format.writeGeometry(geom)).to.eql(wkt);
@@ -321,9 +321,9 @@ describe('ol.format.WKT', function() {
geom = format.readGeometry(wkt);
geoms = geom.getGeometries();
expect(geoms.length).to.eql(2);
expect(geom.getType()).to.eql(ol.geom.GeometryType.GEOMETRY_COLLECTION);
expect(geoms[0].getType()).to.eql(ol.geom.GeometryType.POINT);
expect(geoms[1].getType()).to.eql(ol.geom.GeometryType.LINE_STRING);
expect(geom.getType()).to.eql('GeometryCollection');
expect(geoms[0].getType()).to.eql('Point');
expect(geoms[1].getType()).to.eql('LineString');
expect(geoms[0].getCoordinates()).to.eql([4, 6]);
expect(geoms[1].getCoordinates()).to.eql([[4, 6], [7, 10]]);
});
@@ -341,8 +341,8 @@ describe('ol.format.WKT', function() {
var features = format.readFeatures(wkt);
expect(features.length).to.eql(2);
var geoms = [features[0].getGeometry(), features[1].getGeometry()];
expect(geoms[0].getType()).to.eql(ol.geom.GeometryType.POINT);
expect(geoms[1].getType()).to.eql(ol.geom.GeometryType.LINE_STRING);
expect(geoms[0].getType()).to.eql('Point');
expect(geoms[1].getType()).to.eql('LineString');
expect(geoms[0].getCoordinates()).to.eql([4, 6]);
expect(geoms[1].getCoordinates()).to.eql([[4, 6], [7, 10]]);
expect(format.writeFeatures(features)).to.eql(wkt);
@@ -362,8 +362,8 @@ describe('ol.format.WKT', function() {
expect(features.length).to.eql(2);
var point1 = features[0].getGeometry();
var point2 = features[1].getGeometry();
expect(point1.getType()).to.eql(ol.geom.GeometryType.POINT);
expect(point2.getType()).to.eql(ol.geom.GeometryType.POINT);
expect(point1.getType()).to.eql('Point');
expect(point2.getType()).to.eql('Point');
expect(point1.getCoordinates()).to.eql([1, 2]);
expect(point2.getCoordinates()).to.eql([3, 4]);
expect(format.writeFeatures(features)).to.eql(wkt);
@@ -429,7 +429,6 @@ describe('ol.format.WKT', function() {
});
goog.require('ol.Feature');
goog.require('ol.geom.GeometryType');
goog.require('ol.geom.Point');
goog.require('ol.format.WKT');
goog.require('ol.proj');

View File

@@ -91,7 +91,7 @@ describe('ol.geom.Circle', function() {
it('maintains Z coordinates', function() {
var circle = new ol.geom.Circle([0, 0, 1], 1);
expect(circle.getLayout()).to.be(ol.geom.GeometryLayout.XYZ);
expect(circle.getLayout()).to.be('XYZ');
var closestPoint = circle.getClosestPoint([2, 0]);
expect(closestPoint).to.have.length(3);
expect(closestPoint[0]).to.roughlyEqual(1, 1e-15);
@@ -101,7 +101,7 @@ describe('ol.geom.Circle', function() {
it('maintains M coordinates', function() {
var circle = new ol.geom.Circle([0, 0, 2], 1,
ol.geom.GeometryLayout.XYM);
'XYM');
var closestPoint = circle.getClosestPoint([2, 0]);
expect(closestPoint).to.have.length(3);
expect(closestPoint[0]).to.roughlyEqual(1, 1e-15);
@@ -111,7 +111,7 @@ describe('ol.geom.Circle', function() {
it('maintains Z and M coordinates', function() {
var circle = new ol.geom.Circle([0, 0, 1, 2], 1);
expect(circle.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
expect(circle.getLayout()).to.be('XYZM');
var closestPoint = circle.getClosestPoint([2, 0]);
expect(closestPoint).to.have.length(4);
expect(closestPoint[0]).to.roughlyEqual(1, 1e-15);
@@ -149,7 +149,7 @@ describe('ol.geom.Circle', function() {
describe('#getType', function() {
it('returns the expected value', function() {
expect(circle.getType()).to.be(ol.geom.GeometryType.CIRCLE);
expect(circle.getType()).to.be('Circle');
});
});
@@ -173,7 +173,7 @@ describe('ol.geom.Circle', function() {
describe('#setFlatCoordinates', function() {
it('sets both center and radius', function() {
circle.setFlatCoordinates(ol.geom.GeometryLayout.XY, [1, 2, 4, 2]);
circle.setFlatCoordinates('XY', [1, 2, 4, 2]);
expect(circle.getCenter()).to.eql([1, 2]);
expect(circle.getRadius()).to.be(3);
});
@@ -181,7 +181,7 @@ describe('ol.geom.Circle', function() {
it('fires a single change event', function() {
var spy = sinon.spy();
circle.on('change', spy);
circle.setFlatCoordinates(ol.geom.GeometryLayout.XY, [1, 2, 4, 2]);
circle.setFlatCoordinates('XY', [1, 2, 4, 2]);
expect(spy.calledOnce).to.be(true);
});
@@ -276,5 +276,3 @@ describe('ol.geom.Circle', function() {
goog.require('ol.geom.Circle');
goog.require('ol.geom.GeometryType');
goog.require('ol.geom.GeometryLayout');

View File

@@ -17,7 +17,7 @@ describe('ol.geom.LineString', function() {
});
it('defaults to layout XY', function() {
expect(lineString.getLayout()).to.be(ol.geom.GeometryLayout.XY);
expect(lineString.getLayout()).to.be('XY');
});
it('has empty coordinates', function() {
@@ -53,7 +53,7 @@ describe('ol.geom.LineString', function() {
});
it('has the expected layout', function() {
expect(lineString.getLayout()).to.be(ol.geom.GeometryLayout.XY);
expect(lineString.getLayout()).to.be('XY');
});
it('has the expected coordinates', function() {
@@ -114,7 +114,7 @@ describe('ol.geom.LineString', function() {
});
it('has the expected layout', function() {
expect(lineString.getLayout()).to.be(ol.geom.GeometryLayout.XYZ);
expect(lineString.getLayout()).to.be('XYZ');
});
it('has the expected coordinates', function() {
@@ -156,11 +156,11 @@ describe('ol.geom.LineString', function() {
var lineString;
beforeEach(function() {
lineString = new ol.geom.LineString(
[[1, 2, 3], [4, 5, 6]], ol.geom.GeometryLayout.XYM);
[[1, 2, 3], [4, 5, 6]], 'XYM');
});
it('has the expected layout', function() {
expect(lineString.getLayout()).to.be(ol.geom.GeometryLayout.XYM);
expect(lineString.getLayout()).to.be('XYM');
});
it('has the expected coordinates', function() {
@@ -205,7 +205,7 @@ describe('ol.geom.LineString', function() {
});
it('has the expected layout', function() {
expect(lineString.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
expect(lineString.getLayout()).to.be('XYZM');
});
it('has the expected coordinates', function() {
@@ -359,7 +359,7 @@ describe('ol.geom.LineString', function() {
var lineString;
beforeEach(function() {
lineString = new ol.geom.LineString(
[[1, 2, 3], [4, 5, 6]], ol.geom.GeometryLayout.XYM);
[[1, 2, 3], [4, 5, 6]], 'XYM');
});
describe('#getCoordinateAtM', function() {
@@ -405,7 +405,7 @@ describe('ol.geom.LineString', function() {
describe('#getCoordinateAtM', function() {
it('returns the expected value', function() {
expect(lineString.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
expect(lineString.getLayout()).to.be('XYZM');
var m;
for (m = 0; m <= 22; m += 0.5) {
expect(lineString.getCoordinateAtM(m, true)).to.eql(
@@ -421,5 +421,4 @@ describe('ol.geom.LineString', function() {
goog.require('ol.extent');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.LineString');

View File

@@ -17,7 +17,7 @@ describe('ol.geom.MultiLineString', function() {
});
it('defaults to layout XY', function() {
expect(multiLineString.getLayout()).to.be(ol.geom.GeometryLayout.XY);
expect(multiLineString.getLayout()).to.be('XY');
});
it('has empty coordinates', function() {
@@ -58,7 +58,7 @@ describe('ol.geom.MultiLineString', function() {
});
it('has the expected layout', function() {
expect(multiLineString.getLayout()).to.be(ol.geom.GeometryLayout.XY);
expect(multiLineString.getLayout()).to.be('XY');
});
it('has the expected coordinates', function() {
@@ -110,7 +110,7 @@ describe('ol.geom.MultiLineString', function() {
});
it('has the expected layout', function() {
expect(multiLineString.getLayout()).to.be(ol.geom.GeometryLayout.XYZ);
expect(multiLineString.getLayout()).to.be('XYZ');
});
it('has the expected coordinates', function() {
@@ -139,11 +139,11 @@ describe('ol.geom.MultiLineString', function() {
beforeEach(function() {
multiLineString = new ol.geom.MultiLineString(
[[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]],
ol.geom.GeometryLayout.XYM);
'XYM');
});
it('has the expected layout', function() {
expect(multiLineString.getLayout()).to.be(ol.geom.GeometryLayout.XYM);
expect(multiLineString.getLayout()).to.be('XYM');
});
it('has the expected coordinates', function() {
@@ -167,11 +167,11 @@ describe('ol.geom.MultiLineString', function() {
it('can return individual line strings', function() {
var lineString0 = multiLineString.getLineString(0);
expect(lineString0).to.be.an(ol.geom.LineString);
expect(lineString0.getLayout()).to.be(ol.geom.GeometryLayout.XYM);
expect(lineString0.getLayout()).to.be('XYM');
expect(lineString0.getCoordinates()).to.eql([[1, 2, 3], [4, 5, 6]]);
var lineString1 = multiLineString.getLineString(1);
expect(lineString1).to.be.an(ol.geom.LineString);
expect(lineString1.getLayout()).to.be(ol.geom.GeometryLayout.XYM);
expect(lineString1.getLayout()).to.be('XYM');
expect(lineString1.getCoordinates()).to.eql([[7, 8, 9], [10, 11, 12]]);
});
@@ -290,7 +290,7 @@ describe('ol.geom.MultiLineString', function() {
});
it('has the expected layout', function() {
expect(multiLineString.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
expect(multiLineString.getLayout()).to.be('XYZM');
});
it('has the expected coordinates', function() {
@@ -333,6 +333,5 @@ describe('ol.geom.MultiLineString', function() {
goog.require('ol.extent');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.LineString');
goog.require('ol.geom.MultiLineString');

View File

@@ -17,7 +17,7 @@ describe('ol.geom.MultiPoint', function() {
});
it('defaults to layout XY', function() {
expect(multiPoint.getLayout()).to.be(ol.geom.GeometryLayout.XY);
expect(multiPoint.getLayout()).to.be('XY');
});
it('has empty coordinates', function() {
@@ -53,7 +53,7 @@ describe('ol.geom.MultiPoint', function() {
});
it('has the expected layout', function() {
expect(multiPoint.getLayout()).to.be(ol.geom.GeometryLayout.XY);
expect(multiPoint.getLayout()).to.be('XY');
});
it('has the expected coordinates', function() {
@@ -94,7 +94,7 @@ describe('ol.geom.MultiPoint', function() {
});
it('has the expected layout', function() {
expect(multiPoint.getLayout()).to.be(ol.geom.GeometryLayout.XYZ);
expect(multiPoint.getLayout()).to.be('XYZ');
});
it('has the expected coordinates', function() {
@@ -120,11 +120,11 @@ describe('ol.geom.MultiPoint', function() {
var multiPoint;
beforeEach(function() {
multiPoint = new ol.geom.MultiPoint(
[[1, 2, 3], [4, 5, 6]], ol.geom.GeometryLayout.XYM);
[[1, 2, 3], [4, 5, 6]], 'XYM');
});
it('has the expected layout', function() {
expect(multiPoint.getLayout()).to.be(ol.geom.GeometryLayout.XYM);
expect(multiPoint.getLayout()).to.be('XYM');
});
it('has the expected coordinates', function() {
@@ -145,10 +145,10 @@ describe('ol.geom.MultiPoint', function() {
it('can return individual points', function() {
var point0 = multiPoint.getPoint(0);
expect(point0.getLayout()).to.be(ol.geom.GeometryLayout.XYM);
expect(point0.getLayout()).to.be('XYM');
expect(point0.getCoordinates()).to.eql([1, 2, 3]);
var point1 = multiPoint.getPoint(1);
expect(point1.getLayout()).to.be(ol.geom.GeometryLayout.XYM);
expect(point1.getLayout()).to.be('XYM');
expect(point1.getCoordinates()).to.eql([4, 5, 6]);
});
@@ -156,10 +156,10 @@ describe('ol.geom.MultiPoint', function() {
var points = multiPoint.getPoints();
expect(points).to.have.length(2);
expect(points[0]).to.be.an(ol.geom.Point);
expect(points[0].getLayout()).to.be(ol.geom.GeometryLayout.XYM);
expect(points[0].getLayout()).to.be('XYM');
expect(points[0].getCoordinates()).to.eql([1, 2, 3]);
expect(points[1]).to.be.an(ol.geom.Point);
expect(points[1].getLayout()).to.be(ol.geom.GeometryLayout.XYM);
expect(points[1].getLayout()).to.be('XYM');
expect(points[1].getCoordinates()).to.eql([4, 5, 6]);
});
@@ -173,7 +173,7 @@ describe('ol.geom.MultiPoint', function() {
});
it('has the expected layout', function() {
expect(multiPoint.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
expect(multiPoint.getLayout()).to.be('XYZM');
});
it('has the expected coordinates', function() {
@@ -264,6 +264,5 @@ describe('ol.geom.MultiPoint', function() {
goog.require('ol.extent');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.MultiPoint');
goog.require('ol.geom.Point');

View File

@@ -17,7 +17,7 @@ describe('ol.geom.Point', function() {
});
it('has the expected layout', function() {
expect(point.getLayout()).to.be(ol.geom.GeometryLayout.XY);
expect(point.getLayout()).to.be('XY');
});
it('has the expected coordinates', function() {
@@ -50,11 +50,11 @@ describe('ol.geom.Point', function() {
var point;
beforeEach(function() {
point = new ol.geom.Point([1, 2, 3], ol.geom.GeometryLayout.XYM);
point = new ol.geom.Point([1, 2, 3], 'XYM');
});
it('has the expected layout', function() {
expect(point.getLayout()).to.be(ol.geom.GeometryLayout.XYM);
expect(point.getLayout()).to.be('XYM');
});
it('has the expected coordinates', function() {
@@ -91,7 +91,7 @@ describe('ol.geom.Point', function() {
});
it('has the expected layout', function() {
expect(point.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
expect(point.getLayout()).to.be('XYZM');
});
it('has the expected coordinates', function() {
@@ -194,5 +194,4 @@ describe('ol.geom.Point', function() {
goog.require('ol.extent');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.Point');

View File

@@ -17,7 +17,7 @@ describe('ol.geom.Polygon', function() {
});
it('defaults to layout XY', function() {
expect(polygon.getLayout()).to.be(ol.geom.GeometryLayout.XY);
expect(polygon.getLayout()).to.be('XY');
});
it('has empty coordinates', function() {
@@ -64,7 +64,7 @@ describe('ol.geom.Polygon', function() {
});
it('has the expected layout', function() {
expect(polygon.getLayout()).to.be(ol.geom.GeometryLayout.XY);
expect(polygon.getLayout()).to.be('XY');
});
it('has the expected coordinates', function() {
@@ -183,7 +183,7 @@ describe('ol.geom.Polygon', function() {
});
it('has the expected layout', function() {
expect(polygon.getLayout()).to.be(ol.geom.GeometryLayout.XYZ);
expect(polygon.getLayout()).to.be('XYZ');
});
it('has the expected coordinates', function() {
@@ -274,7 +274,7 @@ describe('ol.geom.Polygon', function() {
outerRing = [[0, 0, 1], [4, 4, 2], [4, 0, 3]];
innerRing = [[2, 1, 4], [3, 1, 5], [3, 2, 6]];
polygon = new ol.geom.Polygon(
[outerRing, innerRing], ol.geom.GeometryLayout.XYM);
[outerRing, innerRing], 'XYM');
flatCoordinates = [0, 0, 1, 4, 4, 2, 4, 0, 3, 2, 1, 4, 3, 1, 5, 3, 2, 6];
outsideOuter = [1, 3];
inside = [3.5, 0.5];
@@ -282,7 +282,7 @@ describe('ol.geom.Polygon', function() {
});
it('has the expected layout', function() {
expect(polygon.getLayout()).to.be(ol.geom.GeometryLayout.XYM);
expect(polygon.getLayout()).to.be('XYM');
});
it('has the expected coordinates', function() {
@@ -387,7 +387,7 @@ describe('ol.geom.Polygon', function() {
});
it('has the expected layout', function() {
expect(polygon.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
expect(polygon.getLayout()).to.be('XYZM');
});
it('has the expected coordinates', function() {
@@ -521,7 +521,7 @@ describe('ol.geom.Polygon', function() {
describe('ol.geom.Polygon.fromCircle', function() {
it('creates a regular polygon', function() {
var circle = new ol.geom.Circle([0, 0, 0], 1, ol.geom.GeometryLayout.XYZ);
var circle = new ol.geom.Circle([0, 0, 0], 1, 'XYZ');
var polygon = ol.geom.Polygon.fromCircle(circle);
var coordinates = polygon.getLinearRing(0).getCoordinates();
expect(coordinates[0].length).to.eql(3);
@@ -556,6 +556,5 @@ describe('ol.geom.Polygon', function() {
goog.require('ol.extent');
goog.require('ol.geom.Circle');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.LinearRing');
goog.require('ol.geom.Polygon');

View File

@@ -35,13 +35,13 @@ describe('ol.interaction.DragAndDrop', function() {
describe('#setMap()', function() {
it('registers and unregisters listeners', function() {
interaction.setMap(map);
expect(viewport.hasListener(ol.events.EventType.DRAGENTER)).to.be(true);
expect(viewport.hasListener(ol.events.EventType.DRAGOVER)).to.be(true);
expect(viewport.hasListener(ol.events.EventType.DROP)).to.be(true);
expect(viewport.hasListener('dragenter')).to.be(true);
expect(viewport.hasListener('dragover')).to.be(true);
expect(viewport.hasListener('drop')).to.be(true);
interaction.setMap(null);
expect(viewport.hasListener(ol.events.EventType.DRAGENTER)).to.be(false);
expect(viewport.hasListener(ol.events.EventType.DRAGOVER)).to.be(false);
expect(viewport.hasListener(ol.events.EventType.DROP)).to.be(false);
expect(viewport.hasListener('dragenter')).to.be(false);
expect(viewport.hasListener('dragover')).to.be(false);
expect(viewport.hasListener('drop')).to.be(false);
});
it('registers and unregisters listeners on a custom target', function() {
@@ -51,13 +51,13 @@ describe('ol.interaction.DragAndDrop', function() {
target: customTarget
});
interaction.setMap(map);
expect(customTarget.hasListener(ol.events.EventType.DRAGENTER)).to.be(true);
expect(customTarget.hasListener(ol.events.EventType.DRAGOVER)).to.be(true);
expect(customTarget.hasListener(ol.events.EventType.DROP)).to.be(true);
expect(customTarget.hasListener('dragenter')).to.be(true);
expect(customTarget.hasListener('dragover')).to.be(true);
expect(customTarget.hasListener('drop')).to.be(true);
interaction.setMap(null);
expect(customTarget.hasListener(ol.events.EventType.DRAGENTER)).to.be(false);
expect(customTarget.hasListener(ol.events.EventType.DRAGOVER)).to.be(false);
expect(customTarget.hasListener(ol.events.EventType.DROP)).to.be(false);
expect(customTarget.hasListener('dragenter')).to.be(false);
expect(customTarget.hasListener('dragover')).to.be(false);
expect(customTarget.hasListener('drop')).to.be(false);
});
});
@@ -87,11 +87,11 @@ describe('ol.interaction.DragAndDrop', function() {
interaction.setMap(map);
var event = new ol.events.Event();
event.dataTransfer = {};
event.type = ol.events.EventType.DRAGENTER;
event.type = 'dragenter';
viewport.dispatchEvent(event);
event.type = ol.events.EventType.DRAGOVER;
event.type = 'dragover';
viewport.dispatchEvent(event);
event.type = ol.events.EventType.DROP;
event.type = 'drop';
event.dataTransfer.files = {
length: 1,
item: function() {
@@ -113,5 +113,4 @@ goog.require('ol.interaction.DragAndDrop');
goog.require('ol.View');
goog.require('ol.events.Event');
goog.require('ol.events.EventTarget');
goog.require('ol.events.EventType');
goog.require('ol.format.GeoJSON');

View File

@@ -62,7 +62,7 @@ describe('ol.interaction.Draw', function() {
it('creates a new interaction', function() {
var draw = new ol.interaction.Draw({
source: source,
type: ol.geom.GeometryType.POINT
type: 'Point'
});
expect(draw).to.be.a(ol.interaction.Draw);
expect(draw).to.be.a(ol.interaction.Interaction);
@@ -76,7 +76,7 @@ describe('ol.interaction.Draw', function() {
var draw = new ol.interaction.Draw({
source: source,
geometryName: 'the_geom',
type: ol.geom.GeometryType.POINT
type: 'Point'
});
map.addInteraction(draw);
});
@@ -96,7 +96,7 @@ describe('ol.interaction.Draw', function() {
beforeEach(function() {
var draw = new ol.interaction.Draw({
source: source,
type: ol.geom.GeometryType.POINT,
type: 'Point',
clickTolerance: 6
});
map.addInteraction(draw);
@@ -125,7 +125,7 @@ describe('ol.interaction.Draw', function() {
beforeEach(function() {
draw = new ol.interaction.Draw({
source: source,
type: ol.geom.GeometryType.POINT
type: 'Point'
});
map.addInteraction(draw);
});
@@ -161,8 +161,8 @@ describe('ol.interaction.Draw', function() {
it('triggers draw events', function() {
var ds = sinon.spy();
var de = sinon.spy();
ol.events.listen(draw, ol.interaction.DrawEventType.DRAWSTART, ds);
ol.events.listen(draw, ol.interaction.DrawEventType.DRAWEND, de);
ol.events.listen(draw, 'drawstart', ds);
ol.events.listen(draw, 'drawend', de);
simulateEvent('pointermove', 10, 20);
simulateEvent('pointerdown', 10, 20);
simulateEvent('pointerup', 10, 20);
@@ -178,13 +178,13 @@ describe('ol.interaction.Draw', function() {
end: 0,
addfeature: 0
};
ol.events.listen(draw, ol.interaction.DrawEventType.DRAWEND,
ol.events.listen(draw, 'drawend',
function() {
expect(receivedEvents.end).to.be(0);
expect(receivedEvents.addfeature).to.be(0);
++receivedEvents.end;
});
source.on(ol.source.VectorEventType.ADDFEATURE, function() {
source.on('addfeature', function() {
expect(receivedEvents.end).to.be(1);
expect(receivedEvents.addfeature).to.be(0);
receivedEvents.addfeature++;
@@ -203,7 +203,7 @@ describe('ol.interaction.Draw', function() {
beforeEach(function() {
map.addInteraction(new ol.interaction.Draw({
source: source,
type: ol.geom.GeometryType.MULTI_POINT
type: 'MultiPoint'
}));
});
@@ -226,7 +226,7 @@ describe('ol.interaction.Draw', function() {
beforeEach(function() {
draw = new ol.interaction.Draw({
source: source,
type: ol.geom.GeometryType.LINE_STRING
type: 'LineString'
});
map.addInteraction(draw);
});
@@ -307,8 +307,8 @@ describe('ol.interaction.Draw', function() {
it('triggers draw events', function() {
var ds = sinon.spy();
var de = sinon.spy();
ol.events.listen(draw, ol.interaction.DrawEventType.DRAWSTART, ds);
ol.events.listen(draw, ol.interaction.DrawEventType.DRAWEND, de);
ol.events.listen(draw, 'drawstart', ds);
ol.events.listen(draw, 'drawend', de);
// first point
simulateEvent('pointermove', 10, 20);
@@ -337,7 +337,7 @@ describe('ol.interaction.Draw', function() {
beforeEach(function() {
var draw = new ol.interaction.Draw({
source: source,
type: ol.geom.GeometryType.LINE_STRING,
type: 'LineString',
finishCondition: function(event) {
if (ol.array.equals(event.coordinate,[30,-20])) {
return true;
@@ -387,7 +387,7 @@ describe('ol.interaction.Draw', function() {
beforeEach(function() {
map.addInteraction(new ol.interaction.Draw({
source: source,
type: ol.geom.GeometryType.MULTI_LINE_STRING
type: 'MultiLineString'
}));
});
@@ -421,7 +421,7 @@ describe('ol.interaction.Draw', function() {
beforeEach(function() {
draw = new ol.interaction.Draw({
source: source,
type: ol.geom.GeometryType.POLYGON
type: 'Polygon'
});
map.addInteraction(draw);
});
@@ -514,8 +514,8 @@ describe('ol.interaction.Draw', function() {
it('triggers draw events', function() {
var ds = sinon.spy();
var de = sinon.spy();
ol.events.listen(draw, ol.interaction.DrawEventType.DRAWSTART, ds);
ol.events.listen(draw, ol.interaction.DrawEventType.DRAWEND, de);
ol.events.listen(draw, 'drawstart', ds);
ol.events.listen(draw, 'drawend', de);
// first point
simulateEvent('pointermove', 10, 20);
@@ -550,7 +550,7 @@ describe('ol.interaction.Draw', function() {
beforeEach(function() {
map.addInteraction(new ol.interaction.Draw({
source: source,
type: ol.geom.GeometryType.MULTI_POLYGON
type: 'MultiPolygon'
}));
});
@@ -627,7 +627,7 @@ describe('ol.interaction.Draw', function() {
beforeEach(function() {
draw = new ol.interaction.Draw({
source: source,
type: ol.geom.GeometryType.CIRCLE
type: 'Circle'
});
map.addInteraction(draw);
});
@@ -654,8 +654,8 @@ describe('ol.interaction.Draw', function() {
it('triggers draw events', function() {
var ds = sinon.spy();
var de = sinon.spy();
ol.events.listen(draw, ol.interaction.DrawEventType.DRAWSTART, ds);
ol.events.listen(draw, ol.interaction.DrawEventType.DRAWEND, de);
ol.events.listen(draw, 'drawstart', ds);
ol.events.listen(draw, 'drawend', de);
// first point
simulateEvent('pointermove', 10, 20);
@@ -680,7 +680,7 @@ describe('ol.interaction.Draw', function() {
beforeEach(function() {
interaction = new ol.interaction.Draw({
type: ol.geom.GeometryType.LINE_STRING
type: 'LineString'
});
expect(interaction.getActive()).to.be(true);
@@ -749,7 +749,7 @@ describe('ol.interaction.Draw', function() {
beforeEach(function() {
interaction = new ol.interaction.Draw({
type: ol.geom.GeometryType.LINE_STRING
type: 'LineString'
});
expect(interaction.getActive()).to.be(true);
});
@@ -803,7 +803,7 @@ describe('ol.interaction.Draw', function() {
it('creates a regular polygon in Circle mode', function() {
var draw = new ol.interaction.Draw({
source: source,
type: ol.geom.GeometryType.CIRCLE,
type: 'Circle',
geometryFunction:
ol.interaction.Draw.createRegularPolygon(4, Math.PI / 4)
});
@@ -836,7 +836,7 @@ describe('ol.interaction.Draw', function() {
beforeEach(function() {
draw = new ol.interaction.Draw({
source: source,
type: ol.geom.GeometryType.LINE_STRING
type: 'LineString'
});
map.addInteraction(draw);
feature = new ol.Feature(
@@ -852,7 +852,7 @@ describe('ol.interaction.Draw', function() {
it('dispatches a drawstart event', function() {
var spy = sinon.spy();
ol.events.listen(draw, ol.interaction.DrawEventType.DRAWSTART, spy);
ol.events.listen(draw, 'drawstart', spy);
draw.extend(feature);
expect(spy.callCount).to.be(1);
});
@@ -867,7 +867,6 @@ goog.require('ol.Map');
goog.require('ol.MapBrowserPointerEvent');
goog.require('ol.View');
goog.require('ol.geom.Circle');
goog.require('ol.geom.GeometryType');
goog.require('ol.geom.LineString');
goog.require('ol.geom.MultiLineString');
goog.require('ol.geom.MultiPoint');
@@ -875,9 +874,7 @@ goog.require('ol.geom.MultiPolygon');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
goog.require('ol.interaction.Draw');
goog.require('ol.interaction.DrawEventType');
goog.require('ol.interaction.Interaction');
goog.require('ol.layer.Vector');
goog.require('ol.pointer.PointerEvent');
goog.require('ol.source.Vector');
goog.require('ol.source.VectorEventType');

View File

@@ -23,18 +23,18 @@ describe('ol.interaction.KeyboardPan', function() {
describe('handleEvent()', function() {
it('pans on arrow keys', function() {
var spy = sinon.spy(ol.interaction.Interaction, 'pan');
var event = new ol.MapBrowserEvent(ol.events.EventType.KEYDOWN, map, {
type: ol.events.EventType.KEYDOWN,
var event = new ol.MapBrowserEvent('keydown', map, {
type: 'keydown',
target: map.getTargetElement(),
preventDefault: ol.events.Event.prototype.preventDefault
});
event.originalEvent.keyCode = ol.events.KeyCode.DOWN;
event.originalEvent.keyCode = 40; // DOWN
map.handleMapBrowserEvent(event);
event.originalEvent.keyCode = ol.events.KeyCode.UP;
event.originalEvent.keyCode = 38; // UP
map.handleMapBrowserEvent(event);
event.originalEvent.keyCode = ol.events.KeyCode.LEFT;
event.originalEvent.keyCode = 37; // LEFT
map.handleMapBrowserEvent(event);
event.originalEvent.keyCode = ol.events.KeyCode.RIGHT;
event.originalEvent.keyCode = 39; // RIGHT
map.handleMapBrowserEvent(event);
expect(spy.getCall(0).args[2]).to.eql([0, -128]);
expect(spy.getCall(1).args[2]).to.eql([0, 128]);
@@ -51,7 +51,5 @@ goog.require('ol.Map');
goog.require('ol.MapBrowserEvent');
goog.require('ol.View');
goog.require('ol.events.Event');
goog.require('ol.events.EventType');
goog.require('ol.events.KeyCode');
goog.require('ol.interaction.Interaction');
goog.require('ol.interaction.KeyboardPan');

View File

@@ -23,8 +23,8 @@ describe('ol.interaction.KeyboardZoom', function() {
describe('handleEvent()', function() {
it('zooms on + and - keys', function() {
var spy = sinon.spy(ol.interaction.Interaction, 'zoomByDelta');
var event = new ol.MapBrowserEvent(ol.events.EventType.KEYDOWN, map, {
type: ol.events.EventType.KEYDOWN,
var event = new ol.MapBrowserEvent('keydown', map, {
type: 'keydown',
target: map.getTargetElement(),
preventDefault: ol.events.Event.prototype.preventDefault
});
@@ -45,6 +45,5 @@ goog.require('ol.Map');
goog.require('ol.MapBrowserEvent');
goog.require('ol.View');
goog.require('ol.events.Event');
goog.require('ol.events.EventType');
goog.require('ol.interaction.Interaction');
goog.require('ol.interaction.KeyboardZoom');

View File

@@ -32,8 +32,8 @@ describe('ol.interaction.MouseWheelZoom', function() {
ol.has.FIREFOX = origHasFirefox;
done();
});
var event = new ol.MapBrowserEvent(ol.events.EventType.WHEEL, map, {
type: ol.events.EventType.WHEEL,
var event = new ol.MapBrowserEvent('wheel', map, {
type: 'wheel',
deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaY: ol.has.DEVICE_PIXEL_RATIO,
target: map.getViewport(),
@@ -53,8 +53,8 @@ describe('ol.interaction.MouseWheelZoom', function() {
ol.has.FIREFOX = origHasFirefox;
done();
});
var event = new ol.MapBrowserEvent(ol.events.EventType.WHEEL, map, {
type: ol.events.EventType.WHEEL,
var event = new ol.MapBrowserEvent('wheel', map, {
type: 'wheel',
deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaY: 1,
target: map.getViewport(),
@@ -71,8 +71,8 @@ describe('ol.interaction.MouseWheelZoom', function() {
ol.interaction.Interaction.zoomByDelta.restore();
done();
});
var event = new ol.MapBrowserEvent(ol.events.EventType.WHEEL, map, {
type: ol.events.EventType.WHEEL,
var event = new ol.MapBrowserEvent('wheel', map, {
type: 'wheel',
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaY: 1 / 40,
target: map.getViewport(),
@@ -92,8 +92,8 @@ describe('ol.interaction.MouseWheelZoom', function() {
ol.has.SAFARI = origHasSafari;
done();
});
var event = new ol.MapBrowserEvent(ol.events.EventType.MOUSEWHEEL, map, {
type: ol.events.EventType.MOUSEWHEEL,
var event = new ol.MapBrowserEvent('mousewheel', map, {
type: 'mousewheel',
wheelDeltaY: -3,
target: map.getViewport(),
preventDefault: ol.events.Event.prototype.preventDefault
@@ -112,8 +112,8 @@ describe('ol.interaction.MouseWheelZoom', function() {
ol.has.SAFARI = origHasSafari;
done();
});
var event = new ol.MapBrowserEvent(ol.events.EventType.MOUSEWHEEL, map, {
type: ol.events.EventType.MOUSEWHEEL,
var event = new ol.MapBrowserEvent('mousewheel', map, {
type: 'mousewheel',
wheelDeltaY: -1,
target: map.getViewport(),
preventDefault: ol.events.Event.prototype.preventDefault
@@ -130,6 +130,5 @@ goog.require('ol.Map');
goog.require('ol.MapBrowserEvent');
goog.require('ol.View');
goog.require('ol.events.Event');
goog.require('ol.events.EventType');
goog.require('ol.interaction.Interaction');
goog.require('ol.interaction.MouseWheelZoom');

View File

@@ -122,7 +122,7 @@ describe('ol.interaction.Select', function() {
});
select.on('select', listenerSpy);
simulateEvent(ol.MapBrowserEvent.EventType.SINGLECLICK, 10, -20);
simulateEvent('singleclick', 10, -20);
expect(listenerSpy.callCount).to.be(1);
@@ -165,7 +165,7 @@ describe('ol.interaction.Select', function() {
});
select.on('select', listenerSpy);
simulateEvent(ol.MapBrowserEvent.EventType.SINGLECLICK, 10, -20, true);
simulateEvent('singleclick', 10, -20, true);
expect(listenerSpy.callCount).to.be(1);
@@ -190,7 +190,7 @@ describe('ol.interaction.Select', function() {
});
select.on('select', listenerSpy);
simulateEvent(ol.MapBrowserEvent.EventType.SINGLECLICK, 10, -20);
simulateEvent('singleclick', 10, -20);
expect(listenerSpy.callCount).to.be(1);
@@ -204,7 +204,7 @@ describe('ol.interaction.Select', function() {
});
select.on('select', listenerSpy);
simulateEvent(ol.MapBrowserEvent.EventType.SINGLECLICK, 10, -20, true);
simulateEvent('singleclick', 10, -20, true);
expect(listenerSpy.callCount).to.be(1);
@@ -213,7 +213,7 @@ describe('ol.interaction.Select', function() {
expect(select.getLayer(features.item(0))).to.equal(layer);
// Select again to make sure the internal layer isn't reported
simulateEvent(ol.MapBrowserEvent.EventType.SINGLECLICK, 10, -20);
simulateEvent('singleclick', 10, -20);
expect(listenerSpy.callCount).to.be(2);
@@ -237,7 +237,7 @@ describe('ol.interaction.Select', function() {
var listenerSpy = sinon.spy();
select.on('select', listenerSpy);
simulateEvent(ol.MapBrowserEvent.EventType.SINGLECLICK, 10, -20, true);
simulateEvent('singleclick', 10, -20, true);
expect(listenerSpy.callCount).to.be(1);
@@ -246,7 +246,7 @@ describe('ol.interaction.Select', function() {
map.renderSync();
simulateEvent(ol.MapBrowserEvent.EventType.SINGLECLICK, 10, -20, true);
simulateEvent('singleclick', 10, -20, true);
expect(listenerSpy.callCount).to.be(2);
@@ -268,7 +268,7 @@ describe('ol.interaction.Select', function() {
});
map.addInteraction(select);
simulateEvent(ol.MapBrowserEvent.EventType.SINGLECLICK, 10, -20);
simulateEvent('singleclick', 10, -20);
var features = select.getFeatures();
expect(features.getLength()).to.equal(2);
expect(features.item(0).get('type')).to.be('bar');
@@ -285,7 +285,7 @@ describe('ol.interaction.Select', function() {
});
map.addInteraction(select);
simulateEvent(ol.MapBrowserEvent.EventType.SINGLECLICK, 10, -20,
simulateEvent('singleclick', 10, -20,
true);
var features = select.getFeatures();
expect(features.getLength()).to.equal(2);
@@ -304,7 +304,7 @@ describe('ol.interaction.Select', function() {
}
});
map.addInteraction(select);
simulateEvent(ol.MapBrowserEvent.EventType.SINGLECLICK, 10, -20);
simulateEvent('singleclick', 10, -20);
var features = select.getFeatures();
expect(features.getLength()).to.equal(1);
expect(features.item(0).get('type')).to.be('bar');
@@ -319,7 +319,7 @@ describe('ol.interaction.Select', function() {
}
});
map.addInteraction(select);
simulateEvent(ol.MapBrowserEvent.EventType.SINGLECLICK, 10, -20,
simulateEvent('singleclick', 10, -20,
true);
var features = select.getFeatures();
expect(features.getLength()).to.equal(1);
@@ -350,9 +350,9 @@ describe('ol.interaction.Select', function() {
});
interaction.on('select', listenerSpy);
simulateEvent(ol.MapBrowserEvent.EventType.SINGLECLICK, 10, -20);
simulateEvent('singleclick', 10, -20);
// Select again to make sure that the internal layer doesn't get reported.
simulateEvent(ol.MapBrowserEvent.EventType.SINGLECLICK, 10, -20);
simulateEvent('singleclick', 10, -20);
});
});
@@ -368,7 +368,7 @@ describe('ol.interaction.Select', function() {
expect(interaction.featureOverlay_).not.to.be(null);
simulateEvent(ol.MapBrowserEvent.EventType.SINGLECLICK, 10, -20);
simulateEvent('singleclick', 10, -20);
});
afterEach(function() {
@@ -435,7 +435,6 @@ describe('ol.interaction.Select', function() {
goog.require('ol.Collection');
goog.require('ol.Feature');
goog.require('ol.Map');
goog.require('ol.MapBrowserEvent.EventType');
goog.require('ol.MapBrowserPointerEvent');
goog.require('ol.View');
goog.require('ol.geom.Polygon');

View File

@@ -44,7 +44,7 @@ describe('ol.layer.Layer', function() {
opacity: 1,
visible: true,
managed: true,
sourceState: ol.source.State.READY,
sourceState: 'ready',
extent: undefined,
zIndex: 0,
maxResolution: Infinity,
@@ -79,7 +79,7 @@ describe('ol.layer.Layer', function() {
opacity: 0.5,
visible: false,
managed: true,
sourceState: ol.source.State.READY,
sourceState: 'ready',
extent: undefined,
zIndex: 10,
maxResolution: 500,
@@ -167,7 +167,7 @@ describe('ol.layer.Layer', function() {
opacity: 0.3,
visible: false,
managed: true,
sourceState: ol.source.State.READY,
sourceState: 'ready',
extent: undefined,
zIndex: 10,
maxResolution: 500,
@@ -183,7 +183,7 @@ describe('ol.layer.Layer', function() {
opacity: 0,
visible: false,
managed: true,
sourceState: ol.source.State.READY,
sourceState: 'ready',
extent: undefined,
zIndex: 0,
maxResolution: Infinity,
@@ -197,7 +197,7 @@ describe('ol.layer.Layer', function() {
opacity: 1,
visible: true,
managed: true,
sourceState: ol.source.State.READY,
sourceState: 'ready',
extent: undefined,
zIndex: 0,
maxResolution: Infinity,
@@ -247,14 +247,14 @@ describe('ol.layer.Layer', function() {
var first = new ol.source.Source({projection: projection});
var layer = new ol.layer.Layer({source: first});
first.setState(ol.source.State.READY);
first.setState('ready');
expect(layer.handleSourceChange_.calledOnce).to.be(true);
var second = new ol.source.Source({projection: projection});
layer.set('source', second);
expect(layer.handleSourceChange_.calledOnce).to.be(true);
second.setState(ol.source.State.READY);
second.setState('ready');
expect(layer.handleSourceChange_.callCount).to.be(2);
// remove spy
@@ -293,14 +293,14 @@ describe('ol.layer.Layer', function() {
var first = new ol.source.Source({projection: projection});
var layer = new ol.layer.Layer({source: first});
first.setState(ol.source.State.READY);
first.setState('ready');
expect(layer.handleSourceChange_.calledOnce).to.be(true);
var second = new ol.source.Source({projection: projection});
layer.setSource(second);
expect(layer.handleSourceChange_.calledOnce).to.be(true);
second.setState(ol.source.State.READY);
second.setState('ready');
expect(layer.handleSourceChange_.callCount).to.be(2);
// remove spy
@@ -333,7 +333,7 @@ describe('ol.layer.Layer', function() {
it('triggers a change event', function() {
var listener = sinon.spy();
layer.on(ol.ObjectEventType.PROPERTYCHANGE, listener);
layer.on('propertychange', listener);
layer.setOpacity(0.4);
expect(listener.calledOnce).to.be(true);
});
@@ -366,7 +366,7 @@ describe('ol.layer.Layer', function() {
it('fires a change event', function() {
var listener = sinon.spy();
layer.on(ol.ObjectEventType.PROPERTYCHANGE, listener);
layer.on('propertychange', listener);
layer.setVisible(false);
expect(listener.callCount).to.be(1);
@@ -433,9 +433,7 @@ describe('ol.layer.Layer', function() {
});
goog.require('ol.Map');
goog.require('ol.ObjectEventType');
goog.require('ol.layer.Layer');
goog.require('ol.proj');
goog.require('ol.render.Event');
goog.require('ol.source.Source');
goog.require('ol.source.State');

View File

@@ -32,7 +32,7 @@ describe('ol.layer.Group', function() {
opacity: 1,
visible: true,
managed: true,
sourceState: ol.source.State.READY,
sourceState: 'ready',
extent: undefined,
zIndex: 0,
maxResolution: Infinity,
@@ -68,14 +68,14 @@ describe('ol.layer.Group', function() {
});
it('is dispatched by the group when layer opacity changes', function() {
group.on(ol.events.EventType.CHANGE, listener);
group.on('change', listener);
layer.setOpacity(0.5);
expect(listener.calledOnce).to.be(true);
});
it('is dispatched by the group when layer visibility changes', function() {
group.on(ol.events.EventType.CHANGE, listener);
group.on('change', listener);
layer.setVisible(false);
expect(listener.callCount).to.be(1);
@@ -107,14 +107,14 @@ describe('ol.layer.Group', function() {
});
it('is dispatched by the group when group opacity changes', function() {
group.on(ol.ObjectEventType.PROPERTYCHANGE, listener);
group.on('propertychange', listener);
group.setOpacity(0.5);
expect(listener.calledOnce).to.be(true);
});
it('is dispatched by the group when group visibility changes', function() {
group.on(ol.ObjectEventType.PROPERTYCHANGE, listener);
group.on('propertychange', listener);
group.setVisible(false);
expect(listener.callCount).to.be(1);
@@ -151,7 +151,7 @@ describe('ol.layer.Group', function() {
opacity: 0.5,
visible: false,
managed: true,
sourceState: ol.source.State.READY,
sourceState: 'ready',
extent: undefined,
zIndex: 10,
maxResolution: 500,
@@ -192,7 +192,7 @@ describe('ol.layer.Group', function() {
opacity: 0.5,
visible: false,
managed: true,
sourceState: ol.source.State.READY,
sourceState: 'ready',
extent: groupExtent,
zIndex: 0,
maxResolution: 500,
@@ -232,7 +232,7 @@ describe('ol.layer.Group', function() {
opacity: 0.3,
visible: false,
managed: true,
sourceState: ol.source.State.READY,
sourceState: 'ready',
extent: groupExtent,
zIndex: 10,
maxResolution: 500,
@@ -248,7 +248,7 @@ describe('ol.layer.Group', function() {
opacity: 0,
visible: false,
managed: true,
sourceState: ol.source.State.READY,
sourceState: 'ready',
extent: undefined,
zIndex: 0,
maxResolution: Infinity,
@@ -262,7 +262,7 @@ describe('ol.layer.Group', function() {
opacity: 1,
visible: true,
managed: true,
sourceState: ol.source.State.READY,
sourceState: 'ready',
extent: undefined,
zIndex: 0,
maxResolution: Infinity,
@@ -426,7 +426,7 @@ describe('ol.layer.Group', function() {
opacity: 0.25,
visible: false,
managed: true,
sourceState: ol.source.State.READY,
sourceState: 'ready',
extent: undefined,
zIndex: 0,
maxResolution: 150,
@@ -491,13 +491,10 @@ describe('ol.layer.Group', function() {
goog.require('ol.array');
goog.require('ol.Collection');
goog.require('ol.ObjectEventType');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol.extent');
goog.require('ol.layer.Group');
goog.require('ol.layer.Layer');
goog.require('ol.object');
goog.require('ol.renderer.Map');
goog.require('ol.source.Source');
goog.require('ol.source.State');

View File

@@ -116,7 +116,7 @@ describe('ol.Object', function() {
ol.events.listen(o, 'change:k', listener1);
listener2 = sinon.spy();
ol.events.listen(o, ol.ObjectEventType.PROPERTYCHANGE, listener2);
ol.events.listen(o, 'propertychange', listener2);
});
it('dispatches events', function() {
@@ -149,7 +149,7 @@ describe('ol.Object', function() {
ol.events.listen(o, 'change:k', listener1);
listener2 = sinon.spy();
ol.events.listen(o, ol.ObjectEventType.PROPERTYCHANGE, listener2);
ol.events.listen(o, 'propertychange', listener2);
});
it('dispatches events to object', function() {
@@ -240,5 +240,4 @@ describe('ol.Object', function() {
goog.require('ol.Object');
goog.require('ol.ObjectEventType');
goog.require('ol.events');

View File

@@ -448,7 +448,7 @@ describe('ol.proj', function() {
describe('ol.proj.removeTransform()', function() {
var extent = [180, -90, 180, 90];
var units = ol.proj.Units.DEGREES;
var units = 'degrees';
it('removes functions cached by addTransform', function() {
var foo = new ol.proj.Projection({
@@ -587,5 +587,4 @@ describe('ol.proj', function() {
goog.require('ol.proj');
goog.require('ol.proj.EPSG4326');
goog.require('ol.proj.Projection');
goog.require('ol.proj.Units');
goog.require('ol.proj.common');

View File

@@ -21,7 +21,7 @@ describe('ol.renderer.vector', function() {
listener = function() {};
listenerThis = {};
iconStyleLoadSpy = sinon.stub(iconStyle, 'load', function() {
iconStyle.iconImage_.imageState_ = ol.style.ImageState.LOADING;
iconStyle.iconImage_.imageState_ = 1; // LOADING
});
});
@@ -40,7 +40,7 @@ describe('ol.renderer.vector', function() {
expect(iconStyleLoadSpy.calledOnce).to.be.ok();
listeners = ol.events.getListeners(
iconStyle.iconImage_, ol.events.EventType.CHANGE);
iconStyle.iconImage_, 'change');
expect(listeners.length).to.eql(1);
// call #2
@@ -49,7 +49,7 @@ describe('ol.renderer.vector', function() {
expect(iconStyleLoadSpy.calledOnce).to.be.ok();
listeners = ol.events.getListeners(
iconStyle.iconImage_, ol.events.EventType.CHANGE);
iconStyle.iconImage_, 'change');
expect(listeners.length).to.eql(1);
});
@@ -60,7 +60,7 @@ describe('ol.renderer.vector', function() {
it('does not render the point', function() {
feature.setGeometry(new ol.geom.Point([0, 0]));
var imageReplay = replayGroup.getReplay(
style.getZIndex(), ol.render.ReplayType.IMAGE);
style.getZIndex(), 'Image');
var setImageStyleSpy = sinon.spy(imageReplay, 'setImageStyle');
var drawPointSpy = sinon.stub(imageReplay,
'drawPoint', ol.nullFunction);
@@ -74,7 +74,7 @@ describe('ol.renderer.vector', function() {
it('does not render the multipoint', function() {
feature.setGeometry(new ol.geom.MultiPoint([[0, 0], [1, 1]]));
var imageReplay = replayGroup.getReplay(
style.getZIndex(), ol.render.ReplayType.IMAGE);
style.getZIndex(), 'Image');
var setImageStyleSpy = sinon.spy(imageReplay, 'setImageStyle');
var drawMultiPointSpy = sinon.stub(imageReplay,
'drawMultiPoint', ol.nullFunction);
@@ -88,7 +88,7 @@ describe('ol.renderer.vector', function() {
it('does render the linestring', function() {
feature.setGeometry(new ol.geom.LineString([[0, 0], [1, 1]]));
var lineStringReplay = replayGroup.getReplay(
style.getZIndex(), ol.render.ReplayType.LINE_STRING);
style.getZIndex(), 'LineString');
var setFillStrokeStyleSpy = sinon.spy(lineStringReplay,
'setFillStrokeStyle');
var drawLineStringSpy = sinon.stub(lineStringReplay,
@@ -104,7 +104,7 @@ describe('ol.renderer.vector', function() {
it('does render the multilinestring', function() {
feature.setGeometry(new ol.geom.MultiLineString([[[0, 0], [1, 1]]]));
var lineStringReplay = replayGroup.getReplay(
style.getZIndex(), ol.render.ReplayType.LINE_STRING);
style.getZIndex(), 'LineString');
var setFillStrokeStyleSpy = sinon.spy(lineStringReplay,
'setFillStrokeStyle');
var drawMultiLineStringSpy = sinon.stub(lineStringReplay,
@@ -121,7 +121,7 @@ describe('ol.renderer.vector', function() {
feature.setGeometry(new ol.geom.Polygon(
[[[0, 0], [1, 1], [1, 0], [0, 0]]]));
var polygonReplay = replayGroup.getReplay(
style.getZIndex(), ol.render.ReplayType.POLYGON);
style.getZIndex(), 'Polygon');
var setFillStrokeStyleSpy = sinon.spy(polygonReplay,
'setFillStrokeStyle');
var drawPolygonSpy = sinon.stub(polygonReplay,
@@ -138,7 +138,7 @@ describe('ol.renderer.vector', function() {
feature.setGeometry(new ol.geom.MultiPolygon(
[[[[0, 0], [1, 1], [1, 0], [0, 0]]]]));
var polygonReplay = replayGroup.getReplay(
style.getZIndex(), ol.render.ReplayType.POLYGON);
style.getZIndex(), 'Polygon');
var setFillStrokeStyleSpy = sinon.spy(polygonReplay,
'setFillStrokeStyle');
var drawMultiPolygonSpy = sinon.stub(polygonReplay,
@@ -156,7 +156,6 @@ describe('ol.renderer.vector', function() {
});
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol.geom.LineString');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
@@ -167,7 +166,6 @@ goog.require('ol.render.canvas.ReplayGroup');
goog.require('ol.renderer.vector');
goog.require('ol.style.Fill');
goog.require('ol.style.Icon');
goog.require('ol.style.ImageState');
goog.require('ol.style.Stroke');
goog.require('ol.style.Style');
goog.require('ol.Feature');

View File

@@ -2,7 +2,7 @@ goog.provide('ol.test.renderer.Layer');
describe('ol.renderer.Layer', function() {
var renderer;
var eventType = ol.events.EventType.CHANGE;
var eventType = 'change';
beforeEach(function() {
var layer = new ol.layer.Layer({});
@@ -43,13 +43,13 @@ describe('ol.renderer.Layer', function() {
describe('load LOADED image', function() {
it('returns true', function() {
image.state = ol.ImageState.LOADED;
image.state = 2; // LOADED
var loaded = renderer.loadImage(image);
expect(loaded).to.be(true);
});
it('does not register a listener', function() {
image.state = ol.ImageState.LOADED;
image.state = 2; // LOADED
var loaded = renderer.loadImage(image);
expect(loaded).to.be(true);
});
@@ -60,7 +60,7 @@ describe('ol.renderer.Layer', function() {
beforeEach(function() {
renderer.loadImage(image);
expect(image.getState()).to.be(ol.ImageState.LOADING);
expect(image.getState()).to.be(1); // LOADING
});
it('returns false', function() {
@@ -79,8 +79,6 @@ describe('ol.renderer.Layer', function() {
});
});
goog.require('ol.events.EventType');
goog.require('ol.Image');
goog.require('ol.ImageState');
goog.require('ol.layer.Layer');
goog.require('ol.renderer.Layer');

View File

@@ -17,9 +17,9 @@ describe('ol.reproj.Image', function() {
it('changes state as expected', function(done) {
var image = createImage(1);
expect(image.getState()).to.be(ol.ImageState.IDLE);
expect(image.getState()).to.be(0); // IDLE
ol.events.listen(image, 'change', function() {
if (image.getState() == ol.ImageState.LOADED) {
if (image.getState() == 2) { // LOADED
done();
}
});
@@ -29,7 +29,7 @@ describe('ol.reproj.Image', function() {
it('returns correct canvas size', function(done) {
var image = createImage(1);
ol.events.listen(image, 'change', function() {
if (image.getState() == ol.ImageState.LOADED) {
if (image.getState() == 2) { // LOADED
var canvas = image.getImage();
expect(canvas.width).to.be(36);
expect(canvas.height).to.be(17);
@@ -42,7 +42,7 @@ describe('ol.reproj.Image', function() {
it('respects pixelRatio', function(done) {
var image = createImage(2);
ol.events.listen(image, 'change', function() {
if (image.getState() == ol.ImageState.LOADED) {
if (image.getState() == 2) { // LOADED
var canvas = image.getImage();
expect(canvas.width).to.be(72);
expect(canvas.height).to.be(34);
@@ -55,7 +55,6 @@ describe('ol.reproj.Image', function() {
goog.require('ol.Image');
goog.require('ol.ImageState');
goog.require('ol.events');
goog.require('ol.proj');
goog.require('ol.reproj.Image');

View File

@@ -22,7 +22,7 @@ describe('ol.reproj.Tile', function() {
proj3857, ol.tilegrid.createForProjection(proj3857), proj4326,
ol.tilegrid.createForProjection(proj4326, 3, opt_tileSize),
[3, 2, -2], null, pixelRatio, 0, function(z, x, y, pixelRatio) {
return new ol.ImageTile([z, x, y], ol.TileState.IDLE,
return new ol.ImageTile([z, x, y], 0, // IDLE
'data:image/gif;base64,' +
'R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=', null,
function(tile, src) {
@@ -33,9 +33,9 @@ describe('ol.reproj.Tile', function() {
it('changes state as expected', function(done) {
var tile = createTile(1);
expect(tile.getState()).to.be(ol.TileState.IDLE);
expect(tile.getState()).to.be(0); // IDLE
ol.events.listen(tile, 'change', function() {
if (tile.getState() == ol.TileState.LOADED) {
if (tile.getState() == 2) { // LOADED
done();
}
});
@@ -51,7 +51,7 @@ describe('ol.reproj.Tile', function() {
[0, -1, 0], null, 1, 0, function() {
expect().fail('No tiles should be required');
});
expect(tile.getState()).to.be(ol.TileState.EMPTY);
expect(tile.getState()).to.be(4); // EMPTY
});
it('is empty when outside source tile grid', function() {
@@ -63,13 +63,13 @@ describe('ol.reproj.Tile', function() {
[3, 2, -2], null, 1, 0, function() {
expect().fail('No tiles should be required');
});
expect(tile.getState()).to.be(ol.TileState.EMPTY);
expect(tile.getState()).to.be(4); // EMPTY
});
it('respects tile size of target tile grid', function(done) {
var tile = createTile(1, [100, 40]);
ol.events.listen(tile, 'change', function() {
if (tile.getState() == ol.TileState.LOADED) {
if (tile.getState() == 2) { // LOADED
var canvas = tile.getImage();
expect(canvas.width).to.be(100);
expect(canvas.height).to.be(40);
@@ -82,7 +82,7 @@ describe('ol.reproj.Tile', function() {
it('respects pixelRatio', function(done) {
var tile = createTile(3, [60, 20]);
ol.events.listen(tile, 'change', function() {
if (tile.getState() == ol.TileState.LOADED) {
if (tile.getState() == 2) { // LOADED
var canvas = tile.getImage();
expect(canvas.width).to.be(180);
expect(canvas.height).to.be(60);
@@ -95,7 +95,6 @@ describe('ol.reproj.Tile', function() {
goog.require('ol.ImageTile');
goog.require('ol.TileState');
goog.require('ol.events');
goog.require('ol.proj');
goog.require('ol.reproj.Tile');

View File

@@ -93,7 +93,7 @@ describe('ol.source.ImageWMS', function() {
});
it('sets MAP_RESOLUTION when the server is MapServer', function() {
options.serverType = ol.source.wms.ServerType.MAPSERVER;
options.serverType = 'mapserver';
var source = new ol.source.ImageWMS(options);
pixelRatio = 2;
var image = source.getImage(extent, resolution, pixelRatio, projection);
@@ -103,7 +103,7 @@ describe('ol.source.ImageWMS', function() {
});
it('sets FORMAT_OPTIONS when the server is GeoServer', function() {
options.serverType = ol.source.wms.ServerType.GEOSERVER;
options.serverType = 'geoserver';
var source = new ol.source.ImageWMS(options);
pixelRatio = 2;
var image = source.getImage(extent, resolution, pixelRatio, projection);
@@ -113,7 +113,7 @@ describe('ol.source.ImageWMS', function() {
});
it('extends FORMAT_OPTIONS if it is already present', function() {
options.serverType = ol.source.wms.ServerType.GEOSERVER;
options.serverType = 'geoserver';
var source = new ol.source.ImageWMS(options);
options.params.FORMAT_OPTIONS = 'param1:value1';
pixelRatio = 2;
@@ -125,7 +125,7 @@ describe('ol.source.ImageWMS', function() {
it('rounds FORMAT_OPTIONS to an integer when the server is GeoServer',
function() {
options.serverType = ol.source.wms.ServerType.GEOSERVER;
options.serverType = 'geoserver';
var source = new ol.source.ImageWMS(options);
pixelRatio = 1.325;
var image =
@@ -136,7 +136,7 @@ describe('ol.source.ImageWMS', function() {
});
it('sets DPI when the server is QGIS', function() {
options.serverType = ol.source.wms.ServerType.QGIS;
options.serverType = 'qgis';
var source = new ol.source.ImageWMS(options);
pixelRatio = 2;
var image = source.getImage(extent, resolution, pixelRatio, projection);
@@ -247,4 +247,3 @@ describe('ol.source.ImageWMS', function() {
goog.require('ol.source.ImageWMS');
goog.require('ol.proj');
goog.require('ol.source.wms.ServerType');

View File

@@ -59,7 +59,7 @@ describe('ol.source.TileImage', function() {
source.getKey = function() {
return 'key0';
};
tile.state = ol.TileState.LOADED;
tile.state = 2; // LOADED
var returnedTile = source.getTileInternal(
0, 0, -1, 1, ol.proj.get('EPSG:3857'));
expect(returnedTile).not.to.be(tile);
@@ -75,7 +75,7 @@ describe('ol.source.TileImage', function() {
return dynamicParamsKey;
};
dynamicParamsKey = 'key0';
tile.state = ol.TileState.LOADED;
tile.state = 2; // LOADED
returnedTile = source.getTileInternal(
0, 0, -1, 1, ol.proj.get('EPSG:3857'));
dynamicParamsKey = 'key1';
@@ -125,7 +125,7 @@ describe('ol.source.TileImage', function() {
expect(tile).to.be.a(ol.reproj.Tile);
ol.events.listen(tile, 'change', function() {
if (tile.getState() == ol.TileState.LOADED) {
if (tile.getState() == 2) { // LOADED
done();
}
});
@@ -144,7 +144,7 @@ describe('ol.source.TileImage', function() {
expect(tile).to.be.a(ol.reproj.Tile);
ol.events.listen(tile, 'change', function() {
if (tile.getState() == ol.TileState.LOADED) {
if (tile.getState() == 2) { // LOADED
done();
}
});
@@ -155,7 +155,6 @@ describe('ol.source.TileImage', function() {
goog.require('ol.ImageTile');
goog.require('ol.Tile');
goog.require('ol.TileState');
goog.require('ol.TileUrlFunction');
goog.require('ol.events');
goog.require('ol.proj');

View File

@@ -32,7 +32,7 @@ describe('ol.source.TileJSON', function() {
describe('#getState', function() {
it('returns ol.source.State.ERROR on HTTP 404', function() {
it('returns error on HTTP 404', function() {
var source = new ol.source.TileJSON({
url: 'invalid.jsonp'
});
@@ -42,7 +42,7 @@ describe('ol.source.TileJSON', function() {
});
});
it('returns ol.source.State.ERROR on CORS issues', function() {
it('returns error on CORS issues', function() {
var source = new ol.source.TileJSON({
url: 'http://example.com'
});
@@ -52,7 +52,7 @@ describe('ol.source.TileJSON', function() {
});
});
it('returns ol.source.State.ERROR on JSON parsing issues', function() {
it('returns error on JSON parsing issues', function() {
var source = new ol.source.TileJSON({
url: '/'
});
@@ -122,7 +122,6 @@ describe('ol.source.TileJSON', function() {
});
goog.require('ol.events');
goog.require('ol.source.State');
goog.require('ol.source.Source');
goog.require('ol.source.TileJSON');
goog.require('ol.Observable');

View File

@@ -87,10 +87,10 @@ describe('ol.source.Tile', function() {
it('calls callback for each loaded tile', function() {
var source = new ol.test.source.TileMock({
'1/0/0': ol.TileState.LOADED,
'1/0/1': ol.TileState.LOADED,
'1/1/0': ol.TileState.LOADING,
'1/1/1': ol.TileState.LOADED
'1/0/0': 2, // LOADED
'1/0/1': 2, // LOADED
'1/1/0': 1, // LOADING,
'1/1/1': 2 // LOADED
});
var zoom = 1;
@@ -103,10 +103,10 @@ describe('ol.source.Tile', function() {
it('returns true if range is fully loaded', function() {
// a source with no loaded tiles
var source = new ol.test.source.TileMock({
'1/0/0': ol.TileState.LOADED,
'1/0/1': ol.TileState.LOADED,
'1/1/0': ol.TileState.LOADED,
'1/1/1': ol.TileState.LOADED
'1/0/0': 2, // LOADED,
'1/0/1': 2, // LOADED,
'1/1/0': 2, // LOADED,
'1/1/1': 2 // LOADED
});
var zoom = 1;
@@ -123,10 +123,10 @@ describe('ol.source.Tile', function() {
it('returns false if range is not fully loaded', function() {
// a source with no loaded tiles
var source = new ol.test.source.TileMock({
'1/0/0': ol.TileState.LOADED,
'1/0/1': ol.TileState.LOADED,
'1/1/0': ol.TileState.LOADING,
'1/1/1': ol.TileState.LOADED
'1/0/0': 2, // LOADED,
'1/0/1': 2, // LOADED,
'1/1/0': 1, // LOADING,
'1/1/1': 2 // LOADED
});
var zoom = 1;
@@ -143,10 +143,10 @@ describe('ol.source.Tile', function() {
it('allows callback to override loaded check', function() {
// a source with no loaded tiles
var source = new ol.test.source.TileMock({
'1/0/0': ol.TileState.LOADED,
'1/0/1': ol.TileState.LOADED,
'1/1/0': ol.TileState.LOADED,
'1/1/1': ol.TileState.LOADED
'1/0/0': 2, // LOADED,
'1/0/1': 2, // LOADED,
'1/1/0': 2, // LOADED,
'1/1/1': 2 // LOADED
});
var zoom = 1;
@@ -215,7 +215,7 @@ describe('ol.source.Tile', function() {
it('checks clearing of internal state', function() {
// create a source with one loaded tile
var source = new ol.test.source.TileMock({
'1/0/0': ol.TileState.LOADED
'1/0/0': 2 // LOADED
});
// check the loaded tile is there
var tile = source.getTile(1, 0, 0);
@@ -269,7 +269,7 @@ ol.test.source.TileMock.prototype.getTile = function(z, x, y) {
if (this.tileCache.containsKey(key)) {
return /** @type {!ol.Tile} */ (this.tileCache.get(key));
} else {
var tile = new ol.Tile(key, ol.TileState.IDLE);
var tile = new ol.Tile(key, 0); // IDLE
this.tileCache.set(key, tile);
return tile;
}
@@ -289,25 +289,25 @@ describe('ol.test.source.TileMock', function() {
describe('#getTile()', function() {
it('returns a tile with state based on constructor arg', function() {
var source = new ol.test.source.TileMock({
'0/0/0': ol.TileState.LOADED,
'1/0/0': ol.TileState.LOADED
'0/0/0': 2, // LOADED,
'1/0/0': 2 // LOADED
});
var tile;
// check a loaded tile
tile = source.getTile(0, 0, 0);
expect(tile).to.be.a(ol.Tile);
expect(tile.state).to.be(ol.TileState.LOADED);
expect(tile.state).to.be(2); // LOADED
// check a tile that is not loaded
tile = source.getTile(1, 0, -1);
expect(tile).to.be.a(ol.Tile);
expect(tile.state).to.be(ol.TileState.IDLE);
expect(tile.state).to.be(0); // IDLE
// check another loaded tile
tile = source.getTile(1, 0, 0);
expect(tile).to.be.a(ol.Tile);
expect(tile.state).to.be(ol.TileState.LOADED);
expect(tile.state).to.be(2); // LOADED
});
});
@@ -316,7 +316,6 @@ describe('ol.test.source.TileMock', function() {
goog.require('ol.Tile');
goog.require('ol.TileRange');
goog.require('ol.TileState');
goog.require('ol.proj');
goog.require('ol.proj.Projection');
goog.require('ol.source.Source');

View File

@@ -57,11 +57,11 @@ describe('ol.source.TileUTFGrid', function() {
var source = new ol.source.TileUTFGrid({
url: url
});
expect(source.getState()).to.be(ol.source.State.LOADING);
expect(source.getState()).to.be('loading');
expect(source.tileGrid).to.be(null);
source.on('change', function(event) {
if (source.getState() === ol.source.State.READY) {
if (source.getState() === 'ready') {
expect(source.tileGrid).to.be.an(ol.tilegrid.TileGrid);
done();
}
@@ -74,11 +74,11 @@ describe('ol.source.TileUTFGrid', function() {
var source = new ol.source.TileUTFGrid({
url: 'Bogus UTFGrid URL'
});
expect(source.getState()).to.be(ol.source.State.LOADING);
expect(source.getState()).to.be('loading');
expect(source.tileGrid).to.be(null);
source.on('change', function(event) {
if (source.getState() === ol.source.State.ERROR) {
if (source.getState() === 'error') {
expect(source.tileGrid).to.be(null);
done();
}
@@ -178,13 +178,13 @@ describe('ol.source.TileUTFGrid', function() {
it('sets correct state', function() {
var source = getTileUTFGrid();
expect(source.getState()).to.be(ol.source.State.LOADING);
expect(source.getState()).to.be('loading');
// call the handleTileJSONResponse method with our
// locally available tileJson (from `before`)
source.handleTileJSONResponse(tileJson);
expect(source.getState()).to.be(ol.source.State.READY);
expect(source.getState()).to.be('ready');
});
});
@@ -232,7 +232,7 @@ describe('ol.source.TileUTFGrid', function() {
var tileUrl = this.tileUrlFunction_(urlTileCoord, pixelRatio, projection);
var tile = new ol.source.TileUTFGridTile_(
tileCoord,
tileUrl !== undefined ? ol.TileState.IDLE : ol.TileState.EMPTY,
tileUrl !== undefined ? 0 : 4, // IDLE : EMPTY
tileUrl !== undefined ? tileUrl : '',
this.tileGrid.getTileCoordExtent(tileCoord),
true); // always preemptive, so loading doesn't happen automatically
@@ -288,8 +288,6 @@ describe('ol.source.TileUTFGrid', function() {
goog.require('ol.net');
goog.require('ol.proj');
goog.require('ol.source.State');
goog.require('ol.source.Tile');
goog.require('ol.source.TileUTFGrid');
goog.require('ol.tilegrid.TileGrid');
goog.require('ol.TileState');

View File

@@ -118,7 +118,7 @@ describe('ol.source.TileWMS', function() {
});
it('sets FORMAT_OPTIONS when the server is GeoServer', function() {
options.serverType = ol.source.wms.ServerType.GEOSERVER;
options.serverType = 'geoserver';
var source = new ol.source.TileWMS(options);
var tile = source.getTile(3, 2, -3, 2, ol.proj.get('CRS:84'));
var uri = new URL(tile.src_);
@@ -127,7 +127,7 @@ describe('ol.source.TileWMS', function() {
});
it('extends FORMAT_OPTIONS if it is already present', function() {
options.serverType = ol.source.wms.ServerType.GEOSERVER;
options.serverType = 'geoserver';
var source = new ol.source.TileWMS(options);
options.params.FORMAT_OPTIONS = 'param1:value1';
var tile = source.getTile(3, 2, -3, 2, ol.proj.get('CRS:84'));
@@ -138,7 +138,7 @@ describe('ol.source.TileWMS', function() {
it('rounds FORMAT_OPTIONS to an integer when the server is GeoServer',
function() {
options.serverType = ol.source.wms.ServerType.GEOSERVER;
options.serverType = 'geoserver';
var source = new ol.source.TileWMS(options);
var tile = source.getTile(3, 2, -3, 1.325, ol.proj.get('CRS:84'));
var uri = new URL(tile.src_);
@@ -270,6 +270,5 @@ describe('ol.source.TileWMS', function() {
goog.require('ol.ImageTile');
goog.require('ol.source.TileWMS');
goog.require('ol.source.wms.ServerType');
goog.require('ol.proj');
goog.require('ol.tilegrid.TileGrid');

View File

@@ -217,12 +217,12 @@ describe('ol.source.Zoomify', function() {
var tile = source.getTile(0, 0, -1, 1, proj);
ol.events.listen(tile, 'change', function() {
if (tile.getState() == ol.TileState.LOADED) {
if (tile.getState() == 2) { // LOADED
var img = tile.getImage(context);
expect(img).to.be.a(HTMLCanvasElement);
var tile2 = source.getTile(0, 0, -1, 1, proj);
expect(tile2.getState()).to.be(ol.TileState.LOADED);
expect(tile2.getState()).to.be(2); // LOADED
var img2 = tile2.getImage(context);
expect(img).to.be(img2);
done();
@@ -262,5 +262,4 @@ goog.require('ol.dom');
goog.require('ol.events');
goog.require('ol.proj.Projection');
goog.require('ol.source.Zoomify');
goog.require('ol.TileState');
goog.require('ol.tilegrid.TileGrid');

View File

@@ -2,8 +2,6 @@ goog.provide('ol.test.style.Icon');
goog.provide('ol.test.style.IconImageCache');
goog.require('ol.style.Icon');
goog.require('ol.style.IconAnchorUnits');
goog.require('ol.style.IconOrigin');
describe('ol.style.Icon', function() {
@@ -55,8 +53,8 @@ describe('ol.style.Icon', function() {
src: 'test.png',
size: size,
anchor: [2, 18],
anchorXUnits: ol.style.IconAnchorUnits.PIXELS,
anchorYUnits: ol.style.IconAnchorUnits.PIXELS
anchorXUnits: 'pixels',
anchorYUnits: 'pixels'
});
expect(iconStyle.getAnchor()).to.eql([2, 18]);
});
@@ -66,7 +64,7 @@ describe('ol.style.Icon', function() {
src: 'test.png',
size: size,
anchor: fractionAnchor,
anchorOrigin: ol.style.IconOrigin.BOTTOM_LEFT
anchorOrigin: 'bottom-left'
});
expect(iconStyle.getAnchor()).to.eql([9, 36]);
});
@@ -76,7 +74,7 @@ describe('ol.style.Icon', function() {
src: 'test.png',
size: size,
anchor: fractionAnchor,
anchorOrigin: ol.style.IconOrigin.BOTTOM_RIGHT
anchorOrigin: 'bottom-right'
});
expect(iconStyle.getAnchor()).to.eql([27, 36]);
});
@@ -86,7 +84,7 @@ describe('ol.style.Icon', function() {
src: 'test.png',
size: size,
anchor: fractionAnchor,
anchorOrigin: ol.style.IconOrigin.TOP_RIGHT
anchorOrigin: 'top-right'
});
expect(iconStyle.getAnchor()).to.eql([27, 12]);
});
@@ -110,7 +108,7 @@ describe('ol.style.Icon', function() {
src: 'test.png',
size: size,
offset: offset,
offsetOrigin: ol.style.IconOrigin.BOTTOM_LEFT
offsetOrigin: 'bottom-left'
});
iconStyle.iconImage_.size_ = imageSize;
expect(iconStyle.getOrigin()).to.eql([16, 124]);
@@ -121,7 +119,7 @@ describe('ol.style.Icon', function() {
src: 'test.png',
size: size,
offset: offset,
offsetOrigin: ol.style.IconOrigin.BOTTOM_RIGHT
offsetOrigin: 'bottom-right'
});
iconStyle.iconImage_.size_ = imageSize;
expect(iconStyle.getOrigin()).to.eql([92, 124]);
@@ -132,7 +130,7 @@ describe('ol.style.Icon', function() {
src: 'test.png',
size: size,
offset: offset,
offsetOrigin: ol.style.IconOrigin.TOP_RIGHT
offsetOrigin: 'top-right'
});
iconStyle.iconImage_.size_ = imageSize;
expect(iconStyle.getOrigin()).to.eql([92, 20]);
@@ -209,14 +207,14 @@ describe('ol.style.IconImageCache', function() {
src = '0';
iconImage = new ol.style.IconImage_(src, null);
ol.events.listen(iconImage, ol.events.EventType.CHANGE,
ol.events.listen(iconImage, 'change',
ol.nullFunction, false);
cache.set(src, null, null, iconImage);
expect(cache.cacheSize_).to.eql(4);
src = '4';
iconImage = new ol.style.IconImage_(src, null);
ol.events.listen(iconImage, ol.events.EventType.CHANGE,
ol.events.listen(iconImage, 'change',
ol.nullFunction, false);
cache.set(src, null, null, iconImage);
expect(cache.cacheSize_).to.eql(5);
@@ -233,5 +231,4 @@ describe('ol.style.IconImageCache', function() {
});
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol.style.IconImageCache');

View File

@@ -336,7 +336,7 @@ describe('ol.tilegrid.TileGrid', function() {
var grid = ol.tilegrid.createForProjection(projection);
var resolutions = grid.getResolutions();
expect(resolutions[5]).to.be(
360 * ol.proj.METERS_PER_UNIT[ol.proj.Units.DEGREES] /
360 * ol.proj.METERS_PER_UNIT['degrees'] /
ol.DEFAULT_TILE_SIZE / Math.pow(2, 5));
});
@@ -351,7 +351,7 @@ describe('ol.tilegrid.TileGrid', function() {
it('accepts bottom-left as corner', function() {
var projection = ol.proj.get('EPSG:3857');
var grid = ol.tilegrid.createForProjection(
projection, undefined, undefined, ol.extent.Corner.BOTTOM_LEFT);
projection, undefined, undefined, 'bottom-left');
var origin = grid.getOrigin();
var half = ol.proj.EPSG3857.HALF_SIZE;
expect(origin).to.eql([-half, -half]);
@@ -360,7 +360,7 @@ describe('ol.tilegrid.TileGrid', function() {
it('accepts bottom-right as corner', function() {
var projection = ol.proj.get('EPSG:3857');
var grid = ol.tilegrid.createForProjection(
projection, undefined, undefined, ol.extent.Corner.BOTTOM_RIGHT);
projection, undefined, undefined, 'bottom-right');
var origin = grid.getOrigin();
var half = ol.proj.EPSG3857.HALF_SIZE;
expect(origin).to.eql([half, -half]);
@@ -369,7 +369,7 @@ describe('ol.tilegrid.TileGrid', function() {
it('accepts top-left as corner', function() {
var projection = ol.proj.get('EPSG:3857');
var grid = ol.tilegrid.createForProjection(
projection, undefined, undefined, ol.extent.Corner.TOP_LEFT);
projection, undefined, undefined, 'top-left');
var origin = grid.getOrigin();
var half = ol.proj.EPSG3857.HALF_SIZE;
expect(origin).to.eql([-half, half]);
@@ -378,7 +378,7 @@ describe('ol.tilegrid.TileGrid', function() {
it('accepts top-right as corner', function() {
var projection = ol.proj.get('EPSG:3857');
var grid = ol.tilegrid.createForProjection(
projection, undefined, undefined, ol.extent.Corner.TOP_RIGHT);
projection, undefined, undefined, 'top-right');
var origin = grid.getOrigin();
var half = ol.proj.EPSG3857.HALF_SIZE;
expect(origin).to.eql([half, half]);
@@ -1094,12 +1094,10 @@ describe('ol.tilegrid.TileGrid', function() {
});
goog.require('ol.extent');
goog.require('ol.extent.Corner');
goog.require('ol.proj');
goog.require('ol.proj.METERS_PER_UNIT');
goog.require('ol.proj');
goog.require('ol.proj.EPSG3857');
goog.require('ol.proj.Projection');
goog.require('ol.proj.Units');
goog.require('ol.TileRange');
goog.require('ol.tilegrid.TileGrid');

View File

@@ -17,7 +17,7 @@ describe('ol.TileQueue', function() {
function createImageTile(opt_tileLoadFunction) {
++tileId;
var tileCoord = [tileId, tileId, tileId];
var state = ol.TileState.IDLE;
var state = 0; // IDLE
var src = 'data:image/gif;base64,R0lGODlhAQABAPAAAP8AAP///' +
'yH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==#' + tileId;
@@ -129,14 +129,14 @@ describe('ol.TileQueue', function() {
it('abort queued tiles', function() {
var tq = new ol.TileQueue(noop, noop);
var tile = createImageTile();
expect(tile.hasListener(ol.events.EventType.CHANGE)).to.be(false);
expect(tile.hasListener('change')).to.be(false);
tq.enqueue([tile]);
expect(tile.hasListener(ol.events.EventType.CHANGE)).to.be(true);
expect(tile.hasListener('change')).to.be(true);
tile.dispose();
expect(tile.hasListener(ol.events.EventType.CHANGE)).to.be(false);
expect(tile.getState()).to.eql(ol.TileState.ABORT);
expect(tile.hasListener('change')).to.be(false);
expect(tile.getState()).to.eql(5); // ABORT
});
it('abort loading tiles', function() {
@@ -146,12 +146,12 @@ describe('ol.TileQueue', function() {
tq.enqueue([tile]);
tq.loadMoreTiles(Infinity, Infinity);
expect(tq.getTilesLoading()).to.eql(1);
expect(tile.getState()).to.eql(ol.TileState.LOADING);
expect(tile.getState()).to.eql(1); // LOADING
tile.dispose();
expect(tq.getTilesLoading()).to.eql(0);
expect(tile.hasListener(ol.events.EventType.CHANGE)).to.be(false);
expect(tile.getState()).to.eql(ol.TileState.ABORT);
expect(tile.hasListener('change')).to.be(false);
expect(tile.getState()).to.eql(5); // ABORT
});
@@ -161,8 +161,6 @@ describe('ol.TileQueue', function() {
goog.require('ol.ImageTile');
goog.require('ol.Tile');
goog.require('ol.TileState');
goog.require('ol.TileQueue');
goog.require('ol.events.EventType');
goog.require('ol.source.Image');
goog.require('ol.structs.PriorityQueue');

View File

@@ -14,9 +14,9 @@ describe('ol.rendering.reproj.Image', function() {
imagesRequested++;
return source.getImage(extent, resolution, pixelRatio, sourceProj);
});
if (image.getState() == ol.ImageState.IDLE) {
if (image.getState() == 0) { // IDLE
ol.events.listen(image, 'change', function(e) {
if (image.getState() == ol.ImageState.LOADED) {
if (image.getState() == 2) { // LOADED
expect(imagesRequested).to.be(1);
resembleCanvas(image.getImage(), expectedUrl, IMAGE_TOLERANCE, done);
}
@@ -58,4 +58,3 @@ goog.require('ol.proj');
goog.require('ol.proj.EPSG3857');
goog.require('ol.reproj.Image');
goog.require('ol.source.ImageStatic');
goog.require('ol.ImageState');