Whitespace changes only.

This commit is contained in:
Marc Jansen
2012-06-22 16:20:42 +02:00
parent 09d7f15fb2
commit e23b119059
14 changed files with 306 additions and 305 deletions

View File

@@ -1,4 +1,4 @@
describe("ol.geom.collection", function() {
describe("ol.geom.collection", function() {
var c;
beforeEach(function() {
c = ol.geom.collection([
@@ -9,7 +9,7 @@ describe("ol.geom.collection", function() {
])
]);
});
afterEach(function() {
c = null;
});
@@ -18,149 +18,149 @@ describe("ol.geom.collection", function() {
expect( c ).toBeA( ol.geom.Collection );
});
});
describe("can construct instances without any components", function() {
it("works with an empty array", function(){
c = ol.geom.collection([]);
expect( c ).toBeA( ol.geom.Collection );
});
it("works without arguments", function(){
c = ol.geom.collection();
expect( c ).toBeA( ol.geom.Collection );
});
});
describe("the method 'add'", function() {
it("exists", function(){
expect( c.add ).toBeA( Function );
});
describe("can be used as setter", function(){
it("works with a single point specification and an index", function(){
var p = ol.geom.point([24,7]);
c.add(p, 0);
expect(c.components().length).toBe(3);
var firstComponent = c.components()[0];
expect( firstComponent.x() + ',' + firstComponent.y() ).toBe( '24,7' );
});
it("the index is functional", function(){
var p = ol.geom.point([24,7]);
c.add(p, 1);
expect(c.components().length).toBe(3);
var firstComponent = c.components()[0], // untouched
secondComponent = c.components()[1], // this should be ours
thirdComponent = c.components()[2]; // shifted here
expect( firstComponent.x() + ',' + firstComponent.y() ).toBe( '0,1' );
expect( secondComponent.x() + ',' + secondComponent.y() ).toBe( '24,7' );
expect( thirdComponent ).toBeA( ol.geom.LineString );
});
it("the index is optional", function(){
var p = ol.geom.point([24,7]);
c.add(p);
expect(c.components().length).toBe(3);
var thirdComponent = c.components()[2];
expect( thirdComponent.x() + ',' + thirdComponent.y() ).toBe( '24,7' );
});
it("returns the collection instance", function(){
var p = ol.geom.point([24,7]);
var returned = c.add(p);
expect(returned).toBe(c);
});
});
});
describe("the method 'addAll'", function(){
it("exists", function(){
expect( c.addAll ).toBeA( Function );
});
describe("can be used as setter", function(){
it("works with an array of points and an index", function(){
var ps = [
ol.geom.point([24,7]),
ol.geom.point([7,11])
];
c.addAll(ps, 0);
expect(c.components().length).toBe(4);
var firstComponent = c.components()[0],
secondComponent = c.components()[1];
expect( firstComponent.x() + ',' + firstComponent.y() ).toBe( '24,7' );
expect( secondComponent.x() + ',' + secondComponent.y() ).toBe( '7,11' );
});
it("the index is functional", function(){
var ps = [
ol.geom.point([24,7]),
ol.geom.point({x:7, y:11})
];
c.addAll(ps, 1);
expect(c.components().length).toBe(4);
var firstComponent = c.components()[0], // untouched
secondComponent = c.components()[1], // this should be ours
thirdComponent = c.components()[2], // this should be ours
fourthComponent = c.components()[3]; // shifted here
expect( firstComponent.x() + ',' + firstComponent.y() ).toBe( '0,1' );
expect( secondComponent.x() + ',' + secondComponent.y() ).toBe( '24,7' );
expect( thirdComponent.x() + ',' + thirdComponent.y() ).toBe( '7,11' );
expect( fourthComponent ).toBeA( ol.geom.LineString );
});
it("the index is optional", function(){
var ps = [
ol.geom.point([24,7]),
ol.geom.point({x:7, y:11})
];
c.addAll(ps);
expect(c.components().length).toBe(4);
var thirdComponent = c.components()[2],
fourthComponent = c.components()[3];
expect( thirdComponent.x() + ',' + thirdComponent.y() ).toBe( '24,7' );
expect( fourthComponent.x() + ',' + fourthComponent.y() ).toBe( '7,11' );
});
it("returns the collection instance", function(){
var ps = [
ol.geom.point([24,7]),
ol.geom.point({x:7, y:11})
];
var returned = c.addAll(ps);
expect(returned).toBe(c);
});
});
});
describe("the method 'remove'", function() {
it("exists", function(){
expect( c.add ).toBeA( Function );
});
it("works with a single point", function(){
var p = c.components()[0];
c.remove(p);
@@ -168,7 +168,7 @@ describe("ol.geom.collection", function() {
var firstComponent = c.components()[0];
expect( firstComponent ).toBeA( ol.geom.LineString );
});
it("works with an array of point specifications", function(){
var ps = [
c.components()[1],

View File

@@ -1,45 +1,45 @@
describe("ol.geom.geometry", function() {
describe("ol.geom.geometry", function() {
var g;
beforeEach(function() {
g = ol.geom.geometry();
});
afterEach(function() {
g = null;
});
it("constructs instances", function() {
expect( g ).toBeA( ol.geom.Geometry );
});
it("can set bounds", function() {
var oldBounds = g.bounds();
expect(oldBounds).toBeUndefined();
var b = ol.bounds([0,1,2,3]);
g.bounds(b);
var gotBounds = g.bounds();
expect(gotBounds).not.toBeUndefined();
});
it("can get bounds", function() {
var b = ol.bounds([0,1,2,3]);
g.bounds(b);
var gotBounds = g.bounds();
expect(gotBounds).toEqual(jasmine.any(ol.Bounds));
});
it("sets and gets the correct bounds", function() {
var b = ol.bounds([0,1,2,3]);
g.bounds(b);
var gotBounds = g.bounds();
expect(gotBounds.minX()).toEqual(0);
expect(gotBounds.minY()).toEqual(1);
expect(gotBounds.maxX()).toEqual(2);

View File

@@ -1,4 +1,4 @@
describe("ol.geom.linestring", function() {
describe("ol.geom.linestring", function() {
var ls;
beforeEach(function() {
ls = ol.geom.linestring([
@@ -6,7 +6,7 @@ describe("ol.geom.linestring", function() {
{x:2, y:3}
]);
});
afterEach(function() {
ls = null;
});
@@ -14,58 +14,58 @@ describe("ol.geom.linestring", function() {
it("works for the object notation of vertices", function(){
expect( ls ).toBeA( ol.geom.LineString );
});
it("works for the array notation of vertices", function(){
ls = ol.geom.linestring([
[0, 1],
[2, 3]
]);
expect( ls ).toBeA( ol.geom.LineString );
});
it("works for real vertices", function(){
ls = ol.geom.linestring([
ol.geom.point([0,1]),
ol.geom.point([2,3])
]);
expect( ls ).toBeA( ol.geom.LineString );
});
});
describe("can construct instances without any vertices", function() {
it("works with an empty array", function(){
ls = ol.geom.linestring([]);
expect( ls ).toBeA( ol.geom.LineString );
});
it("works without arguments", function(){
ls = ol.geom.linestring();
expect( ls ).toBeA( ol.geom.LineString );
});
});
describe("the method 'add'", function() {
it("exists", function(){
expect( ls.add ).toBeA( Function );
});
describe("can be used as setter", function(){
it("works with a single vertex specification and an index", function(){
var p = ol.geom.point([24,7]);
ls.add(p, 0);
expect(ls.vertices().length).toBe(3);
var firstPoint = ls.vertices()[0];
expect( firstPoint.x() + ',' + firstPoint.y() ).toBe( '24,7' );
});
it("works with point instance", function(){
ls = ol.geom.linestring();
ls.add(ol.geom.point([24,7]));
@@ -73,7 +73,7 @@ describe("ol.geom.linestring", function() {
var firstPoint = ls.vertices()[0];
expect( firstPoint.x() + ',' + firstPoint.y() ).toBe( '24,7' );
});
it("works with array specifications", function(){
ls = ol.geom.linestring();
ls.add([24,7]);
@@ -81,7 +81,7 @@ describe("ol.geom.linestring", function() {
var firstPoint = ls.vertices()[0];
expect( firstPoint.x() + ',' + firstPoint.y() ).toBe( '24,7' );
});
it("works with object specifications", function(){
ls = ol.geom.linestring();
ls.add({x:24,y:7});
@@ -89,117 +89,117 @@ describe("ol.geom.linestring", function() {
var firstPoint = ls.vertices()[0];
expect( firstPoint.x() + ',' + firstPoint.y() ).toBe( '24,7' );
});
it("the index is functional", function(){
var p = ol.geom.point([24,7]);
ls.add(p, 1);
expect(ls.vertices().length).toBe(3);
var firstPoint = ls.vertices()[0], // untouched
secondPoint = ls.vertices()[1], // this should be ours
thirdPoint = ls.vertices()[2]; // shifted here
expect( firstPoint.x() + ',' + firstPoint.y() ).toBe( '0,1' );
expect( secondPoint.x() + ',' + secondPoint.y() ).toBe( '24,7' );
expect( thirdPoint.x() + ',' + thirdPoint.y() ).toBe( '2,3' );
});
it("the index is optional", function(){
var p = ol.geom.point([24,7]);
ls.add(p);
expect(ls.vertices().length).toBe(3);
var thirdPoint = ls.vertices()[2];
expect( thirdPoint.x() + ',' + thirdPoint.y() ).toBe( '24,7' );
});
it("returns the linestring instance", function(){
var p = ol.geom.point([24,7]);
var returned = ls.add(p);
expect(returned).toBe(ls);
});
});
});
describe("the method 'addAll'", function(){
it("exists", function(){
expect( ls.addAll ).toBeA( Function );
});
describe("can be used as setter", function(){
it("works with an array of point specifications and an index", function(){
var ps = [
ol.geom.point([24,7]),
ol.geom.point([7,11])
];
ls.addAll(ps, 0);
expect(ls.vertices().length).toBe(4);
var firstPoint = ls.vertices()[0],
secondPoint = ls.vertices()[1];
expect( firstPoint.x() + ',' + firstPoint.y() ).toBe( '24,7' );
expect( secondPoint.x() + ',' + secondPoint.y() ).toBe( '7,11' );
});
it("the index is functional", function(){
var ps = [
[24,7],
{x:7, y:11}
];
ls.addAll(ps, 1);
expect(ls.vertices().length).toBe(4);
var firstPoint = ls.vertices()[0], // untouched
secondPoint = ls.vertices()[1], // this should be ours
thirdPoint = ls.vertices()[2], // this should be ours
fourthPoint = ls.vertices()[3]; // shifted here
expect( firstPoint.x() + ',' + firstPoint.y() ).toBe( '0,1' );
expect( secondPoint.x() + ',' + secondPoint.y() ).toBe( '24,7' );
expect( thirdPoint.x() + ',' + thirdPoint.y() ).toBe( '7,11' );
expect( fourthPoint.x() + ',' + fourthPoint.y() ).toBe( '2,3' );
});
it("the index is optional", function(){
var ps = [
[24,7],
{x:7, y:11}
];
ls.addAll(ps);
expect(ls.vertices().length).toBe(4);
var thirdPoint = ls.vertices()[2],
fourthPoint = ls.vertices()[3];
expect( thirdPoint.x() + ',' + thirdPoint.y() ).toBe( '24,7' );
expect( fourthPoint.x() + ',' + fourthPoint.y() ).toBe( '7,11' );
});
it("returns the linestring instance", function(){
var ps = [
[24,7],
{x:7, y:11}
];
var returned = ls.addAll(ps);
expect(returned).toBe(ls);
});
});
});
describe("the method 'remove'", function() {
it("exists", function(){
expect( ls.add ).toBeA( Function );
});
it("works with a single point", function(){
var p = ls.vertices()[0];
ls.remove(p);
@@ -207,7 +207,7 @@ describe("ol.geom.linestring", function() {
var firstPoint = ls.vertices()[0];
expect( firstPoint.x() + ',' + firstPoint.y() ).toBe( '2,3' );
});
it("works with an array of point specifications", function(){
var ps = [
ls.vertices()[1],

View File

@@ -1,4 +1,4 @@
describe("ol.geom.multipoint", function() {
describe("ol.geom.multipoint", function() {
var mp;
beforeEach(function() {
mp = ol.geom.multipoint([
@@ -6,7 +6,7 @@ describe("ol.geom.multipoint", function() {
{x:2, y:3}
]);
});
afterEach(function() {
mp = null;
});
@@ -14,58 +14,58 @@ describe("ol.geom.multipoint", function() {
it("works for the object notation of points", function(){
expect( mp ).toBeA( ol.geom.MultiPoint );
});
it("works for the array notation of points", function(){
mp = ol.geom.multipoint([
[0, 1],
[2, 3]
]);
expect( mp ).toBeA( ol.geom.MultiPoint );
});
it("works for real points", function(){
mp = ol.geom.multipoint([
ol.geom.point([0,1]),
ol.geom.point([2,3])
]);
expect( mp ).toBeA( ol.geom.MultiPoint );
});
});
describe("can construct instances without any points", function() {
it("works with an empty array", function(){
mp = ol.geom.multipoint([]);
expect( mp ).toBeA( ol.geom.MultiPoint );
});
it("works without arguments", function(){
mp = ol.geom.multipoint();
expect( mp ).toBeA( ol.geom.MultiPoint );
});
});
describe("the method 'add'", function() {
it("exists", function(){
expect( mp.add ).toBeA( Function );
});
describe("can be used as setter", function(){
it("works with a single point specification and an index", function(){
var p = ol.geom.point([24,7]);
mp.add(p, 0);
expect(mp.points().length).toBe(3);
var firstPoint = mp.points()[0];
expect( firstPoint.x() + ',' + firstPoint.y() ).toBe( '24,7' );
});
it("works with point instance", function(){
mp = ol.geom.multipoint();
mp.add(ol.geom.point([24,7]));
@@ -73,7 +73,7 @@ describe("ol.geom.multipoint", function() {
var firstPoint = mp.points()[0];
expect( firstPoint.x() + ',' + firstPoint.y() ).toBe( '24,7' );
});
it("works with array specifications", function(){
mp = ol.geom.multipoint();
mp.add([24,7]);
@@ -81,7 +81,7 @@ describe("ol.geom.multipoint", function() {
var firstPoint = mp.points()[0];
expect( firstPoint.x() + ',' + firstPoint.y() ).toBe( '24,7' );
});
it("works with object specifications", function(){
mp = ol.geom.multipoint();
mp.add({x:24,y:7});
@@ -89,117 +89,117 @@ describe("ol.geom.multipoint", function() {
var firstPoint = mp.points()[0];
expect( firstPoint.x() + ',' + firstPoint.y() ).toBe( '24,7' );
});
it("the index is functional", function(){
var p = ol.geom.point([24,7]);
mp.add(p, 1);
expect(mp.points().length).toBe(3);
var firstPoint = mp.points()[0], // untouched
secondPoint = mp.points()[1], // this should be ours
thirdPoint = mp.points()[2]; // shifted here
expect( firstPoint.x() + ',' + firstPoint.y() ).toBe( '0,1' );
expect( secondPoint.x() + ',' + secondPoint.y() ).toBe( '24,7' );
expect( thirdPoint.x() + ',' + thirdPoint.y() ).toBe( '2,3' );
});
it("the index is optional", function(){
var p = ol.geom.point([24,7]);
mp.add(p);
expect(mp.points().length).toBe(3);
var thirdPoint = mp.points()[2];
expect( thirdPoint.x() + ',' + thirdPoint.y() ).toBe( '24,7' );
});
it("returns the multipoint instance", function(){
var p = ol.geom.point([24,7]);
var returned = mp.add(p);
expect(returned).toBe(mp);
});
});
});
describe("the method 'addAll'", function(){
it("exists", function(){
expect( mp.addAll ).toBeA( Function );
});
describe("can be used as setter", function(){
it("works with an array of point specifications and an index", function(){
var ps = [
ol.geom.point([24,7]),
ol.geom.point([7,11])
];
mp.addAll(ps, 0);
expect(mp.points().length).toBe(4);
var firstPoint = mp.points()[0],
secondPoint = mp.points()[1];
expect( firstPoint.x() + ',' + firstPoint.y() ).toBe( '24,7' );
expect( secondPoint.x() + ',' + secondPoint.y() ).toBe( '7,11' );
});
it("the index is functional", function(){
var ps = [
[24,7],
{x:7, y:11}
];
mp.addAll(ps, 1);
expect(mp.points().length).toBe(4);
var firstPoint = mp.points()[0], // untouched
secondPoint = mp.points()[1], // this should be ours
thirdPoint = mp.points()[2], // this should be ours
fourthPoint = mp.points()[3]; // shifted here
expect( firstPoint.x() + ',' + firstPoint.y() ).toBe( '0,1' );
expect( secondPoint.x() + ',' + secondPoint.y() ).toBe( '24,7' );
expect( thirdPoint.x() + ',' + thirdPoint.y() ).toBe( '7,11' );
expect( fourthPoint.x() + ',' + fourthPoint.y() ).toBe( '2,3' );
});
it("the index is optional", function(){
var ps = [
[24,7],
{x:7, y:11}
];
mp.addAll(ps);
expect(mp.points().length).toBe(4);
var thirdPoint = mp.points()[2],
fourthPoint = mp.points()[3];
expect( thirdPoint.x() + ',' + thirdPoint.y() ).toBe( '24,7' );
expect( fourthPoint.x() + ',' + fourthPoint.y() ).toBe( '7,11' );
});
it("returns the multipoint instance", function(){
var ps = [
[24,7],
{x:7, y:11}
];
var returned = mp.addAll(ps);
expect(returned).toBe(mp);
});
});
});
describe("the method 'remove'", function() {
it("exists", function(){
expect( mp.add ).toBeA( Function );
});
it("works with a single point", function(){
var p = mp.points()[0];
mp.remove(p);
@@ -207,7 +207,7 @@ describe("ol.geom.multipoint", function() {
var firstPoint = mp.points()[0];
expect( firstPoint.x() + ',' + firstPoint.y() ).toBe( '2,3' );
});
it("works with an array of point specifications", function(){
var ps = [
mp.points()[1],