Optional zIndex for shape symbolizers

This commit is contained in:
Tim Schaub
2013-08-26 15:33:42 -06:00
parent b7cb21dc4a
commit b9a44d2db5
5 changed files with 87 additions and 10 deletions

View File

@@ -77,6 +77,16 @@ describe('ol.style.ShapeLiteral', function() {
strokeOpacity: 0.8,
strokeWidth: 4
});
var differentZIndex = new ol.style.ShapeLiteral({
type: ol.style.ShapeType.CIRCLE,
size: 4,
fillColor: '#BADA55',
fillOpacity: 0.9,
strokeColor: '#013',
strokeOpacity: 0.8,
strokeWidth: 3,
zIndex: -1
});
expect(literal.equals(equalLiteral)).to.be(true);
expect(literal.equals(differentSize)).to.be(false);
expect(literal.equals(differentFillColor)).to.be(false);
@@ -84,6 +94,7 @@ describe('ol.style.ShapeLiteral', function() {
expect(literal.equals(differentStrokeColor)).to.be(false);
expect(literal.equals(differentStrokeOpacity)).to.be(false);
expect(literal.equals(differentStrokeWidth)).to.be(false);
expect(literal.equals(differentZIndex)).to.be(false);
});
});

View File

@@ -24,6 +24,17 @@ describe('ol.style.Shape', function() {
expect(symbolizer).to.be.a(ol.style.Shape);
});
it('accepts zIndex', function() {
var symbolizer = new ol.style.Shape({
size: 4,
fill: new ol.style.Fill({
color: '#ff0000'
}),
zIndex: -1
});
expect(symbolizer).to.be.a(ol.style.Shape);
});
});
describe('#createLiteral()', function() {
@@ -47,6 +58,7 @@ describe('ol.style.Shape', function() {
expect(literal).to.be.a(ol.style.ShapeLiteral);
expect(literal.size).to.be(42);
expect(literal.fillOpacity).to.be(0.4);
expect(literal.zIndex).to.be(undefined);
});
it('can be called without a feature', function() {
@@ -160,6 +172,19 @@ describe('ol.style.Shape', function() {
expect(literal.fillOpacity).to.be(0.42);
});
it('handles zIndex', function() {
var symbolizer = new ol.style.Shape({
stroke: new ol.style.Stroke({
color: '#ff0000'
}),
zIndex: -2
});
var literal = symbolizer.createLiteral(ol.geom.GeometryType.POINT);
expect(literal).to.be.a(ol.style.ShapeLiteral);
expect(literal.zIndex).to.be(-2);
});
});
describe('#getFill()', function() {