Skip to content

Commit 5cfbfbd

Browse files
authored
Merge pull request #4028 from rldhont/server-backport-release-2_18-tests
[Server] Backport tests for 2.18
2 parents e23a3d0 + 8e268da commit 5cfbfbd

File tree

29 files changed

+994
-9
lines changed

29 files changed

+994
-9
lines changed

src/server/qgswmsconfigparser.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ QgsComposition* QgsWMSConfigParser::createPrintComposition( const QString& compo
209209
//grid space x / y
210210
currentMap->grid()->setIntervalX( parameterMap.value( mapId + ":GRID_INTERVAL_X" ).toDouble() );
211211
currentMap->grid()->setIntervalY( parameterMap.value( mapId + ":GRID_INTERVAL_Y" ).toDouble() );
212+
currentMap->grid()->setEnabled( currentMap->grid()->intervalX() != 0.0 && currentMap->grid()->intervalY() != 0.0 );
212213
}
213214
//update legend
214215
// if it has an auto-update model

tests/src/python/test_qgsserver.py

Lines changed: 317 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,323 @@ def test_getfeature_post(self):
378378
for id, req in tests:
379379
self.wfs_getfeature_post_compare(id, req)
380380

381+
def test_wms_getmap_basic(self):
382+
qs = "&".join(["%s=%s" % i for i in list({
383+
"MAP": urllib.quote(self.projectPath),
384+
"SERVICE": "WMS",
385+
"VERSION": "1.1.1",
386+
"REQUEST": "GetMap",
387+
"LAYERS": "Country",
388+
"STYLES": "",
389+
"FORMAT": "image/png",
390+
"BBOX": "-16817707,-4710778,5696513,14587125",
391+
"HEIGHT": "500",
392+
"WIDTH": "500",
393+
"CRS": "EPSG:3857"
394+
}.items())])
395+
396+
r, h = self._result(self.server.handleRequest(qs))
397+
self._img_diff_error(r, h, "WMS_GetMap_Basic")
398+
399+
def test_wms_getmap_transparent(self):
400+
qs = "&".join(["%s=%s" % i for i in list({
401+
"MAP": urllib.quote(self.projectPath),
402+
"SERVICE": "WMS",
403+
"VERSION": "1.1.1",
404+
"REQUEST": "GetMap",
405+
"LAYERS": "Country",
406+
"STYLES": "",
407+
"FORMAT": "image/png",
408+
"BBOX": "-16817707,-4710778,5696513,14587125",
409+
"HEIGHT": "500",
410+
"WIDTH": "500",
411+
"CRS": "EPSG:3857",
412+
"TRANSPARENT": "TRUE"
413+
}.items())])
414+
415+
r, h = self._result(self.server.handleRequest(qs))
416+
self._img_diff_error(r, h, "WMS_GetMap_Transparent")
417+
418+
def test_wms_getmap_background(self):
419+
qs = "&".join(["%s=%s" % i for i in list({
420+
"MAP": urllib.quote(self.projectPath),
421+
"SERVICE": "WMS",
422+
"VERSION": "1.1.1",
423+
"REQUEST": "GetMap",
424+
"LAYERS": "Country",
425+
"STYLES": "",
426+
"FORMAT": "image/png",
427+
"BBOX": "-16817707,-4710778,5696513,14587125",
428+
"HEIGHT": "500",
429+
"WIDTH": "500",
430+
"CRS": "EPSG:3857",
431+
"BGCOLOR": "green"
432+
}.items())])
433+
434+
r, h = self._result(self.server.handleRequest(qs))
435+
self._img_diff_error(r, h, "WMS_GetMap_Background")
436+
437+
qs = "&".join(["%s=%s" % i for i in list({
438+
"MAP": urllib.quote(self.projectPath),
439+
"SERVICE": "WMS",
440+
"VERSION": "1.1.1",
441+
"REQUEST": "GetMap",
442+
"LAYERS": "Country",
443+
"STYLES": "",
444+
"FORMAT": "image/png",
445+
"BBOX": "-16817707,-4710778,5696513,14587125",
446+
"HEIGHT": "500",
447+
"WIDTH": "500",
448+
"CRS": "EPSG:3857",
449+
"BGCOLOR": "0x008000"
450+
}.items())])
451+
452+
r, h = self._result(self.server.handleRequest(qs))
453+
self._img_diff_error(r, h, "WMS_GetMap_Background_Hex")
454+
455+
def test_wms_getmap_order(self):
456+
qs = "&".join(["%s=%s" % i for i in list({
457+
"MAP": urllib.quote(self.projectPath),
458+
"SERVICE": "WMS",
459+
"VERSION": "1.1.1",
460+
"REQUEST": "GetMap",
461+
"LAYERS": "Hello,Country",
462+
"STYLES": "",
463+
"FORMAT": "image/png",
464+
"BBOX": "-16817707,-4710778,5696513,14587125",
465+
"HEIGHT": "500",
466+
"WIDTH": "500",
467+
"CRS": "EPSG:3857"
468+
}.items())])
469+
470+
r, h = self._result(self.server.handleRequest(qs))
471+
self._img_diff_error(r, h, "WMS_GetMap_LayerOrder")
472+
473+
def test_wms_getmap_srs(self):
474+
qs = "&".join(["%s=%s" % i for i in list({
475+
"MAP": urllib.quote(self.projectPath),
476+
"SERVICE": "WMS",
477+
"VERSION": "1.1.1",
478+
"REQUEST": "GetMap",
479+
"LAYERS": "Country,Hello",
480+
"STYLES": "",
481+
"FORMAT": "image/png",
482+
"BBOX": "-151.7,-38.9,51.0,78.0",
483+
"HEIGHT": "500",
484+
"WIDTH": "500",
485+
"CRS": "EPSG:4326"
486+
}.items())])
487+
488+
r, h = self._result(self.server.handleRequest(qs))
489+
self._img_diff_error(r, h, "WMS_GetMap_SRS")
490+
491+
def test_wms_getmap_style(self):
492+
# default style
493+
qs = "&".join(["%s=%s" % i for i in list({
494+
"MAP": urllib.quote(self.projectPath),
495+
"SERVICE": "WMS",
496+
"VERSION": "1.1.1",
497+
"REQUEST": "GetMap",
498+
"LAYERS": "Country_Labels",
499+
"STYLES": "",
500+
"FORMAT": "image/png",
501+
"BBOX": "-16817707,-4710778,5696513,14587125",
502+
"HEIGHT": "500",
503+
"WIDTH": "500",
504+
"CRS": "EPSG:3857"
505+
}.items())])
506+
507+
r, h = self._result(self.server.handleRequest(qs))
508+
self._img_diff_error(r, h, "WMS_GetMap_StyleDefault")
509+
510+
# custom style
511+
qs = "&".join(["%s=%s" % i for i in list({
512+
"MAP": urllib.quote(self.projectPath),
513+
"SERVICE": "WMS",
514+
"VERSION": "1.1.1",
515+
"REQUEST": "GetMap",
516+
"LAYERS": "Country_Labels",
517+
"STYLES": "custom",
518+
"FORMAT": "image/png",
519+
"BBOX": "-16817707,-4710778,5696513,14587125",
520+
"HEIGHT": "500",
521+
"WIDTH": "500",
522+
"CRS": "EPSG:3857"
523+
}.items())])
524+
525+
r, h = self._result(self.server.handleRequest(qs))
526+
self._img_diff_error(r, h, "WMS_GetMap_StyleCustom")
527+
528+
def test_wms_getmap_filter(self):
529+
qs = "&".join(["%s=%s" % i for i in list({
530+
"MAP": urllib.quote(self.projectPath),
531+
"SERVICE": "WMS",
532+
"VERSION": "1.1.1",
533+
"REQUEST": "GetMap",
534+
"LAYERS": "Country,Hello",
535+
"STYLES": "",
536+
"FORMAT": "image/png",
537+
"BBOX": "-16817707,-4710778,5696513,14587125",
538+
"HEIGHT": "500",
539+
"WIDTH": "500",
540+
"CRS": "EPSG:3857",
541+
"FILTER": "Country:\"name\" = 'eurasia'"
542+
}.items())])
543+
544+
r, h = self._result(self.server.handleRequest(qs))
545+
self._img_diff_error(r, h, "WMS_GetMap_Filter")
546+
547+
def test_wms_getmap_selection(self):
548+
qs = "&".join(["%s=%s" % i for i in list({
549+
"MAP": urllib.quote(self.projectPath),
550+
"SERVICE": "WMS",
551+
"VERSION": "1.1.1",
552+
"REQUEST": "GetMap",
553+
"LAYERS": "Country,Hello",
554+
"STYLES": "",
555+
"FORMAT": "image/png",
556+
"BBOX": "-16817707,-4710778,5696513,14587125",
557+
"HEIGHT": "500",
558+
"WIDTH": "500",
559+
"SRS": "EPSG:3857",
560+
"SELECTION": "Country: 4"
561+
}.items())])
562+
563+
r, h = self._result(self.server.handleRequest(qs))
564+
self._img_diff_error(r, h, "WMS_GetMap_Selection")
565+
566+
def test_wms_getmap_opacities(self):
567+
qs = "&".join(["%s=%s" % i for i in list({
568+
"MAP": urllib.quote(self.projectPath),
569+
"SERVICE": "WMS",
570+
"VERSION": "1.1.1",
571+
"REQUEST": "GetMap",
572+
"LAYERS": "Country,Hello",
573+
"STYLES": "",
574+
"FORMAT": "image/png",
575+
"BBOX": "-16817707,-4710778,5696513,14587125",
576+
"HEIGHT": "500",
577+
"WIDTH": "500",
578+
"CRS": "EPSG:3857",
579+
"OPACITIES": "125, 50"
580+
}.items())])
581+
582+
r, h = self._result(self.server.handleRequest(qs))
583+
self._img_diff_error(r, h, "WMS_GetMap_Opacities")
584+
585+
def test_wms_getprint_basic(self):
586+
qs = "&".join(["%s=%s" % i for i in list({
587+
"MAP": urllib.quote(self.projectPath),
588+
"SERVICE": "WMS",
589+
"VERSION": "1.1.1",
590+
"REQUEST": "GetPrint",
591+
"TEMPLATE": "layoutA4",
592+
"FORMAT": "png",
593+
"map0:EXTENT": "-33626185.498,-13032965.185,33978427.737,16020257.031",
594+
"map0:LAYERS": "Country,Hello",
595+
"HEIGHT": "500",
596+
"WIDTH": "500",
597+
"CRS": "EPSG:3857"
598+
}.items())])
599+
600+
r, h = self._result(self.server.handleRequest(qs))
601+
self._img_diff_error(r, h, "WMS_GetPrint_Basic")
602+
603+
def test_wms_getprint_srs(self):
604+
qs = "&".join(["%s=%s" % i for i in list({
605+
"MAP": urllib.quote(self.projectPath),
606+
"SERVICE": "WMS",
607+
"VERSION": "1.1.1",
608+
"REQUEST": "GetPrint",
609+
"TEMPLATE": "layoutA4",
610+
"FORMAT": "png",
611+
"map0:EXTENT": "-309.015,-133.011,312.179,133.949",
612+
"map0:LAYERS": "Country,Hello",
613+
"HEIGHT": "500",
614+
"WIDTH": "500",
615+
"CRS": "EPSG:4326"
616+
}.items())])
617+
618+
r, h = self._result(self.server.handleRequest(qs))
619+
self._img_diff_error(r, h, "WMS_GetPrint_SRS")
620+
621+
def test_wms_getprint_scale(self):
622+
qs = "&".join(["%s=%s" % i for i in list({
623+
"MAP": urllib.quote(self.projectPath),
624+
"SERVICE": "WMS",
625+
"VERSION": "1.1.1",
626+
"REQUEST": "GetPrint",
627+
"TEMPLATE": "layoutA4",
628+
"FORMAT": "png",
629+
"map0:EXTENT": "-33626185.498,-13032965.185,33978427.737,16020257.031",
630+
"map0:LAYERS": "Country,Hello",
631+
"map0:SCALE": "36293562",
632+
"HEIGHT": "500",
633+
"WIDTH": "500",
634+
"CRS": "EPSG:3857"
635+
}.items())])
636+
637+
r, h = self._result(self.server.handleRequest(qs))
638+
self._img_diff_error(r, h, "WMS_GetPrint_Scale")
639+
640+
def test_wms_getprint_grid(self):
641+
qs = "&".join(["%s=%s" % i for i in list({
642+
"MAP": urllib.quote(self.projectPath),
643+
"SERVICE": "WMS",
644+
"VERSION": "1.1.1",
645+
"REQUEST": "GetPrint",
646+
"TEMPLATE": "layoutA4",
647+
"FORMAT": "png",
648+
"map0:EXTENT": "-33626185.498,-13032965.185,33978427.737,16020257.031",
649+
"map0:LAYERS": "Country,Hello",
650+
"map0:GRID_INTERVAL_X": "1000000",
651+
"map0:GRID_INTERVAL_Y": "2000000",
652+
"HEIGHT": "500",
653+
"WIDTH": "500",
654+
"CRS": "EPSG:3857"
655+
}.items())])
656+
657+
r, h = self._result(self.server.handleRequest(qs))
658+
self._img_diff_error(r, h, "WMS_GetPrint_Grid")
659+
660+
def test_wms_getprint_rotation(self):
661+
qs = "&".join(["%s=%s" % i for i in list({
662+
"MAP": urllib.quote(self.projectPath),
663+
"SERVICE": "WMS",
664+
"VERSION": "1.1.1",
665+
"REQUEST": "GetPrint",
666+
"TEMPLATE": "layoutA4",
667+
"FORMAT": "png",
668+
"map0:EXTENT": "-33626185.498,-13032965.185,33978427.737,16020257.031",
669+
"map0:LAYERS": "Country,Hello",
670+
"map0:ROTATION": "45",
671+
"HEIGHT": "500",
672+
"WIDTH": "500",
673+
"CRS": "EPSG:3857"
674+
}.items())])
675+
676+
r, h = self._result(self.server.handleRequest(qs))
677+
self._img_diff_error(r, h, "WMS_GetPrint_Rotation")
678+
679+
def test_wms_getprint_selection(self):
680+
qs = "&".join(["%s=%s" % i for i in list({
681+
"MAP": urllib.quote(self.projectPath),
682+
"SERVICE": "WMS",
683+
"VERSION": "1.1.1",
684+
"REQUEST": "GetPrint",
685+
"TEMPLATE": "layoutA4",
686+
"FORMAT": "png",
687+
"map0:EXTENT": "-33626185.498,-13032965.185,33978427.737,16020257.031",
688+
"map0:LAYERS": "Country,Hello",
689+
"HEIGHT": "500",
690+
"WIDTH": "500",
691+
"CRS": "EPSG:3857",
692+
"SELECTION": "Country: 4"
693+
}.items())])
694+
695+
r, h = self._result(self.server.handleRequest(qs))
696+
self._img_diff_error(r, h, "WMS_GetPrint_Selection")
697+
381698
def test_getLegendGraphics(self):
382699
"""Test that does not return an exception but an image"""
383700
parms = {
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)