Whitespace changes only.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
describe("ol.geom.Collection", function() {
|
||||
var c;
|
||||
|
||||
|
||||
beforeEach(function(){
|
||||
c = new ol.geom.Collection([
|
||||
new ol.geom.Point(10,20),
|
||||
@@ -10,25 +10,25 @@ describe("ol.geom.Collection", function() {
|
||||
])
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
afterEach(function(){
|
||||
c = null;
|
||||
});
|
||||
|
||||
|
||||
it("constructs instances", function() {
|
||||
expect( c ).toBeA( ol.geom.Collection );
|
||||
});
|
||||
|
||||
|
||||
it("can construct instances without any components", function() {
|
||||
// empty array
|
||||
c = new ol.geom.Collection([]);
|
||||
expect( c ).toBeA( ol.geom.Collection );
|
||||
|
||||
|
||||
// no argument at all
|
||||
c = new ol.geom.Collection();
|
||||
expect( c ).toBeA( ol.geom.Collection );
|
||||
});
|
||||
|
||||
|
||||
it("cannot construct instances when passed illegal components", function() {
|
||||
// collection cannot contain collections
|
||||
expect(function(){
|
||||
@@ -36,29 +36,29 @@ describe("ol.geom.Collection", function() {
|
||||
new ol.geom.Collection()
|
||||
]);
|
||||
}).toThrow();
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
it("inherits from ol.geom.Geometry", function() {
|
||||
expect( c ).toBeA( ol.geom.Geometry );
|
||||
});
|
||||
|
||||
|
||||
it("has a working getter for components", function() {
|
||||
|
||||
|
||||
var components = c.getComponents();
|
||||
|
||||
|
||||
expect( components ).toBeA( Array );
|
||||
expect( components.length ).toBe( 2 );
|
||||
expect( components[0] ).toBeA( ol.geom.Point );
|
||||
expect( components[1] ).toBeA( ol.geom.LineString );
|
||||
|
||||
|
||||
expect( components[0].getX() + ',' + components[0].getY()).toBe( '10,20' );
|
||||
expect( components[1].getVertices()[0].getX() + ',' + components[1].getVertices()[0].getY()).toBe( '47,11' );
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
it("has a working setter for components", function() {
|
||||
|
||||
|
||||
c.setComponents([
|
||||
new ol.geom.Point(30,40),
|
||||
new ol.geom.LineString([
|
||||
@@ -66,20 +66,20 @@ describe("ol.geom.Collection", function() {
|
||||
new ol.geom.Point(4,16)
|
||||
])
|
||||
]);
|
||||
|
||||
|
||||
var components = c.getComponents();
|
||||
|
||||
|
||||
expect( components.length ).toBe( 2 );
|
||||
expect( components[0] ).toBeA( ol.geom.Point );
|
||||
expect( components[1] ).toBeA( ol.geom.LineString );
|
||||
|
||||
|
||||
expect( components[0].getX() + ',' + components[0].getY()).toBe( '30,40' );
|
||||
expect( components[1].getVertices()[0].getX() + ',' + components[1].getVertices()[0].getY()).toBe( '3,9' );
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
it("has a method to add components", function() {
|
||||
|
||||
|
||||
c.addComponent(
|
||||
new ol.geom.Point(30,40),
|
||||
1
|
||||
@@ -91,17 +91,17 @@ describe("ol.geom.Collection", function() {
|
||||
]),
|
||||
0
|
||||
);
|
||||
|
||||
|
||||
var components = c.getComponents();
|
||||
|
||||
|
||||
expect( components.length ).toBe( 4 );
|
||||
expect( components[0].getVertices()[0].getX() + ',' + components[0].getVertices()[0].getY()).toBe( '5,25' );
|
||||
expect( components[1].getX() + ',' + components[1].getY()).toBe( '10,20' );
|
||||
expect( components[2].getX() + ',' + components[2].getY()).toBe( '30,40' );
|
||||
expect( components[3].getVertices()[0].getX() + ',' + components[3].getVertices()[0].getY()).toBe( '47,11' );
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
it("cannot add instances of 'ol.geom.Collection'", function(){
|
||||
expect(function(){
|
||||
c.addComponent(
|
||||
@@ -112,7 +112,7 @@ describe("ol.geom.Collection", function() {
|
||||
);
|
||||
}).toThrow();
|
||||
});
|
||||
|
||||
|
||||
it("has a method to remove components", function() {
|
||||
c.setComponents([
|
||||
new ol.geom.Point(0,10),
|
||||
@@ -120,16 +120,16 @@ describe("ol.geom.Collection", function() {
|
||||
new ol.geom.Point(20,30),
|
||||
new ol.geom.Point(30,40)
|
||||
]);
|
||||
|
||||
|
||||
var p = c.getComponents()[2]; // 20,30;
|
||||
|
||||
|
||||
c.removeComponent( p );
|
||||
|
||||
|
||||
var components = c.getComponents();
|
||||
|
||||
|
||||
expect( components.length ).toBe( 3 );
|
||||
expect( components[0].getX() + ',' + components[0].getY()).toBe( '0,10' );
|
||||
expect( components[1].getX() + ',' + components[1].getY()).toBe( '10,20' );
|
||||
expect( components[2].getX() + ',' + components[2].getY()).toBe( '30,40' );
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
describe("ol.geom.LineString", function() {
|
||||
var ls;
|
||||
|
||||
|
||||
beforeEach(function(){
|
||||
ls = new ol.geom.LineString([
|
||||
new ol.geom.Point(0,0),
|
||||
@@ -9,61 +9,61 @@ describe("ol.geom.LineString", function() {
|
||||
new ol.geom.Point(20,20)
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
afterEach(function(){
|
||||
ls = null;
|
||||
});
|
||||
|
||||
|
||||
it("constructs instances", function() {
|
||||
expect( ls ).toBeA( ol.geom.LineString );
|
||||
});
|
||||
|
||||
|
||||
it("can construct instances without any points", function() {
|
||||
// empty array
|
||||
mp = new ol.geom.LineString([]);
|
||||
expect( ls ).toBeA( ol.geom.LineString );
|
||||
|
||||
|
||||
// no argument at all
|
||||
mp = new ol.geom.LineString();
|
||||
expect( ls ).toBeA( ol.geom.LineString );
|
||||
});
|
||||
|
||||
|
||||
it("inherits from ol.geom.Geometry", function() {
|
||||
expect( ls ).toBeA( ol.geom.Geometry );
|
||||
});
|
||||
|
||||
|
||||
it("has a working getter for vertices", function() {
|
||||
|
||||
|
||||
var vertices = ls.getVertices();
|
||||
|
||||
|
||||
expect( vertices ).toBeA( Array );
|
||||
expect( vertices.length ).toBe( 4 );
|
||||
expect( vertices[0] ).toBeA( ol.geom.Point );
|
||||
|
||||
|
||||
expect( vertices[0].getX() + ',' + vertices[0].getY()).toBe( '0,0' );
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
it("has a working setter for vertices", function() {
|
||||
|
||||
|
||||
ls.setVertices([
|
||||
new ol.geom.Point(30,40),
|
||||
new ol.geom.Point(50,60)
|
||||
]);
|
||||
|
||||
|
||||
var vertices = ls.getVertices();
|
||||
|
||||
|
||||
expect( vertices.length ).toBe( 2 );
|
||||
expect( vertices[0] ).toBeA( ol.geom.Point );
|
||||
expect( vertices[1] ).toBeA( ol.geom.Point );
|
||||
|
||||
|
||||
expect( vertices[0].getX() + ',' + vertices[0].getY()).toBe( '30,40' );
|
||||
expect( vertices[1].getX() + ',' + vertices[1].getY()).toBe( '50,60' );
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
it("has a method to add vertices", function() {
|
||||
|
||||
|
||||
ls.addVertex(
|
||||
new ol.geom.Point(30,40),
|
||||
1
|
||||
@@ -76,9 +76,9 @@ describe("ol.geom.LineString", function() {
|
||||
new ol.geom.Point(-10,0),
|
||||
0
|
||||
);
|
||||
|
||||
|
||||
var vertices = ls.getVertices();
|
||||
|
||||
|
||||
expect( vertices.length ).toBe( 7 );
|
||||
expect( vertices[0].getX() + ',' + vertices[0].getY()).toBe( '-10,0' );
|
||||
expect( vertices[1].getX() + ',' + vertices[1].getY()).toBe( '0,0' );
|
||||
@@ -87,9 +87,9 @@ describe("ol.geom.LineString", function() {
|
||||
expect( vertices[4].getX() + ',' + vertices[4].getY()).toBe( '10,10' );
|
||||
expect( vertices[5].getX() + ',' + vertices[5].getY()).toBe( '10,0' );
|
||||
expect( vertices[6].getX() + ',' + vertices[6].getY()).toBe( '20,20' );
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
it("has a method to remove vertices", function() {
|
||||
ls.setVertices([
|
||||
new ol.geom.Point(0,10),
|
||||
@@ -97,16 +97,16 @@ describe("ol.geom.LineString", function() {
|
||||
new ol.geom.Point(20,30),
|
||||
new ol.geom.Point(30,40)
|
||||
]);
|
||||
|
||||
|
||||
var v = ls.getVertices()[2]; // 20,30;
|
||||
|
||||
|
||||
ls.removeVertex( v );
|
||||
|
||||
|
||||
var vertices = ls.getVertices();
|
||||
|
||||
|
||||
expect( vertices.length ).toBe( 3 );
|
||||
expect( vertices[0].getX() + ',' + vertices[0].getY()).toBe( '0,10' );
|
||||
expect( vertices[1].getX() + ',' + vertices[1].getY()).toBe( '10,20' );
|
||||
expect( vertices[2].getX() + ',' + vertices[2].getY()).toBe( '30,40' );
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
describe("ol.geom.MultiPoint", function() {
|
||||
var mp;
|
||||
|
||||
|
||||
beforeEach(function(){
|
||||
mp = new ol.geom.MultiPoint([
|
||||
new ol.geom.Point(10,20)
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
afterEach(function(){
|
||||
mp = null;
|
||||
});
|
||||
|
||||
|
||||
it("constructs instances", function() {
|
||||
expect( mp ).toBeA( ol.geom.MultiPoint );
|
||||
});
|
||||
|
||||
|
||||
it("can construct instances without any points", function() {
|
||||
// empty array
|
||||
mp = new ol.geom.MultiPoint([]);
|
||||
expect( mp ).toBeA( ol.geom.MultiPoint );
|
||||
|
||||
|
||||
// no argument at all
|
||||
mp = new ol.geom.MultiPoint();
|
||||
expect( mp ).toBeA( ol.geom.MultiPoint );
|
||||
});
|
||||
|
||||
|
||||
it("cannot be constructed with component-types other than 'ol.geom.Point'", function() {
|
||||
expect(function(){
|
||||
mp = new ol.geom.MultiPoint([
|
||||
@@ -32,43 +32,43 @@ describe("ol.geom.MultiPoint", function() {
|
||||
]);
|
||||
}).toThrow();
|
||||
});
|
||||
|
||||
|
||||
it("inherits from ol.geom.Geometry", function() {
|
||||
expect( mp ).toBeA( ol.geom.Geometry );
|
||||
});
|
||||
|
||||
|
||||
it("has a working getter for points", function() {
|
||||
|
||||
|
||||
var points = mp.getPoints();
|
||||
|
||||
|
||||
expect( points ).toBeA( Array );
|
||||
expect( points.length ).toBe( 1 );
|
||||
expect( points[0] ).toBeA( ol.geom.Point );
|
||||
|
||||
|
||||
expect( points[0].getX() + ',' + points[0].getY()).toBe( '10,20' );
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
it("has a working setter for points", function() {
|
||||
|
||||
|
||||
mp.setPoints([
|
||||
new ol.geom.Point(30,40),
|
||||
new ol.geom.Point(50,60)
|
||||
]);
|
||||
|
||||
|
||||
var points = mp.getPoints();
|
||||
|
||||
|
||||
expect( points.length ).toBe( 2 );
|
||||
expect( points[0] ).toBeA( ol.geom.Point );
|
||||
expect( points[1] ).toBeA( ol.geom.Point );
|
||||
|
||||
|
||||
expect( points[0].getX() + ',' + points[0].getY()).toBe( '30,40' );
|
||||
expect( points[1].getX() + ',' + points[1].getY()).toBe( '50,60' );
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
it("has a method to add points", function() {
|
||||
|
||||
|
||||
mp.addPoint(
|
||||
new ol.geom.Point(30,40),
|
||||
1
|
||||
@@ -81,17 +81,17 @@ describe("ol.geom.MultiPoint", function() {
|
||||
new ol.geom.Point(-10,0),
|
||||
0
|
||||
);
|
||||
|
||||
|
||||
var points = mp.getPoints();
|
||||
|
||||
|
||||
expect( points.length ).toBe( 4 );
|
||||
expect( points[0].getX() + ',' + points[0].getY()).toBe( '-10,0' );
|
||||
expect( points[1].getX() + ',' + points[1].getY()).toBe( '10,20' );
|
||||
expect( points[2].getX() + ',' + points[2].getY()).toBe( '30,40' );
|
||||
expect( points[3].getX() + ',' + points[3].getY()).toBe( '50,60' );
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
it("can only add ol.geom.Point as components", function() {
|
||||
expect(function(){
|
||||
mp.addComponent(
|
||||
@@ -102,7 +102,7 @@ describe("ol.geom.MultiPoint", function() {
|
||||
);
|
||||
}).toThrow();
|
||||
});
|
||||
|
||||
|
||||
it("has a method to remove points", function() {
|
||||
mp.setPoints([
|
||||
new ol.geom.Point(0,10),
|
||||
@@ -110,16 +110,16 @@ describe("ol.geom.MultiPoint", function() {
|
||||
new ol.geom.Point(20,30),
|
||||
new ol.geom.Point(30,40)
|
||||
]);
|
||||
|
||||
|
||||
var p = mp.getPoints()[2]; // 20,30;
|
||||
|
||||
|
||||
mp.removePoint( p );
|
||||
|
||||
|
||||
var points = mp.getPoints();
|
||||
|
||||
|
||||
expect( points.length ).toBe( 3 );
|
||||
expect( points[0].getX() + ',' + points[0].getY()).toBe( '0,10' );
|
||||
expect( points[1].getX() + ',' + points[1].getY()).toBe( '10,20' );
|
||||
expect( points[2].getX() + ',' + points[2].getY()).toBe( '30,40' );
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user