Changeset 15843 in josm


Ignore:
Timestamp:
2020-02-11T21:53:29+01:00 (5 years ago)
Author:
simon04
Message:

see #17109 - Autofilter: use dot as decimal separator

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/autofilter/AutoFilterRule.java

    r15842 r15843  
    44import java.text.DecimalFormat;
    55import java.util.Arrays;
     6import java.util.Locale;
    67import java.util.Objects;
    78import java.util.Optional;
     
    148149                // #17109, support values like 0.5 or 1.5 - level values are multiplied by 2 when parsing, values are divided by 2 for formatting
    149150                .setValueExtractor(s -> (int) (Double.parseDouble(s) * 2.))
    150                 .setValueFormatter(v -> DecimalFormat.getInstance().format(v / 2.)),
     151                .setValueFormatter(v -> DecimalFormat.getInstance(Locale.ROOT).format(v / 2.)),
    151152            new AutoFilterRule("layer", 16)
    152153                    .setDefaultValueSupplier(AutoFilterRule::defaultLayer),
  • trunk/test/unit/org/openstreetmap/josm/gui/autofilter/AutoFilterRuleTest.java

    r15842 r15843  
    66
    77import java.util.NoSuchElementException;
     8import java.util.stream.Collectors;
     9import java.util.stream.IntStream;
    810
    911import org.junit.Rule;
     
    4244        assertTagValuesForPrimitive(level, "way level=10;12-13", 20, 24, 25, 26);
    4345        assertTagValuesForPrimitive(level, "way level=0;0.5;1;1.5;2;2.5;3", 0, 1, 2, 3, 4, 5, 6);
     46        assertEquals("0 0.5 1 1.5 2 2.5 3",
     47                IntStream.of(0, 1, 2, 3, 4, 5, 6).mapToObj(level::formatValue).collect(Collectors.joining(" ")));
    4448    }
    4549
Note: See TracChangeset for help on using the changeset viewer.