[render-test] Add tests for filesize probe

And make sure we run it on the bots
This commit is contained in:
Thiago Marcos P. Santos
2019-10-09 22:00:30 +03:00
parent 2e002746eb
commit 629c0e1142
15 changed files with 173 additions and 7 deletions

5
.gitignore vendored
View File

@@ -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*

View File

@@ -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}
)

View File

@@ -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;

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 B

View 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"
}
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 B

View File

@@ -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]]}

View 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"
}
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 B

View File

@@ -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]]}

View 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"
}
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 B

View File

@@ -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]]}

View 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"
}
}
]
}

View 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."
}