Changeset 9672 in josm for trunk/test


Ignore:
Timestamp:
2016-01-29T19:53:36+01:00 (9 years ago)
Author:
Don-vip
Message:

fix #11685 - parse subsecond exif information correctly

Location:
trunk/test
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/tools/ExifReaderTest.java

    r9499 r9672  
    66
    77import java.io.File;
     8import java.io.IOException;
    89import java.text.DecimalFormat;
    910import java.text.ParseException;
     
    1617import org.junit.Before;
    1718import org.junit.Test;
     19import org.openstreetmap.josm.TestUtils;
    1820import org.openstreetmap.josm.data.coor.LatLon;
    1921import org.openstreetmap.josm.tools.date.DateUtilsTest;
     
    4951    /**
    5052     * Tests reading sub-seconds from the EXIF header
    51      * @throws ParseException  if {@link ExifReader#readTime} fails to parse date/time of sample file
     53     * @throws ParseException if {@link ExifReader#readTime} fails to parse date/time of sample file
    5254     */
    5355    @Test
     
    8082
    8183    /**
    82      * Test coordinates extraction
     84     * Test direction extraction
    8385     */
    8486    @Test
     
    8789        assertEquals(new Double(46.5), direction);
    8890    }
     91
     92    /**
     93     * Non-regression test for ticket <a href="https://josm.openstreetmap.de/ticket/11685">#11685</a>
     94     * @throws IOException if an error occurs during reading
     95     */
     96    @Test
     97    public void testTicket11685() throws IOException {
     98        File file = new File(TestUtils.getRegressionDataFile(11685, "2015-11-08_15-33-27-Xiaomi_YI-Y0030832.jpg"));
     99        String dateStr = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").format(ExifReader.readTime(file));
     100        assertEquals("2015-11-08T15:33:27.500", dateStr);
     101    }
    89102}
Note: See TracChangeset for help on using the changeset viewer.