Index: /trunk/src/org/openstreetmap/josm/gui/layer/gpx/ChooseTrackVisibilityAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/gpx/ChooseTrackVisibilityAction.java	(revision 14336)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/gpx/ChooseTrackVisibilityAction.java	(revision 14337)
@@ -7,5 +7,4 @@
 import java.awt.Component;
 import java.awt.Dimension;
-import java.awt.GraphicsEnvironment;
 import java.awt.GridBagLayout;
 import java.awt.event.ActionEvent;
@@ -263,24 +262,22 @@
 
         int v = 1;
-        if (!GraphicsEnvironment.isHeadless()) {
-            // build dialog
-            ExtendedDialog ed = new ExtendedDialog(MainApplication.getMainFrame(), tr("Set track visibility for {0}", layer.getName()),
-                    tr("Show all"), tr("Show selected only"), tr("Cancel"));
-            ed.setButtonIcons("eye", "dialogs/filter", "cancel");
-            ed.setContent(msg, false);
-            ed.setDefaultButton(2);
-            ed.setCancelButton(3);
-            ed.configureContextsensitiveHelp("/Action/ChooseTrackVisibility", true);
-            ed.setRememberWindowGeometry(getClass().getName() + ".geometry",
-                    WindowGeometry.centerInWindow(MainApplication.getMainFrame(), new Dimension(1000, 500)));
-            ed.showDialog();
-            dateFilter.saveInPrefs();
-            v = ed.getValue();
-            // cancel for unknown buttons and copy back original settings
-            if (v != 1 && v != 2) {
-                layer.trackVisibility = Arrays.copyOf(trackVisibilityBackup, layer.trackVisibility.length);
-                MainApplication.getMap().repaint();
-                return;
-            }
+        // build dialog
+        ExtendedDialog ed = new ExtendedDialog(MainApplication.getMainFrame(), tr("Set track visibility for {0}", layer.getName()),
+                tr("Show all"), tr("Show selected only"), tr("Cancel"));
+        ed.setButtonIcons("eye", "dialogs/filter", "cancel");
+        ed.setContent(msg, false);
+        ed.setDefaultButton(2);
+        ed.setCancelButton(3);
+        ed.configureContextsensitiveHelp("/Action/ChooseTrackVisibility", true);
+        ed.setRememberWindowGeometry(getClass().getName() + ".geometry",
+                WindowGeometry.centerInWindow(MainApplication.getMainFrame(), new Dimension(1000, 500)));
+        ed.showDialog();
+        dateFilter.saveInPrefs();
+        v = ed.getValue();
+        // cancel for unknown buttons and copy back original settings
+        if (v != 1 && v != 2) {
+            layer.trackVisibility = Arrays.copyOf(trackVisibilityBackup, layer.trackVisibility.length);
+            MainApplication.getMap().repaint();
+            return;
         }
         // set visibility (1 = show all, 2 = filter). If no tracks are selected
Index: /trunk/test/unit/org/openstreetmap/josm/gui/layer/GpxLayerTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/layer/GpxLayerTest.java	(revision 14336)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/layer/GpxLayerTest.java	(revision 14337)
@@ -64,5 +64,5 @@
      */
     public static GpxLayer getMinimalGpxLayer() throws IOException, SAXException {
-        return new GpxLayer(getMinimalGpxData());
+        return new GpxLayer(getMinimalGpxData(), "Bananas");
     }
 
Index: /trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/ChooseTrackVisibilityActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/ChooseTrackVisibilityActionTest.java	(revision 14336)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/ChooseTrackVisibilityActionTest.java	(revision 14337)
@@ -2,8 +2,15 @@
 package org.openstreetmap.josm.gui.layer.gpx;
 
+import static org.junit.Assert.assertEquals;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
 import org.junit.Rule;
 import org.junit.Test;
+import org.openstreetmap.josm.gui.ExtendedDialog;
 import org.openstreetmap.josm.gui.layer.GpxLayerTest;
 import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.mockers.ExtendedDialogMocker;
 
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@@ -27,5 +34,22 @@
     @Test
     public void testAction() throws Exception {
+        final ExtendedDialogMocker edMocker = new ExtendedDialogMocker() {
+            protected String getString(final ExtendedDialog instance) {
+                return ((JLabel) ((JPanel) this.getContent(instance)).getComponent(2)).getText();
+            }
+        };
+        edMocker.getMockResultMap().put(
+            "<html>Select all tracks that you want to be displayed. You can drag select a range of " +
+            "tracks or use CTRL+Click to select specific ones. The map is updated live in the " +
+            "background. Open the URLs by double clicking them.</html>",
+            "Show all"
+        );
+
         new ChooseTrackVisibilityAction(GpxLayerTest.getMinimalGpxLayer()).actionPerformed(null);
+
+        assertEquals(1, edMocker.getInvocationLog().size());
+        Object[] invocationLogEntry = edMocker.getInvocationLog().get(0);
+        assertEquals(1, (int) invocationLogEntry[0]);
+        assertEquals("Set track visibility for Bananas", invocationLogEntry[2]);
     }
 }
