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

Removed submodule maplibre-gl-js #938

Merged
merged 9 commits into from
Mar 25, 2023
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
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 0 additions & 1 deletion .github/workflows/android-ci-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ on:
- "src/**"
- "test/**"
- "vendor/**"
- maplibre-gl-js
- ".gitmodules"
- "!**/*.md"

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/android-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ on:
- "src/**"
- "test/**"
- "vendor/**"
- maplibre-gl-js
- ".gitmodules"
- "!**/*.md"

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/core-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
- "include/**"
- "workflows/core-build.yml"
- "vendor/**"
- maplibre-gl-js
- "CMakeLists.txt"

concurrency:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ios-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ on:
- "src/**"
- "test/**"
- "vendor/**"
- maplibre-gl-js
- ".gitmodules"
- "!**/*.md"

Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/macos-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ on:
- "src/**"
- "test/**"
- "vendor/**"
- maplibre-gl-js
- ".gitmodules"
- "!**/*.md"

Expand All @@ -42,7 +41,6 @@ on:
- "src/**"
- "test/**"
- "vendor/**"
- maplibre-gl-js
- ".gitmodules"
- "!**/*.md"

Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ on:
- "src/**"
- "test/**"
- "vendor/**"
- maplibre-gl-js
- ".gitmodules"
- "!**/*.md"

Expand All @@ -50,7 +49,6 @@ on:
- "src/**"
- "test/**"
- "vendor/**"
- maplibre-gl-js
- ".gitmodules"
- "!**/*.md"

Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/qt-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ on:
- "src/**"
- "test/**"
- "vendor/**"
- maplibre-gl-js
- ".gitmodules"
- "!**/*.md"

Expand All @@ -44,7 +43,6 @@ on:
- "src/**"
- "test/**"
- "vendor/**"
- maplibre-gl-js
- ".gitmodules"
- "!**/*.md"

