diff --git a/debug/canvas.html b/debug/canvas.html
new file mode 100644
index 00000000000..3b2a0087df6
--- /dev/null
+++ b/debug/canvas.html
@@ -0,0 +1,80 @@
+
+
+
+
 |
-
+
- diff: <%- r.difference %>
- zoom: <%- r.zoom %>
diff --git a/test/integration/render-tests/debug/collision-pitched-wrapped/expected.png b/test/integration/render-tests/debug/collision-pitched-wrapped/expected.png
new file mode 100644
index 00000000000..c1ff274b1fe
Binary files /dev/null and b/test/integration/render-tests/debug/collision-pitched-wrapped/expected.png differ
diff --git a/test/integration/render-tests/debug/collision-pitched-wrapped/style.json b/test/integration/render-tests/debug/collision-pitched-wrapped/style.json
new file mode 100644
index 00000000000..6515c0a22b2
--- /dev/null
+++ b/test/integration/render-tests/debug/collision-pitched-wrapped/style.json
@@ -0,0 +1,51 @@
+{
+ "version": 8,
+ "metadata": {
+ "test": {
+ "ignored": {
+ "native": "https://github.com/mapbox/mapbox-gl-native/issues/8967"
+ },
+ "collisionDebug": true,
+ "debug": true,
+ "width": 500,
+ "height": 500
+ }
+ },
+ "center": [
+ 0,
+ 0
+ ],
+ "zoom": 1,
+ "pitch": 60,
+ "bearing": 90,
+ "sources": {
+ "geojson": {
+ "type": "geojson",
+ "data": "local://data/places.geojson"
+ }
+ },
+ "glyphs": "local://glyphs/{fontstack}/{range}.pbf",
+ "sprite": "local://sprites/sprite",
+ "layers": [
+ {
+ "id": "background",
+ "type": "background",
+ "paint": {
+ "background-color": "white"
+ }
+ },
+ {
+ "id": "symbol",
+ "type": "symbol",
+ "source": "geojson",
+ "layout": {
+ "symbol-placement": "point",
+ "text-field": "test test test",
+ "text-font": [
+ "Open Sans Semibold",
+ "Arial Unicode MS Bold"
+ ]
+ }
+ }
+ ]
+}
diff --git a/test/integration/render-tests/debug/collision-pitched/expected.png b/test/integration/render-tests/debug/collision-pitched/expected.png
new file mode 100644
index 00000000000..c38a733eea1
Binary files /dev/null and b/test/integration/render-tests/debug/collision-pitched/expected.png differ
diff --git a/test/integration/render-tests/debug/collision-pitched/style.json b/test/integration/render-tests/debug/collision-pitched/style.json
new file mode 100644
index 00000000000..00cf43617fd
--- /dev/null
+++ b/test/integration/render-tests/debug/collision-pitched/style.json
@@ -0,0 +1,51 @@
+{
+ "version": 8,
+ "metadata": {
+ "test": {
+ "ignored": {
+ "native": "https://github.com/mapbox/mapbox-gl-native/issues/8967"
+ },
+ "collisionDebug": true,
+ "debug": true,
+ "width": 500,
+ "height": 500
+ }
+ },
+ "center": [
+ 0,
+ 0
+ ],
+ "zoom": 3,
+ "pitch": 60,
+ "bearing": 90,
+ "sources": {
+ "geojson": {
+ "type": "geojson",
+ "data": "local://data/places.geojson"
+ }
+ },
+ "glyphs": "local://glyphs/{fontstack}/{range}.pbf",
+ "sprite": "local://sprites/sprite",
+ "layers": [
+ {
+ "id": "background",
+ "type": "background",
+ "paint": {
+ "background-color": "white"
+ }
+ },
+ {
+ "id": "symbol",
+ "type": "symbol",
+ "source": "geojson",
+ "layout": {
+ "symbol-placement": "point",
+ "text-field": "test test test",
+ "text-font": [
+ "Open Sans Semibold",
+ "Arial Unicode MS Bold"
+ ]
+ }
+ }
+ ]
+}
diff --git a/test/integration/render-tests/icon-pitch-scaling/rotation-alignment-map/expected.png b/test/integration/render-tests/icon-pitch-scaling/rotation-alignment-map/expected.png
new file mode 100644
index 00000000000..de8bdc7b3ee
Binary files /dev/null and b/test/integration/render-tests/icon-pitch-scaling/rotation-alignment-map/expected.png differ
diff --git a/test/integration/render-tests/icon-pitch-scaling/rotation-alignment-map/style.json b/test/integration/render-tests/icon-pitch-scaling/rotation-alignment-map/style.json
new file mode 100644
index 00000000000..a6492c76726
--- /dev/null
+++ b/test/integration/render-tests/icon-pitch-scaling/rotation-alignment-map/style.json
@@ -0,0 +1,56 @@
+{
+ "version": 8,
+ "metadata": {
+ "test": {
+ "ignored": {
+ "native": "https://github.com/mapbox/mapbox-gl-native/issues/8967"
+ },
+ "height": 512
+ }
+ },
+ "center": [
+ 13.418056,
+ 52.499167
+ ],
+ "zoom": 14,
+ "pitch": 30,
+ "sources": {
+ "mapbox": {
+ "type": "vector",
+ "maxzoom": 14,
+ "tiles": [
+ "local://tiles/{z}-{x}-{y}.mvt"
+ ]
+ }
+ },
+ "sprite": "local://sprites/sprite",
+ "glyphs": "local://glyphs/{fontstack}/{range}.pbf",
+ "layers": [
+ {
+ "id": "background",
+ "type": "background",
+ "paint": {
+ "background-color": "white"
+ }
+ },
+ {
+ "id": "icon",
+ "type": "symbol",
+ "source": "mapbox",
+ "source-layer": "poi_label",
+ "filter": [
+ "==",
+ "maki",
+ "restaurant"
+ ],
+ "layout": {
+ "symbol-placement": "point",
+ "icon-rotation-alignment": "map",
+ "icon-allow-overlap": true,
+ "icon-ignore-placement": true,
+ "icon-image": "building-12"
+ },
+ "paint": {}
+ }
+ ]
+}
diff --git a/test/integration/render-tests/icon-pitch-scaling/rotation-alignment-viewport/expected.png b/test/integration/render-tests/icon-pitch-scaling/rotation-alignment-viewport/expected.png
new file mode 100644
index 00000000000..ba821ba7188
Binary files /dev/null and b/test/integration/render-tests/icon-pitch-scaling/rotation-alignment-viewport/expected.png differ
diff --git a/test/integration/render-tests/icon-pitch-scaling/rotation-alignment-viewport/style.json b/test/integration/render-tests/icon-pitch-scaling/rotation-alignment-viewport/style.json
new file mode 100644
index 00000000000..b26fc5d5f5d
--- /dev/null
+++ b/test/integration/render-tests/icon-pitch-scaling/rotation-alignment-viewport/style.json
@@ -0,0 +1,55 @@
+{
+ "version": 8,
+ "metadata": {
+ "test": {
+ "ignored": {
+ "native": "https://github.com/mapbox/mapbox-gl-native/issues/8967"
+ },
+ "height": 512
+ }
+ },
+ "center": [
+ 13.418056,
+ 52.499167
+ ],
+ "zoom": 14,
+ "pitch": 30,
+ "sources": {
+ "mapbox": {
+ "type": "vector",
+ "maxzoom": 14,
+ "tiles": [
+ "local://tiles/{z}-{x}-{y}.mvt"
+ ]
+ }
+ },
+ "sprite": "local://sprites/sprite",
+ "glyphs": "local://glyphs/{fontstack}/{range}.pbf",
+ "layers": [
+ {
+ "id": "background",
+ "type": "background",
+ "paint": {
+ "background-color": "white"
+ }
+ },
+ {
+ "id": "icon",
+ "type": "symbol",
+ "source": "mapbox",
+ "source-layer": "poi_label",
+ "filter": [
+ "==",
+ "maki",
+ "restaurant"
+ ],
+ "layout": {
+ "symbol-placement": "point",
+ "icon-allow-overlap": true,
+ "icon-ignore-placement": true,
+ "icon-image": "building-12"
+ },
+ "paint": {}
+ }
+ ]
+}
diff --git a/test/integration/render-tests/results.html.tmpl b/test/integration/render-tests/results.html.tmpl
index 46a10b479e3..ef48f88018c 100644
--- a/test/integration/render-tests/results.html.tmpl
+++ b/test/integration/render-tests/results.html.tmpl
@@ -29,7 +29,7 @@
 |
 |
