Factor out ol.geom.flat.orient
This commit is contained in:
26
test/spec/ol/geom/flat/orientflatgeom.test.js
Normal file
26
test/spec/ol/geom/flat/orientflatgeom.test.js
Normal file
@@ -0,0 +1,26 @@
|
||||
goog.provide('ol.test.geom.flat.orient');
|
||||
|
||||
describe('ol.geom.flat.orient', function() {
|
||||
|
||||
describe('ol.geom.flat.orient.linearRingIsClockwise', function() {
|
||||
|
||||
it('identifies clockwise rings', function() {
|
||||
var flatCoordinates = [0, 1, 1, 4, 4, 3, 3, 0];
|
||||
var isClockwise = ol.geom.flat.orient.linearRingIsClockwise(
|
||||
flatCoordinates, 0, flatCoordinates.length, 2);
|
||||
expect(isClockwise).to.be(true);
|
||||
});
|
||||
|
||||
it('identifies anti-clockwise rings', function() {
|
||||
var flatCoordinates = [2, 2, 3, 2, 3, 3, 2, 3];
|
||||
var isClockwise = ol.geom.flat.orient.linearRingIsClockwise(
|
||||
flatCoordinates, 0, flatCoordinates.length, 2);
|
||||
expect(isClockwise).to.be(false);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
goog.require('ol.geom.flat');
|
||||
goog.require('ol.geom.flat.orient');
|
||||
@@ -85,24 +85,6 @@ describe('ol.geom.flat', function() {
|
||||
|
||||
});
|
||||
|
||||
describe('ol.geom.flat.linearRingIsClockwise', function() {
|
||||
|
||||
it('identifies clockwise rings', function() {
|
||||
var flatCoordinates = [0, 1, 1, 4, 4, 3, 3, 0];
|
||||
var isClockwise = ol.geom.flat.linearRingIsClockwise(
|
||||
flatCoordinates, 0, flatCoordinates.length, 2);
|
||||
expect(isClockwise).to.be(true);
|
||||
});
|
||||
|
||||
it('identifies anti-clockwise rings', function() {
|
||||
var flatCoordinates = [2, 2, 3, 2, 3, 3, 2, 3];
|
||||
var isClockwise = ol.geom.flat.linearRingIsClockwise(
|
||||
flatCoordinates, 0, flatCoordinates.length, 2);
|
||||
expect(isClockwise).to.be(false);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('ol.geom.flat.reverseCoordinates', function() {
|
||||
|
||||
describe('with a stride of 2', function() {
|
||||
|
||||
Reference in New Issue
Block a user