summaryrefslogtreecommitdiff
path: root/misc/openlayers/tests/node.js/run-test.js
diff options
context:
space:
mode:
authorChris Schlaeger <chris@linux.com>2014-08-12 21:56:44 +0200
committerChris Schlaeger <chris@linux.com>2014-08-12 21:56:44 +0200
commitea346a785dc1b3f7c156f6fc33da634e1f1a627b (patch)
treeaf67530553d20b6e82ad60fd79593e9c4abf5565 /misc/openlayers/tests/node.js/run-test.js
parent59741cd535c47f25971bf8c32b25da25ceadc6d5 (diff)
downloadpostrunner-ea346a785dc1b3f7c156f6fc33da634e1f1a627b.zip
Adding jquery, flot and openlayers to be included with the GEM.v0.0.4
Diffstat (limited to 'misc/openlayers/tests/node.js/run-test.js')
-rw-r--r--misc/openlayers/tests/node.js/run-test.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/misc/openlayers/tests/node.js/run-test.js b/misc/openlayers/tests/node.js/run-test.js
new file mode 100644
index 0000000..7b0dd8b
--- /dev/null
+++ b/misc/openlayers/tests/node.js/run-test.js
@@ -0,0 +1,26 @@
+// Requires:
+/// 0. nodejs
+// 1. jsdom installed (npm install jsdom)
+// 2. A build profile with mockdom.js included in [first], and node.js
+// inclded in [last], at ../../build/OpenLayers.js , like node-tests.js.
+// 3. Run with node run-tests.js
+//
+// Missing: integration with a solid node.js testrunner.
+var jsdom = require('jsdom');
+jsdom.env('<html><body></body></html>', function(errors, window) {
+ for (var i in window) {
+ if (i == "console") {
+ continue;
+ }
+ eval(i+"=window['"+i+"'];");
+ }
+ OpenLayers = require("../../build/OpenLayers.js")['OpenLayers'];
+ var map = new OpenLayers.Map(document.createElement("map"));
+ map.addLayer(new OpenLayers.Layer("", {isBaseLayer:true}));
+ map.setCenter(new OpenLayers.LonLat(-71,42), 10);
+ var px = map.getPixelFromLonLat(map.getLonLatFromPixel(new OpenLayers.Pixel(100,100)));
+ console.log(px);
+ var px = map.getLonLatFromPixel(map.getPixelFromLonLat(new OpenLayers.LonLat(10,10)));
+ console.log(px);
+
+});