Switch map and layer constructor in tests

The webgl tests do not run currently (which is why these have not been failing).
This commit is contained in:
Tim Schaub
2018-11-04 20:29:54 -07:00
parent ca5b0c63a5
commit a69eeceeba
14 changed files with 122 additions and 89 deletions

View File

@@ -2,8 +2,10 @@ import Feature from '../../../../src/ol/Feature.js';
import Point from '../../../../src/ol/geom/Point.js';
import MultiPoint from '../../../../src/ol/geom/MultiPoint.js';
import Map from '../../../../src/ol/Map.js';
import WebGLMap from '../../../../src/ol/WebGLMap.js';
import View from '../../../../src/ol/View.js';
import VectorLayer from '../../../../src/ol/layer/Vector.js';
import WebGLVectorLayer from '../../../../src/ol/layer/Vector.js';
import VectorSource from '../../../../src/ol/source/Vector.js';
import CircleStyle from '../../../../src/ol/style/Circle.js';
import Fill from '../../../../src/ol/style/Fill.js';
@@ -16,15 +18,17 @@ describe('ol.rendering.style.Circle', function() {
let map, vectorSource;
function createMap(renderer) {
const MapConstructor = renderer === 'webgl' ? WebGLMap : Map;
const LayerConstructor = renderer === 'webgl' ? WebGLVectorLayer : VectorLayer;
vectorSource = new VectorSource();
const vectorLayer = new VectorLayer({
const vectorLayer = new LayerConstructor({
source: vectorSource
});
map = new Map({
map = new MapConstructor({
pixelRatio: 1,
target: createMapDiv(50, 50),
renderer: renderer,
layers: [vectorLayer],
view: new View({
projection: 'EPSG:4326',

View File

@@ -1,8 +1,10 @@
import Feature from '../../../../src/ol/Feature.js';
import Point from '../../../../src/ol/geom/Point.js';
import Map from '../../../../src/ol/Map.js';
import WebGLMap from '../../../../src/ol/WebGLMap.js';
import View from '../../../../src/ol/View.js';
import VectorLayer from '../../../../src/ol/layer/Vector.js';
import WebGLVectorLayer from '../../../../src/ol/layer/Vector.js';
import VectorSource from '../../../../src/ol/source/Vector.js';
import Icon from '../../../../src/ol/style/Icon.js';
import Style from '../../../../src/ol/style/Style.js';
@@ -22,15 +24,17 @@ describe('ol.rendering.style.Icon', function() {
};
function createMap(renderer, width, height) {
const MapConstructor = renderer === 'webgl' ? WebGLMap : Map;
const LayerConstructor = renderer === 'webgl' ? WebGLVectorLayer : VectorLayer;
vectorSource = new VectorSource();
const vectorLayer = new VectorLayer({
const vectorLayer = new LayerConstructor({
source: vectorSource
});
map = new Map({
map = new MapConstructor({
pixelRatio: 1,
target: createMapDiv(width ? width : 50, height ? height : 50),
renderer: renderer,
layers: [vectorLayer],
view: new View({
projection: 'EPSG:4326',

View File

@@ -1,8 +1,10 @@
import Feature from '../../../../src/ol/Feature.js';
import LineString from '../../../../src/ol/geom/LineString.js';
import Map from '../../../../src/ol/Map.js';
import WebGLMap from '../../../../src/ol/WebGLMap.js';
import View from '../../../../src/ol/View.js';
import VectorLayer from '../../../../src/ol/layer/Vector.js';
import WebGLVectorLayer from '../../../../src/ol/layer/Vector.js';
import VectorSource from '../../../../src/ol/source/Vector.js';
import Style from '../../../../src/ol/style/Style.js';
import Stroke from '../../../../src/ol/style/Stroke.js';
@@ -13,15 +15,17 @@ describe('ol.rendering.style.LineString', function() {
let map, vectorSource;
function createMap(renderer, opt_pixelRatio) {
const MapConstructor = renderer === 'webgl' ? WebGLMap : Map;
const LayerConstructor = renderer === 'webgl' ? WebGLVectorLayer : VectorLayer;
vectorSource = new VectorSource();
const vectorLayer = new VectorLayer({
const vectorLayer = new LayerConstructor({
source: vectorSource
});
map = new Map({
map = new MapConstructor({
pixelRatio: opt_pixelRatio || 1,
target: createMapDiv(50, 50),
renderer: renderer,
layers: [vectorLayer],
view: new View({
projection: 'EPSG:4326',

View File

@@ -1,8 +1,10 @@
import Feature from '../../../../src/ol/Feature.js';
import Polygon from '../../../../src/ol/geom/Polygon.js';
import Map from '../../../../src/ol/Map.js';
import WebGLMap from '../../../../src/ol/WebGLMap.js';
import View from '../../../../src/ol/View.js';
import VectorLayer from '../../../../src/ol/layer/Vector.js';
import WebGLVectorLayer from '../../../../src/ol/layer/Vector.js';
import VectorSource from '../../../../src/ol/source/Vector.js';
import Fill from '../../../../src/ol/style/Fill.js';
import Style from '../../../../src/ol/style/Style.js';
@@ -14,17 +16,19 @@ describe('ol.rendering.style.Polygon', function() {
let map, vectorSource;
function createMap(renderer, opt_size) {
const MapConstructor = renderer === 'webgl' ? WebGLMap : Map;
const LayerConstructor = renderer === 'webgl' ? WebGLVectorLayer : VectorLayer;
const size = opt_size || 50;
vectorSource = new VectorSource();
const vectorLayer = new VectorLayer({
const vectorLayer = new LayerConstructor({
source: vectorSource
});
map = new Map({
map = new MapConstructor({
pixelRatio: 1,
target: createMapDiv(size, size),
renderer: renderer,
layers: [vectorLayer],
view: new View({
projection: 'EPSG:4326',

View File

@@ -1,8 +1,10 @@
import Feature from '../../../../src/ol/Feature.js';
import Point from '../../../../src/ol/geom/Point.js';
import Map from '../../../../src/ol/Map.js';
import WebGLMap from '../../../../src/ol/WebGLMap.js';
import View from '../../../../src/ol/View.js';
import VectorLayer from '../../../../src/ol/layer/Vector.js';
import WebGLVectorLayer from '../../../../src/ol/layer/Vector.js';
import VectorSource from '../../../../src/ol/source/Vector.js';
import Fill from '../../../../src/ol/style/Fill.js';
import RegularShape from '../../../../src/ol/style/RegularShape.js';
@@ -15,15 +17,17 @@ describe('ol.rendering.style.RegularShape', function() {
let map, vectorSource;
function createMap(renderer) {
const MapConstructor = renderer === 'webgl' ? WebGLMap : Map;
const LayerConstructor = renderer === 'webgl' ? WebGLVectorLayer : VectorLayer;
vectorSource = new VectorSource();
const vectorLayer = new VectorLayer({
const vectorLayer = new LayerConstructor({
source: vectorSource
});
map = new Map({
map = new MapConstructor({
pixelRatio: 1,
target: createMapDiv(50, 50),
renderer: renderer,
layers: [vectorLayer],
view: new View({
projection: 'EPSG:4326',

View File

@@ -5,8 +5,10 @@ import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js';
import Point from '../../../../src/ol/geom/Point.js';
import Polygon from '../../../../src/ol/geom/Polygon.js';
import Map from '../../../../src/ol/Map.js';
import WebGLMap from '../../../../src/ol/WebGLMap.js';
import View from '../../../../src/ol/View.js';
import VectorLayer from '../../../../src/ol/layer/Vector.js';
import WebGLVectorLayer from '../../../../src/ol/layer/Vector.js';
import VectorSource from '../../../../src/ol/source/Vector.js';
import Text from '../../../../src/ol/style/Text.js';
import Fill from '../../../../src/ol/style/Fill.js';
@@ -18,16 +20,18 @@ describe('ol.rendering.style.Text', function() {
let map, vectorSource;
function createMap(renderer, opt_pixelRatio) {
const MapConstructor = renderer === 'webgl' ? WebGLMap : Map;
const LayerConstructor = renderer === 'webgl' ? WebGLVectorLayer : VectorLayer;
const pixelRatio = opt_pixelRatio || 1;
vectorSource = new VectorSource();
const vectorLayer = new VectorLayer({
const vectorLayer = new LayerConstructor({
source: vectorSource
});
map = new Map({
map = new MapConstructor({
pixelRatio: pixelRatio,
target: createMapDiv(200 / pixelRatio, 200 / pixelRatio),
renderer: renderer,
layers: [vectorLayer],
view: new View({
projection: 'EPSG:4326',