Use a mock format instead of ol.format.MVT in tests
This commit is contained in:
@@ -2,9 +2,10 @@ goog.provide('ol.test.featureloader');
|
|||||||
|
|
||||||
goog.require('ol.events');
|
goog.require('ol.events');
|
||||||
goog.require('ol.VectorTile');
|
goog.require('ol.VectorTile');
|
||||||
|
goog.require('ol.Feature');
|
||||||
goog.require('ol.featureloader');
|
goog.require('ol.featureloader');
|
||||||
goog.require('ol.format.GeoJSON');
|
goog.require('ol.format.GeoJSON');
|
||||||
goog.require('ol.format.MVT');
|
goog.require('ol.format.TextFeature');
|
||||||
goog.require('ol.proj');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.source.Vector');
|
goog.require('ol.source.Vector');
|
||||||
|
|
||||||
@@ -85,18 +86,28 @@ describe('ol.featureloader', function() {
|
|||||||
loader.call(tile, [], 1, ol.proj.get('EPSG:3857'));
|
loader.call(tile, [], 1, ol.proj.get('EPSG:3857'));
|
||||||
});
|
});
|
||||||
|
|
||||||
(typeof ArrayBuffer == 'function' ? it : xit)(
|
it('sets features on the tile and updates proj units', function(done) {
|
||||||
'sets features on the tile and updates proj units', function(done) {
|
// mock format that return a tile-pixels feature
|
||||||
var url = 'spec/ol/data/14-8938-5680.vector.pbf';
|
var format = new ol.format.TextFeature();
|
||||||
var format = new ol.format.MVT();
|
format.readProjection = function(source) {
|
||||||
loader = ol.featureloader.tile(url, format);
|
return new ol.proj.Projection({
|
||||||
ol.events.listen(tile, 'change', function(e) {
|
code: '',
|
||||||
expect(tile.getFeatures().length).to.be.greaterThan(0);
|
units: 'tile-pixels'
|
||||||
expect(tile.getProjection().getUnits()).to.be('tile-pixels');
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
loader.call(tile, [], 1, ol.proj.get('EPSG:3857'));
|
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
format.readFeatures = function(source, options) {
|
||||||
|
return [new ol.Feature()];
|
||||||
|
};
|
||||||
|
|
||||||
|
var url = 'spec/ol/data/point.json';
|
||||||
|
loader = ol.featureloader.tile(url, format);
|
||||||
|
ol.events.listen(tile, 'change', function(e) {
|
||||||
|
expect(tile.getFeatures().length).to.be.greaterThan(0);
|
||||||
|
expect(tile.getProjection().getUnits()).to.be('tile-pixels');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
loader.call(tile, [], 1, ol.proj.get('EPSG:3857'));
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user