Changeset 18683 in josm for trunk/test
- Timestamp:
- 2023-03-06T23:28:55+01:00 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetsTest.java
r17275 r18683 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.tagging.presets; 3 4 import static org.junit.jupiter.api.Assertions.assertAll; 5 import static org.junit.jupiter.api.Assertions.assertSame; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 3 7 4 8 import java.util.Collection; … … 8 12 import java.util.concurrent.TimeoutException; 9 13 10 import org.junit.jupiter.api.Test; 11 import org.junit.jupiter.api.extension.RegisterExtension; 12 import org.openstreetmap.josm.testutils.JOSMTestRules; 13 import org.openstreetmap.josm.tools.Logging; 14 import javax.swing.JMenu; 15 import javax.swing.JSeparator; 14 16 15 17 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 16 18 import net.trajano.commons.testing.UtilityClassTestUtil; 19 import org.junit.jupiter.api.Test; 20 import org.junit.jupiter.api.extension.RegisterExtension; 21 import org.junit.jupiter.params.ParameterizedTest; 22 import org.junit.jupiter.params.provider.ValueSource; 23 import org.openstreetmap.josm.actions.PreferencesAction; 24 import org.openstreetmap.josm.gui.MainApplication; 25 import org.openstreetmap.josm.gui.MainMenu; 26 import org.openstreetmap.josm.testutils.JOSMTestRules; 27 import org.openstreetmap.josm.tools.Logging; 17 28 18 29 /** … … 26 37 @RegisterExtension 27 38 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 28 public JOSMTestRules test = new JOSMTestRules(); 39 public JOSMTestRules test = new JOSMTestRules().main(); 29 40 30 41 /** … … 35 46 void testUtilityClass() throws ReflectiveOperationException { 36 47 UtilityClassTestUtil.assertUtilityClassWellDefined(TaggingPresets.class); 48 } 49 50 /** 51 * Ensure that sorting the menu does <em>not</em> change the order of the first 3 actions. 52 * See {@link TaggingPresetMenu.PresetTextComparator} for the comparator to fix if this test 53 * fails <i>after</i> adding a new menu item. 54 */ 55 @ParameterizedTest 56 @ValueSource(booleans = {true, false}) 57 void testNonRegression22783(boolean sort) { 58 final MainMenu menu = MainApplication.getMenu(); 59 TaggingPresets.SORT_MENU.put(sort); 60 TaggingPresets.initialize(); 61 final JMenu presetsMenu = menu.presetsMenu; 62 assertAll(() -> assertSame(menu.presetSearchAction, presetsMenu.getItem(0).getAction()), 63 () -> assertSame(menu.presetSearchPrimitiveAction, presetsMenu.getItem(1).getAction()), 64 () -> assertTrue(presetsMenu.getItem(2).getAction() instanceof PreferencesAction), 65 () -> assertTrue(presetsMenu.getMenuComponent(3) instanceof JSeparator)); 37 66 } 38 67
Note:
See TracChangeset
for help on using the changeset viewer.