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)) { if (goog.isDef(projection)) {
map.setProjection(projection); map.setProjection(projection);
} }
if (goog.isDef(projection)) { if (goog.isDef(userProjection)) {
map.setUserProjection(projection); map.setUserProjection(userProjection);
} }
return map; return map;

View File

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

View File

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