-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test that SLD style is applied in map thumbnail
- Loading branch information
Showing
3 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ | ||
"abstract": "World places and boundaries abstract", | ||
"title": "World places and boundaries", | ||
"extent": [ | ||
"-35.0", | ||
"-48.5", | ||
"179", | ||
"81.5" | ||
], | ||
"projection": "epsg:3857", | ||
"layers": [ | ||
{ | ||
"metadata": {}, | ||
"visibility": true, | ||
"opacity": 1, | ||
"title": "Staty", | ||
"className": "HSLayers.Layer.WMS", | ||
"singleTile": true, | ||
"url": "http://localhost:8000/geoserver/test_sld_style_applied_in_map_thumbnail_workspace_wms/ows", | ||
"params": { | ||
"LAYERS": "test_sld_style_applied_in_map_thumbnail_layer", | ||
"FORMAT": "image\/png" | ||
} | ||
}, | ||
{ | ||
"metadata": {}, | ||
"visibility": true, | ||
"opacity": 1, | ||
"title": "Defini\u010dn\u00ed body administrativn\u00edch celk\u016f", | ||
"className": "HSLayers.Layer.WMS", | ||
"singleTile": true, | ||
"wmsMaxScale": 0, | ||
"legends": [ | ||
"https%3A%2F%2Fgeoportal.kraj-lbc.cz%2Fcgi-bin%2Fmapserv%3Fmap%3D%2Fdata%2Fgis%2FMapServer%2Fprojects%2Fwms%2Fatlas%2Fadministrativni_cleneni.map%26version%3D1.3.0%26service%3DWMS%26request%3DGetLegendGraphic%26sld_version%3D1.1.0%26layer%3Ddefinicni_body_administrativnich_celku%26format%3Dimage%2Fpng%26STYLE%3Ddefault" | ||
], | ||
"maxResolution": null, | ||
"minResolution": 0, | ||
"url": "https%3A%2F%2Fgeoportal.kraj-lbc.cz%2Fcgi-bin%2Fmapserv%3Fmap%3D%2Fdata%2Fgis%2FMapServer%2Fprojects%2Fwms%2Fatlas%2Fadministrativni_cleneni.map%26", | ||
"params": { | ||
"LAYERS": "definicni_body_administrativnich_celku", | ||
"INFO_FORMAT": "application\/vnd.ogc.gml", | ||
"FORMAT": "image\/png", | ||
"FROMCRS": "EPSG:3857", | ||
"VERSION": "1.3.0" | ||
}, | ||
"dimensions": {} | ||
} | ||
] | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import pytest | ||
from layman import app | ||
from . import thumbnail | ||
from test import process_client, util | ||
|
||
|
||
headers_sld = { | ||
'Accept': 'application/vnd.ogc.sld+xml', | ||
'Content-type': 'application/xml', | ||
} | ||
|
||
|
||
@pytest.mark.usefixtures('ensure_layman') | ||
def test_sld_style_applied_in_map_thumbnail(): | ||
workspace = 'test_sld_style_applied_in_map_thumbnail_workspace' | ||
layer = 'test_sld_style_applied_in_map_thumbnail_layer' | ||
map = 'test_sld_style_applied_in_map_thumbnail_map' | ||
geojson_file = ['/code/tmp/naturalearth/110m/cultural/ne_110m_admin_0_countries.geojson'] | ||
map_file = ['sample/layman.map/internal_url_thumbnail.json'] | ||
style_file = 'sample/style/generic-blue.xml' | ||
expected_file = 'sample/style/test_sld_style_applied_in_map_thumbnail_map.png' | ||
|
||
process_client.publish_layer(workspace, | ||
layer, | ||
file_paths=geojson_file, | ||
style_file=style_file) | ||
|
||
process_client.publish_map(workspace, | ||
map, | ||
file_paths=map_file) | ||
|
||
with app.app_context(): | ||
thumbnail_path = thumbnail.get_map_thumbnail_path(workspace, map) | ||
|
||
diffs = util.compare_images(expected_file, thumbnail_path) | ||
|
||
assert diffs < 1000 | ||
|
||
process_client.delete_map(workspace, map) | ||
process_client.delete_layer(workspace, layer) |