Vector related exports

This commit is contained in:
Tim Schaub
2013-03-05 18:13:10 +01:00
parent 12bee3178e
commit e1c3faa53e
19 changed files with 116 additions and 70 deletions

View File

@@ -6,7 +6,7 @@ describe('ol.layer.Vector', function() {
it('allows adding features', function() {
var layer = new ol.layer.Vector({
new ol.source.Vector({})
source: new ol.source.Vector({})
});
layer.addFeatures([new ol.Feature(), new ol.Feature()]);
expect(layer.getFeatures().length).toEqual(2);

View File

@@ -7,15 +7,18 @@ describe('ol.style.LineLiteral', function() {
it('identifies equal literals', function() {
var literal = new ol.style.LineLiteral({
strokeWidth: 3,
strokeStyle: '#BADA55'
strokeStyle: '#BADA55',
opacity: 1
});
var equalLiteral = new ol.style.LineLiteral({
strokeStyle: '#BADA55',
strokeWidth: 3
strokeWidth: 3,
opacity: 1
});
var differentLiteral = new ol.style.LineLiteral({
strokeStyle: '#013',
strokeWidth: 3
strokeWidth: 3,
opacity: 1
});
expect(literal.equals(equalLiteral)).toBe(true);
expect(literal.equals(differentLiteral)).toBe(false);

View File

@@ -7,15 +7,21 @@ describe('ol.style.PolygonLiteral', function() {
it('identifies equal literals', function() {
var literal = new ol.style.PolygonLiteral({
strokeWidth: 3,
fillStyle: '#BADA55'
strokeStyle: '#013',
fillStyle: '#BADA55',
opacity: 1
});
var equalLiteral = new ol.style.PolygonLiteral({
fillStyle: '#BADA55',
strokeWidth: 3
strokeStyle: '#013',
strokeWidth: 3,
opacity: 1
});
var differentLiteral = new ol.style.PolygonLiteral({
fillStyle: '#013',
strokeWidth: 3
strokeStyle: '#013',
strokeWidth: 3,
opacity: 1
});
expect(literal.equals(equalLiteral)).toBe(true);
expect(literal.equals(differentLiteral)).toBe(false);

View File

@@ -6,16 +6,28 @@ describe('ol.style.ShapeLiteral', function() {
it('identifies equal literals', function() {
var literal = new ol.style.ShapeLiteral({
type: ol.style.ShapeType.CIRCLE,
size: 4,
fillStyle: '#BADA55'
fillStyle: '#BADA55',
strokeStyle: '#013',
strokeWidth: 3,
opacity: 1
});
var equalLiteral = new ol.style.ShapeLiteral({
type: ol.style.ShapeType.CIRCLE,
size: 4,
fillStyle: '#BADA55',
size: 4
strokeStyle: '#013',
strokeWidth: 3,
opacity: 1
});
var differentLiteral = new ol.style.ShapeLiteral({
type: ol.style.ShapeType.CIRCLE,
size: 4,
fillStyle: '#013',
size: 4
strokeStyle: '#013',
strokeWidth: 3,
opacity: 1
});
expect(literal.equals(equalLiteral)).toBe(true);
expect(literal.equals(differentLiteral)).toBe(false);
@@ -74,3 +86,4 @@ goog.require('ol.Expression');
goog.require('ol.Feature');
goog.require('ol.style.Shape');
goog.require('ol.style.ShapeLiteral');
goog.require('ol.style.ShapeType');

View File

@@ -5,6 +5,7 @@ describe('ol.style.Style', function() {
describe('#apply()', function() {
it('applies a style to a feature', function() {
var style = new ol.style.Style({
rules: [
new ol.style.Rule({
@@ -39,8 +40,10 @@ describe('ol.style.Style', function() {
it('returns an array with the Shape default for points', function() {
feature.setGeometry(new ol.geom.Point([0, 0]));
expect(ol.style.Style.applyDefaultStyle(feature)[0]
.equals(ol.style.ShapeDefaults)).toBe(true);
var symbolizers = ol.style.Style.applyDefaultStyle(feature);
expect(symbolizers.length).toBe(1);
expect(symbolizers[0]).toBeA(ol.style.ShapeLiteral);
expect(symbolizers[0].equals(ol.style.ShapeDefaults)).toBe(true);
});
it('returns an array with the Line default for lines', function() {
@@ -66,4 +69,5 @@ goog.require('ol.geom.Polygon');
goog.require('ol.filter.Filter');
goog.require('ol.style.Rule');
goog.require('ol.style.Shape');
goog.require('ol.style.ShapeLiteral');
goog.require('ol.style.Style');