Changeset 36065 in osm


Ignore:
Timestamp:
2023-03-22T15:57:34+01:00 (20 months ago)
Author:
taylor.smock
Message:

Streetside: Fix or disable various tests

Location:
applications/editors/josm/plugins/MicrosoftStreetside
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/StreetsidePlugin.java

    r34773 r36065  
    3636  private static final StreetsideWalkAction WALK_ACTION = new StreetsideWalkAction();
    3737
    38   static {
    39       MainMenu.add(MainApplication.getMenu().fileMenu, new StreetsideExportAction(), false, 14);
    40       MainMenu.add(MainApplication.getMenu().imagerySubMenu, new StreetsideDownloadAction(), false);
    41       MainMenu.add(MainApplication.getMenu().viewMenu, ZOOM_ACTION, false, 15);
    42       MainMenu.add(MainApplication.getMenu().fileMenu, new StreetsideDownloadViewAction(), false, 14);
    43       MainMenu.add(MainApplication.getMenu().moreToolsMenu, WALK_ACTION, false);
    44   }
    45 
    4638  /**
    4739   * Main constructor.
     
    5648      StreetsideUser.setTokenValid(false);
    5749    }
     50    MainMenu.add(MainApplication.getMenu().fileMenu, new StreetsideExportAction(), false, 14);
     51    MainMenu.add(MainApplication.getMenu().imagerySubMenu, new StreetsideDownloadAction(), false);
     52    MainMenu.add(MainApplication.getMenu().viewMenu, ZOOM_ACTION, false, 15);
     53    MainMenu.add(MainApplication.getMenu().fileMenu, new StreetsideDownloadViewAction(), false, 14);
     54    MainMenu.add(MainApplication.getMenu().moreToolsMenu, WALK_ACTION, false);
    5855  }
    5956
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/CubemapBuilder.java

    r34774 r36065  
    2424import org.openstreetmap.josm.plugins.streetside.gui.StreetsideViewerDialog;
    2525import org.openstreetmap.josm.plugins.streetside.gui.imageinfo.StreetsideViewerPanel;
     26import org.openstreetmap.josm.plugins.streetside.gui.imageinfo.ThreeSixtyDegreeViewerPanel;
    2627import org.openstreetmap.josm.plugins.streetside.utils.GraphicsUtils;
    2728import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties;
     
    115116
    116117        public void downloadCubemapImages(String imageId) {
    117     if(StreetsideViewerPanel.getThreeSixtyDegreeViewerPanel().getScene() != StreetsideViewerPanel.getThreeSixtyDegreeViewerPanel().getLoadingScene()) {
    118       StreetsideViewerPanel.getThreeSixtyDegreeViewerPanel().setScene(
    119               StreetsideViewerPanel.getThreeSixtyDegreeViewerPanel().getLoadingScene()
    120           );
     118      ThreeSixtyDegreeViewerPanel panel360 = StreetsideViewerPanel.getThreeSixtyDegreeViewerPanel();
     119      if (panel360 != null && panel360.getScene() != panel360.getLoadingScene()) {
     120        panel360.setScene(panel360.getLoadingScene());
    121121          }
    122122
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/StreetsideViewerPanel.java

    r34577 r36065  
    33
    44import java.awt.BorderLayout;
     5import java.awt.GraphicsEnvironment;
    56import java.text.MessageFormat;
    67
     
    5556                threeSixtyDegreeViewerPanel = new ThreeSixtyDegreeViewerPanel();
    5657
    57                 GraphicsUtils.PlatformHelper.run(() -> {
    58                 threeSixtyDegreeViewerPanel.initialize();
    59                 });
     58    if (!GraphicsEnvironment.isHeadless()) {
     59      GraphicsUtils.PlatformHelper.run(threeSixtyDegreeViewerPanel::initialize);
     60    }
    6061
    6162                add(threeSixtyDegreeViewerPanel, BorderLayout.CENTER);
  • applications/editors/josm/plugins/MicrosoftStreetside/test/unit/org/openstreetmap/josm/plugins/streetside/StreetsideDataTest.java

    r36064 r36065  
    1111
    1212import org.junit.jupiter.api.BeforeEach;
     13import org.junit.jupiter.api.Disabled;
    1314import org.junit.jupiter.api.Test;
    1415import org.junit.jupiter.api.condition.DisabledIf;
    1516import org.openstreetmap.josm.data.coor.LatLon;
     17import org.openstreetmap.josm.testutils.annotations.Main;
    1618
    1719/**
     
    2123 * @see StreetsideData
    2224 */
    23 @DisabledIf(value = "org.openstreetmap.josm.plugins.streetside.utils.TestUtil#cannotLoadImages", disabledReason = "At JOSM maintainer request (flaky?)")
     25@Main
    2426class StreetsideDataTest {
    2527
     
    9597   * Tests the selection of images.
    9698   */
     99  @Disabled("The imgs have non-int identifiers while the code expects the identifiers to be int in string form")
    97100  @Test
    98101  void testSelect() {
     
    112115   */
    113116  @Test
     117  @Disabled("The imgs have non-int identifiers while the code expects the identifiers to be int in string form")
    114118  void testNextAndPrevious() {
    115119    data.setSelectedImage(img1);
     
    125129  }
    126130
     131  @Disabled("Someone decided to not throw an IllegalStateException. No clue why.")
    127132  @Test
    128133  void testNextOfNullImg() {
     
    131136  }
    132137
     138  @Disabled("Someone decided to not throw an IllegalStateException. No clue why.")
    133139  @Test
    134140  void testPreviousOfNullImg() {
     
    141147   * multiselected List should reset.
    142148   */
     149  @Disabled("The imgs have non-int identifiers while the code expects the identifiers to be int in string form")
    143150  @Test
    144151  void testMultiSelect() {
  • applications/editors/josm/plugins/MicrosoftStreetside/test/unit/org/openstreetmap/josm/plugins/streetside/StreetsideLayerTest.java

    r36064 r36065  
    66import static org.junit.jupiter.api.Assertions.assertThrows;
    77import static org.junit.jupiter.api.Assertions.assertTrue;
     8
     9import java.awt.GraphicsEnvironment;
    810
    911import org.junit.jupiter.api.Test;
     
    2224@Main
    2325@Projection
    24 @DisabledIf(value = "org.openstreetmap.josm.plugins.streetside.utils.TestUtil#cannotLoadImages", disabledReason = "At JOSM maintainer request (flaky?)")
    2526class StreetsideLayerTest {
    2627  private static Layer getDummyLayer() {
     
    7273  }
    7374
     75  @DisabledIf(value = "java.awt.GraphicsEnvironment#isHeadless", disabledReason = "Listener for destruction is only registered in non-headless environments")
    7476  @Test
    7577  void testClearInstance() {
  • applications/editors/josm/plugins/MicrosoftStreetside/test/unit/org/openstreetmap/josm/plugins/streetside/utils/TestUtil.java

    r36064 r36065  
    1515
    1616import org.junit.runners.model.InitializationError;
    17 import org.openstreetmap.josm.plugins.streetside.StreetsidePlugin;
    18 import org.openstreetmap.josm.spi.preferences.Config;
    19 import org.openstreetmap.josm.spi.preferences.MemoryPreferences;
    2017import org.openstreetmap.josm.testutils.JOSMTestRules;
    21 import org.openstreetmap.josm.tools.ImageProvider;
    2218import org.openstreetmap.josm.tools.Logging;
    2319import org.openstreetmap.josm.tools.Utils;
     
    3026  private TestUtil() {
    3127    // Prevent instantiation
    32   }
    33 
    34   /**
    35    * Check if we can load images
    36    * @return {@code true} if the {@link StreetsidePlugin#LOGO} could be loaded
    37    */
    38   public static boolean cannotLoadImages() {
    39     // The class-level @DisabledIf seems to be run prior to any possible setup code
    40     if (Config.getPref() == null) {
    41       Config.setPreferencesInstance(new MemoryPreferences());
    42     }
    43     return new ImageProvider("streetside-logo").setOptional(true).getResource() == null;
    4428  }
    4529
Note: See TracChangeset for help on using the changeset viewer.