Files
openlayers/tests/Projection.html
2008-03-31 05:31:28 +00:00

31 lines
1.3 KiB
HTML

<html>
<head>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
function test_Projection_constructor(t) {
t.plan(9);
var options = {'foo': 'bar'};
var projection = new OpenLayers.Projection("code", options);
t.ok(projection instanceof OpenLayers.Projection,
"new OpenLayers.Projection returns object" );
t.eq(projection.projCode, "code", "The proj code is maintained");
t.eq(projection.getCode(), "code", "The proj code is maintained.");
t.eq(projection.getUnits(), null, "Null units with no proj4js library.");
t.eq(projection.foo, "bar", "constructor sets options correctly");
var projection2 = new OpenLayers.Projection("epsg:4325", options);
out = OpenLayers.Projection.transform({'x':10,'y':12}, projection, projection2);
t.eq(out.x, 10, "Null transform has no effect");
t.eq(out.y, 12, "Null transform has no effect");
t.eq(projection.equals(null), false, "equals on null projection returns false");
t.eq(projection.equals({}), false, "equals on null projection object returns false (doesn't call getCode)");
}
</script>
</head>
<body>
</body>
</html>