Changes for the CircleStyle inconsistency seen in #9395

Change hit detection test to reflect fix for #9395 CircleStyle inconsistency

Update ol/style/Circle and ol/style/RegularShapen tests
Revise test for no fill
Add test for transparent fill

Update Upgrade notes
Changes to hit detection with unfilled styles
This commit is contained in:
mike-000
2019-09-25 21:17:58 +01:00
parent e1d9f8dd59
commit e28fa56edd
5 changed files with 73 additions and 20 deletions

View File

@@ -40,13 +40,31 @@ describe('ol.style.RegularShape', function() {
expect(style.getImageSize()).to.eql([21, 21]);
expect(style.getOrigin()).to.eql([0, 0]);
expect(style.getAnchor()).to.eql([10.5, 10.5]);
// hit-detection image is created, because no fill style is set
// no hit-detection image is created, because no fill style is set
expect(style.getImage()).to.be(style.getHitDetectionImage());
expect(style.getHitDetectionImage()).to.be.an(HTMLCanvasElement);
expect(style.getHitDetectionImageSize()).to.eql([21, 21]);
});
it('creates a canvas (transparent fill-style)', function() {
const style = new RegularShape({
radius: 10,
fill: new Fill({
color: 'transparent'
})
});
expect(style.getImage()).to.be.an(HTMLCanvasElement);
expect(style.getSize()).to.eql([21, 21]);
expect(style.getImageSize()).to.eql([21, 21]);
expect(style.getOrigin()).to.eql([0, 0]);
expect(style.getAnchor()).to.eql([10.5, 10.5]);
// hit-detection image is created, because transparent fill style is set
expect(style.getImage()).to.not.be(style.getHitDetectionImage());
expect(style.getHitDetectionImage()).to.be.an(HTMLCanvasElement);
expect(style.getHitDetectionImageSize()).to.eql([21, 21]);
});
it('creates a canvas (fill-style)', function() {
it('creates a canvas (non-transparent fill-style)', function() {
const style = new RegularShape({
radius: 10,
fill: new Fill({
@@ -58,7 +76,7 @@ describe('ol.style.RegularShape', function() {
expect(style.getImageSize()).to.eql([21, 21]);
expect(style.getOrigin()).to.eql([0, 0]);
expect(style.getAnchor()).to.eql([10.5, 10.5]);
// no hit-detection image is created, because fill style is set
// no hit-detection image is created, because non-transparent fill style is set
expect(style.getImage()).to.be(style.getHitDetectionImage());
expect(style.getHitDetectionImage()).to.be.an(HTMLCanvasElement);
expect(style.getHitDetectionImageSize()).to.eql([21, 21]);