Index: trunk/test/unit/org/openstreetmap/josm/gui/MapViewStateTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/MapViewStateTest.java	(revision 10373)
+++ trunk/test/unit/org/openstreetmap/josm/gui/MapViewStateTest.java	(revision 10375)
@@ -3,6 +3,4 @@
 
 import static org.junit.Assert.assertEquals;
-
-import java.awt.Rectangle;
 
 import org.junit.Before;
@@ -14,5 +12,4 @@
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.gui.MapViewState.MapViewPoint;
-import org.openstreetmap.josm.gui.util.GuiHelper;
 
 /**
@@ -22,7 +19,6 @@
 public class MapViewStateTest {
 
+    private static final int WIDTH = 300;
     private static final int HEIGHT = 200;
-    private static final int WIDTH = 300;
-    private NavigatableComponent component;
     private MapViewState state;
 
@@ -36,17 +32,9 @@
 
     /**
-     * Create a new, fresh {@link NavigatableComponent}
+     * Create the default state.
      */
     @Before
     public void setUp() {
-        component = new NavigatableComponent();
-        component.setBounds(new Rectangle(WIDTH, HEIGHT));
-        // wait for the event to be propagated.
-        GuiHelper.runInEDTAndWait(new Runnable() {
-            @Override
-            public void run() {
-            }
-        });
-        state = new MapViewState(component);
+        state = MapViewState.createDefaultState(WIDTH, HEIGHT);
     }
 
@@ -59,5 +47,5 @@
         assertHasViewCoords(WIDTH / 2, HEIGHT / 2, center);
 
-        component.zoomTo(new LatLon(3, 4));
+        MapViewState newState = state.movedTo(center, new EastNorth(3, 4));
 
         // state should not change, but new state should.
@@ -65,7 +53,7 @@
         assertHasViewCoords(WIDTH / 2, HEIGHT / 2, center);
 
-        center = new MapViewState(component).getCenter();
-        assertEquals("x", 3, center.getLatLon().lat(), 0.01);
-        assertEquals("y", 4, center.getLatLon().lon(), 0.01);
+        center = newState.getCenter();
+        assertEquals("east", 3, center.getEastNorth().east(), 0.01);
+        assertEquals("north", 4, center.getEastNorth().north(), 0.01);
     }
 
@@ -109,16 +97,17 @@
     @Test
     public void testPointConversions() {
-        MapViewPoint p = state.getForView(50, 70);
-        assertHasViewCoords(50, 70, p);
+        MapViewPoint p = state.getForView(WIDTH / 2, HEIGHT / 2);
+        assertHasViewCoords(WIDTH / 2, HEIGHT / 2, p);
+
 
         EastNorth eastnorth = p.getEastNorth();
-        EastNorth shouldEastNorth = component.getEastNorth(50, 70);
+        LatLon shouldLatLon = Main.getProjection().getWorldBoundsLatLon().getCenter();
+        EastNorth shouldEastNorth = Main.getProjection().latlon2eastNorth(shouldLatLon);
         assertEquals("east", shouldEastNorth.east(), eastnorth.east(), 0.01);
         assertEquals("north", shouldEastNorth.north(), eastnorth.north(), 0.01);
         MapViewPoint reversed = state.getPointFor(shouldEastNorth);
-        assertHasViewCoords(50, 70, reversed);
+        assertHasViewCoords(WIDTH / 2, HEIGHT / 2, reversed);
 
         LatLon latlon = p.getLatLon();
-        LatLon shouldLatLon = Main.getProjection().eastNorth2latlon(shouldEastNorth);
         assertEquals("lat", shouldLatLon.lat(), latlon.lat(), 0.01);
         assertEquals("lon", shouldLatLon.lon(), latlon.lon(), 0.01);
Index: trunk/test/unit/org/openstreetmap/josm/gui/NavigatableComponentTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/NavigatableComponentTest.java	(revision 10373)
+++ trunk/test/unit/org/openstreetmap/josm/gui/NavigatableComponentTest.java	(revision 10375)
@@ -5,6 +5,9 @@
 import static org.junit.Assert.assertThat;
 
+import java.awt.Point;
 import java.awt.Rectangle;
 import java.awt.geom.Point2D;
+
+import javax.swing.JFrame;
 
 import org.CustomMatchers;
@@ -44,5 +47,10 @@
     @Before
     public void setUp() {
-        component = new NavigatableComponent();
+        component = new NavigatableComponent() {
+            @Override
+            public Point getLocationOnScreen() {
+                return new Point(30, 40);
+            }
+        };
         component.setBounds(new Rectangle(WIDTH, HEIGHT));
         // wait for the event to be propagated.
@@ -52,4 +60,8 @@
             }
         });
+        component.setVisible(true);
+        JFrame window = new JFrame();
+        window.add(component);
+        component.updateLocationState();
     }
 
