Hi Miguel, Could you please review this patch? It is very small!
I am currently running into issues with maps regression tests failing due to some problems with the Maps JavaScript API. The Maps JavaScript API can be configured to return the "current" version, either stable or experimental. When you run into problems, it is helpful to know what version your app is actually running so you can research the problem or write a good bug report. This change adds Maps.getVersion() to return the current Maps JavaScript API version and adds a unit test case for it. Also, when I sorted MapWidgetTest, a method moved. M maps/src/com/google/gwt/maps/client/Maps.java M maps/test/com/google/gwt/maps/client/MapWidgetTest.java Patch is made against the releases/maps/1.0 branch Thanks, -Eric. -- Eric Z. Ayers - GWT Team - Atlanta, GA USA http://code.google.com/webtoolkit/ --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
M maps/src/com/google/gwt/maps/client/Maps.java M maps/test/com/google/gwt/maps/client/MapWidgetTest.java Index: maps/src/com/google/gwt/maps/client/Maps.java =================================================================== --- maps/src/com/google/gwt/maps/client/Maps.java (revision 920) +++ maps/src/com/google/gwt/maps/client/Maps.java (working copy) @@ -33,6 +33,14 @@ } /** + * Return the current Maps API Version. + * @return + */ + public static native String getVersion() /*-{ + return $wnd.G_API_VERSION; + }-*/; + + /** * Returns <code>true</code> if the current browser supports the maps API * library. * @@ -52,7 +60,7 @@ public static native boolean isLoaded() /*-{ return $wnd.GMap2 !== undefined; }-*/; - + /** * Use private constructor so this class can't be instantiated. */ Index: maps/test/com/google/gwt/maps/client/MapWidgetTest.java =================================================================== --- maps/test/com/google/gwt/maps/client/MapWidgetTest.java (revision 920) +++ maps/test/com/google/gwt/maps/client/MapWidgetTest.java (working copy) @@ -40,15 +40,43 @@ TestUtilities.cleanDom(); } + public void testGetVersion() { + String version = Maps.getVersion(); + /* This will print on the console in hosted mode tests only and be + * ignored for web mode tests. + */ + System.out.println("Maps version: " + version); + assertNotNull("Maps version", version); + } + public void testIsBrowserCompatible() { assertTrue("The MAPS api is not compatible with this browser.", Maps.isBrowserCompatible()); } - + public void testIsLoaded() { assertTrue("The MAPS api is not properly loaded.", Maps.isLoaded()); } + public void testMapWidgetCloseInfoWindow() { + LatLng center = LatLng.newInstance(0, 0); + final MapWidget map = new MapWidget(center, 1); + map.setSize("300px", "300px"); + RootPanel.get().add(map); + InfoWindowContent content = new InfoWindowContent("<i>Hello World!</i>"); + InfoWindow info = map.getInfoWindow(); + info.open(center, content); + DeferredCommand.addCommand(new Command() { + + public void execute() { + map.closeInfoWindow(); + finishTest(); + } + + }); + delayTestFinish(ASYNC_DELAY_MSEC); + } + public void testMapWidgetCursors() { MapWidget m = new MapWidget(LatLng.newInstance(0, 80), 4, "wait", "help"); RootPanel.get().add(m); @@ -73,23 +101,4 @@ LatLng.newInstance(45, 45))); assertEquals("Zoom level didn't match.", m.getZoomLevel(), 8); } - - public void testMapWidgetCloseInfoWindow() { - LatLng center = LatLng.newInstance(0, 0); - final MapWidget map = new MapWidget(center, 1); - map.setSize("300px", "300px"); - RootPanel.get().add(map); - InfoWindowContent content = new InfoWindowContent("<i>Hello World!</i>"); - InfoWindow info = map.getInfoWindow(); - info.open(center, content); - DeferredCommand.addCommand(new Command() { - - public void execute() { - map.closeInfoWindow(); - finishTest(); - } - - }); - delayTestFinish(ASYNC_DELAY_MSEC); - } }