From 4a110ff17e994a07a36a1d4bedf18f5e6c6dbb6a Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Sun, 20 Jul 2014 17:02:52 -0700 Subject: Use mapbox-gl-test-suite --- .travis.yml | 6 +- scripts/compare_images.js | 117 --------------------- scripts/deploy_results.sh | 8 -- .../0-255.pbf | Bin 84942 -> 0 bytes test/fixtures/sprites/outdoors.json | 1 - test/fixtures/sprites/outdoors.png | Bin 40912 -> 0 bytes test/fixtures/styles/icons.info.json | 18 ---- test/fixtures/styles/icons.style.json | 33 ------ test/fixtures/styles/icons/default.expected.png | Bin 6538 -> 0 bytes test/fixtures/styles/line-color.info.json | 27 ----- test/fixtures/styles/line-color.style.json | 33 ------ .../styles/line-color/colored.expected.png | Bin 64163 -> 0 bytes .../styles/line-color/default.expected.png | Bin 80000 -> 0 bytes test/fixtures/styles/road-width.info.json | 45 -------- test/fixtures/styles/road-width.style.json | 31 ------ test/fixtures/styles/road-width/z13.9.expected.png | Bin 1142 -> 0 bytes test/fixtures/styles/road-width/z14.0.expected.png | Bin 51801 -> 0 bytes test/fixtures/styles/road-width/z14.1.expected.png | Bin 35033 -> 0 bytes test/fixtures/styles/road-width/z14.2.expected.png | Bin 23417 -> 0 bytes test/fixtures/styles/world-aa.info.json | 9 -- test/fixtures/styles/world-aa.style.json | 29 ----- test/fixtures/styles/world-aa/plain.expected.png | Bin 31356 -> 0 bytes test/fixtures/styles/world-no-aa.info.json | 10 -- test/fixtures/styles/world-no-aa.style.json | 30 ------ .../fixtures/styles/world-no-aa/plain.expected.png | Bin 9451 -> 0 bytes test/fixtures/tiles/0-0-0.vector.pbf | Bin 79244 -> 0 bytes test/fixtures/tiles/13-4401-2687.vector.pbf | Bin 97260 -> 0 bytes test/fixtures/tiles/14-8802-5374.vector.pbf | Bin 399937 -> 0 bytes test/fixtures/tiles/14-8802-5375.vector.pbf | Bin 325249 -> 0 bytes test/fixtures/tiles/14-8803-5374.vector.pbf | Bin 347363 -> 0 bytes test/fixtures/tiles/14-8803-5375.vector.pbf | Bin 448599 -> 0 bytes test/fixtures/tiles/2-1-1.vector.pbf | Bin 74471 -> 0 bytes test/fixtures/tiles/2-1-2.vector.pbf | Bin 41406 -> 0 bytes test/fixtures/tiles/2-2-1.vector.pbf | Bin 272036 -> 0 bytes test/fixtures/tiles/2-2-2.vector.pbf | Bin 29521 -> 0 bytes test/headless.cpp | 102 +++++++----------- 36 files changed, 39 insertions(+), 460 deletions(-) delete mode 100755 scripts/compare_images.js delete mode 100755 scripts/deploy_results.sh delete mode 100644 test/fixtures/glyphs/Open Sans Semibold, Arial Unicode MS Bold/0-255.pbf delete mode 100644 test/fixtures/sprites/outdoors.json delete mode 100644 test/fixtures/sprites/outdoors.png delete mode 100644 test/fixtures/styles/icons.info.json delete mode 100644 test/fixtures/styles/icons.style.json delete mode 100644 test/fixtures/styles/icons/default.expected.png delete mode 100644 test/fixtures/styles/line-color.info.json delete mode 100644 test/fixtures/styles/line-color.style.json delete mode 100644 test/fixtures/styles/line-color/colored.expected.png delete mode 100644 test/fixtures/styles/line-color/default.expected.png delete mode 100644 test/fixtures/styles/road-width.info.json delete mode 100644 test/fixtures/styles/road-width.style.json delete mode 100644 test/fixtures/styles/road-width/z13.9.expected.png delete mode 100644 test/fixtures/styles/road-width/z14.0.expected.png delete mode 100644 test/fixtures/styles/road-width/z14.1.expected.png delete mode 100644 test/fixtures/styles/road-width/z14.2.expected.png delete mode 100644 test/fixtures/styles/world-aa.info.json delete mode 100644 test/fixtures/styles/world-aa.style.json delete mode 100644 test/fixtures/styles/world-aa/plain.expected.png delete mode 100644 test/fixtures/styles/world-no-aa.info.json delete mode 100644 test/fixtures/styles/world-no-aa.style.json delete mode 100644 test/fixtures/styles/world-no-aa/plain.expected.png delete mode 100644 test/fixtures/tiles/0-0-0.vector.pbf delete mode 100644 test/fixtures/tiles/13-4401-2687.vector.pbf delete mode 100644 test/fixtures/tiles/14-8802-5374.vector.pbf delete mode 100644 test/fixtures/tiles/14-8802-5375.vector.pbf delete mode 100644 test/fixtures/tiles/14-8803-5374.vector.pbf delete mode 100644 test/fixtures/tiles/14-8803-5375.vector.pbf delete mode 100644 test/fixtures/tiles/2-1-1.vector.pbf delete mode 100644 test/fixtures/tiles/2-1-2.vector.pbf delete mode 100644 test/fixtures/tiles/2-2-1.vector.pbf delete mode 100644 test/fixtures/tiles/2-2-2.vector.pbf diff --git a/.travis.yml b/.travis.yml index ec877eb68b..eb4e700b1e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,7 @@ before_install: install: - make setup +- npm install git+https://github.com/mapbox/mapbox-gl-test-suite.git before_script: - rm -rf mapnik-packaging/out/packages @@ -30,10 +31,7 @@ script: - make linux -j4 BUILDTYPE=${BUILDTYPE} - make test -j4 BUILDTYPE=${BUILDTYPE} - ./scripts/run_tests.sh -- ./scripts/compare_images.js - -after_script: -- ./scripts/deploy_results.sh +- (cd ./node_modules/mapbox-gl-test-suite/ && (./bin/compare_images.js; ./bin/deploy_results.sh)) notifications: hipchat: diff --git a/scripts/compare_images.js b/scripts/compare_images.js deleted file mode 100755 index ef854b038e..0000000000 --- a/scripts/compare_images.js +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/env node - -var fs = require('fs'); -var path = require('path'); -var spawn = require('child_process').spawn; - -var base_dir = path.join(path.resolve('.'), 'test/fixtures/styles'); - -var files = fs.readdirSync(base_dir).filter(function(name) { - return name.match(/\.info\.json$/); -}); - -var html = - '\n' + - '\n' + - '\n' + - ' \n' + - ' \n' + - ' \n' + - '\n'; - -var exitCode = 0; -var failures = 0; - -processFiles(); - -function processFiles() { - if (!files.length) return done(); - - var name = files.shift(); - - var info = require(path.join(base_dir, name)); - - var keys = Object.keys(info); - - processFileTest(); - - function processFileTest() { - if (!keys.length) return processFiles(); - - var key = keys.shift(); - - var base = path.basename(name, '.info.json'); - - var actual = path.join(base_dir, base + '/' + key + '.actual.png'); - var expected = path.join(base_dir, base + '/' + key + '.expected.png'); - var diff = path.join(base_dir, base + '/' + key + '.diff.png'); - - var compare = spawn('compare', ['-metric', 'MAE', actual, expected, diff ]); - var error = ''; - compare.stderr.on('data', function(data) { - error += data.toString(); - }); - compare.on('exit', function(code, signal) { - // The compare program returns 2 on error otherwise 0 if the images are similar or 1 if they are dissimilar. - if (code == 2) { - writeResult(base, key, info[key], error.trim(), Infinity); - exitCode = 2; - } else { - var match = error.match(/^\d+(?:\.\d+)?\s+\(([^\)]+)\)\s*$/); - var difference = match ? parseFloat(match[1]) : Infinity; - writeResult(base, key, info[key], match ? '' : error, difference); - - } - processFileTest(); - }); - compare.stdin.end(); - } -} - -function writeResult(base, key, info, error, difference) { - var color = 'green'; - var allowedDifference = ('diff' in info) ? info.diff : 0.01; - if (difference > allowedDifference) { - color = 'red'; - if (exitCode < 1) { - exitCode = 1; - } - failures++; - } - - html += - '\n' + - ' \n' + - ' \n' + - ' \n' + - '\n' - ; -} - -function done() { - html += "
ActualExpectedInfo
\n' + - '