-
+
- diff: <%- r.difference %>
<% if (r.zoom) { %>- zoom: <%- r.zoom %>
<% } %>
diff --git a/test/integration/render-tests/text-pitch-alignment/auto-text-rotation-alignment-map/expected.png b/test/integration/render-tests/text-pitch-alignment/auto-text-rotation-alignment-map/expected.png
index 1c9aa911b32..01f7a0f698d 100644
Binary files a/test/integration/render-tests/text-pitch-alignment/auto-text-rotation-alignment-map/expected.png and b/test/integration/render-tests/text-pitch-alignment/auto-text-rotation-alignment-map/expected.png differ
diff --git a/test/integration/render-tests/text-pitch-alignment/auto-text-rotation-alignment-map/style.json b/test/integration/render-tests/text-pitch-alignment/auto-text-rotation-alignment-map/style.json
index ba2f96cf3a7..68a32e6ff2b 100644
--- a/test/integration/render-tests/text-pitch-alignment/auto-text-rotation-alignment-map/style.json
+++ b/test/integration/render-tests/text-pitch-alignment/auto-text-rotation-alignment-map/style.json
@@ -2,6 +2,9 @@
"version": 8,
"metadata": {
"test": {
+ "ignored": {
+ "native": "https://github.com/mapbox/mapbox-gl-native/issues/8967"
+ },
"allowed": 0.005,
"height": 256
}
diff --git a/test/integration/render-tests/text-pitch-alignment/auto-text-rotation-alignment-viewport/expected.png b/test/integration/render-tests/text-pitch-alignment/auto-text-rotation-alignment-viewport/expected.png
index 889ad937366..948d22f692a 100644
Binary files a/test/integration/render-tests/text-pitch-alignment/auto-text-rotation-alignment-viewport/expected.png and b/test/integration/render-tests/text-pitch-alignment/auto-text-rotation-alignment-viewport/expected.png differ
diff --git a/test/integration/render-tests/text-pitch-alignment/auto-text-rotation-alignment-viewport/style.json b/test/integration/render-tests/text-pitch-alignment/auto-text-rotation-alignment-viewport/style.json
index 7ae7fd2bb6b..1bb5dfbcab3 100644
--- a/test/integration/render-tests/text-pitch-alignment/auto-text-rotation-alignment-viewport/style.json
+++ b/test/integration/render-tests/text-pitch-alignment/auto-text-rotation-alignment-viewport/style.json
@@ -2,6 +2,9 @@
"version": 8,
"metadata": {
"test": {
+ "ignored": {
+ "native": "https://github.com/mapbox/mapbox-gl-native/issues/8967"
+ },
"allowed": 0.005,
"height": 256
}
diff --git a/test/integration/render-tests/text-pitch-alignment/map-text-depthtest/expected.png b/test/integration/render-tests/text-pitch-alignment/map-text-depthtest/expected.png
index ab2f60fd95c..34fc7bd0e05 100644
Binary files a/test/integration/render-tests/text-pitch-alignment/map-text-depthtest/expected.png and b/test/integration/render-tests/text-pitch-alignment/map-text-depthtest/expected.png differ
diff --git a/test/integration/render-tests/text-pitch-alignment/map-text-depthtest/style.json b/test/integration/render-tests/text-pitch-alignment/map-text-depthtest/style.json
index 97e1b39d462..ca43c7ba9db 100644
--- a/test/integration/render-tests/text-pitch-alignment/map-text-depthtest/style.json
+++ b/test/integration/render-tests/text-pitch-alignment/map-text-depthtest/style.json
@@ -2,6 +2,9 @@
"version": 8,
"metadata": {
"test": {
+ "ignored": {
+ "native": "https://github.com/mapbox/mapbox-gl-native/issues/8967"
+ },
"height": 256,
"diff": 0.00025
}
diff --git a/test/integration/render-tests/text-pitch-alignment/map-text-rotation-alignment-map/expected.png b/test/integration/render-tests/text-pitch-alignment/map-text-rotation-alignment-map/expected.png
index 1c9aa911b32..01f7a0f698d 100644
Binary files a/test/integration/render-tests/text-pitch-alignment/map-text-rotation-alignment-map/expected.png and b/test/integration/render-tests/text-pitch-alignment/map-text-rotation-alignment-map/expected.png differ
diff --git a/test/integration/render-tests/text-pitch-alignment/map-text-rotation-alignment-map/style.json b/test/integration/render-tests/text-pitch-alignment/map-text-rotation-alignment-map/style.json
index d39e03385c0..1b99785ea30 100644
--- a/test/integration/render-tests/text-pitch-alignment/map-text-rotation-alignment-map/style.json
+++ b/test/integration/render-tests/text-pitch-alignment/map-text-rotation-alignment-map/style.json
@@ -2,6 +2,9 @@
"version": 8,
"metadata": {
"test": {
+ "ignored": {
+ "native": "https://github.com/mapbox/mapbox-gl-native/issues/8967"
+ },
"allowed": 0.005,
"height": 256
}
diff --git a/test/integration/render-tests/text-pitch-alignment/map-text-rotation-alignment-viewport/expected.png b/test/integration/render-tests/text-pitch-alignment/map-text-rotation-alignment-viewport/expected.png
index cf227a43931..2d7031ca9a1 100644
Binary files a/test/integration/render-tests/text-pitch-alignment/map-text-rotation-alignment-viewport/expected.png and b/test/integration/render-tests/text-pitch-alignment/map-text-rotation-alignment-viewport/expected.png differ
diff --git a/test/integration/render-tests/text-pitch-alignment/map-text-rotation-alignment-viewport/style.json b/test/integration/render-tests/text-pitch-alignment/map-text-rotation-alignment-viewport/style.json
index 6d5bcacf327..02dae2b58a8 100644
--- a/test/integration/render-tests/text-pitch-alignment/map-text-rotation-alignment-viewport/style.json
+++ b/test/integration/render-tests/text-pitch-alignment/map-text-rotation-alignment-viewport/style.json
@@ -2,6 +2,9 @@
"version": 8,
"metadata": {
"test": {
+ "ignored": {
+ "native": "https://github.com/mapbox/mapbox-gl-native/issues/8967"
+ },
"allowed": 0.005,
"height": 256
}
diff --git a/test/integration/render-tests/text-pitch-alignment/viewport-text-depthtest/expected.png b/test/integration/render-tests/text-pitch-alignment/viewport-text-depthtest/expected.png
index ba0f95502f5..992481538a7 100644
Binary files a/test/integration/render-tests/text-pitch-alignment/viewport-text-depthtest/expected.png and b/test/integration/render-tests/text-pitch-alignment/viewport-text-depthtest/expected.png differ
diff --git a/test/integration/render-tests/text-pitch-alignment/viewport-text-depthtest/style.json b/test/integration/render-tests/text-pitch-alignment/viewport-text-depthtest/style.json
index 5532c4b142e..997e064acf3 100644
--- a/test/integration/render-tests/text-pitch-alignment/viewport-text-depthtest/style.json
+++ b/test/integration/render-tests/text-pitch-alignment/viewport-text-depthtest/style.json
@@ -2,6 +2,9 @@
"version": 8,
"metadata": {
"test": {
+ "ignored": {
+ "native": "https://github.com/mapbox/mapbox-gl-native/issues/8967"
+ },
"height": 256,
"diff": 0.00025
}
diff --git a/test/integration/render-tests/text-pitch-alignment/viewport-text-rotation-alignment-map/expected.png b/test/integration/render-tests/text-pitch-alignment/viewport-text-rotation-alignment-map/expected.png
index ad0e97600e3..8d2024a709e 100644
Binary files a/test/integration/render-tests/text-pitch-alignment/viewport-text-rotation-alignment-map/expected.png and b/test/integration/render-tests/text-pitch-alignment/viewport-text-rotation-alignment-map/expected.png differ
diff --git a/test/integration/render-tests/text-pitch-alignment/viewport-text-rotation-alignment-map/style.json b/test/integration/render-tests/text-pitch-alignment/viewport-text-rotation-alignment-map/style.json
index a4e1cf964b6..f36be4d83a6 100644
--- a/test/integration/render-tests/text-pitch-alignment/viewport-text-rotation-alignment-map/style.json
+++ b/test/integration/render-tests/text-pitch-alignment/viewport-text-rotation-alignment-map/style.json
@@ -2,6 +2,9 @@
"version": 8,
"metadata": {
"test": {
+ "ignored": {
+ "native": "https://github.com/mapbox/mapbox-gl-native/issues/8967"
+ },
"allowed": 0.005,
"height": 256
}
diff --git a/test/integration/render-tests/text-pitch-alignment/viewport-text-rotation-alignment-viewport/expected.png b/test/integration/render-tests/text-pitch-alignment/viewport-text-rotation-alignment-viewport/expected.png
index 889ad937366..948d22f692a 100644
Binary files a/test/integration/render-tests/text-pitch-alignment/viewport-text-rotation-alignment-viewport/expected.png and b/test/integration/render-tests/text-pitch-alignment/viewport-text-rotation-alignment-viewport/expected.png differ
diff --git a/test/integration/render-tests/text-pitch-alignment/viewport-text-rotation-alignment-viewport/style.json b/test/integration/render-tests/text-pitch-alignment/viewport-text-rotation-alignment-viewport/style.json
index 89c221b5882..057cb2a4a6a 100644
--- a/test/integration/render-tests/text-pitch-alignment/viewport-text-rotation-alignment-viewport/style.json
+++ b/test/integration/render-tests/text-pitch-alignment/viewport-text-rotation-alignment-viewport/style.json
@@ -2,6 +2,9 @@
"version": 8,
"metadata": {
"test": {
+ "ignored": {
+ "native": "https://github.com/mapbox/mapbox-gl-native/issues/8967"
+ },
"allowed": 0.005,
"height": 256
}
diff --git a/test/integration/render-tests/text-pitch-scaling/line-half/expected.png b/test/integration/render-tests/text-pitch-scaling/line-half/expected.png
new file mode 100644
index 00000000000..b4ea1a351df
Binary files /dev/null and b/test/integration/render-tests/text-pitch-scaling/line-half/expected.png differ
diff --git a/test/integration/render-tests/text-pitch-scaling/line-half/style.json b/test/integration/render-tests/text-pitch-scaling/line-half/style.json
new file mode 100644
index 00000000000..8d1bc066a8b
--- /dev/null
+++ b/test/integration/render-tests/text-pitch-scaling/line-half/style.json
@@ -0,0 +1,67 @@
+{
+ "version": 8,
+ "metadata": {
+ "test": {
+ "ignored": {
+ "native": "https://github.com/mapbox/mapbox-gl-native/issues/8967"
+ },
+ "allowed": 0.005,
+ "height": 512
+ }
+ },
+ "center": [
+ 13.418056,
+ 52.499167
+ ],
+ "zoom": 16,
+ "pitch": 30,
+ "sources": {
+ "mapbox": {
+ "type": "vector",
+ "maxzoom": 14,
+ "tiles": [
+ "local://tiles/{z}-{x}-{y}.mvt"
+ ]
+ }
+ },
+ "glyphs": "local://glyphs/{fontstack}/{range}.pbf",
+ "layers": [
+ {
+ "id": "background",
+ "type": "background",
+ "paint": {
+ "background-color": "white"
+ }
+ },
+ {
+ "id": "road",
+ "type": "line",
+ "source": "mapbox",
+ "source-layer": "road",
+ "paint": {
+ "line-color": "#888",
+ "line-width": 1
+ }
+ },
+ {
+ "id": "text",
+ "type": "symbol",
+ "source": "mapbox",
+ "source-layer": "road_label",
+ "layout": {
+ "symbol-placement": "line",
+ "symbol-spacing": 60,
+ "text-rotation-alignment": "map",
+ "text-pitch-alignment": "auto",
+ "text-field": "{class}",
+ "text-font": [
+ "Open Sans Semibold",
+ "Arial Unicode MS Bold"
+ ]
+ },
+ "paint": {
+ "text-opacity": 1
+ }
+ }
+ ]
+}
diff --git a/test/unit/data/symbol_bucket.test.js b/test/unit/data/symbol_bucket.test.js
index 13f2a84a70c..a9b2366df00 100644
--- a/test/unit/data/symbol_bucket.test.js
+++ b/test/unit/data/symbol_bucket.test.js
@@ -6,7 +6,7 @@ const path = require('path');
const Protobuf = require('pbf');
const VectorTile = require('vector-tile').VectorTile;
const SymbolBucket = require('../../../src/data/bucket/symbol_bucket');
-const Collision = require('../../../src/symbol/collision_tile');
+const CollisionTile = require('../../../src/symbol/collision_tile');
const CollisionBoxArray = require('../../../src/symbol/collision_box');
const GlyphAtlas = require('../../../src/symbol/glyph_atlas');
const StyleLayer = require('../../../src/style/style_layer');
@@ -21,7 +21,7 @@ const glyphs = JSON.parse(fs.readFileSync(path.join(__dirname, '/../../fixtures/
/*eslint new-cap: 0*/
const collisionBoxArray = new CollisionBoxArray();
-const collision = new Collision(0, 0, collisionBoxArray);
+const collision = new CollisionTile(0, 0, 1, 1, collisionBoxArray);
const atlas = new GlyphAtlas();
for (const id in glyphs) {
glyphs[id].bitmap = true;
diff --git a/test/unit/source/geojson_source.test.js b/test/unit/source/geojson_source.test.js
index 6ad5fa3fd6f..1721ed5e4ce 100644
--- a/test/unit/source/geojson_source.test.js
+++ b/test/unit/source/geojson_source.test.js
@@ -185,7 +185,7 @@ test('GeoJSONSource#update', (t) => {
const source = new GeoJSONSource('id', {data: {}}, mockDispatcher);
source.map = {
- transform: {}
+ transform: { cameraToCenterDistance: 1, cameraToTileDistance: () => { return 1; } }
};
source.on('data', (e) => {
diff --git a/test/unit/source/source_cache.test.js b/test/unit/source/source_cache.test.js
index 5214a818d00..65d56818997 100644
--- a/test/unit/source/source_cache.test.js
+++ b/test/unit/source/source_cache.test.js
@@ -166,7 +166,7 @@ test('SourceCache#addTile', (t) => {
t.end();
});
- t.test('reuses wrapped tile', (t) => {
+ t.test('does not reuse wrapped tile', (t) => {
const coord = new TileCoord(0, 0, 0);
let load = 0,
add = 0;
@@ -183,9 +183,9 @@ test('SourceCache#addTile', (t) => {
const t1 = sourceCache.addTile(coord);
const t2 = sourceCache.addTile(new TileCoord(0, 0, 0, 1));
- t.equal(load, 1);
- t.equal(add, 1);
- t.equal(t1, t2);
+ t.equal(load, 2);
+ t.equal(add, 2);
+ t.notEqual(t1, t2);
t.end();
});
@@ -478,7 +478,7 @@ test('SourceCache#update', (t) => {
const sourceCache = createSourceCache({
loadTile: function(tile, callback) {
- tile.state = (tile.coord.id === new TileCoord(0, 0, 0).id) ? 'loaded' : 'loading';
+ tile.state = (tile.coord.id === new TileCoord(0, 0, 0, 1).id) ? 'loaded' : 'loading';
callback();
}
});
diff --git a/test/unit/source/tile.test.js b/test/unit/source/tile.test.js
index ab336300a99..8c94e539b86 100644
--- a/test/unit/source/tile.test.js
+++ b/test/unit/source/tile.test.js
@@ -142,7 +142,7 @@ test('Tile#redoPlacement', (t) => {
send: () => {}
},
map: {
- transform: {}
+ transform: { cameraToCenterDistance: 1, cameraToTileDistance: () => { return 1; } }
}
};
@@ -249,7 +249,7 @@ function createVectorData(options) {
const collisionBoxArray = new CollisionBoxArray();
return util.extend({
collisionBoxArray: collisionBoxArray.serialize(),
- collisionTile: (new CollisionTile(0, 0, collisionBoxArray)).serialize(),
+ collisionTile: (new CollisionTile(0, 0, 1, 1, collisionBoxArray)).serialize(),
featureIndex: (new FeatureIndex(new TileCoord(1, 1, 1))).serialize(),
buckets: []
}, options);
diff --git a/test/unit/source/vector_tile_source.test.js b/test/unit/source/vector_tile_source.test.js
index c03a752141c..3cb8cc23645 100644
--- a/test/unit/source/vector_tile_source.test.js
+++ b/test/unit/source/vector_tile_source.test.js
@@ -9,7 +9,7 @@ const Evented = require('../../../src/util/evented');
function createSource(options) {
const source = new VectorTileSource('id', options, { send: function() {} }, options.eventedParent);
source.onAdd({
- transform: { angle: 0, pitch: 0, showCollisionBoxes: false }
+ transform: { angle: 0, pitch: 0, cameraToCenterDistance: 1, cameraToTileDistance: () => { return 1; }, showCollisionBoxes: false }
});
source.on('error', (e) => {
diff --git a/test/unit/source/vector_tile_worker_source.test.js b/test/unit/source/vector_tile_worker_source.test.js
index 954c681de48..fcbfd5f0462 100644
--- a/test/unit/source/vector_tile_worker_source.test.js
+++ b/test/unit/source/vector_tile_worker_source.test.js
@@ -53,7 +53,7 @@ test('redoPlacement', (t) => {
t.test('on loaded tile', (t) => {
const source = new VectorTileWorkerSource(null, new StyleLayerIndex());
const tile = {
- redoPlacement: function(angle, pitch, showCollisionBoxes) {
+ redoPlacement: function(angle, pitch, cameraToCenterDistance, cameraToTileDistance, showCollisionBoxes) {
t.equal(angle, 60);
t.equal(pitch, 30);
t.equal(showCollisionBoxes, false);
@@ -70,6 +70,8 @@ test('redoPlacement', (t) => {
source: 'mapbox',
angle: 60,
pitch: 30,
+ cameraToCenterDistance: 1,
+ cameraToTileDistance: 1,
showCollisionBoxes: false
}, (err, result, transferables) => {
t.error(err);
diff --git a/test/unit/symbol/collision_feature.js b/test/unit/symbol/collision_feature.js
index d3e02683b74..7f330d32d33 100644
--- a/test/unit/symbol/collision_feature.js
+++ b/test/unit/symbol/collision_feature.js
@@ -38,6 +38,8 @@ test('CollisionFeature', (t) => {
const cf = new CollisionFeature(collisionBoxArray, line, anchor, 0, 0, 0, shapedText, 1, 0, true);
const boxPoints = pluckAnchorPoints(cf);
t.deepEqual(boxPoints, [
+ { x: 448, y: 90},
+ { x: 458, y: 92},
{ x: 468, y: 94},
{ x: 478, y: 96},
{ x: 487, y: 97},
@@ -47,7 +49,32 @@ test('CollisionFeature', (t) => {
{ x: 522, y: 84},
{ x: 531, y: 80},
{ x: 540, y: 76},
- { x: 549, y: 72} ]);
+ { x: 549, y: 72},
+ { x: 558, y: 67},
+ { x: 567, y: 63} ]);
+ t.end();
+ });
+
+ test('boxes for handling pitch underzooming have scale < 1', (t) => {
+ const line = [new Point(0, 0), new Point(500, 100), new Point(510, 90), new Point(700, 0)];
+ const anchor = new Anchor(505, 95, 0, 1);
+ const cf = new CollisionFeature(collisionBoxArray, line, anchor, 0, 0, 0, shapedText, 1, 0, true);
+ const maxScales = pluckMaxScales(cf);
+ t.deepEqual(maxScales, [
+ 0.9090909361839294,
+ 0.9900000095367432,
+ 1.4285714626312256,
+ 2,
+ 3.3333332538604736,
+ 10,
+ Infinity,
+ 10,
+ 3.3333332538604736,
+ 2,
+ 1.4285714626312256,
+ 1.1111111640930176,
+ 0.9090909361839294,
+ 0.7692307829856873]);
t.end();
});
@@ -57,6 +84,8 @@ test('CollisionFeature', (t) => {
const cf = new CollisionFeature(collisionBoxArray, line, anchor, 0, 0, 0, shapedText, 1, 0, true);
const boxPoints = pluckAnchorPoints(cf);
t.deepEqual(boxPoints, [
+ { x: 0, y: 50 },
+ { x: 0, y: 60 },
{ x: 0, y: 70 },
{ x: 0, y: 80 },
{ x: 0, y: 90 },
@@ -66,7 +95,9 @@ test('CollisionFeature', (t) => {
{ x: 0, y: 130 },
{ x: 0, y: 140 },
{ x: 0, y: 150 },
- { x: 0, y: 160 } ]);
+ { x: 0, y: 160 },
+ { x: 0, y: 170 },
+ { x: 0, y: 180 } ]);
t.end();
});
@@ -111,7 +142,7 @@ test('CollisionFeature', (t) => {
const line = [new Point(0, 0), new Point(500, 100), new Point(510, 90), new Point(700, 0)];
const anchor = new Anchor(505, 95, 0, 1);
const cf = new CollisionFeature(collisionBoxArray, line, anchor, 0, 0, 0, shapedText, 1, 0, true);
- t.ok(cf.boxEndIndex - cf.boxStartIndex < 30);
+ t.ok(cf.boxEndIndex - cf.boxStartIndex < 45);
t.end();
});
@@ -133,4 +164,12 @@ test('CollisionFeature', (t) => {
}
return result;
}
+
+ function pluckMaxScales(cf) {
+ const result = [];
+ for (let i = cf.boxStartIndex; i < cf.boxEndIndex; i++) {
+ result.push(collisionBoxArray.get(i).maxScale);
+ }
+ return result;
+ }
});
| |