@@ -263,8 +263,8 @@ describe('SLD with external graphics', () => {
263263 ) . to . be . undefined ;
264264 expect (
265265 getImageLoadingState (
266- featureTypeStyle . elseFilterRules [ 0 ] . symbolizers [ 0 ] . graphic . externalgraphic
267- . onlineresource
266+ featureTypeStyle . elseFilterRules [ 0 ] . symbolizers [ 0 ] . graphic
267+ . externalgraphic . onlineresource
268268 )
269269 ) . to . be . undefined ;
270270
@@ -451,8 +451,8 @@ describe('SLD with external graphics', () => {
451451 . true ;
452452 // The pointsymbolizer of the second style object should also be properly invalidated,
453453 // even if it uses the same image for which the first style function triggered the loading.
454- expect ( featureTypeStyle2 . rules [ 0 ] . symbolizers [ 0 ] . __invalidated ) . to
455- . be . true ;
454+ expect ( featureTypeStyle2 . rules [ 0 ] . symbolizers [ 0 ] . __invalidated ) . to . be
455+ . true ;
456456 done ( ) ;
457457 } ,
458458 } ) ;
@@ -595,9 +595,15 @@ describe('Dynamic style properties', () => {
595595 ) ;
596596 } ) ;
597597
598- it ( 'Reads displacement from feature ' , ( ) => {
598+ it ( 'Reads displacement and compensates for rotation ' , ( ) => {
599599 const style = styleFunction ( pointFeature ) [ 0 ] ;
600- expect ( style . getImage ( ) . getDisplacement ( ) ) . to . deep . equal ( [ 10 , 20 ] ) ;
600+ const [ dx , dy ] = style . getImage ( ) . getDisplacement ( ) ;
601+ const rotation = style . getImage ( ) . getRotation ( ) ;
602+ // OriDx and oriDy are the original, uncompensated, displacement values from SLD.
603+ const oriDx = Math . cos ( - rotation ) * dx - Math . sin ( - rotation ) * dy ;
604+ expect ( oriDx ) . to . be . closeTo ( 10 , 1e-6 ) ;
605+ const oriDy = Math . sin ( - rotation ) * dx + Math . cos ( - rotation ) * dy ;
606+ expect ( oriDy ) . to . be . closeTo ( 20 , 1e-6 ) ;
601607 } ) ;
602608
603609 it ( 'Reads text for label from feature' , ( ) => {
@@ -1227,8 +1233,14 @@ describe('Styling with dynamic SVG Parameters', () => {
12271233 expect ( imageRotationDegrees ) . to . equal ( 42 ) ;
12281234 } ) ;
12291235
1230- it ( 'Dynamic displacement' , ( ) => {
1231- expect ( olStyle . getImage ( ) . getDisplacement ( ) ) . to . deep . equal ( [ 15 , 45 ] ) ;
1236+ it ( 'Dynamic displacement (compensated for dynamic rotation)' , ( ) => {
1237+ const [ dx , dy ] = olStyle . getImage ( ) . getDisplacement ( ) ;
1238+ const rotation = olStyle . getImage ( ) . getRotation ( ) ;
1239+ // OriDx and oriDy are the original, uncompensated, displacement values from SLD.
1240+ const oriDx = Math . cos ( - rotation ) * dx - Math . sin ( - rotation ) * dy ;
1241+ expect ( oriDx ) . to . be . closeTo ( 15 , 1e-6 ) ;
1242+ const oriDy = Math . sin ( - rotation ) * dx + Math . cos ( - rotation ) * dy ;
1243+ expect ( oriDy ) . to . be . closeTo ( 45 , 1e-6 ) ;
12321244 } ) ;
12331245 } ) ;
12341246
0 commit comments