2010-09-02 23:23:53 +08:00
|
|
|
describe("Transformation", function() {
|
|
|
|
var t, p;
|
2013-02-05 19:51:27 +08:00
|
|
|
|
2010-09-02 23:23:53 +08:00
|
|
|
beforeEach(function() {
|
|
|
|
t = new L.Transformation(1, 2, 3, 4);
|
|
|
|
p = new L.Point(10, 20);
|
|
|
|
});
|
2013-02-05 19:51:27 +08:00
|
|
|
|
|
|
|
describe('#transform', function () {
|
2013-02-20 04:41:48 +08:00
|
|
|
it("performs a transformation", function() {
|
2013-02-05 19:51:27 +08:00
|
|
|
var p2 = t.transform(p, 2);
|
|
|
|
expect(p2).toEqual(new L.Point(24, 128));
|
|
|
|
});
|
2013-02-20 04:41:48 +08:00
|
|
|
it('assumes a scale of 1 if not specified', function () {
|
2013-02-05 19:51:27 +08:00
|
|
|
var p2 = t.transform(p);
|
|
|
|
expect(p2).toEqual(new L.Point(12, 64));
|
|
|
|
});
|
2010-09-02 23:23:53 +08:00
|
|
|
});
|
2013-02-05 19:51:27 +08:00
|
|
|
|
|
|
|
describe('#untransform', function () {
|
2013-02-20 04:41:48 +08:00
|
|
|
it("performs a reverse transformation", function() {
|
2013-02-05 19:51:27 +08:00
|
|
|
var p2 = t.transform(p, 2);
|
|
|
|
var p3 = t.untransform(p2, 2);
|
|
|
|
expect(p3).toEqual(p);
|
|
|
|
});
|
2013-02-20 04:41:48 +08:00
|
|
|
it('assumes a scale of 1 if not specified', function () {
|
2013-02-05 19:51:27 +08:00
|
|
|
var p2 = t.transform(p);
|
|
|
|
expect(t.untransform(new L.Point(12, 64))).toEqual(new L.Point(10, 20));
|
|
|
|
});
|
2010-09-02 23:23:53 +08:00
|
|
|
});
|
2013-02-05 19:51:27 +08:00
|
|
|
});
|