Ignore:
Timestamp:
2020-10-29T00:51:28+01:00 (3 years ago)
Author:
Don-vip
Message:

see #16567 - revert r17275 for CycleLayerActionTest / MinimapDialogTest

They depend on fakeImagery, which does not work yet with JUnit 5

Location:
trunk/test/unit/org/openstreetmap/josm/gui/dialogs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/MinimapDialogTest.java

    r17275 r17279  
    33
    44import static java.util.concurrent.TimeUnit.MILLISECONDS;
    5 import static org.junit.jupiter.api.Assertions.fail;
    6 import static org.junit.jupiter.api.Assertions.assertArrayEquals;
    7 import static org.junit.jupiter.api.Assertions.assertEquals;
    8 import static org.junit.jupiter.api.Assertions.assertFalse;
    9 import static org.junit.jupiter.api.Assertions.assertTrue;
     5import static org.junit.Assert.assertArrayEquals;
     6import static org.junit.Assert.assertEquals;
     7import static org.junit.Assert.assertFalse;
     8import static org.junit.Assert.assertTrue;
     9import static org.junit.Assert.fail;
    1010import static org.openstreetmap.josm.tools.I18n.tr;
    1111
     
    2828
    2929import org.awaitility.Awaitility;
    30 import org.junit.jupiter.api.Test;
    31 import org.junit.jupiter.api.extension.RegisterExtension;
     30import org.junit.Rule;
     31import org.junit.Test;
    3232import org.openstreetmap.josm.TestUtils;
    3333import org.openstreetmap.josm.data.Bounds;
     
    5555 * Unit tests of {@link MinimapDialog} class.
    5656 */
    57 class MinimapDialogTest {
     57public class MinimapDialogTest {
    5858
    5959    /**
    6060     * Setup tests
    6161     */
    62     @RegisterExtension
     62    @Rule
    6363    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    6464    public JOSMTestRules josmTestRules = new JOSMTestRules().main().projection().fakeImagery();
     
    6868     */
    6969    @Test
    70     void testMinimapDialog() {
     70    public void testMinimapDialog() {
    7171        MinimapDialog dlg = new MinimapDialog();
    7272        dlg.showDialog();
     
    102102                assertEquals(equalText, isSelected);
    103103                if (equalText) {
    104                     assertFalse(found, "Second selected source found");
     104                    assertFalse("Second selected source found", found);
    105105                    found = true;
    106106                }
    107107            }
    108108        }
    109         assertTrue(found, "Selected source not found in menu");
     109        assertTrue("Selected source not found in menu", found);
    110110    }
    111111
     
    199199     */
    200200    @Test
    201     void testSourceSwitching() throws Exception {
     201    public void testSourceSwitching() throws Exception {
    202202        // relevant prefs starting out empty, should choose the first source and have shown download area enabled
    203203        // (not that there's a data layer for it to use)
     
    246246     */
    247247    @Test
    248     void testRefreshSourcesRetainsSelection() throws Exception {
     248    public void testRefreshSourcesRetainsSelection() throws Exception {
    249249        // relevant prefs starting out empty, should choose the first source and have shown download area enabled
    250250        // (not that there's a data layer for it to use)
     
    284284     */
    285285    @Test
    286     void testRemovedSourceStillSelected() throws Exception {
     286    public void testRemovedSourceStillSelected() throws Exception {
    287287        // relevant prefs starting out empty, should choose the first source and have shown download area enabled
    288288        // (not that there's a data layer for it to use)
     
    317317     */
    318318    @Test
    319     void testTileSourcesFromCurrentLayers() throws Exception {
     319    public void testTileSourcesFromCurrentLayers() throws Exception {
    320320        // relevant prefs starting out empty, should choose the first (ImageryLayerInfo) source and have shown download area enabled
    321321        // (not that there's a data layer for it to use)
     
    451451     */
    452452    @Test
    453     void testSourcePrefObeyed() throws Exception {
     453    public void testSourcePrefObeyed() throws Exception {
    454454        Config.getPref().put("slippy_map_chooser.mapstyle", "Green Tiles");
    455455
     
    478478     */
    479479    @Test
    480     void testSourcePrefInvalid() throws Exception {
     480    public void testSourcePrefInvalid() throws Exception {
    481481        Config.getPref().put("slippy_map_chooser.mapstyle", "Hooloovoo Tiles");
    482482
     
    500500     */
    501501    @Test
    502     void testViewportAspectRatio() throws Exception {
     502    public void testViewportAspectRatio() throws Exception {
    503503        // Add a test layer to the layer manager to get the MapFrame & MapView
    504504        MainApplication.getLayerManager().addLayer(new TestLayer());
     
    546546        // should equal the number on the right
    547547        assertTrue(
    548             Math.abs(rowMatcher.group(1).length() - rowMatcher.group(3).length()) < 4,
    549             "Viewport marker not horizontally centered"
     548            "Viewport marker not horizontally centered",
     549            Math.abs(rowMatcher.group(1).length() - rowMatcher.group(3).length()) < 4
    550550        );
    551551
     
    561561        // should equal the number on the bottom
    562562        assertTrue(
    563             Math.abs(colMatcher.group(1).length() - colMatcher.group(3).length()) < 4,
    564             "Viewport marker not vertically centered"
     563            "Viewport marker not vertically centered",
     564            Math.abs(colMatcher.group(1).length() - colMatcher.group(3).length()) < 4
    565565        );
    566566
    567567        // (within a tolerance for numerical error) the viewport marker should be square
    568568        assertTrue(
    569             Math.abs(colMatcher.group(2).length() - rowMatcher.group(2).length()) < 4,
    570             "Viewport marker not square"
     569            "Viewport marker not square",
     570            Math.abs(colMatcher.group(2).length() - rowMatcher.group(2).length()) < 4
    571571        );
    572572
     
    591591        );
    592592        assertTrue(
    593             Math.abs(rowMatcher.group(1).length() - rowMatcher.group(3).length()) < 4,
    594             "Viewport marker not horizontally centered"
     593            "Viewport marker not horizontally centered",
     594            Math.abs(rowMatcher.group(1).length() - rowMatcher.group(3).length()) < 4
    595595        );
    596596
     
    603603        );
    604604        assertTrue(
    605             Math.abs(colMatcher.group(1).length() - colMatcher.group(3).length()) < 4,
    606             "Viewport marker not vertically centered"
     605            "Viewport marker not vertically centered",
     606            Math.abs(colMatcher.group(1).length() - colMatcher.group(3).length()) < 4
    607607        );
    608608
     
    614614
    615615        assertTrue(
    616             Math.abs(colMatcher.group(2).length() - (rowMatcher.group(2).length()*2.0)) < 5,
    617             "Viewport marker not 2:1 aspect ratio"
     616            "Viewport marker not 2:1 aspect ratio",
     617            Math.abs(colMatcher.group(2).length() - (rowMatcher.group(2).length()*2.0)) < 5
    618618        );
    619619    }
     
    624624        for (Component c: menu.getComponents()) {
    625625            if (JPopupMenu.Separator.class.isInstance(c)) {
    626                 assertFalse(afterSeparator, "More than one separator before target item");
     626                assertFalse("More than one separator before target item", afterSeparator);
    627627                afterSeparator = true;
    628628            } else if (((JMenuItem) c).getText().equals(tr("Show downloaded area"))) {
    629                 assertTrue(afterSeparator, "Separator not found before target item");
    630                 assertTrue(JCheckBoxMenuItem.class.isInstance(c), "Target item doesn't appear to be a JCheckBoxMenuItem");
     629                assertTrue("Separator not found before target item", afterSeparator);
     630                assertTrue("Target item doesn't appear to be a JCheckBoxMenuItem", JCheckBoxMenuItem.class.isInstance(c));
    631631                return (JCheckBoxMenuItem) c;
    632632            }
     
    641641     */
    642642    @Test
    643     void testShowDownloadedArea() throws Exception {
     643    public void testShowDownloadedArea() throws Exception {
    644644        Config.getPref().put("slippy_map_chooser.mapstyle", "Green Tiles");
    645645        Config.getPref().putBoolean("slippy_map_chooser.show_downloaded_area", false);
     
    800800     */
    801801    @Test
    802     void testShowDownloadedAreaLayerSwitching() throws Exception {
     802    public void testShowDownloadedAreaLayerSwitching() throws Exception {
    803803        Config.getPref().put("slippy_map_chooser.mapstyle", "Green Tiles");
    804804        Config.getPref().putBoolean("slippy_map_chooser.show_downloaded_area", true);
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/layer/CycleLayerActionTest.java

    r17275 r17279  
    22package org.openstreetmap.josm.gui.dialogs.layer;
    33
    4 import static org.junit.jupiter.api.Assertions.assertEquals;
     4import static org.junit.Assert.assertEquals;
    55import static org.openstreetmap.josm.tools.I18n.tr;
    66
    7 import org.junit.jupiter.api.BeforeEach;
    8 import org.junit.jupiter.api.Test;
    9 import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.Before;
     8import org.junit.Rule;
     9import org.junit.Test;
    1010import org.openstreetmap.josm.data.imagery.ImageryInfo;
    1111import org.openstreetmap.josm.data.imagery.ImageryLayerInfo;
     
    2424 * @author Taylor Smock
    2525 */
    26 class CycleLayerActionTest {
     26public class CycleLayerActionTest {
    2727    /** Layers need a projection */
    28     @RegisterExtension
     28    @Rule
    2929    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3030    public JOSMTestRules test = new JOSMTestRules().main().preferences().projection().fakeImagery();
     
    3737     * Set up common items (make layers, etc.)
    3838     */
    39     @BeforeEach
     39    @Before
    4040    public void setUp() {
    4141        cycleDown = new CycleLayerDownAction();
     
    5151     */
    5252    @Test
    53     void testDownBottom() {
     53    public void testDownBottom() {
    5454        manager.setActiveLayer(manager.getLayers().get(0));
    5555        cycleDown.actionPerformed(null);
     
    6161     */
    6262    @Test
    63     void testUpTop() {
     63    public void testUpTop() {
    6464        manager.setActiveLayer(manager.getLayers().get(manager.getLayers().size() - 1));
    6565        cycleUp.actionPerformed(null);
     
    7171     */
    7272    @Test
    73     void testDown() {
     73    public void testDown() {
    7474        manager.setActiveLayer(manager.getLayers().get(3));
    7575        cycleDown.actionPerformed(null);
     
    8181     */
    8282    @Test
    83     void testUp() {
     83    public void testUp() {
    8484        manager.setActiveLayer(manager.getLayers().get(3));
    8585        cycleUp.actionPerformed(null);
     
    9191     */
    9292    @Test
    93     void testNoLayers() {
     93    public void testNoLayers() {
    9494        manager.getLayers().forEach(manager::removeLayer);
    9595        cycleUp.actionPerformed(null);
     
    102102     */
    103103    @Test
    104     void testWithAerialImagery() {
     104    public void testWithAerialImagery() {
    105105        final ImageryInfo magentaTilesInfo = ImageryLayerInfo.instance.getLayers().stream()
    106106                .filter(i -> i.getName().equals("Magenta Tiles")).findAny().get();
Note: See TracChangeset for help on using the changeset viewer.