' + base + '/' + key + '

\n' + - (error ? '

' + error + '

\n' : '') + - '
    \n' + - '
  • diff: ' + difference + '
  • \n' + - '
  • zoom: ' + (info.zoom || 0) + '
  • \n' + - '
  • center: ' + (info.center || [0, 0]) + '
  • \n' + - '
  • bearing: ' + (info.bearing || 0) + '
  • \n' + - '
  • width: ' + (info.width || 512) + '
  • \n' + - '
  • height: ' + (info.height || 512) + '
  • \n' + - '
\n' + - '
\n"; - - fs.writeFileSync(path.join(base_dir, 'index.html'), html); - console.warn('Results at: ' + path.join(base_dir, 'index.html')); - if (failures) { - console.warn('\x1B[1m\x1B[31m' + failures + ' ' + (failures == 1 ? 'image doesn\'t' : 'images don\'t') + ' match\x1B[39m\x1B[22m'); - } else { - console.warn('\x1B[1m\x1B[32mAll images match\x1B[39m\x1B[22m'); - } - - process.exit(exitCode); -} \ No newline at end of file diff --git a/scripts/deploy_results.sh b/scripts/deploy_results.sh deleted file mode 100755 index bf13def012..0000000000 --- a/scripts/deploy_results.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -aws s3 cp test/fixtures/styles/ s3://mapbox-gl-testing/headless/$TRAVIS_JOB_NUMBER/ --acl public-read --recursive - -echo http://mapbox-gl-testing.s3.amazonaws.com/headless/$TRAVIS_JOB_NUMBER/index.html diff --git a/test/fixtures/glyphs/Open Sans Semibold, Arial Unicode MS Bold/0-255.pbf b/test/fixtures/glyphs/Open Sans Semibold, Arial Unicode MS Bold/0-255.pbf deleted file mode 100644 index cea1c094d6..0000000000 Binary files a/test/fixtures/glyphs/Open Sans Semibold, Arial Unicode MS Bold/0-255.pbf and /dev/null differ diff --git a/test/fixtures/sprites/outdoors.json b/test/fixtures/sprites/outdoors.json deleted file mode 100644 index b2a7ddf53a..0000000000 --- a/test/fixtures/sprites/outdoors.json +++ /dev/null @@ -1 +0,0 @@ -{"wetland_noveg_64":{"x":0,"y":0,"width":64,"height":32,"pixelRatio":1},"wetland_64":{"x":66,"y":0,"width":64,"height":32,"pixelRatio":1},"airport-24":{"x":0,"y":34,"width":24,"height":24,"pixelRatio":1},"wetland_32":{"x":26,"y":34,"width":32,"height":16,"pixelRatio":1},"wetland_noveg_32":{"x":60,"y":34,"width":32,"height":16,"pixelRatio":1},"night-library-12":{"x":94,"y":34,"width":12,"height":12,"pixelRatio":1},"bakery-12":{"x":108,"y":34,"width":12,"height":12,"pixelRatio":1},"bank-12":{"x":0,"y":60,"width":12,"height":12,"pixelRatio":1},"bar-12":{"x":14,"y":60,"width":12,"height":12,"pixelRatio":1},"baseball-12":{"x":28,"y":60,"width":12,"height":12,"pixelRatio":1},"basketball-12":{"x":42,"y":60,"width":12,"height":12,"pixelRatio":1},"beer-12":{"x":56,"y":60,"width":12,"height":12,"pixelRatio":1},"bicycle-12":{"x":70,"y":60,"width":12,"height":12,"pixelRatio":1},"building-12":{"x":84,"y":60,"width":12,"height":12,"pixelRatio":1},"bus-12":{"x":98,"y":60,"width":12,"height":12,"pixelRatio":1},"cafe-12":{"x":112,"y":60,"width":12,"height":12,"pixelRatio":1},"camera-12":{"x":0,"y":74,"width":12,"height":12,"pixelRatio":1},"campsite-12":{"x":14,"y":74,"width":12,"height":12,"pixelRatio":1},"car-12":{"x":28,"y":74,"width":12,"height":12,"pixelRatio":1},"cemetery-12":{"x":42,"y":74,"width":12,"height":12,"pixelRatio":1},"chemist-12":{"x":56,"y":74,"width":12,"height":12,"pixelRatio":1},"cinema-12":{"x":70,"y":74,"width":12,"height":12,"pixelRatio":1},"circle-12":{"x":84,"y":74,"width":12,"height":12,"pixelRatio":1},"circle-stroked-12":{"x":98,"y":74,"width":12,"height":12,"pixelRatio":1},"city-12":{"x":112,"y":74,"width":12,"height":12,"pixelRatio":1},"clothing-store-12":{"x":0,"y":88,"width":12,"height":12,"pixelRatio":1},"college-12":{"x":14,"y":88,"width":12,"height":12,"pixelRatio":1},"commercial-12":{"x":28,"y":88,"width":12,"height":12,"pixelRatio":1},"cricket-12":{"x":42,"y":88,"width":12,"height":12,"pixelRatio":1},"cross-12":{"x":56,"y":88,"width":12,"height":12,"pixelRatio":1},"dam-12":{"x":70,"y":88,"width":12,"height":12,"pixelRatio":1},"danger-12":{"x":84,"y":88,"width":12,"height":12,"pixelRatio":1},"disability-12":{"x":98,"y":88,"width":12,"height":12,"pixelRatio":1},"dog-park-12":{"x":112,"y":88,"width":12,"height":12,"pixelRatio":1},"embassy-12":{"x":0,"y":102,"width":12,"height":12,"pixelRatio":1},"emergency-telephone-12":{"x":14,"y":102,"width":12,"height":12,"pixelRatio":1},"entrance-12":{"x":28,"y":102,"width":12,"height":12,"pixelRatio":1},"farm-12":{"x":42,"y":102,"width":12,"height":12,"pixelRatio":1},"fast-food-12":{"x":56,"y":102,"width":12,"height":12,"pixelRatio":1},"ferry-12":{"x":70,"y":102,"width":12,"height":12,"pixelRatio":1},"fire-station-12":{"x":84,"y":102,"width":12,"height":12,"pixelRatio":1},"fuel-12":{"x":98,"y":102,"width":12,"height":12,"pixelRatio":1},"garden-12":{"x":112,"y":102,"width":12,"height":12,"pixelRatio":1},"golf-12":{"x":0,"y":116,"width":12,"height":12,"pixelRatio":1},"grocery-12":{"x":14,"y":116,"width":12,"height":12,"pixelRatio":1},"hairdresser-12":{"x":28,"y":116,"width":12,"height":12,"pixelRatio":1},"harbor-12":{"x":42,"y":116,"width":12,"height":12,"pixelRatio":1},"heart-12":{"x":56,"y":116,"width":12,"height":12,"pixelRatio":1},"heliport-12":{"x":70,"y":116,"width":12,"height":12,"pixelRatio":1},"hospital-12":{"x":84,"y":116,"width":12,"height":12,"pixelRatio":1},"industrial-12":{"x":98,"y":116,"width":12,"height":12,"pixelRatio":1},"land-use-12":{"x":112,"y":116,"width":12,"height":12,"pixelRatio":1},"laundry-12":{"x":132,"y":0,"width":12,"height":12,"pixelRatio":1},"library-12":{"x":132,"y":14,"width":12,"height":12,"pixelRatio":1},"lighthouse-12":{"x":132,"y":28,"width":12,"height":12,"pixelRatio":1},"lodging-12":{"x":132,"y":42,"width":12,"height":12,"pixelRatio":1},"logging-12":{"x":132,"y":56,"width":12,"height":12,"pixelRatio":1},"london-underground-12":{"x":132,"y":70,"width":12,"height":12,"pixelRatio":1},"marker-12":{"x":132,"y":84,"width":12,"height":12,"pixelRatio":1},"marker-stroked-12":{"x":132,"y":98,"width":12,"height":12,"pixelRatio":1},"minefield-12":{"x":132,"y":112,"width":12,"height":12,"pixelRatio":1},"mobilephone-12":{"x":0,"y":130,"width":12,"height":12,"pixelRatio":1},"monument-12":{"x":14,"y":130,"width":12,"height":12,"pixelRatio":1},"museum-12":{"x":28,"y":130,"width":12,"height":12,"pixelRatio":1},"music-12":{"x":42,"y":130,"width":12,"height":12,"pixelRatio":1},"night-airfield-12":{"x":56,"y":130,"width":12,"height":12,"pixelRatio":1},"night-airport-12":{"x":70,"y":130,"width":12,"height":12,"pixelRatio":1},"night-alcohol-shop-12":{"x":84,"y":130,"width":12,"height":12,"pixelRatio":1},"night-america-football-12":{"x":98,"y":130,"width":12,"height":12,"pixelRatio":1},"night-art-gallery-12":{"x":112,"y":130,"width":12,"height":12,"pixelRatio":1},"night-bakery-12":{"x":126,"y":130,"width":12,"height":12,"pixelRatio":1},"night-bank-12":{"x":146,"y":0,"width":12,"height":12,"pixelRatio":1},"night-bar-12":{"x":146,"y":14,"width":12,"height":12,"pixelRatio":1},"night-baseball-12":{"x":146,"y":28,"width":12,"height":12,"pixelRatio":1},"night-basketball-12":{"x":146,"y":42,"width":12,"height":12,"pixelRatio":1},"night-beer-12":{"x":146,"y":56,"width":12,"height":12,"pixelRatio":1},"night-bicycle-12":{"x":146,"y":70,"width":12,"height":12,"pixelRatio":1},"night-building-12":{"x":146,"y":84,"width":12,"height":12,"pixelRatio":1},"night-bus-12":{"x":146,"y":98,"width":12,"height":12,"pixelRatio":1},"night-cafe-12":{"x":146,"y":112,"width":12,"height":12,"pixelRatio":1},"night-camera-12":{"x":146,"y":126,"width":12,"height":12,"pixelRatio":1},"night-campsite-12":{"x":0,"y":144,"width":12,"height":12,"pixelRatio":1},"night-car-12":{"x":14,"y":144,"width":12,"height":12,"pixelRatio":1},"night-cemetery-12":{"x":28,"y":144,"width":12,"height":12,"pixelRatio":1},"night-chemist-12":{"x":42,"y":144,"width":12,"height":12,"pixelRatio":1},"night-cinema-12":{"x":56,"y":144,"width":12,"height":12,"pixelRatio":1},"night-circle-12":{"x":70,"y":144,"width":12,"height":12,"pixelRatio":1},"night-circle-stroked-12":{"x":84,"y":144,"width":12,"height":12,"pixelRatio":1},"night-city-12":{"x":98,"y":144,"width":12,"height":12,"pixelRatio":1},"night-clothing-store-12":{"x":112,"y":144,"width":12,"height":12,"pixelRatio":1},"night-college-12":{"x":126,"y":144,"width":12,"height":12,"pixelRatio":1},"night-commercial-12":{"x":140,"y":144,"width":12,"height":12,"pixelRatio":1},"night-cricket-12":{"x":160,"y":0,"width":12,"height":12,"pixelRatio":1},"night-cross-12":{"x":160,"y":14,"width":12,"height":12,"pixelRatio":1},"night-dam-12":{"x":160,"y":28,"width":12,"height":12,"pixelRatio":1},"night-danger-12":{"x":160,"y":42,"width":12,"height":12,"pixelRatio":1},"night-disability-12":{"x":160,"y":56,"width":12,"height":12,"pixelRatio":1},"night-dog-park-12":{"x":160,"y":70,"width":12,"height":12,"pixelRatio":1},"night-embassy-12":{"x":160,"y":84,"width":12,"height":12,"pixelRatio":1},"night-emergency-telephone-12":{"x":160,"y":98,"width":12,"height":12,"pixelRatio":1},"night-entrance-12":{"x":160,"y":112,"width":12,"height":12,"pixelRatio":1},"night-farm-12":{"x":160,"y":126,"width":12,"height":12,"pixelRatio":1},"night-fast-food-12":{"x":160,"y":140,"width":12,"height":12,"pixelRatio":1},"night-ferry-12":{"x":0,"y":158,"width":12,"height":12,"pixelRatio":1},"night-fire-station-12":{"x":14,"y":158,"width":12,"height":12,"pixelRatio":1},"night-fuel-12":{"x":28,"y":158,"width":12,"height":12,"pixelRatio":1},"night-garden-12":{"x":42,"y":158,"width":12,"height":12,"pixelRatio":1},"night-golf-12":{"x":56,"y":158,"width":12,"height":12,"pixelRatio":1},"night-grocery-12":{"x":70,"y":158,"width":12,"height":12,"pixelRatio":1},"night-hairdresser-12":{"x":84,"y":158,"width":12,"height":12,"pixelRatio":1},"night-harbor-12":{"x":98,"y":158,"width":12,"height":12,"pixelRatio":1},"night-heart-12":{"x":112,"y":158,"width":12,"height":12,"pixelRatio":1},"night-heliport-12":{"x":126,"y":158,"width":12,"height":12,"pixelRatio":1},"night-hospital-12":{"x":140,"y":158,"width":12,"height":12,"pixelRatio":1},"night-industrial-12":{"x":154,"y":158,"width":12,"height":12,"pixelRatio":1},"night-land-use-12":{"x":174,"y":0,"width":12,"height":12,"pixelRatio":1},"night-laundry-12":{"x":174,"y":14,"width":12,"height":12,"pixelRatio":1},"airport-12":{"x":174,"y":28,"width":12,"height":12,"pixelRatio":1},"night-lighthouse-12":{"x":174,"y":42,"width":12,"height":12,"pixelRatio":1},"night-lodging-12":{"x":174,"y":56,"width":12,"height":12,"pixelRatio":1},"night-logging-12":{"x":174,"y":70,"width":12,"height":12,"pixelRatio":1},"night-london-underground-12":{"x":174,"y":84,"width":12,"height":12,"pixelRatio":1},"night-marker-12":{"x":174,"y":98,"width":12,"height":12,"pixelRatio":1},"night-marker-stroked-12":{"x":174,"y":112,"width":12,"height":12,"pixelRatio":1},"night-minefield-12":{"x":174,"y":126,"width":12,"height":12,"pixelRatio":1},"night-mobilephone-12":{"x":174,"y":140,"width":12,"height":12,"pixelRatio":1},"night-monument-12":{"x":174,"y":154,"width":12,"height":12,"pixelRatio":1},"night-museum-12":{"x":0,"y":172,"width":12,"height":12,"pixelRatio":1},"night-music-12":{"x":14,"y":172,"width":12,"height":12,"pixelRatio":1},"night-oil-well-12":{"x":28,"y":172,"width":12,"height":12,"pixelRatio":1},"night-park-12":{"x":42,"y":172,"width":12,"height":12,"pixelRatio":1},"night-park2-12":{"x":56,"y":172,"width":12,"height":12,"pixelRatio":1},"night-parking-12":{"x":70,"y":172,"width":12,"height":12,"pixelRatio":1},"night-parking-garage-12":{"x":84,"y":172,"width":12,"height":12,"pixelRatio":1},"night-pharmacy-12":{"x":98,"y":172,"width":12,"height":12,"pixelRatio":1},"night-pitch-12":{"x":112,"y":172,"width":12,"height":12,"pixelRatio":1},"night-place-of-worship-12":{"x":126,"y":172,"width":12,"height":12,"pixelRatio":1},"night-playground-12":{"x":140,"y":172,"width":12,"height":12,"pixelRatio":1},"night-police-12":{"x":154,"y":172,"width":12,"height":12,"pixelRatio":1},"night-polling-place-12":{"x":168,"y":172,"width":12,"height":12,"pixelRatio":1},"night-post-12":{"x":188,"y":0,"width":12,"height":12,"pixelRatio":1},"night-prison-12":{"x":188,"y":14,"width":12,"height":12,"pixelRatio":1},"night-rail-12":{"x":188,"y":28,"width":12,"height":12,"pixelRatio":1},"night-rail-above-12":{"x":188,"y":42,"width":12,"height":12,"pixelRatio":1},"night-rail-light-12":{"x":188,"y":56,"width":12,"height":12,"pixelRatio":1},"night-rail-metro-12":{"x":188,"y":70,"width":12,"height":12,"pixelRatio":1},"night-rail-underground-12":{"x":188,"y":84,"width":12,"height":12,"pixelRatio":1},"night-religious-christian-12":{"x":188,"y":98,"width":12,"height":12,"pixelRatio":1},"night-religious-jewish-12":{"x":188,"y":112,"width":12,"height":12,"pixelRatio":1},"night-religious-muslim-12":{"x":188,"y":126,"width":12,"height":12,"pixelRatio":1},"night-restaurant-12":{"x":188,"y":140,"width":12,"height":12,"pixelRatio":1},"night-roadblock-12":{"x":188,"y":154,"width":12,"height":12,"pixelRatio":1},"night-rocket-12":{"x":188,"y":168,"width":12,"height":12,"pixelRatio":1},"night-school-12":{"x":0,"y":186,"width":12,"height":12,"pixelRatio":1},"night-scooter-12":{"x":14,"y":186,"width":12,"height":12,"pixelRatio":1},"night-shop-12":{"x":28,"y":186,"width":12,"height":12,"pixelRatio":1},"night-skiing-12":{"x":42,"y":186,"width":12,"height":12,"pixelRatio":1},"night-slaughterhouse-12":{"x":56,"y":186,"width":12,"height":12,"pixelRatio":1},"night-soccer-12":{"x":70,"y":186,"width":12,"height":12,"pixelRatio":1},"night-square-12":{"x":84,"y":186,"width":12,"height":12,"pixelRatio":1},"night-square-stroked-12":{"x":98,"y":186,"width":12,"height":12,"pixelRatio":1},"night-star-12":{"x":112,"y":186,"width":12,"height":12,"pixelRatio":1},"night-star-stroked-12":{"x":126,"y":186,"width":12,"height":12,"pixelRatio":1},"night-suitcase-12":{"x":140,"y":186,"width":12,"height":12,"pixelRatio":1},"night-swimming-12":{"x":154,"y":186,"width":12,"height":12,"pixelRatio":1},"night-telephone-12":{"x":168,"y":186,"width":12,"height":12,"pixelRatio":1},"night-tennis-12":{"x":182,"y":186,"width":12,"height":12,"pixelRatio":1},"night-theatre-12":{"x":202,"y":0,"width":12,"height":12,"pixelRatio":1},"night-toilets-12":{"x":202,"y":14,"width":12,"height":12,"pixelRatio":1},"night-town-12":{"x":202,"y":28,"width":12,"height":12,"pixelRatio":1},"night-town-hall-12":{"x":202,"y":42,"width":12,"height":12,"pixelRatio":1},"night-triangle-12":{"x":202,"y":56,"width":12,"height":12,"pixelRatio":1},"night-triangle-stroked-12":{"x":202,"y":70,"width":12,"height":12,"pixelRatio":1},"night-village-12":{"x":202,"y":84,"width":12,"height":12,"pixelRatio":1},"night-warehouse-12":{"x":202,"y":98,"width":12,"height":12,"pixelRatio":1},"night-waste-basket-12":{"x":202,"y":112,"width":12,"height":12,"pixelRatio":1},"night-water-12":{"x":202,"y":126,"width":12,"height":12,"pixelRatio":1},"night-wetland-12":{"x":202,"y":140,"width":12,"height":12,"pixelRatio":1},"night-zoo-12":{"x":202,"y":154,"width":12,"height":12,"pixelRatio":1},"oil-well-12":{"x":202,"y":168,"width":12,"height":12,"pixelRatio":1},"park-12":{"x":202,"y":182,"width":12,"height":12,"pixelRatio":1},"park2-12":{"x":0,"y":200,"width":12,"height":12,"pixelRatio":1},"parking-12":{"x":14,"y":200,"width":12,"height":12,"pixelRatio":1},"parking-garage-12":{"x":28,"y":200,"width":12,"height":12,"pixelRatio":1},"pharmacy-12":{"x":42,"y":200,"width":12,"height":12,"pixelRatio":1},"pitch-12":{"x":56,"y":200,"width":12,"height":12,"pixelRatio":1},"place-of-worship-12":{"x":70,"y":200,"width":12,"height":12,"pixelRatio":1},"playground-12":{"x":84,"y":200,"width":12,"height":12,"pixelRatio":1},"police-12":{"x":98,"y":200,"width":12,"height":12,"pixelRatio":1},"polling-place-12":{"x":112,"y":200,"width":12,"height":12,"pixelRatio":1},"post-12":{"x":126,"y":200,"width":12,"height":12,"pixelRatio":1},"prison-12":{"x":140,"y":200,"width":12,"height":12,"pixelRatio":1},"rail-12":{"x":154,"y":200,"width":12,"height":12,"pixelRatio":1},"rail-above-12":{"x":168,"y":200,"width":12,"height":12,"pixelRatio":1},"rail-light-12":{"x":182,"y":200,"width":12,"height":12,"pixelRatio":1},"rail-metro-12":{"x":196,"y":200,"width":12,"height":12,"pixelRatio":1},"rail-underground-12":{"x":216,"y":0,"width":12,"height":12,"pixelRatio":1},"religious-christian-12":{"x":216,"y":14,"width":12,"height":12,"pixelRatio":1},"religious-jewish-12":{"x":216,"y":28,"width":12,"height":12,"pixelRatio":1},"religious-muslim-12":{"x":216,"y":42,"width":12,"height":12,"pixelRatio":1},"restaurant-12":{"x":216,"y":56,"width":12,"height":12,"pixelRatio":1},"roadblock-12":{"x":216,"y":70,"width":12,"height":12,"pixelRatio":1},"rocket-12":{"x":216,"y":84,"width":12,"height":12,"pixelRatio":1},"school-12":{"x":216,"y":98,"width":12,"height":12,"pixelRatio":1},"scooter-12":{"x":216,"y":112,"width":12,"height":12,"pixelRatio":1},"shop-12":{"x":216,"y":126,"width":12,"height":12,"pixelRatio":1},"skiing-12":{"x":216,"y":140,"width":12,"height":12,"pixelRatio":1},"slaughterhouse-12":{"x":216,"y":154,"width":12,"height":12,"pixelRatio":1},"soccer-12":{"x":216,"y":168,"width":12,"height":12,"pixelRatio":1},"square-12":{"x":216,"y":182,"width":12,"height":12,"pixelRatio":1},"square-stroked-12":{"x":216,"y":196,"width":12,"height":12,"pixelRatio":1},"star-12":{"x":0,"y":214,"width":12,"height":12,"pixelRatio":1},"star-stroked-12":{"x":14,"y":214,"width":12,"height":12,"pixelRatio":1},"suitcase-12":{"x":28,"y":214,"width":12,"height":12,"pixelRatio":1},"swimming-12":{"x":42,"y":214,"width":12,"height":12,"pixelRatio":1},"telephone-12":{"x":56,"y":214,"width":12,"height":12,"pixelRatio":1},"tennis-12":{"x":70,"y":214,"width":12,"height":12,"pixelRatio":1},"theatre-12":{"x":84,"y":214,"width":12,"height":12,"pixelRatio":1},"toilets-12":{"x":98,"y":214,"width":12,"height":12,"pixelRatio":1},"town-12":{"x":112,"y":214,"width":12,"height":12,"pixelRatio":1},"town-hall-12":{"x":126,"y":214,"width":12,"height":12,"pixelRatio":1},"triangle-12":{"x":140,"y":214,"width":12,"height":12,"pixelRatio":1},"triangle-stroked-12":{"x":154,"y":214,"width":12,"height":12,"pixelRatio":1},"village-12":{"x":168,"y":214,"width":12,"height":12,"pixelRatio":1},"warehouse-12":{"x":182,"y":214,"width":12,"height":12,"pixelRatio":1},"waste-basket-12":{"x":196,"y":214,"width":12,"height":12,"pixelRatio":1},"water-12":{"x":210,"y":214,"width":12,"height":12,"pixelRatio":1},"wetland-12":{"x":230,"y":0,"width":12,"height":12,"pixelRatio":1},"airfield-12":{"x":230,"y":14,"width":12,"height":12,"pixelRatio":1},"alcohol-shop-12":{"x":230,"y":28,"width":12,"height":12,"pixelRatio":1},"america-football-12":{"x":230,"y":42,"width":12,"height":12,"pixelRatio":1},"art-gallery-12":{"x":230,"y":56,"width":12,"height":12,"pixelRatio":1},"zoo-12":{"x":230,"y":70,"width":12,"height":12,"pixelRatio":1},"wetland_noveg_16":{"x":0,"y":228,"width":16,"height":8,"pixelRatio":1},"wetland_16":{"x":18,"y":228,"width":16,"height":8,"pixelRatio":1}} \ No newline at end of file diff --git a/test/fixtures/sprites/outdoors.png b/test/fixtures/sprites/outdoors.png deleted file mode 100644 index 61e99085f1..0000000000 Binary files a/test/fixtures/sprites/outdoors.png and /dev/null differ diff --git a/test/fixtures/styles/icons.info.json b/test/fixtures/styles/icons.info.json deleted file mode 100644 index e116913aa4..0000000000 --- a/test/fixtures/styles/icons.info.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "default": { - "zoom": 14, - "center": [52.499167, 13.418056], - "height": 256, - "log": [ - [1, "INFO", "HttpRequest", 200, "sprites/outdoors.json"], - [1, "INFO", "HttpRequest", 200, "sprites/outdoors.png"], - [1, "INFO", "HttpRequest", 200, "tiles/14-8803-5375.vector.pbf"], - [1, "INFO", "HttpRequest", 200, "tiles/14-8802-5375.vector.pbf"], - [1, "INFO", "HttpRequest", 200, "tiles/14-8803-5374.vector.pbf"], - [1, "INFO", "HttpRequest", 200, "tiles/14-8802-5374.vector.pbf"], - [6, "INFO", "HttpRequest"], - - [1, "INFO", "Sprite", "loaded sprites/outdoors"] - ] - } -} diff --git a/test/fixtures/styles/icons.style.json b/test/fixtures/styles/icons.style.json deleted file mode 100644 index 46adfbd408..0000000000 --- a/test/fixtures/styles/icons.style.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "version": 3, - "sources": { - "mapbox": { - "type": "vector", - "url": "tiles/{z}-{x}-{y}.vector.pbf", - "tileSize": 512, - "maxZoom": 14 - } - }, - "sprite": "sprites/outdoors", - "layers": [ - { - "id": "background", - "type": "background", - "style": { - "background-color": "green" - } - }, - { - "id": "poi", - "source": "mapbox", - "source-layer": "poi_label", - "type": "icon", - "filter": { "maki": "restaurant" }, - "render": { - "icon-image": "{maki}-12", - "icon-size": 12, - "icon-allow-overlap": true - } - } - ] -} diff --git a/test/fixtures/styles/icons/default.expected.png b/test/fixtures/styles/icons/default.expected.png deleted file mode 100644 index 17e3252c88..0000000000 Binary files a/test/fixtures/styles/icons/default.expected.png and /dev/null differ diff --git a/test/fixtures/styles/line-color.info.json b/test/fixtures/styles/line-color.info.json deleted file mode 100644 index d9be88b102..0000000000 --- a/test/fixtures/styles/line-color.info.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "default": { - "zoom": 14, - "center": [52.499167, 13.418056], - "height": 256, - "log": [ - [1, "INFO", "HttpRequest", 200, "tiles/14-8803-5375.vector.pbf"], - [1, "INFO", "HttpRequest", 200, "tiles/14-8802-5375.vector.pbf"], - [1, "INFO", "HttpRequest", 200, "tiles/14-8803-5374.vector.pbf"], - [1, "INFO", "HttpRequest", 200, "tiles/14-8802-5374.vector.pbf"], - [4, "INFO", "HttpRequest"] - ] - }, - "colored": { - "zoom": 14, - "center": [52.499167, 13.418056], - "height": 256, - "classes": ["colored"], - "log": [ - [1, "INFO", "HttpRequest", 200, "tiles/14-8803-5375.vector.pbf"], - [1, "INFO", "HttpRequest", 200, "tiles/14-8802-5375.vector.pbf"], - [1, "INFO", "HttpRequest", 200, "tiles/14-8803-5374.vector.pbf"], - [1, "INFO", "HttpRequest", 200, "tiles/14-8802-5374.vector.pbf"], - [4, "INFO", "HttpRequest"] - ] - } -} diff --git a/test/fixtures/styles/line-color.style.json b/test/fixtures/styles/line-color.style.json deleted file mode 100644 index 10f5fb9cb7..0000000000 --- a/test/fixtures/styles/line-color.style.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "version": 3, - "sources": { - "mapbox": { - "type": "vector", - "url": "tiles/{z}-{x}-{y}.vector.pbf", - "tileSize": 512, - "maxZoom": 14 - } - }, - "layers": [ - { - "id": "background", - "type": "background", - "style": { - "background-color": "white" - } - }, - { - "id": "road", - "source": "mapbox", - "source-layer": "road", - "type": "line", - "style": { - "line-width": 2, - "line-color": "#3590db" - }, - "style.colored": { - "line-color": "#222222" - } - } - ] -} diff --git a/test/fixtures/styles/line-color/colored.expected.png b/test/fixtures/styles/line-color/colored.expected.png deleted file mode 100644 index ffd1ac3fb5..0000000000 Binary files a/test/fixtures/styles/line-color/colored.expected.png and /dev/null differ diff --git a/test/fixtures/styles/line-color/default.expected.png b/test/fixtures/styles/line-color/default.expected.png deleted file mode 100644 index 6369f5620b..0000000000 Binary files a/test/fixtures/styles/line-color/default.expected.png and /dev/null differ diff --git a/test/fixtures/styles/road-width.info.json b/test/fixtures/styles/road-width.info.json deleted file mode 100644 index 0094f715ca..0000000000 --- a/test/fixtures/styles/road-width.info.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "z13.9": { - "zoom": 13.9, - "center": [52.499167, 13.418056], - "height": 256, - "log": [ - [1, "INFO", "HttpRequest", 200, "tiles/13-4401-2687.vector.pbf"], - [1, "INFO", "HttpRequest"] - ] - }, - "z14.0": { - "zoom": 14, - "center": [52.499167, 13.418056], - "height": 256, - "log": [ - [1, "INFO", "HttpRequest", 200, "tiles/14-8803-5375.vector.pbf"], - [1, "INFO", "HttpRequest", 200, "tiles/14-8802-5375.vector.pbf"], - [1, "INFO", "HttpRequest", 200, "tiles/14-8803-5374.vector.pbf"], - [1, "INFO", "HttpRequest", 200, "tiles/14-8802-5374.vector.pbf"], - [4, "INFO", "HttpRequest"] - ] - }, - "z14.1": { - "zoom": 14.1, - "center": [52.499167, 13.418056], - "height": 256, - "log": [ - [1, "INFO", "HttpRequest", 200, "tiles/14-8803-5375.vector.pbf"], - [1, "INFO", "HttpRequest", 200, "tiles/14-8802-5375.vector.pbf"], - [1, "INFO", "HttpRequest", 200, "tiles/14-8803-5374.vector.pbf"], - [1, "INFO", "HttpRequest", 200, "tiles/14-8802-5374.vector.pbf"], - [4, "INFO", "HttpRequest"] - ] - }, - "z14.2": { - "zoom": 14.2, - "center": [52.499167, 13.418056], - "height": 256, - "log": [ - [1, "INFO", "HttpRequest", 200, "tiles/14-8803-5374.vector.pbf"], - [1, "INFO", "HttpRequest", 200, "tiles/14-8802-5374.vector.pbf"], - [2, "INFO", "HttpRequest"] - ] - } -} diff --git a/test/fixtures/styles/road-width.style.json b/test/fixtures/styles/road-width.style.json deleted file mode 100644 index 76d7b5258c..0000000000 --- a/test/fixtures/styles/road-width.style.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "version": 3, - "sources": { - "mapbox": { - "type": "vector", - "url": "tiles/{z}-{x}-{y}.vector.pbf", - "tileSize": 512, - "maxZoom": 14 - } - }, - "layers": [ - { - "id": "background", - "type": "background", - "style": { - "background-color": "white" - } - }, - { - "id": "road", - "source": "mapbox", - "source-layer": "road", - "type": "line", - "style": { - "line-width": { - "stops": [[13, 0], [13.999, 0], [14, 4], [14.1, 10], [14.2, 20]] - } - } - } - ] -} diff --git a/test/fixtures/styles/road-width/z13.9.expected.png b/test/fixtures/styles/road-width/z13.9.expected.png deleted file mode 100644 index e65d3339d6..0000000000 Binary files a/test/fixtures/styles/road-width/z13.9.expected.png and /dev/null differ diff --git a/test/fixtures/styles/road-width/z14.0.expected.png b/test/fixtures/styles/road-width/z14.0.expected.png deleted file mode 100644 index 01444c6f87..0000000000 Binary files a/test/fixtures/styles/road-width/z14.0.expected.png and /dev/null differ diff --git a/test/fixtures/styles/road-width/z14.1.expected.png b/test/fixtures/styles/road-width/z14.1.expected.png deleted file mode 100644 index 3a28f3c4de..0000000000 Binary files a/test/fixtures/styles/road-width/z14.1.expected.png and /dev/null differ diff --git a/test/fixtures/styles/road-width/z14.2.expected.png b/test/fixtures/styles/road-width/z14.2.expected.png deleted file mode 100644 index 8cd62453cb..0000000000 Binary files a/test/fixtures/styles/road-width/z14.2.expected.png and /dev/null differ diff --git a/test/fixtures/styles/world-aa.info.json b/test/fixtures/styles/world-aa.info.json deleted file mode 100644 index e5e123dcef..0000000000 --- a/test/fixtures/styles/world-aa.info.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "plain": { - "center": [0, 0], - "zoom": 0, - "log": [ - [ 1, "INFO", "HttpRequest", 200, "tiles/0-0-0.vector.pbf" ] - ] - } -} diff --git a/test/fixtures/styles/world-aa.style.json b/test/fixtures/styles/world-aa.style.json deleted file mode 100644 index 3165ec5b9f..0000000000 --- a/test/fixtures/styles/world-aa.style.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "version": 3, - "sources": { - "mapbox": { - "type": "vector", - "url": "tiles/{z}-{x}-{y}.vector.pbf", - "tileSize": 512, - "maxZoom": 14 - } - }, - "layers": [ - { - "id": "background", - "type": "background", - "style": { - "background-color": "red" - } - }, - { - "id": "water", - "source": "mapbox", - "source-layer": "water", - "type": "fill", - "style": { - "fill-color": "blue" - } - } - ] -} diff --git a/test/fixtures/styles/world-aa/plain.expected.png b/test/fixtures/styles/world-aa/plain.expected.png deleted file mode 100644 index d34c46a6c9..0000000000 Binary files a/test/fixtures/styles/world-aa/plain.expected.png and /dev/null differ diff --git a/test/fixtures/styles/world-no-aa.info.json b/test/fixtures/styles/world-no-aa.info.json deleted file mode 100644 index f5bc0c1462..0000000000 --- a/test/fixtures/styles/world-no-aa.info.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "plain": { - "center": [0, 0], - "zoom": 0, - "log": [ - [1, "INFO", "HttpRequest", 200, "tiles/0-0-0.vector.pbf"], - [1, "INFO", "HttpRequest"] - ] - } -} diff --git a/test/fixtures/styles/world-no-aa.style.json b/test/fixtures/styles/world-no-aa.style.json deleted file mode 100644 index c37774b662..0000000000 --- a/test/fixtures/styles/world-no-aa.style.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "version": 3, - "sources": { - "mapbox": { - "type": "vector", - "url": "tiles/{z}-{x}-{y}.vector.pbf", - "tileSize": 512, - "maxZoom": 14 - } - }, - "layers": [ - { - "id": "background", - "type": "background", - "style": { - "background-color": "red" - } - }, - { - "id": "water", - "source": "mapbox", - "source-layer": "water", - "type": "fill", - "style": { - "fill-color": "blue", - "fill-antialias": false - } - } - ] -} diff --git a/test/fixtures/styles/world-no-aa/plain.expected.png b/test/fixtures/styles/world-no-aa/plain.expected.png deleted file mode 100644 index 34e984cce3..0000000000 Binary files a/test/fixtures/styles/world-no-aa/plain.expected.png and /dev/null differ diff --git a/test/fixtures/tiles/0-0-0.vector.pbf b/test/fixtures/tiles/0-0-0.vector.pbf deleted file mode 100644 index 5eee529357..0000000000 Binary files a/test/fixtures/tiles/0-0-0.vector.pbf and /dev/null differ diff --git a/test/fixtures/tiles/13-4401-2687.vector.pbf b/test/fixtures/tiles/13-4401-2687.vector.pbf deleted file mode 100644 index f2165b8fe5..0000000000 Binary files a/test/fixtures/tiles/13-4401-2687.vector.pbf and /dev/null differ diff --git a/test/fixtures/tiles/14-8802-5374.vector.pbf b/test/fixtures/tiles/14-8802-5374.vector.pbf deleted file mode 100644 index a2277ea1ff..0000000000 Binary files a/test/fixtures/tiles/14-8802-5374.vector.pbf and /dev/null differ diff --git a/test/fixtures/tiles/14-8802-5375.vector.pbf b/test/fixtures/tiles/14-8802-5375.vector.pbf deleted file mode 100644 index 0804e8736c..0000000000 Binary files a/test/fixtures/tiles/14-8802-5375.vector.pbf and /dev/null differ diff --git a/test/fixtures/tiles/14-8803-5374.vector.pbf b/test/fixtures/tiles/14-8803-5374.vector.pbf deleted file mode 100644 index 4e66bead09..0000000000 Binary files a/test/fixtures/tiles/14-8803-5374.vector.pbf and /dev/null differ diff --git a/test/fixtures/tiles/14-8803-5375.vector.pbf b/test/fixtures/tiles/14-8803-5375.vector.pbf deleted file mode 100644 index f940be5992..0000000000 Binary files a/test/fixtures/tiles/14-8803-5375.vector.pbf and /dev/null differ diff --git a/test/fixtures/tiles/2-1-1.vector.pbf b/test/fixtures/tiles/2-1-1.vector.pbf deleted file mode 100644 index 00a5435b7e..0000000000 Binary files a/test/fixtures/tiles/2-1-1.vector.pbf and /dev/null differ diff --git a/test/fixtures/tiles/2-1-2.vector.pbf b/test/fixtures/tiles/2-1-2.vector.pbf deleted file mode 100644 index 4d26226c57..0000000000 Binary files a/test/fixtures/tiles/2-1-2.vector.pbf and /dev/null differ diff --git a/test/fixtures/tiles/2-2-1.vector.pbf b/test/fixtures/tiles/2-2-1.vector.pbf deleted file mode 100644 index a92e85b60e..0000000000 Binary files a/test/fixtures/tiles/2-2-1.vector.pbf and /dev/null differ diff --git a/test/fixtures/tiles/2-2-2.vector.pbf b/test/fixtures/tiles/2-2-2.vector.pbf deleted file mode 100644 index 209014708f..0000000000 Binary files a/test/fixtures/tiles/2-2-2.vector.pbf and /dev/null differ diff --git a/test/headless.cpp b/test/headless.cpp index 4838ca560c..bd84e37681 100644 --- a/test/headless.cpp +++ b/test/headless.cpp @@ -6,6 +6,8 @@ #include #include +#include +#include #include "../common/headless_view.hpp" @@ -16,24 +18,47 @@ const std::string base_directory = []{ std::string fn = __FILE__; fn.erase(fn.find_last_of("/")); - return fn + "/fixtures/styles"; + return fn + "/../node_modules/mapbox-gl-test-suite/"; }(); class HeadlessTest : public ::testing::TestWithParam {}; +void ResolveLocalURL(rapidjson::Value& value, rapidjson::Document& doc) { + std::string str { value.GetString(), value.GetStringLength() }; + str.replace(0, 8, base_directory); // local:// + value.SetString(str.c_str(), str.length(), doc.GetAllocator()); +} + TEST_P(HeadlessTest, render) { using namespace mbgl; const std::string &base = GetParam(); - const std::string style = util::read_file(base_directory + "/" + base + ".style.json"); - const std::string info = util::read_file(base_directory + "/" + base + ".info.json"); + std::string style = util::read_file(base_directory + "tests/" + base + "/style.json"); + std::string info = util::read_file(base_directory + "tests/" + base + "/info.json"); + + // Parse style. + rapidjson::Document styleDoc; + styleDoc.Parse<0>((const char *const)style.c_str()); + ASSERT_EQ(false, styleDoc.HasParseError()); + ASSERT_EQ(true, styleDoc.IsObject()); + + if (styleDoc.HasMember("sprite")) { + ResolveLocalURL(styleDoc["sprite"], styleDoc); + } + + ResolveLocalURL(styleDoc["sources"]["mapbox"]["url"], styleDoc); + + rapidjson::StringBuffer buffer; + rapidjson::Writer writer(buffer); + styleDoc.Accept(writer); + style = buffer.GetString(); // Parse settings. - rapidjson::Document doc; - doc.Parse<0>((const char *const)info.c_str()); - ASSERT_EQ(false, doc.HasParseError()); - ASSERT_EQ(true, doc.IsObject()); + rapidjson::Document infoDoc; + infoDoc.Parse<0>((const char *const)info.c_str()); + ASSERT_EQ(false, infoDoc.HasParseError()); + ASSERT_EQ(true, infoDoc.IsObject()); Log::Set(); @@ -41,15 +66,13 @@ TEST_P(HeadlessTest, render) { HeadlessView view; Map map(view); - for (auto it = doc.MemberBegin(), end = doc.MemberEnd(); it != end; it++) { - const FixtureLogBackend &log = Log::Set(); - + for (auto it = infoDoc.MemberBegin(), end = infoDoc.MemberEnd(); it != end; it++) { const std::string name { it->name.GetString(), it->name.GetStringLength() }; const rapidjson::Value &value = it->value; ASSERT_EQ(true, value.IsObject()); if (value.HasMember("center")) ASSERT_EQ(true, value["center"].IsArray()); - const std::string actual_image = base_directory + "/" + base + "/" + name + ".actual.png"; + const std::string actual_image = base_directory + "tests/" + base + "/" + name + "/actual.png"; const double zoom = value.HasMember("zoom") ? value["zoom"].GetDouble() : 0; const double bearing = value.HasMember("bearing") ? value["bearing"].GetDouble() : 0; @@ -84,73 +107,22 @@ TEST_P(HeadlessTest, render) { const std::string image = util::compress_png(width, height, pixels.get(), true); util::write_file(actual_image, image); - - if (value.HasMember("log")) { - const rapidjson::Value &js_log = value["log"]; - ASSERT_EQ(true, js_log.IsArray()); - for (rapidjson::SizeType i = 0; i < js_log.Size(); i++) { - const rapidjson::Value &js_entry = js_log[i]; - ASSERT_EQ(true, js_entry.IsArray()); - if (js_entry.Size() == 5) { - const uint32_t count = js_entry[rapidjson::SizeType(0)].GetUint(); - const FixtureLogBackend::LogMessage message { - EventSeverityClass(js_entry[rapidjson::SizeType(1)].GetString()), - EventClass(js_entry[rapidjson::SizeType(2)].GetString()), - js_entry[rapidjson::SizeType(3)].GetInt64(), - js_entry[rapidjson::SizeType(4)].GetString() - }; - ASSERT_EQ(count, log.count(message)) << "Message: " << message << "Full Log: " << std::endl << log.messages; - } else if (js_entry.Size() == 4) { - const uint32_t count = js_entry[rapidjson::SizeType(0)].GetUint(); - if (js_entry[rapidjson::SizeType(3)].IsString()) { - const FixtureLogBackend::LogMessage message { - EventSeverityClass(js_entry[rapidjson::SizeType(1)].GetString()), - EventClass(js_entry[rapidjson::SizeType(2)].GetString()), - js_entry[rapidjson::SizeType(3)].GetString() - }; - ASSERT_EQ(count, log.count(message)) << "Message: " << message << "Full Log: " << std::endl << log.messages; - } else { - const FixtureLogBackend::LogMessage message { - EventSeverityClass(js_entry[rapidjson::SizeType(1)].GetString()), - EventClass(js_entry[rapidjson::SizeType(2)].GetString()), - js_entry[rapidjson::SizeType(3)].GetInt64() - }; - ASSERT_EQ(count, log.count(message)) << "Message: " << message << "Full Log: " << std::endl << log.messages; - } - } else if (js_entry.Size() == 3) { - const uint32_t count = js_entry[rapidjson::SizeType(0)].GetUint(); - const FixtureLogBackend::LogMessage message { - EventSeverityClass(js_entry[rapidjson::SizeType(1)].GetString()), - EventClass(js_entry[rapidjson::SizeType(2)].GetString()) - }; - ASSERT_EQ(count, log.count(message)) << "Message: " << message << "Full Log: " << std::endl << log.messages; - } else { - FAIL(); - } - } - } - - const auto &unchecked = log.unchecked(); - if (unchecked.size()) { - std::cerr << "Unchecked Log Messages (" << base << "/" << name << "): " << std::endl << unchecked; - } } } INSTANTIATE_TEST_CASE_P(Headless, HeadlessTest, ::testing::ValuesIn([] { std::vector names; - const std::string ending = ".info.json"; - DIR *dir = opendir(base_directory.c_str()); + DIR *dir = opendir((base_directory + "tests").c_str()); if (dir == nullptr) { return names; } for (dirent *dp = nullptr; (dp = readdir(dir)) != nullptr;) { const std::string name = dp->d_name; - if (name.length() >= ending.length() && name.compare(name.length() - ending.length(), ending.length(), ending) == 0) { - names.push_back(name.substr(0, name.length() - ending.length())); + if (name != "." && name != ".." && name != "index.html") { + names.push_back(name); } } -- cgit v1.2.1