View source
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<link rel="stylesheet" href="qunit.css" type="text/css" media="screen" />
<script type="text/javascript" src="harness.js"></script>
<script type="text/javascript" src="http://www.openlayers.org/dev/OpenLayers.js"></script>
<script type="text/javascript" src="../../js/openlayers.js"></script>
<script type="text/javascript" src="../../includes/layer_types/js/kml.js"></script>
<script type="text/javascript" src="../../includes/layer_types/js/osm.js"></script>
<script type="text/javascript" src="../../includes/layer_types/js/wms.js"></script>
<script type="text/javascript" src="../../includes/layer_types/js/xyz.js"></script>
<script type="text/javascript" src="qunit.js"></script>
<script>
$(document).ready(function() {
module("Utility Functions");
test("Testing Drupal.openlayers.relatePath correctness", function() {
var root_path = "/this/is/path.js";
var relative_path = "this/is/path.js";
var domain_path = "http://www.test.com/this/is/path.js";
equals(root_path,
Drupal.openlayers.relatePath(root_path, 'foo'), "Root path is correct" );
equals(domain_path,
Drupal.openlayers.relatePath(domain_path, 'foo'), "Domain path is correct" );
equals("http://foo.com/this/is/path.js",
Drupal.openlayers.relatePath(relative_path, 'http://foo.com/'), "Relative path is correct" )});
test("Testing object_from_feature correctness", function() {
var latlonobject = {lat: 5, lon: 10};
var llobj = Drupal.openlayers.objectFromFeature(latlonobject);
equals(10, llobj.geometry.x, "Latitude is correct" );
equals(5, llobj.geometry.y, "Latitude is correct" );
var wktobject = {wkt: 'POINT(50 40)'};
var wktobj = Drupal.openlayers.objectFromFeature(wktobject);
equals(50, wktobj.geometry.x, "Latitude is correct" );
equals(40, wktobj.geometry.y, "Latitude is correct" );
});
});
</script>
</head>
<body>
<h1 id="qunit-header">OpenLayers Tests</h1>
<h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
</body>
</html>