[render-test] Add tests for filesize probe
And make sure we run it on the bots
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -4,6 +4,9 @@
|
||||
*.gcno
|
||||
*.gcda
|
||||
*~
|
||||
**/actual.png
|
||||
**/diff.png
|
||||
render-test/index.html
|
||||
offline.db
|
||||
new_offline.db
|
||||
xcuserdata
|
||||
@@ -19,8 +22,6 @@ xcuserdata
|
||||
/test/fixtures/api/2.png
|
||||
/test/fixtures/offline_database/offline.db
|
||||
/test/fixtures/offline_database/offline.db-*
|
||||
/test/fixtures/**/actual.png
|
||||
/test/fixtures/**/diff.png
|
||||
/test/output
|
||||
/node_modules
|
||||
/platform/ios/benchmark/assets/glyphs/DIN*
|
||||
|
||||
@@ -47,8 +47,19 @@ add_test(
|
||||
render-tests
|
||||
--recycle-map
|
||||
--shuffle
|
||||
--seed
|
||||
${MBGL_RENDER_TEST_SEED}
|
||||
--seed=${MBGL_RENDER_TEST_SEED}
|
||||
WORKING_DIRECTORY ${MBGL_ROOT}
|
||||
)
|
||||
|
||||
add_test(
|
||||
NAME mbgl-render-test-probes
|
||||
COMMAND
|
||||
mbgl-render-test
|
||||
render-tests
|
||||
--recycle-map
|
||||
--shuffle
|
||||
--seed=${MBGL_RENDER_TEST_SEED}
|
||||
--rootPath=render-test
|
||||
WORKING_DIRECTORY ${MBGL_ROOT}
|
||||
)
|
||||
|
||||
|
||||
@@ -421,15 +421,17 @@ std::vector<std::pair<std::string, std::string>> parseIgnores() {
|
||||
auto mainIgnoresPath = mbgl::filesystem::path(TEST_RUNNER_ROOT_PATH).append("platform/node/test/ignores.json");
|
||||
|
||||
mbgl::filesystem::path platformSpecificIgnores;
|
||||
mbgl::filesystem::path ownTestsIgnores =
|
||||
mbgl::filesystem::path(TEST_RUNNER_ROOT_PATH).append("render-test/tests/should-fail.json");
|
||||
|
||||
#ifdef __APPLE__
|
||||
platformSpecificIgnores = mbgl::filesystem::path(TEST_RUNNER_ROOT_PATH).append("render-test/mac-ignores.json");
|
||||
#elif __linux__
|
||||
platformSpecificIgnores = mbgl::filesystem::path(TEST_RUNNER_ROOT_PATH).append("render-test/linux-ignores.json");
|
||||
#endif
|
||||
|
||||
std::vector<mbgl::filesystem::path> ignoresPaths = { mainIgnoresPath, platformSpecificIgnores };
|
||||
for (auto path: ignoresPaths) {
|
||||
|
||||
std::vector<mbgl::filesystem::path> ignoresPaths = {mainIgnoresPath, platformSpecificIgnores, ownTestsIgnores};
|
||||
for (const auto& path : ignoresPaths) {
|
||||
auto maybeIgnores = readJson(path);
|
||||
if (!maybeIgnores.is<mbgl::JSDocument>()) {
|
||||
continue;
|
||||
|
||||
BIN
render-test/tests/filesize/fail-file-doesnt-match/expected.png
Normal file
BIN
render-test/tests/filesize/fail-file-doesnt-match/expected.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 686 B |
36
render-test/tests/filesize/fail-file-doesnt-match/style.json
Normal file
36
render-test/tests/filesize/fail-file-doesnt-match/style.json
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"version": 8,
|
||||
"metadata": {
|
||||
"test": {
|
||||
"operations": [
|
||||
["probeFileSize", "style", "aaaaa.json"],
|
||||
["probeFileSize", "image", "bbbbb.png"]
|
||||
],
|
||||
"width": 64,
|
||||
"height": 64
|
||||
}
|
||||
},
|
||||
"sources": {
|
||||
"geojson": {
|
||||
"type": "geojson",
|
||||
"data": {
|
||||
"type": "Point",
|
||||
"coordinates": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"sprite": "local://sprites/sprite",
|
||||
"layers": [
|
||||
{
|
||||
"id": "symbol",
|
||||
"type": "symbol",
|
||||
"source": "geojson",
|
||||
"layout": {
|
||||
"icon-image": "circle-12"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
render-test/tests/filesize/fail-size-is-over/expected.png
Normal file
BIN
render-test/tests/filesize/fail-size-is-over/expected.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 686 B |
@@ -0,0 +1 @@
|
||||
{"fileSize":[["image","../render-test/tests/filesize/fail-size-is-over/expected.png",100],["style","../render-test/tests/filesize/fail-size-is-over/style.json",100]]}
|
||||
36
render-test/tests/filesize/fail-size-is-over/style.json
Normal file
36
render-test/tests/filesize/fail-size-is-over/style.json
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"version": 8,
|
||||
"metadata": {
|
||||
"test": {
|
||||
"operations": [
|
||||
["probeFileSize", "style", "style.json"],
|
||||
["probeFileSize", "image", "expected.png"]
|
||||
],
|
||||
"width": 64,
|
||||
"height": 64
|
||||
}
|
||||
},
|
||||
"sources": {
|
||||
"geojson": {
|
||||
"type": "geojson",
|
||||
"data": {
|
||||
"type": "Point",
|
||||
"coordinates": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"sprite": "local://sprites/sprite",
|
||||
"layers": [
|
||||
{
|
||||
"id": "symbol",
|
||||
"type": "symbol",
|
||||
"source": "geojson",
|
||||
"layout": {
|
||||
"icon-image": "circle-12"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
render-test/tests/filesize/fail-size-is-under/expected.png
Normal file
BIN
render-test/tests/filesize/fail-size-is-under/expected.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 686 B |
@@ -0,0 +1 @@
|
||||
{"fileSize":[["image","../render-test/tests/filesize/fail-size-is-under/expected.png",999],["style","../render-test/tests/filesize/fail-size-is-under/style.json",999]]}
|
||||
36
render-test/tests/filesize/fail-size-is-under/style.json
Normal file
36
render-test/tests/filesize/fail-size-is-under/style.json
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"version": 8,
|
||||
"metadata": {
|
||||
"test": {
|
||||
"operations": [
|
||||
["probeFileSize", "style", "style.json"],
|
||||
["probeFileSize", "image", "expected.png"]
|
||||
],
|
||||
"width": 64,
|
||||
"height": 64
|
||||
}
|
||||
},
|
||||
"sources": {
|
||||
"geojson": {
|
||||
"type": "geojson",
|
||||
"data": {
|
||||
"type": "Point",
|
||||
"coordinates": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"sprite": "local://sprites/sprite",
|
||||
"layers": [
|
||||
{
|
||||
"id": "symbol",
|
||||
"type": "symbol",
|
||||
"source": "geojson",
|
||||
"layout": {
|
||||
"icon-image": "circle-12"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
render-test/tests/filesize/pass-size-is-same/expected.png
Normal file
BIN
render-test/tests/filesize/pass-size-is-same/expected.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 686 B |
@@ -0,0 +1 @@
|
||||
{"fileSize":[["image","../render-test/tests/filesize/pass-size-is-same/expected.png",686],["style","../render-test/tests/filesize/pass-size-is-same/style.json",609]]}
|
||||
36
render-test/tests/filesize/pass-size-is-same/style.json
Normal file
36
render-test/tests/filesize/pass-size-is-same/style.json
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"version": 8,
|
||||
"metadata": {
|
||||
"test": {
|
||||
"operations": [
|
||||
["probeFileSize", "style", "style.json"],
|
||||
["probeFileSize", "image", "expected.png"]
|
||||
],
|
||||
"width": 64,
|
||||
"height": 64
|
||||
}
|
||||
},
|
||||
"sources": {
|
||||
"geojson": {
|
||||
"type": "geojson",
|
||||
"data": {
|
||||
"type": "Point",
|
||||
"coordinates": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"sprite": "local://sprites/sprite",
|
||||
"layers": [
|
||||
{
|
||||
"id": "symbol",
|
||||
"type": "symbol",
|
||||
"source": "geojson",
|
||||
"layout": {
|
||||
"icon-image": "circle-12"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
5
render-test/tests/should-fail.json
Normal file
5
render-test/tests/should-fail.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"tests/filesize/fail-size-is-over": "Should fail, size is bigger than expected.",
|
||||
"tests/filesize/fail-size-is-under": "Should fail, size is smaller than expected.",
|
||||
"tests/filesize/fail-file-doesnt-match": "Should fail, file not found."
|
||||
}
|
||||
Reference in New Issue
Block a user