Correct the tests for geom.Point and geom.point.
Add tests for the API version `ol.point()`; adjust the tests for the internal `new ol.Point()`.
This commit is contained in:
@@ -1,44 +1,34 @@
|
||||
describe("ol.geom.Point", function() {
|
||||
var pNoArgs,
|
||||
pNoZ_arr,
|
||||
pWithZ_arr,
|
||||
var p2Args,
|
||||
p3Args,
|
||||
p4Args,
|
||||
p_arr,
|
||||
pNoZ_obj,
|
||||
pWithZ_obj,
|
||||
p_obj,
|
||||
proj = "EPSG:4326";
|
||||
|
||||
var instances = {
|
||||
"no arguments passed": ol.geom.point(),
|
||||
"one argument [x,y] passed": ol.geom.point([21, 4]),
|
||||
"one argument [x,y,z] passed": ol.geom.point([21, 4, 8]),
|
||||
"one argument [x,y,z,projection] passed": ol.geom.point([21, 4, 8, proj]),
|
||||
"one argument {x,y} passed": ol.geom.point([21, 4]),
|
||||
"one argument {x,y,z} passed": ol.geom.point([21, 4, 8]),
|
||||
"one argument {x,y,z,projection} passed": ol.geom.point([21, 4, 8, proj])
|
||||
"two arguments <x>,<y> passed": new ol.geom.Point(21, 4),
|
||||
"three arguments <x>,<y>,<z> passed": new ol.geom.Point(21, 4, 8),
|
||||
"four arguments <x>,<y>,<z>,<projection> passed": new ol.geom.Point(21, 4, 8, proj)
|
||||
};
|
||||
|
||||
beforeEach(function() {
|
||||
proj = ol.projection("EPSG:4326");
|
||||
instances = {
|
||||
"no arguments passed": ol.geom.point(),
|
||||
"one argument [x,y] passed": ol.geom.point([21, 4]),
|
||||
"one argument [x,y,z] passed": ol.geom.point([21, 4, 8]),
|
||||
"one argument [x,y,z,projection] passed": ol.geom.point([21, 4, 8, proj])
|
||||
"two arguments <x>,<y> passed": new ol.geom.Point(21, 4),
|
||||
"three arguments <x>,<y>,<z> passed": new ol.geom.Point(21, 4, 8),
|
||||
"four arguments <x>,<y>,<z>,<projection> passed": new ol.geom.Point(21, 4, 8, proj)
|
||||
};
|
||||
pNoArgs = instances['no arguments passed'];
|
||||
pNoZ = instances['one argument [x,y] passed'];
|
||||
pWithZ = instances['one argument [x,y,z] passed'];
|
||||
p = instances['one argument [x,y,z,projection] passed'];
|
||||
p2Args = instances['two arguments <x>,<y> passed'];
|
||||
p3Args = instances['three arguments <x>,<y>,<z> passed'];
|
||||
p4Args = instances['four arguments <x>,<y>,<z>,<projection> passed'];
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
pNoArgs = pNoZ = pWithZ = p = null;
|
||||
p2Args = p3Args = p4Args = null;
|
||||
instances = {
|
||||
"no arguments passed": ol.geom.point(),
|
||||
"one argument [x,y] passed": ol.geom.point([21, 4]),
|
||||
"one argument [x,y,z] passed": ol.geom.point([21, 4, 8]),
|
||||
"one argument [x,y,z,projection] passed": ol.geom.point([21, 4, 8, proj])
|
||||
"two arguments <x>,<y> passed": new ol.geom.Point(21, 4),
|
||||
"three arguments <x>,<y>,<z> passed": new ol.geom.Point(21, 4, 8),
|
||||
"four arguments <x>,<y>,<z>,<projection> passed": new ol.geom.Point(21, 4, 8, proj)
|
||||
};
|
||||
});
|
||||
|
||||
@@ -70,32 +60,27 @@ describe("ol.geom.Point", function() {
|
||||
}
|
||||
}
|
||||
|
||||
it("has functional getters (no arguments passed)", function(){
|
||||
expect(pNoArgs.getX()).toBe(0);
|
||||
expect(pNoArgs.getY()).toBe(0);
|
||||
expect(pNoArgs.getZ()).toBeUndefined();
|
||||
expect(pNoArgs.getProjection()).toBeNull();
|
||||
it("has functional getters (two arguments <x>,<y> passed)", function(){
|
||||
|
||||
expect(p2Args.getX()).toBe(21);
|
||||
expect(p2Args.getY()).toBe(4);
|
||||
expect(p2Args.getZ()).toBeUndefined();
|
||||
expect(p2Args.getProjection()).toBeNull();
|
||||
});
|
||||
|
||||
it("has functional getters (one argument [x,y] passed)", function(){
|
||||
expect(pNoZ.getX()).toBe(21);
|
||||
expect(pNoZ.getY()).toBe(4);
|
||||
expect(pNoZ.getZ()).toBeUndefined();
|
||||
expect(pNoZ.getProjection()).toBeNull();
|
||||
it("has functional getters (three arguments <x>,<y>,<z> passed)", function(){
|
||||
expect(p3Args.getX()).toBe(21);
|
||||
expect(p3Args.getY()).toBe(4);
|
||||
expect(p3Args.getZ()).not.toBeUndefined();
|
||||
expect(p3Args.getZ()).toBe(8);
|
||||
expect(p3Args.getProjection()).toBeNull();
|
||||
});
|
||||
|
||||
it("has functional getters (one argument [x,y,z] passed)", function(){
|
||||
expect(pWithZ.getX()).toBe(21);
|
||||
expect(pWithZ.getY()).toBe(4);
|
||||
expect(pWithZ.getZ()).toBe(8);
|
||||
expect(pWithZ.getProjection()).toBeNull();
|
||||
});
|
||||
|
||||
it("has functional getters (one argument [x,y,z,projection] passed)", function(){
|
||||
expect(p.getX()).toBe(21);
|
||||
expect(p.getY()).toBe(4);
|
||||
expect(p.getZ()).toBe(8);
|
||||
expect(p.getProjection()).not.toBeNull();
|
||||
expect(p.getProjection()).toEqual(jasmine.any(ol.Projection));
|
||||
it("has functional getters (four arguments <x>,<y>,<z>,<projection> passed)", function(){
|
||||
expect(p4Args.getX()).toBe(21);
|
||||
expect(p4Args.getY()).toBe(4);
|
||||
expect(p4Args.getZ()).toBe(8);
|
||||
expect(p4Args.getProjection()).not.toBeNull();
|
||||
expect(p4Args.getProjection()).toBeA(ol.Projection);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user