*/
public void testSubclassProjection() {
loadApi(new Runnable() {
public void run() {
TileLayer tileLayer = initTileLayer();
MapWidget map = new MapWidget();
map.setSize("300px", "300px");
Projection projection = new Projection() {
@Override
public Point fromLatLngToPixel(LatLng latlng, int zoomLevel) {
assertNotNull(latlng);
assertTrue("zoomLevel > 0", zoomLevel > 0);
return Point.newInstance(1, 1);
}
@Override
public LatLng fromPixelToLatLng(Point point, int zoomLevel,
boolean unbounded) {
assertNotNull(point);
assertTrue("zoomLevel > 0", zoomLevel > 0);
return LatLng.newInstance(45, 45);
}
@Override
public double getWrapWidth(int zoomLevel) {
assertTrue("zoomLevel > 0", zoomLevel > 0);
return 100;
}
@Override
public boolean tileCheckRange(TileIndex index, int zoomLevel,
int tileSize) {
assertNotNull("index", index);
assertTrue("zoomLevel > 0", zoomLevel > 0);
assertTrue("tileSize > 0", tileSize > 0);
return false;
}
};
MapType mapType = new MapType(new TileLayer[] {tileLayer}, projection,
"MyMap");
map.addMapType(mapType);
RootPanel.get().add(map);
map.setCurrentMapType(mapType);
// The map gets recentered when its created and these callbacks
// may fire multiple times. Give the test some time to quiesce.
new Timer() {
public void run() {