# Code coverage report for ./suites/geometry/TransformationSpec.js

## Statements: 100% (20 / 20) Branches: 100% (0 / 0) Functions: 100% (8 / 8) Lines: 100% (20 / 20)

All files » ./suites/geometry/ » TransformationSpec.js

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    321
    1

    1
    4
    4

    1
    1
    1
    1

    1
    1
    1

    1
    1
    1
    1
    1

    1
    1
    1

     describe("Transformation", function() {
    	var t, p;

    	beforeEach(function() {
    		t = new L.Transformation(1, 2, 3, 4);
    		p = new L.Point(10, 20);
    	});

    	describe('#transform', function () {
    		it("performs a transformation", function() {
    			var p2 = t.transform(p, 2);
    			expect(p2).to.eql(new L.Point(24, 128));
    		});
    		it('assumes a scale of 1 if not specified', function () {
    			var p2 = t.transform(p);
    			expect(p2).to.eql(new L.Point(12, 64));
    		});
    	});

    	describe('#untransform', function () {
    		it("performs a reverse transformation", function() {
    			var p2 = t.transform(p, 2);
    			var p3 = t.untransform(p2, 2);
    			expect(p3).to.eql(p);
    		});
    		it('assumes a scale of 1 if not specified', function () {
    			var p2 = t.transform(p);
    			expect(t.untransform(new L.Point(12, 64))).to.eql(new L.Point(10, 20));
    		});
    	});
    });