Factor out ol.geom.flat.flip

This commit is contained in:
Tom Payne
2014-03-12 12:55:30 +01:00
parent 266c43dc78
commit 9ca996725e
4 changed files with 76 additions and 66 deletions

View File

@@ -3,37 +3,6 @@ goog.provide('ol.test.geom.flat');
describe('ol.geom.flat', function() {
describe('ol.geom.flat.flipXY', function() {
it('can flip XY coordinates', function() {
var flatCoordinates = ol.geom.flat.flipXY([1, 2, 3, 4], 0, 4, 2);
expect(flatCoordinates).to.eql([2, 1, 4, 3]);
});
it('can flip XY coordinates while preserving other dimensions', function() {
var flatCoordinates = ol.geom.flat.flipXY(
[1, 2, 3, 4, 5, 6, 7, 8], 0, 8, 4);
expect(flatCoordinates).to.eql([2, 1, 3, 4, 6, 5, 7, 8]);
});
it('can flip XY coordinates in place', function() {
var flatCoordinates = [1, 2, 3, 4];
expect(ol.geom.flat.flipXY(flatCoordinates, 0, 4, 2, flatCoordinates)).
to.be(flatCoordinates);
expect(flatCoordinates).to.eql([2, 1, 4, 3]);
});
it('can flip XY coordinates in place while preserving other dimensions',
function() {
var flatCoordinates = [1, 2, 3, 4, 5, 6, 7, 8, 9];
expect(ol.geom.flat.flipXY(
flatCoordinates, 0, 9, 3, flatCoordinates)).
to.be(flatCoordinates);
expect(flatCoordinates).to.eql([2, 1, 3, 5, 4, 6, 8, 7, 9]);
});
});
describe('ol.geom.flat.inflateCoordinates', function() {
it('inflates coordinates', function() {