Optional zIndex for icon symbolizers

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

View File

@@ -54,12 +54,21 @@ describe('ol.style.IconLiteral', function() {
rotation: 0.1,
url: 'http://example.com/2.png'
});
var differentZIndex = new ol.style.IconLiteral({
height: 10,
width: 20,
opacity: 1,
rotation: 0.1,
url: 'http://example.com/1.png',
zIndex: 20
});
expect(literal.equals(equalLiteral)).to.be(true);
expect(literal.equals(differentLiteral1)).to.be(false);
expect(literal.equals(differentLiteral2)).to.be(false);
expect(literal.equals(differentLiteral3)).to.be(false);
expect(literal.equals(differentLiteral4)).to.be(false);
expect(literal.equals(differentLiteral5)).to.be(false);
expect(literal.equals(differentZIndex)).to.be(false);
});
});

View File

@@ -30,6 +30,18 @@ describe('ol.style.Icon', function() {
expect(symbolizer).to.be.a(ol.style.Icon);
});
it('accepts zIndex', function() {
var symbolizer = new ol.style.Icon({
height: ol.expr.parse('10'),
width: ol.expr.parse('20'),
opacity: ol.expr.parse('1'),
rotation: ol.expr.parse('0.1'),
url: ol.expr.parse('"http://example.com/1.png"'),
zIndex: 3
});
expect(symbolizer).to.be.a(ol.style.Icon);
});
});
describe('#createLiteral()', function() {
@@ -65,6 +77,7 @@ describe('ol.style.Icon', function() {
expect(literal.xOffset).to.be(20);
expect(literal.yOffset).to.be(30);
expect(literal.url).to.be('http://example.com/1.png');
expect(literal.zIndex).to.be(undefined);
});
it('can be called without a feature', function() {
@@ -223,6 +236,20 @@ describe('ol.style.Icon', function() {
expect(literal.yOffset).to.be(42);
});
it('handles zIndex', function() {
var symbolizer = new ol.style.Icon({
height: ol.expr.parse('10'),
width: ol.expr.parse('20'),
url: ol.expr.parse('"http://example.com/1.png"'),
zIndex: 4
});
var literal = symbolizer.createLiteral(ol.geom.GeometryType.POINT);
expect(literal).to.be.a(ol.style.IconLiteral);
expect(literal.xOffset).to.be(0);
expect(literal.zIndex).to.be(4);
});
});
describe('#getHeight()', function() {