[Commits] r1632 - in sandbox/cmoullet/ux/GoogleEarthPanel: tests/ux/widgets ux/widgets
commits at geoext.org
commits at geoext.org
Wed Dec 30 05:37:59 CET 2009
Author: cmoullet
Date: 2009-12-30 05:37:56 +0100 (Wed, 30 Dec 2009)
New Revision: 1632
Added:
sandbox/cmoullet/ux/GoogleEarthPanel/tests/ux/widgets/GoogleEarthPanelStandalone.html
Modified:
sandbox/cmoullet/ux/GoogleEarthPanel/tests/ux/widgets/GoogleEarthPanel.html
sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets/GoogleEarthPanel.js
Log:
Add some tests. Still some problem with GE instance creation in test
Modified: sandbox/cmoullet/ux/GoogleEarthPanel/tests/ux/widgets/GoogleEarthPanel.html
===================================================================
--- sandbox/cmoullet/ux/GoogleEarthPanel/tests/ux/widgets/GoogleEarthPanel.html 2009-12-29 21:36:33 UTC (rev 1631)
+++ sandbox/cmoullet/ux/GoogleEarthPanel/tests/ux/widgets/GoogleEarthPanel.html 2009-12-30 04:37:56 UTC (rev 1632)
@@ -32,21 +32,44 @@
<script type="text/javascript">
google.load("earth", "1");
-
+
function test_ctor(t) {
- t.plan(1);
- var map = new OpenLayers.Map('map');
- var ge = new GeoExt.ux.GoogleEarthPanel({
- renderTo: 'googleearth',
- map: map
+ t.plan(8);
+ var options = {
+ projection: new OpenLayers.Projection("EPSG:900913"),
+ units: "m",
+ numZoomLevels: 18,
+ maxResolution: 156543.0339,
+ maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
+ 20037508, 20037508.34)
+ };
+ var map = new OpenLayers.Map('map', options);
+ // Add a layer in map
+ var layer = new OpenLayers.Layer.Google(
+ "Google Street", {sphericalMercator: true});
+ map.addLayer(layer);
+ var center = new OpenLayers.LonLat(-13625995.09, 4550849.74);
+ map.setCenter(center, 14);
+
+ var gePanel = new GeoExt.ux.GoogleEarthPanel({
+ map: map,
+ renderTo: 'map3d'
});
- t.eq(ge.getTerrainLayer(), true, "showTerrainLayer is true per default");
+ 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");
+ t.eq(gePanel.clickMode, true, "clickMode is true per default");
+ t.eq(gePanel.range, 100, "range is 100 per default");
+ t.eq(gePanel.readPermalink, true, "read permalink is true per default");
+ t.eq(map.getCenter().toString(), "lon=-13625995.09,lat=4550849.74", "map center set correctly");
+ t.eq(map.getZoom(), 14, "zoom set correctly");
}
+
</script>
<body>
<div id="map"></div>
-<div id="googleearth"></div>
+<div id="map3d" style="height: 400px; width: 600px;"></div>
</body>
</html>
Added: sandbox/cmoullet/ux/GoogleEarthPanel/tests/ux/widgets/GoogleEarthPanelStandalone.html
===================================================================
--- sandbox/cmoullet/ux/GoogleEarthPanel/tests/ux/widgets/GoogleEarthPanelStandalone.html (rev 0)
+++ sandbox/cmoullet/ux/GoogleEarthPanel/tests/ux/widgets/GoogleEarthPanelStandalone.html 2009-12-30 04:37:56 UTC (rev 1632)
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html debug="true">
+<head>
+
+ <script type="text/javascript" src="http://extjs.cachefly.net/builds/ext-cdn-771.js"></script>
+ <!-- Google Maps API for "localhost"
+ <script type="text/javascript" src='http://maps.google.com/maps?file=api&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script>
+ <script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ"></script>
+ -->
+ <!-- 192.168.1.44 -->
+ <!--
+ <script src='http://maps.google.com/maps?file=api&key=ABQIAAAAY-I0w1WyNCVHbxpuwQWMpRSIMweZSjbRtcUk2F5YNqLnri0MahTrQJRaRPWFP0OUB1b6unv37Jg7vQ'></script>
+ <script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAAY-I0w1WyNCVHbxpuwQWMpRSIMweZSjbRtcUk2F5YNqLnri0MahTrQJRaRPWFP0OUB1b6unv37Jg7vQ"></script>
+ -->
+ <!-- 10.27.10.44 -->
+ <!--
+ <script src='http://maps.google.com/maps?file=api&key=ABQIAAAAY-I0w1WyNCVHbxpuwQWMpRQg15vMUgV9rqK5U3tGsPdx8x_OsBTeBHQ0wK75MLc8dB7yu0cRx36VJQ'></script>
+ <script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAAY-I0w1WyNCVHbxpuwQWMpRQg15vMUgV9rqK5U3tGsPdx8x_OsBTeBHQ0wK75MLc8dB7yu0cRx36VJQ"></script>
+ -->
+
+ <!-- Google Maps API for "dev.geoext.org" -->
+ <script type="text/javascript"
+ src='http://maps.google.com/maps?file=api&key=ABQIAAAAY-I0w1WyNCVHbxpuwQWMpRTv_-xvSZ6KJmWSkQfCJoxbiB7tyBQ1ey_kgwA_p7sbTQSTOBeMyXtXkA'></script>
+ <script type="text/javascript"
+ src="http://www.google.com/jsapi?key=ABQIAAAAY-I0w1WyNCVHbxpuwQWMpRTv_-xvSZ6KJmWSkQfCJoxbiB7tyBQ1ey_kgwA_p7sbTQSTOBeMyXtXkA"></script>
+
+
+ <script type="text/javascript" src="http://openlayers.org/api/2.8/OpenLayers.js"></script>
+ <script type="text/javascript" src="../../../../../trunk/geoext/lib/GeoExt.js"></script>
+ <script type="text/javascript" src="../../../ux/control/GoogleEarthClick.js"></script>
+ <script type="text/javascript" src="../../../ux/widgets/GoogleEarthPanel.js"></script>
+
+ <script type="text/javascript">
+ var ge;
+ google.load("earth", "1");
+
+ function init() {
+ google.earth.createInstance('map3d', initCB, failureCB);
+ }
+
+ function initCB(instance) {
+ ge = instance;
+ ge.getWindow().setVisibility(true);
+ }
+
+ function failureCB(errorCode) {
+ }
+
+ google.setOnLoadCallback(init);
+ </script>
+
+</head>
+<body>
+<div id="map3d" style="height: 400px; width: 600px;"></div>
+</body>
+</html>
\ No newline at end of file
Modified: sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets/GoogleEarthPanel.js
===================================================================
--- sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets/GoogleEarthPanel.js 2009-12-29 21:36:33 UTC (rev 1631)
+++ sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets/GoogleEarthPanel.js 2009-12-30 04:37:56 UTC (rev 1632)
@@ -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
@@ -307,9 +307,9 @@
/** method[failureCallback]
* Failure callback for the creation of the Google Earth Instance
* More documentation in http://code.google.com/apis/earth/documentation/reference/google_earth_namespace.html
- * :param object: ``Object`` The Google Earth Instance
*/
- failureCallback: function() {
+ failureCallback: function(errorcode) {
+ alert('Google Earth plug in not working: ' +errorcode);
this.earthAvailable = false;
},
More information about the Commits
mailing list