OpenLayers OpenLayers

Ticket #359: 359.patch

File 359.patch, 5.4 kB (added by crschmidt, 1 year ago)
  • tests/Control/test_Permalink.html

    old new  
    1010        t.ok( control instanceof OpenLayers.Control.Permalink, "new OpenLayers.Control returns object" ); 
    1111        t.eq( control.displayClass,  "olControlPermalink", "displayClass is correct" ); 
    1212    } 
     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    }    
    1322    function test_02_Control_Permalink_updateLinks (t) { 
    14         t.plan( 2 ); 
     23        t.plan( 3 ); 
    1524     
    1625        control = new OpenLayers.Control.Permalink('permalink'); 
    1726        t.ok( control instanceof OpenLayers.Control.Permalink, "new OpenLayers.Control returns object" ); 
    1827        map = new OpenLayers.Map('map'); 
    1928        layer = new OpenLayers.Layer.WMS('Test Layer', "http://octo.metacarta.com/cgi-bin/mapserv", {map: '/mapdata/vmap_wms.map', layers: 'basic', format: 'image/jpeg'}); 
    2029        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); 
    2133        if (!map.getCenter())  map.zoomToMaxExtent(); 
    2234        map.addControl(control); 
    2335        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'); 
    2541    } 
    2642    function test_03_Control_Permalink_updateLinksBase (t) { 
    2743        t.plan( 2 ); 
  • tests/Geometry/test_Point.html

    old new  
    6565    } 
    6666     
    6767    function test_06_Point_move(t) { 
     68<<<<<<< .mine 
     69        t.plan(4); 
     70======= 
    6871        t.plan(3); 
     72>>>>>>> .r4227 
    6973         
    7074        var x = 10; 
    7175        var y = 20; 
    7276        point = new OpenLayers.Geometry.Point(x, y); 
     77        var bounds = point.getBounds(); 
    7378         
    7479        var dx = 10 * Math.random(); 
    7580        var dy = 10 * Math.random(); 
     
    7782        point.move(dx, dy); 
    7883        t.eq(point.x, x + dx, "move() correctly modifies x"); 
    7984        t.eq(point.y, y + dy, "move() correctly modifies y"); 
     85<<<<<<< .mine 
    8086         
     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         
    8191        t.ok(point.bounds == null, "bounds is cleared after a move()"); 
     92>>>>>>> .r4227 
    8293    } 
    8394 
    8495    function test_Point_rotate(t) { 
     96<<<<<<< .mine 
     97        t.plan(6); 
     98======= 
    8599        t.plan(5); 
     100>>>>>>> .r4227 
    86101         
    87102        var tolerance = 1e-10; 
    88103        var x = 10; 
    89104        var y = 20; 
    90105        var point = new OpenLayers.Geometry.Point(x, y); 
    91106        var origin = new OpenLayers.Geometry.Point(5, 10); 
     107        var bounds = point.getBounds(); 
    92108         
    93109        // rotate a full revolution 
    94110        point.bounds = "foo"; 
     
    105121        t.ok(((point.x - 1.4644660940672636) / 1.4644660940672636) < tolerance, 
    106122             "rotate 1/8 turn correctly"); 
    107123        t.ok(((point.y - 20.606601717798213) / 20.606601717798213) < tolerance, 
     124<<<<<<< .mine 
    108125             "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 
    109133    } 
    110134 
    111135    function test_Point_resize(t) { 
  • lib/OpenLayers/Control/Permalink.js

    old new  
    9393            this.div.appendChild(this.element); 
    9494        } 
    9595        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); 
    9698        return this.div; 
    9799    }, 
    98100    
     
    101103     */ 
    102104    updateLink: function() { 
    103105        var center = this.map.getCenter(); 
     106         
     107        // Map not initialized yet. Return null. 
     108        if (!center) { return null; } 
     109         
    104110        var zoom = "zoom=" + this.map.getZoom();  
    105111        var lat = "lat=" + Math.round(center.lat*100000)/100000; 
    106112        var lon = "lon=" + Math.round(center.lon*100000)/100000;