OpenLayers OpenLayers

Changeset 7163

Show
Ignore:
Timestamp:
05/13/08 16:52:01 (5 months ago)
Author:
elemoine
Message:

MousePosition: numDigits inconsistency, reported by kthy, patch by kthy, additional test by me, r=me (closes #1544)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Control/MousePosition.js

    r6727 r7163  
    4141     * {Integer} 
    4242     */ 
    43     numdigits: 5, 
     43    numDigits: 5, 
    4444     
    4545    /**  
     
    145145     */ 
    146146    formatOutput: function(lonLat) { 
    147         var digits = parseInt(this.numdigits); 
     147        var digits = parseInt(this.numDigits); 
    148148        var newHtml = 
    149149            this.prefix + 
  • trunk/openlayers/tests/Control/MousePosition.html

    r6724 r7163  
    44  <script type="text/javascript"> 
    55    var map, control;  
    6     function test_Control_MousePosition_constructor (t) { 
     6    function test_initialize (t) { 
    77        t.plan( 2 ); 
    88     
     
    1111        t.eq( control.displayClass,  "olControlMousePosition", "displayClass is correct" ); 
    1212    } 
    13     function test_Control_MousePosition_redraw_noLayer_displayProjection(t) { 
     13    function test_redraw_noLayer_displayProjection(t) { 
    1414        t.plan(2); 
    1515        control = new OpenLayers.Control.MousePosition({'displayProjection': new OpenLayers.Projection("WGS84")}); 
     
    2626        t.eq(control.div.innerHTML, "-175.78125, 85.78125", "innerHTML set correctly when triggered."); 
    2727    } 
    28     function test_MousePosition_destroy(t) { 
     28    function test_destroy(t) { 
    2929        t.plan(1); 
    3030     
     
    3939        map.destroy();      
    4040    } 
    41  
    42     function test_MousePosition_addControl(t) { 
     41    function test_addControl(t) { 
    4342        t.plan(4); 
    4443 
     
    5352        map.destroy();      
    5453    } 
    55  
    56     function test_Control_MousePosition_redraw_noLayer_displayProjection(t) { 
     54    function test_redraw_noLayer_displayProjection(t) { 
    5755        t.plan(3); 
    5856        var control = new OpenLayers.Control.MousePosition(); 
     
    7169        map.destroy();      
    7270    } 
     71    function test_formatOutput(t) { 
     72        t.plan(1); 
     73        var control = new OpenLayers.Control.MousePosition({ 
     74            prefix: 'prefix', 
     75            suffix: 'suffix', 
     76            separator: 'separator', 
     77            numDigits: 3 
     78        }); 
     79        var lonlat = new OpenLayers.LonLat(0.75699, 0.37365); 
     80        var val = control.formatOutput(lonlat); 
     81        t.eq(val, 'prefix0.757separator0.374suffix', 'formatOutput correctly formats the mouse position output'); 
     82    } 
    7383  </script> 
    7484</head>