Opened 8 years ago

Closed 8 years ago

#12937 closed enhancement (fixed)

Use the new LayerChangeListener

Reported by: michael2402 Owned by: team
Priority: normal Milestone: 16.06
Component: Core Version:
Keywords: gsoc-core Cc: Don-vip, bastiK, stoecker


Uses the new LayerChangeListener of the LayerManager. Most of it is a simple replacement.

New things:

  • ValidatorDialog is now explicitly tied to the edit layer (and not to the last active data layer). They should be the same.
  • I removed the runInEDT code - the whole event is handled in EDT.
  • Image offset menu is updated if layer oder is changed.
  • Buttons of ProperiesDialog were destroyed twice (once when layout was destroyed, once explicitly.)

Attachments (1)

patch-layer-manager-migrate-layer-change.patch (64.3 KB ) - added by michael2402 8 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 by Don-vip, 8 years ago

Resolution: fixed
Status: newclosed

In 10345/josm:

fix #12937 - Use the new LayerChangeListener (patch by michael2402) - gsoc-core

comment:2 by Don-vip, 8 years ago

Resolution: fixed
Status: closedreopened

comment:3 by Don-vip, 8 years ago

Summary: [Patch] Use the new LayerChangeListenerUse the new LayerChangeListener

comment:4 by michael2402, 8 years ago

I did only run the tests from eclipse - they work there. I can reproduce the issue when running them from the console.

The problem is that JOSM has a lot of global state. This state is not reset entirely when creating the JOSMFixture. So many actions of the test class that was run previously are used again.

I suggest setting the forkmode to perTest for now. It makes tests run longer but every test starts with a clean state. We can switch back to forkmode="once" after we fixed the global state problems. This may take some time, because there are many places where global state is involved.

Mind that this will extremely increase the time tests need to run (takes ~ 10 times as long as it did)

Last edited 8 years ago by michael2402 (previous) (diff)

comment:5 by Don-vip, 8 years ago

The tests already take a lot of time, I'd prefer to fix the problems rather than change the fork method. It's OK if it takes a few days :)

comment:6 by michael2402, 8 years ago

The main Problem I see with the tests is that they all depend on the JOSM main application. Most of them only need to have Main.pref!=null.

Since I deplayed the bug report dialog until after Java 1.8, I'm planing to do some more work on Main() the next weeks and see if I can change it in a way that allows you to run tests without loading all of JOSM. We currently have a code coverage of ~14% for running a simple test case that creates a gpx layer.

comment:7 by michael2402, 8 years ago

I started to fix the problem in #12949 - Controlling the test environment more allows us to see which parts of JOSM we need to reset. I'll add more code for the UI later, then this issue should be fixed.

comment:8 by michael2402, 8 years ago

The test failures are fixed now.

There are still the following failures:

  •, fix: #13071
  • org.openstreetmap.josm.gui.MapScalerTest.testMapScaler, assumes map to be scaled at 10:1, but it is not.
  • org.openstreetmap.josm.gui.dialogs.InspectPrimitiveDialogTest.testBuildMapPaintText, assumes map to be scaled at 10:1, but it is not.
  •, still tracing that one down, seems to be one of the previous tests...
  • org.openstreetmap.josm.plugins.PluginHandlerTestIT.testValidityOfAvailablePlugins, plugin issue

comment:9 by Don-vip, 8 years ago

Resolution: fixed
Status: reopenedclosed

All tests are fixed, thank you :)

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.