Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 'mapbox-gl-test-suite' repo without preserving git history #3834

Merged
merged 5 commits into from
Jan 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ coverage
.nyc_output
*_generated.js
yarn.lock
test/integration/**/index.html
test/integration/**/actual.png
test/integration/**/diff.png
2 changes: 1 addition & 1 deletion debug/chinese.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
map.on('load', function () {
map.addSource("points", {
"type": "geojson",
"data": '/node_modules/mapbox-gl-test-suite/data/chinese.geojson'
"data": '/test/integration/data/chinese.geojson'
});

map.addLayer({
Expand Down
2 changes: 1 addition & 1 deletion debug/circles.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

map.addSource('circles', {
"type": "geojson",
"data": "/node_modules/mapbox-gl-test-suite/data/places.geojson"
"data": "/test/integration/data/places.geojson"
});

map.addLayer({
Expand Down
4 changes: 2 additions & 2 deletions debug/cluster.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
"sources": {
"geojson": {
"type": "geojson",
"data": "/node_modules/mapbox-gl-test-suite/data/places.geojson",
"data": "/test/integration/data/places.geojson",
"cluster": true,
"clusterRadius": 25
}
},
"glyphs": "/node_modules/mapbox-gl-test-suite/glyphs/{fontstack}/{range}.pbf",
"glyphs": "/test/integration/glyphs/{fontstack}/{range}.pbf",
"layers": [
{
"id": "cluster",
Expand Down
2 changes: 1 addition & 1 deletion debug/debug.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
map.on('load', function() {
map.addSource('geojson', {
"type": "geojson",
"data": "/node_modules/mapbox-gl-test-suite/data/linestring.geojson"
"data": "/test/integration/data/linestring.geojson"
});
map.addLayer({
"id": "route",
Expand Down
2 changes: 1 addition & 1 deletion debug/image.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"sources": {
"image": {
"type": "image",
"url": "/node_modules/mapbox-gl-test-suite/image/0.png",
"url": "/test/integration/image/0.png",
"coordinates": [
[-122.51596391201019, 37.56238816766053],
[-122.51467645168304, 37.56410183312965],
Expand Down
16 changes: 12 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,32 +46,39 @@
"benchmark": "~2.1.0",
"browserify": "^13.0.0",
"clipboard": "^1.5.12",
"colors": "^1.1.2",
"concat-stream": "1.5.2",
"coveralls": "^2.11.8",
"d3-queue": "^3.0.3",
"diff": "^3.0.0",
"documentation": "4.0.0-beta12",
"envify": "^3.4.0",
"eslint": "3.12.1",
"eslint-config-mourner": "^2.0.0",
"eslint-plugin-flowtype": "^2.20.0",
"eslint-plugin-html": "^1.5.1",
"eslint": "3.12.1",
"flow-bin": "^0.36.0",
"flow-remove-types": "^1.0.4",
"github-slugger": "^1.1.1",
"gl": "^4.0.1",
"handlebars": "^4.0.5",
"highlight.js": "9.8.0",
"in-publish": "^2.0.0",
"jsdom": "^9.4.2",
"jsonlint": "^1.6.2",
"lodash.template": "^4.4.0",
"mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#7438620cfcdb406c6ea7f4a10918e4f5a2d517d6",
"minifyify": "^7.0.1",
"npm-run-all": "^3.0.0",
"nyc": "^8.3.0",
"pixelmatch": "^4.0.2",
"pngjs": "^3.0.0",
"proxyquire": "^1.7.9",
"sinon": "^1.15.4",
"st": "^1.1.0",
"st": "^1.2.0",
"tap": "^5.7.0",
"vinyl": "2.0.0",
"vinyl-fs": "2.4.4",
"vinyl": "2.0.0",
"watchify": "^3.7.0"
},
"browserify": {
Expand Down Expand Up @@ -110,13 +117,14 @@
"build-docs": "documentation build --github --format html --config documentation.yml --theme ./docs/_theme --output docs/api/",
"build": "npm run build-docs # invoked by publisher when publishing docs on the mb-pages branch",
"start-docs": "npm run build-min && npm run build-docs && jekyll serve --watch",
"lint": "eslint --ignore-path .gitignore js test bench docs/_posts/examples/*.html debug/*.html",
"lint": "eslint --ignore-path .gitignore js test bench docs/_posts/examples/*.html debug/*.html",
"lint-docs": "documentation lint",
"open-changed-examples": "git diff --name-only mb-pages HEAD -- docs/_posts/examples/*.html | awk '{print \"http://127.0.0.1:4000/mapbox-gl-js/example/\" substr($0,33,length($0)-37)}' | xargs open",
"plugin-deploy": "set -e; node plugins/exists.js; aws s3 sync --exclude *.DS_Store --acl public-read plugins/src s3://mapbox-gl-js/plugins/; echo ' -- DEPLOYED --'",
"test": "run-s lint test-unit test-plugin test-flow",
"test-plugin": "tap test/plugins/",
"test-suite": "run-s test-render test-query",
"test-suite-clean": "find test/integration/*-tests -mindepth 2 -type d -not \\( -exec test -e \"{}/style.json\" \\; \\) -print | xargs -t rm -r",
"test-unit": "tap --reporter dot --no-coverage test/js",
"test-render": "node test/render.test.js",
"test-query": "node test/query.test.js",
Expand Down
2 changes: 1 addition & 1 deletion test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ First you must configure your development environment per [`../CONTRIBUTING.md`]
There are two test suites associated with Mapbox GL JS

- `npm test` runs quick unit tests
- `npm run test-suite` runs integration tests from the [mapbox-gl-test-suite](https://github.com/mapbox/mapbox-gl-test-suite) repository
- `npm run test-suite` runs slower integration tests

## Writing Unit Tests

Expand Down
66 changes: 66 additions & 0 deletions test/integration/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
Verify correctness and consistency of [mapbox-gl-js](https://github.com/mapbox/mapbox-gl-js) and
[mapbox-gl-native](https://github.com/mapbox/mapbox-gl-native) rendering.

## Organization

Tests are contained in a directory tree, generally organized by [style specification](https://github.com/mapbox/mapbox-gl-style-spec)
property: `background-color`, `line-width`, etc., with a second level of directories below that for individual tests.

Within a leaf directory is a `style.json` file, which contains the minimal style needed for the given test case. The style can specify the map size, center, bearing, and pitch, and additional test metadata. The expected output for a given test case is in `expected.png`, e.g. [`tests/background-color/constant/expected.png`](https://github.com/mapbox/mapbox-gl-js/blob/master/test/integration/render-tests/background-color/constant/expected.png).

Supporting files -- glyphs, sprites, and tiles -- live in their own respective subdirectories at the top level. The test
harness sets up the environment such that requests for these resources are directed to the correct location.

The contents of vector tile fixtures can be read using the [`vt2geojson`](https://github.com/mapbox/vt2geojson) tool

## Running tests

Run `npm run test-suite` in mapbox-gl-js or mapbox-gl-native. To view the results graphically, run:

```
open ./test/integration/render-tests/index.html
```
or
```
open ./test/integration/query-tests/index.html
```

When run via Travis, the test artifacts are uploaded to S3 as a permanent record of results. Near the
end of the Travis output is a link to the result, for example:

http://mapbox.s3.amazonaws.com/mapbox-gl-native/tests/5952.10/index.html

## Writing new tests

Expected results are always generated with the **js** implementation. This is merely for consistency and does not
imply that in the event of a rendering discrepancy, the js implementation is always correct.

```
UPDATE=1 npm run test-suite
[review and commit changes]
```

### Reading Vector Tile Fixtures

Install `vt2geojson`, a command line utility which turns vector tiles into geojson, and `harp`, a simple file server.

```
npm install -g vt2geojson harp
```

Start a static file server
```
harp server .
```

Read the contents of an entire vector tile

```
vt2geojson -z 14 -y 8803 -x 5374 http://localhost:9000/tiles/14-8803-5374.mvt
```

Read the contents of a particular layer in a vector tile

```
vt2geojson --layer poi_label -z 14 -y 8803 -x 5374 http://localhost:9000/tiles/14-8803-5374.mvt
```
Loading