Changeset 9633 in josm


Ignore:
Timestamp:
2016-01-26T00:02:31+01:00 (9 years ago)
Author:
Don-vip
Message:

fix unit tests

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

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/PreferencesTestUtils.java

    r9624 r9633  
    1919     */
    2020    public static void testPreferenceSettingAddGui(PreferenceSettingFactory factory, Class<? extends DefaultTabPreferenceSetting> parentClass) {
     21        testPreferenceSettingAddGui(factory, parentClass, 1);
     22    }
     23
     24    /**
     25     * Generic test for {@link PreferenceSetting#addGui(PreferenceTabbedPane)}.
     26     * @param factory setting factory to test
     27     * @param parentClass optional parent setting, can be {@code null}
     28     * @param increment expected tab number increment
     29     */
     30    public static void testPreferenceSettingAddGui(PreferenceSettingFactory factory, Class<? extends DefaultTabPreferenceSetting> parentClass,
     31            int increment) {
    2132        PreferenceSetting setting = factory.createPreferenceSetting();
    2233        PreferenceTabbedPane tabPane = new PreferenceTabbedPane();
     
    2536        setting.addGui(tabPane);
    2637        if (parentClass != null) {
    27             assertEquals(tabs + 1, tabPane.getSetting(parentClass).getTabPane().getTabCount());
     38            assertEquals(tabs + increment, tabPane.getSetting(parentClass).getTabPane().getTabCount());
    2839            assertEquals(tabPane.getSetting(parentClass), ((SubPreferenceSetting) setting).getTabPreferenceSetting(tabPane));
    2940        }
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/display/DrawingPreferenceTest.java

    r9624 r9633  
    3535    @Test
    3636    public void testAddGui() {
    37         PreferencesTestUtils.testPreferenceSettingAddGui(new DrawingPreference.Factory(), DisplayPreference.class);
     37        PreferencesTestUtils.testPreferenceSettingAddGui(new DrawingPreference.Factory(), DisplayPreference.class, 2);
    3838    }
    3939}
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/display/LanguagePreferenceTest.java

    r9624 r9633  
    3535    @Test
    3636    public void testAddGui() {
    37         PreferencesTestUtils.testPreferenceSettingAddGui(new LanguagePreference.Factory(), DisplayPreference.class);
     37        PreferencesTestUtils.testPreferenceSettingAddGui(new LanguagePreference.Factory(), null);
    3838    }
    3939}
Note: See TracChangeset for help on using the changeset viewer.