@@ -2396,19 +2396,39 @@ describe('WebMapV3 - _parseLegendtyle types', () => {
23962396 expect ( result . lineStyles [ 0 ] . color ) . toBe ( 'red' ) ;
23972397 } ) ;
23982398
2399- it ( 'LINE with image symbol should return sprite image style' , ( ) => {
2399+ it ( 'LINE with image symbol should return sprite image style with unified height ' , ( ) => {
24002400 const { instance } = createTestContext ( ) ;
24012401 instance . _sprite = 'http://localhost:8190/iportal/web/maps/1/sprites/sprite' ;
24022402 instance . _spriteDatas = { 'line-tex' : { width : 8 , height : 4 } } ;
24032403 const result = instance . _parseLegendtyle ( {
24042404 legendRenderType : 'LINE' ,
24052405 customValue : {
2406+ width : 6 ,
24062407 symbolsContent : { style : [ { paint : { 'line-pattern' : 'line-tex' } } ] }
24072408 }
24082409 } ) ;
24092410 expect ( result . type ) . toBe ( 'image' ) ;
24102411 expect ( result . sprite ) . toEqual ( { width : 8 , height : 4 } ) ;
24112412 expect ( result . url ) . toBe ( 'http://localhost:8190/iportal/web/maps/1/sprites/sprite.png' ) ;
2413+ // 普通线图层图片符号高度统一为 10、宽度 100,不使用线宽或图片尺寸
2414+ expect ( result . height ) . toBe ( 10 ) ;
2415+ expect ( result . width ) . toBe ( 100 ) ;
2416+ } ) ;
2417+
2418+ it ( 'ANIMATELINE with image symbol should keep original height logic' , ( ) => {
2419+ const { instance } = createTestContext ( ) ;
2420+ instance . _sprite = 'http://localhost:8190/iportal/web/maps/1/sprites/sprite' ;
2421+ instance . _spriteDatas = { 'anim-tex' : { width : 8 , height : 8 } } ;
2422+ const result = instance . _parseLegendtyle ( {
2423+ legendRenderType : 'ANIMATELINE' ,
2424+ customValue : {
2425+ symbolsContent : { style : [ { layout : { 'icon-image' : 'anim-tex' } } ] }
2426+ }
2427+ } ) ;
2428+ expect ( result . type ) . toBe ( 'image' ) ;
2429+ expect ( result . width ) . toBe ( 100 ) ;
2430+ // 动画线图片符号高度保持 cssStyle.width 的原逻辑,不使用统一高度
2431+ expect ( result . height ) . toBe ( 20 ) ;
24122432 } ) ;
24132433
24142434 it ( 'ANIMATELINE replacing color should return transparent background image' , ( ) => {
@@ -2424,6 +2444,7 @@ describe('WebMapV3 - _parseLegendtyle types', () => {
24242444 } ) ;
24252445 expect ( result . type ) . toBe ( 'image' ) ;
24262446 expect ( result . backgroundColor ) . toBe ( 'transparent' ) ;
2447+ expect ( result . height ) . toBe ( 20 ) ;
24272448 } ) ;
24282449
24292450 it ( 'FILL simple solid color should be vector style without url' , ( ) => {
0 commit comments