Remove getChecksum functions

This commit is contained in:
Frederic Junod
2018-12-14 11:37:48 +01:00
parent 1bb1e3c542
commit 0ec769c234
5 changed files with 0 additions and 444 deletions

View File

@@ -90,164 +90,6 @@ describe('ol.style.Circle', function() {
});
describe('#getChecksum', function() {
it('calculates the same hash code for default options', function() {
const style1 = new CircleStyle();
const style2 = new CircleStyle();
expect(style1.getChecksum()).to.eql(style2.getChecksum());
});
it('calculates not the same hash code (radius)', function() {
const style1 = new CircleStyle();
const style2 = new CircleStyle({
radius: 5
});
expect(style1.getChecksum()).to.not.eql(style2.getChecksum());
});
it('calculates the same hash code (radius)', function() {
const style1 = new CircleStyle({
radius: 5
});
const style2 = new CircleStyle({
radius: 5
});
expect(style1.getChecksum()).to.eql(style2.getChecksum());
});
it('calculates not the same hash code (color)', function() {
const style1 = new CircleStyle({
radius: 5,
fill: new Fill({
color: '#319FD3'
})
});
const style2 = new CircleStyle({
radius: 5,
stroke: new Stroke({
color: '#319FD3'
})
});
expect(style1.getChecksum()).to.not.eql(style2.getChecksum());
});
it('calculates the same hash code (everything set)', function() {
const style1 = new CircleStyle({
radius: 5,
fill: new Fill({
color: '#319FD3'
}),
stroke: new Stroke({
color: '#319FD3',
lineCap: 'round',
lineDash: [5, 15, 25],
lineJoin: 'miter',
miterLimit: 4,
width: 2
})
});
const style2 = new CircleStyle({
radius: 5,
fill: new Fill({
color: '#319FD3'
}),
stroke: new Stroke({
color: '#319FD3',
lineCap: 'round',
lineDash: [5, 15, 25],
lineJoin: 'miter',
miterLimit: 4,
width: 2
})
});
expect(style1.getChecksum()).to.eql(style2.getChecksum());
});
it('calculates not the same hash code (stroke width differs)', function() {
const style1 = new CircleStyle({
radius: 5,
fill: new Fill({
color: '#319FD3'
}),
stroke: new Stroke({
color: '#319FD3',
lineCap: 'round',
lineDash: [5, 15, 25],
lineJoin: 'miter',
miterLimit: 4,
width: 3
})
});
const style2 = new CircleStyle({
radius: 5,
fill: new Fill({
color: '#319FD3'
}),
stroke: new Stroke({
color: '#319FD3',
lineCap: 'round',
lineDash: [5, 15, 25],
lineJoin: 'miter',
miterLimit: 4,
width: 2
})
});
expect(style1.getChecksum()).to.not.eql(style2.getChecksum());
});
it('invalidates a cached checksum if values change (fill)', function() {
const style1 = new CircleStyle({
radius: 5,
fill: new Fill({
color: '#319FD3'
}),
stroke: new Stroke({
color: '#319FD3'
})
});
const style2 = new CircleStyle({
radius: 5,
fill: new Fill({
color: '#319FD3'
}),
stroke: new Stroke({
color: '#319FD3'
})
});
expect(style1.getChecksum()).to.eql(style2.getChecksum());
style1.getFill().setColor('red');
expect(style1.getChecksum()).to.not.eql(style2.getChecksum());
});
it('invalidates a cached checksum if values change (stroke)', function() {
const style1 = new CircleStyle({
radius: 5,
fill: new Fill({
color: '#319FD3'
}),
stroke: new Stroke({
color: '#319FD3'
})
});
const style2 = new CircleStyle({
radius: 5,
fill: new Fill({
color: '#319FD3'
}),
stroke: new Stroke({
color: '#319FD3'
})
});
expect(style1.getChecksum()).to.eql(style2.getChecksum());
style1.getStroke().setWidth(4);
expect(style1.getChecksum()).to.not.eql(style2.getChecksum());
});
});
describe('#setRadius', function() {
it('changes the circle radius', function() {
const style = new CircleStyle({

View File

@@ -127,184 +127,4 @@ describe('ol.style.RegularShape', function() {
});
});
describe('#getChecksum', function() {
it('calculates not the same hash code (radius)', function() {
const style1 = new RegularShape({
radius: 4,
radius2: 5
});
const style2 = new RegularShape({
radius: 3,
radius2: 5
});
expect(style1.getChecksum()).to.not.eql(style2.getChecksum());
});
it('calculates not the same hash code (radius2)', function() {
const style1 = new RegularShape({
radius: 4,
radius2: 5
});
const style2 = new RegularShape({
radius: 4,
radius2: 6
});
expect(style1.getChecksum()).to.not.eql(style2.getChecksum());
});
it('calculates the same hash code (radius)', function() {
const style1 = new RegularShape({
radius: 5
});
const style2 = new RegularShape({
radius: 5
});
expect(style1.getChecksum()).to.eql(style2.getChecksum());
});
it('calculates not the same hash code (color)', function() {
const style1 = new RegularShape({
radius: 5,
fill: new Fill({
color: '#319FD3'
})
});
const style2 = new RegularShape({
radius: 5,
stroke: new Stroke({
color: '#319FD3'
})
});
expect(style1.getChecksum()).to.not.eql(style2.getChecksum());
});
it('calculates the same hash code (everything set)', function() {
const style1 = new RegularShape({
radius: 5,
radius2: 3,
angle: 1.41,
points: 5,
fill: new Fill({
color: '#319FD3'
}),
stroke: new Stroke({
color: '#319FD3',
lineCap: 'round',
lineDash: [5, 15, 25],
lineJoin: 'miter',
miterLimit: 4,
width: 2
})
});
const style2 = new RegularShape({
radius: 5,
radius2: 3,
angle: 1.41,
points: 5,
fill: new Fill({
color: '#319FD3'
}),
stroke: new Stroke({
color: '#319FD3',
lineCap: 'round',
lineDash: [5, 15, 25],
lineJoin: 'miter',
miterLimit: 4,
width: 2
})
});
expect(style1.getChecksum()).to.eql(style2.getChecksum());
});
it('calculates not the same hash code (stroke width differs)', function() {
const style1 = new RegularShape({
radius: 5,
radius2: 3,
angle: 1.41,
points: 5,
fill: new Fill({
color: '#319FD3'
}),
stroke: new Stroke({
color: '#319FD3',
lineCap: 'round',
lineDash: [5, 15, 25],
lineJoin: 'miter',
miterLimit: 4,
width: 3
})
});
const style2 = new RegularShape({
radius: 5,
radius2: 3,
angle: 1.41,
points: 5,
fill: new Fill({
color: '#319FD3'
}),
stroke: new Stroke({
color: '#319FD3',
lineCap: 'round',
lineDash: [5, 15, 25],
lineJoin: 'miter',
miterLimit: 4,
width: 2
})
});
expect(style1.getChecksum()).to.not.eql(style2.getChecksum());
});
it('invalidates a cached checksum if values change (fill)', function() {
const style1 = new RegularShape({
radius: 5,
fill: new Fill({
color: '#319FD3'
}),
stroke: new Stroke({
color: '#319FD3'
})
});
const style2 = new RegularShape({
radius: 5,
fill: new Fill({
color: '#319FD3'
}),
stroke: new Stroke({
color: '#319FD3'
})
});
expect(style1.getChecksum()).to.eql(style2.getChecksum());
style1.getFill().setColor('red');
expect(style1.getChecksum()).to.not.eql(style2.getChecksum());
});
it('invalidates a cached checksum if values change (stroke)', function() {
const style1 = new RegularShape({
radius: 5,
fill: new Fill({
color: '#319FD3'
}),
stroke: new Stroke({
color: '#319FD3'
})
});
const style2 = new RegularShape({
radius: 5,
fill: new Fill({
color: '#319FD3'
}),
stroke: new Stroke({
color: '#319FD3'
})
});
expect(style1.getChecksum()).to.eql(style2.getChecksum());
style1.getStroke().setWidth(4);
expect(style1.getChecksum()).to.not.eql(style2.getChecksum());
});
});
});