Skip to content

Commit

Permalink
test: enhance unsupported properties test
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiVolland committed Nov 27, 2024
1 parent 0621db2 commit a40efe9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
10 changes: 8 additions & 2 deletions data/olStyles/unsupported_properties.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import OlStyle from 'ol/style/Style';
import OlStyleFill from 'ol/style/Fill';
import OlStyleIcon from 'ol/style/Icon';

const olUnsupportedProperties = new OlStyle({
const unsupportedFill = new OlStyle({
fill: new OlStyleFill({
color: '#F1337F'
})
});
const unsupportedImage = new OlStyle({
image: new OlStyleIcon({
src: 'peter.png'
})
});

export default olUnsupportedProperties;
export default [unsupportedFill, unsupportedImage];
4 changes: 4 additions & 0 deletions data/styles/unsupported_properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ const unsupportedProperties: Style = {
kind: 'Fill',
color: '#F1337F',
opacity: 0.5
}, {
kind: 'Icon',
image: 'peter.png',
anchor: 'bottom-left'
}]
}
]
Expand Down
5 changes: 4 additions & 1 deletion src/OlStyleParser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,10 @@ describe('OlStyleParser implements StyleParser', () => {
info: 'Use fillOpacity instead.',
support: 'none'
}
}
},
IconSymbolizer: {
anchor: 'none',
},
}
};
const warningsGot = ['Your style contains unsupportedProperties!'];
Expand Down
2 changes: 1 addition & 1 deletion src/OlStyleParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,7 @@ export class OlStyleParser implements StyleParser<OlStyleLike> {

const baseProps: OlStyleIconOptions = {
src: isSprite(symbolizer.image) ? symbolizer.image.source as string : symbolizer.image as string,
crossOrigin: 'anonymous',
crossOrigin: null,
opacity: symbolizer.opacity as number,
width: symbolizer.size as number,
// Rotation in openlayers is radians while we use degree
Expand Down

0 comments on commit a40efe9

Please sign in to comment.