protected void testZoomInPoint(int vx, int vy) { Point position1 = geoMapPositioned.getMapPosition(); int zoom = geoMapPositioned.getZoom(); geoMapBot.zoomIn(vx, vy); testMapPositionZoom( position1, zoom, geoMapPositioned.getMapPosition(), geoMapPositioned.getZoom(), vx, vy); }
@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); }
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); }