2013-11-08 05:54:33 +08:00
|
|
|
describe("Transformation", function () {
|
2010-09-02 23:23:53 +08:00
|
|
|
var t, p;
|
2013-02-05 19:51:27 +08:00
|
|
|
|
2013-11-08 05:54:33 +08:00
|
|
|
beforeEach(function () {
|
2010-09-02 23:23:53 +08:00
|
|
|
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-11-08 05:54:33 +08:00
|
|
|
it("performs a transformation", function () {
|
2013-02-05 19:51:27 +08:00
|
|
|
var p2 = t.transform(p, 2);
|
2013-03-02 05:49:20 +08:00
|
|
|
expect(p2).to.eql(new L.Point(24, 128));
|
2013-02-05 19:51:27 +08:00
|
|
|
});
|
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);
|
2013-03-02 05:49:20 +08:00
|
|
|
expect(p2).to.eql(new L.Point(12, 64));
|
2013-02-05 19:51:27 +08:00
|
|
|
});
|
2010-09-02 23:23:53 +08:00
|
|
|
});
|
2013-02-05 19:51:27 +08:00
|
|
|
|
|
|
|
describe('#untransform', function () {
|
2013-11-08 05:54:33 +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);
|
2013-03-02 05:49:20 +08:00
|
|
|
expect(p3).to.eql(p);
|
2013-02-05 19:51:27 +08:00
|
|
|
});
|
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);
|
2013-03-02 05:49:20 +08:00
|
|
|
expect(t.untransform(new L.Point(12, 64))).to.eql(new L.Point(10, 20));
|
2013-02-05 19:51:27 +08:00
|
|
|
});
|
2010-09-02 23:23:53 +08:00
|
|
|
});
|
2013-02-05 19:51:27 +08:00
|
|
|
});
|