summaryrefslogtreecommitdiff
path: root/misc/openlayers/tests/deprecated/Layer/Yahoo.html
diff options
context:
space:
mode:
Diffstat (limited to 'misc/openlayers/tests/deprecated/Layer/Yahoo.html')
-rwxr-xr-xmisc/openlayers/tests/deprecated/Layer/Yahoo.html121
1 files changed, 121 insertions, 0 deletions
diff --git a/misc/openlayers/tests/deprecated/Layer/Yahoo.html b/misc/openlayers/tests/deprecated/Layer/Yahoo.html
new file mode 100755
index 0000000..f7c67c0
--- /dev/null
+++ b/misc/openlayers/tests/deprecated/Layer/Yahoo.html
@@ -0,0 +1,121 @@
+<html>
+<head>
+ <script src="http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=euzuro-openlayers"></script>
+ <script src="../../OLLoader.js"></script>
+ <script src="../../../lib/deprecated.js"></script>
+ <script type="text/javascript">
+ var layer;
+
+ function test_Layer_Yahoo_constructor (t) {
+ t.plan( 4 );
+
+ var tempEventPane = OpenLayers.Layer.EventPane.prototype.initialize;
+ OpenLayers.Layer.EventPane.prototype.initialize = function(name, options) {
+ t.ok(name == g_Name, "EventPane initialize() called with correct name");
+ t.ok(options == g_Options, "EventPane initialize() called with correct options");
+ }
+
+ var tempFixedZoomLevels = OpenLayers.Layer.FixedZoomLevels.prototype.initialize;
+ OpenLayers.Layer.FixedZoomLevels.prototype.initialize = function(name, options) {
+ t.ok(name == g_Name, "FixedZoomLevels initialize() called with correct name");
+ t.ok(options == g_Options, "FixedZoomLevels initialize() called with correct options");
+ }
+
+
+ g_Name = {};
+ g_Options = {};
+ var l = new OpenLayers.Layer.Yahoo(g_Name, g_Options);
+
+ OpenLayers.Layer.EventPane.prototype.initialize = tempEventPane;
+ OpenLayers.Layer.FixedZoomLevels.prototype.initialize = tempFixedZoomLevels;
+ }
+
+ function test_Layer_Yahoo_loadMapObject(t) {
+ t.plan(5);
+
+ var temp = YMap;
+ YMap = OpenLayers.Class({
+ initialize: function(div, type, size) {
+ t.ok(div == g_Div, "correct div passed to YMap constructor");
+ t.ok(type == g_Type, "correct type passed to YMap constructor");
+ t.ok(size == g_YMapSize, "correct size passed to YMap constructor");
+ },
+ disableKeyControls: function() {
+ t.ok(true, "disableKeyControls called on map object");
+ }
+ });
+
+ g_Div = {};
+ g_Type = {};
+ g_MapSize = {};
+ g_YMapSize = {};
+
+ var l = new OpenLayers.Layer.Yahoo();
+ l.div = g_Div;
+ l.type = g_Type;
+ l.map = {
+ 'getSize': function() {
+ return g_MapSize;
+ }
+ };
+ l.getMapObjectSizeFromOLSize = function(mapSize) {
+ t.ok(mapSize == g_MapSize, "correctly translating map size from ol to YSize");
+ return g_YMapSize;
+ };
+
+ l.loadMapObject();
+
+ YMap = temp;
+ }
+
+ function test_Layer_Yahoo_onMapResize(t) {
+ t.plan(2);
+
+ g_MapSize = {};
+ g_YMapSize = {};
+
+ var l = new OpenLayers.Layer.Yahoo();
+ l.mapObject = {
+ 'resizeTo': function(size) {
+ t.ok(size == g_YMapSize, "correct YSize passed to reiszeTo on map object");
+ }
+ }
+ l.map = {
+ 'getSize': function() {
+ return g_MapSize;
+ }
+ };
+ l.getMapObjectSizeFromOLSize = function(mapSize) {
+ t.ok(mapSize == g_MapSize, "correctly translating map size from ol to YSize");
+ return g_YMapSize;
+ };
+
+ l.onMapResize();
+ }
+
+ function test_Layer_Yahoo_getMapObjectSizeFromOLSize(t) {
+ t.plan(2);
+
+ var temp = YSize;
+ YSize = function(w, h) {
+ t.ok(w == g_Size.w, "correct width passed to YSize constructor");
+ t.ok(h == g_Size.h, "correct height passed to YSize constructor");
+ }
+
+ g_Size = {
+ 'w': {},
+ 'h': {}
+ };
+
+ OpenLayers.Layer.Yahoo.prototype.getMapObjectSizeFromOLSize(g_Size);
+
+ YSize = temp;
+ }
+
+
+ </script>
+</head>
+<body>
+ <div id="map"></div>
+</body>
+</html>