Redefine ol.Coordinate to be Array.<number>
This commit is contained in:
+30
-56
@@ -7,62 +7,37 @@ describe('ol.Extent', function() {
|
||||
describe('positive', function() {
|
||||
it('returns true', function() {
|
||||
var extent = new ol.Extent(1, 2, 3, 4);
|
||||
expect(extent.containsCoordinate(
|
||||
new ol.Coordinate(1, 2))).to.be.ok();
|
||||
expect(extent.containsCoordinate(
|
||||
new ol.Coordinate(1, 3))).to.be.ok();
|
||||
expect(extent.containsCoordinate(
|
||||
new ol.Coordinate(1, 4))).to.be.ok();
|
||||
expect(extent.containsCoordinate(
|
||||
new ol.Coordinate(2, 2))).to.be.ok();
|
||||
expect(extent.containsCoordinate(
|
||||
new ol.Coordinate(2, 3))).to.be.ok();
|
||||
expect(extent.containsCoordinate(
|
||||
new ol.Coordinate(2, 4))).to.be.ok();
|
||||
expect(extent.containsCoordinate(
|
||||
new ol.Coordinate(3, 2))).to.be.ok();
|
||||
expect(extent.containsCoordinate(
|
||||
new ol.Coordinate(3, 3))).to.be.ok();
|
||||
expect(extent.containsCoordinate(
|
||||
new ol.Coordinate(3, 4))).to.be.ok();
|
||||
expect(extent.containsCoordinate([1, 2])).to.be.ok();
|
||||
expect(extent.containsCoordinate([1, 3])).to.be.ok();
|
||||
expect(extent.containsCoordinate([1, 4])).to.be.ok();
|
||||
expect(extent.containsCoordinate([2, 2])).to.be.ok();
|
||||
expect(extent.containsCoordinate([2, 3])).to.be.ok();
|
||||
expect(extent.containsCoordinate([2, 4])).to.be.ok();
|
||||
expect(extent.containsCoordinate([3, 2])).to.be.ok();
|
||||
expect(extent.containsCoordinate([3, 3])).to.be.ok();
|
||||
expect(extent.containsCoordinate([3, 4])).to.be.ok();
|
||||
});
|
||||
});
|
||||
|
||||
describe('negative', function() {
|
||||
it('returns false', function() {
|
||||
var extent = new ol.Extent(1, 2, 3, 4);
|
||||
expect(extent.containsCoordinate(
|
||||
new ol.Coordinate(0, 1))).to.not.be();
|
||||
expect(extent.containsCoordinate(
|
||||
new ol.Coordinate(0, 2))).to.not.be();
|
||||
expect(extent.containsCoordinate(
|
||||
new ol.Coordinate(0, 3))).to.not.be();
|
||||
expect(extent.containsCoordinate(
|
||||
new ol.Coordinate(0, 4))).to.not.be();
|
||||
expect(extent.containsCoordinate(
|
||||
new ol.Coordinate(0, 5))).to.not.be();
|
||||
expect(extent.containsCoordinate(
|
||||
new ol.Coordinate(1, 1))).to.not.be();
|
||||
expect(extent.containsCoordinate(
|
||||
new ol.Coordinate(1, 5))).to.not.be();
|
||||
expect(extent.containsCoordinate(
|
||||
new ol.Coordinate(2, 1))).to.not.be();
|
||||
expect(extent.containsCoordinate(
|
||||
new ol.Coordinate(2, 5))).to.not.be();
|
||||
expect(extent.containsCoordinate(
|
||||
new ol.Coordinate(3, 1))).to.not.be();
|
||||
expect(extent.containsCoordinate(
|
||||
new ol.Coordinate(3, 5))).to.not.be();
|
||||
expect(extent.containsCoordinate(
|
||||
new ol.Coordinate(4, 1))).to.not.be();
|
||||
expect(extent.containsCoordinate(
|
||||
new ol.Coordinate(4, 2))).to.not.be();
|
||||
expect(extent.containsCoordinate(
|
||||
new ol.Coordinate(4, 3))).to.not.be();
|
||||
expect(extent.containsCoordinate(
|
||||
new ol.Coordinate(4, 4))).to.not.be();
|
||||
expect(extent.containsCoordinate(
|
||||
new ol.Coordinate(4, 5))).to.not.be();
|
||||
expect(extent.containsCoordinate([0, 1])).to.not.be();
|
||||
expect(extent.containsCoordinate([0, 2])).to.not.be();
|
||||
expect(extent.containsCoordinate([0, 3])).to.not.be();
|
||||
expect(extent.containsCoordinate([0, 4])).to.not.be();
|
||||
expect(extent.containsCoordinate([0, 5])).to.not.be();
|
||||
expect(extent.containsCoordinate([1, 1])).to.not.be();
|
||||
expect(extent.containsCoordinate([1, 5])).to.not.be();
|
||||
expect(extent.containsCoordinate([2, 1])).to.not.be();
|
||||
expect(extent.containsCoordinate([2, 5])).to.not.be();
|
||||
expect(extent.containsCoordinate([3, 1])).to.not.be();
|
||||
expect(extent.containsCoordinate([3, 5])).to.not.be();
|
||||
expect(extent.containsCoordinate([4, 1])).to.not.be();
|
||||
expect(extent.containsCoordinate([4, 2])).to.not.be();
|
||||
expect(extent.containsCoordinate([4, 3])).to.not.be();
|
||||
expect(extent.containsCoordinate([4, 4])).to.not.be();
|
||||
expect(extent.containsCoordinate([4, 5])).to.not.be();
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -102,7 +77,7 @@ describe('ol.Extent', function() {
|
||||
|
||||
it('works for a unit square', function() {
|
||||
var extent = ol.Extent.getForView2DAndSize(
|
||||
new ol.Coordinate(0, 0), 1, 0, new ol.Size(1, 1));
|
||||
[0, 0], 1, 0, new ol.Size(1, 1));
|
||||
expect(extent.minX).to.be(-0.5);
|
||||
expect(extent.minY).to.be(-0.5);
|
||||
expect(extent.maxX).to.be(0.5);
|
||||
@@ -111,7 +86,7 @@ describe('ol.Extent', function() {
|
||||
|
||||
it('works for center', function() {
|
||||
var extent = ol.Extent.getForView2DAndSize(
|
||||
new ol.Coordinate(5, 10), 1, 0, new ol.Size(1, 1));
|
||||
[5, 10], 1, 0, new ol.Size(1, 1));
|
||||
expect(extent.minX).to.be(4.5);
|
||||
expect(extent.minY).to.be(9.5);
|
||||
expect(extent.maxX).to.be(5.5);
|
||||
@@ -120,7 +95,7 @@ describe('ol.Extent', function() {
|
||||
|
||||
it('works for rotation', function() {
|
||||
var extent = ol.Extent.getForView2DAndSize(
|
||||
new ol.Coordinate(0, 0), 1, Math.PI / 4, new ol.Size(1, 1));
|
||||
[0, 0], 1, Math.PI / 4, new ol.Size(1, 1));
|
||||
expect(extent.minX).to.roughlyEqual(-Math.sqrt(0.5), 1e-9);
|
||||
expect(extent.minY).to.roughlyEqual(-Math.sqrt(0.5), 1e-9);
|
||||
expect(extent.maxX).to.roughlyEqual(Math.sqrt(0.5), 1e-9);
|
||||
@@ -129,7 +104,7 @@ describe('ol.Extent', function() {
|
||||
|
||||
it('works for resolution', function() {
|
||||
var extent = ol.Extent.getForView2DAndSize(
|
||||
new ol.Coordinate(0, 0), 2, 0, new ol.Size(1, 1));
|
||||
[0, 0], 2, 0, new ol.Size(1, 1));
|
||||
expect(extent.minX).to.be(-1);
|
||||
expect(extent.minY).to.be(-1);
|
||||
expect(extent.maxX).to.be(1);
|
||||
@@ -138,7 +113,7 @@ describe('ol.Extent', function() {
|
||||
|
||||
it('works for size', function() {
|
||||
var extent = ol.Extent.getForView2DAndSize(
|
||||
new ol.Coordinate(0, 0), 1, 0, new ol.Size(10, 5));
|
||||
[0, 0], 1, 0, new ol.Size(10, 5));
|
||||
expect(extent.minX).to.be(-5);
|
||||
expect(extent.minY).to.be(-2.5);
|
||||
expect(extent.maxX).to.be(5);
|
||||
@@ -149,7 +124,6 @@ describe('ol.Extent', function() {
|
||||
|
||||
});
|
||||
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Extent');
|
||||
goog.require('ol.Size');
|
||||
goog.require('ol.projection');
|
||||
|
||||
Reference in New Issue
Block a user