Ticket #359: 359.patch
| File 359.patch, 5.4 kB (added by crschmidt, 1 year ago) |
|---|
-
tests/Control/test_Permalink.html
old new 10 10 t.ok( control instanceof OpenLayers.Control.Permalink, "new OpenLayers.Control returns object" ); 11 11 t.eq( control.displayClass, "olControlPermalink", "displayClass is correct" ); 12 12 } 13 function test_Control_Permalink_uncentered (t) { 14 t.plan( 1 ); 15 16 control = new OpenLayers.Control.Permalink('permalink'); 17 map = new OpenLayers.Map('map'); 18 map.addControl(control); 19 map.events.triggerEvent("changelayer", {}); 20 t.ok(true, "permalink didn't bomb out."); 21 } 13 22 function test_02_Control_Permalink_updateLinks (t) { 14 t.plan( 2);23 t.plan( 3 ); 15 24 16 25 control = new OpenLayers.Control.Permalink('permalink'); 17 26 t.ok( control instanceof OpenLayers.Control.Permalink, "new OpenLayers.Control returns object" ); 18 27 map = new OpenLayers.Map('map'); 19 28 layer = new OpenLayers.Layer.WMS('Test Layer', "http://octo.metacarta.com/cgi-bin/mapserv", {map: '/mapdata/vmap_wms.map', layers: 'basic', format: 'image/jpeg'}); 20 29 map.addLayer(layer); 30 layer = new OpenLayers.Layer.WMS('Test Layer', "http://octo.metacarta.com/cgi-bin/mapserv", {map: '/mapdata/vmap_wms.map', layers: 'basic', format: 'image/jpeg'}, {'isBaseLayer': false}); 31 map.addLayer(layer); 32 layer.setVisibility(true); 21 33 if (!map.getCenter()) map.zoomToMaxExtent(); 22 34 map.addControl(control); 23 35 map.pan(5, 0); 24 t.eq(OpenLayers.Util.getElement('permalink').href, location+"?lat=0&lon=1.75781&zoom=2&layers=B", "Panning sets permalink"); 36 t.ok(OpenLayers.Util.isEquivalentUrl(OpenLayers.Util.getElement('permalink').href, location+"?lat=0&lon=1.75781&zoom=2&layers=BT"), 'pan sets permalink'); 37 38 map.layers[1].setVisibility(false); 39 40 t.ok(OpenLayers.Util.isEquivalentUrl(OpenLayers.Util.getElement('permalink').href, location+"?lat=0&lon=1.75781&zoom=2&layers=BF"), 'setVisibility sets permalink'); 25 41 } 26 42 function test_03_Control_Permalink_updateLinksBase (t) { 27 43 t.plan( 2 ); -
tests/Geometry/test_Point.html
old new 65 65 } 66 66 67 67 function test_06_Point_move(t) { 68 <<<<<<< .mine 69 t.plan(4); 70 ======= 68 71 t.plan(3); 72 >>>>>>> .r4227 69 73 70 74 var x = 10; 71 75 var y = 20; 72 76 point = new OpenLayers.Geometry.Point(x, y); 77 var bounds = point.getBounds(); 73 78 74 79 var dx = 10 * Math.random(); 75 80 var dy = 10 * Math.random(); … … 77 82 point.move(dx, dy); 78 83 t.eq(point.x, x + dx, "move() correctly modifies x"); 79 84 t.eq(point.y, y + dy, "move() correctly modifies y"); 85 <<<<<<< .mine 80 86 87 t.eq(point.getBounds().left, bounds.left + dx, "bounds is correctly updated after a move()"); 88 t.eq(point.getBounds().top, bounds.top + dy, "bounds is correctly updated after a move()"); 89 ======= 90 81 91 t.ok(point.bounds == null, "bounds is cleared after a move()"); 92 >>>>>>> .r4227 82 93 } 83 94 84 95 function test_Point_rotate(t) { 96 <<<<<<< .mine 97 t.plan(6); 98 ======= 85 99 t.plan(5); 100 >>>>>>> .r4227 86 101 87 102 var tolerance = 1e-10; 88 103 var x = 10; 89 104 var y = 20; 90 105 var point = new OpenLayers.Geometry.Point(x, y); 91 106 var origin = new OpenLayers.Geometry.Point(5, 10); 107 var bounds = point.getBounds(); 92 108 93 109 // rotate a full revolution 94 110 point.bounds = "foo"; … … 105 121 t.ok(((point.x - 1.4644660940672636) / 1.4644660940672636) < tolerance, 106 122 "rotate 1/8 turn correctly"); 107 123 t.ok(((point.y - 20.606601717798213) / 20.606601717798213) < tolerance, 124 <<<<<<< .mine 108 125 "rotate 1/8 turn correctly"); 126 t.ok(((point.getBounds().left - 1.4644660940672636) / 1.4644660940672636) < tolerance, 127 "bounds is correctly updated after a rotate()"); 128 t.ok(((point.getBounds().right - 20.606601717798213) / 20.606601717798213) < tolerance, 129 "bounds is correctly updated after a rotate()"); 130 ======= 131 "rotate 1/8 turn correctly"); 132 >>>>>>> .r4227 109 133 } 110 134 111 135 function test_Point_resize(t) { -
lib/OpenLayers/Control/Permalink.js
old new 93 93 this.div.appendChild(this.element); 94 94 } 95 95 this.map.events.register('moveend', this, this.updateLink); 96 this.map.events.register('changelayer', this, this.updateLink); 97 this.map.events.register('changebaselayer', this, this.updateLink); 96 98 return this.div; 97 99 }, 98 100 … … 101 103 */ 102 104 updateLink: function() { 103 105 var center = this.map.getCenter(); 106 107 // Map not initialized yet. Return null. 108 if (!center) { return null; } 109 104 110 var zoom = "zoom=" + this.map.getZoom(); 105 111 var lat = "lat=" + Math.round(center.lat*100000)/100000; 106 112 var lon = "lon=" + Math.round(center.lon*100000)/100000;
