mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
Finish tests for new geo functionality
This commit is contained in:
@@ -92,5 +92,25 @@ describe('Util', function() {
|
||||
expect(iD.util.geo.polygonContainsPolygon(outer, inner)).to.be.false;
|
||||
});
|
||||
});
|
||||
|
||||
describe('#polygonIntersectsPolygon', function() {
|
||||
it('says a polygon in a polygon intersects it', function() {
|
||||
var outer = [[0, 0], [0, 3], [3, 3], [3, 0], [0, 0]];
|
||||
var inner = [[1, 1], [1, 2], [2, 2], [2, 1], [1, 1]];
|
||||
expect(iD.util.geo.polygonIntersectsPolygon(outer, inner)).to.be.true;
|
||||
});
|
||||
|
||||
it('says a polygon that partially intersects does', function() {
|
||||
var outer = [[0, 0], [0, 3], [3, 3], [3, 0], [0, 0]];
|
||||
var inner = [[-1, -1], [1, 2], [2, 2], [2, 1], [1, 1]];
|
||||
expect(iD.util.geo.polygonIntersectsPolygon(outer, inner)).to.be.true;
|
||||
});
|
||||
|
||||
it('says totally disjoint polygons do not intersect', function() {
|
||||
var outer = [[0, 0], [0, 3], [3, 3], [3, 0], [0, 0]];
|
||||
var inner = [[-1, -1], [-1, -2], [-2, -2], [-2, -1], [-1, -1]];
|
||||
expect(iD.util.geo.polygonIntersectsPolygon(outer, inner)).to.be.false;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user