Sha256: a275177618327dcf78cb306e5f2dbe5423c027cfccda4dbc780d631b96e00dfc

Contents?: true

Size: 1.64 KB

Versions: 5

Compression:

Stored size: 1.64 KB

Contents

describe("Projection.Mercator", function () {
	var p = L.Projection.Mercator;

	describe("#project", function () {
		it("projects a center point", function () {
			//edge cases
			expect(p.project(new L.LatLng(0, 0))).near(new L.Point(0, 0));
		});

		it("projects the northeast corner of the world", function () {
			expect(p.project(new L.LatLng(90, 180))).near(new L.Point(20037508, 20037508));
		});

		it("projects the southwest corner of the world", function () {
			expect(p.project(new L.LatLng(-90, -180))).near(new L.Point(-20037508, -20037508));
		});

		it("projects other points", function () {
			expect(p.project(new L.LatLng(50, 30))).near(new L.Point(3339584, 6413524));

			// from https://github.com/Leaflet/Leaflet/issues/1578
			expect(p.project(new L.LatLng(51.9371170300465, 80.11230468750001)))
			        .near(new L.Point(8918060.964088084, 6755099.410887127));
		});
	});

	describe("#unproject", function () {
		function pr(point) {
			return p.project(p.unproject(point));
		}

		it("unprojects a center point", function () {
			expect(pr(new L.Point(0, 0))).near(new L.Point(0, 0));
		});

		it("unprojects pi points", function () {
			expect(pr(new L.Point(-Math.PI, Math.PI))).near(new L.Point(-Math.PI, Math.PI));
			expect(pr(new L.Point(-Math.PI, -Math.PI))).near(new L.Point(-Math.PI, -Math.PI));

			expect(pr(new L.Point(0.523598775598, 1.010683188683))).near(new L.Point(0.523598775598, 1.010683188683));
		});

		it('unprojects other points', function () {
			// from https://github.com/Leaflet/Leaflet/issues/1578
			expect(pr(new L.Point(8918060.964088084, 6755099.410887127)));
		});
	});
});

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
leaflet-js-0.7.0.4 lib/leaflet/spec/suites/geo/ProjectionSpec.js
leaflet-js-0.7.0.3 lib/leaflet/spec/suites/geo/ProjectionSpec.js
leaflet-js-0.7.0.2 lib/leaflet/spec/suites/geo/ProjectionSpec.js
leaflet-js-0.7.0.1 lib/leaflet/spec/suites/geo/ProjectionSpec.js
leaflet-js-0.7.0 lib/leaflet/spec/suites/geo/ProjectionSpec.js