diff options
author | Chris Schlaeger <chris@linux.com> | 2014-08-12 21:56:44 +0200 |
---|---|---|
committer | Chris Schlaeger <chris@linux.com> | 2014-08-12 21:56:44 +0200 |
commit | ea346a785dc1b3f7c156f6fc33da634e1f1a627b (patch) | |
tree | af67530553d20b6e82ad60fd79593e9c4abf5565 /misc/openlayers/tests/Icon.html | |
parent | 59741cd535c47f25971bf8c32b25da25ceadc6d5 (diff) | |
download | postrunner-ea346a785dc1b3f7c156f6fc33da634e1f1a627b.zip |
Adding jquery, flot and openlayers to be included with the GEM.v0.0.4
Diffstat (limited to 'misc/openlayers/tests/Icon.html')
-rw-r--r-- | misc/openlayers/tests/Icon.html | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/misc/openlayers/tests/Icon.html b/misc/openlayers/tests/Icon.html new file mode 100644 index 0000000..ac542d2 --- /dev/null +++ b/misc/openlayers/tests/Icon.html @@ -0,0 +1,68 @@ +<html> +<head> + <script src="OLLoader.js"></script> + <script type="text/javascript"> + var icon; + + function test_Icon_constructor (t) { + t.plan( 4 ); + var size = new OpenLayers.Size(5,6); + icon = new OpenLayers.Icon("", size); + t.ok( icon instanceof OpenLayers.Icon, "new OpenLayers.Icon returns Icon object" ); + t.ok( icon.size instanceof OpenLayers.Size, "icon.size returns Size object" ); + t.ok( icon.size.equals(size), "icon.size returns correct value" ); + t.eq( icon.url, "", "icon.url returns str object" ); + } + function test_Icon_clone (t) { + t.plan( 4 ); + icon = new OpenLayers.Icon("a",new OpenLayers.Size(5,6)); + t.ok( icon instanceof OpenLayers.Icon, "new OpenLayers.Icon returns Icon object" ); + var cloned = icon.clone(); + t.ok( cloned instanceof OpenLayers.Icon, "clone is an OpenLayers.Icon" ); + cloned.url = "b" + t.eq( icon.url, "a", "icon.url doesn't change with clone's url" ); + t.eq( cloned.url, "b", "cloned.url does change when edited" ); + } + + function test_Icon_setOpacity(t) { + t.plan( 2 ); + + icon = new OpenLayers.Icon("a",new OpenLayers.Size(5,6)); + t.ok(!icon.imageDiv.style.opacity, "default icon has no opacity"); + + icon.setOpacity(0.5); + t.eq(parseFloat(icon.imageDiv.style.opacity), 0.5, "icon.setOpacity() works"); + } + + function test_Icon_isDrawn(t) { + t.plan(4); + + var icon = {}; + + //no imageDiv + var drawn = OpenLayers.Icon.prototype.isDrawn.apply(icon, []); + t.ok(!drawn, "icon with no imageDiv not drawn"); + + //imageDiv no parentNode + icon.imageDiv = {}; + drawn = OpenLayers.Icon.prototype.isDrawn.apply(icon, []); + t.ok(!drawn, "icon with imageDiv with no parentNode not drawn"); + + //imageDiv with parent + icon.imageDiv.parentNode = {}; + drawn = OpenLayers.Icon.prototype.isDrawn.apply(icon, []); + t.ok(drawn, "icon with imageDiv with parentNode drawn"); + + //imageDiv with parent but nodetype 11 + icon.imageDiv.parentNode = {'nodeType': 11}; + drawn = OpenLayers.Icon.prototype.isDrawn.apply(icon, []); + t.ok(!drawn, "imageDiv with parent but nodetype 11 not drawn"); + } + + + + </script> +</head> +<body> +</body> +</html> |