Width and height on unreferenced bounds.
This commit is contained in:
@@ -92,3 +92,16 @@ ol.UnreferencedBounds.prototype.setMaxY = function(maxY) {
|
||||
this.maxY_ = maxY;
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {number} Bounds width.
|
||||
*/
|
||||
ol.UnreferencedBounds.prototype.getWidth = function() {
|
||||
return this.maxX_ - this.minX_;
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {number} Bounds height.
|
||||
*/
|
||||
ol.UnreferencedBounds.prototype.getHeight = function() {
|
||||
return this.maxY_ - this.minY_;
|
||||
};
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
<script type="text/javascript" src="spec/api/layer/xyz.test.js"></script>
|
||||
<script type="text/javascript" src="spec/api/feature.test.js"></script>
|
||||
<script type="text/javascript" src="spec/ol/Events.test.js"></script>
|
||||
<script type="text/javascript" src="spec/ol/UnreferencedBounds.test.js"></script>
|
||||
<script type="text/javascript" src="spec/ol/Projection.test.js"></script>
|
||||
<script type="text/javascript" src="spec/ol/Tile.test.js"></script>
|
||||
<script type="text/javascript" src="spec/ol/TileSet.test.js"></script>
|
||||
|
||||
21
test/spec/ol/UnreferencedBounds.test.js
Normal file
21
test/spec/ol/UnreferencedBounds.test.js
Normal file
@@ -0,0 +1,21 @@
|
||||
describe("ol.UnreferencedBounds", function() {
|
||||
|
||||
describe("creating a bounds", function() {
|
||||
it("creates a bounds instance", function() {
|
||||
var bounds = new ol.UnreferencedBounds(1, 2, 3, 4);
|
||||
expect(bounds).toBeA(ol.UnreferencedBounds);
|
||||
});
|
||||
});
|
||||
describe("getting properties", function() {
|
||||
var bounds = new ol.UnreferencedBounds(10, 20, 30, 50);
|
||||
|
||||
it("allows getting width", function() {
|
||||
expect(bounds.getWidth()).toBe(20);
|
||||
});
|
||||
|
||||
it("allows getting height", function() {
|
||||
expect(bounds.getHeight()).toBe(30);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user