Changeset 12637 in josm for trunk/test


Ignore:
Timestamp:
2017-08-24T23:29:01+02:00 (7 years ago)
Author:
Don-vip
Message:

see #15182 - deprecate Main.toolbar. Replacement: gui.MainApplication.getToolbar()

Location:
trunk/test/unit/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java

    r12636 r12637  
    1919import org.openstreetmap.josm.data.projection.Projections;
    2020import org.openstreetmap.josm.gui.MainApplication;
     21import org.openstreetmap.josm.gui.MainApplicationTest;
    2122import org.openstreetmap.josm.gui.MainPanel;
    2223import org.openstreetmap.josm.gui.layer.LayerManagerTest.TestLayer;
    23 import org.openstreetmap.josm.gui.preferences.ToolbarPreferences;
    2424import org.openstreetmap.josm.gui.util.GuiHelper;
    2525import org.openstreetmap.josm.io.CertificateAmendment;
     
    201201     * Make sure {@code Main.toolbar} is initialized.
    202202     */
     203    @SuppressWarnings("deprecation")
    203204    public static void initToolbar() {
     205        MainApplicationTest.initToolbar();
    204206        if (Main.toolbar == null) {
    205             Main.toolbar = new ToolbarPreferences();
     207            Main.toolbar = MainApplication.getToolbar();
    206208        }
    207209    }
  • trunk/test/unit/org/openstreetmap/josm/MainTest.java

    r12634 r12637  
    1313import java.util.Collection;
    1414import java.util.Map;
    15 
    16 import javax.swing.UIManager;
    1715
    1816import org.junit.Rule;
     
    8179        Main.preConstructorInit();
    8280        assertNotNull(Main.getProjection());
    83         assertEquals(Main.pref.get("laf", Main.platform.getDefaultStyle()), UIManager.getLookAndFeel().getClass().getCanonicalName());
    84         assertNotNull(Main.toolbar);
    8581    }
    8682
  • trunk/test/unit/org/openstreetmap/josm/gui/MainApplicationTest.java

    r12636 r12637  
    1919import java.util.concurrent.Future;
    2020
     21import javax.swing.UIManager;
     22
    2123import org.junit.Rule;
    2224import org.junit.Test;
     25import org.openstreetmap.josm.Main;
    2326import org.openstreetmap.josm.TestUtils;
    2427import org.openstreetmap.josm.data.Version;
     
    2629import org.openstreetmap.josm.gui.SplashScreen.SplashProgressMonitor;
    2730import org.openstreetmap.josm.gui.layer.GpxLayer;
     31import org.openstreetmap.josm.gui.preferences.ToolbarPreferences;
    2832import org.openstreetmap.josm.plugins.PluginHandler;
    2933import org.openstreetmap.josm.plugins.PluginHandlerTestIT;
     
    4751    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4852    public JOSMTestRules test = new JOSMTestRules().main().https().devAPI().timeout(20000);
     53
     54    /**
     55     * Make sure {@link MainApplication#toolbar} is initialized.
     56     */
     57    public static void initToolbar() {
     58        if (MainApplication.toolbar == null) {
     59            MainApplication.toolbar = new ToolbarPreferences();
     60        }
     61    }
    4962
    5063    @SuppressFBWarnings(value = "DM_DEFAULT_ENCODING")
     
    132145    }
    133146
     147    /**
     148     * Unit test of {@link MainApplication#setupUIManager}.
     149     */
     150    @Test
     151    public void testSetupUIManager() {
     152        MainApplication.setupUIManager();
     153        assertEquals(Main.pref.get("laf", Main.platform.getDefaultStyle()), UIManager.getLookAndFeel().getClass().getCanonicalName());
     154    }
     155
    134156    private static PluginInformation newPluginInformation(String plugin) throws PluginListParseException {
    135157        return PluginListParser.createInfo(plugin+".jar", "https://svn.openstreetmap.org/applications/editors/josm/dist/"+plugin+".jar",
Note: See TracChangeset for help on using the changeset viewer.