Hello Miguel,
Here is another patch I'd like for you to review. It addresses issue 189 in
the issue tracker:
http://code.google.com/p/gwt-google-apis/issues/detail?id=189
The problem was very easy to solve, but I went ahead and added some more
unit testing and eliminated some warnings from a couple of other tests.
Note that I moved the StatusCodesTest.java file to the correct package in
the test source tree as well.
M maps/test/com/google/gwt/maps/MapsTestSuite.java
M maps/test/com/google/gwt/maps/client/impl/MinimumMapVersionTest.java
D maps/test/com/google/gwt/maps/client/StatusCodesTest.java
A maps/test/com/google/gwt/maps/client/geocode/StatusCodesTest.java
M maps/test/com/google/gwt/maps/client/MapWidgetEventsTest.java
M maps/test/com/google/gwt/maps/client/geom/BoundsTest.java
M maps/src/com/google/gwt/maps/client/geocode/StatusCodes.java
-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/test/com/google/gwt/maps/MapsTestSuite.java
M maps/test/com/google/gwt/maps/client/impl/MinimumMapVersionTest.java
D maps/test/com/google/gwt/maps/client/StatusCodesTest.java
A maps/test/com/google/gwt/maps/client/geocode/StatusCodesTest.java
M maps/test/com/google/gwt/maps/client/MapWidgetEventsTest.java
M maps/test/com/google/gwt/maps/client/geom/BoundsTest.java
M maps/src/com/google/gwt/maps/client/geocode/StatusCodes.java
Index: maps/test/com/google/gwt/maps/MapsTestSuite.java
===================================================================
--- maps/test/com/google/gwt/maps/MapsTestSuite.java (revision 865)
+++ maps/test/com/google/gwt/maps/MapsTestSuite.java (working copy)
@@ -21,7 +21,7 @@
import com.google.gwt.maps.client.MapWidgetEventsTest;
import com.google.gwt.maps.client.MapWidgetTest;
import com.google.gwt.maps.client.MapsNotInstalledTest;
-import com.google.gwt.maps.client.StatusCodesTest;
+import com.google.gwt.maps.client.geocode.StatusCodesTest;
import com.google.gwt.maps.client.control.ControlTest;
import com.google.gwt.maps.client.geocode.DirectionsTest;
import com.google.gwt.maps.client.geocode.GeocodeTest;
@@ -54,6 +54,7 @@
suite.addTestSuite(MapWidgetTest.class);
suite.addTestSuite(ControlTest.class);
suite.addTestSuite(GeocodeTest.class);
+ suite.addTestSuite(StatusCodesTest.class);
suite.addTestSuite(DirectionsTest.class);
suite.addTestSuite(InfoWindowEventsTest.class);
suite.addTestSuite(MarkerEventsTest.class);
@@ -66,7 +67,6 @@
suite.addTestSuite(PolygonTest.class);
suite.addTestSuite(PolylineTest.class);
suite.addTestSuite(CopyrightEventTest.class);
- suite.addTestSuite(StatusCodesTest.class);
suite.addTestSuite(LatLngTest.class);
suite.addTestSuite(LatLngBoundsTest.class);
suite.addTestSuite(ProjectionTest.class);
Index: maps/test/com/google/gwt/maps/client/impl/MinimumMapVersionTest.java
===================================================================
--- maps/test/com/google/gwt/maps/client/impl/MinimumMapVersionTest.java (revision 865)
+++ maps/test/com/google/gwt/maps/client/impl/MinimumMapVersionTest.java (working copy)
@@ -95,12 +95,14 @@
}
public void testConcreteOverlayImpl() {
+ @SuppressWarnings("unused")
ConcreteOverlay concreteOverlay = new ConcreteOverlay(
nativeMakeConcreteOverlay());
}
public void testControl() {
ControlPosition pos = new ControlPosition(ControlAnchor.BOTTOM_LEFT, 0, 0);
+ @SuppressWarnings("unused")
CustomControl c = new CustomControl(pos) {
@Override
@@ -135,10 +137,12 @@
return result;
}
}
+ @SuppressWarnings("unused")
MyGeocodeCache customGc = new MyGeocodeCache();
}
public void testMapImpl() {
+ @SuppressWarnings("unused")
MapWidget w = new MapWidget();
}
@@ -146,15 +150,18 @@
initTileLayer();
TileLayer[] layers = new TileLayer[1];
layers[0] = tileLayer;
+ @SuppressWarnings("unused")
MapType t = new MapType(layers, new MercatorProjection(1),
"versionTestLayer");
}
public void testMercatorProjection() {
+ @SuppressWarnings("unused")
MercatorProjection m = new MercatorProjection(2);
}
public void testOverlayImpl() {
+ @SuppressWarnings("unused")
Overlay o = new Overlay() {
@Override
@@ -179,6 +186,7 @@
public void testProjection() {
initTileLayer();
+ @SuppressWarnings("unused")
Projection projection = new Projection() {
@Override
@@ -206,6 +214,7 @@
public void testTileLayerOverlay() {
initTileLayer();
+ @SuppressWarnings("unused")
TileLayerOverlay overlay = new TileLayerOverlay(tileLayer);
}
Index: maps/test/com/google/gwt/maps/client/StatusCodesTest.java
===================================================================
--- maps/test/com/google/gwt/maps/client/StatusCodesTest.java (revision 865)
+++ maps/test/com/google/gwt/maps/client/StatusCodesTest.java (working copy)
@@ -1,42 +0,0 @@
-/*
- * Copyright 2008 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.google.gwt.maps.client;
-
-import com.google.gwt.junit.client.GWTTestCase;
-import com.google.gwt.maps.client.geocode.StatusCodes;
-
-/**
- * Tests the StatusCode class.
- *
- */
-public class StatusCodesTest extends GWTTestCase {
-
- @Override
- public String getModuleName() {
- return "com.google.gwt.maps.GoogleMapsTest";
- }
-
- public void testStatusCodeValues() {
- assertEquals(StatusCodes.BAD_KEY, 610);
- assertEquals(StatusCodes.BAD_REQUEST, 400);
- assertEquals(StatusCodes.MISSING_ADDRESS, 601);
- assertEquals(StatusCodes.MISSING_QUERY, 601);
- assertEquals(StatusCodes.SERVER_ERROR, 500);
- assertEquals(StatusCodes.SUCCESS, 200);
- assertEquals(StatusCodes.UNAVAILABLE_ADDRESS, 603);
- assertEquals(StatusCodes.UNKNOWN_ADDRESS, 602);
- }
-}
Index: maps/test/com/google/gwt/maps/client/geocode/StatusCodesTest.java
===================================================================
--- maps/test/com/google/gwt/maps/client/geocode/StatusCodesTest.java (revision 0)
+++ maps/test/com/google/gwt/maps/client/geocode/StatusCodesTest.java (revision 0)
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.maps.client.geocode;
+
+import com.google.gwt.junit.client.GWTTestCase;
+
+/**
+ * Tests for the StatusCode class.
+ */
+public class StatusCodesTest extends GWTTestCase {
+
+ @Override
+ public String getModuleName() {
+ return "com.google.gwt.maps.GoogleMapsTest";
+ }
+
+ public void testGetNameByConstant() {
+ assertEquals(StatusCodes.getName(StatusCodes.BAD_KEY), "BAD_KEY");
+ assertEquals(StatusCodes.getName(StatusCodes.BAD_REQUEST), "BAD_REQUEST");
+ assertEquals(StatusCodes.getName(StatusCodes.MISSING_ADDRESS),
+ "MISSING_ADDRESS");
+ // Synonym for Missing Address
+ assertEquals(StatusCodes.getName(StatusCodes.MISSING_QUERY),
+ "MISSING_ADDRESS");
+ assertEquals(StatusCodes.getName(StatusCodes.SERVER_ERROR), "SERVER_ERROR");
+ assertEquals(StatusCodes.getName(StatusCodes.SUCCESS), "SUCCESS");
+ assertEquals(StatusCodes.getName(StatusCodes.TOO_MANY_QUERIES),
+ "TOO_MANY_QUERIES");
+ assertEquals(StatusCodes.getName(StatusCodes.UNAVAILABLE_ADDRESS),
+ "UNAVAILABLE_ADDRESS");
+ assertEquals(StatusCodes.getName(StatusCodes.UNKNOWN_ADDRESS),
+ "UNKNOWN_ADDRESS");
+ assertEquals(StatusCodes.getName(StatusCodes.UNKNOWN_DIRECTIONS),
+ "UNKNOWN_DIRECTIONS");
+ }
+
+ public void testGetNameByNumber() {
+ assertEquals(StatusCodes.getName(200), "SUCCESS");
+ assertEquals(StatusCodes.getName(400), "BAD_REQUEST");
+ assertEquals(StatusCodes.getName(500), "SERVER_ERROR");
+ assertEquals(StatusCodes.getName(601), "MISSING_ADDRESS");
+ assertEquals(StatusCodes.getName(602), "UNKNOWN_ADDRESS");
+ assertEquals(StatusCodes.getName(603), "UNAVAILABLE_ADDRESS");
+ assertEquals(StatusCodes.getName(604), "UNKNOWN_DIRECTIONS");
+ assertEquals(StatusCodes.getName(610), "BAD_KEY");
+ assertEquals(StatusCodes.getName(620), "TOO_MANY_QUERIES");
+ assertEquals(StatusCodes.getName(123), "UNKNOWN_STATUS: 123");
+ }
+
+ public void testStatusCodeValues() {
+
+ assertEquals(StatusCodes.SUCCESS, 200);
+ assertEquals(StatusCodes.BAD_REQUEST, 400);
+ assertEquals(StatusCodes.SERVER_ERROR, 500);
+ assertEquals(StatusCodes.MISSING_ADDRESS, 601);
+ assertEquals(StatusCodes.MISSING_QUERY, 601);
+ assertEquals(StatusCodes.UNKNOWN_ADDRESS, 602);
+ assertEquals(StatusCodes.UNAVAILABLE_ADDRESS, 603);
+ assertEquals(StatusCodes.UNKNOWN_DIRECTIONS, 604);
+ assertEquals(StatusCodes.BAD_KEY, 610);
+ assertEquals(StatusCodes.TOO_MANY_QUERIES, 620);
+ }
+}
Property changes on: maps/test/com/google/gwt/maps/client/geocode/StatusCodesTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Author Id Revision HeadURL
Name: svn:eol-style
+ native
Index: maps/test/com/google/gwt/maps/client/MapWidgetEventsTest.java
===================================================================
--- maps/test/com/google/gwt/maps/client/MapWidgetEventsTest.java (revision 865)
+++ maps/test/com/google/gwt/maps/client/MapWidgetEventsTest.java (working copy)
@@ -347,6 +347,8 @@
Marker marker = (Marker) o;
assertTrue(marker.getPoint().getLatitude() == 12.34);
assertTrue(marker.getPoint().getLongitude() == -22.2);
+ assertTrue(marker.getLatLng().getLatitude() == 12.34);
+ assertTrue(marker.getLatLng().getLongitude() == -22.2);
assertNotNull("point is null", p);
assertTrue(p.getLatitude() == 10.1);
assertTrue(p.getLongitude() == 12.2);
Index: maps/test/com/google/gwt/maps/client/geom/BoundsTest.java
===================================================================
--- maps/test/com/google/gwt/maps/client/geom/BoundsTest.java (revision 865)
+++ maps/test/com/google/gwt/maps/client/geom/BoundsTest.java (working copy)
@@ -78,6 +78,7 @@
}
public void testNewInstance() {
+ @SuppressWarnings("unused")
Bounds b = Bounds.newInstance(0,0,45,45);
}
@@ -86,6 +87,7 @@
JsArray<Point> points = (JsArray<Point>) Point.createArray();
points.set(0, Point.newInstance(0, 0));
points.set(1, Point.newInstance(45, 45));
+ @SuppressWarnings("unused")
Bounds b = Bounds.newInstance(points);
}
}
Index: maps/src/com/google/gwt/maps/client/geocode/StatusCodes.java
===================================================================
--- maps/src/com/google/gwt/maps/client/geocode/StatusCodes.java (revision 865)
+++ maps/src/com/google/gwt/maps/client/geocode/StatusCodes.java (working copy)
@@ -113,6 +113,8 @@
return "UNKNOWN_ADDRESS";
} else if (statusCode == UNKNOWN_DIRECTIONS) {
return "UNKNOWN_DIRECTIONS";
+ } else if (statusCode == TOO_MANY_QUERIES) {
+ return "TOO_MANY_QUERIES";
} else {
return "UNKNOWN_STATUS: " + statusCode;
}