Add styleMap writer
This commit is contained in:
@@ -283,6 +283,31 @@ describe('ol.parser.KML', function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('handles styleMap (read / write)', function(done) {
|
||||
var url = 'spec/ol/parser/kml/stylemap.kml';
|
||||
afterLoadXml(url, function(xml) {
|
||||
var p = new ol.parser.KML({extractStyles: true});
|
||||
var obj = p.read(xml);
|
||||
var output = p.write(obj);
|
||||
expect(goog.dom.xml.loadXml(output)).to.xmleql(xml);
|
||||
|
||||
var symbolizers = obj.features[0].getSymbolizers();
|
||||
expect(symbolizers).to.have.length(1);
|
||||
|
||||
var symbolizer = symbolizers[0];
|
||||
expect(symbolizer).to.be.a(ol.style.Icon);
|
||||
|
||||
var literal = symbolizer.createLiteral(ol.geom.GeometryType.POINT);
|
||||
expect(literal).to.be.a(ol.style.IconLiteral);
|
||||
|
||||
var url = 'http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png';
|
||||
expect(literal.url).to.eql(url);
|
||||
expect(literal.width).to.eql(32);
|
||||
expect(literal.height).to.eql(32);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('parsing states.kml', function() {
|
||||
|
||||
Reference in New Issue
Block a user