Changeset 17809 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/StyleCache.java
r17805 r17809 46 46 47 47 if (selected) { 48 if (s.selectedStyle == null) { 49 s.selectedStyle = new DividedScale<>(); 50 } 51 s.selectedStyle.put(o, r); 48 s.selectedStyle = (s.selectedStyle == null ? new DividedScale<StyleElementList>() : s.selectedStyle).put(o, r); 52 49 } else { 53 if (s.plainStyle == null) { 54 s.plainStyle = new DividedScale<>(); 55 } 56 s.plainStyle.put(o, r); 50 s.plainStyle = (s.plainStyle == null ? new DividedScale<StyleElementList>() : s.plainStyle).put(o, r); 57 51 } 58 52 return s.intern(); … … 82 76 @Override 83 77 public boolean equals(Object obj) { 84 if (obj == null) { 85 return false; 86 } 87 if (getClass() != obj.getClass()) { 88 return false; 89 } 78 if (obj == null) return false; 79 if (getClass() != obj.getClass()) return false; 90 80 final StyleCache other = (StyleCache) obj; 91 81 return Objects.equals(plainStyle, other.plainStyle) && Objects.equals(selectedStyle, other.selectedStyle); -
trunk/test/functional/org/openstreetmap/josm/gui/mappaint/StyleCacheTest.java
r17625 r17809 14 14 15 15 import org.junit.jupiter.api.AfterAll; 16 import org.junit.jupiter.api.BeforeAll;17 16 import org.junit.jupiter.api.BeforeEach; 18 17 import org.junit.jupiter.api.Test; … … 53 52 @RegisterExtension 54 53 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 55 public JOSMTestRules test = new JOSMTestRules().preferences().projection().mapStyles().timeout(60000); 54 public JOSMTestRules test = new JOSMTestRules().main().preferences().projection().mapStyles().timeout(60000); 56 55 57 56 /** … … 59 58 * @throws Exception If an error occurred during load. 60 59 */ 61 @Before All62 public staticvoid load() throws Exception {60 @BeforeEach 61 public void load() throws Exception { 63 62 img = new BufferedImage(IMG_WIDTH, IMG_HEIGHT, BufferedImage.TYPE_INT_ARGB); 64 63 try (InputStream in = Compression.getUncompressedFileInputStream(new File("nodist/data/neubrandenburg.osm.bz2"))) { … … 158 157 StyleElementList sel = p.a; 159 158 assertNotNull(sel); 160 Integer k = counter.get(sel); 161 if (k == null) { 162 k = 0; 163 } 164 counter.put(sel, k + 1); 159 counter.merge(sel, 1, Integer::sum); 165 160 } 166 161 }
Note:
See TracChangeset
for help on using the changeset viewer.