Changeset 14149 in josm for trunk/test/unit/org
- Timestamp:
- 2018-08-12T17:24:32+02:00 (6 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java
r14143 r14149 16 16 import org.openstreetmap.josm.actions.DeleteAction; 17 17 import org.openstreetmap.josm.command.DeleteCommand; 18 import org.openstreetmap.josm.data.Preferences; 18 19 import org.openstreetmap.josm.data.preferences.JosmBaseDirectories; 19 20 import org.openstreetmap.josm.data.preferences.JosmUrls; … … 104 105 System.setProperty("josm.home", josmHome); 105 106 TimeZone.setDefault(DateUtils.UTC); 106 Config.setPreferencesInstance(Main.pref); 107 Preferences pref = Preferences.main(); 108 Config.setPreferencesInstance(pref); 107 109 Config.setBaseDirectoriesProvider(JosmBaseDirectories.getInstance()); 108 110 Config.setUrlsProvider(JosmUrls.getInstance()); 109 Main.pref.resetToInitialState();110 Main.pref.enableSaveOnPut(false);111 pref.resetToInitialState(); 112 pref.enableSaveOnPut(false); 111 113 I18n.init(); 112 114 // initialize the plaform hook, and … … 115 117 116 118 Logging.setLogLevel(Logging.LEVEL_INFO); 117 Main.pref.init(false);119 pref.init(false); 118 120 String url = Config.getPref().get("osm-server.url"); 119 121 if (url == null || url.isEmpty() || isProductionApiUrl(url)) { -
trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/PluginDownloadTaskTest.java
r14052 r14149 13 13 import org.junit.Rule; 14 14 import org.junit.Test; 15 import org.openstreetmap.josm.Main;16 15 import org.openstreetmap.josm.TestUtils; 16 import org.openstreetmap.josm.data.Preferences; 17 17 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 18 18 import org.openstreetmap.josm.plugins.PluginDownloadTask; … … 62 62 new File(TestUtils.getTestDataRoot()), "__files/" + this.pluginPath 63 63 ); 64 final File pluginDir = Main.pref.getPluginsDirectory();64 final File pluginDir = Preferences.main().getPluginsDirectory(); 65 65 final File pluginFile = new File(pluginDir, "dummy_plugin.jar"); 66 66 final File pluginFileNew = new File(pluginDir, "dummy_plugin.jar.new"); … … 104 104 new File(TestUtils.getTestDataRoot()), "__files/" + this.pluginPath 105 105 ); 106 final File pluginDir = Main.pref.getPluginsDirectory();106 final File pluginDir = Preferences.main().getPluginsDirectory(); 107 107 final File pluginFile = new File(pluginDir, "corrupted_plugin.jar"); 108 108 final File pluginFileNew = new File(pluginDir, "corrupted_plugin.jar.new"); -
trunk/test/unit/org/openstreetmap/josm/data/PreferencesTest.java
r14138 r14149 6 6 import org.junit.Rule; 7 7 import org.junit.Test; 8 import org.openstreetmap.josm.Main;9 8 import org.openstreetmap.josm.testutils.JOSMTestRules; 10 9 … … 33 32 " <tag key='osm-server.url' value='http://fake.xxx/api'/>%n" + 34 33 "</preferences>%n", Version.getInstance().getVersion()), 35 Main.pref.toXML(true));34 Preferences.main().toXML(true)); 36 35 } 37 36 } -
trunk/test/unit/org/openstreetmap/josm/data/preferences/NamedColorPropertyTest.java
r12989 r14149 11 11 import org.junit.Rule; 12 12 import org.junit.Test; 13 import org.openstreetmap.josm. Main;13 import org.openstreetmap.josm.data.Preferences; 14 14 import org.openstreetmap.josm.spi.preferences.Config; 15 15 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 18 18 19 19 /** 20 * Test {@link ColorProperty}20 * Test {@link NamedColorProperty} 21 21 * @author Michael Zangl 22 22 */ … … 39 39 40 40 /** 41 * Test {@link ColorProperty#get()}41 * Test {@link NamedColorProperty#get()} 42 42 */ 43 43 @Test … … 47 47 48 48 /** 49 * Test {@link ColorProperty#put}49 * Test {@link NamedColorProperty#put} 50 50 */ 51 51 @Test … … 67 67 public void testColorAlpha() { 68 68 assertEquals(0x12, new NamedColorProperty("foo", new Color(0x12345678, true)).get().getAlpha()); 69 assertTrue( Main.pref.putList("clr.general.bar", Arrays.asList("#34567812", "general", "", "bar")));69 assertTrue(Preferences.main().putList("clr.general.bar", Arrays.asList("#34567812", "general", "", "bar"))); 70 70 assertEquals(0x12, new NamedColorProperty("bar", Color.RED).get().getAlpha()); 71 71 } … … 80 80 81 81 /** 82 * Test {@link ColorProperty#getChildColor(String)}82 * Test {@link NamedColorProperty#getChildColor(String)} 83 83 */ 84 84 @Test -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/MinimapDialogTest.java
r14138 r14149 26 26 import org.junit.Rule; 27 27 import org.junit.Test; 28 import org.openstreetmap.josm.Main;29 28 import org.openstreetmap.josm.TestUtils; 30 29 import org.openstreetmap.josm.data.Bounds; … … 217 216 assertEquals(0xff00ff00, paintedSlippyMap.getRGB(0, 0)); 218 217 219 assertEquals("Green Tiles", Main.pref.get("slippy_map_chooser.mapstyle", "Fail"));218 assertEquals("Green Tiles", Config.getPref().get("slippy_map_chooser.mapstyle", "Fail")); 220 219 } 221 220 … … 244 243 this.assertSingleSelectedSourceLabel("Magenta Tiles"); 245 244 246 assertEquals("Magenta Tiles", Main.pref.get("slippy_map_chooser.mapstyle", "Fail"));245 assertEquals("Magenta Tiles", Config.getPref().get("slippy_map_chooser.mapstyle", "Fail")); 247 246 } 248 247 -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/ExportProfileActionTest.java
r14081 r14149 6 6 import org.junit.Rule; 7 7 import org.junit.Test; 8 import org.openstreetmap.josm.Main;9 8 import org.openstreetmap.josm.TestUtils; 9 import org.openstreetmap.josm.data.Preferences; 10 10 import org.openstreetmap.josm.testutils.JOSMTestRules; 11 11 import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker; … … 35 35 "All the preferences of this group are default, nothing to save", JOptionPane.OK_OPTION 36 36 )); 37 new ExportProfileAction( Main.pref, "foo", "bar").actionPerformed(null);38 new ExportProfileAction( Main.pref, "expert", "expert").actionPerformed(null);37 new ExportProfileAction(Preferences.main(), "foo", "bar").actionPerformed(null); 38 new ExportProfileAction(Preferences.main(), "expert", "expert").actionPerformed(null); 39 39 } 40 40 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceHighLevelTest.java
r14138 r14149 23 23 import org.openstreetmap.josm.Main; 24 24 import org.openstreetmap.josm.TestUtils; 25 import org.openstreetmap.josm.data.Preferences; 25 26 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 26 27 import org.openstreetmap.josm.gui.util.GuiHelper; … … 97 98 this.referenceBazJarOld = new File(TestUtils.getTestDataRoot(), "__files/plugin/baz_plugin.v6.jar"); 98 99 this.referenceBazJarNew = new File(TestUtils.getTestDataRoot(), "__files/plugin/baz_plugin.v7.jar"); 99 this.pluginDir = Main.pref.getPluginsDirectory();100 this.pluginDir = Preferences.main().getPluginsDirectory(); 100 101 this.targetDummyJar = new File(this.pluginDir, "dummy_plugin.jar"); 101 102 this.targetDummyJarNew = new File(this.pluginDir, "dummy_plugin.jar.new"); -
trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerJOSMTooOldTest.java
r14081 r14149 17 17 import org.openstreetmap.josm.Main; 18 18 import org.openstreetmap.josm.TestUtils; 19 import org.openstreetmap.josm.data.Preferences; 19 20 import org.openstreetmap.josm.spi.preferences.Config; 20 21 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 66 67 this.referenceBazJarOld = new File(TestUtils.getTestDataRoot(), "__files/plugin/baz_plugin.v6.jar"); 67 68 this.referenceBazJarNew = new File(TestUtils.getTestDataRoot(), "__files/plugin/baz_plugin.v7.jar"); 68 this.pluginDir = Main.pref.getPluginsDirectory();69 this.pluginDir = Preferences.main().getPluginsDirectory(); 69 70 this.targetDummyJar = new File(this.pluginDir, "dummy_plugin.jar"); 70 71 this.targetDummyJarNew = new File(this.pluginDir, "dummy_plugin.jar.new"); -
trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerTestIT.java
r14138 r14149 19 19 import org.junit.Rule; 20 20 import org.junit.Test; 21 import org.openstreetmap.josm. Main;21 import org.openstreetmap.josm.data.Preferences; 22 22 import org.openstreetmap.josm.data.gpx.GpxData; 23 23 import org.openstreetmap.josm.data.osm.DataSet; … … 93 93 // Download complete list of plugins 94 94 ReadRemotePluginInformationTask pluginInfoDownloadTask = new ReadRemotePluginInformationTask( 95 Main.pref.getOnlinePluginSites());95 Preferences.main().getOnlinePluginSites()); 96 96 pluginInfoDownloadTask.run(); 97 97 List<PluginInformation> plugins = pluginInfoDownloadTask.getAvailablePlugins(); -
trunk/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java
r14138 r14149 26 26 import org.openstreetmap.josm.actions.DeleteAction; 27 27 import org.openstreetmap.josm.command.DeleteCommand; 28 import org.openstreetmap.josm.data.Preferences; 28 29 import org.openstreetmap.josm.data.UserIdentityManager; 29 30 import org.openstreetmap.josm.data.Version; … … 418 419 } 419 420 420 Config.setPreferencesInstance(Main.pref); 421 Preferences pref = Preferences.main(); 422 Config.setPreferencesInstance(pref); 421 423 Config.setBaseDirectoriesProvider(JosmBaseDirectories.getInstance()); 422 424 Config.setUrlsProvider(JosmUrls.getInstance()); … … 449 451 if (usePreferences) { 450 452 @SuppressWarnings("unchecked") 451 final Map<String, Setting<?>> defaultsMap = (Map<String, Setting<?>>) TestUtils.getPrivateField( Main.pref, "defaultsMap");453 final Map<String, Setting<?>> defaultsMap = (Map<String, Setting<?>>) TestUtils.getPrivateField(pref, "defaultsMap"); 452 454 defaultsMap.clear(); 453 Main.pref.resetToInitialState();454 Main.pref.enableSaveOnPut(false);455 pref.resetToInitialState(); 456 pref.enableSaveOnPut(false); 455 457 // No pref init -> that would only create the preferences file. 456 458 // We force the use of a wrong API server, just in case anyone attempts an upload … … 543 545 MemoryManagerTest.resetState(true); 544 546 cleanLayerEnvironment(); 545 Main.pref.resetToInitialState();547 Preferences.main().resetToInitialState(); 546 548 System.gc(); 547 549 } … … 584 586 // TODO: Remove global listeners and other global state. 585 587 ProjectionRegistry.clearProjectionChangeListeners(); 586 Main.pref.resetToInitialState();588 Preferences.main().resetToInitialState(); 587 589 588 590 if (this.assumeRevisionString != null && this.originalVersion != null) {
Note:
See TracChangeset
for help on using the changeset viewer.