Expand Down
56 changes: 0 additions & 56 deletions .github/workflows/update-gl-js.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@
[submodule "platform/android/vendor/mapbox-gestures-android"]
path = platform/android/vendor/mapbox-gestures-android
url = https://github.com/mapbox/mapbox-gestures-android.git
[submodule "maplibre-gl-js"]
path = maplibre-gl-js
url = https://github.com/maplibre/maplibre-gl-js.git
[submodule "docs/doxygen/doxygen-awesome-css"]
path = docs/doxygen/doxygen-awesome-css
url = https://github.com/jothepro/doxygen-awesome-css.git
Expand Down
8 changes: 0 additions & 8 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@ Code and build scripts belonging to platform SDKs are contained in the `platform
- `platform/android` - Android SDK, forked from https://github.com/mapbox/mapbox-gl-native-android/commit/4c12fb2c.
- `platform/glfw` - [GLFW](https://www.glfw.org) is library to support OpenGL development on the desktop. The code in this directory builds an executable application `mbgl-glfw` for demo/dev/local testing purposes.

## Maplibre-gl-js

`maplibre-gl-js` is added to this repostiory as a top-level submodule to provide

- Test cases and test data, e.g. all rendering test manifests json files under `render-test` load test cases from `maplibre-gl-js/test/*`.
- Shader written in GLSL ES.
- Style specification

## Other directories

- `benchmark` contains the performance tests built using https://github.com/google/benchmark/. The code under this directory builds the `mbgl-benchmark-test` executable to execute the benchmark tests.
Expand Down
15 changes: 7 additions & 8 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ To check that the output of the rendering is correct, we compare actual rendered
The directory sturcture of the render tests looks like:

```
maplibre-gl-js/
test/
integration/
render-tests/
<name-of-style-spec-feature>/
<name-of-feature-value>/
expected.png
style.json
maetrics/
integration/
render-tests/
<name-of-style-spec-feature>/
<name-of-feature-value>/
expected.png
style.json
```

After the render test run, the folder will also contain an `actual.png` file and a `diff.png` which is the difference between the expected and the actual image. There is a pixel difference threshold value which is used to decide if a render test passed or failed.
Expand Down
2 changes: 1 addition & 1 deletion expression-test/expression_test_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ std::tuple<filesystem::path, std::vector<filesystem::path>, bool, uint32_t> pars
exit(2);
}

filesystem::path rootPath {std::string(TEST_RUNNER_ROOT_PATH).append("/maplibre-gl-js/test/integration/expression-tests")};
filesystem::path rootPath {std::string(TEST_RUNNER_ROOT_PATH).append("/metrics/integration/expression-tests")};
if (!filesystem::exists(rootPath)) {
Log::Error(Event::General, "Test path '" + rootPath.string() + "' does not exist.");
exit(3);
Expand Down
1 change: 0 additions & 1 deletion maplibre-gl-js
Submodule maplibre-gl-js deleted from 9489d7
2 changes: 1 addition & 1 deletion metrics/FIXME-linux-asan-style.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"base_test_path": "../maplibre-gl-js/test/integration",
"base_test_path": "integration",
"cache_path": "cache-style.db",
"expectation_paths": [
"expectations/platform-all"
Expand Down
2 changes: 1 addition & 1 deletion metrics/android-render-test-runner-style.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"base_test_path": "../maplibre-gl-js/test/integration",
"base_test_path": "integration",
"cache_path": "cache-style.db",
"expectation_paths": [
"expectations/platform-all",
Expand Down
157 changes: 157 additions & 0 deletions metrics/integration/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
These integration tests verify the 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. For example, the test for specifying a literal `circle-radius` value lives in [`test/integration/render-tests/circle-radius/literal/`](https://github.com/mapbox/mapbox-gl-js/tree/master/test/integration/render-tests/circle-radius/literal).

Within a leaf directory is a `style.json` file (e.g. [`circle-radius/literal/style.json`](https://github.com/mapbox/mapbox-gl-js/blob/master/test/integration/render-tests/circle-radius/literal/style.json)), 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 (e.g. output image dimensions).

The expected output for a given test case is in `expected.png`, e.g. [`circle-radius/literal/expected.png`](https://github.com/mapbox/mapbox-gl-js/blob/master/test/integration/render-tests/circle-radius/literal/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 (see below).

## Running tests

To run the entire integration test suite (both render or query tests), from within the `mapbox-gl-js` directory run the command:
```
yarn run test-suite
```

To run only the render/query tests:

```
yarn run test-render
```
or
```
yarn run test-query-node
```

### Running specific tests

To run a subset of tests or an individual test, you can pass a specific subdirectory to the `test-render` script. For example, to run all the tests for a given property, e.g. `circle-radius`:
```
$ yarn run test-render circle-radius
...
* passed circle-radius/antimeridian
* passed circle-radius/default
* passed circle-radius/function
* passed circle-radius/literal
* passed circle-radius/property-function
* passed circle-radius/zoom-and-property-function
6 passed (100.0%)
Results at: ./test/integration/render-tests/index.html
Done in 2.71s.
```
Or to run a single test:
```
$ yarn run test-render circle-radius/literal
...
* passed circle-radius/literal
1 passed (100.0%)
Results at: ./test/integration/render-tests/index.html
Done in 2.32s.
```

### Viewing test results

During a test run, the test harness will use GL-JS to create an `actual.png` image from the given `style.json`, and will then use [pixelmatch](https://github.com/mapbox/pixelmatch) to compare that image to `expected.png`, generating a `diff.png` highlighting the mismatching pixels (if any) in red.

After the test(s) have run, you can view the results graphically by opening the `index.html` file generated by the harness:

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

## Running tests in the browser

Query tests can be run in the browser, the server for serving up the test page and test fixtures starts when you run
```
yarn run start
```
OR
```
yarn run start-debug
```

If you want to run only the test server run:
```
yarn run watch-query
```

Then open the following url in the browser of your choice to start running the tests.
```
http://localhost:7357/
```

### Running specific tests

A filter can be specified by using the `filter` query param in the url. E.g, adding
```
?filter=circle-pitch
```
to the end of the url will only run the tests that contain `circle-pitch` in the name.

### Build Notifications

The terminal window can be very noisy with both the build and the test servers running in the same session.
So the server uses platform notifications to inform when the build has finished. If this behaviour is annoying, it can be disabled by setting the following env-var
```
DISABLE_BUILD_NOTIFICATIONS=true
```


## Writing new tests

_Note: 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._

To add a new render test:
1. Create a new directory `test/integration/render-tests/<property-name>/<new-test-name>`

2. Create a new `style.json` file within that directory, specifying the map to load. Feel free to copy & modify one of the existing `style.json` files from the `render-tests` subdirectories.

3. Generate an `expected.png` image from the given style by running the new test with the `UPDATE` flag enabled:
```
$ UPDATE=1 yarn run test-render <property-name>/<new-test-name>
```
The test will appear to fail, but you'll now see a new `expected.png` in the test directory.

4. Manually inspect `expected.png` to verify it looks as expected, and optionally run the test again without the update flag (`yarn run test-render <property-name>/<new-test-name>`) to watch it pass (enjoy that dopamine kick!)

5. Commit the new `style.json` and `expected.png` :rocket:


## 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