diff options
Diffstat (limited to 'platform/node/test')
-rw-r--r-- | platform/node/test/expression.test.js | 16 | ||||
-rw-r--r-- | platform/node/test/ignores.json | 12 | ||||
-rw-r--r-- | platform/node/test/query.test.js | 10 | ||||
-rw-r--r-- | platform/node/test/render.test.js | 10 | ||||
-rw-r--r-- | platform/node/test/suite_implementation.js | 46 |
5 files changed, 50 insertions, 44 deletions
diff --git a/platform/node/test/expression.test.js b/platform/node/test/expression.test.js index ffd1c68ff2..4635ef78f7 100644 --- a/platform/node/test/expression.test.js +++ b/platform/node/test/expression.test.js @@ -1,10 +1,8 @@ -'use strict'; +import {run} from '../../../mapbox-gl-js/test/integration/lib/expression'; +import mbgl from '../index'; +import ignores from './ignores.json'; -var suite = require('../../../mapbox-gl-js/test/integration').expression; -var mbgl = require('../index'); -var ignores = require('./ignores.json'); - -var tests; +let tests; if (process.argv[1] === __filename && process.argv.length > 2) { tests = process.argv.slice(2); @@ -30,7 +28,7 @@ function getExpectedType(spec) { return typeof spec.type === 'string' ? {kind: spec.type} : null; } -suite.run('native', {ignores: ignores, tests: tests}, (fixture) => { +run('native', {ignores, tests}, (fixture) => { const compiled = {}; const recompiled = {}; const result = { @@ -55,7 +53,7 @@ suite.run('native', {ignores: ignores, tests: tests}, (fixture) => { type: 'Feature', properties: {}, geometry: { type: 'Point', coordinates: [0, 0] } - }, input[1]) + }, input[1]); const output = expression.evaluate(input[0], feature); evaluateResults.push(output); @@ -68,7 +66,7 @@ suite.run('native', {ignores: ignores, tests: tests}, (fixture) => { compilationResult.result = 'error'; compilationResult.errors = expression; } - } + }; result.outputs = evaluateExpression(expression, compiled); if (expression instanceof mbgl.Expression) { diff --git a/platform/node/test/ignores.json b/platform/node/test/ignores.json index 18e9e11c49..2d46317a95 100644 --- a/platform/node/test/ignores.json +++ b/platform/node/test/ignores.json @@ -1,5 +1,9 @@ { "expression-tests/collator/accent-equals-de": "Locale-specific behavior changes based on platform.", + "expression-tests/formatted/basic": "skip - https://github.com/mapbox/mapbox-gl-native/pull/12624", + "expression-tests/formatted/to-string": "skip - https://github.com/mapbox/mapbox-gl-native/pull/12624", + "expression-tests/interpolate-hcl/linear": "https://github.com/mapbox/mapbox-gl-native/issues/8720", + "expression-tests/interpolate-lab/linear": "https://github.com/mapbox/mapbox-gl-native/issues/8720", "expression-tests/is-supported-script/default": "This tests RTL text plugin behavior specific to GL JS", "expression-tests/resolved-locale/basic": "Even the 'en' locale may not be present on some test systems.", "query-tests/geometry/multilinestring": "needs investigation", @@ -9,12 +13,16 @@ "query-tests/world-wrapping/point": "skip - needs issue", "query-tests/circle-radius/feature-state": "skip - port https://github.com/mapbox/mapbox-gl-js/pull/6263 - needs issue", "query-tests/circle-stroke-width/feature-state": "skip - port https://github.com/mapbox/mapbox-gl-js/pull/6263 - needs issue", + "query-tests/fill-extrusion-translate/multiple-layers": "https://github.com/mapbox/mapbox-gl-native/issues/12701", + "query-tests/fill-translate/multiple-layers": "https://github.com/mapbox/mapbox-gl-native/issues/12701", "query-tests/line-gap-width/feature-state": "skip - port https://github.com/mapbox/mapbox-gl-js/pull/6263 - needs issue", "query-tests/line-offset/feature-state": "skip - port https://github.com/mapbox/mapbox-gl-js/pull/6263 - needs issue", "query-tests/line-width/feature-state": "skip - port https://github.com/mapbox/mapbox-gl-js/pull/6263 - needs issue", "query-tests/feature-state/default": "skip - port https://github.com/mapbox/mapbox-gl-js/pull/6263 - needs issue", "query-tests/regressions/mapbox-gl-js#6555": "skip - no querySourceFeatures in mbgl-node; needs issue", "render-tests/background-color/transition": "https://github.com/mapbox/mapbox-gl-native/issues/10619", + "render-tests/basic-v9/z0-wide": "https://github.com/mapbox/mapbox-gl-native/pull/12611", + "render-tests/bright-v9/z0-wide": "https://github.com/mapbox/mapbox-gl-native/pull/12611", "render-tests/collator/resolved-locale": "Some test platforms don't resolve 'en' locale", "render-tests/collator/default": "Some test platforms don't resolve 'en' locale", "render-tests/debug/collision": "https://github.com/mapbox/mapbox-gl-native/issues/3841", @@ -56,9 +64,13 @@ "render-tests/runtime-styling/image-add-sdf": "https://github.com/mapbox/mapbox-gl-native/issues/9847", "render-tests/runtime-styling/paint-property-fill-flat-to-extrude": "https://github.com/mapbox/mapbox-gl-native/issues/6745", "render-tests/runtime-styling/set-style-paint-property-fill-flat-to-extrude": "https://github.com/mapbox/mapbox-gl-native/issues/6745", + "render-tests/satellite-v9/z0-wide": "https://github.com/mapbox/mapbox-gl-native/pull/12611", "render-tests/symbol-cross-fade/chinese": "https://github.com/mapbox/mapbox-gl-native/issues/10619", "render-tests/symbol-placement/line-overscaled": "https://github.com/mapbox/mapbox-gl-js/issues/5654", "render-tests/symbol-visibility/visible": "https://github.com/mapbox/mapbox-gl-native/issues/10409", + "render-tests/text-field/formatted-arabic": "skip - https://github.com/mapbox/mapbox-gl-native/pull/12624", + "render-tests/text-field/formatted-line": "skip - https://github.com/mapbox/mapbox-gl-native/pull/12624", + "render-tests/text-field/formatted": "skip - https://github.com/mapbox/mapbox-gl-native/pull/12624", "render-tests/text-no-cross-source-collision/default": "skip - gl-js only", "render-tests/text-pitch-alignment/auto-text-rotation-alignment-map": "https://github.com/mapbox/mapbox-gl-native/issues/9732", "render-tests/text-pitch-alignment/map-text-rotation-alignment-map": "https://github.com/mapbox/mapbox-gl-native/issues/9732", diff --git a/platform/node/test/query.test.js b/platform/node/test/query.test.js index 02602d3f5a..3dfce4474c 100644 --- a/platform/node/test/query.test.js +++ b/platform/node/test/query.test.js @@ -1,8 +1,6 @@ -'use strict'; - -const suite = require('../../../mapbox-gl-js/test/integration').query; -const suiteImplementation = require('./suite_implementation'); -const ignores = require('./ignores.json'); +import {run} from '../../../mapbox-gl-js/test/integration/lib/query'; +import implementation from './suite_implementation'; +import ignores from './ignores.json'; let tests; @@ -10,4 +8,4 @@ if (process.argv[1] === __filename && process.argv.length > 2) { tests = process.argv.slice(2); } -suite.run('native', {tests: tests, ignores: ignores}, suiteImplementation); +run('native', {tests, ignores}, implementation); diff --git a/platform/node/test/render.test.js b/platform/node/test/render.test.js index 812a531f20..950f8eb7ab 100644 --- a/platform/node/test/render.test.js +++ b/platform/node/test/render.test.js @@ -1,7 +1,5 @@ -'use strict'; +import {run} from '../../../mapbox-gl-js/test/integration/lib/render'; +import implementation from './suite_implementation'; +import ignores from './ignores.json'; -const suite = require('../../../mapbox-gl-js/test/integration').render; -const suiteImplementation = require('./suite_implementation'); -const ignores = require('./ignores.json'); - -suite.run('native', ignores, suiteImplementation); +run('native', ignores, implementation); diff --git a/platform/node/test/suite_implementation.js b/platform/node/test/suite_implementation.js index c09e8f50bf..704cab8940 100644 --- a/platform/node/test/suite_implementation.js +++ b/platform/node/test/suite_implementation.js @@ -1,24 +1,24 @@ -'use strict'; - -var mbgl = require('../index'); -var request = require('request'); -var PNG = require('pngjs').PNG; -var fs = require('fs'); -var path = require('path'); +import mbgl from '../index'; +import request from 'request'; +import {PNG} from 'pngjs'; +import * as fs from 'fs'; +import * as path from 'path'; mbgl.on('message', function(msg) { console.log('%s (%s): %s', msg.severity, msg.class, msg.text); }); // Map of map objects by pixel ratio -var maps = new Map(); +const maps = new Map(); + +export default function (style, options, callback) { + const tileMode = options.mapMode === 'tile'; + let map; -module.exports = function (style, options, callback) { - var tileMode = options.mapMode === 'tile'; if (options.recycleMap) { - var key = options.pixelRatio + '/' + tileMode; + const key = options.pixelRatio + '/' + tileMode; if (maps.has(key)) { - var map = maps.get(key); + map = maps.get(key); map.request = mapRequest; } else { maps.set(key, new mbgl.Map({ @@ -26,18 +26,18 @@ module.exports = function (style, options, callback) { request: mapRequest, mode: options.mapMode })); - var map = maps.get(key); + map = maps.get(key); } } else { - var map = new mbgl.Map({ + map = new mbgl.Map({ ratio: options.pixelRatio, request: mapRequest, mode: options.mapMode }); } - var timedOut = false; - var watchdog = setTimeout(function () { + let timedOut = false; + const watchdog = setTimeout(function () { timedOut = true; map.dumpDebugLogs(); callback(new Error('timed out after 20 seconds')); @@ -61,19 +61,19 @@ module.exports = function (style, options, callback) { request(req.url, {encoding: null}, function (err, response, body) { if (err) { callback(err); - } else if (response.statusCode == 404) { + } else if (response.statusCode === 404) { callback(); - } else if (response.statusCode != 200) { + } else if (response.statusCode !== 200) { callback(new Error(response.statusMessage)); } else { callback(null, {data: body}); } }); - }; + } applyOperations(options.operations, function() { map.render(options, function (err, pixels) { - var results = options.queryGeometry ? + const results = options.queryGeometry ? map.queryRenderedFeatures(options.queryGeometry, options.queryOptions || {}) : []; if (!options.recycleMap) { @@ -86,7 +86,7 @@ module.exports = function (style, options, callback) { }); function applyOperations(operations, callback) { - var operation = operations && operations[0]; + const operation = operations && operations[0]; if (!operations || operations.length === 0) { callback(); @@ -102,7 +102,7 @@ module.exports = function (style, options, callback) { applyOperations(operations.slice(1), callback); }, operation[1]); } else if (operation[0] === 'addImage' || operation[0] === 'updateImage') { - var img = PNG.sync.read(fs.readFileSync(path.join(__dirname, '../../../mapbox-gl-js/test/integration', operation[2]))); + const img = PNG.sync.read(fs.readFileSync(path.join(__dirname, '../../../mapbox-gl-js/test/integration', operation[2]))); const testOpts = (operation.length > 3) ? operation[3] : {}; const options = { @@ -110,7 +110,7 @@ module.exports = function (style, options, callback) { width: img.width, pixelRatio: testOpts.pixelRatio || 1, sdf: testOpts.sdf || false - } + }; map.addImage(operation[1], img.data, options); |