Test the getCentroid/centroid Method of linestrings

This commit is contained in:
Marc Jansen
2012-06-22 17:25:03 +02:00
parent bddb84ec14
commit 4dd3e695a4
2 changed files with 39 additions and 0 deletions

View File

@@ -216,6 +216,26 @@ describe("ol.geom.linestring", function() {
expect(ls.vertices().length).toBe(0);
});
});
describe("the centroid method is functional", function(){
it("returns an instance of ol.geom.Point", function(){
expect(ls.centroid()).toBeA(ol.geom.Point);
});
it("has the expected coordinates", function(){
ls = ol.geom.linestring([
ol.geom.point([0.5, 1]),
ol.geom.point([1, 1.5]),
ol.geom.point([1.5, 1]),
ol.geom.point([1, 0.5])
]);
var c = ls.centroid();
expect(c.x() + ',' + c.y()).toBe('1,1');
});
});
});