initial set of tests running

This commit is contained in:
Mike Adair
2012-06-19 10:17:41 -04:00
parent 6f3b47709a
commit b0490ecdb6
3 changed files with 13 additions and 7 deletions

View File

@@ -59,8 +59,8 @@ ol.map = function(opt_arg){
if (goog.isDef(projection)) {
map.setProjection(projection);
}
if (goog.isDef(projection)) {
map.setUserProjection(projection);
if (goog.isDef(userProjection)) {
map.setUserProjection(userProjection);
}
return map;

View File

@@ -14,13 +14,13 @@ ol.Map = function() {
* @private
* @type {ol.Projection}
*/
this.projection_ = new ol.Projection('EPSG:900913');
this.projection_ = null;
/**
* @private
* @type {ol.Projection}
*/
this.userProjection_ = new ol.Projection('EPSG:4326');
this.userProjection_ = null;
/**
* @private
@@ -66,7 +66,7 @@ ol.Map.prototype.getCenter = function() {
* @return {ol.Projection} Projection.
*/
ol.Map.prototype.getProjection = function() {
if (!goog.isDef(this.projection_)) {
if (goog.isNull(this.projection_)) {
this.projection_ = new ol.Projection(this.DEFAULT_PROJECTION);
}
return this.projection_;
@@ -77,7 +77,7 @@ ol.Map.prototype.getProjection = function() {
* @return {ol.Projection} User projection.
*/
ol.Map.prototype.getUserProjection = function() {
if (!goog.isDef(this.userProjection_)) {
if (goog.isNull(this.userProjection_)) {
this.userProjection_ = new ol.Projection(this.DEFAULT_USER_PROJECTION);
}
return this.userProjection_;
@@ -153,4 +153,7 @@ ol.Map.prototype.setNumZoomLevels = function(nZoom) {
*/
ol.Map.prototype.destroy = function() {
//remove layers, etc.
for (key in this) {
delete this[key];
}
};

View File

@@ -83,7 +83,10 @@ describe("ol.Map", function() {
var proj;
// at construction
var map = ol.map({projection: "EPSG:4326"});
debugger;
var map = ol.map({
projection: ol.projection("EPSG:4326")
});
proj = map.projection();
expect(proj instanceof ol.Projection).toBe(true);