Changeset 18783 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java
r18778 r18783 322 322 private synchronized boolean isConflictSelected() { 323 323 final ListSelectionModel selModel = lstConflicts.getSelectionModel(); 324 return selModel.getMinSelectionIndex() >= 0 && selModel.getMaxSelectionIndex() >= selModel.getMinSelectionIndex(); 324 final int minSelectionIndex = selModel.getMinSelectionIndex(); 325 final int maxSelectionIndex = selModel.getMaxSelectionIndex(); 326 final int maxIndex = conflicts.size(); 327 // if minSelectionIndex < 0, nothing is selected 328 // if minSelectionIndex > maxIndex, then nothing is selected (we are operating with an old selection context, most likely) 329 // if maxSelectionIndex < minSelectionIndex, _something_ funny is going on. Or there was a typo in the original code. 330 return minSelectionIndex >= 0 && maxIndex > minSelectionIndex && maxSelectionIndex >= minSelectionIndex; 325 331 } 326 332 … … 369 375 btnResolveMy.setVisible(ExpertToggleAction.isExpert()); 370 376 btnResolveTheir.setVisible(ExpertToggleAction.isExpert()); 377 ((ResolveAction) btnResolveMy.getAction()).valueChanged(null); 378 ((ResolveAction) btnResolveTheir.getAction()).valueChanged(null); 371 379 } 372 380 … … 529 537 } 530 538 } 531 UndoRedoHandler.getInstance().add(new SequenceCommand(name, commands)); 539 UndoRedoHandler.getInstance().add(new SequenceCommand(name, commands)); 532 540 refreshView(); 533 541 } -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/ConflictDialogTest.java
r17275 r18783 2 2 package org.openstreetmap.josm.gui.dialogs; 3 3 4 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; 4 5 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertNotNull;6 6 7 7 import java.awt.Color; 8 8 import java.awt.image.BufferedImage; 9 9 10 import org.junit.jupiter.api.extension.RegisterExtension;11 10 import org.junit.jupiter.api.Test; 12 11 import org.openstreetmap.josm.data.coor.LatLon; … … 19 18 import org.openstreetmap.josm.gui.dialogs.ConflictDialog.ConflictPainter; 20 19 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 21 import org.openstreetmap.josm.testutils.JOSMTestRules; 22 23 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 20 import org.openstreetmap.josm.testutils.annotations.Main; 21 import org.openstreetmap.josm.testutils.annotations.Projection; 24 22 25 23 /** 26 24 * Unit tests of {@link ConflictDialog} class. 27 25 */ 26 @Main 27 @Projection 28 28 class ConflictDialogTest { 29 30 /**31 * Setup tests32 */33 @RegisterExtension34 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")35 public JOSMTestRules test = new JOSMTestRules().main().projection();36 37 29 /** 38 30 * Unit test of {@link ConflictDialog#ConflictDialog}. … … 40 32 @Test 41 33 void testConflictDialog() { 42 assert NotNull(newConflictDialog());34 assertDoesNotThrow(ConflictDialog::new); 43 35 } 44 36
Note:
See TracChangeset
for help on using the changeset viewer.
