[Commits] r1633 - in sandbox/cmoullet/ux/GoogleEarthPanel: tests/ux/widgets ux/widgets

commits at geoext.org commits at geoext.org
Wed Dec 30 05:57:41 CET 2009


Author: cmoullet
Date: 2009-12-30 05:57:40 +0100 (Wed, 30 Dec 2009)
New Revision: 1633

Modified:
   sandbox/cmoullet/ux/GoogleEarthPanel/tests/ux/widgets/GoogleEarthPanel.html
   sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets/GoogleEarthPanel.js
Log:
Extend tests and fix destroy bug

Modified: sandbox/cmoullet/ux/GoogleEarthPanel/tests/ux/widgets/GoogleEarthPanel.html
===================================================================
--- sandbox/cmoullet/ux/GoogleEarthPanel/tests/ux/widgets/GoogleEarthPanel.html	2009-12-30 04:37:56 UTC (rev 1632)
+++ sandbox/cmoullet/ux/GoogleEarthPanel/tests/ux/widgets/GoogleEarthPanel.html	2009-12-30 04:57:40 UTC (rev 1633)
@@ -34,7 +34,7 @@
         google.load("earth", "1");
 
         function test_ctor(t) {
-            t.plan(8);
+            t.plan(10);
             var options = {
                 projection: new OpenLayers.Projection("EPSG:900913"),
                 units: "m",
@@ -56,6 +56,11 @@
                 renderTo: 'map3d'
             });
 
+            t.ok(gePanel instanceof GeoExt.ux.GoogleEarthPanel,
+                    "ctor creates a GeoExt.ux.GoogleEarthPanel object");
+            t.ok(gePanel instanceof Ext.Panel,
+                    "ctor creates an Ext.Panel object");
+
             t.eq(gePanel.getTerrainLayer(), true, "showTerrainLayer is true per default");
             t.eq(gePanel.getBuildingsLayer(), true, "showBuildingsLayer is true per default");
             t.eq(gePanel.show2DNavigationTool, true, "show2DNavigationTool is true per default");
@@ -65,6 +70,7 @@
             t.eq(map.getCenter().toString(), "lon=-13625995.09,lat=4550849.74", "map center set correctly");
             t.eq(map.getZoom(), 14, "zoom set correctly");
 
+            gePanel.destroy();
         }
 
     </script>

Modified: sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets/GoogleEarthPanel.js
===================================================================
--- sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets/GoogleEarthPanel.js	2009-12-30 04:37:56 UTC (rev 1632)
+++ sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets/GoogleEarthPanel.js	2009-12-30 04:57:40 UTC (rev 1633)
@@ -195,7 +195,7 @@
         if (this.ownerCt) {
             var wh = this.ownerCt.getSize();
             Ext.applyIf(this, wh);
-        } 
+        }
         GeoExt.ux.GoogleEarthPanel.superclass.afterRender.call(this);
 
         // Use the permalink
@@ -309,7 +309,7 @@
      *  More documentation in http://code.google.com/apis/earth/documentation/reference/google_earth_namespace.html
      */
     failureCallback: function(errorcode) {
-        alert('Google Earth plug in not working: ' +errorcode);
+        alert('Google Earth plug in not working: ' + errorcode);
         this.earthAvailable = false;
     },
 
@@ -810,10 +810,12 @@
         this.setShow2DNavigationTool(false);
         this.setClickMode(false);
         this.setNavigationMode2D(false);
-        google.earth.removeEventListener(this.ge, "frameend", function() {
-            self.onFrameEnd();
-        });
-        this.ge.getNavigationControl().setVisibility(this.ge.VISIBILITY_HIDE);
+        if (this.ge) {
+            google.earth.removeEventListener(this.ge, "frameend", function() {
+                self.onFrameEnd();
+            });
+            this.ge.getNavigationControl().setVisibility(this.ge.VISIBILITY_HIDE);
+        }
         GeoExt.ux.GoogleEarthPanel.superclass.beforeDestroy.apply(this, arguments);
     },
 



More information about the Commits mailing list