Test restructuring. No functional change.
This commit is contained in:
@@ -57,15 +57,17 @@ describe("ol.geom.point", function() {
|
|||||||
if (instances.hasOwnProperty(instancesDesc)) {
|
if (instances.hasOwnProperty(instancesDesc)) {
|
||||||
var instance = instances[instancesDesc];
|
var instance = instances[instancesDesc];
|
||||||
|
|
||||||
it("constructs instances (" + instancesDesc + ")", function() {
|
describe("instantiate with " + instancesDesc, function() {
|
||||||
|
|
||||||
|
it("constructs instances", function() {
|
||||||
expect(instance).toEqual(jasmine.any(ol.geom.Point));
|
expect(instance).toEqual(jasmine.any(ol.geom.Point));
|
||||||
});
|
});
|
||||||
|
|
||||||
it("constructs instances of ol.geom.Geometry (" + instancesDesc + ")", function() {
|
it("constructs instances of ol.geom.Geometry", function() {
|
||||||
expect(instance).toEqual(jasmine.any(ol.geom.Geometry));
|
expect(instance).toEqual(jasmine.any(ol.geom.Geometry));
|
||||||
});
|
});
|
||||||
|
|
||||||
it("has coordinate getter/setter methods (" + instancesDesc + ")", function() {
|
it("has coordinate getter/setter methods", function() {
|
||||||
expect(instance.x).not.toBeUndefined();
|
expect(instance.x).not.toBeUndefined();
|
||||||
expect(instance.y).not.toBeUndefined();
|
expect(instance.y).not.toBeUndefined();
|
||||||
expect(instance.z).not.toBeUndefined();
|
expect(instance.z).not.toBeUndefined();
|
||||||
@@ -93,7 +95,7 @@ describe("ol.geom.point", function() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("has projection getter/setter methods (" + instancesDesc + ")", function() {
|
it("has projection getter/setter methods", function() {
|
||||||
expect(instance.projection).not.toBeUndefined();
|
expect(instance.projection).not.toBeUndefined();
|
||||||
|
|
||||||
var getRes = instance.projection();
|
var getRes = instance.projection();
|
||||||
@@ -106,31 +108,35 @@ describe("ol.geom.point", function() {
|
|||||||
expect(getRes).toBeA(ol.Projection);
|
expect(getRes).toBeA(ol.Projection);
|
||||||
expect(getRes.code()).toEqual("EPSG:12345");
|
expect(getRes.code()).toEqual("EPSG:12345");
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
it("has functional getters (no arguments passed)", function(){
|
describe('the getters are functional', function(){
|
||||||
|
it("works when no arguments passed", function(){
|
||||||
expect(pNoArgs.x()).toBe(0);
|
expect(pNoArgs.x()).toBe(0);
|
||||||
expect(pNoArgs.y()).toBe(0);
|
expect(pNoArgs.y()).toBe(0);
|
||||||
expect(pNoArgs.z()).toBeUndefined();
|
expect(pNoArgs.z()).toBeUndefined();
|
||||||
expect(pNoArgs.projection()).toBeNull();
|
expect(pNoArgs.projection()).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("has functional getters (one argument <Array[x,y]> passed)", function(){
|
it("works when one argument <Array[x,y]> passed", function(){
|
||||||
expect(pNoZ_arr.x()).toBe(21);
|
expect(pNoZ_arr.x()).toBe(21);
|
||||||
expect(pNoZ_arr.y()).toBe(4);
|
expect(pNoZ_arr.y()).toBe(4);
|
||||||
expect(pNoZ_arr.z()).toBeUndefined();
|
expect(pNoZ_arr.z()).toBeUndefined();
|
||||||
expect(pNoZ_arr.projection()).toBeNull();
|
expect(pNoZ_arr.projection()).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("has functional getters (one argument <Array[x,y,z]> passed)", function(){
|
it("works when one argument <Array[x,y,z]> passed", function(){
|
||||||
expect(pWithZ_arr.x()).toBe(21);
|
expect(pWithZ_arr.x()).toBe(21);
|
||||||
expect(pWithZ_arr.y()).toBe(4);
|
expect(pWithZ_arr.y()).toBe(4);
|
||||||
expect(pWithZ_arr.z()).toBe(8);
|
expect(pWithZ_arr.z()).toBe(8);
|
||||||
expect(pWithZ_arr.projection()).toBeNull();
|
expect(pWithZ_arr.projection()).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("has functional getters (one argument <Array[x,y,z,projection]> passed)", function(){
|
it("works when one argument <Array[x,y,z,projection]> passed", function(){
|
||||||
expect(p_arr.x()).toBe(21);
|
expect(p_arr.x()).toBe(21);
|
||||||
expect(p_arr.y()).toBe(4);
|
expect(p_arr.y()).toBe(4);
|
||||||
expect(p_arr.z()).toBe(8);
|
expect(p_arr.z()).toBe(8);
|
||||||
@@ -138,21 +144,21 @@ describe("ol.geom.point", function() {
|
|||||||
expect(p_arr.projection()).toBeA(ol.Projection);
|
expect(p_arr.projection()).toBeA(ol.Projection);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("has functional getters (one argument <Object{x,y}> passed)", function(){
|
it("works when one argument <Object{x,y}> passed", function(){
|
||||||
expect(pNoZ_obj.x()).toBe(21);
|
expect(pNoZ_obj.x()).toBe(21);
|
||||||
expect(pNoZ_obj.y()).toBe(4);
|
expect(pNoZ_obj.y()).toBe(4);
|
||||||
expect(pNoZ_obj.z()).toBeUndefined();
|
expect(pNoZ_obj.z()).toBeUndefined();
|
||||||
expect(pNoZ_obj.projection()).toBeNull();
|
expect(pNoZ_obj.projection()).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("has functional getters (one argument <Object{x,y,z}> passed)", function(){
|
it("works when one argument <Object{x,y,z}> passed", function(){
|
||||||
expect(pWithZ_obj.x()).toBe(21);
|
expect(pWithZ_obj.x()).toBe(21);
|
||||||
expect(pWithZ_obj.y()).toBe(4);
|
expect(pWithZ_obj.y()).toBe(4);
|
||||||
expect(pWithZ_obj.z()).toBe(8);
|
expect(pWithZ_obj.z()).toBe(8);
|
||||||
expect(pWithZ_obj.projection()).toBeNull();
|
expect(pWithZ_obj.projection()).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("has functional getters (one argument <Object{x,y,z,projection}> passed)", function(){
|
it("works when one argument <Object{x,y,z,projection}> passed", function(){
|
||||||
expect(p_obj.x()).toBe(21);
|
expect(p_obj.x()).toBe(21);
|
||||||
expect(p_obj.y()).toBe(4);
|
expect(p_obj.y()).toBe(4);
|
||||||
expect(p_obj.z()).toBe(8);
|
expect(p_obj.z()).toBe(8);
|
||||||
@@ -160,3 +166,4 @@ describe("ol.geom.point", function() {
|
|||||||
expect(p_obj.projection()).toEqual(jasmine.any(ol.Projection));
|
expect(p_obj.projection()).toEqual(jasmine.any(ol.Projection));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|||||||
@@ -35,15 +35,17 @@ describe("ol.geom.Point", function() {
|
|||||||
if (instances.hasOwnProperty(instancesDesc)) {
|
if (instances.hasOwnProperty(instancesDesc)) {
|
||||||
var instance = instances[instancesDesc];
|
var instance = instances[instancesDesc];
|
||||||
|
|
||||||
it("constructs instances (" + instancesDesc + ")", function() {
|
describe("instantiate with " + instancesDesc, function() {
|
||||||
|
|
||||||
|
it("constructs instances", function() {
|
||||||
expect(instance).toEqual(jasmine.any(ol.geom.Point));
|
expect(instance).toEqual(jasmine.any(ol.geom.Point));
|
||||||
});
|
});
|
||||||
|
|
||||||
it("constructs instances of ol.geom.Geometry (" + instancesDesc + ")", function() {
|
it("constructs instances of ol.geom.Geometry", function() {
|
||||||
expect(instance).toEqual(jasmine.any(ol.geom.Geometry));
|
expect(instance).toEqual(jasmine.any(ol.geom.Geometry));
|
||||||
});
|
});
|
||||||
|
|
||||||
it("has the coordinate accessor methods (" + instancesDesc + ")", function() {
|
it("has the coordinate accessor methods", function() {
|
||||||
expect(instance.getX).not.toBeUndefined();
|
expect(instance.getX).not.toBeUndefined();
|
||||||
expect(instance.getY).not.toBeUndefined();
|
expect(instance.getY).not.toBeUndefined();
|
||||||
expect(instance.getZ).not.toBeUndefined();
|
expect(instance.getZ).not.toBeUndefined();
|
||||||
@@ -52,15 +54,15 @@ describe("ol.geom.Point", function() {
|
|||||||
expect(instance.setZ).not.toBeUndefined();
|
expect(instance.setZ).not.toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("has the projection accessor methods (" + instancesDesc + ")", function() {
|
it("has the projection accessor methods", function() {
|
||||||
expect(instance.getProjection).not.toBeUndefined();
|
expect(instance.getProjection).not.toBeUndefined();
|
||||||
expect(instance.setProjection).not.toBeUndefined();
|
expect(instance.setProjection).not.toBeUndefined();
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
describe('the getters are functional', function(){
|
||||||
it("has functional getters (two arguments <x>,<y> passed)", function(){
|
it("works when two arguments <x>,<y> passed", function(){
|
||||||
|
|
||||||
expect(p2Args.getX()).toBe(21);
|
expect(p2Args.getX()).toBe(21);
|
||||||
expect(p2Args.getY()).toBe(4);
|
expect(p2Args.getY()).toBe(4);
|
||||||
@@ -68,7 +70,7 @@ describe("ol.geom.Point", function() {
|
|||||||
expect(p2Args.getProjection()).toBeNull();
|
expect(p2Args.getProjection()).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("has functional getters (three arguments <x>,<y>,<z> passed)", function(){
|
it("works when three arguments <x>,<y>,<z> passed", function(){
|
||||||
expect(p3Args.getX()).toBe(21);
|
expect(p3Args.getX()).toBe(21);
|
||||||
expect(p3Args.getY()).toBe(4);
|
expect(p3Args.getY()).toBe(4);
|
||||||
expect(p3Args.getZ()).not.toBeUndefined();
|
expect(p3Args.getZ()).not.toBeUndefined();
|
||||||
@@ -76,14 +78,16 @@ describe("ol.geom.Point", function() {
|
|||||||
expect(p3Args.getProjection()).toBeNull();
|
expect(p3Args.getProjection()).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("has functional getters (four arguments <x>,<y>,<z>,<projection> passed)", function(){
|
it("works when four arguments <x>,<y>,<z>,<projection> passed", function(){
|
||||||
expect(p4Args.getX()).toBe(21);
|
expect(p4Args.getX()).toBe(21);
|
||||||
expect(p4Args.getY()).toBe(4);
|
expect(p4Args.getY()).toBe(4);
|
||||||
expect(p4Args.getZ()).toBe(8);
|
expect(p4Args.getZ()).toBe(8);
|
||||||
expect(p4Args.getProjection()).not.toBeNull();
|
expect(p4Args.getProjection()).not.toBeNull();
|
||||||
expect(p4Args.getProjection()).toBeA(ol.Projection);
|
expect(p4Args.getProjection()).toBeA(ol.Projection);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("transformation is functional", function(){
|
||||||
it("can be transformed", function(){
|
it("can be transformed", function(){
|
||||||
// save for later comparison
|
// save for later comparison
|
||||||
var old = {
|
var old = {
|
||||||
@@ -109,7 +113,6 @@ describe("ol.geom.Point", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("throws an exception when you try to transform without a source projection", function(){
|
it("throws an exception when you try to transform without a source projection", function(){
|
||||||
|
|
||||||
expect(function() {
|
expect(function() {
|
||||||
p2Args.transform("EPSG:3857");
|
p2Args.transform("EPSG:3857");
|
||||||
}).toThrow();
|
}).toThrow();
|
||||||
@@ -117,7 +120,7 @@ describe("ol.geom.Point", function() {
|
|||||||
expect(function() {
|
expect(function() {
|
||||||
p3Args.transform("EPSG:3857");
|
p3Args.transform("EPSG:3857");
|
||||||
}).toThrow();
|
}).toThrow();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user