Optional zIndex for fill symbolizers

This commit is contained in:
Tim Schaub
2013-08-26 15:18:34 -06:00
parent 96fa07effb
commit 04a23d0e45
5 changed files with 83 additions and 10 deletions

View File

@@ -19,6 +19,15 @@ describe('ol.style.Fill', function() {
expect(symbolizer).to.be.a(ol.style.Fill);
});
it('accepts zIndex', function() {
var symbolizer = new ol.style.Fill({
opacity: ol.expr.parse('value / 100'),
color: ol.expr.parse('fillAttr'),
zIndex: 3
});
expect(symbolizer).to.be.a(ol.style.Fill);
});
});
describe('#createLiteral()', function() {
@@ -40,6 +49,7 @@ describe('ol.style.Fill', function() {
expect(literal).to.be.a(ol.style.PolygonLiteral);
expect(literal.fillOpacity).to.be(42 / 100);
expect(literal.fillColor).to.be('#ff0000');
expect(literal.zIndex).to.be(undefined);
});
it('applies default opacity', function() {
@@ -81,6 +91,19 @@ describe('ol.style.Fill', function() {
expect(literal.fillOpacity).to.be(0.55);
});
it('handles zIndex', function() {
var symbolizer = new ol.style.Fill({
opacity: 0.8,
zIndex: 2
});
var literal = symbolizer.createLiteral(ol.geom.GeometryType.POLYGON);
expect(literal).to.be.a(ol.style.PolygonLiteral);
expect(literal.fillColor).to.be('#ffffff');
expect(literal.fillOpacity).to.be(0.8);
expect(literal.zIndex).to.be(2);
});
});
describe('#getColor()', function() {

View File

@@ -54,12 +54,21 @@ describe('ol.style.PolygonLiteral', function() {
fillColor: '#BADA55',
fillOpacity: 0.31
});
var differentZIndex = new ol.style.PolygonLiteral({
strokeWidth: 3,
strokeColor: '#013',
strokeOpacity: 0.4,
fillColor: '#BADA55',
fillOpacity: 0.3,
zIndex: 2
});
expect(literal.equals(equalLiteral)).to.be(true);
expect(literal.equals(differentStrokeWidth)).to.be(false);
expect(literal.equals(differentStrokeColor)).to.be(false);
expect(literal.equals(differentStrokeOpacity)).to.be(false);
expect(literal.equals(differentFillColor)).to.be(false);
expect(literal.equals(differentFillOpacity)).to.be(false);
expect(literal.equals(differentZIndex)).to.be(false);
});
});