Index: trunk/test/unit/org/openstreetmap/josm/gui/MapViewStateTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/MapViewStateTest.java	(revision 10853)
+++ trunk/test/unit/org/openstreetmap/josm/gui/MapViewStateTest.java	(revision 10856)
@@ -7,4 +7,5 @@
 import java.awt.geom.Point2D;
 import java.util.Arrays;
+import java.util.function.Function;
 
 import org.junit.Before;
@@ -23,5 +24,5 @@
 public class MapViewStateTest {
 
-    private static final int WIDTH = 300;
+    private static final int WIDTH = 301;
     private static final int HEIGHT = 200;
     private MapViewState state;
@@ -43,4 +44,19 @@
     }
 
+    private void doTestGetCenter(Function<MapViewState, MapViewPoint> getter, Function<Integer, Double> divider) {
+        MapViewPoint center = getter.apply(state);
+        assertHasViewCoords(divider.apply(WIDTH), divider.apply(HEIGHT), center);
+
+        MapViewState newState = state.movedTo(center, new EastNorth(3, 4));
+
+        // state should not change, but new state should.
+        center = getter.apply(state);
+        assertHasViewCoords(divider.apply(WIDTH), divider.apply(HEIGHT), center);
+
+        center = getter.apply(newState);
+        assertEquals("east", 3, center.getEastNorth().east(), 0.01);
+        assertEquals("north", 4, center.getEastNorth().north(), 0.01);
+    }
+
     /**
      * Test {@link MapViewState#getCenter()} returns map view center.
@@ -48,19 +64,16 @@
     @Test
     public void testGetCenter() {
-        MapViewPoint center = state.getCenter();
-        assertHasViewCoords(WIDTH / 2, HEIGHT / 2, center);
-
-        MapViewState newState = state.movedTo(center, new EastNorth(3, 4));
-
-        // state should not change, but new state should.
-        center = state.getCenter();
-        assertHasViewCoords(WIDTH / 2, HEIGHT / 2, center);
-
-        center = newState.getCenter();
-        assertEquals("east", 3, center.getEastNorth().east(), 0.01);
-        assertEquals("north", 4, center.getEastNorth().north(), 0.01);
+        doTestGetCenter(s -> s.getCenter(), t -> t / 2d);
     }
 
-    private void assertHasViewCoords(double x, double y, MapViewPoint center) {
+    /**
+     * Test {@link MapViewState#getCenterAtPixel()} returns map view center.
+     */
+    @Test
+    public void testGetCenterAtPixel() {
+        doTestGetCenter(s -> s.getCenterAtPixel(), t -> (double) (t / 2));
+    }
+
+    private static void assertHasViewCoords(double x, double y, MapViewPoint center) {
         assertEquals("x", x, center.getInViewX(), 0.01);
         assertEquals("y", y, center.getInViewY(), 0.01);
@@ -101,6 +114,6 @@
     @Test
     public void testPointConversions() {
-        MapViewPoint p = state.getForView(WIDTH / 2, HEIGHT / 2);
-        assertHasViewCoords(WIDTH / 2, HEIGHT / 2, p);
+        MapViewPoint p = state.getForView(WIDTH / 2d, HEIGHT / 2d);
+        assertHasViewCoords(WIDTH / 2d, HEIGHT / 2d, p);
 
         EastNorth eastnorth = p.getEastNorth();
@@ -110,5 +123,5 @@
         assertEquals("north", shouldEastNorth.north(), eastnorth.north(), 0.01);
         MapViewPoint reversed = state.getPointFor(shouldEastNorth);
-        assertHasViewCoords(WIDTH / 2, HEIGHT / 2, reversed);
+        assertHasViewCoords(WIDTH / 2d, HEIGHT / 2d, reversed);
 
         LatLon latlon = p.getLatLon();
