Exemplo n.º 1
0
 @Test
 public void testCenter() {
   Point mapPosition = geoMapPositioned.getMapPosition();
   int dx = 10, dy = 20;
   geoMapBot.center(dx, dy);
   assertEquals(new Point(mapPosition.x + dx, mapPosition.y + dy), geoMap.getCenterPosition());
 }
Exemplo n.º 2
0
 @Test
 public void testZoomOut() {
   Point position = geoMapPositioned.getMapPosition(), size = geoMap.getSize();
   int zoom = geoMapPositioned.getZoom();
   int vx = size.x / 2, vy = size.y / 2;
   geoMapBot.zoomOut(size.x / 2, size.y / 2);
   // check zoom level
   assertEquals(zoom - 1, geoMapPositioned.getZoom());
   // check map position
   testMapPositionZoom(
       geoMapPositioned.getMapPosition(), geoMapPositioned.getZoom(), position, zoom, vx, vy);
 }
Exemplo n.º 3
0
 protected void testZoomInRectangle(int x1, int y1, int x2, int y2) {
   Point position1 = geoMapPositioned.getMapPosition(), size = geoMap.getSize();
   int zoom = geoMapPositioned.getZoom();
   geoMapBot.zoomIn(x1, y1, x2, y2);
   // check zoom level
   assertEquals(zoom + 1, geoMapPositioned.getZoom());
   // check map position
   Point position2 = geoMapPositioned.getMapPosition();
   // the center of the rectangle
   Point center1 = new Point(position1.x + (x1 + x2) / 2, position1.y + (y1 + y2) / 2);
   // the center of the new viewport (divided by the zoom factor)
   Point center2 = new Point((position2.x + size.x / 2) / 2, (position2.y + size.y / 2) / 2);
   assertEquals(center1, center2);
 }
Exemplo n.º 4
0
 @Test
 public void testZoomInRectangle() {
   Point size = geoMap.getSize();
   testZoomInRectangle(size.x / 4 + 5, size.y / 4 + 5, size.x * 3 / 4 - 5, size.y * 3 / 4 - 5);
 }
Exemplo n.º 5
0
 @Test
 public void testZoomInPoint() {
   Point size = geoMap.getSize();
   testZoomInPoint(size.x / 2, size.y / 2);
 }