11import { wmtsLayer } from '../../../src/leaflet/mapping/TileLayer.WMTS' ;
2+ import { SecurityManager } from '../../../src/common/security/SecurityManager' ;
23
34var url = GlobeParameter . WMTSURL ;
45describe ( 'leaflet_TileLayerWMTS' , ( ) => {
@@ -71,4 +72,36 @@ describe('leaflet_TileLayerWMTS', () => {
7172 expect ( WMTStiledMapLayerObject . getTileUrl ( coords ) ) . toBe ( url + '/China/default/Custom_China/NaN/0/0.png' ) ;
7273 } ) ;
7374
75+ it ( "getTileUrl_params Token" , ( ) => {
76+ var coords = { x : 0 , y : 0 , z : 0 } ;
77+ var option = {
78+ layer : "China" ,
79+ style : "default" ,
80+ tilematrixSet : "Custom_China" ,
81+ format : "image/png" ,
82+ requestEncoding : 'REST'
83+ } ;
84+ var url = GlobeParameter . WMTSURL + '?token=test' ;
85+ WMTStiledMapLayerObject = wmtsLayer ( url , option ) ;
86+ const tileUrl = WMTStiledMapLayerObject . getTileUrl ( coords )
87+ expect ( tileUrl ) . not . toBeNull ( ) ;
88+ expect ( tileUrl ) . toBe ( GlobeParameter . WMTSURL + '/China/default/Custom_China/NaN/0/0.png?token=test' ) ;
89+ } ) ;
90+
91+ it ( "getTileUrl_registerToken" , ( ) => {
92+ var coords = { x : 0 , y : 0 , z : 0 } ;
93+ var option = {
94+ layer : "China" ,
95+ style : "default" ,
96+ tilematrixSet : "Custom_China" ,
97+ format : "image/png" ,
98+ requestEncoding : 'REST'
99+ } ;
100+ var url = GlobeParameter . WMTSURL ;
101+ SecurityManager . registerToken ( url , 'test' ) ;
102+ WMTStiledMapLayerObject = wmtsLayer ( url , option ) ;
103+ const tileUrl = WMTStiledMapLayerObject . getTileUrl ( coords )
104+ expect ( tileUrl ) . not . toBeNull ( ) ;
105+ expect ( tileUrl ) . toBe ( GlobeParameter . WMTSURL + '/China/default/Custom_China/NaN/0/0.png?token=test' ) ;
106+ } ) ;
74107} ) ;
0 commit comments