[OpenLayers-Commits] r2965 - in trunk/openlayers: lib/OpenLayers/Control tests/Control

commits at openlayers.org commits at openlayers.org
Sun Apr 1 21:03:26 EDT 2007


Author: crschmidt
Date: 2007-04-01 21:03:25 -0400 (Sun, 01 Apr 2007)
New Revision: 2965

Modified:
   trunk/openlayers/lib/OpenLayers/Control/PanZoom.js
   trunk/openlayers/lib/OpenLayers/Control/PanZoomBar.js
   trunk/openlayers/tests/Control/test_PanZoom.html
   trunk/openlayers/tests/Control/test_PanZoomBar.html
Log:
Commit tests and code for #610, reviewed by Schuyler, to resolve 
PanZoom/PanZoomBar position argument.


Modified: trunk/openlayers/lib/OpenLayers/Control/PanZoom.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Control/PanZoom.js	2007-04-02 00:46:07 UTC (rev 2964)
+++ trunk/openlayers/lib/OpenLayers/Control/PanZoom.js	2007-04-02 01:03:25 UTC (rev 2965)
@@ -27,9 +27,9 @@
      * @constructor
      */
     initialize: function() {
-        OpenLayers.Control.prototype.initialize.apply(this, arguments);
         this.position = new OpenLayers.Pixel(OpenLayers.Control.PanZoom.X,
                                              OpenLayers.Control.PanZoom.Y);
+        OpenLayers.Control.prototype.initialize.apply(this, arguments);
     },
 
     /**

Modified: trunk/openlayers/lib/OpenLayers/Control/PanZoomBar.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Control/PanZoomBar.js	2007-04-02 00:46:07 UTC (rev 2964)
+++ trunk/openlayers/lib/OpenLayers/Control/PanZoomBar.js	2007-04-02 01:03:25 UTC (rev 2965)
@@ -9,8 +9,6 @@
  * @requires OpenLayers/Control/PanZoom.js
  */
 OpenLayers.Control.PanZoomBar = OpenLayers.Class.create();
-OpenLayers.Control.PanZoomBar.X = 4;
-OpenLayers.Control.PanZoomBar.Y = 4;
 OpenLayers.Control.PanZoomBar.prototype = 
   OpenLayers.Class.inherit( OpenLayers.Control.PanZoom, {
 
@@ -34,8 +32,6 @@
 
     initialize: function() {
         OpenLayers.Control.PanZoom.prototype.initialize.apply(this, arguments);
-        this.position = new OpenLayers.Pixel(OpenLayers.Control.PanZoomBar.X,
-                                             OpenLayers.Control.PanZoomBar.Y);
     },
 
     /**

Modified: trunk/openlayers/tests/Control/test_PanZoom.html
===================================================================
--- trunk/openlayers/tests/Control/test_PanZoom.html	2007-04-02 00:46:07 UTC (rev 2964)
+++ trunk/openlayers/tests/Control/test_PanZoom.html	2007-04-02 01:03:25 UTC (rev 2965)
@@ -4,10 +4,13 @@
   <script type="text/javascript"><!--
     var map; 
     function test_01_Control_PanZoom_constructor (t) {
-        t.plan( 1 );
+        t.plan( 3 );
     
         control = new OpenLayers.Control.PanZoom();
         t.ok( control instanceof OpenLayers.Control.PanZoom, "new OpenLayers.Control.PanZoom returns object" );
+        control = new OpenLayers.Control.PanZoom({position: new OpenLayers.Pixel(100,100)});
+        t.eq( control.position.x, 100, "PanZoom X Set correctly."); 
+        t.eq( control.position.y, 100, "PanZoom y Set correctly."); 
     }
     function test_02_Control_PanZoom_addControl (t) {
         t.plan( 8 );

Modified: trunk/openlayers/tests/Control/test_PanZoomBar.html
===================================================================
--- trunk/openlayers/tests/Control/test_PanZoomBar.html	2007-04-02 00:46:07 UTC (rev 2964)
+++ trunk/openlayers/tests/Control/test_PanZoomBar.html	2007-04-02 01:03:25 UTC (rev 2965)
@@ -4,10 +4,12 @@
   <script type="text/javascript"><!--
     var map; 
     function test_01_Control_PanZoomBar_constructor (t) {
-        t.plan( 1 );
+        t.plan( 3 );
     
-        control = new OpenLayers.Control.PanZoomBar();
+        control = new OpenLayers.Control.PanZoomBar({position: new OpenLayers.Pixel(100,100)});
         t.ok( control instanceof OpenLayers.Control.PanZoomBar, "new OpenLayers.Control.PanZoomBar returns object" );
+        t.eq( control.position.x, 100, "PanZoom X Set correctly."); 
+        t.eq( control.position.y, 100, "PanZoom y Set correctly."); 
     }
     function test_02_Control_PanZoomBar_addControl (t) {
         t.plan( 8 );



More information about the Commits mailing list