Changeset 6422 in josm for trunk/test/unit/org/openstreetmap


Ignore:
Timestamp:
2013-11-29T00:10:15+01:00 (11 years ago)
Author:
simon04
Message:

see #9331 - allow custom formatters in SystemOfMeasurement methods

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/SystemOfMeasurementTest.java

    r5870 r6422  
    88import org.openstreetmap.josm.data.Preferences;
    99import org.openstreetmap.josm.gui.NavigatableComponent.SystemOfMeasurement;
     10
     11import java.text.DecimalFormat;
     12import java.text.DecimalFormatSymbols;
     13import java.util.Locale;
    1014
    1115/**
     
    6367    }
    6468
     69    @Test
     70    public void testGetDistTextLocalized() {
     71        final DecimalFormat format = new DecimalFormat("0.000", DecimalFormatSymbols.getInstance(Locale.GERMAN));
     72        assertEquals("0,001 m", NavigatableComponent.METRIC_SOM.getDistText(0.001, format, 1e-6));
     73        assertEquals("< 0,010 m", NavigatableComponent.METRIC_SOM.getDistText(0.001, format, 0.01));
     74        assertEquals("10,051 m", NavigatableComponent.METRIC_SOM.getDistText(10.0514, format, 0.01));
     75        assertEquals("10,052 m", NavigatableComponent.METRIC_SOM.getDistText(10.0515, format, 0.01));
     76        assertEquals("100,000 km", NavigatableComponent.METRIC_SOM.getDistText(100000.0, format, 0.01));
     77    }
     78
    6579    /**
    6680     * Test of {@link SystemOfMeasurement#getAreaText} method.
Note: See TracChangeset for help on using the changeset viewer.